query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
sequencelengths 0
101
| negative_scores
sequencelengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
---|---|---|---|---|---|---|
Calculate total size, in bytes, of: UTF16encoded string uint16 length of string (2 bytes) null terminator (2 bytes) | def size
self.data.length + 4
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def size(str)\n str.unpack(\"U*\").size\n end",
"def get_safe_size(s)\n safe_size = get_unsafe_size(s)\n while (safe_size.to_s(16).rjust(8, '0')).scan(/../).include?(\"00\")\n safe_size -= 1\n end\n\n safe_size\n end",
"def total_payload_size\n length + 16 * character_count\n end",
"def get_utf8_size(first_utf8_byte)\n return 1 if (first_utf8_byte < 128)\n raise \"Invalid variable UTF-8 byte encoded: #{first_utf8_byte} (is a UTF-16 character)\" if ((first_utf8_byte & 192) == 128)\n size = 2\n while ((first_utf8_byte & (1 << (7-size))) != 0)\n size += 1\n raise \"Invalid variable UTF-8 byte encoded: #{first_utf8_byte}\" if (size > 7)\n end\n return size\n end",
"def calculate_string_size_in_kb string\n total_bytes = 0\n string.each_byte {|b| total_bytes += 1}\n result = total_bytes.to_f / 1024.to_f\n end",
"def mylength str\n length = str.length\n str.unpack(\"U*\").each do |char|\n length = length + 1 if char > 255\n end\n length\nend",
"def length\n length = 0\n each{|s| length += s.bytesize}\n length\n end",
"def byte_size(); @data.byte_size + 4; end",
"def get_unsafe_size(s)\n 0xffffffff - s + 1\n end",
"def byte_size()\n @value.length * 4\n end",
"def byte_size()\n @value.length * 4\n end",
"def length(str)\n g_unpack(str).length\n end",
"def byte_size()\n if @record and RECORD_INFO[@record.type].size > 0 then\n RECORD_INFO[@record.type].size * @value.length\n else\n sum = 0\n @value.each do |val|\n sum += (val.length % 2 == 0) ? val.length : val.length + 1\n end\n sum\n end\n end",
"def length\n string.length\n end",
"def str_size\r\n return @pig_latin_str.size\r\n end",
"def length\n @string.length\n end",
"def size\n (@bit_length*@length*@count)/8.0\n end",
"def get_length_size\n return false if @data.empty?\n\n # High bits used for length type\n # Low bits used as first bits of length\n \n # 0xxxxxxx = 7 bit length\n # 10xxxxxx = 14 bit length\n # 110xxxxx = 21 bit length\n # 1110xxxx = 28 bit length\n # 11110000 = 32 bit length follows\n\n t = @data.unpack('C').first\n\n return 7 if t & 0b10000000 == 0\n return 14 if t & 0b01000000 == 0\n return 21 if t & 0b00100000 == 0\n return 28 if t & 0b00010000 == 0\n return 32 if t == 0b11110000\n\n raise ArgumentError, \"Invalid length type encoding\"\n end",
"def length()\n return to_s.size\n end",
"def get_maximum_utf8cstring_size(string)\n JavaScriptCore::Lib.JSStringGetMaximumUTF8CStringSize(string)\n end",
"def size_in_bytes\n ( file_length * 16 ) / 8\n end",
"def strlen\n return @container.length\n end",
"def length\n pack.length\n end",
"def get_length(string)\n JavaScriptCore::Lib.JSStringGetLength(string)\n end",
"def size\n @hash.size + @converted.size\n end",
"def size\n @data.bytesize\n end",
"def string_length(password)\n if password.size >= 10 && password.size < 17\n return 0\n else\n return password.size > 16 ? (16 - password.size) : 10 - password.size\n end\n end",
"def stringio_length(io)\n io.string.length\n end",
"def data_len_bytes()\n 2\n end",
"def data_len_bytes()\n 2\n end",
"def data_len_bytes()\n 2\n end",
"def bytesize(string)\n string.respond_to?(:bytesize) ? string.bytesize : string.length\n end",
"def as_size2( s = nil )\n prefix = %W(ТиБ ГиБ МиБ КиБ Б)\n s = (s || self).to_f\n i = prefix.length - 1\n while s > 512 && i > 0\n s /= 1024\n i -= 1\n end\n ((s > 9 || s.modulo(1) < 0.1 ? '%d' : '%.1f') % s) + ' ' + prefix[i]\n end",
"def length_prefixed_string(data)\n msg = data.encode(Encoding::UTF_8)\n # https://ruby-doc.org/core-1.9.3/Array.html#method-i-pack\n [msg.bytes.length].pack('V') + msg.force_encoding(Encoding::BINARY)\n end",
"def size\r\n @pack.size\r\n end",
"def data_len_bytes()\n 1\n end",
"def d_size\n uint64(header, 'size') / @blockSize\n end",
"def size\n @length / 4\n end",
"def getTorrentSize(infoHash)\n return @rpc.call('d.get_size_bytes', infoHash)\n end",
"def length_of_string(str)\n return str.length\n end",
"def get_data_size(iFormat)\n rDataSize = 0\n\n case iFormat\n when Wx::DF_TEXT\n # Add 1, otherwise it replaces last character with \\0x00\n rDataSize = @DataAsText.length + 1\n when DataObjectSelection.getDataFormat\n rDataSize = @Data.length\n else\n log_bug \"Asked unknown format for size: #{iFormat}\"\n end\n\n return rDataSize\n end",
"def _v(str)\n _f(str).length.to_s\n end",
"def used_bytes\n size = 0\n unless empty?\n actual_node = @tail_node\n while actual_node != nil do\n size += actual_node.value.value.length\n actual_node = actual_node.next_node\n end\n end\n size\n end",
"def sz\n self.to_s.size\n end",
"def calc_size\n return size unless translatable?\n translated_text.size + 8\n end",
"def u16\n next_bytes(2).unpack(\"S>\").first\n end",
"def rest_size\n p = @pos\n ss = @string.size\n if p < ss\n ss - p\n else\n 0\n end\n end",
"def read_string(data, offset, length, encoding)\n if \"UTF-16\".casecmp(encoding) == 0\n out = data[offset, length].unpack('v*').pack('U*')\n else\n out = data[offset, length].unpack('C*').pack('U*')\n end\n return out\n end",
"def get_utf16_of(character)\n character.encode('UTF-16BE').unpack('H*').first.upcase\nend",
"def output_length\n length_ptr = FFI::MemoryPointer.new(:size_t)\n Botan.call_ffi(:botan_mac_output_length, @ptr, length_ptr)\n length_ptr.read(:size_t)\n end",
"def size_in_byte\n return @size_in_byte\n end",
"def actual_length\n @transfer[:actual_length]\n end",
"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",
"def test_004_length()\n TestVals.each do |sVal|\n #\n # The length() method returns either the size of a bounded\n # bitstring, or the number of digits from the most significant\n # 1.\n #\n uLength = sVal.sub(/^0+(.)/, '\\1').length\n bLength = sVal.length\n bs = BitString.new(sVal)\n assert_equal(uLength,\n bs.length,\n \"Test unbounded '#{sVal}'.length => #{uLength}\")\n #\n # Now do the same check for the bounded version.\n #\n bs = BitString.new(sVal, sVal.length)\n bLength = sVal.length\n assert_equal(bLength,\n bs.length,\n \"Test bounded '#{sVal}'.length => #{bLength}\")\n end\n end",
"def size\n return nil if not @value\n return to_s.size\n end",
"def part_size_in_bytes\n data.part_size_in_bytes\n end",
"def length\n to_s.length\n end",
"def length (string)\n string.length\nend",
"def size\n to_payload.bytesize\n end",
"def size\n read.bytesize\n end",
"def char_length(offset, end_offset)\n if multibyte?\n @string.byteslice(offset, end_offset - offset).length\n else\n end_offset - offset\n end\n end",
"def length\n barcode.two_dimensional? ? encoding.first.length : encoding.length\n end",
"def length\n barcode.two_dimensional? ? encoding.first.length : encoding.length\n end",
"def size\n chunk_size = nil\n File.open(@file_name) do |file|\n file.seek(@offset + 4, IO::SEEK_CUR)\n case @size_length\n when 4\n chunk_size = file.read(@size_length).unpack('L').first\n when 2\n chunk_size = file.read(@size_length).unpack('S').first\n else\n raise \"Can't decode size field of length #{@size_length}\"\n end\n end\n chunk_size + @data_size_correction\n end",
"def message_length; complete_message.length; end",
"def length\n dump.length\n end",
"def length_of_string(string)\n return string.length\nend",
"def size\n @contents.bytes.size\n end",
"def digest_length\n decode[:length]\n end",
"def length\n do_num_bytes\n end",
"def length\n do_num_bytes\n end",
"def length\n do_num_bytes\n end",
"def size\n BitCounter.count(@val)\n end",
"def char_length(offset, end_offset)\n string.byteslice(offset, end_offset - offset).length\n end",
"def length_of_string(test_string)\n return test_string.length()\nend",
"def size\n self.dna_hash.size\n end",
"def size\n self.dna_hash.size\n end",
"def to_utf16\r\n Iconv.iconv(\"utf-16LE\", \"utf-8\", self).first + \"\\x00\\x00\"\r\n end",
"def size_syncsafe(bytes)\n c = bytes.unpack(\"C4\")\n c[0]*(0x80**3) +\n c[1]*(0x80**2) +\n c[2]*0x80 +\n c[3]\n end",
"def length\n length = 1 #@primary\n length += @extlang.length if @extlang\n length += 1 if @script\n length += 1 if @region\n length += @variants.length if @variants\n @extensions.each { |_,e| length += e.length+1 } if @extensions # length += @extenstions.to_a.flatten.length if @extensions\n length += @privateuse.length+1 if @privateuse\n length\n end",
"def header_length size\n size.to_s(16).length +\n CHUNK_SIGNATURE_HEADER.length +\n SIGNATURE_LENGTH +\n CLRF.length +\n size +\n CLRF.length\n end",
"def get_length(str)\n @str.length.to_i\n end",
"def word_size_char(string)\n\tcount = Hash.new(0)\n\tcount.merge!(word_sizes_correct(cleanup(string)))\n\tcount\nend",
"def size\n @content.bytesize\n end",
"def extract_size(io)\n io.size\n end",
"def size\n (contents || '').length\n end",
"def length_of_string(test_string)\n return test_string.length\nend",
"def length_of_string(test_string)\n return test_string.length\nend",
"def size\r\n self.data.length\r\n end",
"def size\n @data ? @data.size : header.sh_size\n end",
"def sizeof_format(format)\n length = 0\n format.scan(/(\\S_?)\\s*(\\d*)/).each do |directive,count|\n count = count.to_i\n count = 1 if count == 0\n \n length += case directive\n when 'A', 'a', 'C', 'c', 'Z', 'x' ; count\n when 'B', 'b' ; (count / 8.0).ceil\n when 'D', 'd', 'E', 'G' ; count * 8\n when 'e', 'F', 'f', 'g' ; count * 4\n when 'H', 'h' ; (count / 2.0).ceil\n when 'I', 'i', 'L', 'l', 'N', 'V' ; count * 4\n when 'n', 'S', 's', 'v' ; count * 2\n when 'Q', 'q' ; count * 8\n when 'X' ; count * -1\n else raise ArgumentError.new(\"#{directive} is not supported in sizeof_format\")\n end\n end\n \n length\n end",
"def size; '' end",
"def width\n chars.inject(0) { |length, char| length + (char.bytesize == 1 ? 1 : 2) }\n end",
"def length() end",
"def length() end",
"def length() end",
"def length() end",
"def size_in_bytes\n @grpc.size_bytes\n end",
"def size\n length\n end",
"def length\n size\n end"
] | [
"0.72015125",
"0.6801919",
"0.67692757",
"0.65911126",
"0.6521578",
"0.6501135",
"0.6395888",
"0.63870794",
"0.6385986",
"0.63798016",
"0.63798016",
"0.6294629",
"0.6282718",
"0.6190484",
"0.6150514",
"0.61168987",
"0.6111864",
"0.607908",
"0.6054241",
"0.6051185",
"0.6047707",
"0.6028401",
"0.60266256",
"0.59966844",
"0.5981025",
"0.5914112",
"0.58968455",
"0.5871628",
"0.5838356",
"0.58377755",
"0.58377755",
"0.57905036",
"0.57897097",
"0.57873344",
"0.57792366",
"0.57665765",
"0.57624656",
"0.57314235",
"0.5730647",
"0.569921",
"0.5697271",
"0.5667246",
"0.5660736",
"0.5659712",
"0.56457174",
"0.5635373",
"0.5626503",
"0.5621133",
"0.5612816",
"0.56121826",
"0.56058455",
"0.56038153",
"0.5602472",
"0.55943",
"0.55839837",
"0.55830145",
"0.5580222",
"0.55687827",
"0.55674356",
"0.55646896",
"0.55628777",
"0.5555595",
"0.5555595",
"0.5544431",
"0.55430764",
"0.55407166",
"0.553703",
"0.55358917",
"0.55349797",
"0.5531409",
"0.5507448",
"0.5507448",
"0.5506714",
"0.5492721",
"0.5487808",
"0.5487407",
"0.5487407",
"0.5485944",
"0.5484453",
"0.5479127",
"0.5477727",
"0.546624",
"0.54629976",
"0.5455286",
"0.54485387",
"0.54477286",
"0.543394",
"0.543394",
"0.5416867",
"0.5402771",
"0.5393859",
"0.5393234",
"0.53910756",
"0.53863823",
"0.53863823",
"0.53863823",
"0.53863823",
"0.53818715",
"0.53764486",
"0.53702223"
] | 0.5875803 | 27 |
Creates instances of the Aggregate functions and stores them in the function array. All aggregate call and summarize method calls operate on these function as a batch. | def create_functions
@ddl[:aggregate].each_with_index do |agg, _i|
output = agg[:args][0]
if contains_output?(output)
arguments = agg[:args][1]
format = (arguments.delete(:format) if arguments) || nil
begin
@functions << load_function(agg[:function]).new(output, arguments, format, @action)
rescue Exception => e # rubocop:disable Lint/RescueException
Log.error("Cannot create aggregate function '%s': %s" % [output, e])
@failed << {:name => output, :type => :startup}
end
else
Log.error("Cannot create aggregate function '%s'. '%s' has not been specified as a valid ddl output." % [output, output])
@failed << {:name => output, :type => :create}
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each_aggregate(&block)\n if block_given?\n @aggregates.each_function(&block)\n self\n else\n @aggregates.functions\n end\n end",
"def aggregate_function\n build_function(super, aggregate_constants)\n end",
"def aggregate_f(*args)\n aggregate_function.f(*args)\n end",
"def create_aggregate( name, arity, step, finalize, type=nil )\n case type\n when :numeric\n type = SQLite::API::NUMERIC\n when :text\n type = SQLite::API::TEXT\n when :args\n type = SQLite::API::ARGS\n end\n\n step_callback = proc do |func,*args|\n ctx = SQLite::API.aggregate_context( func )\n step.call( FunctionProxy.new( func, ctx ), *args )\n end\n\n finalize_callback = proc do |func|\n ctx = SQLite::API.aggregate_context( func )\n finalize.call( FunctionProxy.new( func, ctx ) )\n end\n\n SQLite::API.create_aggregate( @handle, name, arity,\n step_callback, finalize_callback )\n\n SQLite::API.function_type( @handle, name, type ) if type\n\n self\n end",
"def process_aggregates\n aggregates = new_collection\n\n unless assessment_group.scoring_type == 2 # do except for scoring type 'grades'\n aggregates.push new_aggregate('score','Total Score',@total_score)\n percentage = @total_score.zero? ? nil : ((@total_score / @total_max) * 100).round(2)\n aggregates.push new_aggregate('percentage','Total Percentage', percentage)\n aggregates.push new_aggregate('grade','Overall Grade',overall_grade_set.grade_string_for(percentage)) if overall_grade_set.present?\n end\n\n aggregates\n end",
"def aggregation(*args, &block)\n @aggregations ||= AggregationsCollection.new\n @aggregations.update args.first => Aggregation.new(*args, &block)\n self\n end",
"def create_aggregate_handler( handler )\n type = nil\n arity = -1\n\n type = handler.function_type if handler.respond_to?(:function_type)\n arity = handler.arity if handler.respond_to?(:arity)\n name = handler.name\n\n case type\n when :numeric\n type = SQLite::API::NUMERIC\n when :text\n type = SQLite::API::TEXT\n when :args\n type = SQLite::API::ARGS\n end\n\n step = proc do |func,*args|\n ctx = SQLite::API.aggregate_context( func )\n ctx[ :handler ] ||= handler.new\n ctx[ :handler ].step( FunctionProxy.new( func, ctx ), *args )\n end\n\n finalize = proc do |func|\n ctx = SQLite::API.aggregate_context( func )\n ctx[ :handler ] ||= handler.new\n begin\n ctx[ :handler ].finalize( FunctionProxy.new( func, ctx ) )\n rescue Exception => e\n STDERR.puts \"BUG: #{e.message} (#{e.class.name})\"\n STDERR.puts \"*** WARNING **** WARNING **** WARNING **** WARNING ****\"\n STDERR.puts \"*** THIS EXCEPTION SHOULD BE FATAL, BUT DUE TO\"\n STDERR.puts \"*** FRAGILITY IN THE FINALIZE CALLBACK IT WILL NOT\"\n STDERR.puts \"*** ABORT THE PROGRAM. PLEASE NOTIFY THE DEVELOPER OF\"\n STDERR.puts \"*** THIS APPLICATION AND ASK THEM TO CORRECT THE\"\n STDERR.puts \"*** PROBLEM.\"\n STDERR.puts \"*** WARNING **** WARNING **** WARNING **** WARNING ****\"\n STDERR.puts e.backtrace.join( \"\\n\" )\n end\n end\n\n SQLite::API.create_aggregate( @handle, name, arity, step, finalize )\n SQLite::API.function_type( @handle, name, type ) if type\n\n self\n end",
"def aggregate\n @aggregate ||= klass.build.tap do |aggregate|\n aggregate.instance_variable_set(:@id, id)\n aggregate.instance_variable_set(:@local_version, version)\n aggregate.instance_variable_set(:@persisted_version, version)\n events.each { |event| EventApplicator.apply_event!(aggregate, event) }\n end\n end",
"def aggregate\n public_send aggregate_name\n end",
"def procedures\n Array.new([\n databases, archives, lambda { package! }, compressors,\n encryptors, lambda { split! }, storages\n ])\n end",
"def call_functions(reply)\n @functions.each do |function|\n Log.debug(\"Calling aggregate function %s for result\" % function)\n begin\n function.process_result(reply[:data][function.output_name], reply)\n rescue Exception => e # rubocop:disable Lint/RescueException\n Log.error(\"Could not process aggregate function for '%s': %s\" % [function.output_name, e])\n @failed << {:name => function.output_name, :type => :process_result}\n @functions.delete(function)\n end\n end\n end",
"def create_aggregate(aggregate)\n raise MethodNotImplemented\n end",
"def apply(_aggregate)\n raise NotImplementedError\n end",
"def aggregate(array, type = 'normal')\n raise \"Need Array not #{array.class}\" unless array.class == Array\n raise 'Two Arrays are not the same size' unless size == array.size\n\n case type\n when 'normal'\n return aggregate_normal(array)\n when 'max'\n return aggregate_max(array)\n when 'min'\n return aggregate_min(array)\n when 'avg'\n return aggregate_avg(array)\n when 'median'\n return aggregate_median(array)\n end\n end",
"def new_aggregate(type,name, value)\n Models::Aggregate.new(\n :type => type,\n :parent_name => assessment_group.display_name,\n :parent_type => 'AssessmentGroup',\n :name => name,\n :value => value\n )\n end",
"def targetsAggregate _obj, _args\n \"_obj targetsAggregate _args;\" \n end",
"def apply(aggregate)\n raise NotImplementedError\n end",
"def aggregate\n []\n end",
"def summarize\n summary = @functions.map do |function|\n begin\n function.summarize\n rescue Exception => e # rubocop:disable Lint/RescueException\n Log.error(\"Could not summarize aggregate result for '%s': %s\" % [function.output_name, e])\n @failed << {:name => function.output_name, :type => :summarize}\n nil\n end\n end\n\n summary.reject(&:nil?).sort do |x, y|\n x.result[:output] <=> y.result[:output]\n end\n end",
"def aggregate\n klass.collection.group(\n :key => field_list,\n :cond => selector,\n :initial => { :count => 0 },\n :reduce => Javascript.aggregate\n )\n end",
"def batch_badge_creator(array)\n array.collect do |name|\n badge_maker(name)\n end\nend",
"def store_aggregates\n raise NotImplementedError\n end",
"def aggregate op, type = :fixnum\n check_closed\n\n aggregation_impl op, type\n end",
"def replace_aggregate!(&block)\n map! do |op|\n case\n when op.respond_to?(:aggregate?) && op.aggregate?\n yield op\n when op.respond_to?(:replace_aggregate!)\n op.replace_aggregate!(&block) \n else\n op\n end\n end\n self\n end",
"def aggregateData(aggregator)\n @timeStamps = aggregator.aggregate(@timeStamps, ChartDirector::AggregateFirst)\n @highData = aggregator.aggregate(@highData, ChartDirector::AggregateMax)\n @lowData = aggregator.aggregate(@lowData, ChartDirector::AggregateMin)\n @openData = aggregator.aggregate(@openData, ChartDirector::AggregateFirst)\n @closeData = aggregator.aggregate(@closeData, ChartDirector::AggregateLast)\n @volData = aggregator.aggregate(@volData, ChartDirector::AggregateSum)\n end",
"def batch_badge_creator(badges)\n array=Array.new\n badges. each do |individuals|\n array=array.push(badge_maker(individuals))\n end\n return array;\n\nend",
"def aggregates\n @aggregates\n end",
"def aggregates\n self.class.instance_variable_get(:@aggregates) || {}\n end",
"def aggregate\n #response = Result.collection.map_reduce(self.map_fn(), _reduce(), :raw => true, :out => {:inline => true}, :query => {:execution_id => id})\n response = Result.where(execution_id: id).map_reduce(self.map_fn(), self.query.reduce).out(inline: true).raw()\n results = response['results']\n if results\n self.aggregate_result = {}\n results.each do |result|\n result = prettify_generated_result(result) if self.query.generated? && result['value']['rereduced']\n self.aggregate_result[result['_id']] = result['value']\n end\n save!\n end\n end",
"def aggregateAndWriteDocuments(collection, aggregateArray)\n collection.aggregate(aggregateArray)\n end",
"def aggregations\n @aggregations ||= AggregationSet.new\n end",
"def batch_badge_creator(array)\n badges = []\n array.each { |name| badges << badge_maker(name)}\n badges\nend",
"def aggregate(request)\n end",
"def multi(functions)\n\t\t\t\t\t\t\tself.multicaller.call(functions)\n\t\t\t\t\t\tend",
"def aggregate_and_create(oftype, ts = Time.now.floor)\n Octo::Enterprise.each do |enterprise|\n calculate(enterprise.id, oftype, ts)\n end\n end",
"def method_missing(method_sym, *arguments, &block)\n if event_method?(method_sym)\n send_event_to_aggregate(method_sym, *arguments, &block)\n else\n @_aggregate.send method_sym, *arguments, &block\n end\n end",
"def post_process(aggregate)\n aggregate\n end",
"def aggregate(accessor, *params)\n self.inject([]) { |all, child| all << child.send(accessor, *params) }.flatten || []\n end",
"def aggregation(operation)\n return self unless operation\n clone.tap do |query|\n unless aggregating?\n query.pipeline.concat(query.selector.to_pipeline)\n query.pipeline.concat(query.options.to_pipeline)\n query.aggregating = true\n end\n yield(query.pipeline)\n end\n end",
"def add(arr)\n init_member(arr.count) if @sample_count == 0\n update_mean_and_r([arr])\n end",
"def apply_functions(fun, series)\n expr = CGI::unescape(fun)\n\n # pass values needed for hitting Cassandra in\n control = { :cass_client => cass_client }\n control[:start_ts], control[:end_ts] = get_start_end :one_day\n\n Hastur::Aggregation.evaluate(expr, series, control)\n end",
"def retrieve_aggregates\n fail ArgumentError, \"Invalid range type '#{range_type}'\" unless %w(year month week day hour).include? range_type\n scope = LineAggregate.\n where(:function => function).\n where(:range_type => 'normal').\n where(:account => account.try(:to_s)).\n where(:partner_account => partner_account.try(:to_s)).\n where(:code => code.try(:to_s)).\n where(:filter => filter.inspect).\n where(LineAggregate.arel_table[range_type].not_eq(nil))\n @aggregates = scope.each_with_object({}) do |result, hash|\n hash[result.key] = formatted_amount(result.amount)\n end\n end",
"def add_aggregations\n add_collection_aggregation\n add_tag_aggregations\n end",
"def batch_badge_creator(array) \n badge_messages = []\n array.each do |object| \n badge_message = badge_maker(object)\n badge_messages.push(badge_message)\n end\n return badge_messages\nend",
"def fill_aggregator_queue(type)\n case type\n when :chat\n 15.times do |day|\n data_in = {'from' => handle, 'rcpt' => 'sender', 'incoming' => 1, 'program' => 'skype', 'content' => 'test message'}\n evidence_in = Evidence.target(target.id).create!(da: Time.now.to_i + day*86400, aid: agent.id, type: :chat, data: data_in)\n\n data_out = {'from' => 'sender', 'rcpt' => handle, 'incoming' => 0, 'program' => 'skype', 'content' => 'test message'}\n evidence_out = Evidence.target(target.id).create!(da: Time.now.to_i + day*86400, aid: agent.id, type: :chat, data: data_out)\n\n evidence_in.add_to_aggregator_queue\n evidence_out.add_to_aggregator_queue\n end\n when :call\n 15.times do |day|\n data_in = {'from' => handle, 'rcpt' => 'sender', 'incoming' => 1, 'program' => 'skype', 'content' => 'test message'}\n evidence_in = Evidence.target(target.id).create!(da: Time.now.to_i + day*86400, aid: agent.id, type: :call, data: data_in)\n\n evidence_in.add_to_aggregator_queue\n end\n end\n end",
"def all\n functions_from_postgres.map { |function| to_fx_function(function) }\n end",
"def batch_badge_creator(array)\n badge_messages = []\n array.each {|name| badge_messages << badge_maker(name)}\n badge_messages\nend",
"def array_from_functions(*args)\n counts = Array.new(26).fill(0)\n for arg in args\n if arg.is_a?(Array)\n arg.each do |o| @add_word[o].call(counts); end\n else\n p arg\n @add_word[arg].call(counts);\n end\n end\n counts\n end",
"def batch(*args, &block)\n self.instance_exec(*args, &block)\n end",
"def run_aggregation\n GRADES.each_with_index do |grade, idx|\n classifier[grade].each_pair do |metric, values|\n all_values = values\n all_values += classifier[GRADES[idx + 1]][metric] if (idx + 1) < GRADES.count\n\n classifier[grade][metric] =\n if all_values.count <= 2\n values.max || 0\n else\n (all_values.sum / all_values.count).round(2)\n end\n end\n end\n end",
"def enable_aggregation! &block\n cpc = 'org.apache.hadoop.hbase.coprocessor.AggregateImplementation'\n add_coprocessor! cpc, &block unless has_coprocessor?(cpc)\n end",
"def initialize(array_clases=ObjectSpace.each_object(Class).to_a)\n @array_clases = array_clases\n @dynamic_classes = []\n @aspects = []\n define_listener_dynamic_methods\n end",
"def initialize(id,method,op_count,closed_sum,expanded_sum,trace)\n @result = [id,method,op_count,closed_sum,expanded_sum,trace]\n end",
"def get_form_summarize_methods\n [\n [\"count\"],\n [\"sum\"],\n [\"maximum\"],\n [\"minimum\"]\n ]\n end",
"def batch_badge_creator(attendee)\n # the below code would work more effectively but since I found it somewhere else I decided to use another method to prove to myself I could do it on my own. Since the collect method saves the results automatically to a new array, it doesnt require the extra step I needed to do with the .each method.\n # attendee.collect do |i|\n # badge_maker(i)\n # end\n\n badges =[]\n attendee.each {|i| badges.push badge_maker(i)}\n return badges\nend",
"def aggregateAndFetchDocuments(collection, aggregateArray)\n return collection.aggregate(aggregateArray)\n end",
"def batch_badge_creator(attendees)\r\n batch_attendees = []\r\n attendees.each do | name |\r\n batch_attendees << badge_maker(name) # add the name to each iteration of the badge_maker method\r\n end\r\n return batch_attendees\r\nend",
"def transproc\n Functions[:group, @name, @keys]\n end",
"def to_a\n results = @allocations\n\n @wheres.each do |where|\n results = where.call(results)\n end\n\n # First apply group_by\n results = @group_by.call(results) if @group_by\n\n # Apply each mapper\n @mappers.each do |mapper|\n results = mapper.call(results)\n end\n\n results\n end",
"def aggregate_values(rows)\n # Convert rows into hash where each key is a column name and the each\n # value is an array of values for that column\n cols = OrderedHash.new\n rows.each do |row|\n row.each do |k,v|\n cols[k] ||= []\n cols[k] << v\n end\n end\n\n # Loop through each column, applying an aggregate proc if one exists\n # to the array of column values. If a proc does not exist we take the\n # last value from the array.\n result = cols.inject(OrderedHash.new) do |hsh, (col, vals)|\n hsh[col] = if @aggregators[col]\n @aggregators[col].call(vals)\n else\n vals.last\n end\n hsh\n end\n\n Row[result]\n end",
"def batch_badge_creator(speaker_array)\n speaker_badge_array = []\n speaker_array.each do |speaker| speaker_badge_array << badge_maker(speaker)\n end\n speaker_badge_array\nend",
"def aggregator(agg = nil, opts = EMPTY_HASH)\n @aggregator = if agg.nil? && !defined?(@aggregator)\n Aggregators.default\n elsif agg.respond_to?(:new)\n agg.new(filter: filter, **opts)\n elsif agg\n Aggregators.resolve(agg, filter: filter, **opts)\n else\n @aggregator\n end\n end",
"def initialize_math_functions\n Math.methods(false).each do |method|\n math_method = Math.method(method)\n add_function(\n name: method,\n type: :numeric,\n signature: [:numeric],\n body: ->(*args) { math_method.call(*args) }\n )\n end\n end",
"def create_aggregates(db: EventSourcery::Postgres.config.event_store_database,\n table_name: EventSourcery::Postgres.config.aggregates_table_name)\n db.create_table(table_name) do\n uuid :aggregate_id, primary_key: true\n column :version, :bigint, default: 1\n end\n end",
"def call\n missing_metrics.each(&method(:create_metric))\n missing_methods.each(&method(:create_method))\n end",
"def baselineable\n key :type, Integer\n key :ts, Time\n key :uid, String\n\n key :val, Float\n\n # Generate the aggregator methods\n generate_aggregators { |ts, method|\n type = method_names_type_counter(method)\n aggregate type, ts\n }\n end",
"def sum_create\n total = add_create.reduce(:+)\nend",
"def post_analytics_evaluations_aggregates_query_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AnalyticsApi.post_analytics_evaluations_aggregates_query ...\"\n end\n \n \n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling AnalyticsApi.post_analytics_evaluations_aggregates_query\" if body.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/analytics/evaluations/aggregates/query\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'EvaluationAggregateQueryResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AnalyticsApi#post_analytics_evaluations_aggregates_query\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def batch_badge_creator(names)\n names.collect { |array_value| badge_maker(array_value) }\nend",
"def use_aggregate_factory(aggregate_factory)\n @aggregate_factory = aggregate_factory\n end",
"def sum_upon_sums(array)\n\nend",
"def aggregate(type, ts)\n Octo::Enterprise.each do |enterprise|\n aggregate_baseline enterprise.id, type, ts\n end\n end",
"def execute_batch(aggregated_input, batch)\n executor = AsyncTaskExecutor.new(batch, container: container)\n executor.call(aggregated_input)\n end",
"def averages(array)\n\t\taverages = []\n\t\taverages << mean(array)\n\t\taverages << median(array)\n\t\taverages << mode(array)\n\t\taverages << length(array)\n\tend",
"def aggregate_tags!\n map = \"function() {\n if (!this.#{tags_field}) {\n return;\n }\n\n for (index in this.#{tags_field}) {\n emit(this.#{tags_field}[index], 1);\n }\n }\"\n\n reduce = \"function(previous, current) {\n var count = 0;\n\n for (index in current) {\n count += current[index]\n }\n\n return count;\n }\"\n\n map_reduce_options = { :out => tags_aggregation_collection }.\n merge(tag_aggregation_options)\n collection.master.map_reduce(map, reduce, map_reduce_options)\n end",
"def batch_badge_creator(names_array)\n badges_array = []\n\n for name in names_array do\n badges_array.push(badge_maker(name))\n end\n\n badges_array\nend",
"def sum_array(array)\n # Your code here\nend",
"def func7\n arr = []\n for i in (0..9) do\n arr.push(func6)\n end\n return arr\nend",
"def batch_badge_creator(attendees)\n new = []\n attendees.each do | name |\n new << badge_maker(name)\n end\nnew\nend",
"def aggregate_after_grouping?; @aggregate_after_grouping; end",
"def batch_badge_creator(attendees)\n attendees.collect do |attendee|\n badge_maker(attendee)\n end\nend",
"def aggregate(value)\n @query_hash[AGGREGATE][value] = value\n self\n end",
"def get_aggregate aggregate_query\n ensure_not_closed!\n ensure_service!\n\n return enum_for :get_aggregate, aggregate_query unless block_given?\n\n results = service.run_aggregate_query aggregate_query.parent_path,\n aggregate_query.to_grpc,\n transaction: transaction_or_create\n results.each do |result|\n extract_transaction_from_result! result\n next if result.result.nil?\n yield AggregateQuerySnapshot.from_run_aggregate_query_response result\n end\n end",
"def collect_operations(ops, aggregator = {})\n ops.each_with_object(aggregator) do |(field, value), operations|\n operations[database_field_name(field)] = value.mongoize\n end\n end",
"def visit_axiom_aggregate_sum(sum)\n aggregate_function_sql(SUM, sum)\n end",
"def aggregate_class_lifelines events\n lifelines = method_events(events).group_by(&:class_name).map {|cn,es| class_commit_monthly_timeline(cn,es).map(&:second) }\n lifelines.reduce {|aggregate,es| aggregate.zip(es).map { |x,y| [x || 0, y || 0] }.map {|x,y| x + y }}\nend",
"def aggregate_calls(metrics,parent_meta)\n categories = categories(metrics)\n aggregates = {}\n categories.each do |cat|\n agg_meta=ScoutRails::MetricMeta.new(\"#{cat}/all\")\n agg_meta.scope = parent_meta.metric_name\n agg_stats = ScoutRails::MetricStats.new\n metrics.each do |meta,stats|\n if meta.metric_name =~ /\\A#{cat}\\//\n agg_stats.combine!(stats) \n end\n end # metrics.each\n aggregates[agg_meta] = agg_stats unless agg_stats.call_count.zero?\n end # categories.each \n aggregates\n end",
"def multi_calc(fcn_vec, options={})\n return nil if fcn_vec.empty?\n fcn_vec.each { |function| send(function, options.merge(:plot_results => true)) }\n aggregate_all(symbol, options.merge(:multiplot => true, :with => 'financebars'))\n clear_results\n end",
"def sum_of_sums(array)\r\nend",
"def output_batch(batch)\n # Build a mapping of { output_plugin => [events...]}\n output_events_map = Hash.new { |h, k| h[k] = [] }\n batch.each do |event|\n # We ask the AST to tell us which outputs to send each event to\n # Then, we stick it in the correct bin\n\n # output_func should never return anything other than an Array but we have lots of legacy specs\n # that monkeypatch it and return nil. We can deprecate \"|| []\" after fixing these specs\n (output_func(event) || []).each do |output|\n output_events_map[output].push(event)\n end\n end\n # Now that we have our output to event mapping we can just invoke each output\n # once with its list of events\n output_events_map.each do |output, events|\n output.multi_receive(events)\n end\n \n @filter_queue_client.add_output_metrics(batch)\n end",
"def function(*args)\n Function.new(self, *args)\n end",
"def function(*args)\n Function.new(self, *args)\n end",
"def set_custom_functions(input_funcs)\n @funcs_ptr = FFI::MemoryPointer.new(SassC::Lib::SassCFunctionDescriptor, input_funcs.count)\n @gc_staph = []\n\n input_funcs.each.with_index do |(signature, block), i|\n fn = SassC::Lib::SassCFunctionDescriptor.new(@funcs_ptr + i * SassC::Lib::SassCFunctionDescriptor.size)\n\n str = FFI::MemoryPointer.from_string(signature)\n fn[:signature] = str\n \n func = FFI::Function.new(SassC::Lib::SassValue.by_value, [SassC::Lib::SassValue.by_value, :pointer]) do |arg, cookie|\n ruby_arg = arg.to_ruby \n ruby_result = block.call(ruby_arg)\n SassC::Lib::SassValue.new.from_ruby(ruby_result) \n end\n fn[:function] = func\n\n @gc_staph << func\n @gc_staph << str\n end\n\n self[:c_functions] = @funcs_ptr\n self[:num_c_functions] = input_funcs.size \n end",
"def output_functions\n @global_functions.each do |name, func|\n\n # create a function scope for each defined function and compile it appropriately.\n # also pass it the current global scope for further lookup of variables used\n # within the functions body that aren't defined there (global variables and those,\n # that are defined in the outer scope of the function's)\n @e.func(name, func.rest?) { compile_eval_arg(FuncScope.new(func, @global_scope), func.body) }\n\n end\n end",
"def aggregate(enum)\n finalize(\n enum.inject(least){|memo,tuple| \n happens(memo, tuple)\n })\n end",
"def group_by(*args)\n @group_keys = args\n\n @group_by = Proc.new do |allocations|\n getters = attribute_getters(@group_keys)\n\n allocations.group_by do |allocation|\n getters.map { |getter| getter.call(allocation) }\n end\n end\n\n self\n end",
"def basic_11 (array_process)\n return { \"max\" => array_process.max, \"min\" => array_process.min, \"average\" => basic_6(array_process) }\nend",
"def my_map(proc)\n return_array = []\n self.my_each do |item|\n return_array << proc.call(item)\n end\n return_array\n end",
"def batch_badge_creator(attendees)\n attendees.collect do |name| \n badge_maker(name)\n end\nend",
"def aggregations\n @aggregations ||= {}.merge(facet_field_aggregations).merge(facet_query_aggregations).merge(facet_pivot_aggregations).merge(facet_json_aggregations)\n end"
] | [
"0.6710387",
"0.6633545",
"0.62691563",
"0.5913287",
"0.583792",
"0.5835885",
"0.58287156",
"0.57873803",
"0.5761962",
"0.57185614",
"0.5621458",
"0.5589315",
"0.558751",
"0.55674505",
"0.5546459",
"0.55322516",
"0.552728",
"0.5504985",
"0.5459525",
"0.5420436",
"0.5417802",
"0.5393383",
"0.53751594",
"0.53282946",
"0.53245044",
"0.5301698",
"0.5289323",
"0.5247713",
"0.5243433",
"0.5185987",
"0.5182364",
"0.51642627",
"0.516354",
"0.515279",
"0.5150453",
"0.5142973",
"0.51381886",
"0.5127064",
"0.5112518",
"0.5111053",
"0.5110166",
"0.50687957",
"0.5060623",
"0.50414896",
"0.5033223",
"0.5011026",
"0.499625",
"0.4993814",
"0.495035",
"0.49336162",
"0.49321875",
"0.49306226",
"0.49274477",
"0.49272892",
"0.49078357",
"0.49076852",
"0.48973846",
"0.48692003",
"0.48571223",
"0.4855106",
"0.48263758",
"0.48206735",
"0.48129988",
"0.48024088",
"0.47980207",
"0.47887325",
"0.47816506",
"0.47760463",
"0.47651017",
"0.4761833",
"0.47420132",
"0.47401404",
"0.4732273",
"0.47172815",
"0.47155434",
"0.4711963",
"0.47076455",
"0.47045377",
"0.47031066",
"0.4695437",
"0.46819383",
"0.46787056",
"0.46747372",
"0.4652003",
"0.46514845",
"0.4644818",
"0.46442336",
"0.46434432",
"0.46412072",
"0.46351036",
"0.4626032",
"0.4626032",
"0.46175635",
"0.46164",
"0.4615757",
"0.46133953",
"0.46085483",
"0.4608255",
"0.46051902",
"0.4603027"
] | 0.6507355 | 2 |
Check if the function param is defined as an output for the action in the ddl | def contains_output?(output)
@ddl[:output].keys.include?(output)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_params\n raise 'No output defined. Please use --output option.' if @outputs.empty?\n end",
"def output? ; !!@output ; end",
"def done?\n !@output_id.nil?\n end",
"def arguments_valid?\n ret = false\n ret = true unless (@options.action == nil)\n end",
"def action_argument_required?\n !AVAILABLE_ACTIONS.empty?\n end",
"def output?\n !@output.empty?\n end",
"def determine_action(input)\n case (input.to_i)\n when 1 then print_all_tasks\n when 2 then retrieve_and_print_worktime\n when 3 then print_tasks_in_interval\n when 4 then output_to_csv\n when 5\n @values = nil\n return false\n else\n handle_wrong_option\n end\n return true\n end",
"def available_action?(action_name); end",
"def validate_output(env, receiver, value)\n _output = get_type(env, output, receiver)\n unless _output.match(env, value)\n raise MethodInterfaceError.new(:output, name, [_output], [value])\n end\n end",
"def returns_something?; @return_type || !@returned_arguments.empty? end",
"def is_valid?\n false if not @output.include? 'Generating' or @output.include? 'Failed'\n true\n end",
"def ok? \n @funct == nil ? (return false) : (return true)\n end",
"def validate_action?(action)\n\t\tres = subset?([action], @action_list)\n\t\tif ! res\n\t\t\tputs \"Action #{action}, is not valid\"\n\t\tend\n\n\t return res\n\tend",
"def eligible_for_supplimental_output?\r\n [BatchStatus::OUTPUT_READY, BatchStatus::OUTPUT_GENERATED, BatchStatus::OUTPUT_EXCEPTION].include?(status)\r\n end",
"def passed?\n @impacts.empty?\n end",
"def exist_output_data?(env, rule_condition, inputs, outputs, data_null_tuples)\n result = false\n rule_condition.outputs.each_with_index do |condition, i|\n _condition = condition.eval(env)\n # remove\n if _condition.operation == :remove\n case _condition.distribution\n when :all\n if not(outputs[i].nil? or outputs[i].select{|data| _condition.match(data.name)}.empty?)\n result = true\n end\n when :each\n if not(outputs[i].nil?) and _condition.match(outputs[i].first.name)\n result = true\n end\n end\n end\n break if result\n end\n return result\n end",
"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",
"def file_is_output? file\n belongs_to.respond_to?(:output) && belongs_to.output.to_s == file\n end",
"def required_secondary_output\n if (needs_to_relay_associations? || requires_accepted_name_assignment?) &&\n secondary_output.nil?\n errors.add(:secondary_output, \"Must have a secondary output\")\n return false\n end\n true\n end",
"def determine_valid_action\n\n end",
"def acceptable_return?(return_val, element_name); end",
"def argument?; end",
"def response?(params); end",
"def action?(*action)\n \t\taction.include?(params[:action])\n \tend",
"def accepts_outcome_data?\n !!@ext_params['outcome_data_values_accepted']\n end",
"def successful?\n output_exists? && expected_output_path\n end",
"def check(params)\n false\n end",
"def valid_action?(value)\n action_names.include?(value)\n end",
"def show_export?\n ((params[:action] == 'edit') && (controller_name == \"charts\"))\n end",
"def output_port?\n @type == :output\n end",
"def has_param?(name)\n\n end",
"def parameter_rule?; end",
"def success?(*) end",
"def has_argument_variations?\n @variations.size > 1\n end",
"def visible_action?(name)\n true #['perform', action_name].include? name\n end",
"def passed?; end",
"def passed?; end",
"def passed?; end",
"def is_function()\n res = super(context,self)\n return res\n end",
"def check_params; true; end",
"def has_analysis_outputs?(analysis_name, visualization_name=nil, cluster_name=nil, annotation_name=nil)\n self.get_analysis_outputs(analysis_name, visualization_name, cluster_name, annotation_name).any?\n end",
"def has_results?\n !(name == 'aggregate' &&\n pipeline.find {|op| op.keys.include?('$out') })\n end",
"def output?(instruction_type)\n @state.auto_output && [:sysex, :message, :process].include?(instruction_type)\n end",
"def any_args?\n @any_args\n end",
"def any_args?\n @any_args\n end",
"def command_given?\n !@command.empty?\n end",
"def result?\n self.type == :result\n end",
"def has_work?\n @action_name && @input && @options\n end",
"def qualified_for_output_generation? \r\n !batch_bundle.detect { |batch| batch.incomplete? }\r\n end",
"def has_return_value?\n @return_value.type != VoidType\n end",
"def success?() end",
"def has_actions?\n if self.actions == []\n return false\n else\n return true\n end\n end",
"def single_actions?\n false\n end",
"def expects_argument?\n config[:argument] && config[:argument] != :optional\n end",
"def despined?(*)\n end",
"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",
"def output=(_arg0); end",
"def output=(_arg0); end",
"def output=(_arg0); end",
"def output=(_arg0); end",
"def output=(_arg0); end",
"def output=(_arg0); end",
"def output=(_arg0); end",
"def output=(_arg0); end",
"def output=(_arg0); end",
"def output=(_arg0); end",
"def output=(_arg0); end",
"def output=(_arg0); end",
"def not_exist_output_data?(env, rule_condition, inputs, outputs, data_null_tuples)\n result = false\n rule_condition.outputs.each_with_index do |condition, i|\n _condition = condition.eval(env)\n if _condition.operation == :write or _condition.operation == :touch\n # FIXME : each tuples are empty or single data tuple, this is confusing\n case _condition.distribution\n when :all\n if outputs[i].nil? or outputs[i].select{|data| _condition.match(data.name)}.empty?\n unless _condition.accept_nonexistence? and data_null_tuples.any?{|tuple| tuple.position == i}\n result = true\n end\n end\n when :each\n if outputs[i].nil? or (outputs[i].kind_of?(Array) and outputs[i].empty?) or not(_condition.match(outputs[i][0].name))\n unless _condition.accept_nonexistence? and data_null_tuples.any?{|tuple| tuple.position == i}\n result = true\n end\n end\n end\n end\n break if result\n end\n return result\n end",
"def supported_for_action?(field)\n return true if field['action'].nil? || @action.nil?\n return field['action'].include?(@action.to_s) if field['action'].is_a?(Array)\n\n field['action'] == @action.to_s\n end",
"def has_action?(action)\n @actions.include? action\n end",
"def any_action?\n admin?\n end",
"def should_print?\n !@suppress_output\n end",
"def qualified_for_supplimental_output_generation?\r\n !batch_bundle_for_supplemental_output.detect { |batch| !batch.eligible_for_supplimental_output? }\r\n end",
"def true(_argvs)\n return nil\n end",
"def _valid_action_name?(action_name); end",
"def callback_executed?(payload)\n payload.get(:executed) == true\nend",
"def accepts_outcome_status_of_result?\n accepted_outcome_types.member?('statusofResult')\n end",
"def scenario_check(flag_param, lang_choice)\n if flag_param == 0\n if lang_choice == 1\n puts 'No such scenarios found'\n else\n puts \"Aucun scénario de ce type n'a été trouvé\"\n end\n return 0\n elsif flag_param == 1\n if lang_choice == 1\n puts 'The desired output is saved in output_file.txt'\n else\n puts 'La sortie souhaitée est enregistrée dans output_file.txt'\n end\n return 0\n else\n return -1\n end\n end",
"def action_method?(name); end",
"def action_allowed?(action_name, user)\n return false\n end",
"def no_echo_parameter_without_default?(cfn_model, key_to_check)\n if key_to_check.is_a? Hash\n if key_to_check.key? 'Ref'\n if cfn_model.parameters.key? key_to_check['Ref']\n parameter = cfn_model.parameters[key_to_check['Ref']]\n\n return truthy?(parameter.noEcho) && parameter.default.nil?\n else\n return false\n end\n else\n return false\n end\n end\n # String or anything weird will fall through here\n false\nend",
"def args?\n\t\treturn !self.fields.empty?\n\tend",
"def action?(*action)\n action.include?(params[:action])\n end",
"def action?(*action)\n action.include?(params[:action])\n end",
"def valid?(output)\n output.any? { |line| line =~ /^END RequestId:/ }\n end",
"def reporting_schema_via_param_or_feature_flag\n param_flag = ActiveRecord::Type::Boolean.new.deserialize(report_params[:v2])\n user_flag = current_admin.feature_enabled?(:reporting_schema_v2)\n return param_flag unless param_flag.nil?\n user_flag\n end",
"def block_should_be_exported?\n export_state = block_header_arguments[':exports']\n case\n when ['both', 'code', nil, ''].include?(export_state)\n true\n when ['none', 'results'].include?(export_state)\n false\n end\n end",
"def no_parameters?\n @parameters.nil? or @parameters.empty?\n end",
"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",
"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",
"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",
"def special_action?\n SPECIAL_ACTIONS.include?(action.to_sym)\n end",
"def arguments_valid?\n true \n # to do\n end",
"def valid?\n !!outcode\n end",
"def boolean?(action)\n @record.respond_to? \"#{action}?\".to_sym\n end",
"def can?(action)\n @allowed_fields.include? action\n end",
"def option?(param)\n param[0] == \"-\"\n end",
"def verify_params\n Validate::params_match @func, @current_param\n end",
"def check_output\n if (@options[:output].split('') & %w{# / : * ? ' < > | & $ ,}).any?\n raise CheripicArgError.new 'please choose a name tag that contains ' +\n 'alphanumeric characters, hyphen(-) and underscore(_) only'\n end\n @options[:hmes_frags] = \"#{@options[:output]}_selected_hme_variants.txt\"\n @options[:bfr_frags] = \"#{@options[:output]}_selected_bfr_variants.txt\"\n [@options[:hmes_frags], @options[:bfr_frags]].each do | file |\n if File.exist?(file)\n raise CheripicArgError.new \"'#{file}' file exists \" +\n 'please choose a different name tag to be included in the output file name'\n end\n end\n end"
] | [
"0.612776",
"0.6070327",
"0.597946",
"0.5908288",
"0.5878903",
"0.58391726",
"0.5827675",
"0.5748225",
"0.56671315",
"0.5663992",
"0.562403",
"0.5589231",
"0.5547613",
"0.5543209",
"0.55371636",
"0.55096775",
"0.5495103",
"0.5474193",
"0.5468145",
"0.54485077",
"0.5446196",
"0.54409283",
"0.5440315",
"0.5431538",
"0.5410434",
"0.5408901",
"0.54030406",
"0.5390482",
"0.53625077",
"0.53598976",
"0.5359504",
"0.535431",
"0.53377587",
"0.5331923",
"0.5328652",
"0.53264284",
"0.53264284",
"0.53264284",
"0.53164",
"0.5296742",
"0.5290475",
"0.5267507",
"0.5261201",
"0.52569973",
"0.52569973",
"0.52566373",
"0.5255465",
"0.5238113",
"0.52358377",
"0.52338284",
"0.5228567",
"0.5221554",
"0.5212924",
"0.5210561",
"0.5204211",
"0.51846594",
"0.51834077",
"0.51834077",
"0.51834077",
"0.51834077",
"0.51834077",
"0.51834077",
"0.51834077",
"0.51834077",
"0.51834077",
"0.51834077",
"0.51834077",
"0.51834077",
"0.51828474",
"0.5182159",
"0.5178826",
"0.51677656",
"0.51597846",
"0.5157922",
"0.51564634",
"0.5140331",
"0.5140163",
"0.5133149",
"0.51305133",
"0.51287967",
"0.5126559",
"0.511759",
"0.51095325",
"0.5091808",
"0.5091174",
"0.5083133",
"0.5072088",
"0.50677294",
"0.5065135",
"0.50650793",
"0.50650793",
"0.50650793",
"0.50570345",
"0.50552386",
"0.5051393",
"0.5048522",
"0.50454545",
"0.5045208",
"0.5039799",
"0.5039494"
] | 0.6811118 | 0 |
Call all the appropriate functions with the reply data received from RPC::Client | def call_functions(reply)
@functions.each do |function|
Log.debug("Calling aggregate function %s for result" % function)
begin
function.process_result(reply[:data][function.output_name], reply)
rescue Exception => e # rubocop:disable Lint/RescueException
Log.error("Could not process aggregate function for '%s': %s" % [function.output_name, e])
@failed << {:name => function.output_name, :type => :process_result}
@functions.delete(function)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def receive_data data\n @buf.extract(data).each do |packet|\n begin\n request = JSON::parse(packet)\n log.debug { request }\n case request['method']\n when \"relay_tx\"\n return handle_relay_tx(request, *request['params'])\n when \"monitor\"\n respond(request, handle_monitor(request, *request['params']))\n else\n if respond_to?(\"handle_#{request['method']}\")\n respond(request, send(\"handle_#{request['method']}\", *request['params']))\n else\n respond(request, { error: \"unknown command: #{request['method']}. send 'help' for help.\" })\n end\n end\n rescue\n respond(request, { error: $!.message })\n end\n end\n rescue Exception\n p $!; puts *$@\n end",
"def remote_call(rpc_method, request_args)\n self.execute(rpc_method, request_args)\n self.last_response\n end",
"def execute_rpc_call(content)\n connection = RPCClient.new(@configuration.server_queue_name,@configuration.server_addr,@configuration.server_port)\n answer = connection.call(content)\n connection.stop\n return answer\n end",
"def runOperation(msg, client)\n case msg.getConfig(\"type\")\n when 0; edgebReflex(msg.getMessage(), client)\n when 1; fillBack(msg)\n when 2; edgeuUpdate(msg.getMessage())\n when 3; pingCallBack(msg)\n when 4; tracerouteCallBack(msg)\n when 5; sendMsgCallBack(msg, client)\n else STDERR.puts \"ERROR: INVALID MESSAGE \\\"#{msg}\\\"\"\n end\nend",
"def receive_response(response); end",
"def process_response\n case @msg.sip_method\n when :INVITE\n if client_transaction = @msg.connection.class.invite_client_transactions[@msg.via_branch_id]\n client_transaction.receive_response(@msg)\n return\n end\n when :ACK\n when :CANCEL\n if client_transaction = @msg.connection.class.invite_client_transactions[@msg.via_branch_id]\n client_transaction.receive_response_to_cancel(@msg)\n return\n end\n else\n if client_transaction = @msg.connection.class.non_invite_client_transactions[@msg.via_branch_id]\n client_transaction.receive_response(@msg)\n return\n end\n end\n log_system_debug \"ignoring a response non matching a client transaction (#{@msg.sip_method} #{@msg.status_code})\" if $oversip_debug\n end",
"def recv_rpc &block\n payload = nil\n errors = []\n xml_retval = nil\n @connection.recv do |ins|\n reader = XML::Reader.io(ins)\n while (reader.read)\n case reader.name\n when 'rpc-error'\n errors.push(RPCError.new(reader))\n when 'ok'\n ok = true\n when 'data'\n if (reader.node_type == XML::Reader::TYPE_ELEMENT)\n ok = true\n if (block)\n block.call(reader)\n else\n xml_retval = reader.read_inner_xml\n end\n end\n end\n end\n if (errors.length > 0)\n raise RPCException.new(errors)\n end\n if !ok\n raise RPCException(\"Failed to receive proper RPC reply\")\n end\n end\n xml_retval\n end",
"def do_request(request, want_reply, data); end",
"def rpc_send(method_name, *args, &block)\n return yield if rpc_in_server_mode? || rpc_enabled?\n begin\n rpc_client << [method_name, args]\n response = rpc_client.read\n rescue => e\n #FIXME: error handling as an error occured at the transport layer\n end\n if response.erred?\n #will have response.message = {:em => 'error msg', :eb => ['error backtrace'], :om => 'original message'}\n end\n response.message\n end",
"def query_callback_common(row_data)\n view = @requests[row_data[:cookie].address]\n\n if row_data[:rc] == :success\n value = JSON.parse(row_data[:row].read_string(row_data[:nrow]), DECODE_OPTIONS)\n\n if (row_data[:rflags] & Ext::RESPFLAGS[:resp_f_final]) > 0\n # We can assume this is JSON\n view.received_final(value)\n else\n view.received(value)\n end\n else\n error_klass = Error.lookup(row_data[:rc])\n if error_klass == Error::HttpError\n http_resp = row_data[:htresp]\n view.error error_klass.new(body_text(http_resp))\n else\n view.error error_klass.new\n end\n end\n end",
"def rpc_invoke server_id, msg, &block\n @client.rpc_invoke server_id, msg, &block\n end",
"def method_missing(called,*args)\n # alex 2013.03.05: a little bit of cleanup to make it useful for for > 1 call\n @data = String.new\n @_data_waiting = false\n # cleanup end\n send_str = called.to_s.gsub(\"_\", \"\")\n args.each { |arg| send_str += \" #{CommuniGate::CliParser.to_cgp(arg)}\"} unless args.empty?\n _reconnect if Time.new > (@_connected + 295) #timeout is 5 mins so this gives us 5 secs of error room\n _send(send_str)\n return _parse_output if @_data_waiting\n end",
"def cmdh_update_resp2(msg_details)\n @log.debug \"UPDATERESPTWO handler\"\n info = YAML::load(msg_details)\n case info[:type] \n when :platf_update\n # need a platform update\n @log.debug \"Platform update is needed\"\n str = \"ATTENZIONE: questo client necessita di un aggiornamento manuale per giocare in internet.\\n\"\n str += \" Vai su cuperativa.invido.it per maggiorni informazioni.\\n\"\n str += \" Senza una versione recente, il gioco in rete non funziona.\\n\"\n str += \" *********** L'ultima versione aggiornata di cuperativa si scarica da: **************\\n\"\n str += \" #{info[:link_platf]}\\n\"\n str += \" *********************************************************\\n\"\n @cup_gui.log_sometext(str) \n #close connection\n @socket_srv.close if @socket_srv\n return\n when :nothing\n # no update, client is OK\n @log.debug \"Client already updated\"\n strtext = u\"Il programma U+00e8 giU+00e0 all'ultima versione.\\n\"\n @cup_gui.log_sometext(strtext)\n return\n when :appli_update\n # need to update the application\n server_name = info[:server].gsub('http://', \"\")\n package_name = info[:file ]\n updater = ClientUpdaterCtrl.new\n updater.set_package_src(server_name, package_name)\n updater.gui_progress = @cup_gui\n updater.net_controller = self\n updater.info_package = info\n begin \n #updater.install_package\n @model_net_data.event_cupe_raised(:ev_startupdate)\n updater.install_package_question(@model_net_data)\n rescue\n @cup_gui.log_sometext(\"ERRORE: Update non riuscito\\n\")\n @cup_gui.log_sometext(\"Riprova l'update, oppure installa la versione completa aggiornata di cuperativa (www.invido.it).\\n\")\n @socket_srv.close if @socket_srv\n end\n else\n @log.error 'Update type not recognized'\n end#case\n end",
"def invoke_request(rpc_method, *args)\n 0.upto(args.size).each { |i| args[i] = args[i].to_s if args[i].is_a?(Symbol) }\n message = RequestMessage.new :method => rpc_method,\n :args => args,\n :headers => @message_headers\n\n # we serialize / unserialze messages to ensure local node complies\n # to same json-rpc restrictions as other nodes\n message = RequestMessage.new :message => message.to_s,\n :headers => @message_headers\n\n result = Dispatcher.dispatch_request(message.jr_method,\n :method_args => message.jr_args,\n :headers => @message_headers,\n :rjr_node => self,\n :rjr_node_id => @node_id,\n :rjr_node_type => @node_type,\n :rjr_callback =>\n LocalNodeCallback.new(:node => self,\n :headers => @message_headers))\n response = ResponseMessage.new(:id => message.msg_id,\n :result => result,\n :headers => @message_headers)\n\n # same comment on serialization/unserialization as above\n response = ResponseMessage.new(:message => response.to_s,\n :headers => @message_headers)\n return Dispatcher.handle_response(response.result)\n end",
"def reply\n end",
"def message(event)\n req = Message.from_wire(event.data)\n\n if req.type == \"rpc\" then\n # Execute the requested method and return the result\n # Do it asynchronously so as not to hold up the EM-loop while the command is running\n @thread_pool.perform do\n json_req = req.json_request\n logger.debug { \"RPC request\\n#{json_req}\" }\n json_response = @handler.new(req).handle(json_req)\n EM.next_tick { ws.send(Response.new(json_response, req.id).to_wire) }\n end\n\n elsif req.type == \"rpc_result\" then\n # Pass the result back to the caller\n res = req.json_response\n logger.debug { \"RPC_RESULT for request id [#{req.id}]\\n#{res}\" }\n @responses[req.id].response = res\n\n elsif req.type == \"connect\" then\n # Agent request to CONNECT to the manager\n # will only be received by the server-end of the channel\n logger.debug { \"CONNECT request #{req.id}\"}\n ret = @handler.new(req).connect(req.json_request, self)\n if ret.kind_of? JsonResponse then\n ws.send(Response.new(ret, req.id).to_wire)\n else\n ws.send(Response.new(JsonResponse.new(\"success\"), req.id).to_wire)\n end\n\n end\n end",
"def dispatch(method, retype, args)\n result = self.send(\"handle_#{method}\".to_sym, args)\n result_key = Chassis.exit_after_current_dispatch ? :last_result : :result\n case retype\n when :json\n [result_key, [:raw, result.to_json]]\n when :pure\n [result_key, result]\n else\n raise \"Unknown response type: #{retype}\"\n end\n rescue Exception => e\n if e.instance_of?(SystemExit)\n exit\n elsif Chassis.exception_handler\n begin\n Chassis.exception_handler.call(e)\n rescue Exception => e2\n [:error, e2.message + \"\\n\\n\" + e2.backtrace.join(\"\\n\")]\n end\n else\n [:error, e.message + \"\\n\\n\" + e.backtrace.join(\"\\n\")]\n end\n end",
"def call(method, *args) rpc_execute(method, *args) end",
"def rpc(action, args={})\n company = @company\n username = @user\n password = @password\n url = \"https://#{company}.logicmonitor.com/santaba/rpc/#{action}?\"\n args.each_pair do |key, value|\n url << \"#{key}=#{value}&\"\n end\n url << \"c=#{company}&u=#{username}&p=#{password}\"\n uri = URI(url)\n begin\n http = Net::HTTP.new(uri.host, 443)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n req = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(req)\n return response.body\n rescue SocketError => se\n puts \"There was an issue communicating with #{url}. Please make sure everything is correct and try again. Exiting\"\n puts se.message\n exit 3\n rescue Error => e\n puts \"There was an issue.\"\n puts e.message\n puts \"Exiting\"\n exit 4\n end\n return nil\nend",
"def call(m_name, *args) \n @method_name = m_name\n @params = args\n finished = false\n attempt_count = 0\n proxy_url = build_proxy_url\n puts \"Service URL\\n\\t#{@url}\"\n puts \"Proxy URL:\\n\\t#{proxy_url}\"\n puts \"\\n\\n\"\n opts = {}\n #opts[\"protocol.http.basic_auth\"] = [service_url, user_name, password]\n opts['protocol.http.proxy'] = proxy_url\n \n #client = ActionWebService::Client::XmlRpc.new(@api, @url, :proxy => proxy_url)\n client = ActionWebService::Client::Soap.new(@api, @url, :driver_options => opts) \n args.insert(0, @key)\n args.insert(1, @src_system_code)\n while not finished\n begin\n attempt_count += 1\n if attempt_count > 3\n raise \"Cannot communicate with server\"\n end\n @results = client.send(@method_name.to_sym, *args)\n if @results\n finished = true\n end\n rescue Net::HTTPError => e\n puts e.response\n sleep 10\n raise \n rescue Exception\n sleep 10\n raise \n end\n end\n @results\n end",
"def execute(rpc_method, request_args)\n @last_request = request(rpc_method, request_args)\n\n _service_class.client.__send__(rpc_method, @last_request) do |c|\n\n # In the event of service failure, raise the error.\n c.on_failure do |error|\n raise ActiveRemoteError, error.message\n end\n\n # In the event of service success, assign the response.\n c.on_success do |response|\n @last_response = response\n end\n end\n end",
"def dispatch(msg)\n case msg.command\n when LINK_ESTABLISHING\n ret=on_link_establishing(msg)\n when LINK_ESTABLISHED\n ret=on_link_established(msg)\n when LINK_FAILED\n ret=on_link_failed(msg)\n when LINK_CLOSING\n ret=on_link_closing(msg)\n when LINK_CLOSED\n ret=on_link_closed(msg)\n when RECV_MESSAGE\n ret=on_recv_message(msg)\n when RECV_MESSAGE_BROKEN\n ret=on_recv_message_broken(msg)\n when RECV_MESSAGE_KILL\n ret=on_recv_message_kill(msg)\n when RECV_MESSAGE_PING\n ret=on_recv_message_ping(msg)\n when RECV_MESSAGE_PONG\n ret=on_recv_message_pong(msg)\n when RECV_MESSAGE_ERROR\n ret=on_recv_message_error(msg)\n when RECV_MESSAGE_NOTICE\n ret=on_recv_message_notice(msg)\n when RECV_RPL_INIT\n ret=on_recv_rpl_init(msg)\n when RECV_RPL_TRACELINK\n ret=on_recv_rpl_tracelink(msg)\n when RECV_RPL_TRACECONNECTING\n ret=on_recv_rpl_traceconnecting(msg)\n when RECV_RPL_TRACEHANDSHAKE\n ret=on_recv_rpl_tracehandshake(msg)\n when RECV_RPL_TRACEUNKNOWN\n ret=on_recv_rpl_traceunknown(msg)\n when RECV_RPL_TRACEOPERATOR\n ret=on_recv_rpl_traceoperator(msg)\n when RECV_RPL_TRACEUSER\n ret=on_recv_rpl_traceuser(msg)\n when RECV_RPL_TRACESERVER\n ret=on_recv_rpl_traceserver(msg)\n when RECV_RPL_TRACENEWTYPE\n ret=on_recv_rpl_tracenewtype(msg)\n when RECV_RPL_STATSLINKINF\n ret=on_recv_rpl_statslinkinf(msg)\n when RECV_RPL_STATSCOMMANDS\n ret=on_recv_rpl_statscommands(msg)\n when RECV_RPL_STATSCLINE\n ret=on_recv_rpl_statscline(msg)\n when RECV_RPL_STATSNLINE\n ret=on_recv_rpl_statsnline(msg)\n when RECV_RPL_STATSILINE\n ret=on_recv_rpl_statsiline(msg)\n when RECV_RPL_STATSKLINE\n ret=on_recv_rpl_statskline(msg)\n when RECV_RPL_STATSYLINE\n ret=on_recv_rpl_statsyline(msg)\n when RECV_RPL_ENDOFSTATS\n ret=on_recv_rpl_endofstats(msg)\n when RECV_RPL_UMODEIS\n ret=on_recv_rpl_umodeis(msg)\n when RECV_RPL_STATSLLINE\n ret=on_recv_rpl_statslline(msg)\n when RECV_RPL_STATSUPTIME\n ret=on_recv_rpl_statsuptime(msg)\n when RECV_RPL_STATSOLINE\n ret=on_recv_rpl_statsoline(msg)\n when RECV_RPL_STATSHLINE\n ret=on_recv_rpl_statshline(msg)\n when RECV_RPL_LUSERCLIENT\n ret=on_recv_rpl_luserclient(msg)\n when RECV_RPL_LUSEROP\n ret=on_recv_rpl_luserop(msg)\n when RECV_RPL_LUSERUNKNOWN\n ret=on_recv_rpl_luserunknown(msg)\n when RECV_RPL_LUSERCHANNELS\n ret=on_recv_rpl_luserchannels(msg)\n when RECV_RPL_LUSERME\n ret=on_recv_rpl_luserme(msg)\n when RECV_RPL_ADMINME\n ret=on_recv_rpl_adminme(msg)\n when RECV_RPL_ADMINLOC1\n ret=on_recv_rpl_adminloc1(msg)\n when RECV_RPL_ADMINLOC2\n ret=on_recv_rpl_adminloc2(msg)\n when RECV_RPL_ADMINEMAIL\n ret=on_recv_rpl_adminemail(msg)\n when RECV_RPL_TRACELOG\n ret=on_recv_rpl_tracelog(msg)\n when RECV_RPL_NONE\n ret=on_recv_rpl_none(msg)\n when RECV_RPL_AWAY\n ret=on_recv_rpl_away(msg)\n when RECV_RPL_USERHOST\n ret=on_recv_rpl_userhost(msg)\n when RECV_RPL_ISON\n ret=on_recv_rpl_ison(msg)\n when RECV_RPL_UNAWAY\n ret=on_recv_rpl_unaway(msg)\n when RECV_RPL_NOWAWAY\n ret=on_recv_rpl_nowaway(msg)\n when RECV_RPL_WHOISUSER\n ret=on_recv_rpl_whoisuser(msg)\n when RECV_RPL_WHOISSERVER\n ret=on_recv_rpl_whoisserver(msg)\n when RECV_RPL_WHOISOPERATOR\n ret=on_recv_rpl_whoisoperator(msg)\n when RECV_RPL_WHOWASUSER\n ret=on_recv_rpl_whowasuser(msg)\n when RECV_RPL_ENDOFWHO\n ret=on_recv_rpl_endofwho(msg)\n when RECV_RPL_WHOISIDLE\n ret=on_recv_rpl_whoisidle(msg)\n when RECV_RPL_ENDOFWHOIS\n ret=on_recv_rpl_endofwhois(msg)\n when RECV_RPL_WHOISCHANNELS\n ret=on_recv_rpl_whoischannels(msg)\n when RECV_RPL_LISTSTART\n ret=on_recv_rpl_liststart(msg)\n when RECV_RPL_LIST\n ret=on_recv_rpl_list(msg)\n when RECV_RPL_LISTEND\n ret=on_recv_rpl_listend(msg)\n when RECV_RPL_CHANNELMODEIS\n ret=on_recv_rpl_channelmodeis(msg)\n when RECV_RPL_NOTOPIC\n ret=on_recv_rpl_notopic(msg)\n when RECV_RPL_TOPIC\n ret=on_recv_rpl_topic(msg)\n when RECV_RPL_INVITING\n ret=on_recv_rpl_inviting(msg)\n when RECV_RPL_SUMMONING\n ret=on_recv_rpl_summoning(msg)\n when RECV_RPL_VERSION\n ret=on_recv_rpl_version(msg)\n when RECV_RPL_WHOREPLY\n ret=on_recv_rpl_whoreply(msg)\n when RECV_RPL_NAMREPLY\n ret=on_recv_rpl_namreply(msg)\n when RECV_RPL_LINKS\n ret=on_recv_rpl_links(msg)\n when RECV_RPL_ENDOFLINKS\n ret=on_recv_rpl_endoflinks(msg)\n when RECV_RPL_ENDOFNAME\n ret=on_recv_rpl_endofname(msg)\n when RECV_RPL_BANLIST\n ret=on_recv_rpl_banlist(msg)\n when RECV_RPL_ENDOFBANLIST\n ret=on_recv_rpl_endofbanlist(msg)\n when RECV_RPL_ENDOFWHOWAS\n ret=on_recv_rpl_endofwhowas(msg)\n when RECV_RPL_INFO\n ret=on_recv_rpl_info(msg)\n when RECV_RPL_MOTD\n ret=on_recv_rpl_motd(msg)\n when RECV_RPL_ENDOFINFO\n ret=on_recv_rpl_endofinfo(msg)\n when RECV_RPL_MOTDSTART\n ret=on_recv_rpl_motdstart(msg)\n when RECV_RPL_ENDOFMOTD\n ret=on_recv_rpl_endofmotd(msg)\n when RECV_RPL_YOUREOPER\n ret=on_recv_rpl_youreoper(msg)\n when RECV_RPL_REHASHING\n ret=on_recv_rpl_rehashing(msg)\n when RECV_RPL_TIME\n ret=on_recv_rpl_time(msg)\n when RECV_RPL_USERS\n ret=on_recv_rpl_users(msg)\n when RECV_RPL_ENDOFUSERS\n ret=on_recv_rpl_endofusers(msg)\n when RECV_RPL_NOUSERS\n ret=on_recv_rpl_nousers(msg)\n when RECV_ERR_NOSUCHNICK\n ret=on_recv_err_nosuchnick(msg)\n when RECV_ERR_NOSUCHSERVE\n ret=on_recv_err_nosuchserve(msg)\n when RECV_ERR_NOSUCHCHANNEL\n ret=on_recv_err_nosuchchannel(msg)\n when RECV_ERR_CANNOTSENDTOCHAN\n ret=on_recv_err_cannotsendtochan(msg)\n when RECV_ERR_TOOMANYCHANNELS\n ret=on_recv_err_toomanychannels(msg)\n when RECV_ERR_WASNOSUCHNICK\n ret=on_recv_err_wasnosuchnick(msg)\n when RECV_ERR_TOOMANYTARGETS\n ret=on_recv_err_toomanytargets(msg)\n when RECV_ERR_NOORIGIN\n ret=on_recv_err_noorigin(msg)\n when RECV_ERR_NORECIPIENT\n ret=on_recv_err_norecipient(msg)\n when RECV_ERR_NOTEXTTOSEND\n ret=on_recv_err_notexttosend(msg)\n when RECV_ERR_NOTOPLEVE\n ret=on_recv_err_notopleve(msg)\n when RECV_ERR_WILDTOPLEVEL\n ret=on_recv_err_wildtoplevel(msg)\n when RECV_ERR_UNKNOWNCOMMAND\n ret=on_recv_err_unknowncommand(msg)\n when RECV_ERR_NOMOTD\n ret=on_recv_err_nomotd(msg)\n when RECV_ERR_NOADMININFO\n ret=on_recv_err_noadmininfo(msg)\n when RECV_ERR_FILEERROR\n ret=on_recv_err_fileerror(msg)\n when RECV_ERR_NONICKNAMEGIVEN\n ret=on_recv_err_nonicknamegiven(msg)\n when RECV_ERR_ERRONEUSNICKNAME\n ret=on_recv_err_erroneusnickname(msg)\n when RECV_ERR_NICKNAMEINUSE\n ret=on_recv_err_nicknameinuse(msg)\n when RECV_ERR_NICKCOLLISION\n ret=on_recv_err_nickcollision(msg)\n when RECV_ERR_USERNOTINCHANNEL\n ret=on_recv_err_usernotinchannel(msg)\n when RECV_ERR_NOTONCHANNE\n ret=on_recv_err_notonchanne(msg)\n when RECV_ERR_USERONCHANNEL\n ret=on_recv_err_useronchannel(msg)\n when RECV_ERR_NOLOGIN\n ret=on_recv_err_nologin(msg)\n when RECV_ERR_SUMMONDISABLED\n ret=on_recv_err_summondisabled(msg)\n when RECV_ERR_USERSDISABLED\n ret=on_recv_err_usersdisabled(msg)\n when RECV_ERR_NOTREGISTERED\n ret=on_recv_err_notregistered(msg)\n when RECV_ERR_NEEDMOREPARAM\n ret=on_recv_err_needmoreparam(msg)\n when RECV_ERR_ALREADYREGISTRE\n ret=on_recv_err_alreadyregistre(msg)\n when RECV_ERR_NOPERMFORHOST\n ret=on_recv_err_nopermforhost(msg)\n when RECV_ERR_PASSWDMISMATCH\n ret=on_recv_err_passwdmismatch(msg)\n when RECV_ERR_YOUREBANNEDCREEP\n ret=on_recv_err_yourebannedcreep(msg)\n when RECV_ERR_KEYSET\n ret=on_recv_err_keyset(msg)\n when RECV_ERR_CHANNELISFULL\n ret=on_recv_err_channelisfull(msg)\n when RECV_ERR_UNKNOWNMODE\n ret=on_recv_err_unknownmode(msg)\n when RECV_ERR_INVITEONLYCHAN\n ret=on_recv_err_inviteonlychan(msg)\n when RECV_ERR_BANNEDFROMCHAN\n ret=on_recv_err_bannedfromchan(msg)\n when RECV_ERR_BADCHANNELKEY\n ret=on_recv_err_badchannelkey(msg)\n when RECV_ERR_NOPRIVILEGES\n ret=on_recv_err_noprivileges(msg)\n when RECV_ERR_CHANOPRIVSNEEDED\n ret=on_recv_err_chanoprivsneeded(msg)\n when RECV_ERR_CANTKILLSERVER\n ret=on_recv_err_cantkillserver(msg)\n when RECV_ERR_NOOPERHOST\n ret=on_recv_err_nooperhost(msg)\n when RECV_ERR_UMODEUNKNOWNFLAG\n ret=on_recv_err_umodeunknownflag(msg)\n when RECV_ERR_USERSDONTMATCH\n ret=on_recv_err_usersdontmatch(msg)\n when RECV_CMND_UNKNOWN\n ret=on_recv_cmnd_unknown(msg)\n when RECV_CMND_PASS\n ret=on_recv_cmnd_pass(msg)\n when RECV_CMND_NICK\n ret=on_recv_cmnd_nick(msg)\n when RECV_CMND_USER\n ret=on_recv_cmnd_user(msg)\n when RECV_CMND_SERVER\n ret=on_recv_cmnd_server(msg)\n when RECV_CMND_OPER\n ret=on_recv_cmnd_oper(msg)\n when RECV_CMND_QUIT\n ret=on_recv_cmnd_quit(msg)\n when RECV_CMND_SQUIT\n ret=on_recv_cmnd_squit(msg)\n when RECV_CMND_JOIN\n ret=on_recv_cmnd_join(msg)\n when RECV_CMND_PART\n ret=on_recv_cmnd_part(msg)\n when RECV_CMND_MODE\n ret=on_recv_cmnd_mode(msg)\n when RECV_CMND_TOPIC\n ret=on_recv_cmnd_topic(msg)\n when RECV_CMND_NAMES\n ret=on_recv_cmnd_names(msg)\n when RECV_CMND_LIST\n ret=on_recv_cmnd_list(msg)\n when RECV_CMND_INVITE\n ret=on_recv_cmnd_invite(msg)\n when RECV_CMND_KICK\n ret=on_recv_cmnd_kick(msg)\n when RECV_CMND_VERSION\n ret=on_recv_cmnd_version(msg)\n when RECV_CMND_STATAS\n ret=on_recv_cmnd_statas(msg)\n when RECV_CMND_LINK\n ret=on_recv_cmnd_link(msg)\n when RECV_CMND_TIME\n ret=on_recv_cmnd_time(msg)\n when RECV_CMND_CONNECT\n ret=on_recv_cmnd_connect(msg)\n when RECV_CMND_TRACE\n ret=on_recv_cmnd_trace(msg)\n when RECV_CMND_ADMIN\n ret=on_recv_cmnd_admin(msg)\n when RECV_CMND_INFO\n ret=on_recv_cmnd_info(msg)\n when RECV_CMND_PRIVMSG\n ret=on_recv_cmnd_privmsg(msg)\n when RECV_CMND_NOTICE\n ret=on_recv_cmnd_notice(msg)\n when RECV_CMND_WHO\n ret=on_recv_cmnd_who(msg)\n when RECV_CMND_WHOIS\n ret=on_recv_cmnd_whois(msg)\n when RECV_CMND_WHOWAS\n ret=on_recv_cmnd_whowas(msg)\n when RECV_CMND_KILL\n ret=on_recv_cmnd_kill(msg)\n when RECV_CMND_PING\n ret=on_recv_cmnd_ping(msg)\n when RECV_CMND_PONG\n ret=on_recv_cmnd_pong(msg)\n when RECV_CMND_ERROR\n ret=on_recv_cmnd_error(msg)\n when RECV_CMND_AWAY\n ret=on_recv_cmnd_away(msg)\n when RECV_CMND_REHASH\n ret=on_recv_cmnd_rehash(msg)\n when RECV_CMND_RESTART\n ret=on_recv_cmnd_restart(msg)\n when RECV_CMND_SUMMON\n ret=on_recv_cmnd_summon(msg)\n when RECV_CMND_USERS\n ret=on_recv_cmnd_users(msg)\n when RECV_CMND_WALLOPS\n ret=on_recv_cmnd_wallops(msg)\n when RECV_CMND_USERHOST\n ret=on_recv_cmnd_userhost(msg)\n when RECV_CMND_ISON\n ret=on_recv_cmnd_ison(msg)\n when RECV_CMND_CTCP_QUERY\n ret=on_recv_cmnd_ctcp_query(msg)\n when RECV_CMND_CTCP_QUERY_UNKNOWN\n ret=on_recv_cmnd_ctcp_query_unknown(msg)\n when RECV_CMND_CTCP_QUERY_PING\n ret=on_recv_cmnd_ctcp_query_ping(msg)\n when RECV_CMND_CTCP_QUERY_ECHO\n ret=on_recv_cmnd_ctcp_query_echo(msg)\n when RECV_CMND_CTCP_QUERY_TIME\n ret=on_recv_cmnd_ctcp_query_time(msg)\n when RECV_CMND_CTCP_QUERY_VERSION\n ret=on_recv_cmnd_ctcp_query_version(msg)\n when RECV_CMND_CTCP_QUERY_CLIENTINFO\n ret=on_recv_cmnd_ctcp_query_clientinfo(msg)\n when RECV_CMND_CTCP_QUERY_USERINFO\n ret=on_recv_cmnd_ctcp_query_userinfo(msg)\n when RECV_CMND_CTCP_QUERY_ACTION\n ret=on_recv_cmnd_ctcp_query_action(msg)\n when RECV_CMND_CTCP_QUERY_DCC\n ret=on_recv_cmnd_ctcp_query_dcc(msg)\n when RECV_CMND_CTCP_ANSWER\n ret=on_recv_cmnd_ctcp_answer(msg)\n when RECV_CMND_CTCP_ANSWER_UNKNOWN\n ret=on_recv_cmnd_ctcp_answer_unknown(msg)\n when RECV_CMND_CTCP_ANSWER_PING\n ret=on_recv_cmnd_ctcp_answer_ping(msg)\n when RECV_CMND_CTCP_ANSWER_ECHO\n ret=on_recv_cmnd_ctcp_answer_echo(msg)\n when RECV_CMND_CTCP_ANSWER_TIME\n ret=on_recv_cmnd_ctcp_answer_time(msg)\n when RECV_CMND_CTCP_ANSWER_VERSION\n ret=on_recv_cmnd_ctcp_answer_version(msg)\n when RECV_CMND_CTCP_ANSWER_CLIENTINFO\n ret=on_recv_cmnd_ctcp_answer_clientinfo(msg)\n when RECV_CMND_CTCP_ANSWER_USERINFO\n ret=on_recv_cmnd_ctcp_answer_userinfo(msg)\n when RECV_CMND_CTCP_ANSWER_ACTION\n ret=on_recv_cmnd_ctcp_answer_action(msg)\n when RECV_CMND_CTCP_ANSWER_DCC\n ret=on_recv_cmnd_ctcp_answer_dcc(msg)\n else\n ret=default_action(msg)\n end\n\n return ret\n end",
"def remote_call(rpc_method, request_args)\n rpc.execute(rpc_method, request_args)\n end",
"def receive_data data\n @connection_attempts = 0\n @buffer.extract(data).each do |packet|\n response = JSON.parse(packet)\n log.debug { d = response['result'].inspect\n \"response: #{response['method']} #{d[0...50]}#{d.size > 50 ? '...' : ''}\" }\n if cb = @requests[response['id']]\n cb.call(response['result'])\n else\n callback(:response, response['method'], response['result'])\n callback(response['method'].to_sym, response['result'])\n end\n end\n end",
"def run(api_method = :api)\n orig_command = \"%s %s\" % [api_method, raw]\n Log.debug \"saying #{orig_command}\"\n resp = @fs_socket.say(orig_command)\n unless resp[\"body\"] == \"0 total.\"\n call_info, count = resp[\"body\"].split(\"\\n\\n\")\n require \"fsr/model/call\"\n begin\n require \"fastercsv\"\n @calls = FCSV.parse(call_info)\n rescue LoadError\n require \"csv\"\n @calls = CSV.parse(call_info)\n end\n return @calls[1 .. -1].map { |c| FSR::Model::Call.new(@calls[0],*c) }\n end\n []\n end",
"def call(method_name, *params)\n request = nil\n response = nil\n\n @call_mutex.synchronize do\n request = [0, @msgid, method_name, params]\n @msgid = (@msgid % MAX_MSGID) + 1\n response = make_request_with_retries(request)\n end\n\n if response[0] != 1\n raise MsgpackRpcClient::Error, 'Response does not bear the proper type flag - something is very wrong'\n end\n if response[1] != request[1]\n raise MsgpackRpcClient::Error, 'Response message id does not match request message id - something is very wrong'\n end\n if response[2] != nil\n raise MsgpackRpcClient::Error, \"Server responded with error: #{response[2]}\"\n end\n\n response[3]\n end",
"def main\n action = configuration[:action]\n\n mc = rpcclient('lusers', :options => options)\n\n case action\n when \"who\"\n mc.who() do |r|\n begin\n lusers = []\n r[:body][:data][:msg].each do |l|\n lusers << l['user']\n end\n if configuration.has_key?('filter') and not configuration['filter'].empty?\n filter = configuration['filter'].split(' ')\n filter.collect!{|x| x.strip}\n lusers = lusers - filter\n end\n unless lusers.empty?\n printf(\"%-40s: %s\\n\", r[:senderid], lusers.join(','))\n end\n rescue RPCError => e\n puts \"The RPC agent returned an error: #{e}\"\n end\n end\n when \"wall\"\n # XXX: sanitize .. ? probably 8)\n mc.wall(:msg => ARGV.to_s) do |r|\n printf(\"%-40s: OK\\n\", r[:senderid]) if r[:body][:data][:msg] == 0\n end\n when \"has_user\"\n mc.has_user(:user => ARGV.to_s ) do |r|\n # XXX: argv can be a string of several users, i.e. \"john jane\"\n #printf(\"%-40s: %s\\n\", r[:senderid], r[:body][:data][:out]) if r[:body][:data][:msg] == 0\n # this will give an entry for each user, i.e.:\n # host.name : john\n # host.name : jane\n # other.host.name : john\n #\n # ...which is easy to parse. Could do\n # host.name : john\n # : jane\n #\n # which would be easier to 'parse' for human eyes, visually separating hosts/data better\n r[:body][:data][:out].split(' ').each do |u|\n printf(\"%-40s: %s\\n\", r[:senderid], u)\n end\n end\n when \"has_group\"\n mc.has_group(:group => ARGV.to_s ) do |r|\n #printf(\"%-40s: %s\\n\", r[:senderid], r[:body][:data][:out]) if r[:body][:data][:msg] == 0\n r[:body][:data][:out].split(' ').each do |u|\n printf(\"%-40s: %s\\n\", r[:senderid], u)\n end\n end\n end\n\n printrpcstats\n end",
"def show_data(method, protobuf)\n if method == 1\n students_response = StudentModule::StudentsResponse.decode(protobuf)\n for index in 0 ... students_response.students.size\n print \"Student #{index}\\n\\n\"\n puts \"RA: #{students_response.students[index].ra}\"\n puts \"name: #{students_response.students[index].name}\"\n puts \"period: #{students_response.students[index].period}\"\n puts \"course code: #{students_response.students[index].course_code}\"\n puts \"---------------------------\"\n end\n else\n update_response = Server::Response.decode(protobuf)\n print \"\\n\" + update_response.message + \"\\n\\n\"\n end\nend",
"def response\n @rpc.response\n end",
"def mainloop3(reader,writer)\n h = @handler.new\n state = :init\n abi = 1\n last_soa_name = nil\n\n reader.each_line do |line|\n h.log = []\n h.result = false\n\n # cannot continue anymore\n if state == :fail\n next\n end\n\n input = {}\n line = line.strip\n if (state == :init) \n if line.match \"HELO[ \\t]*([0-9])\"\n abi = $2.to_i\n # synthesize empty init\n h.do_initialize(input)\n\n if h.result == false\n state = :fail\n h.log.each do |l| \n writer.puts \"LOG\\t#{l}\"\n end\n writer.puts \"FAIL\"\n else\n writer.puts \"OK\\tPowerDNS ruby remotebackend version #{Pdns::Remotebackend::VERSION} initialized\"\n state = :main \n end\n else\n writer.puts \"FAIL\"\n state = :fail\n end\n next\n end\n \n # parse input\n query = line.split /[\\t ]+/\n input[\"method\"] = query[0]\n if input[\"method\"] == \"Q\"\n input[\"method\"] = \"lookup\"\n input[\"parameters\"] = {\n \"qname\" => query[1], \"qclass\" => query[2],\n \"qtype\" => query[3], \"domain_id\" => query[4].to_i,\n \"zone_id\" => query[4].to_i, \"remote\" => query[5]\n }\n if abi > 1 \n input[\"parameters\"][\"local\"] = query[6]\n end\n if abi > 2\n input[\"parameters\"][\"edns-subnet\"] = query[7]\n end\n if input[\"parameters\"][\"qtype\"] == \"SOA\"\n last_soa_name = input[\"parameters\"][\"qname\"]\n end\n elsif input[\"method\"] == \"AXFR\"\n input[\"method\"] = \"list\"\n input[\"parameters\"] = { \"zonename\" => last_soa_name, \"domain_id\" => line[1].to_i }\n else\n writer.puts \"FAIL\"\n next\n end\n\n method = \"do_#{input[\"method\"]}\"\n # try to call\n if h.respond_to?(method.to_sym) == true\n h.send(method, input[\"parameters\"])\n else\n writer.puts \"FAIL\"\n next\n end\n\n if (h.result != false) \n h.result.each do |r|\n if r.has_key? :scopemask == false\n r[:scopemask] = 0\n end\n if r.has_key?(:domain_id) == false\n r[:domain_id] = input[\"parameters\"][\"domain_id\"]\n end\n\n # fix content to contain prio if needed\n if [\"MX\", \"SRV\", \"NAPTR\"].include? r[:qtype].upcase\n if r.has_key?(\"prio\")\n r[:content] = \"#{r[:prio].to_i} #{r[:content]}\"\n else\n r[:content] = \"0 #{r[:content]}\"\n end\n end\n if (abi < 3)\n writer.puts \"DATA\\t#{r[:qname]}\\tIN\\t#{r[:qtype]}\\t#{r[:ttl]}\\t#{r[:domain_id]}\\t#{r[:content]}\"\n else\n writer.puts \"DATA\\t#{r[:scopemask]}\\t#{r[:auth]}\\t#{r[:qname]}\\tIN\\t#{r[:qtype]}\\t#{r[:ttl]}\\t#{r[:domain_id]}\\t#{r[:content]}\"\n end\n end\n end\n\n h.log.each do |l|\n writer.puts \"LOG\\t#{l}\"\n end\n writer.puts \"END\"\n end\n end",
"def run(api_method = :api)\n orig_command = \"%s %s\" % [api_method, raw]\n Log.debug \"saying #{orig_command}\"\n resp = @fs_socket.say(orig_command)\n unless resp[\"body\"] == \"0 total.\"\n call_info, count = resp[\"body\"].split(\"\\n\\n\")\n require \"fsr/model/call\"\n require \"csv\"\n @calls = CSV.parse(call_info)\n return @calls[1 .. -1].map { |c| FSR::Model::Call.new(@calls[0],*c) }\n end\n []\n end",
"def on_send_response(cli,data)\n cli.payload = data\n cli.recalc\n inject cli.to_s\n sent_info(cli,data) if datastore['VERBOSE']\n end",
"def process_data\n begin\n data = ::ActiveSupport::HashWithIndifferentAccess.new(JSON.parse(received_data))\n packet = ::Syncano::Packets::Base.instantize_packet(data)\n\n if packet.notification?\n notification = ::Syncano::Resources::Notifications::Base.instantize_notification(client, packet)\n\n callbacks_queue.each do |callback_name|\n callbacks[callback_name].call(notification)\n end\n elsif packet.call_response?\n queue_response(packet)\n elsif packet.auth?\n queue_response(packet)\n end\n\n self.received_data = ''\n rescue Exception => e\n p 'EXCEPTION!'\n p e.inspect\n end\n end",
"def receive(comm)\n meths = Hash.new\n logger.debug \"<< \" + comm\n \n if comm =~ /^:(.+?)\\s+NOTICE\\s+(\\S+)\\s+:(.+?)[\\r\\n]*$/\n server, sender, msg = $1, $2, $3\n meths[:irc_server_notice] = [ self, server, sender, msg ]\n return meths\n elsif comm =~ /^NOTICE\\s+(.+?)\\s+:(.+?)[\\r\\n]*$/\n sender, msg = $1, $2\n meths[:irc_server_notice] = [ self, nil, sender, msg ]\n return meths\n elsif comm =~ /^ERROR :(.+?)[\\r\\n]*$/ then\n msg = $1\n meths[:irc_server_error] = [ self, msg ]\n return meths\n elsif comm =~ /^:(#{nick_regex})!(\\S+?)@(\\S+?)\\s+([A-Z]+)\\s+(.*?)[\\r\\n]*$/ then\n sender = { :nick => $1, :user => $2, :host => $3 }\n command, arg_str = $4, $5\n elsif comm =~ /^:(#{nick_regex})\\s+([A-Z]+)\\s+(.*?)[\\r\\n]*$/ then\n sender = { :nick => $1 }\n command, arg_str = $2, $3\n elsif comm =~ /^:([^\\s:]+?)\\s+([A-Z]+)\\s+(.*?)[\\r\\n]*$/ then\n server, command, arg_str = $1, $2, $3\n arg_array, msg = split_out_message(arg_str)\n elsif comm =~ /^(\\w+)\\s+:(.+?)[\\r\\n]*$/ then\n command, msg = $1, $2\n elsif comm =~ /^:([^\\s:]+?)\\s+(\\d+)\\s+(.*?)[\\r\\n]*$/ then\n server, code, arg_str = $1, $2, $3\n arg_array, msg = split_out_message(arg_str)\n \n numeric_method = \"irc_#{code}_response\".to_sym\n readable_method = \"irc_#{server_type.event[code.to_i]}_response\".to_sym if not code.to_i.zero? and server_type.event?(code.to_i)\n name = arg_array.shift\n meths[numeric_method] = [ self, server, name, arg_array, msg ]\n meths[readable_method] = [ self, server, name, arg_array, msg ] if readable_method\n meths[:irc_response] = [ self, code, server, name, arg_array, msg ]\n return meths\n else\n logger.error \"Couldn't parse IRC message: #{comm.inspect}\"\n return meths\n end\n \n if arg_str then\n arg_array, msg = split_out_message(arg_str)\n else\n arg_array = Array.new\n end\n command = command.downcase.to_sym\n \n case command\n when :nick then\n arguments = { :nick => arg_array.at(0) }\n # Some IRC servers put the nick in the message field\n unless arguments[:nick]\n arguments[:nick] = msg\n msg = nil\n end\n when :quit then\n arguments = { }\n when :join then\n arguments = { :channel => (msg || arg_array.at(0)) }\n msg = nil\n when :part then\n arguments = { :channel => arg_array.at(0) }\n when :mode then\n arguments = if channel?(arg_array.at(0)) then { :channel => arg_array.at(0) } else { :recipient => arg_array.at(0) } end\n params = arg_array[2, arg_array.size]\n if params then\n params = params.only if params.size == 1\n params = nil if params.empty? # empty? is a method on String too, so this has to come second to prevent an error\n end\n arguments.update(:mode => arg_array.at(1), :parameter => params)\n # Usermodes stick the mode in the message\n if arguments[:mode].nil? and msg =~ /^[\\+\\-]\\w+$/ then\n arguments[:mode] = msg\n msg = nil\n end\n when :topic then\n arguments = { :channel => arg_array.at(0), :topic => msg }\n msg = nil\n when :invite then\n arguments = { :recipient => arg_array.at(0), :channel => msg }\n msg = nil\n when :kick then\n arguments = { :channel => arg_array.at(0), :recipient => arg_array.at(1) }\n when :privmsg then\n arguments = if channel?(arg_array.at(0)) then { :channel => arg_array.at(0) } else { :recipient => arg_array.at(0) } end\n when :notice then\n arguments = if channel?(arg_array.at(0)) then { :channel => arg_array.at(0) } else { :recipient => arg_array.at(0) } end\n when :ping then\n arguments = { :server => arg_array.at(0) }\n else\n logger.warn \"Unknown IRC command #{command.to_s}\"\n return\n end\n arguments.update :message => msg\n arguments[:channel] = normalized_channel_name(arguments[:channel]) if arguments[:channel]\n \n method = \"irc_#{command}_event\".to_sym\n meths[method] = [ self, sender, arguments ]\n meths[:irc_event] = [ self, command, sender, arguments ]\n return meths\n end",
"def remote_call(remote_method, params)\n correlation_id = SecureRandom.uuid\n message = { id: correlation_id, jsonrpc: '2.0', method: remote_method, params: params}\n # Reply To => make sure the service knows where to send it's response.\n # Correlation ID => identify the results that belong to the unique call made\n @exchange.publish(message.to_json, routing_key: @server_queue.name, correlation_id: correlation_id,\n reply_to: @reply_queue.name)\n result = @results[correlation_id].pop\n @results.delete correlation_id # remove item from hash. prevents memory leak.\n result\n end",
"def process_data\n unless @state.include?(:rcpt)\n send_data \"503 Operation sequence error\\r\\n\"\n else\n succeeded = proc {\n send_data \"354 Send it\\r\\n\"\n @state << :data\n @databuffer = []\n }\n failed = proc {\n send_data \"550 Operation failed\\r\\n\"\n }\n\n d = receive_data_command\n\n if d.respond_to?(:callback)\n d.callback(&succeeded)\n d.errback(&failed)\n else\n (d ? succeeded : failed).call\n end\n end\n end",
"def recv(*rest) end",
"def handle_request(client, lines, requests); end",
"def create_reply(message_type, msg, data)\n reply = ''\n\n case message_type\n # Greet user\n when MessageType::INITIAL\n countries = data.collect { |x| x.name.capitalize }.join(', ')\n reply = \"Hello! Welcome to NuoLingo's Dial-ect service. We have etiquette sets for the following countries: #{countries}. Please reply with the country you want to learn more about!\"\n\n # Tell user sets for the given country\n when MessageType::GET_COUNTRY\n reply = \"We have the following sets for #{data[session['country_index']].name.capitalize}: #{session['country_sets']}. Reply with either \\\"VIEW\\\" or \\\"QUIZ\\\" and then the name of a set to either view the set or be quizzed on it.\"\n\n # Print the requested set\n when MessageType::GET_SET\n advice_list = data[session['country_index']].sets[session['set_index']].advice\n (0..advice_list.length - 1).each do |i|\n reply << (i + 1).to_s + '. ' + advice_list[i] + '\\n\\n'\n end\n\n # Start quizzing a user on the requested set\n when MessageType::GET_SET_QUIZ\n question = data[session['country_index']].sets[session['set_index']].quiz_questions[session['quiz_index']]\n reply = question.prompt + \"\\n\"\n\n (0..question.responses.length - 1).each do |i|\n reply << (i + 65).chr + '. ' + question.responses[i].text + \"\\n\"\n end\n\n reply << 'Text the letter matching your answer only.'\n\n # Check a user's answer to a quiz question\n when MessageType::ANSWER_QUESTION\n # Convert response to an integer\n # 'A' => 0, 'B' => 1, etc\n user_answer = msg.upcase.ord - 65\n quizzes = data[session['country_index']].sets[session['set_index']].quiz_questions\n quiz = quizzes[session['quiz_index']]\n\n # Validate answer\n if user_answer < 0 || user_answer >= quiz.responses.length\n\n reply = 'Please give a valid answer'\n\n else\n if quiz.responses[user_answer].is_correct\n reply = 'Correct! Great job!'\n if session['quiz_index'] == quizzes.length - 1\n reply << ' You\\'ve finished this quiz! If you want to review or be quizzed on another set, reply with the country you\\'re going to.'\n else\n reply << ' Text: \\'next\\' for the next question'\n end\n\n session['quiz_index'] = (session['quiz_index'] + 1) % quizzes.length\n else\n reply = 'I\\'m sorry, that\\'s incorrect. Try again?'\n end\n end\n\n # Continue quizzing the user\n when MessageType::NEXT_QUESTION\n quizzes = data[session['country_index']].sets[session['set_index']].quiz_questions\n quiz = quizzes[session['quiz_index']]\n\n if session['quiz_index'] >= quizzes.length\n session['quiz_index'] = 0\n else\n reply = quiz.prompt + '\\n'\n\n (0..quiz.responses.length - 1).each do |i|\n reply << (i + 65).chr + '. ' + quiz.responses[i].text + '\\n'\n end\n\n reply << 'Text the letter matching your answer only.'\n end\n\n # No MessageType\n else\n reply = 'Sorry, I didn\\'t understand that!'\n end\n\n reply\nend",
"def call(envelope)\n mail = MarilynRPC::MailFactory.unpack(envelope)\n tag = mail.tag\n \n if mail.is_a?(MarilynRPC::CallRequestMail) # handle a call request\n # fetch the service and check if the user has the permission to access the\n # service\n service = lookup(mail.path)\n method = mail.method.to_sym\n if service.class.__methods_with_authentication__[method] && !@username \n raise MarilynRPC::PermissionDeniedError.new(\"No permission to access\" \\\n \" the #{service.class.name}##{method}\")\n end\n \n # call the service instance using the argument of the mail\n #puts \"call #{mail.method}@#{mail.path} with #{mail.args.inspect}\"\n result = service.__send__(method, *mail.args)\n #puts \"result => #{result.inspect}\"\n \n # no direct result, register callback\n if result.is_a? MarilynRPC::Gentleman\n result.tag = tag # set the correct mail tag for the answer\n result\n else # direct response\n MarilynRPC::Envelope.new(MarilynRPC::CallResponseMail.new(tag, result).encode, \n MarilynRPC::CallResponseMail::TYPE).encode\n end\n else\n raise MarilynRPC::BrokenEnvelopeError.new(\"Expected CallRequestMail Object!\")\n end\n rescue MarilynRPC::BrokenEnvelopeError => exception\n MarilynRPC::Envelope.new(MarilynRPC::ExceptionMail.new(nil, exception).encode, \n MarilynRPC::ExceptionMail::TYPE).encode\n rescue => exception\n #puts exception\n #puts exception.backtrace.join(\"\\n \")\n MarilynRPC::Envelope.new(MarilynRPC::ExceptionMail.new(tag, exception).encode, \n MarilynRPC::ExceptionMail::TYPE).encode\n end",
"def receive_data p_data\n if p_data[:data][:worker_method] == :exit\n exit\n end\n case p_data[:type]\n when :request then process_request(p_data)\n when :response then process_response(p_data)\n when :get_result then return_result_object(p_data)\n end\n end",
"def run(&callback)\n @serializer.run do |msg|\n debug(\"received #{msg.inspect}\")\n kind, *payload = msg\n\n case kind\n when 0\n handle_request(payload, callback)\n when 1\n handle_response(payload)\n when 2\n handle_notification(payload, callback)\n end\n end\n rescue => e\n fatal(\"got unexpected error #{e.inspect}\")\n debug(e.backtrace.join(\"\\n\"))\n end",
"def process_client(client, buffer); end",
"def process_response(entry)\n entry.messagings.each do |messaging|\n # Set global variable Messenger Sender\n set_sender(messaging.sender_id)\n # Check if user is available to talk with bot or human.\n if bot_service_active?\n if messaging.callback.message?\n receive_message(messaging.callback)\n elsif messaging.callback.delivery?\n puts messaging.callback\n elsif messaging.callback.postback?\n receive_postback(messaging.callback)\n elsif messaging.callback.optin?\n puts messaging.callback\n elsif messaging.callback.account_linking?\n login_or_log_out(messaging.callback)\n end\n # puts Messenger::Client.get_user_profile(messaging.sender_id)\n else\n send_directly_message_without_boot(messaging)\n end\n end\n end",
"def command(cmd, arg = 2)\n return if @sp == nil\n #<SOT><CMD_BYTE><CHECK_SUM><EOT>\n case cmd\n=begin\n Request DCF Time\n <SOH><0x30><Chksum><EOT>\n=end\n when 0 #Poll DCF Time\n exchange(\"\\x01\\x30\\xcf\\x04\", 7)\n puts DCF77.new(@response).to_s\n=begin\n Request Dataset\n \t<SOH><0x31><Chksum><EOT>\n \t\tResponse from weather station: (34/60 Bytes) Mine has additional 0 byte, so 35/61 bytes are received.\n \t\t1. Data available\n \t\t\tBlock no.: 2 bytes Number of the block in the memory\n \t\t\t (no relation to time. Serves to control dataset registered twice).)\n \t\t\tTime: 2 bytes Age of the dataset in minutes up to the current time.\n \t\t\t\t\t\t\t\t age = ( data[2] & 0xff ) + ( data[3] << 8 & 0xff00 );\n \t\t\tData: 30 (9 sensors) or 56 (16 sensors) bytes\n \t\t2. No data available: <DLE>\n=end\n when 1 #Request dataset\n exchange(\"\\x01\\x31\\xce\\x04\", 61)\n #@response.each { |r| print \"%02X \" % r }\n s = Sensors.new(@response)\n if s.data?\n puts s.to_data_row\n puts Sensors.new(@response).to_s\n end\n=begin\n \tSelect Next Dataset\n \t\t<SOH><0x32><Chksum><EOT>\n \t\t\tResponse from weather station: (1 Byte)\n \t\t\t\t1. Next dataset available : <ACK> 0x06\n \t\t\t\t2. No dataset available: <DLE> 0x10\n=end\n when 2 #select next dataset\n exchange(\"\\x01\\x32\\xcd\\x04\",1)\n exit @response[0] == ACK ? 0 : 1\n=begin\n \tSet 8 Sensors\n \t\t<SOH><0x33><Chksum><EOT>\n \t\tResponse from weather station: (1 Byte)\n \t\t<ACK>\n=end\n when 3 #activate 8 sensors\n exchange(\"\\x01\\x33\\xcc\\x04\",1)\n exit @response[0] == ACK ? 0 : 1\n=begin\n set 16 Sensors\n \t<SOH><0x34><Chksum><EOT>\n \tResponse from weather station: (1 Byte)\n \t<ACK>\n=end\n when 4 #activate 16 sensors\n exchange(\"\\x01\\x34\\xcb\\x04\",1)\n exit @response[0] == ACK ? 0 : 1\n=begin\n \tStatus\n \t <SOH><0x35><Chksum><EOT>\n \tResponse from weather station: (21 Byte)\n \tBytes 1 - 18\n \t\t\tS:1-8 Temp/Hum\n \t\t\t9 Rain,\n \t\t\t10 Wind\n \t\t\t11 Indoor Temp/Hum/Pres\n \t\t\t12 S9:Temp/Hum\n \t\t\t13-15 S10-15:Temp/Hum/Pres\n \t\tByte >= 0x10 if sensor present\n \t\tvalue > 0x10 number of error\n \tByte 19 Sample Interval in minutes\n \tByte 20\n \t bit 0 DFC77 time receiver active\n \t\tbit 1 HF if set\n \t\tbit 2 8/16 Sensors\n \t\tbit 3 DFC Synchronized (Not likely in NZ)\n \tByte 21 Version Number\n=end\n when 5 #Request Status\n exchange(\"\\x01\\x35\\xca\\x04\", 21)\n @response.each { |r| print \"%02X \" % r }\n puts\n=begin\n Set Interval time\n \t <SOH><0x36><minutes><Chksum><EOT>\n \t\tminutes range 1..60\n \t Response from weather station: (1 Byte)\n \t<ACK> if in range\n \t<DLE> if out of range\n=end\n when 6 #set interval time\n #<SOT><CMD_BYTE><ARGUMENT><CHECK_SUM><EOT>\n raise Weather_exception, \"Interval Range 2..60\" if arg > 60 || arg < 2\n exchange(\"\\x01\\x36#{arg.chr}#{(0xc9-arg).chr}\\x04\", 1)\n exit @response[0] == ACK ? 0 : 1\n\n when 12 #Loop through 1 and 2\n begin\n exchange(\"\\x01\\x31\\xce\\x04\", 61)\n s = Sensors.new(@response)\n exchange(\"\\x01\\x32\\xcd\\x04\",1)\n if s.data?\n\t puts s.to_data_row\n else\n break\n end\n end while( @response[0] == ACK )\n end\n end",
"def invoke(message)\n\n # Get the arguments\n registration_id = message.registered_registration\n request_id = message.request\n args = message.call_arguments || []\n kwargs = message.call_argumentskw || {}\n\n # If we have a registration, execute it\n registration = self.objects[registration_id]\n if registration\n\n # Create the details\n details = message.details || {}\n details[:request] = request_id\n details[:procedure] = registration.procedure\n details[:session] = self\n\n handler = registration.handler\n if handler\n # Use the invoke wrapper to process the result\n value = Response.invoke_handler do\n handler.call(args, kwargs, details)\n end\n\n # If a defer was returned, handle accordingly\n if value.is_a? Response::CallDefer\n value.request = request_id\n value.registration = registration_id\n\n # Store the defer\n self.defers[request_id] = value\n\n # On complete, send the result\n value.on :complete do |defer, result|\n result = Response::CallResult.ensure(result)\n self.yield(defer.request, result, {}, true)\n end\n\n # On error, send the error\n value.on :error do |defer, error|\n error = Response::CallError.ensure(error)\n self.yield(defer.request, error, {}, true)\n end\n\n # For progressive, return the progress\n if value.is_a? Response::ProgressiveCallDefer\n value.on :progress do |defer, result|\n result = Response::CallResult.ensure(result)\n self.yield(defer.request, result, { progress: true }, true)\n end\n end\n\n # Else it was a normal response\n else\n self.yield(request_id, value)\n end\n end\n end\n end",
"def receive_data(data)\n # a large json-rpc message may be split over multiple packets\n # (invocations of receive_data)\n # and multiple messages may be concatinated into one packet\n @data += data\n while extracted = JSONParser.extract_json_from(@data)\n msg, @data = *extracted\n @rjr_node.send(:handle_message, msg, self) # XXX private method\n end\n end",
"def call(function, data, do_recv = true)\n\n frag_size = data.length\n if options['frag_size']\n frag_size = options['frag_size']\n end\n object_id = ''\n if options['object_call']\n object_id = self.handle.uuid[0]\n end\n if options['random_object_id']\n object_id = Rex::Proto::DCERPC::UUID.uuid_unpack(Rex::Text.rand_text(16))\n end\n\n call_packets = Rex::Proto::DCERPC::Packet.make_request(function, data, frag_size, self.context, object_id)\n call_packets.each { |packet|\n self.write(packet)\n }\n\n return true if not do_recv\n\n raw_response = ''\n\n begin\n raw_response = self.read()\n rescue ::EOFError\n raise Rex::Proto::DCERPC::Exceptions::NoResponse\n end\n\n if (raw_response == nil or raw_response.length == 0)\n raise Rex::Proto::DCERPC::Exceptions::NoResponse\n end\n\n self.last_response = Rex::Proto::DCERPC::Response.new(raw_response)\n\n if self.last_response.type == 3\n e = Rex::Proto::DCERPC::Exceptions::Fault.new\n e.fault = self.last_response.status\n raise e\n end\n\n self.last_response.stub_data\n end",
"def response_request(msg,sock)\n begin \n @user = @user_info[@descriptors.index(sock)-1]\n msg = msg.strip\n umsg = msg.split(\" \")\n cmd = umsg[0]\n puts \"Comando ingresado: \" + cmd\n case @user[:role]\n when \"client\"\n if @@cmd_client.include? cmd\n evaluate_client(umsg,sock)\n else\n raise Exception.new(\"#{@@cmd_client}\")\n end\n when \"editor\"\n if @@cmd_editor.include? cmd\n evaluate_editor(umsg,sock) \n else\n raise Exception.new(\"#{@@cmd_editor}\")\n end\n when \"admin\"\n if @@cmd_admin.include? cmd\n evaluate_admin(umsg,sock)\n else\n raise Exception.new(\"#{@@cmd_admin}\")\n end\n end\n rescue Exception => e\n sock.write(\"Invalid command: #{umsg[0]}\\nValid Commands:#{e}\\n\")\n end\n end",
"def receive_data(response)\n ip, port = peer_info\n log \"Response from #{ip}:#{port}:\\n#{response}\\n\"\n parsed_response = parse(response)\n\n return if parsed_response.has_key? :nts\n return if parsed_response[:man] && parsed_response[:man] =~ /ssdp:discover/\n\n @discovery_responses << parsed_response\n end",
"def on_client_data(cli)\n begin\n data = cli.read(65535)\n\n raise ::EOFError if not data\n raise ::EOFError if data.empty?\n\n case cli.request.parse(data)\n when Packet::ParseCode::Completed\n dispatch_request(cli, cli.request)\n cli.reset_cli\n\n when Packet::ParseCode::Partial\n # Return and wait for the on_client_data handler to be called again\n # The Request object tracks the state of the request for us\n return\n\n when Packet::ParseCode::Error\n close_client(cli)\n end\n rescue EOFError\n if (cli.request.completed?)\n dispatch_request(cli, cli.request)\n\n cli.reset_cli\n end\n\n close_client(cli)\n end\n end",
"def receive_replies(connection); end",
"def call(rpcname, responsetype, args=nil)\n rpc = VistaRPC.new(rpcname, responsetype)\n if !args.nil?\n rpc.params = args\n end\n rpcresponse = execute(rpc)\n return rpcresponse\n end",
"def process_protocol(cmds, vars)\n end",
"def trigger_callbacks_for(msg)\n case msg.message_type\n\n # ----- server messages\n when RPL_WELCOME\n notify :registered_with_server\n when CMD_PING\n notify :server_ping, msg.params[0] # server wants the params back\n when CMD_ERROR\n notify :server_error\n\n # ----- nick-related -----\n when CMD_NICK\n @state[:nick] = msg.params[0] if msg.prefix[:nick] == @state[:nick]\n threaded_notify :nick_changed, msg.prefix[:nick], msg.params[0]\n when ERR_NICKNAMEINUSE\n # nickname errors are deterministic, that is, the client keeps track of the \n # state of attempted nick changes in @state, and the server responds to them\n # in order, so no additional info needs to be sent in the callback.\n # (this is tested)\n notify :nick_in_use\n when ERR_ERRONEUSNICKNAME\n notify :nick_invalid\n\n # ----- channel-related -----\n when CMD_JOIN\n threaded_notify :joined_channel, msg.user, msg.params[0]\n when CMD_PART\n threaded_notify :left_channel, msg.user, msg.params[0], msg.params[1]\n when CMD_QUIT\n threaded_notify :quit_server, msg.user, msg.params[0]\n when RPL_TOPIC # negative indices handle rfc and non-rfc commands\n threaded_notify :topic_changed, msg.params[-2], msg.params[-1], nil\n when CMD_TOPIC\n threaded_notify :topic_changed, msg.params[0], msg.params[1], msg.user\n when RPL_NAMREPLY\n @state[:scratch] ||= {}\n @state[:scratch][msg.params[-2]] ||= []\n # strip out leading mode characters: @, +, ~, etc.\n @state[:scratch][msg.params[-2]] += msg.params[-1].split.map { |name| name.gsub(/^[^a-zA-Z\\[\\]\\\\`_\\^{}\\|]/,'') }\n when RPL_ENDOFNAMES\n if @state[:scratch]\n threaded_notify :channel_name_list, msg.params[-2], ( @state[:scratch][msg.params[-2]] || [] )\n @state[:scratch].delete(msg.params[-2])\n else\n threaded_notify :channel_name_list, []\n end\n \n # ----- messaging -----\n when CMD_PRIVMSG\n if private?(msg)\n threaded_notify :private_message, msg.params[0], msg.params[1], msg.user\n else\n threaded_notify :channel_message, msg.params[0], msg.params[1], msg.user\n end\n when CMD_NOTICE\n if private?(msg)\n threaded_notify :private_notice, msg.params[0], msg.params[1], msg.user\n else\n threaded_notify :channel_notice, msg.params[0], msg.params[1], msg.user\n end\n\n end\n end",
"def extract_data code, messages\n hash = {}\n code.scan(/say_reply\\(\\d+, (\\d+)/).each { |(id)|\n id = Integer id\n next unless messages.has_key? id\n text = messages.fetch id\n (hash['replies'] ||= []) << text\n }\n code.scan(/message_str\\(\\d+, (\\d+)/).each { |(id)|\n id = Integer id\n next unless messages.has_key? id\n text = messages.fetch id\n (hash['used'] ||= []) << text\n }\n code.scan(/option[(].*?,.*?, (\\d+), (.*?),/).\n each {|(id,node)|\n id = Integer id\n next unless messages.has_key? id\n text = messages.fetch id\n (hash['options'] ||= []) << {node => text}\n }\n code.scan(/say_message\\(\\d+, (\\d+)/).each { |(id)|\n id = Integer id\n next unless messages.has_key? id\n text = messages.fetch id\n (hash['messages'] ||= []) << text\n }\n code.scan(/call (.*);/).each { |(name)|\n (hash['calls'] ||= []) << name\n }\n hash\nrescue\n p code\n p messages\n raise\nend",
"def rpc_invoke server_id, msg, &block\n unless @state == :state_started\n block_given? and yield Exception.new 'fail to do rpc invoke for client is not running'\n return\n end\n @station.dispatch server_id, msg, @args, block\n end",
"def respond(received)\n case received['type']\n\n when 'JOINING_NETWORK'\n puts('JOINING_NETWORK')\n\n # Reply with ROUTING_INFO\n @socket.send @msg.ROUTING_INFO(@id, received['node_id'], @port , @rt.getRoutingTableToSend(@port)), 0, '127.0.0.1', received['ip_address']\n\n # Put joining node in routing table\n @rt.updateRoutingTable(received['node_id'], received['ip_address'])\n\n # If there is a node closer to target in routing table forward JOINING_NETWORK_RELAY\n if @rt.routing_table.length > 0\n closest_node_ip = @rt.findCloserNode(received['target_id'], received['node_id'])\n if closest_node_ip != nil\n @socket.send @msg.JOINING_NETWORK_RELAY(received['node_id'], received['target_id'], @id), 0, '127.0.0.1', closest_node_ip\n end\n end\n\n when 'JOINING_NETWORK_RELAY'\n puts('JOINING_NETWORK_RELAY')\n\n # If not target, forward JOINING_NETWORK_RELAY to closer node\n if received['node_id'] != @id\n closest_node_ip = @rt.findCloserNode(received['target_id'], received['node_id'])\n if !closest_node_ip.nil?\n @socket.send @msg.JOINING_NETWORK_RELAY(received['node_id'], received['target_id'], received['gateway_id']), 0, '127.0.0.1', closest_node_ip\n end\n end\n\n # Send ROUTING_INFO to gateway node\n closest_node_ip = @rt.findCloserNode(received['gateway_id'], nil)\n if !closest_node_ip.nil?\n @socket.send @msg.ROUTING_INFO(received['gateway_id'], received['node_id'], @port, @rt.getRoutingTableToSend(@port)), 0, '127.0.0.1', closest_node_ip\n end\n\n when 'ROUTING_INFO'\n puts('ROUTING_INFO')\n\n # Store received routing info\n received['route_table'].each do |x|\n @rt.updateRoutingTable(x['node_id'], x['ip_address'])\n end\n\n # If this is the gateway node forward ROUTING_INFO to joining node\n if received['gateway_id'] == @id\n joining_ip = @rt.routing_table.detect{|x| x[:node_id] == received['node_id']}[:ip_address]\n @socket.send @msg.ROUTING_INFO(@id, received['node_id'], @port, received['route_table']), 0, '127.0.0.1', joining_ip\n end\n\n # If message not intended for this node send it closer to target\n if received['node_id'] != @id\n closest_node_ip = @rt.findCloserNode(received['gateway_id'], nil)\n if !closest_node_ip.nil?\n @socket.send @msg.ROUTING_INFO(received['gateway_id'], received['node_id'], @port, received['route_table']), 0, '127.0.0.1', closest_node_ip\n end\n end\n\n when 'LEAVING_NETWORK'\n puts('LEAVING_NETWORK')\n @rt.deleteRoutingTableEntry(received['node_id']) # Delete leaving node from routing table\n\n when 'INDEX'\n puts('INDEX')\n\n # If message is intended for this node\n if received['target_id'] == @id\n\n # Store new index\n @index.addIndex(received['keyword'], received['link'])\n\n # Respond with ACK_INDEX\n closest_node_ip = @rt.findCloserNode(received['sender_id'], nil)\n if !closest_node_ip.nil?\n @socket.send @msg.ACK_INDEX(received['sender_id'], received['keyword']), 0, '127.0.0.1', closest_node_ip\n end\n\n # If message not for this node, send closer to target\n else\n closest_node_ip = @rt.findCloserNode(received['target_id'], nil)\n if !closest_node_ip.nil?\n @socket.send @msg.INDEX(received['target_id'], received['sender_id'], received['keyword'], received['link']), 0, '127.0.0.1', closest_node_ip\n end\n end\n\n when 'SEARCH'\n puts('SEARCH')\n\n # If message is intended for this node ger results and send SEARCH_RESPONSE\n if received['node_id'] == @id\n closest_node_ip = @rt.findCloserNode(received['sender_id'], nil)\n if !closest_node_ip.nil?\n @socket.send @msg.SEARCH_RESPONSE(received['word'], received['sender_id'], @id, @index.getKeywordIndexes(received['word'].to_s)), 0, '127.0.0.1', closest_node_ip\n end\n\n # If message not for this node, send closer to target\n else\n closest_node_ip = @rt.findCloserNode(received['node_id'], nil)\n if !closest_node_ip.nil?\n @socket.send @msg.SEARCH(received['word'], received['node_id'], received['sender_id']), 0, '127.0.0.1', closest_node_ip\n end\n end\n\n when 'SEARCH_RESPONSE'\n puts('SEARCH_RESPONSE')\n\n # If message is intended for this node\n if received['node_id'] == @id\n\n received['response'].each do |x|\n result = SearchResult.new(received['word'], x['url'], x['rank'])\n ap result\n end\n\n # If message is not intended for this node, send closer to target\n else\n closest_node_ip = @rt.findCloserNode(received['node_id'], nil)\n if !closest_node_ip.nil?\n @socket.send @msg.SEARCH_RESPONSE(received['word'], received['node_id'], received['sender_id'], received['response']), 0, '127.0.0.1', closest_node_ip\n end\n end\n\n when 'PING'\n puts('PING')\n\n # Respond with ACK\n @socket.send @msg.ACK(received['target_id'], @port), 0, '127.0.0.1', received['ip_address']\n\n # Send PING to next node if not final target\n if received['target_id'] != @id\n\n # Send closer to target\n closest_node_ip = @rt.findCloserNode(received['target_id'], nil)\n if !closest_node_ip.nil?\n @socket.send @msg.PING(received['target_id'], received['sender_id'], @port), 0, '127.0.0.1', closest_node_ip\n @pinged_ip = closest_node_ip\n\n # Wait up to 10s for ACK\n time = Time.now\n while Time.now - time < 10 && !@ack_received\n end\n\n # If no ACK received delete node from routing table\n if !@ack_received\n @rt.deleteRoutingTableEntry(@rt.routing_table.detect{|x| x[:ip_address == closest_node_ip]}[:node_id]) # Delete from routing table\n else\n @ack_received = false # If ACK received reset value to false\n end\n end\n end\n\n when 'ACK'\n puts('ACK')\n\n if received['ip_address'] == @pinged_ip # If ACK is from expected node\n @ack_received = true # Indicate that ACK has been received\n end\n\n when 'ACK_INDEX'\n puts('ACK_INDEX')\n\n # If message is intended for this node\n if received['node_id'] == @id\n @ack_index_received = true # Indicate that ACK_INDEX has been received\n\n # If message not intended for this node, send closer to target\n else\n closest_node_ip = @rt.findCloserNode(received['node_id'], nil)\n if !closest_node_ip.nil?\n @socket.send @msg.ACK_INDEX(received['node_id'], received['keyword']), 0, '127.0.0.1', closest_node_ip\n end\n end\n\n end\n end",
"def default_callback\n lambda do |type, format, conv, hsz1, hsz2, data_handle, data1, data2|\n case type\n when XTYP_CONNECT # Request to connect from client, creating data exchange channel\n # format:: Not used.\n # conv:: Not used.\n # hsz1:: Handle to the topic name.\n # hsz2:: Handle to the service name.\n # data_handle:: Handle to DDE data. Meaning depends on the type of the current transaction.\n # data1:: Pointer to a CONVCONTEXT structure that contains context information for the conversation.\n # If the client is not a DDEML application, this parameter is 0.\n # data2:: Specifies whether the client is the same application instance as the server. If the parameter\n # is 1, the client is the same instance. If it is 0, the client is a different instance.\n # *Returns*:: A server callback function should return TRUE(1, but DDE_FACK works just fine too)\n # to allow the client to establish a conversation on the specified service name and topic\n # name pair, or the function should return FALSE to deny the conversation. If the callback\n # function returns TRUE and a conversation is successfully established, the system passes\n # the conversation handle to the server by issuing an XTYP_CONNECT_CONFIRM transaction to\n # the server's callback function (unless the server specified the CBF_SKIP_CONNECT_CONFIRMS\n # flag in the DdeInitialize function).\n\n if hsz2 == @service.handle\n cout \"Service #{@service}: connect requested by client\\n\"\n DDE_FACK # instead of true # Yes, this server supports requested (name) handle\n else\n cout \"Service #{@service} unable to process connection request for #{hsz2}\\n\"\n DDE_FNOTPROCESSED # 0 instead of false # No, server does not support requested (name) handle\n end\n\n when XTYP_POKE # Client initiated XTYP_POKE transaction to push unsolicited data to the server\n # format:: Specifies the format of the data sent from the server.\n # conv:: Handle to the conversation.\n # hsz1:: Handle to the topic name. (Excel: [topic]item ?!)\n # hsz2:: Handle to the item name.\n # data_handle:: Handle to the data that the client is sending to the server.\n # *Returns*:: A server callback function should return the DDE_FACK flag if it processes this\n # transaction, the DDE_FBUSY flag if it is too busy to process this transaction,\n # or the DDE_FNOTPROCESSED flag if it rejects this transaction.\n\n @data.topic = dde_query_string(@id, hsz1) # Convert hsz1 into \"[topic]item\" string and\n if @data.receive(data_handle) # Receive incoming DDE data and process it\n\n # Perform actions like :draw, :debug, :timer, :formats on received data (default :timer)\n @actions.each{|action| @data.send(action.to_sym)}\n DDE_FACK # Transaction successful\n else\n @data.debug\n cout \"Service #{@service} unable to process data request (XTYP_POKE) for #{hsz2}\"\n DDE_FNOTPROCESSED # 0 Transaction NOT successful - return (HDDEDATA)TRUE; ?!(why TRUE, not FALSE)\n end\n else\n DDE_FNOTPROCESSED # 0 - return((HDDEDATA)NULL);// is it the same as 0 ?!\n end\n end\n end",
"def call\n @called = true\n handleResponse @stubs\n end",
"def receive_data(response)\n ip, port = peer_info\n logger.info \"<#{self.class}> Response from #{ip}:#{port}:\\n#{response}\\n\"\n parsed_response = parse(response)\n @discovery_responses << parsed_response\n end",
"def processRPCRequests(user, input)\n jsonAPI = @apiClass.new(@configuration, @connections, user)\n return processRPCRequestsByAPI(user, input, jsonAPI)\n end",
"def pingCallBack(msg)\n code = msg.getConfig(\"code\")\n message_arr = msg.getMessage.split(' ')\n src = message_arr[0]\n dst = message_arr[1]\n seq_id = message_arr[2]\n\n # code will equal 0 when the method ping is called. It will rewrite the hostid. If it \n # reached the correct destination, it will set the code to 1 then resend it back. Otherwise\n # it will forward it to the next client\n if code == 0\n if dst == $hostname\n msg.setConfig(\"code\", 1)\n client = $clients[$next[src]]\n sendMessage(client, msg)\n else\n client = $clients[$next[dst]]\n sendMessage(client, msg)\n end\n \n # If code is not 0, and the src reached the correct host, it will print out the right\n # information. Note: once the src found the correct host, it wil delete itself from the \n # ping_table. Otherwise, it will forward it to the next client. \n else\n if src == $hostname\n if $ping_table.has_key?(seq_id)\n rtp = $currtime - $ping_table[seq_id]\n STDOUT.puts (seq_id + \" \" + dst + \" \" + rtp.to_s)\n $ping_table.delete(seq_id)\n end\n else\n client = $clients[$next[src]]\n sendMessage(client, msg)\n end\n end\nend",
"def apply\n return if @error\n fun = @service.procs[@fun]\n get = self.is_a?(Get)\n set_error(999, \"This JSON-RPC service does not provide a '#{@fun}' method.\", (get ? 404 : 500)) and return unless fun\n set_error(999, \"This method is not idempotent and can only be called using POST.\") and return if get && !fun[:idempotent]\n canonicalise_args fun\n return if @error\n begin\n @result = fun[:proc].call *@args_pos\n rescue Exception => e\n set_error 999, e.message + e.backtrace.join(\"\\n\")\n end\n # If the procedure return type is the string \"nil\", return nothing\n @result = nil if fun[:return][:type] == 'nil'\n end",
"def handle_list_reply( m, params )\n if @reply.length == 0\n m.reply( \"Nothing available.\" ); return\n end\n\n m.reply \"Custom replies: #{@reply.keys.sort.join(', ')}\"\n end",
"def process client\n data = client.read\n command, position, value = data.split\n case command.upcase\n when 'SET'\n puts \"SET request from #{position} (#{client.local_address.ip_port})\"\n @storage[position] = value\n when 'REBOOT'\n angle = [75, 275].sample\n client.write(\"#{angle}\")\n when 'GET'\n puts \"GET request from #{position} (#{client.local_address.ip_port})\"\n client.write(\"#{@storage[position]}\")\n when 'CLOSE'\n puts \"CLOSE all connections\"\n exit\n end\n client.close\n end",
"def handle_result! json, peer\n Logger.info 'Processing data received from peer: ' + peer.to_s\n service = Executor::Service.get json[:service_id]\n service.trigger.send :perform, Result.new(json, peer) \n end",
"def process_response(obj)\n end",
"def process(source)\n begin\n request = parse_json_request(source)\n if request.is_a?(Array)\n # If the batch rpc call itself fails to be recognized as an valid\n # JSON or as an Array with at least one value, the response from\n # the Server MUST be a single Response object.\n raise InvalidRequest.new if request.empty?\n # process batch request\n response = request.map { |r| process_request(r) }\n # A Response object SHOULD exist for each Request object, except that\n # there SHOULD NOT be any Response objects for notifications.\n # Remove nil responses from response array\n response.compact!\n else\n response = process_request(request)\n end\n rescue ParseError, InvalidRequest => e\n # If there was an error in detecting the id in the Request object\n # (e.g. Parse error/Invalid Request), then the id member MUST be\n # Null. Don't pass request obj when building the error response.\n response = self.class.create_error_response(e)\n rescue RpcError => e\n # other JSON-RPC errors should include the id from the Request object\n response = self.class.create_error_response(e, request)\n rescue => e\n response = self.class.create_error_response(ApplicationServerError.new(e), request)\n end\n\n # When a rpc call is made, the Server MUST reply with a Response, except\n # for in the case of Notifications. The Response is expressed as a single\n # JSON Object.\n self.class.to_json(response)\n end",
"def response_from_service\n\n end",
"def callbacks(conn)\n conn.server(:srv, {\n :host => @config[:server_host],\n :port => @config[:server_port]})\n conn.on_data do |data|\n # parse the raw binary message\n @flag = false\n # nil \n raw_msg, msg = WireMongo.receive(data)\n @recent = msg\n # nil \n # nil \n # nil \n nil \n user_name = \"Alice\"\n if abac(msg, user_name, \"127.0.0.1\")\n @flag = true\n end\n\n # nil \n # nil \n @log.info 'from client'\n @log.info msg\n\n if raw_msg == nil\n @log.info \"Client disconnected\"\n # nil \n return\n end\n\n @front_callbacks.each do |cb|\n msg = cb.call(conn, msg)\n break unless msg\n end\n next unless msg\n\n # get auth response about client query\n authed = (@config[:read_only] == true ? @auth.wire_auth(conn, msg) : true)\n r = nil\n\n if authed == true # auth succeeded\n @back_callbacks.each do |cb|\n msg = cb.call(conn, msg)\n break unless msg\n end\n next unless msg\n # nil \n r = WireMongo::write(msg)\n \n elsif authed.is_a?(Hash) # auth had a direct response\n response = WireMongo::write(authed)\n # nil \n conn.send_data(response)\n\n else # otherwise drop the message\n @log.info 'dropping message'\n\n end\n # nil \n r\n end\n\n # messages back from the server\n conn.on_response do |backend, resp|\n\n if @config[:verbose]\n _, msg = WireMongo::receive(resp)\n # nil \n # nil \n # nil \n @log.info 'from server'\n @log.info msg\n end\n _, msg = WireMongo::receive(resp)\n # if flag\n # nil \n if not @flag\n @flag = false\n msg[:responseFlags] = 2\n msg[:cursorId] = 0\n msg[:numberReturned] = 1\n msg[:documents] = [{\"$err\"=>\"UnauthorizedError: not authorized to execute command #{@recent[:header][:opCode]} on collection #{@recent[:collection]} of database #{@recent[:database]}\", \"code\"=>13}]\n resp = WireMongo::write(msg)\n end\n resp\n end\n\n conn.on_finish do |backend, name|\n @log.info \"closing client connection #{name}\"\n end\n end",
"def run(api_method = :api)\n orig_command = \"%s %s\" % [api_method, raw]\n Log.debug \"saying #{orig_command}\"\n resp = @fs_socket.say(orig_command)\n if resp[\"body\"] =~ /USAGE/\n Log.warn \"This server does not support #{raw}, trying Calls\"\n return Calls.new(@fs_socket, :detailed).run\n else\n unless resp[\"body\"] == \"0 total.\"\n call_info, count = resp[\"body\"].split(\"\\n\\n\")\n require \"fsr/model/channel\"\n require \"csv\"\n channels = CSV.parse(call_info) \n headers = channels[0]\n @channels = channels[1 .. -1].map { |c| FSR::Model::Channel.new(headers ,*c) }\n return @channels\n end\n []\n end\n end",
"def call\r\n # TODO: rename to more appropriate one 2007/05/10 by shino\r\n self.modify_message\r\n logger.debug{\"Ap4r::Dispatcher after modification\\n#{@message.to_yaml}\"}\r\n self.invoke\r\n self.validate_response\r\n self.response\r\n end",
"def evaluate_command(data)\n cmd = data['cmd']\n ownnick = params[:nickname]\n\n ## for description of the meaning see below (at function definitions)\n\n if cmd == 'add_contact'\n return add_contact(ownnick, data['nickname'])\n end\n if cmd == 'remove_contact'\n return remove_contact(ownnick, data['nickname'])\n end\n if cmd == 'request_auth'\n return request_auth(ownnick, data['to'], data['message'])\n end\n if cmd == 'grant_auth'\n return grant_auth(ownnick, data['nickname'])\n end\n if cmd == 'withdraw_auth'\n return withdraw_auth(ownnick, data['nickname'])\n end\n if cmd == 'get_pubkey'\n return get_publickey(data['nickname'])\n end\n if cmd == 'pull_clist'\n return pull_clist(ownnick)\n end\n if cmd == 'pull_queue'\n return pull_queue(ownnick)\n end\n if cmd == 'send_im'\n return send_im(ownnick, data['to'], data['message'])\n end\n if cmd == 'check_online_state'\n return check_online_state(ownnick,data['nickname'])\n end\n if cmd == 'delete_account' #can also happen :(\n return delete_account(ownnick, params[:password]) #huge cleanup function\n end\n\n #for demonstration - calculator...\n if cmd == 'calc'\n return calc(data['expression'])\n end\n\n #########################\n #nothing matched\n return {'response'=>false,'report'=>'Unknown command: '+cmd}\nend",
"def process_client(c)\n Thread.current[:client] = c\n Thread.current[:info] = {\n :port => client.peeraddr[1],\n :host => client.peeraddr[2],\n :addr => client.peeraddr[3],\n }\n info[:uri] = [info[:host], info[:port]].join(':')\n logger.debug \"Processing client from #{info[:uri]}\"\n while line = client.gets\n line = line.chomp.strip\n logger.info \"Dispatching command (#{info[:uri]}): #{line}\"\n @handlers.each do |handler|\n if handler = handler.new(self).match(line.chomp.strip)\n handler.call\n next\n end\n end\n end\n end",
"def receive_json( json )\n emit( 'json_received', json )\n raise Rpc::InvalidRequest.new( extra_msg: \"cmd is not a kind of Hash : #{json.class.name}\" ) unless json.kind_of?( Hash )\n raise Rpc::InvalidRequest.new( id: json[\"id\"], extra_msg: \"cmd.jsonrpc is #{json[\"jsonrpc\"].inspect} instead of #{Rpc::VERSION.inspect}\" ) unless @skip_jsonrpc_field || json[\"jsonrpc\"] == Rpc::VERSION\n if json[\"method\"]\n raise Rpc::InvalidRequest.new( extra_msg: \"cmd.id is not a kind of String or Number #{json[\"id\"].class.name}\" ) unless json[\"id\"].nil? || json[\"id\"].kind_of?( String ) || json[\"id\"].kind_of?( Numeric )\n raise Rpc::InvalidRequest.new( id: json[\"id\"], extra_msg: \"cmd.method is not a kind of String #{json[\"method\"].class.name}\" ) unless json[\"method\"].kind_of?( String )\n raise Rpc::InvalidRequest.new( id: json[\"id\"], extra_msg: \"cmd.params is not a kind of Array or Hash. #{json[\"params\"].class.name}\" ) unless json[\"params\"].nil? || json[\"params\"].kind_of?( Array ) || json[\"params\"].kind_of?( Hash )\n json[\"id\"] ? receive_request( json ) : receive_notification( json )\n elsif json[\"result\"] != nil || ( json[\"error\"] && json[\"id\"] )\n raise Rpc::InvalidRequest.new( extra_msg: \"cmd.id is not a kind of String or Number : #{json[\"id\"].class.name}\" ) unless json[\"id\"].kind_of?( String ) || json[\"id\"].kind_of?( Numeric )\n receive_response( json )\n elsif json[\"error\"]\n emit( 'error', json )\n else\n raise Rpc::InvalidRequest.new( extra_msg: \"Wait a 'method', a 'result' or an 'error' member.\" )\n end\n rescue => err\n Handler.log.error err\n raise\n end",
"def actions()\n\t(\n\t\tcall_src_sip_username = _arg( 'Caller-Username' )\n\t\tcall_src_cid_userinfo = _arg( 'Caller-Caller-ID-Number' )\n\t\tcall_src_cid_displayname = _arg( 'Caller-Caller-ID-Name' )\n\t\tcall_dst_sip_userinfo = _arg( 'Caller-Destination-Number' )\n\t\tcall_dst_sip_domain = _arg( 'var_sip_to_host' )\n\t\t\n\t\t# Strip \"-kambridge-\" prefix added in kamailio.cfg:\n\t\tcall_dst_sip_userinfo = call_dst_sip_userinfo.gsub( /^-kambridge-/, '' )\n\t\t\n\t\tlogger.info(_bold( \"[FS] Call-proc. request, acct. #{call_src_sip_username.inspect} as #{call_src_cid_userinfo.inspect} (#{call_src_cid_displayname.inspect}) -> #{call_dst_sip_userinfo.inspect} ...\" ))\n\t\t_args.each { |k,v|\n\t\t\tcase v\n\t\t\t\twhen String\n\t\t\t\t\t#logger.debug( \" #{k.ljust(36)} = #{v.inspect}\" )\n\t\t\t\t#when Hash\n\t\t\t\t#\tv.each { |k1,v1|\n\t\t\t\t#\t\tlogger.debug( \" #{k}[ #{k1.ljust(30)} ] = #{v1.inspect}\" )\n\t\t\t\t#\t}\n\t\t\tend\n\t\t}\n\t\t\n\t\t# For FreeSwitch dialplan applications see\n\t\t# http://wiki.freeswitch.org/wiki/Mod_dptools\n\t\t# http://wiki.freeswitch.org/wiki/Category:Dptools\n\t\t\n\t\t# Note: If you want to do multiple iterations (requests) you\n\t\t# have to set channel variables to keep track of \"where you\n\t\t# are\" i.e. what you have done already.\n\t\t# And you have to explicitly send \"_continue\" as the last\n\t\t# application.\n\t\t\t\t\n\t\tif call_dst_sip_userinfo.blank?\n\t\t\tcase _arg( 'Answer-State' )\n\t\t\t\twhen 'ringing'\n\t\t\t\t\taction :respond , '404 Not Found' # or '400 Bad Request'? or '484 Address Incomplete'?\n\t\t\t\telse\n\t\t\t\t\taction :hangup , ''\n\t\t\tend\n\t\telse\n\t\t\t\n\t\t\tcall_dst_real_sip_username = call_dst_sip_userinfo # un-alias\n\t\t\t# (Alias lookup has already been done in kamailio.cfg.)\n\t\t\t\n\t\t\t# Here's an example: {\n\t\t\t#action :set , 'effective_caller_id_number=1234567'\n\t\t\t#action :bridge , \"sofia/internal/#{call_dst_real_sip_username}\"\n\t\t\t#action :answer\n\t\t\t#action :sleep , 1000\n\t\t\t#action :playback , 'tone_stream://%(500, 0, 640)'\n\t\t\t#action :set , 'voicemail_authorized=${sip_authorized}'\n\t\t\t#action :voicemail , \"default $${domain} #{call_dst_real_sip_username}\"\n\t\t\t#action :hangup\n\t\t\t#action :_continue\n\t\t\t# end of example }\n\t\t\t\n\t\t\t\n\t\t\t# http://kb.asipto.com/freeswitch:kamailio-3.1.x-freeswitch-1.0.6d-sbc#dialplan\n\t\t\t\n\t\t\t#OPTIMIZE Implement call-forwardings here ...\n\t\t\t\n\t\t\t# Ring the SIP user via Kamailio for 30 seconds:\n\t\t\taction_log( FS_LOG_INFO, \"Calling #{call_dst_real_sip_username} ...\" )\n\t\t\taction :set , \"call_timeout=5\"\n\t\t\taction :export , \"sip_contact_user=ufs\"\n\t\t\taction :bridge , \"sofia/internal/#{call_dst_real_sip_username}@127.0.0.1\"\n\t\t\t\n\t\t\t#OPTIMIZE Implement call-forward on busy/unavailable here ...\n\t\t\t\n\t\t\t# Go to voicemail:\n\t\t\taction_log( FS_LOG_INFO, \"Going to voicemail ...\" )\n\t\t\taction :answer\n\t\t\taction :voicemail , \"default #{call_dst_sip_domain} #{call_dst_real_sip_username}\"\n\t\t\taction :hangup\n\t\t\t\n\t\t\t\n\t\tend\n\t\t\n\t\t\n\t\trespond_to { |format|\n\t\t\tformat.xml {\n\t\t\t\trender :actions, :layout => false\n\t\t\t}\n\t\t\tformat.all {\n\t\t\t\trender :status => '406 Not Acceptable',\n\t\t\t\t\t:layout => false, :content_type => 'text/plain',\n\t\t\t\t\t:text => \"<!-- Only XML format is supported. -->\"\n\t\t\t}\n\t\t}\n\t\treturn\n\t)end",
"def received(data)\n\t\t#\n\t\t# Command failed\n\t\t#\n\t\tif data[0] & 0xA0 == 0xA0\n\t\t\t#\n\t\t\t# We were changing power state at time of failure we should keep trying\n\t\t\t#\n\t\t\tif [0x00, 0x01].include?(last_command[1])\n\t\t\t\tsleep(5)\n\t\t\t\tstatus_lamp\n\t\t\t\treturn true\n\t\t\tend\n\t\t\tlogger.info \"-- NEC projector, sent fail code for command: 0x#{byte_to_hex(array_to_str(last_command))}\"\n\t\t\tlogger.info \"-- NEC projector, response was: 0x#{byte_to_hex(array_to_str(data))}\"\n\t\t\treturn false\n\t\tend\n\t\t\n\t\t#\n\t\t# Check checksum\n\t\t#\n\t\tif !check_checksum(data)\n\t\t\tlogger.debug \"-- NEC projector, checksum failed for command: 0x#{byte_to_hex(array_to_str(last_command))}\"\n\t\t\treturn false\n\t\tend\n\n\t\t#\n\t\t# Process a successful command\n\t\t#\tadd 0x20 to the first byte of the send command\n\t\t#\tThen match the second byte to the second byte of the send command\n\t\t#\n\t\tcase data[0]\n\t\twhen 0x20\n\t\t\tcase data[1]\n\t\t\t\twhen 0x81\n\t\t\t\t\tprocess_lamp_status(data)\n\t\t\t\t\treturn true\n\t\t\t\twhen 0x88\n\t\t\t\t\tprocess_error_status(data)\n\t\t\t\t\treturn true\n\t\t\t\twhen 0x85\n\t\t\t\t\tcase last_command[-2]\n\t\t\t\t\t\twhen 0x02\n\t\t\t\t\t\t\tprocess_input_state(data)\n\t\t\t\t\t\t\treturn true\n\t\t\t\t\t\twhen 0x03\n\t\t\t\t\t\t\tprocess_mute_state(data)\n\t\t\t\t\t\t\treturn true\n\t\t\t\t\tend\n\t\t\tend\n\t\twhen 0x22\n\t\t\tcase data[1]\n\t\t\t\twhen 0x03\n\t\t\t\t\treturn process_input_switch(data)\n\t\t\t\twhen 0x00, 0x01\n\t\t\t\t\tprocess_lamp_command(data)\n\t\t\t\t\treturn true\n\t\t\t\twhen 0x10, 0x11, 0x12, 0x13, 0x14, 0x15\n\t\t\t\t\tstatus_mute\t# update mute status's (dry)\n\t\t\t\t\treturn true\n\t\t\tend\n\t\twhen 0x23\n\t\t\tcase data[1]\n\t\t\t\twhen 0x10\n\t\t\t\t\t#\n\t\t\t\t\t# Picture, Volume, Keystone, Image adjust mode\n\t\t\t\t\t#\thow to play this?\n\t\t\t\t\t#\t\n\t\t\t\t\t#\tTODO:: process volume control\n\t\t\t\t\t#\n\t\t\t\t\treturn true\n\t\t\t\twhen 0x8A\n\t\t\t\t\tprocess_projector_information(data)\n\t\t\t\t\treturn true\n\t\t\tend\n\t\tend\n\t\t\n\t\tlogger.warn \"-- NEC projector, no status updates defined for response: #{byte_to_hex(array_to_str(data))}\"\n\t\tlogger.warn \"-- NEC projector, command was: 0x#{byte_to_hex(array_to_str(last_command))}\"\n\t\treturn true\t\t\t\t\t\t\t\t\t\t\t# to prevent retries on commands we were not expecting\n\tend",
"def receive_data(data)\n case @state\n when :protocol_proposal\n deferrable = @in_flight\n @state = :idle\n @in_flight = nil\n if data == 'ok'\n send_next_request\n deferrable.succeed\n else\n close_connection\n deferrable.fail(\"server response: #{data.inspect}\")\n end\n\n when :request\n @recv_buf << data\n response_size = @recv_buf.unpack('N').first\n if response_size && @recv_buf.bytesize >= response_size + 4\n response = @recv_buf[4, response_size]\n deferrable = @in_flight\n @state = :idle\n @in_flight = @recv_buf = nil\n send_next_request\n deferrable.succeed(response)\n end\n\n else\n raise \"Received data in unexpected state: #{@state.inspect}\"\n end\n end",
"def receiving(data); end",
"def receiving(data); end",
"def process_response\n job = message.job\n job.data = message.data\n job.message = message.message\n\n if message.ok?\n job.proceed!\n else\n job.error!\n end\n end",
"def reply(data)\n res.json(Satz.serializer.dump(data))\n end",
"def handle_call(client, data)\n call_id, proc_uri, *args = data\n\n trigger(:call, client, call_id, proc_uri, args)\n end",
"def process_msg_from_client ws, ws_context, msg\n if !ws_context[:registered]\n ws.close\n return\n end\n if ws_context[:type] != 'client'\n return\n end\n if msg[:command]\n # a command from client\n @console_service.command(msg[:command], msg[:module_id], msg[:body]) { |err, res|\n if is_request? msg\n if resp = compose_response(msg, err, res)\n ws.send ['client', resp].to_json\n end\n else\n # notify should not have a callback\n end\n }\n else\n # a request or a notify from client\n @console_service.execute(msg[:module_id], :client_handler, msg[:body]) { |err, res|\n if is_request? msg\n if resp = compose_response(msg, err, res)\n ws.send ['client', resp].to_json\n end\n else\n # notify should not have a callback\n end\n }\n end\n end",
"def hook_result(messages); end",
"def response=(_arg0); end",
"def response=(_arg0); end",
"def response=(_arg0); end",
"def response=(_arg0); end",
"def process_messages\n\t\t\tloop do\n\t\t\t\tchan, message = @redis_listener.blpop(\"#{PREFIX}.network:#{@network}.messages\", 0)\n\t\t\t\t@log.debug(\"A client sent the message : #{message}\")\n\t\t\t\tmsgid, command, args = parse(message)\n\t\t\t\tunless command\n\t\t\t\t\t@log.warn(\"A client sent an invalid message.\")\n\t\t\t\t\tnext\n\t\t\t\tend\n\t\t\t\tif msgid && @failed_cmds.include?(msgid) # Every daemon tried to contact the multi (blpop act as first waiting, first served)\n\t\t\t\t\tanswer(msgid, false, \"No daemon could contact the multiplexer\")\n\t\t\t\t\tnext\n\t\t\t\tend\n\t\t\t\tans, info = case command\n\t\t\t\t\twhen \"add_sensor\"\n\t\t\t\t\t\tregister_device :sensor, args\n\t\t\t\t\twhen \"add_actuator\"\n\t\t\t\t\t\tregister_device :actuator, args\n\t\t\t\t\twhen \"delete_sensor\"\n\t\t\t\t\t\tunregister_device :sensor, args\n\t\t\t\t\twhen \"delete_actuator\"\n\t\t\t\t\t\tunregister_device :actuator, args\n\t\t\t\t\twhen \"take\"\n\t\t\t\t\t\ttake_callback args\n\t\t\t\t\twhen \"actuator_state\"\n\t\t\t\t\t\tactuator_state_callback args\n\t\t\t\t\telse\n\t\t\t\t\t\t@log.warn(\"A client sent an unknown command : \\\"#{command}\\\"\")\n\t\t\t\t\t\t[false, \"Unknown command \\\"#{command}\\\"\"]\n\t\t\t\tend\n\t\t\t\tcase ans\n\t\t\t\t\twhen true # Success\n\t\t\t\t\t\tanswer(msgid, true)\n\t\t\t\t\twhen false # Failure\n\t\t\t\t\t\tanswer(msgid, false, info)\n\t\t\t\t\telse # Timeout error, transmit to another daemon\n\t\t\t\t\t\tif not msgid\t\t\t # Generate an id only for daemons\n\t\t\t\t\t\t\tmsgid = rand.hash.abs\n\t\t\t\t\t\t\tmessage = \"#{msgid}:#{message}\"\n\t\t\t\t\t\tend\n\t\t\t\t\t\t@failed_cmds.push(msgid).unshift\n\t\t\t\t\t\t#answer(msgid, false, \"wait\") # TODO utile ?\n\t\t\t\t\t\t@redis_listener.lpush(\"#{PREFIX}.network:#@network.messages\", message) #TODO generate with path?\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def receive_data(msg) \n msg.split(\"\\n\").each do |row|\n begin\n msg_split = row.split(\" \")\n command = msg_split[0]\n\n return unless command\n case\n when command.match(/available/i)\n EM.defer { send_data \"#{JSON(@redis.datapoints)}\\n\" }\n when command.match(/values/i)\n EM.defer do\n command, metric, begin_time, end_time = msg_split\n datapoints, interval = [], 0\n\n if metric.match(/^gauge/)\n datapoints = @diskstore.read(metric, begin_time, end_time)\n else\n Batsd::Server.config[:retentions].each_with_index do |retention, index|\n if (index != Batsd::Server.config[:retentions].count - 1) && (Time.now.to_i - (retention[0] * retention[1]) > begin_time.to_i)\n next\n end\n interval = retention[0]\n\n if index.zero?\n datapoints = @redis.values_from_zset(metric, begin_time, end_time)\n break\n else\n datapoints = @diskstore.read(\"#{metric}:#{retention[0]}\", begin_time, end_time)\n break\n end\n end\n end\n send_data \"#{JSON({'interval' => interval, \"#{metric}\" => datapoints})}\\n\"\n end\n when command.match(/ping/i)\n send_data \"PONG\\n\"\n when command.match(/quit|exit/i)\n send_data \"BYE\\n\"\n close_connection\n else\n send_data \"#{JSON({error: \"Unrecognized command #{command}\"})}\\n\"\n end\n rescue Exception => e\n puts e if ENV[\"VERBOSE\"]\n rescue\n puts \"Uncaught Error\"\n end\n end\n end",
"def execute\n\n case @template[:payload][:method]\n when 'get'\n begin\n out = RestClient.get @template[:payload][:uri]\n response = {:status => 200, :message => \"[i2] GET request on #{@template[:payload][:uri]} executed.\", :id => @template[:payload][:uri], :response => out.to_str}\n rescue Exception => e\n response = {:status => 400, :message => \"Unable to perform GET request, #{e}\"}\n Services::Slog.exception e\n end\n when 'post'\n begin\n\n case @template[:payload][:message]\n when 'form'\n out = RestClient.post @template[:payload][:uri], @template[:payload]\n when 'text/plain'\n out = RestClient.post @template[:payload][:uri], @template[:payload][:content], :content_type => 'text/plain'\n when 'application/javascript'\n if @template[:payload][:content].nil?\n out = RestClient.post @template[:payload][:uri], @template[:payload].to_json, :content_type => 'application/javascript'\n else\n out = RestClient.post @template[:payload][:uri], @template[:payload][:content], :content_type => 'application/javascript'\n end\n when \"application/json\"\n if @template[:payload][:content].nil?\n out = RestClient.post @template[:payload][:uri], @template[:payload].to_json, :content_type => 'application/json'\n else\n out = RestClient.post @template[:payload][:uri], @template[:payload][:content], :content_type => 'application/json'\n end\n when 'application/xml'\n if @template[:payload][:content].nil?\n out = RestClient.post @template[:payload][:uri], @template[:payload].to_xml, :content_type => 'application/xml'\n else\n out = RestClient.post @template[:payload][:uri], @template[:payload][:content], :content_type => 'application/xml'\n end\n when 'text/xml'\n if @template[:payload][:content].nil?\n out = RestClient.post @template[:payload][:uri], @template[:payload].to_xml, :content_type => 'text/xml'\n else\n out = RestClient.post @template[:payload][:uri], @template[:payload][:content], :content_type => 'text/xml'\n end\n when 'text/html'\n out = RestClient.post @template[:payload][:uri], @template[:payload][:content], :content_type => 'text/html'\n end\n\n response = {:status => 200, :message => \"[i2] POST request on #{@template[:payload][:uri]} executed.\", :id => @template[:payload][:uri], :response => out.to_str}\n rescue Exception => e\n response = {:status => 400, :message => \"Unable to perform POST request, #{e}\"}\n end\n when 'put'\n begin\n\n rescue Exception => e\n response = {:status => 440, :message => \"Unable to perform PUT request (not implemented), #{e}\"}\n end\n when 'delete'\n begin\n\n rescue Exception => e\n response = {:status => 440, :message => \"Unable to perform DELETE request (not implemented), #{e}\"}\n end\n end\n response\n end",
"def run_respond(aCommand)\n run(aCommand) do |ch,stream,text|\n \tch[:state] ||= { :channel => ch }\n \toutput = yield(text,stream,ch[:state])\n \tch.send_data(output) if output\n end\nend",
"def dispatch(msg)\n case msg.message_type\n when Message::METHOD_CALL\n if not @intfs[msg.interface]\n raise InterfaceNotInObject, msg.interface\n end\n meth = @intfs[msg.interface].methods[msg.member.to_sym]\n raise MethodNotInInterface if not meth\n methname = Object.make_method_name(msg.interface, msg.member)\n retdata = method(methname).call(*msg.params)\n\n reply = Message.new.reply_to(msg)\n # I'm sure there is a ruby way to do that\n i = 0\n if meth.rets.size > 0 and not retdata.kind_of?(Array)\n raise InvalidReturnType\n end\n meth.rets.each do |rsig|\n reply.add_param(rsig[1], retdata[i])\n end\n @service.bus.send(reply.marshall)\n end\n end",
"def process_argv(option, num1, num2)\n port = 9090\n\n transporte = Thrift::Socket.new('localhost', port)\n transporte = Thrift::BufferedTransport.new(transporte)\n protocolo = Thrift::BinaryProtocol.new(transporte)\n\n client = CalculatorService::Client.new(protocolo)\n transporte.open()\n case option\n when \"-h\"\n puts \"This is the help menu.\"\n puts \"Example: [command] num1 num2\"\n puts \" --sum sum two numbers\"\n puts \" --substract substract two numbers\"\n puts \" --division divide two numbers\"\n puts \" --multiply multiply two numbers\"\n exit\n when \"--sum\"\n result = client.Sum(num1.to_f, num2.to_f)\n puts \"Result: \" + result.result.to_s\n \n when \"--substract\"\n result = client.Subtraction(num1.to_f, num2.to_f)\n puts \"Result: \" + result.result.to_s\n when \"--division\"\n result = client.Division(num1.to_f, num2.to_f)\n puts \"Result: \" + result.result.to_s\n when \"--multiply\"\n result = client.Multiplication(num1.to_f, num2.to_f)\n puts \"Result: \" + result.result.to_s\n end\n transporte.close()\nend",
"def socks_parse_response\n case @socks_state\n when :method_negotiation\n return unless @socks_data.size >= 2\n\n _, method = @socks_data.slice!(0, 2).unpack('CC')\n\n if socks_methods.include?(method)\n case method\n when 0 then socks_send_connect_request\n when 2 then socks_send_authentication\n end\n else\n raise SOCKSError, 'proxy did not accept method'\n end\n\n when :authenticating\n return unless @socks_data.size >= 2\n\n socks_version, status_code = @socks_data.slice!(0, 2).unpack('CC')\n\n raise SOCKSError, \"SOCKS version 5 not supported\" unless socks_version == 5\n raise SOCKSError, 'access denied by proxy' unless status_code == 0\n\n socks_send_connect_request\n\n when :connecting\n return unless @socks_data.size >= 2\n\n socks_version, status_code = @socks_data.slice(0, 2).unpack('CC')\n\n raise SOCKSError, \"SOCKS version #{socks_version} is not 5\" unless socks_version == 5\n raise SOCKSError.for_response_code(status_code) unless status_code == 0\n\n min_size = @socks_data[3].ord == 3 ? 5 : 4\n\n return unless @socks_data.size >= min_size\n\n size = case @socks_data[3].ord\n when 1 then 4\n when 3 then @socks_data[4].ord\n when 4 then 16\n else raise SOCKSError.for_response_code(@socks_data[3])\n end\n\n return unless @socks_data.size >= (min_size + size)\n\n bind_addr = @socks_data.slice(min_size, size)\n\n ip = case @socks_data[3].ord\n when 1 then bind_addr.bytes.to_a.join('.')\n when 3 then bind_addr\n when 4 then # TODO: ???\n end\n\n socks_unhook(ip)\n end\n rescue Exception => e\n @socks_deferrable.fail(e)\n end",
"def methods(*args)\n super | rpc_methods\n end",
"def call_a(rpcname, args=nil)\n rpc = VistaRPC.new(rpcname, RPCResponse::ARRAY)\n if !args.nil?\n rpc.params = args\n end\n rpcresponse = execute(rpc)\n if rpcresponse.nil?\n return nil\n end\n if !rpcresponse.error_message.nil?\n @lastvistaerror = rpcresponse.error_message\n end\n return rpcresponse.value\n end",
"def read_rtu_response(io)\n\t # Read the slave_id and function code\n msg = nil\n while msg.nil?\n\t msg = io.read(2)\n end\n\n function_code = msg.getbyte(1)\n case function_code\n when 1,2,3,4 then\n # read the third byte to find out how much more\n # we need to read + CRC\n msg += io.read(1)\n msg += io.read(msg.getbyte(2)+2)\n when 5,6,15,16 then\n # We just read in an additional 6 bytes\n msg += io.read(6)\n when 22 then\n msg += io.read(8)\n when 0x80..0xff then\n msg += io.read(3)\n else\n io.read\n raise ModBus::Errors::ResponseIgnored, \"Illegal function: #{function_code}\"\n end\n end"
] | [
"0.63153875",
"0.622617",
"0.6218907",
"0.62075",
"0.6169773",
"0.6132769",
"0.6126708",
"0.6115627",
"0.60541344",
"0.59888375",
"0.5978423",
"0.5963581",
"0.59628373",
"0.59484845",
"0.5926947",
"0.5895297",
"0.58793026",
"0.5877376",
"0.58488405",
"0.58384126",
"0.58135504",
"0.5799494",
"0.57926184",
"0.57886195",
"0.578527",
"0.57832235",
"0.57757926",
"0.5772965",
"0.5768882",
"0.5757744",
"0.57562256",
"0.57510096",
"0.573859",
"0.56955117",
"0.5682109",
"0.56767523",
"0.5669362",
"0.56662655",
"0.56601673",
"0.5654571",
"0.5647781",
"0.56450397",
"0.56412196",
"0.5632658",
"0.5625083",
"0.5624409",
"0.56236225",
"0.56223756",
"0.56222135",
"0.5616193",
"0.5611298",
"0.55987763",
"0.5597292",
"0.5596531",
"0.55941784",
"0.55933684",
"0.55901116",
"0.5583635",
"0.55789524",
"0.5576993",
"0.5568026",
"0.5563244",
"0.55499977",
"0.55336225",
"0.5527477",
"0.5518982",
"0.5514917",
"0.550983",
"0.5505878",
"0.55039114",
"0.54926604",
"0.549158",
"0.5484173",
"0.54801357",
"0.54687226",
"0.5456986",
"0.5444938",
"0.5444747",
"0.5429904",
"0.5422311",
"0.5422311",
"0.54193205",
"0.54162854",
"0.54151094",
"0.5412112",
"0.54119104",
"0.5408958",
"0.5408958",
"0.5408958",
"0.5408958",
"0.5408215",
"0.54042894",
"0.5403243",
"0.53976095",
"0.5385685",
"0.5383391",
"0.5379982",
"0.5378229",
"0.53711617",
"0.53669596"
] | 0.57379323 | 33 |
Finalizes the function returning a result object | def summarize
summary = @functions.map do |function|
begin
function.summarize
rescue Exception => e # rubocop:disable Lint/RescueException
Log.error("Could not summarize aggregate result for '%s': %s" % [function.output_name, e])
@failed << {:name => function.output_name, :type => :summarize}
nil
end
end
summary.reject(&:nil?).sort do |x, y|
x.result[:output] <=> y.result[:output]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def finish(_result)\n end",
"def clear_result; end",
"def finalise\n end",
"def finalized; end",
"def finalize!; end",
"def finalize\n nil\n end",
"def finalize\n end",
"def finalize\n end",
"def finalize\n end",
"def finalize\n end",
"def finalize\n end",
"def finalize\n end",
"def finalize\n end",
"def prepare_result; end",
"def finalize\n\n end",
"def finalize\n end",
"def with_clean_result # :nodoc:\n was_result = @result\n yield\n @result\n ensure\n @result = was_result\n end",
"def original_result; end",
"def finish \n @_.dup.freeze\n end",
"def finish \n @_.dup.freeze\n end",
"def free_result\n IBM_DB.free_result(@stmt)\n end",
"def finalize\n class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def serialize(buffer = \"\")\n #{serialization.map { |command| \"#{command}(buffer)\" }.join(\"\\n\")}\n buffer\n end\n alias to_s serialize\n RUBY\n end",
"def __finalize__\n\t\t@__hash__.each { |k,v|\n\t\t\t@__hash__[k] = v.call if v.respond_to?(:call)\n\t\t}\n\tend",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def finalize_operations\n\tend",
"def finish()\n #This is a stub, used for indexing\n end",
"def result()\n end",
"def finish; end",
"def finish; end",
"def finish; end",
"def finish; end",
"def finish; end",
"def finish; end",
"def finish; end",
"def finish; end",
"def result=(_); end",
"def finally\n end",
"def done!(result = nil)\n begin\n self.class.processor_for(type).call(self, result)\n destroy\n rescue Jobber::ResultRejected\n unlock!\n end\n end",
"def finalize!\n @finalized = true\n self\n end",
"def finish(*args,&ruby_block)\n # Gain access to the finisher as local variable.\n finisher_proc = @finisher_proc\n # # The context is the one of the finisher.\n # Execute the code generating the finisher in context.\n HDLRuby::High.space_push(@namespace)\n HDLRuby::High.cur_block.open do\n instance_exec(ruby_block,*args,&finisher_proc)\n end\n HDLRuby::High.space_pop\n end",
"def use_result\n store_result\n end",
"def initialize(original_result); end",
"def store_result(result); end",
"def finalize!(result)\n @session.finish(result)\n self.class.instruments.each { |i| i.after(@session) }\n SessionFinalizer.instance.finalize!(self.class.instruments, @session)\n end",
"def finalize(function = nil)\n configure(:finalize, function)\n end",
"def result\n @result = yield\n end",
"def finalize(bool=true)\n update(:finalized => bool)\n end",
"def finish(*args,&ruby_block)\n # Gain access to the finisher as local variable.\n finisher_proc = @finisher_proc\n # Execute the code generating the accesser in context.\n HDLRuby::High.space_push(@namespace)\n HDLRuby::High.cur_block.open do\n instance_exec(ruby_block,*args,&finisher_proc)\n end\n HDLRuby::High.space_pop\n end",
"def final; end",
"def finish(*args,&ruby_block)\n # Gain access to the accesser as local variable.\n finisher_proc = @finisher_proc\n # Execute the code generating the accesser in context.\n HDLRuby::High.space_push(@namespace)\n HDLRuby::High.cur_block.open do\n instance_exec(ruby_block,*args,&finisher_proc)\n end\n HDLRuby::High.space_pop\n end",
"def get_finalize()\n finalize_js = <<-'END_OF_FINALIZE'\n function(key, val) {\n var newval = {}\n newval[\"total\"] = 0\n print (val.toSource())\n for (command in val) {\n// print (\"val[\"+command+\"] = \"+ val[\"command\"])\n newval[command] = val[command]\n newval[\"total\"] += val[command]\n }\n return (newval);\n }\n END_OF_FINALIZE\n \nreturn finalize_js\n \nend",
"def do_finalization(key,obj)\n\t\t\t\t@finalizers.each do |f|\n\t\t\t\t\tf[0].call(key,obj,*f[1])\n\t\t\t\tend\n\t\t\tend",
"def return(&block); end",
"def process_result\n end",
"def finalize!\n @_values.freeze\n end",
"def _reduce_13(val, _values, result)\n @handler.start_object \n result\nend",
"def results=(_arg0); end",
"def results=(_arg0); end",
"def discard_results; end",
"def cleanup; end",
"def cleanup; end",
"def cleanup; end",
"def cleanup; end",
"def finalize!\n return self if frozen?\n\n super\n freeze\n end",
"def cleanup!; end",
"def cleanup!; end",
"def store_result()\n #This is a stub, used for indexing\n end",
"def finalize\n return unless cache = self[:cache]\n\n finalize_settings.each do |meth, key|\n next if has_key?(key)\n\n send(meth)\n self[key] = cache.delete(key) if cache.has_key?(key)\n end\n\n nil\n end",
"def clear\n @res = @fields = @result = nil\n end",
"def finalize\n destroy_previous\n promote_cached\n @previous = nil\n end",
"def finish(options); end",
"def finished=(_arg0); end",
"def finish\n end",
"def result\n end",
"def initialize\n @result = result\n end",
"def abandon_results!()\n #This is a stub, used for indexing\n end",
"def returns; end",
"def return!(&block); end",
"def clearResult\n @mResult.clear\n end",
"def exit(param)\n @result = param\n end",
"def dematerialize ; end",
"def execute(input_set = nil)\n resp = super(input_set)\n results = FinalizeOAuthResultSet.new(resp)\n return results\n end",
"def execute(input_set = nil)\n resp = super(input_set)\n results = FinalizeOAuthResultSet.new(resp)\n return results\n end",
"def execute(input_set = nil)\n resp = super(input_set)\n results = FinalizeOAuthResultSet.new(resp)\n return results\n end",
"def execute(input_set = nil)\n resp = super(input_set)\n results = FinalizeOAuthResultSet.new(resp)\n return results\n end",
"def execute(input_set = nil)\n resp = super(input_set)\n results = FinalizeOAuthResultSet.new(resp)\n return results\n end",
"def execute(input_set = nil)\n resp = super(input_set)\n results = FinalizeOAuthResultSet.new(resp)\n return results\n end",
"def result_unlock\n\n end",
"def finalize\n yield [key, @count]\n end",
"def process(result)\n result\n end",
"def set_result\n @result = Result.new\n end",
"def finalise(_ = nil)\n answers.select(&:attempting?).each(&:finalise!)\n end",
"def result\n self\n end",
"def result\n self\n end"
] | [
"0.6868573",
"0.684749",
"0.67059416",
"0.6559592",
"0.63404405",
"0.6323175",
"0.6240594",
"0.6240594",
"0.6240594",
"0.6240594",
"0.6240594",
"0.6240594",
"0.6240594",
"0.6230367",
"0.6182199",
"0.6153636",
"0.60507613",
"0.6024462",
"0.59965855",
"0.59965855",
"0.5970299",
"0.5939831",
"0.5922809",
"0.5919899",
"0.5919899",
"0.5919899",
"0.5919899",
"0.5919899",
"0.5919899",
"0.5919899",
"0.5919899",
"0.5901546",
"0.5877508",
"0.5848423",
"0.58175343",
"0.58175343",
"0.58175343",
"0.58175343",
"0.58175343",
"0.58175343",
"0.58175343",
"0.58175343",
"0.5798937",
"0.57955974",
"0.5760845",
"0.5739973",
"0.57072544",
"0.5694733",
"0.56907403",
"0.56888056",
"0.5688042",
"0.56784964",
"0.5658766",
"0.56369686",
"0.5631744",
"0.5630319",
"0.56281185",
"0.56010264",
"0.5600221",
"0.5599647",
"0.5590077",
"0.5579926",
"0.55750245",
"0.5571629",
"0.5571629",
"0.5561855",
"0.5559466",
"0.5559466",
"0.5559466",
"0.5559466",
"0.55406094",
"0.5528901",
"0.5528901",
"0.55198604",
"0.5518508",
"0.5505581",
"0.55010307",
"0.55009425",
"0.5499508",
"0.5484248",
"0.5445382",
"0.5440265",
"0.54351014",
"0.54325175",
"0.541343",
"0.5410144",
"0.5409172",
"0.5392466",
"0.5389938",
"0.5389938",
"0.5389938",
"0.5389938",
"0.5389938",
"0.5389938",
"0.5376003",
"0.53716105",
"0.5366156",
"0.5357231",
"0.5350013",
"0.53411615",
"0.53411615"
] | 0.0 | -1 |
Loads function from disk for use | def load_function(function_name)
function_name = function_name.to_s.capitalize
PluginManager.loadclass("MCollective::Aggregate::%s" % function_name) unless Aggregate.const_defined?(function_name)
Aggregate.const_get(function_name)
rescue Exception # rubocop:disable Lint/RescueException
raise("Aggregate function file '%s.rb' cannot be loaded" % function_name.downcase)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load!; end",
"def load(file_path); end",
"def load(file_path); end",
"def load(path); end",
"def load; end",
"def load; end",
"def load; end",
"def load(name)\n Kernel.load name\nend",
"def puppet_function_load(name)\n name = name.to_sym unless name.is_a? Symbol\n Puppet::Parser::Functions.autoloader.load name\n end",
"def load(name); end",
"def load(file); end",
"def load\n end",
"def load\n end",
"def load\n end",
"def load_file(filename); end",
"def load_file(filename); end",
"def load(filename)\n end",
"def l(filename)\n load \"#{filename}.rb\"\nend",
"def read_from_file(iFileName)\n lStrFunction = nil\n if (File.exists?(iFileName))\n File.open(iFileName, 'r') do |iFile|\n lStrFunction = iFile.read\n end\n else\n raise RuntimeError.new(\"Missing file #{iFileName} to load function.\")\n end\n begin\n @Function = eval(lStrFunction)\n rescue Exception\n raise RuntimeError.new(\"Invalid function specified in file #{iFileName}: #{$!}\")\n end\n convertDataTypes\n optimize\n end",
"def load_file(file); end",
"def load_path; end",
"def load_script(file); end",
"def load_file(file_path)\n\t\t\tcode = File.open(file_path) { |f| f.read }\n\t\t\trun(code)\n\t\tend",
"def load_or_run(path)\n result = nil\n if File.exist?(path)\n File.open(path, 'rb') { |f| result = Marshal.load(f) }\n else\n result = yield\n File.open(path, 'wb') { |f| Marshal.dump(result, f) }\n end\n result\nend",
"def load\r\n \r\n end",
"def load_script(path)\n eval(load_data(path))\nend",
"def load_factories_if_file(path)\n Kernel.load(\"#{path}.rb\") if File.exists?(\"#{path}.rb\")\n end",
"def load_file(file)\n kernel_load(file)\n end",
"def import_file(path)\n return Kernel.load(path)\nend",
"def loader; end",
"def load\n end",
"def load\n end",
"def load\n end",
"def load_from_file_cache(file)\n puts \"loading stuff from #{file}\"\n File.open(file, 'r') do |input|\n Marshal.load(input.read)\n end\n end",
"def eval_file; end",
"def load_file(path)\n load(path)\n end",
"def load(fn)\n return if ! File.exists?(fn)\n lines = File.read fn\n lines.gsub!(/\\\\ /, SPACE_MARK)\n lines.gsub!(/#[^\\n]*\\n/m, \"\")\n lines.gsub!(/\\\\\\n/, ' ')\n lines.each_line do |line|\n process_line(line)\n end\n end",
"def run(_path)\n return instance_eval(File.read(_path)) if File.extname(_path) == '.rb'\n _source = Heist.parse(File.read(_path))\n _scope = FileScope.new(self, _path)\n _source.eval(_scope)\n end",
"def load_file(path)\n send_cmd(\"load #{path}\")\n end",
"def from_file(path)\n\t\t\t\told_eval_path,@current_eval_path = @current_eval_path,path\n\t\t\t\tinstance_eval path.read, path.to_s\n\t\t\tensure\n\t\t\t\t@current_eval_path = old_eval_path\n\t\t\tend",
"def load_file(file_path)\n\t\t\tcode = File.open(file_path) { |f| f.read }\n\t\t\t@interpreter.run(code)\n\t\tend",
"def load_sym(name)\n functions = (self.__cached_functions__ ||= {})\n functions[name] ||= begin\n symfunc = self.loader.load_sym(name, GL_COMMAND_TYPES[name])\n\n if symfunc.nil?\n raise NoMethodError, \"GL function #{name} could not be loaded\"\n end\n\n symfunc\n end\n end",
"def load(filename)\n\t\tend",
"def load(file)\n path = expand_path(file)\n runtime.run(path) if path\n end",
"def load\n if File.exist?(@path) && !self.loaded?\n @source = File.read(@path)\n context = Context.new(self)\n eval @source, context.binding, @path.to_s, 1\n @loaded = true\n end \n end",
"def load_from_file(name, path, env = default_environment)\n if autoloader.load(path, env)\n # the autoloaded code should add its macro to macros\n unless m = self.macro(name,env,false)\n Puppet.debug(\"#{autoloader.expand(path).inspect} loaded but it \" +\n \"didn't define macro #{name.inspect}\")\n end\n m\n else\n Puppet.debug(\"could not autoload #{autoloader.expand(path).inspect}\")\n nil\n end\n end",
"def load_and_run!\n File.open(@pathfile, \"w\") { |f| f.write(@pathfile_contents) }\n Pathological.add_paths!(@load_path)\n end",
"def load_extension path\n instance_eval(File.read(File.join(File.dirname(__FILE__), path)))\n end",
"def load(id, *args, &blk); end",
"def load_file\n raise NotImplementedError, \"loading Ruby source files is not implemented\"\n end",
"def load(fn) # :nodoc:\n lines = File.read fn\n lines.gsub!(/\\\\ /, SPACE_MARK)\n lines.gsub!(/#[^\\n]*\\n/m, \"\")\n lines.gsub!(/\\\\\\n/, \" \")\n lines.each_line do |line|\n process_line(line)\n end\n end",
"def load_source\n load source\n end",
"def script_load(script); end",
"def load(filename)\n run \"load #{OptArg.quote(filename)}\"\n nil\n end",
"def from_file(fn, code_type = nil)\n if fn == Pry.eval_path\n f = Pry.line_buffer.drop(1)\n else\n if File.readable?(fn)\n f = File.open(fn, 'r')\n code_type = type_from_filename(fn)\n else\n raise MethodSource::SourceNotFoundError, \"Cannot open #{fn.inspect} for reading.\"\n end\n end\n new(f, 1, code_type || :ruby)\n ensure\n f.close if f.respond_to?(:close)\n end",
"def load_file(path)\n load_string(File.binread(path))\n end",
"def load_dataE(filename)\r\n Log.ger.debug('Read '+filename)\r\n File.open(filename, \"rb\") { |f|\r\n obj = Marshal.load(f)\r\n }\r\nend",
"def from_file path\n run File.read(path) if File.exists? path\n end",
"def load_file(file)\n return if @loaded.include? file\n\n # We have to specify Kernel.load, because we have a load method.\n begin\n # Store the file path so we don't try to reload it\n @loaded << file\n Kernel.load(file)\n rescue ScriptError => detail\n # Don't store the path if the file can't be loaded\n # in case it's loadable later on.\n @loaded.delete(file)\n Facter.warn \"Error loading fact #{file} #{detail}\"\n end\n end",
"def load\n eval(@data, TOPLEVEL_BINDING, @filename)\n end",
"def struct_load(file_path)\n if(eval_disabled?)\n raise 'Ruby based configuration evaluation is currently disabled!'\n else\n result = Module.new.instance_eval(\n IO.read(file_path), file_path, 1\n )\n result._dump.to_smash\n end\n end",
"def load_method klass_name, method_name\n file = method_file klass_name, method_name\n\n File.open file, 'rb' do |io|\n obj = Marshal.load io.read\n obj.store = self\n obj.parent =\n find_class_or_module(klass_name) || load_class(klass_name) unless\n obj.parent\n obj\n end\n rescue Errno::ENOENT => e\n error = MissingFileError.new(self, file, klass_name + method_name)\n error.set_backtrace e.backtrace\n raise error\n end",
"def load\n\t\tsource = self.depfile.read\n\t\tself.instance_eval( source, self.depfile.to_s, 1 )\n\tend",
"def load_path=(load_path); end",
"def _load(path)\n path = Pathname.new(path)\n @loader.load(path)\n end",
"def ld(lib)\n load lib.to_s + '.rb'\n end",
"def fetch(fn)\n return fn unless fn.instance_of? Symbol\n respond_to?(fn) ? method(fn) : store.fetch(fn)\n rescue\n raise FunctionNotFoundError.new(fn, self)\n end",
"def load\n if File.exist?(@file_path)\n\n @_cache = JSON File.open(@file_path, &:read).strip\n else\n $stderr.puts \"#{@file_path} does not exist\"\n end\n end",
"def load\n return unless @file_path && File.exist?(@file_path)\n File.open(@file_path, 'rb') do |file|\n return Marshal.load(file)\n end\n end",
"def load file='GOL.sav'\n self.state=File.open(file,'r') do |f|\n Marshal.load(f)\n end\n end",
"def load(filename = '')\n catch_load_error(filename) do\n _load(filename)\n set_proc_line\n end\n end",
"def load_script(debug)\n @file_path = @path\n @load_path = File.expand_path @path\n\n load_error unless loadable? @load_path\n load_file\n\n # HACK we use __send__ here so that the method inliner\n # doesn't accidentally inline a script body into here!\n MAIN.__send__ :__script__\n CodeLoader.loaded_hook.trigger!(@path)\n end",
"def helper(file)\n instance_eval(File.read(file), file)\n end",
"def after_safe_load(file)\n end",
"def file\n #load_file\n @file ||= load_file\n end",
"def load_script(name)\r\n script = File.read(name)\r\n eval script, binding, name\r\nend",
"def load!(file = T.unsafe(nil)); end",
"def load\n instance_eval File.read(@path).tap(&Gem::UNTAINT), @path, 1\n\n self\n end",
"def reload\n load __FILE__\nend",
"def load_from(m, *args, &blk)\n return if :nothing == m\n meth = \"load_from_#{m}\".to_sym\n if private_methods.include?(meth) or respond_to?(meth)\n send meth, *args, &blk \n else\n raise NoMethodError, \"#{m} is not a proper loader\"\n end\n end",
"def pre_hard_load(mod); end",
"def loadFile _args\n \"loadFile _args;\" \n end",
"def loaded()\n end",
"def load()\n code = File.open(@filename) {|file| file.read}\n dup = @players.last.dup\n begin\n dup.reset\n dup.instance_eval(code)\n @players.push(dup)\n rescue\n puts \"LOAD ERROR #{$!}\"\n end\n @load_time = Time.now.to_i\n end",
"def eval_file(file)\n file = File.join(__dir__, file)\n eval(File.read(file), nil, file) # rubocop:disable Security/Eval\nend",
"def reload\n load @filename\n end",
"def fl(file_name)\n file_name += '.rb' unless file_name =~ /\\.rb/\n @@recent = file_name \n load \"#{file_name}\"\nend",
"def load_compiled_file(path, version)\n Ruby.primitive :compiledfile_load\n\n raise InvalidRBC, path\n end",
"def load(data)\n end",
"def load_source!\n @source = load_file_contents\n end",
"def load\r\n\t\tload_file\r\n\t\tconfigure\r\n\tend",
"def safe_load(file)\n before_safe_load(file)\n load(file)\n after_safe_load_succeed(file)\n rescue Object => ex\n Log.error(ex)\n after_safe_load_failed(file, ex)\n end",
"def file path\n STDERR.puts \"file called with: #{path}\"\n puts \"Loading file: #{path}\"\n begin\n load path\n rescue => e\n puts e.inspect\n puts e.backtrace.join(\"\\n\\tfrom \")\n end\n end",
"def foo(file_name)\n puts \"Successfully loaded #{file_name}.\"\nend",
"def get_loaded_model(model_path, file); end",
"def load (scriptPath)\n @examRip.instance_eval( File.read( scriptPath ) , scriptPath, 1)\n end",
"def register_udf_from_file(client_path, server_path, language, options = nil)\n udf_body = File.read(client_path)\n register_udf(udf_body, server_path, language, options)\n end",
"def load_file(filename)\n instance_eval File.read(filename), filename, 1\n self\n end",
"def load(playground, stack, file)\n raise \"Circular dependency detected: #{stack.join('=>')}=>#{file}\" if stack.include?(file)\n\n source = File.read(file)\n stack.push file\n id = File.basename(file, \".rb\").downcase.gsub(/\\W/, \"_\").to_sym\n context = Object.new\n context.instance_eval do\n extend Definition\n metric = eval(source, context.new_binding(playground, id), file) # rubocop:todo Security/Eval\n raise NameError.new(\"Expected #{file} to define metric #{id}\", id) unless playground.metrics[id]\n\n metric\n end\n rescue StandardError\n error = NameError.exception($!.message, id)\n error.set_backtrace $!.backtrace\n raise error\n ensure\n stack.pop\n end",
"def function_map\n unless @functions\n do_initialize\n @functions = {}\n function_files.each do |file|\n obj = {}\n name = File.basename(file, '.rb')\n obj[:name] = name\n obj[:parent] = mod_finder.match(file)[1]\n @functions[\"#{obj[:parent]}::#{name}\"] = obj\n end\n end\n @functions\n end"
] | [
"0.6985383",
"0.6885975",
"0.6885975",
"0.6858655",
"0.6851686",
"0.6851686",
"0.6851686",
"0.681678",
"0.67859066",
"0.6680383",
"0.6675167",
"0.659482",
"0.6558314",
"0.6558314",
"0.65532494",
"0.65532494",
"0.6494042",
"0.6456529",
"0.64447165",
"0.6438244",
"0.6437145",
"0.64327806",
"0.6406124",
"0.6371254",
"0.6371003",
"0.6358025",
"0.6342018",
"0.63145804",
"0.6308283",
"0.6278255",
"0.6244705",
"0.6244705",
"0.6244705",
"0.6209915",
"0.6192356",
"0.6136997",
"0.61352116",
"0.6105715",
"0.6102733",
"0.6098533",
"0.6075263",
"0.6073246",
"0.607302",
"0.6064661",
"0.6054526",
"0.6047898",
"0.60447407",
"0.60387176",
"0.6007348",
"0.60051465",
"0.5966128",
"0.59656876",
"0.59488195",
"0.59357744",
"0.5925696",
"0.5908706",
"0.59007716",
"0.58959067",
"0.5873399",
"0.58685726",
"0.5868291",
"0.58446825",
"0.5828946",
"0.5813674",
"0.5805412",
"0.57901746",
"0.5782771",
"0.5778728",
"0.57732993",
"0.5770068",
"0.5769668",
"0.5767739",
"0.5766625",
"0.57651013",
"0.5751589",
"0.57449603",
"0.57439",
"0.5741672",
"0.57103807",
"0.57051134",
"0.57050794",
"0.56977266",
"0.56774104",
"0.56725794",
"0.5669992",
"0.5651228",
"0.56429493",
"0.56159294",
"0.561177",
"0.56059176",
"0.5587152",
"0.55831605",
"0.5577772",
"0.5568298",
"0.5559608",
"0.5548441",
"0.5540081",
"0.5538019",
"0.55368197",
"0.5532882"
] | 0.6318792 | 27 |
builds the actual args from the method signature if x is a symbol check for input in params if not in params use default if not a symbol use x in place of the value | def args_chain sign, params
[@visa_id] + sign.map{ |x| (params[x]||Session::defaults[x] if x.is_a? Symbol ) || x }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def canonicalise_args(fun)\n procpars = fun[:params] || {}\n if procpars.size == 0 && @args_named.size > 0\n set_error 999, \"Parameters passed to method declared to take none.\"\n return\n end\n # Go through the declared arglist and populate the positional arglist\n procpars.each_with_index do |pp, i|\n argname = pp[:name]\n argtype = pp[:type]\n arg_named = @args_named.delete argname\n arg_numbered = @args_named.delete i.to_s\n set_error(999, \"You cannot set the parameter #{argname} both by name and position\") and return if arg_named && arg_numbered\n arg = @args_pos[i] || arg_named || arg_numbered\n # Type-check arg\n case argtype\n when 'bit'\n set_error(999, \"The arg #{argname} must be literally true or false (was #{arg.to_json})\") and return unless arg == true || arg == false\n when 'num'\n if !arg.is_a?(Numeric)\n if arg.is_a?(String) && (arg_conv = arg.to_i rescue nil).to_s == arg\n arg = arg_conv\n elsif arg.is_a?(String) && (arg_conv = arg.to_f rescue nil).to_s == arg\n arg = arg_conv\n else\n set_error(999, \"The arg #{argname} must be numeric (was #{arg.to_json})\") \n return\n end\n end\n when 'str'\n if !arg.is_a?(String)\n if arg.is_a?(Numeric)\n arg = arg.to_s\n else\n set_error(999, \"The arg #{argname} must be a string (was #{arg.to_json})\")\n return\n end\n end\n when 'arr'\n set_error(999, \"The arg #{argname} must be an array (was #{arg.to_json})\") and return unless arg.is_a?(Array)\n when 'obj'\n set_error(999, \"The arg #{argname} must be a JSON object (was #{arg.to_json})\") and return unless arg.is_a?(Hash)\n end\n # Set the positional arg\n @args_pos[i] ||= arg\n end\n # The positional arglist should now be populated. The named arglist should be exhausted.\n set_error(999, \"Excess parameters passed (#{@args_named.to_json})\") and return unless @args_named.size == 0\n end",
"def method_missing(symbol, *args)\n @params[symbol] = args.length == 1 ? args[0] : args\n end",
"def process_args(exp)\n raise if @want_expression\n\n args = []\n default_values = nil\n\n loop do\n arg = exp.shift\n break if arg.nil?\n if arg.is_a?(Symbol)\n args << arg\n else\n raise unless exp.empty?\n default_values = arg\n end\n end\n\n args.each do |arg|\n arg = arg.to_s\n if arg[0,1] == '*'\n raise if @argument_splat\n @argument_splat = @model.encode_local_variable(arg[1..-1])\n # argument_splat is not an argument in the function's argument list\n @local_variables.add(@argument_splat) \n else\n v = @model.encode_local_variable(arg)\n @arguments_no_splat << v \n @local_variables.add(v)\n @argument_variables.add(v)\n end\n end\n\n # that's not the correct arity, but we decrease it by one for each\n # optional argument.\n min_arity = @arguments_no_splat.size\n max_arity = @arguments_no_splat.size\n\n str = \"\"\n\n #\n # Generate code for the default values of arguments. We check\n # whether a argument has been assigned a value, if not (== null or == undefined), \n # then we assign the default value.\n #\n # NOTE: A check to ==null also returns true if the argument is undefined.\n #\n if default_values\n raise unless default_values[0] == :block\n default_values[1..-1].each do |dv|\n min_arity -= 1\n raise unless dv[0] == :lasgn\n raise unless dv.size == 3\n arg = @model.encode_local_variable(dv[1])\n @local_variables.add(arg)\n @argument_variables.add(arg)\n value = dv[2]\n\n str << \"if(#{arg}==null)\"\n str << \"#{arg}=\"\n str << want_expression do process(value) end\n str << sep()\n end\n end\n\n # now as we know the min_arity, we prepend an arity check before the\n # code generated above.\n str2 = \"\"\n\n if @argument_splat\n # max_arity == infinity => no check\n\n if min_arity == 0\n # min_arity == infinity as well => we need no check\n else\n # +1 because we have a block argument anyway.\n str2 << \"if(arguments.length<#{min_arity+1})#{throw_argument_error(min_arity)}#{sep()}\"\n end\n else\n if min_arity == 0\n # can't be less than 0 arguments anyway! => no check\n str2 << \"if(arguments.length>#{max_arity+1})#{throw_argument_error(max_arity)}#{sep()}\"\n else\n if min_arity == max_arity\n str2 << \"if(arguments.length!=#{min_arity+1})#{throw_argument_error(min_arity)}#{sep()}\"\n else\n str2 << \"if(arguments.length<#{min_arity+1})#{throw_argument_error(min_arity)}#{sep()}\"\n str2 << \"if(arguments.length>#{max_arity+1})#{throw_argument_error(max_arity)}#{sep()}\"\n end\n end\n end\n\n # NoArgumentArityChecks disable argument arity checks\n if $RUBYJS__OPTS.include?('NoArgumentArityChecks')\n else\n # prepend\n str = str2 + str\n end\n\n if @argument_splat\n # construct the code to initialize the splat argument. \n # unluckily the arguments object is not an array, instead it's a\n # special object that has only the length() and [] methods. There\n # is no way to convert it to an array, except looping over each\n # value and pushing the value into a new array.\n # FIXME: variable \"i\"\n str << \"#{@argument_splat}=[]#{sep()}\"\n @local_variables_need_no_initialization.add(@argument_splat)\n with_temporary_variable do |i|\n @local_variables_need_no_initialization.add(i)\n str << \"for(#{i}=#{@arguments_no_splat.size+1};#{i}<arguments.length;#{i}++)#{@argument_splat}.push(arguments[#{i}])#{sep()}\"\n end\n end\n \n return str \n end",
"def method_missing(sym, *args, &block)\n if @params.has_key?(sym)\n return @params[sym]\n elsif sym.to_s =~ /^[a-z0-9_]*=$/\n return @params[sym.to_s.sub(/^(.*?)=$/, '\\1').to_sym] = args.shift\n elsif sym.to_s =~ /^[a-z0-9_]*\\?$/\n return !!@params[sym.to_s.sub(/^(.*?)\\?$/, '\\1').to_sym]\n end\n\n super(sym, *args, &block)\n end",
"def process_arg(meth, key, default, max_input_bytesize=nil)\n case key\n when String\n v = process(meth, key, default, max_input_bytesize)\n\n if @capture\n key = key.to_sym if symbolize?\n if !@skip_missing || @obj.has_key?(key)\n @params[key] = v\n end\n end\n\n v\n when Array\n key.map do |k|\n raise ProgrammerError, \"non-String element in array argument passed to typecast_params: #{k.inspect}\" unless k.is_a?(String)\n process_arg(meth, k, default, max_input_bytesize)\n end\n else\n raise ProgrammerError, \"Unsupported argument for typecast_params conversion method: #{key.inspect}\"\n end\n end",
"def parse_arguments(parameters)\n parameter_string = \"\"\n method_definition = nil\n parameters.each do |parameter|\n arg_type = parameter[0]\n arg = parameter[1]\n case arg_type\n when :req\n parameter_string += \" #{arg}\"\n when :opt\n if Commandable.verbose_parameters\n # figure out what the default value is\n method_definition ||= readline(@@method_file, @@method_line)\n default = parse_optional(method_definition, arg)\n parameter_string += \" [#{arg}=#{default}]\"\n else\n parameter_string += \" [#{arg}]\"\n end\n when :rest\n parameter_string += \" *#{arg}\"\n when :block\n parameter_string += \" &#{arg}\"\n end\n end\n parameter_string.strip\n end",
"def determine_arguments\n s = Marshal.load(Marshal.dump(self)) # sexp handling is not clean cut\n raise \"what is this?\" unless s.sexp.sexp_type == :iter && s.sexp[1].sexp_type == :call && s.sexp[1][1] == nil && s.sexp[1][2] == :proc && s.sexp[1][3].sexp_type == :arglist\n\n block_args = s.sexp[2]\n if block_args\n if block_args[0]==:lasgn\n # single argument\n args = [block_args[1]]\n elsif block_args[0]==:masgn\n # multiple arguments\n args = block_args[1]\n raise \"unsupported argument type #{args}\" unless args[0]==:array\n args = args[1..-1].map{ |arg|\n raise \"unsupported argument type #{arg}\" unless arg[0]==:lasgn\n arg[1]\n }\n else\n raise \"unsupported argument type #{args}\"\n end\n end\n\n # maybe we can fix the input so we don't have to repair it here?\n @args = @args[-args.size..-1] if args and args.size != @args.size\n\n @named_args = Hash[*args.zip(@args[-args.size..-1]).flatten] if args\n @named_args ||= {}\n end",
"def infer_args(opts)\n opts.map do |hash|\n if hash.has_key?(:name)\n hash\n else\n check = [:type, :match, :constraint, :within, :default]\n if check.any? {|key| hash.has_key?(key) }\n hash.merge! :name => 'arg'\n end\n\n if hash.has_key?(:default) && !hash.has_key?(:optional)\n hash.merge! :optional => true\n end\n\n hash\n end\n end\n end",
"def method_missing(method, *args)\n if defines_default?(method) && args.empty?\n self[method]\n elsif method.to_s =~ /^(\\w+)=$/ && args.size == 1\n self[Regexp.last_match(1).to_sym] = args[0]\n else\n super\n end\n end",
"def _normalize_args(action = T.unsafe(nil), options = T.unsafe(nil)); end",
"def _normalize_args(action = T.unsafe(nil), options = T.unsafe(nil)); end",
"def process_params(exp)\n _, normal, defaults, splat, rest, kwargs, doublesplat, block = exp.shift 8\n\n args =\n handle_normal_arguments(normal) +\n handle_default_arguments(defaults) +\n handle_splat(splat) +\n handle_normal_arguments(rest) +\n handle_kwargs(kwargs) +\n handle_double_splat(doublesplat) +\n handle_block_argument(block)\n\n s(:args, *args)\n end",
"def get_arg_func(key, func, default) \n if (@args == nil) \n return default\n elsif @args[0].instance_of? Hash\n if @args[0][key]\n return func.call(@args[0][key])\n else\n return default\n end\n else \n return default\n end\n end",
"def _normalize_args(action = T.unsafe(nil), options = T.unsafe(nil), &blk); end",
"def prepare_method_arg_hash(args)\n # SEQUEL5: Remove\n h = {}\n prepare_method_args('a', args.length).zip(args).each{|k, v| h[k] = v}\n h\n end",
"def defaultArguments (x = 22, y = x + 20, z = 50)\n puts \"x = \" + x.to_s\n puts \"y = \" + y.to_s\n puts \"z = \" + z.to_s\n end",
"def validated_name_args(method_name, body)\n @args = json_parse(body)\n args = case method_name\n when /^sha$/ then []\n when /^alive$/ then []\n when /^ready$/ then []\n when /^image_names$/ then []\n when /^names$/ then []\n when /^manifests$/ then []\n when /^manifest$/ then [name]\n else\n raise ClientError, 'json:malformed'\n end\n if query?(method_name)\n method_name += '?'\n end\n [method_name, args]\n end",
"def invokeDefaultMethodWithArguments(args)\n eval(args[0])\n end",
"def extract(args, *params)\n args, opts = args.args_and_opts\n name = extract_value opts, :name\n opts.merge!(@singular.to_sym => name ) if name\n params.map do |param| # for every symbol in params Array:\n arg = args.next rescue nil # try to assign sequential argument from args\n arg ||= extract_value opts, param # try to assign named argument from opts\n arg || case param # assign defaults if no other value found\n when :user\n API.auth['login']\n when :branch\n 'master'\n when :public\n !extract_value(opts, :private) unless arg == false\n else\n nil # no default found, parameter is nil\n end\n end\n end",
"def method_missing(method_sym, *arguments, &block)\n method = method_sym.to_s\n\n #puts \"%s %s %s\" % [\"---- \", method, \" ----\"]\n #\n if method =~ /^[A-Z]\\d{2}(_\\d{2})?/\n Array(parse(get_spec(method))).join(', ') rescue ''\n elsif respond_to?((/(\\w+)/.match(method))[0])\n instance_eval(method) rescue ''\n # for testing:\n elsif %w(E_STRING E_MULTI_STRING E_NUMBER E_DATETIME E_DATE E_TIME E_YES_NO E_SINGLE E_MULTIPLE E_ALLOW_NEGATIVE E_LOOKUP).include?(method)\n Array(parse(get_spec(method))).join(', ') rescue ''\n else\n super\n end\n end",
"def transformed_argname; end",
"def two_arg_method_defaults(arg1=0, arg2=\"020202\")\n puts \"Here are my args: #{arg1}, #{arg2}\"\nend",
"def method_missing(sym, *args)\n\t\tif sym.to_s[-1] == \"=\"[0]\n\t\t\treturn self[sym.to_s[0 .. -2]] = args[0]\n\t\telse\n\t\t\treturn self[sym.to_s]\n\t\tend\n\tend",
"def minimal_arguments(method)\n # Build an arguments array with holds all required parameters. The actual\n # values for these arguments doesn't matter at all.\n args = method.parameters.select { |mode, _name| mode == :req }\n\n # Add a hash with all required named arguments\n required_keyword_args = method.parameters.each_with_object({}) do |(mode, name), hsh|\n hsh[name] = :anything if mode == :keyreq\n end\n args << required_keyword_args if required_keyword_args\n\n args\n end",
"def method (a=3, b=4)\r\nend",
"def meth( x = nil)\nend",
"def resolve_args(command, ctx)\n resolvers = ctx.preferred\n\n if command.kind_of? Method or command.kind_of? Proc\n method = command\n elsif command.kind_of? Command\n method = command.method\n end\n\n method.parameters.map do |param|\n param_name = param[1]\n\n preferred_resolver = resolvers.find { |resolver| resolver.has_key? param_name unless resolver.nil? }\n\n if !preferred_resolver.nil?\n preferred_resolver[param_name]\n elsif param[0] == :req\n raise \"Couldn't find value for required parameter #{param_name}\"\n else\n nil\n end\n end unless method.nil?\n end",
"def method_missing(method, *args, &block)\n if method.to_s =~ /^_(.+)$/\n arg = @in_args[$1.to_sym] || @out_args[$1.to_sym]\n return arg if !arg.nil?\n end\n\n super\n end",
"def testing(a, b = 1, *c, d: 1, **x)\n # p a,b,c,d,x\n dump_object(a)\n dump_object(b)\n dump_object(c)\n dump_object(d)\n dump_object(x)\nend",
"def method_missing(symbol, *args)\n if (method = symbol.to_s).sub!(/\\=$/, '')\n options[method.to_sym] = args.first\n else\n options.fetch(method.to_sym, super)\n end\n end",
"def build_args(args)\n args.each do |arg|\n arg.each do |key, value|\n case key.to_s\n when 'query_params'\n @query_params = value\n when 'request_headers'\n update_headers(value)\n when 'request_body'\n @request_body = value\n end\n end\n end\n end",
"def generic_method(a, b, c = 'default', *d, e)\n p [a, b, c]\n p d\n p e\nend",
"def method(arg_1, arg_2, *other_args)\n p arg_1 # \"a\"\n p arg_2 # \"b\"\n p other_args # []\nend",
"def rb_scan_args method_body\n method_body =~ /rb_scan_args\\((.*?)\\)/m\n return '(*args)' unless $1\n\n $1.split(/,/)[2] =~ /\"(.*?)\"/ # format argument\n format = $1.split(//)\n\n lead = opt = trail = 0\n\n if format.first =~ /\\d/ then\n lead = $&.to_i\n format.shift\n if format.first =~ /\\d/ then\n opt = $&.to_i\n format.shift\n if format.first =~ /\\d/ then\n trail = $&.to_i\n format.shift\n block_arg = true\n end\n end\n end\n\n if format.first == '*' and not block_arg then\n var = true\n format.shift\n if format.first =~ /\\d/ then\n trail = $&.to_i\n format.shift\n end\n end\n\n if format.first == ':' then\n hash = true\n format.shift\n end\n\n if format.first == '&' then\n block = true\n format.shift\n end\n\n # if the format string is not empty there's a bug in the C code, ignore it\n\n args = []\n position = 1\n\n (1...(position + lead)).each do |index|\n args << \"p#{index}\"\n end\n\n position += lead\n\n (position...(position + opt)).each do |index|\n args << \"p#{index} = v#{index}\"\n end\n\n position += opt\n\n if var then\n args << '*args'\n position += 1\n end\n\n (position...(position + trail)).each do |index|\n args << \"p#{index}\"\n end\n\n position += trail\n\n if hash then\n args << \"p#{position} = {}\"\n end\n\n args << '&block' if block\n\n \"(#{args.join ', '})\"\n end",
"def method8(x: nil, y: nil, z: nil)\r\n p x, y, z\r\nend",
"def method_missing(method, *args)\n if method.to_s =~ /^([^=]+)(=?)$/ && options.has_key?($1.to_sym)\n options[$1.to_sym] = args.first unless $2.empty?\n options[$1.to_sym]\n else\n super\n end\n end",
"def arg_check(args, types = nil, server = nil)\n return args unless types\n\n args.each_with_index.map do |arg, i|\n next arg if types[i].nil? || types[i] == String\n\n if types[i] == Integer\n begin\n Integer(arg, 10)\n rescue ArgumentError\n nil\n end\n elsif types[i] == Float\n begin\n Float(arg)\n rescue ArgumentError\n nil\n end\n elsif types[i] == Time\n begin\n Time.parse arg\n rescue ArgumentError\n nil\n end\n elsif types[i] == TrueClass || types[i] == FalseClass\n if arg.casecmp('true').zero? || arg.downcase.start_with?('y')\n true\n elsif arg.casecmp('false').zero? || arg.downcase.start_with?('n')\n false\n end\n elsif types[i] == Symbol\n arg.to_sym\n elsif types[i] == Encoding\n begin\n Encoding.find arg\n rescue ArgumentError\n nil\n end\n elsif types[i] == Regexp\n begin\n Regexp.new arg\n rescue ArgumentError\n nil\n end\n elsif types[i] == Rational\n begin\n Rational(arg)\n rescue ArgumentError\n nil\n end\n elsif types[i] == Range\n begin\n if arg.include? '...'\n Range.new(*arg.split('...').map(&:to_i), true)\n elsif arg.include? '..'\n Range.new(*arg.split('..').map(&:to_i))\n end\n rescue ArgumentError\n nil\n end\n elsif types[i] == NilClass\n nil\n elsif [Discordrb::User, Discordrb::Role, Discordrb::Emoji].include? types[i]\n result = parse_mention arg, server\n result if result.instance_of? types[i]\n elsif types[i] == Discordrb::Invite\n resolve_invite_code arg\n elsif types[i].respond_to?(:from_argument)\n begin\n types[i].from_argument arg\n rescue StandardError\n nil\n end\n else\n raise ArgumentError, \"#{types[i]} doesn't implement from_argument\"\n end\n end\n end",
"def transformed_argname=(_); end",
"def initialize hashed_args\n new_args = DEFAULT_ARGS.merge(hashed_args)\n \n @type = new_args[:type]\n if @type.is_a?(Enumerable)\n @type.each do |type|\n raise ArgumentError, \"#{type} is not a Class\" unless type.is_a?(Class)\n end\n else\n raise ArgumentError, \"#{@type} is not a Class\" unless @type.is_a?(Class)\n end\n \n @validator = new_args[:validator]\n @reqd = new_args[:reqd]\n \n unless @reqd\n msg = \"if hashed arg is not required, a default value or value generator (proc) must be defined via :default key\"\n raise ArgumentError, msg unless new_args.has_key?(:default)\n @default = new_args[:default]\n end\n end",
"def action_arguments action\n raise Gin::NotFound,\n \"No action exists for: #{env[REQ_METHOD]} #{env[PATH_INFO]}\" unless action\n\n raise Gin::NotFound, \"No action #{self.class}##{action}\" unless\n self.class.actions.include?(action.to_sym)\n\n args = []\n temp = []\n prev_type = nil\n\n method(action).parameters.each do |(type, name)|\n val = params[name.to_s]\n\n raise Gin::BadRequest, BAD_REQ_MSG % name if type == :req && !val\n break if type == :rest || type == :block || name.nil?\n\n if type == :key\n # Ruby 2.0 hash keys arguments\n args.concat temp\n args << {} if prev_type != :key\n args.last[name] = val unless val.nil?\n\n elsif val.nil?\n temp << val\n\n else\n args.concat temp\n temp.clear\n args << val\n end\n\n prev_type = type\n end\n\n args\n end",
"def coerce_params_for(method, type)\n raise \"Argument type for #{method} could not be found. Did you define a `signature` stanza for it?\" unless type\n\n if method.start_with?('self.')\n simple_name = method.to_s.gsub(/^self./, '').to_sym\n # Look for a Class method\n raise \"Error building typed method signature: Method #{method} is not defined in class #{name}\" unless methods.include?(simple_name)\n\n coerce_params_for_class(method(simple_name), type)\n else\n # Look for an instance method\n raise \"Error building typed method signature: Method #{method} is not defined in class #{name}\" unless method_defined?(method)\n\n coerce_params_for_instance(instance_method(method), type)\n end\n end",
"def meth(\n arg1,\n arg2 , arg3 = 7 , *rest,\n\n\n last,\n required:,\n not_required: 7, **options)\nend",
"def meth(\n arg1,\n arg2 , arg3 = 7 , *rest,\n\n\n last,\n required:,\n not_required: 7, **options)\nend",
"def method_interface(name)\n return \"*a, &b\" unless base.method_defined?(name)\n meth = base.instance_method(name)\n blck = (name.to_s !~ /=$/)\n if (arity = meth.arity) > 0\n args = arity.of{ |i| \"a#{i}\" }\n args << \"&b\" if blck\n args = args.join(\", \")\n elsif arity == 0\n args = blck ? \"&b\" : \"\"\n else\n args = blck ? \"*a, &b\" : \"*a\"\n end\n\n return args\n end",
"def params_to_api_args(type)\n args = params.to_unsafe_h.symbolize_keys.except(:controller)\n args[:method] = request.method\n args[:action] = type\n args.delete(:format)\n args\n end",
"def to_ruby_arg\n \"#{to_s_name}#{@default ? ' = ' + @default : ''}\"\n end",
"def method_missing(sym, *args, &block)\n str = sym.to_s\n matches = nil\n\n if str == \"[]\"\n str = args.shift\n elsif str == \"[]=\"\n str = \"#{ args.shift }=\"\n end\n\n if @@fields.include?(str)\n @hash[str]\n elsif matches = str.match(/(.*)=$/) and @@fields.include?(matches[1])\n @hash[matches[1]] = args.first\n else\n super(sym, *args, &block)\n end\n end",
"def process_arguments\n # clean unsupport symbols, e.g. JieFang;\n # or error argument due to option typo, e.g. '-list' will put 'ist' into the array in this src.\n @support_newspapers = Array.new #TODO: move to elsewhere\n @support_newspapers << :XM\n @support_newspapers << :WHB\n @support_newspapers << :YZ\n # ATTENTION: command line input is an array of string, to be consistent, internally I use only symbol when using this symbol\n @options.newspapers = @options.newspapers.collect { | item | item.to_sym } & @support_newspapers\n \n if @options.newspapers.size == 0\n @support_newspapers.each do | sym |\n @options.newspapers << sym\n end\n end\n end",
"def method_missing(meth, *args) = parameters.has_key?(meth) ? parameters[meth] : meth",
"def prepare_method_args(base, n)\n # SEQUEL5: Remove\n (0...n).map do\n s = base.to_sym\n base = base.next\n s\n end\n end",
"def signature(*args); end",
"def default_args(a,b,c=1)\n puts \"\\nValues of variables: \",a,b,c\nend",
"def __get_params(data)\n \n # If named arguments used, assigns keys as symbols\n # but keeps numeric arguments as integers\n \n if @params.kind_of? Hash\n @params = @params.dup\n @keyword_params = JsonRpcObjects::Utils::Hash.remove!(@params) do |k, v|\n not JsonRpcObjects::Utils::String.numeric? k\n end\n \n @params = @params.sort_by { |i| i[0].to_i }.map { |i| i[1] }\n else\n @keyword_params = { }\n end\n \n JsonRpcObjects::Utils::Hash.keys_to_sym! @keyword_params\n \n end",
"def f4(x:, x: nil); end",
"def method(arg1, arg2, *other_args)\n p arg1 # 'a'\n p arg2 # 'b'\n p other_args # []\nend",
"def default_args\n args.select &:default\n end",
"def method(*other_args, required_arg)\n p other_args # ['a', 'b']\n p required_arg # 'c'\nend",
"def method(arg_1, arg_2, *other_args)\n p arg_1 # \"a\"\n p arg_2 # \"b\"\n p other_args # [\"c\", \"d\", \"e\"]\nend",
"def default _args\n \"default _args;\" \n end",
"def to_param(args)\n case args\n when String\n define_method \"to_param\" do\n args.gsub(/:(\\w+)/) {|method| send(method[1..-1]).to_s.parameterize }\n end\n\n if args.empty?\n raise ArgumentError.new(\"args can not be an empty string\")\n end\n when Symbol\n define_method \"to_param\" do\n \"#{id}-#{send(args).parameterize}\"\n end\n else\n raise ArgumentError.new(\"args can only be string or symbol\")\n end\n end",
"def method(*other_args, required_arg)\n p other_args # [\"a\", \"b\"]\n p required_arg # \"c\"\nend",
"def build_args\n @scope.argument_descriptors = build_arg_descriptor\n add CheckArityInstr.new(2, 0, false, false, -1)\n _in = @scope.get_new_local_variable(\"_in\", 0)\n add ReceivePreReqdArgInstr.new(_in, 0)\n _out = @scope.get_new_local_variable(\"_out\", 0)\n add ReceivePreReqdArgInstr.new(_out, 1)\n end",
"def method_with_keyword_arguments(one: 1, two: 'two')\n [one, two]\n end",
"def method_missing(meth, *args)\n return nil if !@hash.key?(meth) && args.empty?\n if args.empty?\n @hash[meth]\n else\n @hash[meth] = args.size == 1 ? args.first : args\n end\n end",
"def _normalize_args(action=nil, options={})\n\t if action.is_a? Hash\n\t action\n\t else\n\t options\n\t end\n\t end",
"def method(a=2, *b)\r\n\tb\r\nend",
"def method_with_splat_parameter(*names)\n end",
"def my_method(a, b, d, c: 3)\n # p [a, b, c, d]\n p a: a, b: b, c: c, d: d\nend",
"def fold_kwargs!(args)\n hash = args&.[](0)\n return unless hash.respond_to?(:key)\n\n Rails5Shims::ControllerTests::REQUEST_KWARGS.each do |kwarg|\n next unless hash.key?(kwarg)\n\n value = hash.delete(kwarg)\n if value.is_a? String\n args.insert(0, value)\n else\n hash.merge! value\n end\n end\n end",
"def parse_args(arg)\n if arg.is_a?(Hash) and Knj::ArrayExt.hash_numeric_keys?(arg)\n arr = []\n \n arg.each do |key, val|\n arr << val\n end\n \n return self.parse_args(arr)\n elsif arg.is_a?(Hash)\n arg.each do |key, val|\n arg[key] = self.parse_args(val)\n end\n \n return arg\n elsif arg.is_a?(Array)\n arg.each_index do |key|\n arg[key] = self.parse_args(arg[key])\n end\n \n return arg\n elsif arg.is_a?(String) and match = arg.match(/^#<Model::(.+?)::(\\d+)>$/)\n return @ob.get(match[1], match[2])\n else\n return arg\n end\n end",
"def method_missing(method, *args)\n case args[0]\n when Hash\n @r.cmd(\"#{method}(#{args[0].to_r})\")\n when Symbol\n @r.cmd(\"#{method}(#{args[0]})\")\n when String\n @r.cmd(\"#{method}(#{args[0]})\")\n when nil\n @r.cmd(\"#{method}()\")\n end\n end",
"def method_missing(method_symbol, *args)\n method = method_symbol.to_s\n method = $1 if method =~ /(.+)=$/\n if args.length > 0\n self[method] = args[0]\n else\n self[method]\n end\n end",
"def my_method(first: nil, second: nil)\n puts \"First is #{first} and second is #{second}\"\nend",
"def build_param_calls_from( atts )\n atts.map do |att|\n case att\n when String, Symbol then \"param :#{att}, '#{att}', nullable: true\"\n when Hash\n att.map do |key,references|\n ( single = (references.last == Parametrization::Config::SINGLETON_FLAG) ) && references.pop # Remove the flag value if it is present.\n if references.empty? then \"param :#{key}, '#{key}', nullable: true, multiple: true\" # This handles explicit empty array literals.\n else [ \"param :#{key}, '#{key}', nullable: true#{ single ? '' : ', multiple: true' } do\", build_param_calls_from( references ), 'end' ]\n end\n end\n end\n end.flatten.join(\"\\n\")\n end",
"def method_missing(method_symbol, *arguments) # rubocop: disable all\n method_name = method_symbol.to_s\n\n if method_name =~ /(=|\\?)$/\n case $1\n when '='\n attributes[$`] = arguments.first\n when '?'\n !!attributes[$`]\n end\n elsif attributes.include?(method_name)\n return attributes[method_name]\n else\n super\n end\n end",
"def method_name_with_defined_argument(method_arguments = 123)\n puts(method_arguments)\nend",
"def method (a=3, b)\r\nend",
"def arglists\n if @call_seq then\n @call_seq\n elsif @params then\n \"#{name}#{param_seq}\"\n end\n end",
"def arglists\n if @call_seq then\n @call_seq\n elsif @params then\n \"#{name}#{param_seq}\"\n end\n end",
"def method(a=2, b, *c)\r\n\treturn a, b, c\r\nend",
"def arguments(required, *optional)\n puts \"required: #{required}\"\n puts \"optional: #{optional}\"\nend",
"def parameters(service, method_id)\n method = service.instance_method(method_id)\n parameters = method.parameters\n\n # method parameters with a :key mode are optional named arguments. We only\n # support defaults for those - if there are none we abort here already.\n keys = parameters.map { |mode, name| name if mode == :key }.compact\n return parameters if keys.empty?\n\n # We are now doing a fake call to the method, with a minimal viable set of\n # arguments, to let the ruby runtime fill in default values for arguments.\n # We do not, however, let the call complete. Instead we use a TracePoint to\n # abort as soon as the method is called, and use the its binding to determine\n # the default values.\n\n fake_recipient = Object.new.extend(service)\n fake_call_args = minimal_arguments(method)\n fake_call_kwargs = fake_call_args.last.is_a?(Hash) ? fake_call_args.pop : {}\n\n trace_point = TracePoint.trace(:call) do |tp|\n throw :received_fake_call, tp.binding if tp.defined_class == service && tp.method_id == method_id\n end\n\n bnd = catch(:received_fake_call) do\n fake_recipient.send(method_id, *fake_call_args, **fake_call_kwargs)\n end\n\n trace_point.disable\n\n # extract default values from the received binding, and merge with the\n # parameters array.\n default_values = keys.each_with_object({}) do |key_parameter, hsh|\n hsh[key_parameter] = bnd.local_variable_get(key_parameter)\n end\n\n parameters.map do |mode, name|\n [mode, name, default_values[name]]\n end\n end",
"def new_method(a = \"This\", b = \"is\", c = \"fun\")\n puts a + ' ' + b + ' ' + c + '.'\nend",
"def method_argument_names\n name, usage = current_method_info\n results = usage.split(name.gsub(/_/,'-')).last || \"\"\n return results.split(' ')\n end",
"def method_args\n hsh = run_args_hash\n unless hsh.blank?\n return Yajl::Parser.parse(hsh)\n end\n return {} # empty hash as a sanity return\n end",
"def method (number, default1 = 1, default2 = 2)\nend",
"def args(*) end",
"def signature=(_arg0); end",
"def signature=(_arg0); end",
"def signature=(_arg0); end",
"def signature=(_arg0); end",
"def method_with_splat_parameter2(*names)\n end",
"def my_method(a, b=2, c=3,d)\n p [a,b,c,d]\nend",
"def valid_argument_list!(rest, *types)\n if rest.size == types.size\n result = rest.zip(types).collect do |arg, type|\n if String == type\n arg.to_s\n elsif Symbol == type\n arg.to_sym\n elsif Integer\n arg.to_i\n else\n raise OptionParser::InvalidArgument, arg\n end\n end\n result.size == 1 ? result[0] : result\n elsif rest.size < types.size\n raise OptionParser::MissingArgument\n else\n raise OptionParser::NeedlessArgument, rest\n end\n end",
"def hello(place=\"world\", *args)\n #...\n end",
"def method_missing(name, *args)\n if name[0, 6] == 'magic_'\n [name[6..-1]] + args\n else\n super\n end\n end",
"def parse_args\n\t\t@args = @args_a.each_slice(2).to_a.inject({}) { |h, k| h[k[0]] = k[1]; h }\n\t\tkeys = @skeys + @lkeys\n\t\t@args.each do |k, v|\n\t\t\tif !keys.include?(k)\n\t\t\t\tputs \"Unknown option `#{k}'\"\n\t\t\t\texit\n\t\t\tend\n\n\t\t\tif keys.include?(v)\n\t\t\t\tputs \"Missing values for `#{k}' and `#{v}'\"\n\t\t\t\texit\n\t\t\tend\n\n\t\t\tif v != nil\n\t\t\t\tif v.start_with?('-')\n\t\t\t\t\tputs \"Warning: Value of `#{k}' appears to be a flag\"\n\t\t\t\tend\n\n\t\t\t\tif @static.has_key?(k)\n\t\t\t\t\tif !@static[k].include?(v)\n\t\t\t\t\t\tputs \"Unknown option `#{v}' for `#{k}'\"\n\t\t\t\t\t\texit\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t\n\t\tif remove_keys(@no_vals).has_blank?\n\t\t\tputs \"Missing argument(s)\"\n\t\t\texit\n\t\tend\t\t\t\n\tend",
"def find_multimethod(x)\n case x\n when String\n signature = Signature.new(:string => x)\n when Method\n signature = x.signature\n when Signature\n signature = x\n end\n\n x = @multimethod.select{|mm| mm.matches_signature(signature)}\n\n x\n end",
"def lambdacall_args(sexp)\n__args_index(car(sexp)) + lambdacall_index(cadr(sexp), [])\n end",
"def method(*a, b=2)\r\nend"
] | [
"0.63874954",
"0.6271626",
"0.6252947",
"0.60311085",
"0.5996558",
"0.5939282",
"0.5926985",
"0.584166",
"0.5745298",
"0.5626676",
"0.5626676",
"0.5560366",
"0.5558328",
"0.553827",
"0.55204827",
"0.5520282",
"0.54967326",
"0.5467915",
"0.5417298",
"0.5409467",
"0.5407127",
"0.5400632",
"0.53999144",
"0.5382992",
"0.5358664",
"0.5348174",
"0.5343579",
"0.5335513",
"0.53289574",
"0.5313809",
"0.5313453",
"0.52952003",
"0.528777",
"0.52875465",
"0.5279216",
"0.52725166",
"0.5264511",
"0.5257226",
"0.5254383",
"0.5248995",
"0.5227906",
"0.5223726",
"0.5223324",
"0.52068096",
"0.51991385",
"0.51974225",
"0.5192918",
"0.51888245",
"0.51835227",
"0.51808167",
"0.5179322",
"0.51767",
"0.5168006",
"0.5163947",
"0.51578206",
"0.51559395",
"0.5146751",
"0.5146187",
"0.514401",
"0.5139606",
"0.5139594",
"0.5130061",
"0.51278925",
"0.5127572",
"0.5124885",
"0.5124396",
"0.5123599",
"0.51221097",
"0.51175755",
"0.5110829",
"0.50988483",
"0.5097195",
"0.50959474",
"0.5095457",
"0.5073986",
"0.50665605",
"0.5061765",
"0.5056913",
"0.5056913",
"0.50500077",
"0.50484014",
"0.5044931",
"0.5043745",
"0.5041627",
"0.50408536",
"0.5040667",
"0.50339574",
"0.5029941",
"0.5029941",
"0.5029941",
"0.5029941",
"0.50295913",
"0.5028056",
"0.5027007",
"0.5024487",
"0.50180596",
"0.5016293",
"0.5011003",
"0.5005914",
"0.5005791"
] | 0.53648186 | 24 |
helper method for horizontal configuration | def horizontal param
@points = param[:points] || defaults[:points]
horizontal_dispatch param
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def horizontal\n return HORIZONTAL\n end",
"def horizontal_dirs\n # have to add extra logic?\n \n HORIZONTAL_DIRS\n\n end",
"def configurations; end",
"def landscape\n config\n end",
"def layout_config\n @squeezed_layout_config\n end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def configuration; end",
"def configuration; end",
"def configuration; end",
"def configuration; end",
"def configuration; end",
"def config\n\n end",
"def parse_horizontal_rule; end",
"def horizontal_data\n ret_hsh = {}\n @grid.each do |k, v|\n ret_hsh[k] = v.values\n end\n ret_hsh\n end",
"def horizontal(options = {}, &block)\n Horizontal.new({ parent: self }.merge!(options), &block)\n end",
"def configure(c)\n super\n c.border = false\n c.items = [{\n :region => :north,\n :height => 35,\n :html => %Q{\n <div style=\"margin:10px; color:#333; text-align:center; font-family: Helvetica;\">\n Simple <span style=\"color:#B32D15\">Netzke</span> app\n </div>\n },\n # TODO: this has no effect anymore:\n # :bodyStyle => {:background => \"#AAA url(\\\"/images/header-deco.gif\\\") top left repeat-x\"}\n },{\n :region => :center,\n :layout => 'border',\n :items => config.items\n }]\n end",
"def horizontal_dirs\r\n HORIZONTAL_DIRS\r\n end",
"def labels_config\n @squeezed_labels_config\n end",
"def load_config\n\n @axis_x.move_home_timeout = 15 # seconds after which home command is aborted\n @axis_y.move_home_timeout = 15\n @axis_z.move_home_timeout = 150\n\n @axis_x.invert_axis = false\n @axis_y.invert_axis = false\n @axis_z.invert_axis = false\n\n @axis_x.steps_per_unit = 5 # steps per milimeter for example\n @axis_y.steps_per_unit = 4\n @axis_z.steps_per_unit = 157\n\n @axis_x.max = 220\n @axis_y.max = 128\n @axis_z.max = 0\n\n @axis_x.min = 0\n @axis_y.min = 0\n @axis_z.min = -70\n \n @axis_x.reverse_home = false\n @axis_y.reverse_home = false\n @axis_z.reverse_home = true\n\n end",
"def initialize( config )\n @config = config\n\n self.top_align = self.top_font = self.right_align = self.right_font = 0\n\n init_with({\n :width => 500,\n :height => 300,\n :show_x_guidelines => false,\n :show_y_guidelines => true,\n :show_data_values => true,\n\n# :min_scale_value => 0,\n\n :show_x_labels => true,\n :stagger_x_labels => false,\n :rotate_x_labels => false,\n :step_x_labels => 1,\n :step_include_first_x_label => true,\n\n :show_y_labels => true,\n :rotate_y_labels => false,\n :stagger_y_labels => false,\n :scale_integers => false,\n\n :show_x_title => false,\n :x_title => 'X Field names',\n\n :show_y_title => false,\n :y_title_text_direction => :bt,\n :y_title => 'Y Scale',\n\n :show_graph_title => false,\n :graph_title => 'Graph Title',\n :show_graph_subtitle => false,\n :graph_subtitle => 'Graph Sub Title',\n :key => true, \n :key_position => :right, # bottom or right\n\n :font_size =>12,\n :title_font_size =>16,\n :subtitle_font_size =>14,\n :x_label_font_size =>12,\n :x_title_font_size =>14,\n :y_label_font_size =>12,\n :y_title_font_size =>14,\n :key_font_size =>10,\n \n :no_css =>false,\n :add_popups =>false,\n })\n\n\t\t\t\tset_defaults if respond_to? :set_defaults\n\n init_with config\n end",
"def get_config\n\t\tend",
"def configure_with(params)\r\n\r\n\t\tend",
"def config\r\n\t\t\t\"<p>No additional configuration is available</p>\"\r\n\t\tend",
"def configurePlot\n end",
"def setup_config\n # To be Extended\n end",
"def configure(c)\n\n c.layout = :fit\n\n c.load_inline_data ||= true\n c.enable_edit_in_form ||= true\n c.enable_edit_inline = false\n c.enable_extended_search = false\n c.enable_column_filters = false\n c.enable_pagination ||= true\n\n super\n\n end",
"def hline config={}\n raise \"I think this is unused. removed if this does not raise 2014-08-29 - 12:43 \"\n row = config[:row] || @app_row\n width = config[:width] || 20\n _position config\n col = config[:col] || 1\n @color_pair = config[:color_pair] || $datacolor\n @attrib = config[:attrib] || Ncurses::A_NORMAL\n @window.attron(Ncurses.COLOR_PAIR(@color_pair) | @attrib)\n @window.mvwhline( row, col, FFI::NCurses::ACS_HLINE, width)\n @window.attron(Ncurses.COLOR_PAIR(@color_pair) | @attrib)\n @app_row += 1\n end",
"def grid_header_rows\n 1\n end",
"def configure; end",
"def set_horizontal_property\n @horizontal_property = HorizontalProperty.find(params[:id])\n end",
"def configure\n end",
"def configure(conf)\n super\n \n ## Check if \"output_format\" has a valid value\n unless @output_format.to_s == \"structured\" ||\n @output_format.to_s == \"flat\" ||\n @output_format.to_s == \"statsd\"\n \n raise ConfigError, \"output_format value '#{@output_format}' is not valid. Must be : structured, flat or statsd\"\n end\n end",
"def configuration\n\n #page_loading = Netzke::Core.controller.instance_variable_get(:@page_loading)\n component_loading = Netzke::Core.controller.instance_variable_get(:@component_loading)\n reset_previous_page_session(component_loading)\n #return {} unless (page_loading.present? or component_loading.present?)\n sup = super\n\n debug_log \"**** PARAMS from Controller\"\n sup.merge(\n name: :app,\n padding: \"20px\",\n style: {\n border: \"5px solid #A4A6A9\",\n \"-o-border-radius\" => \"10px\",\n \"-ms-border-radius\" => \"10px\",\n \"-moz-border-radius\" => \"10px\",\n \"-webkit-border-radius\" => \"30px\",\n \"border-radius\" => \"8px\"\n },\n :items => [{\n :region => :north,\n :border => false,\n :height => 70,\n :items => [{\n xtype: 'panel',\n frame: false,\n header: false,\n height: 70,\n :layout => :hbox,\n border: 0,\n items: [\n {\n xtype: 'panel',\n flex: 0.8,\n frame: false,\n header: false,\n height: 70,\n border: 0,\n items: [\n {\n xtype: 'label',\n html: \"<img class='main_logo'/>\"\n }\n ]\n\n },\n {\n xtype: 'panel',\n flex: 1,\n frame: false,\n header: false,\n border: 0,\n layout: {\n type: 'vbox',\n align:'right'\n },\n items: [\n {\n xtype: 'panel',\n frame: false,\n header: false,\n border: 0,\n items: [\n {\n xtype: 'label',\n :html => \"<div id='test-lbl-text-align' width = 100%\n style=margin-bottom:4px;text-align:right;color:grey;>\n #{display_user_name} <span style='color:#2A81C9'>\n #{org_info}</span> \n <a style='color:grey;' href='/signout'>Logout</a></div>\"\n }\n ]\n },\n {\n xtype: 'panel',\n frame: false,\n header: false,\n border: 0,\n items: [\n {\n xtype: 'label',\n html: \"<div width = 100% > #{context_specific_display}</div>\"\n }\n ]\n }\n ]\n }\n ]}\n ]\n },\n {\n :region => :center,\n :layout => :border,\n :border => false,\n :items => [status_bar_config, {\n :region => :center,\n :layout => :border,\n :items => [main_panel_config(border: false)]\n }]\n }]\n )\n end",
"def _configure s\n s[:row] ||= 0\n s[:col] ||= 0\n s[:row] += (s[:margin_top] || 0)\n s[:col] += (s[:margin_left] || 0)\n s[:width] = FFI::NCurses.COLS-s[:col] if s[:width] == :expand\n s[:height] = FFI::NCurses.LINES-s[:row] if s[:height] == :expand # 2011-11-30 \n last = @_ws_active.last\n if last\n if s[:width_pc]\n if last.is_a? WsStack\n s[:width] = (last[:width] * (s[:width_pc].to_i * 0.01)).floor\n else\n # i think this width is picked up by next stack in this flow\n last[:item_width] = (last[:width] * (s[:width_pc].to_i* 0.01)).floor\n end\n end\n if s[:height_pc]\n if last.is_a? WsFlow\n s[:height] = ( (last[:height] * s[:height_pc].to_i)/100).floor\n else\n # this works only for flows within stacks not for an object unless\n # you put a single object in a flow\n s[:item_height] = ( (last[:height] * s[:height_pc].to_i)/100).floor\n end\n #alert \"item height set as #{s[:height]} for #{s} \"\n end\n if last.is_a? WsStack\n s[:row] += (last[:row] || 0)\n s[:col] += (last[:col] || 0) \n else\n s[:row] += (last[:row] || 0)\n s[:col] += (last[:col] || 0) # we are updating with item_width as each st finishes\n s[:width] ||= last[:item_width] # \n end\n else\n # this should be outer most flow or stack, if nothing mentioned\n # trying this out\n s[:width] ||= :expand\n s[:height] ||= :expand\n s[:width] = FFI::NCurses.COLS-s[:col] if s[:width] == :expand\n s[:height] = FFI::NCurses.LINES-s[:row] if s[:height] == :expand # 2011-11-30 \n end\n s[:components] = []\n end",
"def configure\n\t\t\tyield configuration\n\t\tend",
"def before_configuration_tasks \n end",
"def configure &block\n\t\tinstance_eval &block\n\tend",
"def horizontal?\n height < width if !(width.blank? && height.blank?)\n end",
"def _conditional_layout?; end",
"def configuration_name\n super\n end",
"def configure\n\t\t\tyield self\n\t\tend",
"def configure\n\t\t\tyield self\n\t\tend",
"def flow config={}, &block\n s = WsFlow.new config\n @_ws_active ||= []\n _configure s\n @_ws_active << s\n yield_or_eval &block if block_given?\n @_ws_active.pop \n last = @_ws_active.last\n if last \n case last\n when WsStack\n if s[:height]\n last[:row] += s[:height] \n else\n #last[:row] += last[:highest_row] \n last[:row] += 1\n end\n when WsFlow\n last[:col] += last[:item_width] || 0 \n end\n end\n end",
"def config\n yield self\n end",
"def generate_config(resource)\n resource = symbolize_hash(convert_to_hash(resource))\n config = []\n config << \"lxc.utsname = #{resource[:utsname]}\"\n if(resource[:aa_profile])\n config << \"lxc.aa_profile = #{resource[:aa_profile]}\"\n end\n [resource[:network]].flatten.each do |net_hash|\n nhsh = Mash.new(net_hash)\n flags = nhsh.delete(:flags)\n %w(type link).each do |k|\n config << \"lxc.network.#{k} = #{nhsh.delete(k)}\" if nhsh[k]\n end\n nhsh.each_pair do |k,v|\n config << \"lxc.network.#{k} = #{v}\"\n end\n if(flags)\n config << \"lxc.network.flags = #{flags}\"\n end\n end\n if(resource[:cap_drop])\n config << \"lxc.cap.drop = #{Array(resource[:cap_drop]).join(' ')}\"\n end\n %w(include pts tty arch devttydir mount mount_entry rootfs rootfs_mount pivotdir).each do |k|\n config << \"lxc.#{k.sub('_', '.')} = #{resource[k.to_sym]}\" if resource[k.to_sym]\n end\n prefix = 'lxc.cgroup'\n resource[:cgroup].each_pair do |key, value|\n if(value.is_a?(Array))\n value.each do |val|\n config << \"#{prefix}.#{key} = #{val}\"\n end\n else\n config << \"#{prefix}.#{key} = #{value}\"\n end\n end\n config.join(\"\\n\") + \"\\n\"\n end",
"def included(klass)\n set_config_defaults\n\n klass.class_eval do\n include ::Collapsium::Config\n end\n end",
"def horizontals_reset\n @htop = 0\n end",
"def config=(_arg0); end",
"def config=(_arg0); end",
"def config=(_arg0); end",
"def config=(_arg0); end",
"def config=(_arg0); end",
"def title; self.config['title']; end",
"def parametrize #alias\n self.configuration\n end",
"def table config={}, &block\n #def tabular_widget config={}, &block\n require 'canis/core/widgets/table'\n events = [:PROPERTY_CHANGE, :LEAVE, :ENTER, :CHANGE, :ENTER_ROW, :PRESS ]\n block_event = nil\n # if no width given, expand to stack width\n #config.delete :title\n useform = nil\n\n w = Table.new useform, config # NO BLOCK GIVEN\n w.width ||= :expand \n w.height ||= :expand # TODO This has to come before other in stack next one will overwrite.\n _position(w)\n if block_given?\n #@current_object << w\n yield_or_eval &block\n #@current_object.pop\n end\n return w\n end",
"def add_sibling_machine_configs; end",
"def configuration\n cfg = {}\n cfg[:author_avpair] = @author_avpair.name if (@author_avpair)\n cfg[:command_authorization_profile] = @command_authorization_profile.name if (@command_authorization_profile)\n cfg[:enable_acl] = @enable_acl.name if (@enable_acl)\n cfg[:login_acl] = @login_acl.name if (@login_acl)\n return(cfg)\n end",
"def configure(conf)\n super\n end",
"def bit_wise_columns_config\n @b_w_c_c ||= {\n steps_done: steps_done_config\n }\n end",
"def display_config\n # Format types and the additional options that apply to each type\n format_opts = {\n \"block\" => [\n \"entry-break\",\n \"element-break\",\n \"exit-break\",\n \"subindent\",\n \"normalize\",\n \"wrap-length\"\n ],\n \"inline\" => [ ],\n \"verbatim\" => [ ]\n }\n @elt_opts.keys.sort.each do |elt_name|\n puts elt_name\n opts = @elt_opts[elt_name]\n format = opts[\"format\"]\n # Write out format type, then options that apply to the format type\n puts \" format = #{format}\"\n format_opts[format].each do |opt_name|\n puts \" #{opt_name} = #{opts[opt_name]}\"\n end\n puts\n end\n end",
"def horizontal?\n height < width\n end",
"def horizontal_line(valign=:middle,options={})\n hl(valign,options)\n end",
"def before_configuration(&block); end",
"def demoExplorerSmallIcons(t)\n demoExplorerList(t)\n t.configure(:orient=>:horizontal, :xscrollincrement=>0)\n t.column_configure(0, :width=>'', :stepwidth=>110, :widthhack=>false)\nend",
"def add_horizontal_segment (option, size)\n case option\n when 'on'\n return ' ' + ('-' * size) + ' ' + @@digit_space\n when 'off'\n return ' ' + (' ' * size) + ' ' + @@digit_space\n else\n return 'Invalid horizontal region option'\n end\n end",
"def horizontal_seperator y, x, x2\n [x, y, x2, y, 150, 150, 150]\n end",
"def horizontal\n column.include?(\"XXXX\") || column.include?(\"OOOO\") #true or false for 4 in a row x's or o's\n end",
"def configure_cells\n\t\teach_cell do |cell|\n\t\t\trow, col = cell.row, cell.column\n\n\t\t\tcell.north = self[row - 1, col]\n\t\t\tcell.south = self[row + 1, col]\n\t\t\tcell.east = self[row, col + 1]\n\t\t\tcell.west = self[row, col - 1]\n\t\tend\n\tend",
"def config_store; end",
"def legionnairs\n\n end",
"def configure(conf)\n @pType = conf['pType']\n @ispColumn = (conf['pColumn']!=\"none\"?true:false)\n if @ispColumn\n @cArray = conf['pColumn'].split(',')\n end\n\n @pArray = conf['pPattern'].split(',')\n end",
"def configure(&block); end",
"def configure(&block); end",
"def config\n name = $0.scan(/thin_(\\d+)/) && $1\n config = <<__CONFIG\ngraph_title Delayed::Job queue size\ngraph_vlabel Entries\ngraph_category Rails\nentries.label Entries\nentries.warning 200\nentries.critical 300\ngraph_info Number of records in the Delayed::Job table\n__CONFIG\nend",
"def config=(config); end",
"def grid(*)\n super\n end",
"def config\n puts <<-END\ngraph_title puppet clients usage\ngraph_vlabel clients\nknown_clients.label Known Clients\navg_compile.label Average configuration compile\nlast5m_count.label Clients in the last 5 minutes\nlast24h_unique_count.label unique clients in the last 24 hours\ngraph_category puppet\nEND\n exit 0\nend",
"def config(&block)\n yield(self)\n end",
"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",
"def config\n details = Chassis.pkgs.dup\n details << [\"tags\"] + Chassis.tags unless Chassis.tags.empty?\n details << [\"roles\"] + Chassis.roles unless Chassis.roles.empty?\n details << [\"kind\"] + [Chassis.node_kind] if Chassis.node_kind\n details << Chassis.extra_config if Chassis.extra_config\n details\n end",
"def config(context={}, aspect_model)\n \n app = context[:app]\n template_path = File.expand_path(File.join(File.dirname(__FILE__),'..',\n 'views','gallery_aspect_config.erb'))\n template = Tilt.new(template_path)\n the_render = template.render(app) \n \n end",
"def configure()\n\t\t\tyield self\n\t\tend",
"def flow config={}, &block\n s = WsFlow.new config\n _configure s\n @_ws_active << s\n yield_or_eval &block if block_given?\n @_ws_active.pop \n last = @_ws_active.last\n if last \n case last\n when WsStack\n if s[:height]\n last[:row] += s[:height] \n else\n #last[:row] += last[:highest_row] \n last[:row] += 1\n end\n when WsFlow\n last[:col] += last[:item_width] || 0 \n end\n end\n end"
] | [
"0.6484537",
"0.6019997",
"0.59005773",
"0.57975817",
"0.5708118",
"0.56599236",
"0.56599236",
"0.56599236",
"0.56599236",
"0.56599236",
"0.56599236",
"0.56599236",
"0.56599236",
"0.56599236",
"0.56599236",
"0.56599236",
"0.56599236",
"0.56599236",
"0.56599236",
"0.56599236",
"0.56599236",
"0.56599236",
"0.56599236",
"0.5641939",
"0.5641939",
"0.5641939",
"0.5641939",
"0.5641939",
"0.56046593",
"0.55613154",
"0.55331326",
"0.55190843",
"0.54994816",
"0.5443907",
"0.5434747",
"0.5422232",
"0.5405733",
"0.54013425",
"0.53986454",
"0.53802",
"0.53725386",
"0.53126",
"0.53068197",
"0.53067195",
"0.52982277",
"0.52872336",
"0.5285215",
"0.52841353",
"0.52766603",
"0.52686733",
"0.52274626",
"0.5218334",
"0.51901096",
"0.51704735",
"0.51549155",
"0.5147484",
"0.5137228",
"0.51302385",
"0.51302385",
"0.5122127",
"0.51081485",
"0.510678",
"0.509783",
"0.5092411",
"0.5081354",
"0.5081354",
"0.5081354",
"0.5081354",
"0.5081354",
"0.50804704",
"0.50781107",
"0.50641185",
"0.5059988",
"0.5059915",
"0.5055773",
"0.505133",
"0.5049934",
"0.5046735",
"0.50328434",
"0.5031523",
"0.502792",
"0.50271565",
"0.5023037",
"0.50159305",
"0.50147444",
"0.50069374",
"0.50049496",
"0.50031257",
"0.49977487",
"0.49977487",
"0.49971852",
"0.4993836",
"0.49927384",
"0.4990157",
"0.49875185",
"0.49813485",
"0.49717838",
"0.49705133",
"0.49671102",
"0.4967005"
] | 0.5293535 | 45 |
helper method for vertical configuration | def channel i, param
param.clone.tap{ |hash|
hash[:channel] = i.to_s
self.channel_dispatch hash
self.vertical hash
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vertical(options = {}, &block)\n Vertical.new({ parent: self }.merge!(options), &block)\n end",
"def vertical_line(options={:start_in => :limit_left, :size => :area_y})\n set RGhost::VerticalLine.new(options)\n end",
"def draw_vertical_segment\n @pixel_x = @cmd_options.first-1\n @color = @cmd_options.last\n\n @pixel_y1s = (@cmd_options[1]..@cmd_options[2]).to_a\n\n @pixel_y1s.each do |pixel_y|\n pixel_y -= 1\n @matrix[pixel_y][@pixel_x] = @color\n end\n end",
"def set_vertical\n @vertical = Vertical.find(params[:id])\n end",
"def set_vertical\n @vertical = Vertical.find(params[:id])\n end",
"def vertical?\n height > width\n end",
"def reflect_vertical\r\n self.v[:y] = -self.v[:y]\r\n end",
"def set_vertical\n @vertical = Vertical.find(params[:id])\n end",
"def vertical_seperator x, y, y2\n [x, y, x, y2, 150, 150, 150]\n end",
"def vertical?\n height > width if !(width.blank? && height.blank?)\n end",
"def verticalLines\n (0...@width).inject([]) { |arr, column| arr << @modified.column(column) }\n end",
"def add_vertical_segment (option, size)\n case option\n when 'right'\n return ' ' + (' ' * size) + '|' + @@digit_space\n when 'left'\n return '|' + (' ' * size) + ' ' + @@digit_space\n when 'both'\n return '|' + (' ' * size) + '|' + @@digit_space\n when 'none'\n return ' ' + (' ' * size) + ' ' + @@digit_space\n else\n return 'Invalid vertical region option'\n end\n end",
"def configurations; end",
"def pivotoptions\n \n end",
"def center_vertically\n @vertical_align = :center\n return self\n end",
"def conf_vlan\n # VLAN port configuration table\n $conf_table =\n [\n {\n # Hybrid, S-custom port\n port_type: \"MESA_VLAN_PORT_TYPE_S_CUSTOM\",\n tpid: $s_etype,\n pvid: $vid_list[1],\n uvid: $vid_list[1],\n frame_type: \"MESA_VLAN_FRAME_ALL\"\n },\n ]\n # Set global Ethernet Type for S-custom ports\n conf = $ts.dut.call(\"mesa_vlan_conf_get\")\n conf[\"s_etype\"] = $s_etype\n $ts.dut.call(\"mesa_vlan_conf_set\", conf)\n\n # Set VLAN port configuration\n $port_list.each_with_index do |port, idx|\n entry = $conf_table[0]\n conf = $ts.dut.call(\"mesa_vlan_port_conf_get\", port)\n conf[\"port_type\"] = entry[:port_type]\n conf[\"pvid\"] = entry[:pvid]\n conf[\"untagged_vid\"] = entry[:uvid]\n conf[\"frame_type\"] = entry[:frame_type]\n $ts.dut.call(\"mesa_vlan_port_conf_set\", port, conf)\n end\n\n # Set VLAN memberships\n $ts.dut.call(\"mesa_vlan_port_members_set\", 1, \"\")\n $vid_list.each_with_index do |vid, idx|\n member_list = $vid_members\n str = \"\"\n member_list.each do |port|\n str += \"#{port}\"\n str += \",\" unless port == member_list.last\n end\n $ts.dut.call(\"mesa_vlan_port_members_set\", vid, str)\n end\nend",
"def vertical\n column.include?(\"XXXX\") || column.include?(\"OOOO\") #true or false for 4 in a row x's or o's\n end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def uv_config_liberal\n UvConfiguration.new(\n modules: {\n footerPanel: {\n options: {\n shareEnabled: true,\n downloadEnabled: true,\n fullscreenEnabled: true\n }\n }\n }\n )\n end",
"def new_config_content\n return <<-VHOST\n\n# vh configuration file\nInclude #{@target}\n# /vh configuration file\n VHOST\n end",
"def visibilities; end",
"def eigen_vertical_line(size, color)\n {\n type: \"VerticalLine\",\n size: size,\n color: color\n }\n end",
"def landscape\n config\n end",
"def vertical_params\n params.require(:vertical).permit(:name, :categories)\n end",
"def vertical_params\n params.require(:vertical).permit(:name)\n end",
"def vertical_bar\n unicode? ? \"\\u2503\" : '|'\n end",
"def layout_config\n @squeezed_layout_config\n end",
"def set_cms_vertical_link\n @cms_vertical_link = CmsVerticalLink.find(params[:id])\n end",
"def vertical_segment(x, y1, y2, color)\n validate_x_coords(x)\n validate_y_coords(y1, y2)\n ([y1, y2].min..[y1, y2].max).each { |y| self[x, y] = color }\n end",
"def verticalXY(vertical, index)\n {\n 'x' => vertical.to_i,\n 'y' => index.to_i\n }\n end",
"def get_verticals\n begin\n @vertical_form_id = nil\n\n if params.key? :software_id\n @vertical = Software.find(params[:software_id]) \n @vertical_form_id = :software_id\n elsif params.key? :dataset_id\n @vertical = Dataset.find(params[:dataset_id])\n @vertical_form_id = :dataset_id\n elsif params.key? :analysis_id\n @vertical = Analysis.find(params[:analysis_id]) \n @vertical_form_id = :analysis_id\n elsif params.key? :assignment_id\n @vertical = Assignment.find(params[:assignment_id]) \n @vertical_form_id = :assignment_id\n elsif params.key? :assignment_group_id\n @vertical = AssignmentGroup.find(params[:assignment_group_id]) \n @vertical_form_id = :assignment_group_id\n elsif params.key? :example_id\n @vertical = Example.find(params[:example_id]) \n @vertical_form_id = :example_id\n end\n\n rescue\n error = \"Invalid vertical id given.\"\n\n end\n end",
"def vertical_alignment=(value)\n @vertical_alignment = value\n end",
"def config\n\n end",
"def default_uv_config\n ViewerConfiguration.new\n end",
"def vertical?(style_name='original')\n geometry(style_name).vertical?\n end",
"def all_verticals(columns)\n verticals = []\n columns.each {|column, content| verticals << content.join}\n verticals\n end",
"def vertical\n @segments = Title.get_segments(@task.id,current_user.id)\n @vertical = Title.find(params[:vertical_id])\n @charttext = Charttext.find_or_create_by_title_id(title_id: @vertical.id, user_id: current_user.id,content_type: 0)\n @ptitles = @vertical.children\n @next_seg = @vertical.find_next\n @prev_seg = @vertical.find_previous\n @url = task_charttext_path(@task,@charttext)\n \n respond_to do |format|\n format.js\n end\n end",
"def use_section_planes=(setting)\n end",
"def configurePlot\n end",
"def configuration; end",
"def configuration; end",
"def configuration; end",
"def configuration; end",
"def configuration; end",
"def draw_vertical(col: 0, start_row: 0, end_row: 0, color: \"R\")\n image.map!.with_index do |row, row_num|\n row.map.with_index do |pixel, col_num|\n if (row_num >= start_row && row_num <= end_row) && (col == col_num)\n color\n else\n pixel\n end\n end\n end\n save_state\n self\n end",
"def ltab\n horizontals_reset\n @vertical = @layout.createBaselineGroup(true, false)\n end",
"def indentation_vertical\n arr = @lines.map { |x| x == \"\\n\" ? x = nil : x[/^\\s*/].size }\n a = []\n 1.upto(arr.size - 2) do |i|\n if arr[i].nil?\n a.push('x')\n elsif !arr[i].nil? && !arr[i + 1].nil?\n a.push(arr[i] - arr[i + 1])\n elsif !arr[i].nil? && arr[i + 1].nil?\n j = i + 1\n loop do\n j += 1\n break if !arr[j].nil? || (j >= arr.size - 2)\n end\n a.push(arr[i] - arr[j]) if !arr[i].nil? && !arr[j].nil?\n next\n end\n end\n a.each_with_index { |x, indx| @indentation[:vertical].push(indx + 2) unless [0, 2, -2, 'x'].include?(x) }\n end",
"def row\n @vgroup.add(@vertical);\n alignments_reset ; widths_reset ; heights_reset\n end",
"def initialize\n super(VIDEO_CONFIG)\n end",
"def initialize( config )\n @config = config\n\n self.top_align = self.top_font = self.right_align = self.right_font = 0\n\n init_with({\n :width => 500,\n :height => 300,\n :show_x_guidelines => false,\n :show_y_guidelines => true,\n :show_data_values => true,\n\n# :min_scale_value => 0,\n\n :show_x_labels => true,\n :stagger_x_labels => false,\n :rotate_x_labels => false,\n :step_x_labels => 1,\n :step_include_first_x_label => true,\n\n :show_y_labels => true,\n :rotate_y_labels => false,\n :stagger_y_labels => false,\n :scale_integers => false,\n\n :show_x_title => false,\n :x_title => 'X Field names',\n\n :show_y_title => false,\n :y_title_text_direction => :bt,\n :y_title => 'Y Scale',\n\n :show_graph_title => false,\n :graph_title => 'Graph Title',\n :show_graph_subtitle => false,\n :graph_subtitle => 'Graph Sub Title',\n :key => true, \n :key_position => :right, # bottom or right\n\n :font_size =>12,\n :title_font_size =>16,\n :subtitle_font_size =>14,\n :x_label_font_size =>12,\n :x_title_font_size =>14,\n :y_label_font_size =>12,\n :y_title_font_size =>14,\n :key_font_size =>10,\n \n :no_css =>false,\n :add_popups =>false,\n })\n\n\t\t\t\tset_defaults if respond_to? :set_defaults\n\n init_with config\n end",
"def center_vertically(vcenter = nil)\n if vcenter.nil?\n @vcenter = 1\n else\n @vcenter = vcenter\n end\n end",
"def default_vertical_margin\n return 0\n end",
"def orientation=(orientation='h')\n if orientation == 'h' || orientation == 'horizontal'\n self.horizontal = true\n elsif orientation == 'v' || orientation == 'vertical'\n self.horizontal = false\n end\n end",
"def active_section_plane\n end",
"def venueColumns \n venueLayout[\"columns\"]\n end",
"def index\n @verticals = Vertical.all\n end",
"def vertical_alignment\n return @vertical_alignment\n end",
"def vertical_line_row(border_options=RGhost::Border::DEFAULT_OPTIONS)\n set RGhost::VerticalLine.row(border_options)\n end",
"def vertical_params\n params.require(:vertical).permit(:name)\n end",
"def relation_base_blacklight_config\n # don't show collection facet\n blacklight_config.facet_fields['collection_name_ssim'].show = false\n blacklight_config.facet_fields['collection_name_ssim'].if = false\n # collapse remaining facets\n blacklight_config.facet_fields['subject_facet_ssim'].collapse = true\n blacklight_config.facet_fields['subject_geographic_sim'].collapse = true\n blacklight_config.facet_fields['date_facet_yearly_itim'].collapse = true\n blacklight_config.facet_fields['genre_basic_ssim'].collapse = true\n blacklight_config.facet_fields['reuse_allowed_ssi'].collapse = true\n # remove item-centric show tools (for admin)\n blacklight_config.show.document_actions.delete(:sharing)\n blacklight_config.show.document_actions.delete(:bookmark)\n blacklight_config.show.document_actions.delete(:email)\n blacklight_config.show.document_actions.delete(:citation)\n end",
"def active_section_plane\n end",
"def active_section_plane\n end",
"def get_config\n\t\tend",
"def setup\n super\n @background_colour = @colour\n @foreground_colour = Palette.white\n @axis = :y\n end",
"def customize_cloud_config(cloud_init_yaml, vm_i)\n case vm_i\n when 1 then cloud_init_yaml['coreos']['fleet']['metadata'] = 'role=head'\n when 2 then cloud_init_yaml['coreos']['fleet']['metadata'] = 'role=proxy'\n when 3 then cloud_init_yaml['coreos']['fleet']['metadata'] = 'role=web'\n when 4 then cloud_init_yaml['coreos']['fleet']['metadata'] = 'role=web'\n end\nend",
"def horizontal\n return HORIZONTAL\n end",
"def data\n vertical? ? columns : rows\n end",
"def initialize\n super\n @vertical = false\n self[:tabindex] ||= 0\n end",
"def config=(config); end",
"def vertical_segment(x, y1, y2, color)\n raise InvalidColorError.new(color) unless valid_color?(color)\n raise SegmentOutOfBoundsError.new unless vertical_segment_valid?(x.to_i, y1.to_i, y2.to_i)\n\n y1.upto(y2).each do |i|\n grid[i.to_i - 1][x.to_i - 1] = color\n end\n end",
"def display_vertical\n\t\t@numbers.to_s.split('').collect{|number| NUMBER[number]}.each do |elems|\n\t\t\telems.each{|elem| puts CHARS[elem]}\n\t\tend\n\tend",
"def configure_vmware_vbox_vm(client_name)\n modify_vbox_vm(client_name,\"rtcuseutc\",\"on\")\n modify_vbox_vm(client_name,\"vtxvpid\",\"on\")\n modify_vbox_vm(client_name,\"vtxux\",\"on\")\n modify_vbox_vm(client_name,\"hwvirtex\",\"on\")\n setextradata_vbox_vm(client_name,\"VBoxInternal/Devices/pcbios/0/Config/DmiSystemVersion\",\"None\")\n setextradata_vbox_vm(client_name,\"VBoxInternal/Devices/pcbios/0/Config/DmiBoardVendor\",\"Intel Corporation\")\n setextradata_vbox_vm(client_name,\"VBoxInternal/Devices/pcbios/0/Config/DmiBoardProduct\",\"440BX Desktop Reference Platform\")\n setextradata_vbox_vm(client_name,\"VBoxInternal/Devices/pcbios/0/Config/DmiSystemVendor\",\"VMware, Inc.\")\n setextradata_vbox_vm(client_name,\"VBoxInternal/Devices/pcbios/0/Config/DmiSystemProduct\",\"VMware Virtual Platform\")\n setextradata_vbox_vm(client_name,\"VBoxInternal/Devices/pcbios/0/Config/DmiBIOSVendor\",\"Phoenix Technologies LTD\")\n setextradata_vbox_vm(client_name,\"VBoxInternal/Devices/pcbios/0/Config/DmiBIOSVersion\",\"6.0\")\n setextradata_vbox_vm(client_name,\"VBoxInternal/Devices/pcbios/0/Config/DmiChassisVendor\",\"No Enclosure\")\n vbox_vm_uuid = get_vbox_vm_uuid(client_name)\n vbox_vm_uuid = \"VMware-\"+vbox_vm_uuid\n setextradata_vbox_vm(client_name,\"VBoxInternal/Devices/pcbios/0/Config/DmiSystemSerial\",vbox_vm_uuid)\n return\nend",
"def vertical_line (board)\n transposed_board = board.transpose\n return horizontal_line (transposed_board)\n end",
"def height\n if alignment == :vertical\n @height ||= @options.count * @options.first.height\n else\n @height ||= @options.first.height\n end\n end",
"def config_lv_define_box2(vm, conf)\n vm.define conf['hostname_box2'] do |box2|\n box2.vm.hostname = conf['hostname_box2']\n box2.vm.box = conf['imagename_box2']\n box2.vm.network :private_network,\n :libvirt__network_name => \"mgmt\",\n :mac => conf['libvirt_mgmt_mac_box2'],\n :ip => conf['libvirt_mgmt_ip_box2'],\n :libvirt__netmask => conf['libvirt_mgmt_netmask_box2'],\n :libvirt__dhcp_enabled => false,\n :libvirt__forward_mode => \"none\",\n :autostart => true\n box2.vm.network :public_network,\n :network_name => \"ext\",\n :ip => conf['libvirt_ext_ip_box2'],\n :netmask => conf['libvirt_ext_netmask_box2'],\n :gateway => conf['libvirt_ext_gateway_box2'],\n :mac => conf['libvirt_ext_mac_box2'],\n :dev => conf['libvirt_dev'],\n :type => conf['libvirt_type'],\n :mode => conf['libvirt_mode']\n box2.vm.network :private_network,\n :libvirt__network_name => \"ceph\",\n :mac => conf['libvirt_ceph_mac_box2'],\n :ip => conf['libvirt_ceph_ip_box2'],\n :libvirt__netmask => conf['libvirt_ceph_netmask_box2'],\n :libvirt__dhcp_enabled => false,\n :libvirt__forward_mode => \"none\",\n :autostart => true\n box2.vm.network :private_network,\n :libvirt__network_name => \"vm_tunnel\",\n :mac => conf['libvirt_tunnel_mac_box2'],\n :ip => conf['libvirt_tunnel_ip_box2'],\n :libvirt__netmask => conf['libvirt_tunnel_netmask_box2'],\n :libvirt__dhcp_enabled => false,\n :libvirt__forward_mode => \"none\",\n :autostart => true\n box2.vm.provider :libvirt do |domain|\n domain.memory = conf['memory_box2']\n domain.cpus = conf['cpus_box2']\n domain.management_network_name = 'vagrantmgmt'\n domain.management_network_address = conf['libvirt_vagrantmgmt_ip_box2']\n domain.management_network_mode = conf['libvirt_mgmt_mode']\n end\n config_provision(box2.vm, conf)\n end\nend",
"def yaxis\n end",
"def submode_config(config_line)\n command = config_line.strip\n @configuration[command]\n end",
"def vertical_grid_line(index)\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.GraphComponentState_vertical_grid_line(@handle.ptr, index)\n result\n end",
"def configure_vmware_fusion(host,vmcfg)\n host.vm.provider \"vmware_fusion\" do |pcfg|\n pcfg.vmx['memsize'] = vmcfg['vm']['memory'] if vmcfg['vm']['memory']\n pcfg.vmx['numvcpus'] = vmcfg['vm']['cpu'] if vmcfg['vm']['cpu']\n end\nend",
"def uv_config\n v = visibility_lookup(resource_id_param)\n config = if v == \"open\"\n uv_config_liberal\n elsif v == \"authenticated\" && user_signed_in?\n uv_config_liberal\n elsif v == \"emory_low\" && user_signed_in?\n uv_config_liberal_low\n else\n default_config\n end\n\n respond_to do |format|\n format.json { render json: config }\n end\n end",
"def layouts=(_arg0); end",
"def layouts=(_arg0); end",
"def config\n puts <<-END\ngraph_title puppet clients usage\ngraph_vlabel clients\nknown_clients.label Known Clients\navg_compile.label Average configuration compile\nlast5m_count.label Clients in the last 5 minutes\nlast24h_unique_count.label unique clients in the last 24 hours\ngraph_category puppet\nEND\n exit 0\nend",
"def getCfg(snap = nil)\n mor = snap ? getSnapMor(snap) : @vmMor\n cfgProps = @invObj.getMoProp(mor, \"config\")\n raise MiqException::MiqVimError, \"Failed to retrieve configuration information for VM\" if cfgProps.nil?\n cfgProps = cfgProps[\"config\"]\n\n cfgHash = {\n 'displayname' => cfgProps['name'],\n 'guestos' => cfgProps['guestId'].downcase.chomp(\"guest\"),\n 'uuid.bios' => cfgProps['uuid'],\n 'uuid.location' => cfgProps['locationId'],\n 'memsize' => cfgProps['hardware']['memoryMB'],\n 'cpu_cores_per_socket' => cfgProps['hardware']['numCoresPerSocket'],\n 'numvcpu' => cfgProps['hardware']['numCPU'],\n 'config.version' => cfgProps['version'],\n }\n\n controllerKeyHash = {}\n\n 1.upto(2) do |_i|\n cfgProps['hardware']['device'].each do |dev|\n case dev.xsiType\n when 'VirtualIDEController'\n tag = \"ide#{dev['busNumber']}\"\n dev['tag'] = tag\n controllerKeyHash[dev['key']] = dev\n\n when 'VirtualLsiLogicController', 'VirtualLsiLogicSASController', 'ParaVirtualSCSIController'\n tag = \"scsi#{dev['busNumber']}\"\n dev['tag'] = tag\n controllerKeyHash[dev['key']] = dev\n cfgHash[\"#{tag}.present\"] = \"true\"\n cfgHash[\"#{tag}.virtualdev\"] = \"lsilogic\"\n\n when 'VirtualBusLogicController'\n tag = \"scsi#{dev['busNumber']}\"\n dev['tag'] = tag\n controllerKeyHash[dev['key']] = dev\n cfgHash[\"#{tag}.present\"] = \"true\"\n cfgHash[\"#{tag}.virtualdev\"] = \"buslogic\"\n\n when 'VirtualDisk'\n controller_tag = controllerKeyHash.fetch_path(dev['controllerKey'], 'tag')\n next if controller_tag.nil?\n tag = \"#{controller_tag}:#{dev['unitNumber']}\"\n cfgHash[\"#{tag}.present\"] = \"true\"\n cfgHash[\"#{tag}.devicetype\"] = \"disk\"\n cfgHash[\"#{tag}.filename\"] = dev['backing']['fileName']\n cfgHash[\"#{tag}.mode\"] = dev['backing']['diskMode']\n when \"VirtualCdrom\"\n controller_tag = controllerKeyHash.fetch_path(dev['controllerKey'], 'tag')\n next if controller_tag.nil?\n tag = \"#{controller_tag}:#{dev['unitNumber']}\"\n cfgHash[\"#{tag}.present\"] = \"true\"\n if dev['backing']['fileName'].nil?\n cfgHash[\"#{tag}.devicetype\"] = \"cdrom-raw\"\n cfgHash[\"#{tag}.filename\"] = dev['backing']['deviceName']\n else\n cfgHash[\"#{tag}.devicetype\"] = \"cdrom-image\"\n cfgHash[\"#{tag}.filename\"] = dev['backing']['fileName']\n end\n cfgHash[\"#{tag}.startconnected\"] = dev['connectable']['startConnected']\n when \"VirtualFloppy\"\n tag = \"floppy#{dev['unitNumber']}\"\n cfgHash[\"#{tag}.present\"] = \"true\"\n if dev['backing']['fileName'].nil?\n cfgHash[\"#{tag}.filename\"] = dev['backing']['deviceName']\n else\n cfgHash[\"#{tag}.filename\"] = dev['backing']['fileName']\n end\n cfgHash[\"#{tag}.startconnected\"] = dev['connectable']['startConnected']\n when \"VirtualPCNet32\", \"VirtualE1000\"\n tag = \"ethernet#{dev['unitNumber'].to_i - 1}\"\n cfgHash[\"#{tag}.present\"] = \"true\"\n cfgHash[\"#{tag}.networkname\"] = dev['backing']['deviceName']\n cfgHash[\"#{tag}.generatedaddress\"] = dev['macAddress']\n cfgHash[\"#{tag}.startconnected\"] = dev['connectable']['startConnected']\n cfgHash[\"#{tag}.type\"] = dev['deviceInfo']['label']\n end\n end\n end\n\n cfgHash\n end"
] | [
"0.63406026",
"0.5960121",
"0.57448065",
"0.5734794",
"0.56970537",
"0.5662436",
"0.5652138",
"0.5646943",
"0.55699885",
"0.555831",
"0.5548402",
"0.54956263",
"0.54668164",
"0.54188526",
"0.5393927",
"0.53391457",
"0.5291507",
"0.52518946",
"0.52518946",
"0.52518946",
"0.52518946",
"0.52518946",
"0.52518946",
"0.52518946",
"0.52518946",
"0.52518946",
"0.52518946",
"0.52518946",
"0.52518946",
"0.52518946",
"0.52518946",
"0.52518946",
"0.52518946",
"0.52518946",
"0.52518946",
"0.52372915",
"0.5209377",
"0.51621115",
"0.5157413",
"0.5147347",
"0.5141623",
"0.51382494",
"0.51302993",
"0.5126225",
"0.5117548",
"0.5108496",
"0.5097061",
"0.5083374",
"0.50818723",
"0.50670224",
"0.5065329",
"0.5064181",
"0.50636435",
"0.5061592",
"0.5060249",
"0.50485265",
"0.5047749",
"0.5047749",
"0.5047749",
"0.5047749",
"0.5047749",
"0.5042206",
"0.50368226",
"0.5034036",
"0.5022601",
"0.50183994",
"0.50166166",
"0.50118434",
"0.49961612",
"0.4973891",
"0.49701017",
"0.49682048",
"0.49646005",
"0.49580064",
"0.49458638",
"0.49395895",
"0.4937603",
"0.49336866",
"0.49336866",
"0.49316123",
"0.49266353",
"0.49075076",
"0.49046582",
"0.48998725",
"0.48980403",
"0.48916548",
"0.48910287",
"0.48871082",
"0.4886096",
"0.4879263",
"0.48713553",
"0.48691964",
"0.48644888",
"0.4863733",
"0.48543936",
"0.4846616",
"0.4842105",
"0.48410916",
"0.48410916",
"0.483903",
"0.48216763"
] | 0.0 | -1 |
helper method for trigger configuration | def trigger param
self.send "trig_#{param[:type] || :edge}".to_sym, param
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def triggers\n\n end",
"def adjust_trigger(trig_type, trig_arn, func_arn, func_id=nil, protocol='lambda',region=@config['region'])\n \n case trig_type\n \n when 'sns'\n # XXX don't do this, use MU::Cloud::AWS::Notification \n sns_client = MU::Cloud::AWS.sns(region: @config['region'], credentials: @config['credentials'])\n sub_to_what = sns_client.subscribe({\n topic_arn: trig_arn,\n protocol: protocol,\n endpoint: func_arn\n })\n when 'event','cloudwatch_event', 'events'\n # XXX don't do this, use MU::Cloud::AWS::Log\n client = MU::Cloud::AWS.cloudwatch_events(region: @config['region'], credentials: @config['credentials']).put_targets({\n rule: @config['trigger']['name'],\n targets: [\n {\n id: func_id,\n arn: func_arn\n }\n ]\n })\n when 'apigateway'\n# XXX this is actually happening in ::Endpoint... maybe... \n# MU.log \"Creation of API Gateway integrations not yet implemented, you'll have to do this manually\", MU::WARN, details: \"(because we'll basically have to implement all of APIG for this)\"\n end \n end",
"def trigger\n @trigger ||= begin\n trigger = Scrutinize::Trigger.new\n\n # Trigger configured at top level\n keys = %w(methods method targets target)\n unless (@options.keys & keys).empty?\n trigger.add @options.select { |k,v| keys.include?(k) }\n end\n\n # Trigger configured under trigger key\n trigger.add @options['trigger'] if @options['trigger'].is_a?(Hash)\n\n # Triggers configured under triggers key\n if @options['triggers'].is_a? Array\n @options['triggers'].each { |t| trigger.add t }\n end\n\n trigger\n end\n end",
"def configurations; end",
"def trigger_options\n triggers.map { |t, _| [t.gsub('on_', '').titlecase, t] }\n end",
"def configuration; end",
"def configuration; end",
"def configuration; end",
"def configuration; end",
"def configuration; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def before_configuration_tasks \n end",
"def to_s\n \"trigger config\"\n end",
"def config\n\n end",
"def trigger!\n end",
"def initialize(trigger, config)\n @trigger = trigger.to_sym\n @config = config\n end",
"def config=(_arg0); end",
"def config=(_arg0); end",
"def config=(_arg0); end",
"def config=(_arg0); end",
"def config=(_arg0); end",
"def checkTrigger\n\t end",
"def before_configuration(&block); end",
"def configure; end",
"def configure\n end",
"def configure(&block); end",
"def configure(&block); end",
"def auto_configuration_state\n super\n end",
"def create_trigger(command, block, extra_cfg=nil)\n trigger = VagrantConfigTrigger.new(command)\n if block.is_a?(Hash)\n trigger.set_options(block)\n else\n block.call(trigger, VagrantConfigTrigger)\n trigger.set_options(extra_cfg) if extra_cfg\n end\n return trigger\n end",
"def setup_config\n # To be Extended\n end",
"def trigger_ext\n return @trigger_ext unless @trigger_ext.nil?\n parse_event_triggers unless @custom_event_triggers_checked\n return @trigger_ext\n end",
"def triggers(name = nil)\n raise \"Internal Error: Connection adapter did not override abstract function\"\n end",
"def config(action, *args); end",
"def get_config\n\t\tend",
"def default_configuration=(_arg0); end",
"def config=(config); end",
"def link_auto_configuration_state\n super\n end",
"def task_triggers=(value)\n @task_triggers = value\n end",
"def configure(update); end",
"def configure(conf)\n super \n # Read property file and create a hash\n @rename_rules = []\n conf_rename_rules = conf.keys.select { |k| k =~ /^rename_rule(\\d+)$/ }\n conf_rename_rules.sort_by { |r| r.sub('rename_rule', '').to_i }.each do |r|\n key_regexp, new_key = parse_rename_rule conf[r]\n\n if key_regexp.nil? || new_key.nil?\n raise Fluent::ConfigError, \"Failed to parse: #{r} #{conf[r]}\"\n end\n\n if @rename_rules.map { |r| r[:key_regexp] }.include? /#{key_regexp}/\n raise Fluent::ConfigError, \"Duplicated rules for key #{key_regexp}: #{@rename_rules}\"\n end\n\n #@rename_rules << { key_regexp: /#{key_regexp}/, new_key: new_key }\n @rename_rules << { key_regexp: key_regexp, new_key: new_key }\n $log.info \"Added rename key rule: #{r} #{@rename_rules.last}\"\n end\n\n raise Fluent::ConfigError, \"No rename rules are given\" if @rename_rules.empty?\n @conf = conf\n # map of Spectrum attribute codes to names\n @spectrum_access_code={\n \"0x11f9c\" => \"ALARM_ID\",\n \"0x11f4e\" => \"CREATION_DATE\",\n \"0x11f56\" => \"SEVERITY\",\n \"0x12b4c\" => \"ALARM_TITLE\",\n \"0x1006e\" => \"HOSTNAME\",\n \"0x12d7f\" => \"IP_ADDRESS\",\n \"0x1296e\" => \"ORIGINATING_EVENT_ATTR\",\n \"0x10000\" => \"MODEL_STRING\", \n \"0x11f4d\" => \"ACKNOWLEDGED\",\n \"0x11f4f\" => \"ALARM_STATUS\",\n \"0x11fc5\" => \"OCCURRENCES\",\n \"0x11f57\" => \"TROUBLE_SHOOTER\",\n \"0x11f9b\" => \"USER_CLEARABLE\",\n \"0x12022\" => \"TROUBLE_TICKET_ID\",\n \"0x12942\" => \"PERSISTENT\",\n \"0x12adb\" => \"GC_NAME\",\n \"0x57f0105\" => \"Custom_Project\",\n \"0x11f4d\" => \"ACKNOWLEDGED\",\n \"0xffff00ed\" => \"application_name\",\n \"0xffff00f1\" => \"business_unit_l1\",\n \"0xffff00f2\" => \"business_unit_l2\",\n \"0xffff00f3\" => \"business_unit_l3\",\n \"0xffff00f4\" => \"business_unit_l4\",\n \"0xffff00f0\" => \"cmdb_ci_sysid\",\n\n #{}\"0x11f51\" => \"CLEARED_BY_USER_NAME\",\n #{}\"0x11f52\" => \"EVENT_ID_LIST\",\n #{}\"0x11f53\" => \"MODEL_HANDLE\",\n #{}\"0x11f54\" => \"PRIMARY_ALARM\",\n #{}\"0x11fc4\" => \"ALARM_SOURCE\",\n #{}\"0x11fc6\" => \"TROUBLE_SHOOTER_MH\",\n #{}\"0x12a6c\" => \"TROUBLE_SHOOTER_EMAIL\",\n #{}\"0x1290d\" => \"IMPACT_SEVERITY\",\n #{}\"0x1290e\" => \"IMPACT_SCOPE\",\n #{}\"0x1298a\" => \"IMPACT_TYPE_LIST\",\n #{}\"0x12948\" => \"DIAGNOSIS_LOG\",\n #{}\"0x129aa\" => \"MODEL_ID\",\n #{}\"0x129ab\" => \"MODEL_TYPE_ID\",\n #{}\"0x129af\" => \"CLEAR_DATE\",\n #{}\"0x12a04\" => \"SYMPTOM_LIST_ATTR\",\n #{}\"0x12a6f\" => \"EVENT_SYMPTOM_LIST_ATTR\",\n #{}\"0x12a05\" => \"CAUSE_LIST_ATTR\",\n #{}\"0x12a06\" => \"SYMPTOM_COUNT_ATTR\",\n #{}\"0x12a70\" => \"EVENT_SYMPTOM_COUNT_ATTR\",\n #{}\"0x12a07\" => \"CAUSE_COUNT_ATTR\",\n #{}\"0x12a63\" => \"WEB_CONTEXT_URL\",\n #{}\"0x12a6b\" => \"COMBINED_IMPACT_TYPE_LIST\",\n #{}\"0x11f50\" => \"CAUSE_CODE\",\n #{}\"0x10009\" => \"SECURITY_STRING\"\n }\n # Create XML chunk for attributes we care about\n @attr_of_interest=\"\"\n @spectrum_access_code.each do |key, array|\n @attr_of_interest += \" <rs:requested-attribute id=\\\"#{key}\\\"/>\"\n end\n\n\n # Setup URL Resource\n \t@url = 'http://' + @endpoint.to_s + '/spectrum/restful/alarms/'\n end",
"def configuration\n notifier.configuration\n end",
"def configure_with(params)\r\n\r\n\t\tend",
"def env_config; end",
"def env_config; end",
"def env_config; end",
"def env_config; end",
"def function\n config[:function]\n end",
"def configuration_file_path; end",
"def config(&b)\n b.call\nend",
"def all_hook_configs; end",
"def configure &block\n\t\tinstance_eval &block\n\tend",
"def config_files(override); end",
"def configure\n send_command \"--configure\"\n end",
"def triggers=(value)\n @triggers = value\n end",
"def configuration_name\n super\n end",
"def declare_configuration_options\n ws.config.declare \"daemon_polling_period\", \"string\",\n default: \"60\",\n doc: \"Enter the github polling period\"\n\n ws.config.declare \"daemon_buildbot_host\", \"string\",\n default: \"localhost\",\n doc: \"Enter builbot host/ip\"\n\n ws.config.declare \"daemon_buildbot_port\", \"string\",\n default: \"8010\",\n doc: \"Enter buildbot http port\"\n\n ws.config.declare \"daemon_project\", \"string\",\n default: File.basename(ws.root_dir),\n doc: \"Enter the project name\"\n\n ws.config.declare \"daemon_max_age\", \"string\",\n default: \"120\",\n doc: \"Enter events and pull requests max age\"\n end",
"def reference\n :config\n end",
"def reference\n :config\n end",
"def trigger\n @trigger ||= begin\n trg = schedule.split(\":\")\n raise \"ll-007: illegal schedule format '#{schedule}'\" unless trg.size == 2\n trg.map(&:strip).map(&:chomp)\n end\n end",
"def config\n self\n end",
"def sync_configuration\n end",
"def config_store; end",
"def parametrize #alias\n self.configuration\n end",
"def configured?; false; end",
"def trigger_definition(table_name, trigger_name, name = nil)\n raise \"Internal Error: Connection adapter did not override abstract function\"\n end",
"def config\n configuration\n end",
"def config=(value); end",
"def configure_backdat\n @commands = parse_options\n\n begin\n ::File.open(config[:config_file]) { |f| apply_config(f.path) }\n rescue Errno::ENOENT => error\n msg = \"Did not find the config file: #{config[:config_file]}\"\n msg << \", Using command line options.\"\n Backdat::Log.warn \"*****************************************\"\n Backdat::Log.warn msg\n Backdat::Log.warn \"*****************************************\"\n end\n end",
"def config(&blk)\n scope &blk\n self\n end",
"def trigger(key, &block)\n @hash[key.to_sym][:trigger] = block\n end",
"def configure(conf)\n super\n end",
"def setting; end",
"def configure_tasks\n end",
"def action_add\n notifying_block do\n create_config\n end\n end",
"def actual_config\n Config.instance\n end",
"def trigger\n\n return []\n end",
"def methods_repo_configuration\n ApplicationController.firecloud_client.get_configuration(self.configuration_namespace, self.configuration_name, self.configuration_snapshot, true)\n end",
"def triggerType _args\n \"triggerType _args;\" \n end",
"def build_config_audit(eh)\n if controller_name == \"ops\" && @sb[:active_tab] == \"settings_server\"\n server = MiqServer.find(@sb[:selected_server_id])\n message = \"Server [#{server.name}] (#{server.id}) in Zone [#{server.my_zone}] VMDB config updated\"\n else\n message = \"VMDB config updated\"\n end\n\n build_audit_payload(nil, eh[:new], eh[:current], \"vmdb_config_update\", message, \"\")\n end",
"def event_harvest_config\n @event_harvest_config ||= Configuration::EventHarvestConfig.from_config(Agent.config)\n end",
"def configure(conf)\n compat_parameters_convert(conf, :inject)\n super\n\n if @format == 'json'\n @format_proc = Proc.new{|tag, time, record| record.to_json}\n else\n @key_names = @key_names.split(/\\s*,\\s*/)\n @format_proc = Proc.new{|tag, time, record| @key_names.map{|k| record[k]}}\n end\n\n if @columns.nil? and @sql.nil?\n raise Fluent::ConfigError, \"columns or sql MUST be specified, but missing\"\n end\n if @columns and @sql\n raise Fluent::ConfigError, \"both of columns and sql are specified, but specify one of them\"\n end\n end",
"def supports_trigger_conditions?\n server_version >= 90000\n end",
"def handle_config\n @node.config\n end",
"def before_update(params_to_update=[])\n transport.command(\"enable\")\n transport.command(\"conf\", :prompt => /\\(conf\\)#\\s?\\z/n)\n end"
] | [
"0.6575454",
"0.65325505",
"0.6513116",
"0.6496943",
"0.64460677",
"0.6402255",
"0.6402255",
"0.6402255",
"0.6402255",
"0.6402255",
"0.63702446",
"0.63702446",
"0.63702446",
"0.63702446",
"0.63702446",
"0.63702446",
"0.63702446",
"0.63702446",
"0.63702446",
"0.63702446",
"0.63702446",
"0.63702446",
"0.63702446",
"0.63702446",
"0.63702446",
"0.63702446",
"0.63702446",
"0.63702446",
"0.6365584",
"0.62815225",
"0.6248768",
"0.6221433",
"0.612615",
"0.60914826",
"0.60914826",
"0.60914826",
"0.60914826",
"0.60914826",
"0.6088049",
"0.6056498",
"0.602948",
"0.60011256",
"0.5940631",
"0.5940631",
"0.5924524",
"0.5913904",
"0.59023803",
"0.5898353",
"0.58643043",
"0.58525574",
"0.5794589",
"0.5790947",
"0.5786942",
"0.5775235",
"0.5757923",
"0.5754052",
"0.5727449",
"0.5725427",
"0.57233226",
"0.57149905",
"0.57149905",
"0.57149905",
"0.57149905",
"0.5700361",
"0.5695122",
"0.56800944",
"0.5672694",
"0.56621873",
"0.56531143",
"0.56250757",
"0.56222206",
"0.5616536",
"0.5614117",
"0.56114155",
"0.56114155",
"0.56112707",
"0.56013495",
"0.55963194",
"0.5594161",
"0.55886525",
"0.5570502",
"0.5560977",
"0.55542016",
"0.5550216",
"0.5544165",
"0.55265146",
"0.55246365",
"0.5524054",
"0.55048996",
"0.55033",
"0.5487587",
"0.548438",
"0.5480766",
"0.5480357",
"0.54726005",
"0.5467636",
"0.5464464",
"0.5462012",
"0.5460263",
"0.5459844",
"0.54541683"
] | 0.0 | -1 |
GET /candidates GET /candidates.json | def index
@candidates = Candidate.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @candidates = Candidate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @candidates }\n end\n end",
"def index\n @candidates = Candidate.all.order(:id)\n #render json: @candidates\n end",
"def index\n if Candidate.count == 0\n source = 'https://geekhunter-recruiting.s3.amazonaws.com/code_challenge.json'\n resp = Net::HTTP.get_response(URI.parse(source))\n data = resp.body\n result = JSON.parse(data)\n result[\"candidates\"].each do |c|\n technologies = []\n c[\"technologies\"].each do |tech|\n technologies.push({ name: tech[\"name\"], is_main_tech: tech[\"is_main_tech\"] })\n end\n candidate = Candidate.new({ city: c[\"city\"], experience: c[\"experience\"], technologies: technologies })\n # if Candidate.find_by_cpf(c[\"cpf\"]).nil?\n # candidate.save\n # end\n candidate.save\n end\n end\n @candidates = Candidate.all\n end",
"def index\n @candidates = Candidate.where(user_id: current_user.id)\n end",
"def show\n @candidate = Candidate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @candidate }\n end\n end",
"def index\n @candidates = Candidate.limit(100)\n end",
"def index\n @candidates = Usernew.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usernew }\n end\n end",
"def show\n @candidate_app = CandidateApp.where(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @candidate_app }\n end\n end",
"def new\n @candidate = Candidate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @candidate }\n end\n end",
"def create\n @candidate = current_user.candidates.new(candidate_params)\n respond_to do |format|\n if @candidate.save\n format.html { redirect_to @candidate, notice: 'Candidate was successfully created.' }\n format.json { render :show, status: :created, location: @candidate }\n else\n format.html { render :new }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @group = @authorized_group\n @candidates = @group.candidates\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @candidates }\n end\n end",
"def index\n @candidate_details = CandidateDetail.all\n end",
"def index\n @candidatedetails = Candidatedetail.all\n end",
"def index\n # @candidates = Candidate.all\n @candidates = Position.find(params[:position_id]).candidates\n end",
"def index\n @candidates=Candidate.all.order(:id)\n end",
"def index\n @candidate_references = @candidate.references\n end",
"def new\n @candidate_app = CandidateApp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @candidate_app }\n end\n end",
"def index\n @votes = @proposal.votes\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end",
"def index\n @candidate_course_scores = @candidate.course_scores\n end",
"def index\n candidate = UspsInPersonProofing::Applicant.new(\n address: search_params['street_address'],\n city: search_params['city'], state: search_params['state'],\n zip_code: search_params['zip_code']\n )\n response = proofer.request_facilities(candidate)\n if response.length > 0\n analytics.idv_in_person_locations_searched(\n success: true,\n result_total: response.length,\n )\n else\n analytics.idv_in_person_locations_searched(\n success: false, errors: 'No USPS locations found',\n )\n end\n render json: response.to_json\n end",
"def index\n @election = Election.find(params[:election_id])\n @races = @election.races\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @races }\n end\n end",
"def friend_search()\n users = User.all.map {|u| u.email }.concat( Candidate.all.map {|u| u.email } )\n render :json => users\n end",
"def index\n @vote_candidates = VoteCandidate.all\n authorize VoteCandidate\n end",
"def get_candidate(username)\n candidate = @database.get_item(\n table_name: candidates_table_name,\n key: { \"username\" => username },\n consistent_read: true\n )[:item]\n\n candidate['votes'] = candidate['votes'].to_i if candidate\n candidate\n end",
"def create\n @result = Result.new()\n\n @result.ip_address = request.remote_ip\n\n unless params[:candidates_ids].nil?\n if params[:candidates_ids].count.eql?(NUMBER_OF_CANDIDATES)\n params[:candidates_ids].each do |candidate_id|\n @result.candidates << Candidate.find(candidate_id)\n end\n end\n end\n\n respond_to { |format|\n if params[:candidates_ids].nil? ? false : params[:candidates_ids].count.eql?(NUMBER_OF_CANDIDATES)\n if @result.save\n format.html { redirect_to(results_path, :notice => \"Thanks for your vote\") }\n format.xml { render :xml => @result, :status => :created, :location => @result }\n cookies[:vote] = {:value => 'sent', :expires => 3.days.from_now}\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @result.errors, :status => :unprocessable_entity }\n end\n else\n format.html {\n flash[:alert] = \"You should choose \" + NUMBER_OF_CANDIDATES.to_s + \" candidates\"\n redirect_to (new_result_path)\n }\n end }\n end",
"def create\n @candidate = Candidate.new(candidate_params)\n\n respond_to do |format|\n if @candidate.save\n @candidate.vacancies.each { |vacancy| CandidateMailer.thanks(@candidate, vacancy).deliver_now }\n format.json { render :show, status: :created, location: api_candidate_path(@candidate) }\n else\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_candidates\n\t$cand_table.each do |x|\n\t\tputs \"Give me a candidate name:\"\n\t\tx[0] = gets.chomp\n\tend\nend",
"def get_candidates(consistent_read)\n candidates = []\n params = {\n table_name: candidates_table_name,\n consistent_read: consistent_read\n }\n\n loop do\n result = @database.scan(params)\n\n # Convert votes to an integer and add the candidate to the candidates array.\n result.items.each do |candidate|\n candidate['votes'] = candidate['votes'].to_i\n candidate['contributions'] = candidate['contributions'].to_i\n candidates << candidate\n end\n\n break if result.last_evaluated_key.nil?\n\n params[:exclusive_start_key] = result.last_evaluated_key\n end\n\n candidates\n end",
"def set_candidate\n @candidate = Candidate.includes(:user, :resume).find(params[:id])\n end",
"def get_votes\n\t\t@voters.each{ |voter| @votes << voter.vote(@candidates) }\n\tend",
"def index\n @candidate_experiences = @candidate.experiences\n end",
"def create\n @candidate = Candidate.new(params[:candidate])\n\n respond_to do |format|\n if @candidate.save\n format.html { redirect_to @candidate, notice: 'Candidate was successfully created.' }\n format.json { render json: @candidate, status: :created, location: @candidate }\n else\n format.html { render action: \"new\" }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n case params[:eligible_for]\n when 'collaboration'\n @collaborators = eligible_collaborators.limit(20)\n when 'ownership'\n @collaborators = eligible_owners.limit(20)\n else\n @collaborators = User.none\n end\n\n if params[:q]\n @collaborators = @collaborators.search(params[:q])\n end\n\n respond_to do |format|\n format.json\n end\n end",
"def index\n @choices = Choice.all\n\n render json: @choices\n end",
"def find(id)\nraise \"candidates must be an Array\" if @candidates.nil?\n @candidates.each do |candidate|\n return candidate if candidate[:id] == id\n end\n nil\nend",
"def index\n @challenges = Challenge.user(current_user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challenges }\n end\n end",
"def map_current_candidates\n\t\tobj = Candidate.all\n\t\tobj.map { |i| {i.id => i.name} }\n\tend",
"def index\n @partners = Partner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @partners }\n end\n end",
"def create\n @candidate = Candidate.new(candidate_params)\n\n respond_to do |format|\n if @candidate.save\n format.html { redirect_to @candidate, notice: 'Candidate was successfully created.' }\n format.json { render :show, status: :created, location: @candidate }\n else\n format.html { render :new }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @candidate = Candidate.new(candidate_params)\n\n respond_to do |format|\n if @candidate.save\n format.html { redirect_to @candidate, notice: 'Candidate was successfully created.' }\n format.json { render :show, status: :created, location: @candidate }\n else\n format.html { render :new }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @candidate = Candidate.new(candidate_params)\n\n respond_to do |format|\n if @candidate.save\n format.html { redirect_to @candidate, notice: 'Candidate was successfully created.' }\n format.json { render :show, status: :created, location: @candidate }\n else\n format.html { render :new }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @candidate = Candidate.new(candidate_params)\n\n respond_to do |format|\n if @candidate.save\n format.html { redirect_to @candidate, notice: 'Candidate was successfully created.' }\n format.json { render :show, status: :created, location: @candidate }\n else\n format.html { render :new }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @candidate = Candidate.new(candidate_params)\n @candidate.user_id = current_user.id\n\n respond_to do |format|\n if @candidate.save\n flash[:notice] = 'Candidate was successfully created.'\n format.html { redirect_to home_candidate_path(@candidate) }\n format.json { render :show, status: :created, location: @candidate }\n else\n format.html { render :new }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def candidate\n @candidate\n end",
"def create\n @candidate = Candidate.new(candidate_params)\n\n respond_to do |format|\n if @candidate.save\n format.html { redirect_to @candidate, notice: \"Candidate was successfully created.\" }\n format.json { render :show, status: :created, location: @candidate }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def open_job_candidates\n authorize(JobCandidate.new)\n if active_job_candidate_list.present?\n @open_job_candidates = active_job_candidate_list.includes(:job)\n .where(\"job_candidates.status in (?)\",\n JobCandidate.statuses_opened)\n .page(params[:page])\n end\n end",
"def candidates\n players.map(&:candidate).compact\n end",
"def parse_to_candidate(resume_text)\n path = \"resume/parseToCandidateViaJson?format=text\"\n encodedResume = {\"resume\" => resume_text}.to_json\n res = conn.post path, encodedResume\n Hashie::Mash.new JSON.parse(res.body)\n end",
"def index\n @proposals = current_user.proposals\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proposals }\n end\n end",
"def candidate\n self['candidate']\n end",
"def index\n @challenges = Challenge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challenges }\n end\n end",
"def index\n \n @page = params[:page]\n\n @candidates = Candidate.page(@page)\n #@users = User.order(:name).page 3\n # @count = Voter.where(candidate_id => @can)\n\n @voter_all = Voter.all.count\n\n\n end",
"def candidate_details candidate_email, qr: false\n params = init_params\n params[:qr] = qr\n request_url = UrlGenerator.url_for(\"candidates\", candidate_email)\n asgn = SignatureGenerator.signature_for(http_verb: 'GET', url: request_url, params: params)\n\n res = self.get(request_url, query: params.merge!({asgn: asgn}))\n if res[\"status\"] == \"SUCCESS\"\n return res\n else\n return error_response_for(res)\n end\n end",
"def get_candidate_list\n raise NoMethodError, 'get_candidate_list should be defined in subclass of HillClimb'\n end",
"def max_candidates\n return @max_candidates\n end",
"def set_candidate\n @candidate = Role::Candidate.includes(:person).find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def candidate_sheet\n @candidate = Candidate.find(params[:id])\n @resource = @candidate\n end",
"def show\n @grades=@section.grades\n @candidates=Candidate.all\n @user = User.find(current_user.id)\n\n if current_user.admin?\n @candidates = @section.candidates\n else\n @candidates = @section.candidates.where(user_id: current_user.id)\n end\n end",
"def qualified_candidates(candidates)\n begin\n @candidates.select do |candidate|\n experienced?(candidate) &&\n enough_points?(candidate) &&\n proper_languages?(candidate) &&\n applied_recently?(candidate) &&\n old_enough?(candidate)\n end\n rescue CandidateError => ex\n puts \"There was an error in finding qualified candidates. The reason was #{ex.message}\"\n end\nend",
"def index\n @citations = Citation.all\n\n render json: @citations\n end",
"def find(id)\n raise '@candidates must be an array!' if @candidates.nil?\n candidate = @candidates.select { |candidate| candidate[:id] == id }\n\nend",
"def show\n @leader = Leader.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @leader }\n end\n end",
"def index\n @elections = Election.all\n end",
"def find(id)\n @candidates.find {|h| h[:id] == id}\nend",
"def create\n @candidate = Candidate.new(permitted_attributes Candidate.new)\n\n respond_to do |format|\n if @candidate.save\n format.html { redirect_to @candidate, notice: \"Candidate was successfully created.\" }\n format.json { render :show, status: :created, location: @candidate }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @proposals = Proposal.all\n\n render json: @proposals\n end",
"def show\n @compromise = Compromise.find(params[:id])\n\n render json: @compromise\n end",
"def show\n @compromise = Compromise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @compromise }\n end\n end",
"def index\n @challenges = Challenge.all\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render json: @challenges }\n end\n end",
"def index\n @proposals = listing.proposals\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proposals }\n end\n end",
"def create\n @candidate = Candidate.new(candidate_params)\n respond_to do |format|\n if @candidate.save\n format.html { redirect_to user_election_position_candidates_path, notice: 'Candidate was successfully created.' }\n format.json { render :show, status: :created, location: @candidate }\n else\n format.html { render :new }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_prefectures\n server_response = handle_timeouts do\n get '/1/neighborhoods.json?locale=en'\n end\n server_response['response']\n end",
"def withdrawn_job_candidates\n authorize(JobCandidate.new)\n if active_job_candidate_list.present?\n @withdrawn_job_candidates = active_job_candidate_list.includes(:job)\n .where(status: JobCandidate.statuses[\"withdrawn\"])\n .page(params[:page])\n end\n end",
"def print_candidates(candidates)\n puts \"----- Starting search -----\"\n if candidates.empty?\n puts \"Couldn't find candidate. Are you sure that's a proper ID integer?\"\n else\n begin\n candidates.each do |candidate|\n candidate.each do |key, value|\n string = @qualified_array.include?(candidate) ? \"#{key} : #{value}\".green : \"#{key} : #{value}\".red\n puts string\n end\n puts \"-----------\"\n end\n rescue\n puts \"There is an error in your database. Certain candidates do not exist.\"\n end\n end\nend",
"def available_collaborators\n input = available_collaborators_input\n return unauthorized unless available_collaborators_auth(input)\n student_id = current_visitor.portal_student.id\n clazz = Portal::Offering.find(input[:offering_id]).clazz\n collaborators = clazz.students.select { |s| s.id != student_id }.map { |s| {:id => s.id, :name => s.name} }\n render json: collaborators\n end",
"def set_candidates(pv)\n @candidates = pv\n @value = @initial_value\n end",
"def find(id)\n @candidates.select{|candidate| candidate[:id] === id }\n #return @candidates\n\nend",
"def find(id)\n # Your code Here\n @candidates.each do |candidate|\n if candidate[:id] == id\n return candidate\n end\n end\n nil\nend",
"def candidate_matches_list\n Candidate.includes(:candidate_profile).where('candidates.archetype_score >= ?\n and candidates.archetype_score <= ?',\n self.archetype_low,\n self.archetype_high)\n .joins(:candidate_profile)\n .where('candidate_profiles.is_incognito=false')\n .order(id: :asc)\n end",
"def index\n @collaborators = User\n .includes(:chef_account)\n .where.not(id: params[:ineligible_user_ids])\n .limit(20)\n\n if params[:q]\n @collaborators = @collaborators.search(params[:q])\n end\n\n respond_to do |format|\n format.json\n end\n end",
"def index\n @clues = Clue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clues }\n end\n end",
"def index\n @challenges = Challenge.order(:id)\n .includes(:user)\n .page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challenges }\n end\n end",
"def validate_candidates(candidates)\n uniq_candidates = []\n candidates.each do |candidate|\n if (uid_exists?(\"candidate\", canid = candidate[\"ident\"].to_s))\n if (uniq_candidates.include?(candidate))\n val_warn(\"Duplicate Candidate Declaration\", canid, \"in Election Definition\")\n else\n val_err(\"Non-Unique Candidate UID\", canid, \"in Election Definition\")\n end\n else\n uniq_candidates.push(candidate)\n uid_add(\"candidate\", canid)\n end\n end\n candidates.each do |candidate|\n canid = candidate[\"ident\"].to_s\n conid = candidate[\"contest_ident\"].to_s\n if (uid_exists?(\"contest\", conid))\n self.counts_contests[conid][\"candidate_count_list\"].\n push({\"candidate_ident\"=>canid, \"count\"=>0})\n else \n val_err(\"Non-Existent Contest UID\", conid, \"for Candidate UID\", canid, \"in Election Definition\")\n end\n end\n end",
"def index\n @people = search Person.involved_in(@conference)\n\n respond_to do |format|\n format.html { @people = @people.paginate page: page_param }\n format.json\n end\n end",
"def find(id)\n raise '@candidates must be an array' if @candidates.nil?\n @candidates.detect {|candidate| candidate[:id] == id}\n\nend",
"def candidate\n candidates.first\n end",
"def find(id)\n # binding.pry\n raise '@candidates must be an Array' if @candidates.nil?\n candidate.each do |candidate|\n if candidate[:id] == id\n return candidate\n else\n nil\n end \n end \nend",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end"
] | [
"0.7828381",
"0.73522097",
"0.72219783",
"0.6928002",
"0.6899774",
"0.6775134",
"0.67688996",
"0.6342606",
"0.6194655",
"0.6079805",
"0.6058217",
"0.60146403",
"0.596775",
"0.5949632",
"0.5942194",
"0.59386665",
"0.5871397",
"0.58210623",
"0.5799082",
"0.57743657",
"0.57622945",
"0.57514733",
"0.56375146",
"0.5632453",
"0.5604177",
"0.55864686",
"0.55673444",
"0.55637956",
"0.5554515",
"0.55472285",
"0.55420184",
"0.5533445",
"0.5525548",
"0.5514009",
"0.55139095",
"0.5506843",
"0.55026436",
"0.55004233",
"0.54912883",
"0.54912883",
"0.54912883",
"0.54912883",
"0.54869276",
"0.5450752",
"0.5450076",
"0.54493606",
"0.5443225",
"0.54279304",
"0.5404538",
"0.54033834",
"0.53980786",
"0.53975403",
"0.53958035",
"0.5391857",
"0.53909457",
"0.53814286",
"0.537766",
"0.537766",
"0.5376075",
"0.5369325",
"0.5365402",
"0.5362923",
"0.53553605",
"0.535234",
"0.53487885",
"0.5346243",
"0.5340467",
"0.53278494",
"0.532728",
"0.53255934",
"0.5322779",
"0.5315783",
"0.5314964",
"0.5310257",
"0.5309812",
"0.5308351",
"0.5303099",
"0.5301258",
"0.52998286",
"0.5294884",
"0.5286069",
"0.5282022",
"0.5263667",
"0.52589417",
"0.5258092",
"0.52521974",
"0.5251969",
"0.5249487",
"0.5247106",
"0.52466",
"0.52466",
"0.52466",
"0.52466",
"0.52466",
"0.52466",
"0.52466"
] | 0.73016286 | 5 |
GET /candidates/1 GET /candidates/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @candidates = Candidate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @candidates }\n end\n end",
"def index\n @candidates = Candidate.all.order(:id)\n #render json: @candidates\n end",
"def show\n @candidate = Candidate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @candidate }\n end\n end",
"def index\n if Candidate.count == 0\n source = 'https://geekhunter-recruiting.s3.amazonaws.com/code_challenge.json'\n resp = Net::HTTP.get_response(URI.parse(source))\n data = resp.body\n result = JSON.parse(data)\n result[\"candidates\"].each do |c|\n technologies = []\n c[\"technologies\"].each do |tech|\n technologies.push({ name: tech[\"name\"], is_main_tech: tech[\"is_main_tech\"] })\n end\n candidate = Candidate.new({ city: c[\"city\"], experience: c[\"experience\"], technologies: technologies })\n # if Candidate.find_by_cpf(c[\"cpf\"]).nil?\n # candidate.save\n # end\n candidate.save\n end\n end\n @candidates = Candidate.all\n end",
"def index\n @candidates = Candidate.all\n end",
"def index\n @candidates = Candidate.all\n end",
"def index\n @candidates = Candidate.all\n end",
"def index\n @candidates = Candidate.all\n end",
"def index\n @candidates = Candidate.all\n end",
"def index\n @candidates = Candidate.where(user_id: current_user.id)\n end",
"def index\n @candidates = Usernew.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usernew }\n end\n end",
"def index\n @candidates = Candidate.limit(100)\n end",
"def show\n @candidate_app = CandidateApp.where(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @candidate_app }\n end\n end",
"def new\n @candidate = Candidate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @candidate }\n end\n end",
"def create\n @candidate = current_user.candidates.new(candidate_params)\n respond_to do |format|\n if @candidate.save\n format.html { redirect_to @candidate, notice: 'Candidate was successfully created.' }\n format.json { render :show, status: :created, location: @candidate }\n else\n format.html { render :new }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def candidate\n candidates.first\n end",
"def index\n @candidate_details = CandidateDetail.all\n end",
"def new\n @candidate_app = CandidateApp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @candidate_app }\n end\n end",
"def index\n @candidates=Candidate.all.order(:id)\n end",
"def get_candidate(username)\n candidate = @database.get_item(\n table_name: candidates_table_name,\n key: { \"username\" => username },\n consistent_read: true\n )[:item]\n\n candidate['votes'] = candidate['votes'].to_i if candidate\n candidate\n end",
"def index\n @candidatedetails = Candidatedetail.all\n end",
"def index\n @group = @authorized_group\n @candidates = @group.candidates\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @candidates }\n end\n end",
"def set_candidate\n @candidate = Candidate.includes(:user, :resume).find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def index\n @votes = @proposal.votes\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end",
"def index\n # @candidates = Candidate.all\n @candidates = Position.find(params[:position_id]).candidates\n end",
"def index\n @candidate_references = @candidate.references\n end",
"def find(id)\nraise \"candidates must be an Array\" if @candidates.nil?\n @candidates.each do |candidate|\n return candidate if candidate[:id] == id\n end\n nil\nend",
"def candidate\n @candidate\n end",
"def candidate\n self['candidate']\n end",
"def create\n @result = Result.new()\n\n @result.ip_address = request.remote_ip\n\n unless params[:candidates_ids].nil?\n if params[:candidates_ids].count.eql?(NUMBER_OF_CANDIDATES)\n params[:candidates_ids].each do |candidate_id|\n @result.candidates << Candidate.find(candidate_id)\n end\n end\n end\n\n respond_to { |format|\n if params[:candidates_ids].nil? ? false : params[:candidates_ids].count.eql?(NUMBER_OF_CANDIDATES)\n if @result.save\n format.html { redirect_to(results_path, :notice => \"Thanks for your vote\") }\n format.xml { render :xml => @result, :status => :created, :location => @result }\n cookies[:vote] = {:value => 'sent', :expires => 3.days.from_now}\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @result.errors, :status => :unprocessable_entity }\n end\n else\n format.html {\n flash[:alert] = \"You should choose \" + NUMBER_OF_CANDIDATES.to_s + \" candidates\"\n redirect_to (new_result_path)\n }\n end }\n end",
"def create\n @candidate = Candidate.new(params[:candidate])\n\n respond_to do |format|\n if @candidate.save\n format.html { redirect_to @candidate, notice: 'Candidate was successfully created.' }\n format.json { render json: @candidate, status: :created, location: @candidate }\n else\n format.html { render action: \"new\" }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_candidate\n @candidate = Role::Candidate.includes(:person).find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def find(id)\n # Your code Here\n @candidates.each do |candidate|\n if candidate[:id] == id\n return candidate\n end\n end\n nil\nend",
"def find(id)\n @candidates.find {|h| h[:id] == id}\nend",
"def show\n @leader = Leader.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @leader }\n end\n end",
"def create\n @candidate = Candidate.new(candidate_params)\n @candidate.user_id = current_user.id\n\n respond_to do |format|\n if @candidate.save\n flash[:notice] = 'Candidate was successfully created.'\n format.html { redirect_to home_candidate_path(@candidate) }\n format.json { render :show, status: :created, location: @candidate }\n else\n format.html { render :new }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @candidate_course_scores = @candidate.course_scores\n end",
"def create\n @candidate = Candidate.new(candidate_params)\n\n respond_to do |format|\n if @candidate.save\n format.html { redirect_to @candidate, notice: 'Candidate was successfully created.' }\n format.json { render :show, status: :created, location: @candidate }\n else\n format.html { render :new }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @candidate = Candidate.new(candidate_params)\n\n respond_to do |format|\n if @candidate.save\n format.html { redirect_to @candidate, notice: 'Candidate was successfully created.' }\n format.json { render :show, status: :created, location: @candidate }\n else\n format.html { render :new }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @candidate = Candidate.new(candidate_params)\n\n respond_to do |format|\n if @candidate.save\n format.html { redirect_to @candidate, notice: 'Candidate was successfully created.' }\n format.json { render :show, status: :created, location: @candidate }\n else\n format.html { render :new }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @candidate = Candidate.new(candidate_params)\n\n respond_to do |format|\n if @candidate.save\n format.html { redirect_to @candidate, notice: 'Candidate was successfully created.' }\n format.json { render :show, status: :created, location: @candidate }\n else\n format.html { render :new }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @election = Election.find(params[:election_id])\n @races = @election.races\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @races }\n end\n end",
"def find(id)\n # Your code Here\n @candidates.each do |candidate|\n if id == candidate[:id]\n return candidate\n end\n end\n\n nil\nend",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n \t@election = Candidate.find(params[:id])\n end",
"def find(id)\n # binding.pry\n raise '@candidates must be an Array' if @candidates.nil?\n candidate.each do |candidate|\n if candidate[:id] == id\n return candidate\n else\n nil\n end \n end \nend",
"def create\n @candidate = Candidate.new(candidate_params)\n\n respond_to do |format|\n if @candidate.save\n @candidate.vacancies.each { |vacancy| CandidateMailer.thanks(@candidate, vacancy).deliver_now }\n format.json { render :show, status: :created, location: api_candidate_path(@candidate) }\n else\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @candidate = Candidate.new(candidate_params)\n\n respond_to do |format|\n if @candidate.save\n format.html { redirect_to @candidate, notice: \"Candidate was successfully created.\" }\n format.json { render :show, status: :created, location: @candidate }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_candidates\n\t$cand_table.each do |x|\n\t\tputs \"Give me a candidate name:\"\n\t\tx[0] = gets.chomp\n\tend\nend",
"def christian_ministry\n @candidate = Candidate.find(params[:id])\n @resource = @candidate\n end",
"def show\n @compromise = Compromise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @compromise }\n end\n end",
"def show\n @compromise = Compromise.find(params[:id])\n\n render json: @compromise\n end",
"def candidate_sheet\n @candidate = Candidate.find(params[:id])\n @resource = @candidate\n end",
"def find(id)\n # Your code Here\n @candidates.each do |candidate|\n \tif candidate[:id] == id\n \t return candidate\n \tend\n end\n return nil\nend",
"def find(id)\n raise '@candidates must be an array!' if @candidates.nil?\n candidate = @candidates.select { |candidate| candidate[:id] == id }\n\nend",
"def find(id)\n\traise '@candidates must be an Array' if @candidates.nil?\n\t@candidates.each do |x|\n\t\tif x[:id] == id\n\t\t\treturn x\n\t\tend\n\tend\n\tputs \"Candidate not found\"\n\tnil\nend",
"def find(id)\n @candidates.each do | candidate |\n if candidate[:id] == id\n return candidate \n end\n end\nend",
"def index\n candidate = UspsInPersonProofing::Applicant.new(\n address: search_params['street_address'],\n city: search_params['city'], state: search_params['state'],\n zip_code: search_params['zip_code']\n )\n response = proofer.request_facilities(candidate)\n if response.length > 0\n analytics.idv_in_person_locations_searched(\n success: true,\n result_total: response.length,\n )\n else\n analytics.idv_in_person_locations_searched(\n success: false, errors: 'No USPS locations found',\n )\n end\n render json: response.to_json\n end",
"def find(id)\n # takes single candidate as id :\n @candidates.each do | candidate |\n if candidate[:id] == id \n\n return candidate\n else \n nil\n end\n end\nend",
"def find(id)\n puts id\n @candidates.each do |candidate|\n if candidate[:id] == id \n return candidate\n end\n end\n puts \"No candidate found with that ID\"\n return nil\nend",
"def show\n @collaborator = Collaborator.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @collaborator }\n end\n end",
"def find(id)\n @candidates.each do |candidate|\n if id == candidate[:id]\n candidate\n end\n end\n nil\nend",
"def create\n @candidate = Candidate.new(candidate_params)\n respond_to do |format|\n if @candidate.save\n format.html { redirect_to user_election_position_candidates_path, notice: 'Candidate was successfully created.' }\n format.json { render :show, status: :created, location: @candidate }\n else\n format.html { render :new }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def find(id)\n raise '@candidates must be an array' if @candidates.nil?\n @candidates.detect {|candidate| candidate[:id] == id}\n\nend",
"def find(id)\n raise '@candidates must be an Array' if @candidates.nil?\n @candidates.detect {|candidate| candidate[:id] == id}\nend",
"def set_candidate_detail\n @candidate_detail = CandidateDetail.find(params[:id])\n end",
"def set_candidatedetail\n @candidatedetail = Candidatedetail.find(params[:id])\n end",
"def find(id)\n @candidates.each do |candidate|\n return candidate if candidate[:id]==id\n end\n nil\nend",
"def create\n @candidate = Candidate.new(permitted_attributes Candidate.new)\n\n respond_to do |format|\n if @candidate.save\n format.html { redirect_to @candidate, notice: \"Candidate was successfully created.\" }\n format.json { render :show, status: :created, location: @candidate }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @vote_candidates = VoteCandidate.all\n authorize VoteCandidate\n end",
"def show\n @proposal = Proposal.find(params[:id])\n\n @proposal.votes.each do |v|\n if v.user == current_user\n @vote = v\n end\n end\n if can? :vote, @proposal\n if @vote.nil?\n @vote = @proposal.votes.new\n end\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @proposal }\n end\n end",
"def show\n @election_type = ElectionType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @election_type }\n end\n end",
"def find(id)\n @candidates.select{|candidate| candidate[:id] === id }\n #return @candidates\n\nend",
"def show\n @candidate_revision = CandidateRevision.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @candidate_revision }\n end\n end",
"def find(id)\n @candidates.each do |candidate|\n if id == candidate[:id] \n return candidate\n end\nend\n\n nil\nend",
"def destroy\n @candidate = Candidate.find(params[:id])\n @candidate.destroy\n\n respond_to do |format|\n format.html { redirect_to candidates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @candidate = Candidate.find(params[:id])\n @candidate.destroy\n\n respond_to do |format|\n format.html { redirect_to candidates_url }\n format.json { head :no_content }\n end\n end",
"def set_candidate\n @candidate = Candidate.find(params[:candidate_id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:candidate_id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:candidate_id])\n end",
"def find(id)\n @candidates.each do |candidate|\n return candidate if id == candidate[:id]\n end\n nil\nend",
"def parse_to_candidate(resume_text)\n path = \"resume/parseToCandidateViaJson?format=text\"\n encodedResume = {\"resume\" => resume_text}.to_json\n res = conn.post path, encodedResume\n Hashie::Mash.new JSON.parse(res.body)\n end",
"def index\n @candidate_experiences = @candidate.experiences\n end",
"def find(id)\n # Your code Here\n # puts \"you are looking for id: #{id}\"\n @candidates.each do |candidate|\n if candidate[:id] == id\n return candidate\n end\n end\n return nil\nend",
"def find(id)\n @candidates.each do |candidate|\n return candidate if candidate[:id] == id\n end\n return nil\nend",
"def set_candidate\n @candidate = params[:id] ? Candidate.find(params[:id]) : Candidate.new(candidate_params)\n end",
"def index\n @challenges = Challenge.user(current_user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challenges }\n end\n end"
] | [
"0.7576062",
"0.719828",
"0.71253955",
"0.71249306",
"0.7115344",
"0.7115344",
"0.7115344",
"0.7115344",
"0.7115344",
"0.674099",
"0.66213965",
"0.6574931",
"0.64875436",
"0.64646935",
"0.61951876",
"0.60203767",
"0.60195625",
"0.601726",
"0.597598",
"0.5966151",
"0.5957981",
"0.59057134",
"0.5888962",
"0.5872949",
"0.5872949",
"0.5871664",
"0.58550066",
"0.58291864",
"0.5802034",
"0.57788444",
"0.57753307",
"0.574274",
"0.5740406",
"0.57202876",
"0.5716884",
"0.5716884",
"0.5716884",
"0.5716884",
"0.5716884",
"0.5716884",
"0.5716884",
"0.5716884",
"0.5716884",
"0.5716884",
"0.5716884",
"0.5716884",
"0.57168067",
"0.5691619",
"0.5691062",
"0.5682975",
"0.5677133",
"0.5674125",
"0.5674125",
"0.5674125",
"0.5674125",
"0.5659494",
"0.5659045",
"0.5654043",
"0.5653378",
"0.56428164",
"0.5640857",
"0.5629934",
"0.5610297",
"0.56023365",
"0.5596037",
"0.5586712",
"0.55819786",
"0.557528",
"0.5563801",
"0.5553614",
"0.5531334",
"0.55279124",
"0.55247176",
"0.5517982",
"0.5509199",
"0.5502619",
"0.55022657",
"0.54815125",
"0.5478599",
"0.54778266",
"0.5470946",
"0.5467161",
"0.54659164",
"0.54591763",
"0.5452584",
"0.54521155",
"0.5447546",
"0.5442897",
"0.54399157",
"0.54374355",
"0.54374355",
"0.54362386",
"0.54362386",
"0.54362386",
"0.5428082",
"0.54231685",
"0.5418373",
"0.5415696",
"0.540279",
"0.5400775",
"0.5400075"
] | 0.0 | -1 |
POST /candidates POST /candidates.json | def create
@candidate = Candidate.new(candidate_params)
@candidate.user_id = current_user.id
respond_to do |format|
if @candidate.save
flash[:notice] = 'Candidate was successfully created.'
format.html { redirect_to home_candidate_path(@candidate) }
format.json { render :show, status: :created, location: @candidate }
else
format.html { render :new }
format.json { render json: @candidate.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @candidate = current_user.candidates.new(candidate_params)\n respond_to do |format|\n if @candidate.save\n format.html { redirect_to @candidate, notice: 'Candidate was successfully created.' }\n format.json { render :show, status: :created, location: @candidate }\n else\n format.html { render :new }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @candidate = Candidate.new(params[:candidate])\n\n respond_to do |format|\n if @candidate.save\n format.html { redirect_to @candidate, notice: 'Candidate was successfully created.' }\n format.json { render json: @candidate, status: :created, location: @candidate }\n else\n format.html { render action: \"new\" }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @candidate = Candidate.new(candidate_params)\n\n respond_to do |format|\n if @candidate.save\n @candidate.vacancies.each { |vacancy| CandidateMailer.thanks(@candidate, vacancy).deliver_now }\n format.json { render :show, status: :created, location: api_candidate_path(@candidate) }\n else\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @candidate = Candidate.new(candidate_params)\n\n respond_to do |format|\n if @candidate.save\n format.html { redirect_to @candidate, notice: 'Candidate was successfully created.' }\n format.json { render :show, status: :created, location: @candidate }\n else\n format.html { render :new }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @candidate = Candidate.new(candidate_params)\n\n respond_to do |format|\n if @candidate.save\n format.html { redirect_to @candidate, notice: 'Candidate was successfully created.' }\n format.json { render :show, status: :created, location: @candidate }\n else\n format.html { render :new }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @candidate = Candidate.new(candidate_params)\n\n respond_to do |format|\n if @candidate.save\n format.html { redirect_to @candidate, notice: 'Candidate was successfully created.' }\n format.json { render :show, status: :created, location: @candidate }\n else\n format.html { render :new }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @candidate = Candidate.new(candidate_params)\n\n respond_to do |format|\n if @candidate.save\n format.html { redirect_to @candidate, notice: 'Candidate was successfully created.' }\n format.json { render :show, status: :created, location: @candidate }\n else\n format.html { render :new }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @candidate = Candidate.new(candidate_params)\n\n respond_to do |format|\n if @candidate.save\n format.html { redirect_to @candidate, notice: \"Candidate was successfully created.\" }\n format.json { render :show, status: :created, location: @candidate }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @candidate = Candidate.new(permitted_attributes Candidate.new)\n\n respond_to do |format|\n if @candidate.save\n format.html { redirect_to @candidate, notice: \"Candidate was successfully created.\" }\n format.json { render :show, status: :created, location: @candidate }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n if Candidate.count == 0\n source = 'https://geekhunter-recruiting.s3.amazonaws.com/code_challenge.json'\n resp = Net::HTTP.get_response(URI.parse(source))\n data = resp.body\n result = JSON.parse(data)\n result[\"candidates\"].each do |c|\n technologies = []\n c[\"technologies\"].each do |tech|\n technologies.push({ name: tech[\"name\"], is_main_tech: tech[\"is_main_tech\"] })\n end\n candidate = Candidate.new({ city: c[\"city\"], experience: c[\"experience\"], technologies: technologies })\n # if Candidate.find_by_cpf(c[\"cpf\"]).nil?\n # candidate.save\n # end\n candidate.save\n end\n end\n @candidates = Candidate.all\n end",
"def create\n @candidate = Candidate.new(candidate_params)\n respond_to do |format|\n if @candidate.save\n format.html { redirect_to user_election_position_candidates_path, notice: 'Candidate was successfully created.' }\n format.json { render :show, status: :created, location: @candidate }\n else\n format.html { render :new }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @result = Result.new()\n\n @result.ip_address = request.remote_ip\n\n unless params[:candidates_ids].nil?\n if params[:candidates_ids].count.eql?(NUMBER_OF_CANDIDATES)\n params[:candidates_ids].each do |candidate_id|\n @result.candidates << Candidate.find(candidate_id)\n end\n end\n end\n\n respond_to { |format|\n if params[:candidates_ids].nil? ? false : params[:candidates_ids].count.eql?(NUMBER_OF_CANDIDATES)\n if @result.save\n format.html { redirect_to(results_path, :notice => \"Thanks for your vote\") }\n format.xml { render :xml => @result, :status => :created, :location => @result }\n cookies[:vote] = {:value => 'sent', :expires => 3.days.from_now}\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @result.errors, :status => :unprocessable_entity }\n end\n else\n format.html {\n flash[:alert] = \"You should choose \" + NUMBER_OF_CANDIDATES.to_s + \" candidates\"\n redirect_to (new_result_path)\n }\n end }\n end",
"def index\n @candidates = Candidate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @candidates }\n end\n end",
"def create\n @candidate = Candidate.new(candidate_params)\n\n unless check_elector\n return\n end\n\n respond_to do |format|\n if @candidate.save\n format.html { redirect_to @candidate, notice: 'Candidate was successfully created.' }\n format.json { render :show, status: :created, location: @candidate }\n else\n format.html { render :new }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @candidate = Candidate.new(candidate_params)\n\n respond_to do |format|\n if @candidate.save\n format.html { redirect_to @candidate, notice: 'Your profile was successfully created.' }\n format.json { render :show, status: :created, location: @candidate }\n else\n format.html { render :new }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n #redirect_to new_candidate_path, notice: 'Candidate was successfully created.'\n end",
"def create\n @candidate = Candidate.new(params[:candidate])\n\n if @candidate.save\n redirect_to admin_candidates_path, notice: 'Candidate was successfully created.'\n else\n render action: \"new\"\n end\n end",
"def new\n @candidate = Candidate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @candidate }\n end\n end",
"def index\n @candidates = Usernew.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usernew }\n end\n end",
"def create\n @candidate = Candidate.new(candidate_params)\n\n respond_to do |format|\n if @candidate.save\n set_questionnaire\n format.html { render partial: 'show', status: :created, locals: { candidate: @candidate } }\n else\n format.html { redirect_to candidates_url, alert: @candidate.errors.full_messages.first }\n end\n end\n end",
"def create\n @candidate = Candidate.new(params[:candidate])\n respond_to do |format|\n if @candidate.save\n session[:candidate_id]=@candidate.id\n TestQuestion.generate_candidate_questions(@candidate.id,session[:test_id])\n Result.generate_result(@candidate.id,session[:test_id])\n flash[:notice]='Successfully entered the Test!'\n format.html { redirect_to instructions_path }\n else\n format.html { render action: \"new\" }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @candidates = Candidate.all\n end",
"def index\n @candidates = Candidate.all\n end",
"def index\n @candidates = Candidate.all\n end",
"def index\n @candidates = Candidate.all\n end",
"def index\n @candidates = Candidate.all\n end",
"def index\n @candidates = Candidate.all.order(:id)\n #render json: @candidates\n end",
"def create\n @vote_candidate = VoteCandidate.new(vote_candidate_params)\n authorize @vote_candidate\n\n respond_to do |format|\n if @vote_candidate.save\n format.html { redirect_to @vote_candidate, notice: 'Vote candidate was successfully created.' }\n format.json { render :show, status: :created, location: @vote_candidate }\n else\n format.html { render :new }\n format.json { render json: @vote_candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @candidatedetail = Candidatedetail.new(candidatedetail_params)\n\n respond_to do |format|\n if @candidatedetail.save\n format.html { redirect_to candidateentry_url, notice: 'Candidatedetail was successfully created.' }\n format.json { render :show, status: :created, location: @candidatedetail }\n else\n format.html { render :new }\n format.json { render json: @candidatedetail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def candidate_params\n params.require(:candidate)\n .permit(%i(first_name last_name gender date_of_birth place_of_birth\n date notes education_subject year police_certificate internships cancel_date\n internships_proved education_contract_sent education_contract_received\n internship_contract_sent internship_contract_received cancel_reason status\n debit_mandate contract_notes career_changer rank) +\n [\n address: %i(street zip city),\n contact: %i(email phone mobile),\n school_graduate: %i(graduate proved),\n profession_graduate: %i(graduate proved comments),\n interview: %i(date time place comments invited answer result reason),\n ])\n end",
"def candidate_params\n params.fetch(:candidate, {}).permit(:name, :biography, :position_id, :id)\n\n end",
"def candidate_params\n params.require(:candidate).permit(:name, :email)\n end",
"def create\n @group = Group.find(params[:group_id])\n @candidate = @group.candidates.build(params[:candidate])\n if @candidate.save\n redirect_to group_candidates_url(@group)\n else\n render :action => \"new\"\n end\n end",
"def create\n @candidate_reference = @candidate.references.build(candidate_reference_params)\n\n respond_to do |format|\n if @candidate_reference.save\n flash[:success] = 'Reference was successfully created.' \n format.html { redirect_to edit_candidate_references_path(params[:candidate_id])}\n format.json { render :show, status: :created, location: @candidate_reference }\n else\n flash[:failure] = 'Reference creation unsuccessful.' \n format.html { redirect_to edit_candidate_references_path(params[:candidate_id]) }\n format.json { render json: @candidate_reference.errors, status: :unprocessable_entity }\n end\n end\n end",
"def candidate_params\n params.require(:candidate).permit(:name, :avatar)\n end",
"def create\n @candidate_detail = @candidate.candidate_details.new(candidate_detail_params)\n\n respond_to do |format|\n if @candidate_detail.save\n format.html { redirect_to candidate_candidate_detail_path(@candidate,@candidate_detail), notice: 'Candidate detail was successfully created.' }\n format.json { render :show, status: :created, location: @candidate_detail }\n else\n format.html { render :new }\n format.json { render json: @candidate_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n $SEARCHES.push({\n \"query\" => params[:query],\n \"candidate_ids\" => nil,\n \"search_status\" => \"In progress\",\n \"get_candidate_status\" => \"Not Started\",\n \"candidate_details\" => nil\n })\n\n # We build our query using the Connect find_candidates schema.\n # We can stack as many filters as we like here, but for this example we\n # only show filtering by email address.\n query = JSON.generate(\n {'filters': [{'field': 'email', 'operator': '==', 'value': params[:query]}]}\n )\n \n # We can choose to either include a callback header with our\n # request, or to poll until the search is complete. Here\n # we use the callback functionality.\n uri = URI.parse(\"%s/v1/%s/find_candidates\" % [\n Rails.application.config.connect_url,\n Rails.application.config.connector['connector_id']\n ])\n\n search_id = $SEARCHES.length - 1\n callback_url = Rails.application.routes.url_for(\n controller: 'search_complete_callback', action: 'create', id: search_id)\n\n resp = ConnectHelper.request_to_connect(\n uri, Net::HTTP::Post, callback_url: callback_url, request_body: query)\n\n redirect_to '/'\n end",
"def candidate_params\n params.require(:candidate).permit(:name, :date_submitted)\n end",
"def validate_candidates(candidates)\n uniq_candidates = []\n candidates.each do |candidate|\n if (uid_exists?(\"candidate\", canid = candidate[\"ident\"].to_s))\n if (uniq_candidates.include?(candidate))\n val_warn(\"Duplicate Candidate Declaration\", canid, \"in Election Definition\")\n else\n val_err(\"Non-Unique Candidate UID\", canid, \"in Election Definition\")\n end\n else\n uniq_candidates.push(candidate)\n uid_add(\"candidate\", canid)\n end\n end\n candidates.each do |candidate|\n canid = candidate[\"ident\"].to_s\n conid = candidate[\"contest_ident\"].to_s\n if (uid_exists?(\"contest\", conid))\n self.counts_contests[conid][\"candidate_count_list\"].\n push({\"candidate_ident\"=>canid, \"count\"=>0})\n else \n val_err(\"Non-Existent Contest UID\", conid, \"for Candidate UID\", canid, \"in Election Definition\")\n end\n end\n end",
"def create\n @election = Election.new(election_params)\n\n respond_to do |format|\n if @election.save\n format.html { redirect_to @election, notice: \"Election was successfully created.\" }\n format.json { render :show, status: :created, location: @election }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @election.errors, status: :unprocessable_entity }\n end\n end\n end",
"def candidate_params\n params.require(:candidate).permit( :name , :bios , :url_image , :category_id , :selection_process_id , :avatar_file )\n end",
"def vote_candidate_params\n params.require(:vote_candidate).permit(:candidate_id, :vote_id)\n end",
"def candidate_params\n params.require(:candidate).permit(:city, :experience)\n end",
"def create\n @candidate = Candidate.new(candidate_params)\n user_session[:category_id] = @candidate.category_id\n respond_to do |format|\n if @candidate.save\n format.html { redirect_to @candidate , notice: 'Candidato creado correctamente.' }\n format.json { render 'show', status: :created , location: @candidate }\n else\n format.html { render 'new' }\n format.json { render json: @candidate.errors , status: :unprocessable_entity }\n end\n end\n end",
"def new\n @candidate_app = CandidateApp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @candidate_app }\n end\n end",
"def candidate_params\n params.require(:candidate).permit(:first_name, :last_name, :preferred_name, :email_address, :phone_number)\n end",
"def create\n @election = Election.new(election_params)\n\n respond_to do |format|\n if @election.save\n format.html { redirect_to @election, notice: 'Election was successfully created.' }\n format.json { render :show, status: :created, location: @election }\n else\n format.html { render :new }\n format.json { render json: @election.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @election = Election.new(election_params)\n\n respond_to do |format|\n if @election.save\n format.html { redirect_to @election, notice: 'Election was successfully created.' }\n format.json { render :show, status: :created, location: @election }\n else\n format.html { render :new }\n format.json { render json: @election.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_candidate_set(name,candidates)\n result = @candidate_set_factory.new\n result.add(name,candidates) unless candidates.empty?\n result\n end",
"def candidate_params\n params.require(:candidate).permit(:name, :plan, :loaction, :image)\n end",
"def create_candidate_set(name,candidates)\n result = @candidate_set_factory.new\n result.add(name,candidates) unless candidates.empty?\n result\n end",
"def candidate_params\n params.require(:candidate).permit(:name, :published, :description, :constituency, \n :avatar, :avatar_cache, :remove_avatar,\n :image, :image_cache, :remove_image, \n :help_image, :help_image_cache, :remove_help_image,\n :donate_image, :donate_image_cache, :remove_donate_image,\n :fb_link, :help_link, :donate_form, :job, :education, :experience,\n :year, :kind, :in_campaign)\n end",
"def candidate_params\n params.require(:candidate).permit(:area_id, :party_list_id, :name, :image, :district_list_id, :desc, :avatar, :x1, :x2, :x3, :x4, :x5, :x6, :x7, :x8, :x9, :x10, :x11, :x12, :x13, :x14, :x15,:cm_candidate)\n end",
"def candidate_params\n params.require(:candidate).permit(:genre, :legal_name, :avatar, :mailing_address, :country, :avatar_id, :postal_code, :cell_phone, :email, :date_of_grade, :university, :programs, :certifications, :degree, :languages, :salary_expectation, :area_of_interest, :job_type, :additional_information, :professional_presentation, :work_experience, :professional_reference, :personal_reference, :skills, :hobbies, :extracurricular_activities, :linkedin, :internships, :behavioral_assessment_id, :arrow_id)\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find_by id: params[:id]\n authorize @candidate\n end",
"def parse_to_candidate(resume_text)\n path = \"resume/parseToCandidateViaJson?format=text\"\n encodedResume = {\"resume\" => resume_text}.to_json\n res = conn.post path, encodedResume\n Hashie::Mash.new JSON.parse(res.body)\n end",
"def candidate_params\n \tparams.require(:candidate).permit(:first_name, :last_name, :party_id, :profile, parties_attributes: [:name])\n end",
"def candidate_params\n params.require(:candidate).permit(:user_id, :first_name, :last_name, :email, :phone, :desired_position, :current_company, :linked_in_url, :twitter_url, :git_hub_url, :portfolio_url, :website_url,\n resume_attributes:[:resume_data])\n end",
"def new\n @election = Election.find(params[:election_id])\n @race = @election.races.build\n @race.race_candidates.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @race }\n end\n end",
"def create_from_candidates\n authorize @competition.competitors.new\n\n heat = params[:heat].to_i\n competitors = params[:competitors]\n begin\n LaneAssignment.transaction do\n competitors.each do |_, competitor|\n reg = Registrant.find_by!(bib_number: competitor[:bib_number])\n lane_assignment = LaneAssignment.new(registrant_id: reg.id, lane: competitor[:lane].to_i, heat: heat, competition: @competition)\n lane_assignment.allow_competitor_auto_creation = true\n lane_assignment.save!\n end\n end\n flash[:notice] = \"Created Lane Assignments & Competitors\"\n rescue StandardError => e\n flash[:alert] = \"Error creating lane assignments/competitors #{e}\"\n end\n redirect_to competition_competitors_path(@competition)\n end",
"def candidate_params\n params.require(:candidate).permit(:name, :email, knowledges_attributes: [:item, :level])\n end",
"def index\n @candidates = Candidate.where(user_id: current_user.id)\n end",
"def candidate_params\n params.require(:candidate).permit(:name, :cellphone, :birth_date, :genre, :status, :regional_candidate, :country_code,\n :civil_status, :recruitment_source, :relocate, :actual_salary, :email,\n :variable_salary, :wage_aspiration, :position, :comparative_chart, :specific_benefit,\n :general_benefits, :general_comments, :address, :conditions_to_move, :telephone,\n :interview_date, :nationality, :actual_company, skills_attributes: [:id, :name, :_destroy],\n education_levels_attributes: [:id, :name, :_destroy], \n careers_attributes: [:id, :name, :_destroy], languages_attributes: [:id, :name, :_destroy],\n performance_areas_attributes: [:id, :name, :_destroy], industries_attributes: [:id, :name, :_destroy])\n end",
"def candidate_params\n params.require(:candidate).permit( :first_name,:last_name,:dob,:gender, :marital_status, :status,:languages,:summary)\n end",
"def create\n votes = params[:vote]\n voter = params[:voter_id]\n\n if votes\n votes.each do |k,v|\n @vote = Vote.new({:voter_id => voter,\n :position_id => v,\n :candidate_id => k })\n @vote.save\n end\n end\n\n\n redirect_to '/vote'\n\n #respond_to do |format|\n #if @vote.save\n #format.html { redirect_to @vote, notice: 'Vote was successfully created.' }\n #format.json { render json: @vote, status: :created, location: @vote }\n #else\n #format.html { render action: \"new\" }\n #format.json { render json: @vote.errors, status: :unprocessable_entity }\n #end\n #end\n end",
"def vote_params\n params.permit(\n :election_id,\n :candidate_id \n )\n end",
"def create\n @candidate_course_score = @candidate.course_scores.build(candidate_course_score_params)\n\n respond_to do |format|\n if @candidate_course_score.save\n flash[:notice] = 'Course score was successfully created.'\n format.html { redirect_to candidate_course_score_path(course_score_path_params(@candidate_course_score)) }\n format.json { render :show, status: :created, location: @candidate_course_score }\n else\n format.html { render :new }\n format.json { render json: @candidate_course_score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def index\n @candidates = Candidate.limit(100)\n end",
"def set_candidate\n \t@election = Candidate.find(params[:id])\n end",
"def show\n @candidate = Candidate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @candidate }\n end\n end",
"def set_candidate\n @candidate = params[:id] ? Candidate.find(params[:id]) : Candidate.new(candidate_params)\n end",
"def save_candidate_data\n raise('Captcha found.') if captcha?\n puts \"Saving candidate's information.\"\n candidates ||= []\n candidate_results = select_elements(:result_tiles)\n candidate_results.each do |candidate_elem|\n candidates.push(candidate_info(candidate_elem)) \\\n unless company?(candidate_elem)\n end\n fail('No data found.') if candidates.empty?\n end_section\n candidates\n end",
"def create\n # Create election from parameters\n @election = Election.new(params[:election])\n user_id = params[:election][:user_id]\n if user_id == \"\"\n flash[:error] = \"You may choose owner for election\"\n redirect_back_or_default(:action => 'new')\n return\n end\n @election.owner = ::User.find(user_id)#current_user\n\n faculty_id = params[:election][:faculty_id]\n # validate\n if faculty_id == \"\"\n flash[:error] = \"You may choose faculty for election\"\n redirect_back_or_default(:action => 'new')\n return\n end\n\n faculty_num = Faculty.find(@election.faculty_id).num\n\n # Get votes by faculty\n voters = Array.new\n voters = ::User.find_users_by_faculty(faculty_num)\n\n # Validates existence of voters\n if voters.empty?\n flash[:error] = \"The are no registered students on a faculty\"\n redirect_back_or_default(:action => 'new')\n return\n end\n\n # Create voting ballots\n ballots = Array.new\n voters.each do |voter|\n ballot = Ballot.new_from_params(voter, @election)\n ballots << ballot\n end\n\n # Save the records to the database\n begin\n Election.transaction do\n @election.save!\n ballots.each {|b| b.save!}\n end\n rescue Exception\n render :action => :new and return\n end\n\n flash[:notice] = \"Election created successfully\"\n redirect_to(object_url(@election))\n end",
"def set_candidates(pv)\n @candidates = pv\n @value = @initial_value\n end",
"def update\n respond_to do |format|\n if @candidate.update(permitted_attributes @candidate)\n format.html { redirect_to @candidate, notice: \"Candidate was successfully updated.\" }\n format.json { render :show, status: :ok, location: @candidate }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @final_decision = FinalDecision.new(:user_id => session[:candidate], :interview_id => session[:interview_id], :decision => params[:decision])\n\n\n if @final_decision.save\n redirect_to organization_show_candidates_path\n else\n format.html { render action: 'new' }\n format.json { render json: @final_decision.errors, status: :unprocessable_entity }\n end\n\n end",
"def create\n\n reviews = []\n params[:scores].keys.each{ |name|\n score = params[:scores][name]\n peer_review = PeerReview.new(name:name, score:score, miniproject_id:params[:project][:id])\n peer_review.save\n reviews << peer_review\n }\n\n render json: reviews\n\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def create\n params[:interview][:scheduler_id] = current_user.id\n @interview = @candidate.interviews.new(params[:interview])\n params[:other_interviewers].split(\",\").each do |interviewer|\n @interview.interviewers.new({:user_id => interviewer})\n end\n respond_to do |format|\n if @interview.save\n format.html { redirect_to candidate_path(@candidate), notice: 'Interview was successfully created.' }\n format.js { render :index }\n format.json { render json: @interview, status: :created, location: @interview }\n else\n format.html { render action: \"new\" }\n format.js { render :index }\n format.json { render json: @interview.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @alliance = find_alliance\n @candidate = Candidate.new(candidate_params).tap do |t|\n t.student_number = current_haka_user.student_number # sensitive\n t.electoral_alliance = @alliance # sensitive\n end\n\n if @candidate.save\n flash.notice = \"Ehdokasilmoittautuminen vastaanotettu!\"\n redirect_to registrations_candidate_path(@candidate.student_number)\n else\n flash.alert = \"Ehdokasilmoittautuminen ei onnistunut, koska lomakkeen tiedoissa oli virheitä.\"\n render :new\n end\n end",
"def candidate_params\n params.require(:user).permit(:first_name, :middle_name, :last_name, :email)\n end",
"def set_candidate\n @candidate = Candidate.includes(:user, :resume).find(params[:id])\n end",
"def create\n @election = Election.new(election_params)\n respond_to do |format|\n if @election.save\n @election.users << current_user #add the current user to the users for this election\n format.html { redirect_to user_elections_path, notice: 'Election was successfully created.' }\n format.json { render :show, status: :created, location: @election }\n else\n format.html { render :new }\n format.json { render json: @election.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @election = Election.new(election_params)\n respond_to do |format|\n if @election.save\n format.html { redirect_to [:admin, @election], notice: 'Election was successfully created.' }\n format.json { render :show, status: :created, location: @election }\n else\n format.html { render :new }\n format.json { render json: @election.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @election = Election.new\n @election.choices.build\n @election.choices.each do |choice|\n choice.election_id = @election.id\n end\n respond_with @election\n\tend",
"def set_candidate\n @candidate = Candidate.find(params[:candidate_id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:candidate_id])\n end"
] | [
"0.73996586",
"0.69050306",
"0.6875307",
"0.6840989",
"0.6840989",
"0.6840989",
"0.6840989",
"0.68375486",
"0.68206316",
"0.6752525",
"0.67350394",
"0.6624552",
"0.65386087",
"0.64996314",
"0.64925003",
"0.6466578",
"0.6317362",
"0.63112783",
"0.6292041",
"0.62748843",
"0.6263035",
"0.6263035",
"0.6263035",
"0.6263035",
"0.6263035",
"0.6223629",
"0.6214525",
"0.60610753",
"0.6047276",
"0.59914696",
"0.59822476",
"0.5924303",
"0.59171975",
"0.59110427",
"0.5861408",
"0.58151865",
"0.58061594",
"0.58049303",
"0.5804285",
"0.57975453",
"0.5797129",
"0.5789055",
"0.57703304",
"0.5769978",
"0.5768044",
"0.57677454",
"0.57677454",
"0.5765535",
"0.5761502",
"0.57588595",
"0.5748943",
"0.5721717",
"0.5708067",
"0.56982106",
"0.56982106",
"0.5693914",
"0.56920874",
"0.56822395",
"0.5682166",
"0.56784517",
"0.56667966",
"0.56647867",
"0.5618734",
"0.5608235",
"0.5577225",
"0.55649483",
"0.5562542",
"0.5559256",
"0.5543848",
"0.5543848",
"0.5543848",
"0.5543848",
"0.5543848",
"0.5543848",
"0.5543848",
"0.5543848",
"0.5543848",
"0.5543848",
"0.5543848",
"0.5543848",
"0.55380285",
"0.5531896",
"0.55250925",
"0.5519289",
"0.5514087",
"0.5508311",
"0.548425",
"0.54822093",
"0.5469462",
"0.54672885",
"0.5451965",
"0.54447144",
"0.5433583",
"0.5429187",
"0.5423632",
"0.5421003",
"0.5418291",
"0.5403239",
"0.5398617",
"0.5398617"
] | 0.6661347 | 11 |
PATCH/PUT /candidates/1 PATCH/PUT /candidates/1.json | def update
respond_to do |format|
if @candidate.update(candidate_params)
flash[:success] = 'Candidate was successfully updated'
format.html { redirect_to edit_candidate_path(@candidate), notice: 'Candidate was successfully updated.' }
format.json { render :show, status: :ok, location: @candidate }
else
flash[:failure] = 'Candidate updation unsuccessful'
format.html { render :edit }
format.json { render json: @candidate.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @candidate = Candidate.find(params[:id])\n\n respond_to do |format|\n if @candidate.update_attributes(params[:candidate])\n format.html { redirect_to @candidate, notice: 'Candidate was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @candidate.update(permitted_attributes @candidate)\n format.html { redirect_to @candidate, notice: \"Candidate was successfully updated.\" }\n format.json { render :show, status: :ok, location: @candidate }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @candidate.update(candidate_params)\n format.html { redirect_to @candidate, notice: 'Candidate was successfully updated.' }\n format.json { render :show, status: :ok, location: @candidate }\n else\n format.html { render :edit }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @candidate.update(candidate_params)\n format.html { redirect_to @candidate, notice: 'Candidate was successfully updated.' }\n format.json { render :show, status: :ok, location: @candidate }\n else\n format.html { render :edit }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @candidate.update(candidate_params)\n format.html { redirect_to @candidate, notice: 'Candidate was successfully updated.' }\n format.json { render :show, status: :ok, location: @candidate }\n else\n format.html { render :edit }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @candidate.update(candidate_params)\n format.html { redirect_to @candidate, notice: 'Candidate was successfully updated.' }\n format.json { render :show, status: :ok, location: @candidate }\n else\n format.html { render :edit }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @candidate.update(candidate_params)\n format.html { redirect_to @candidate, notice: 'Candidate was successfully updated.' }\n format.json { render :show, status: :ok, location: @candidate }\n else\n format.html { render :edit }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @candidate.update(candidate_params)\n format.html { redirect_to @candidate, notice: 'Candidate was successfully updated.' }\n format.json { render :show, status: :ok, location: @candidate }\n else\n format.html { render :edit }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @candidate.update(candidate_params)\n format.html { redirect_to @candidate, notice: 'Candidate was successfully updated.' }\n format.json { render :show, status: :ok, location: @candidate }\n else\n format.html { render :edit }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @candidate.update(candidate_params)\n format.html { redirect_to @candidate, notice: \"Candidate was successfully updated.\" }\n format.json { render :show, status: :ok, location: @candidate }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @candidate = Candidate.find(params[:id])\n\n respond_to do |format|\n if @candidate.update_attributes(params[:candidate])\n flash[:notice]='Successfully updated Details!'\n format.html { redirect_to :controller=>\"test_center\",:action=>\"instructions\" }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @candidate.update(candidate_params)\n format.html { redirect_to user_election_position_candidates_path, notice: 'Candidate was successfully updated.' }\n format.json { render :show, status: :ok, location: @candidate }\n else\n format.html { render :edit }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @candidate = Candidate.find(params[:id])\n\n if @candidate.update_attributes(params[:candidate])\n redirect_to admin_candidates_path, notice: 'Candidate was successfully updated.'\n else\n render action: \"edit\"\n end\n end",
"def update\n authorize @vote_candidate\n respond_to do |format|\n if @vote_candidate.update(vote_candidate_params)\n format.html { redirect_to @vote_candidate, notice: 'Vote candidate was successfully updated.' }\n format.json { render :show, status: :ok, location: @vote_candidate }\n else\n format.html { render :edit }\n format.json { render json: @vote_candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @candidate.update(candidate_params)\n set_questionnaire\n format.html { redirect_to candidates_url, notice: \"Candidate was successfully updated.\" }\n else\n format.html { redirect_to edit_candidate_url(@candidate), alert: @candidate.errors.full_messages.first }\n end\n end\n end",
"def update\n @candidate_app = CandidateApp.find(params[:id])\n\n respond_to do |format|\n if @candidate_app.update_attributes(params[:candidate_app])\n format.html { redirect_to @candidate_app, notice: 'Candidate app was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @candidate_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @candidate.update(candidate_params)\n format.html { redirect_to @candidate , notice: 'Información actualizada correctamente.' }\n format.json { head :no_content }\n else\n format.html { render 'edit' }\n format.json { render json: @candidate.errors , status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @candidate_detail.update(candidate_detail_params)\n format.html { redirect_to candidate_candidate_detail_path(@candidate,@candidate_detail), notice: 'Candidate detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @candidate_detail }\n else\n format.html { render :edit }\n format.json { render json: @candidate_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @candidate_info = args[:candidate_info] if args.key?(:candidate_info)\n @contain_user_quotes = args[:contain_user_quotes] if args.key?(:contain_user_quotes)\n @contain_vulgar_candidates = args[:contain_vulgar_candidates] if args.key?(:contain_vulgar_candidates)\n @disable_ng3_scoring = args[:disable_ng3_scoring] if args.key?(:disable_ng3_scoring)\n @disable_query_features = args[:disable_query_features] if args.key?(:disable_query_features)\n @snippet_brain_selected_candidate_index = args[:snippet_brain_selected_candidate_index] if args.key?(:snippet_brain_selected_candidate_index)\n @snippetsbrain_model_info = args[:snippetsbrain_model_info] if args.key?(:snippetsbrain_model_info)\n end",
"def update\n respond_to do |format|\n if @candidatedetail.update(candidatedetail_params)\n format.html { redirect_to @candidatedetail, notice: 'Candidatedetail was successfully updated.' }\n format.json { render :show, status: :ok, location: @candidatedetail }\n else\n format.html { render :edit }\n format.json { render json: @candidatedetail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @candidate = @alliance.candidates.find(params[:id])\n\n authorize! :update, @candidate\n\n if @candidate.log_and_update_attributes(candidate_params)\n flash[:notice] = \"Muutokset tallennettu.\"\n else\n flash[:alert] = \"Muutosten tallentaminen epäonnistui!\"\n render :action => :edit and return\n end\n\n respond_with(@alliance) do |format|\n format.html { redirect_to advocates_alliance_path(@alliance) }\n end\n end",
"def update\n\n # Note: use form validation to ensure that\n # params[:uploaded_file] is not null\n\n respond_to do |format|\n if @candidate.update(candidate_params)\n format.html { redirect_to @candidate, notice: 'Candidate was successfully updated.' }\n format.json { render :show, status: :ok, location: @candidate }\n else\n format.html { render :edit }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @candidate = args[:candidate] if args.key?(:candidate)\n @reference = args[:reference] if args.key?(:reference)\n end",
"def update\n @election = Election.find(election_params[:id])\n respond_to do |format|\n if @election.update(election_params)\n format.html { redirect_to user_elections_path, notice: 'Election was successfully updated.' }\n format.json { render :show, status: :ok, location: @election }\n else\n format.html { render :edit }\n format.json { render json: @election.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @compromise = Compromise.find(params[:id])\n\n respond_to do |format|\n if @compromise.update_attributes(params[:compromise])\n format.html { redirect_to @compromise, notice: 'Compromise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @compromise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @candidate.update(candidate_params)\n redirect_to (current_user.role == 'candidate' ? root_path : @candidate), notice: 'Candidate was successfully updated.'\n else\n render :edit\n end\n end",
"def update\n respond_to do |format|\n# if @proposal.update(proposal_params)\n if @proposal.update_with_conflict_validation(proposal_params)\n format.html { redirect_to @proposal, notice: '提案を1件更新しました。' }\n format.json { render :show, status: :ok, location: @proposal }\n else\n format.html { render :edit }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @candidates = args[:candidates] if args.key?(:candidates)\n @query = args[:query] if args.key?(:query)\n @weight = args[:weight] if args.key?(:weight)\n end",
"def update\n @choice = Choice.find(params[:id])\n\n if @choice.update(choice_params)\n head :no_content\n else\n render json: @choice.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @candidate_reference.update(candidate_reference_params)\n flash[:success] = 'Reference was successfully updated.' \n format.html { redirect_to edit_candidate_references_path(params[:candidate_id])}\n format.json { render :show, status: :ok, location: @candidate_reference }\n else\n flash[:failure] = 'Reference updation unsuccessful.' \n @candidate_references = [@candidate_reference]\n @new_candidate_reference = Candidate::Reference.new\n format.html { redirect_to edit_candidate_references_path(params[:candidate_id]) }\n format.json { render json: @candidate_reference.errors, status: :unprocessable_entity }\n end\n end\n end",
"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",
"def update!(**args)\n @candidate_index = args[:candidate_index] if args.key?(:candidate_index)\n end",
"def patch!\n request! :patch\n end",
"def update\n @proposal = Proposal.find(params[:id])\n\n respond_to do |format|\n if @proposal.update_attributes(params[:proposal])\n format.html { redirect_to @proposal, notice: 'Proposal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @proposal.update_attributes(params[:proposal])\n format.html { redirect_to @proposal, notice: 'Proposal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @proposal = listing.proposals.find(params[:id])\n\n respond_to do |format|\n if @proposal.update_attributes(params[:proposal])\n format.html { redirect_to @proposal, notice: 'Proposal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n @proposal = Proposal.find(params[:id])\n\n respond_to do |format|\n if @proposal.update_attributes(update_params)\n format.html { redirect_to @proposal, notice: 'Proposal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @concept_id = args[:concept_id] if args.key?(:concept_id)\n @contact_source = args[:contact_source] if args.key?(:contact_source)\n @is_relationship_from_annotation = args[:is_relationship_from_annotation] if args.key?(:is_relationship_from_annotation)\n @is_relationship_from_source = args[:is_relationship_from_source] if args.key?(:is_relationship_from_source)\n @is_single_candidate = args[:is_single_candidate] if args.key?(:is_single_candidate)\n @is_starred = args[:is_starred] if args.key?(:is_starred)\n @matched_name_type = args[:matched_name_type] if args.key?(:matched_name_type)\n @num_alternate_name_from_fuzzy_contact_match = args[:num_alternate_name_from_fuzzy_contact_match] if args.key?(:num_alternate_name_from_fuzzy_contact_match)\n @num_alternate_names_from_s3 = args[:num_alternate_names_from_s3] if args.key?(:num_alternate_names_from_s3)\n @num_alternative_names_from_interpretation = args[:num_alternative_names_from_interpretation] if args.key?(:num_alternative_names_from_interpretation)\n @num_candidates = args[:num_candidates] if args.key?(:num_candidates)\n @recognition_alternate_source = args[:recognition_alternate_source] if args.key?(:recognition_alternate_source)\n end",
"def update\n @candidate_revision = CandidateRevision.find(params[:id])\n\n respond_to do |format|\n if @candidate_revision.update_attributes(params[:candidate_revision])\n flash[:notice] = 'CandidateRevision was successfully updated.'\n format.html { redirect_to(@candidate_revision) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @candidate_revision.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @candidate = Usernew.find(params[:id])\n\n respond_to do |format|\n if @candidate.update_attributes(params[:usernew])\n format.html { redirect_to @usernew, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @usernew.errors, status: :unprocessable_entity }\n end\n end\n end",
"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",
"def update\n respond_to do |format|\n if @election.update(election_params)\n format.html { redirect_to @election, notice: \"Election was successfully updated.\" }\n format.json { render :show, status: :ok, location: @election }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @election.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def update\n @person = Person.find(params[:id]) \n respond_to do |format|\n if @person.update(person_params)\n format.json { render json: @person, status: :ok }\n else\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @coffer.update(coffer_params)\n format.html { redirect_to @coffer, notice: 'Coffer was successfully updated.' }\n format.json { render :show, status: :ok, location: @coffer }\n else\n format.html { render :edit }\n format.json { render json: @coffer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @proposal.accepted == true\n format.html { redirect_to @proposal, notice: 'The Proposal Can Not Be Changed After It Has Been Assigned' }\n end\n unless params[:proposal][:bts].nil? || params[:proposal][:bts].count == 0\n @proposal.bts.clear\n params[:proposal][:bts].each do |bt|\n @proposal.bts << bt\n end\n end\n unless params[:proposal][:focus_points].nil? || params[:proposal][:focus_points].count == 0\n @proposal.focus_points.clear\n params[:proposal][:focus_points].each do |fp|\n @proposal.focus_points << fp\n end\n end\n if @proposal.update(proposal_params)\n format.html { redirect_to @proposal, notice: 'Proposal was successfully updated.' }\n format.json { render :show, status: :ok, location: @proposal }\n else\n format.html { render :edit }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @leader = Leader.find(params[:id])\n\n respond_to do |format|\n if @leader.update_attributes(params[:leader])\n format.html { redirect_to @leader, notice: 'Leader was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @leader.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_candidate\n @candidate = Candidate.includes(:user, :resume).find(params[:id])\n end",
"def update\n respond_to do |format|\n if @election.update(election_params)\n format.html { redirect_to @election, notice: 'Election was successfully updated.' }\n format.json { render :show, status: :ok, location: @election }\n else\n format.html { render :edit }\n format.json { render json: @election.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @election.update(election_params)\n format.html { redirect_to @election, notice: 'Election was successfully updated.' }\n format.json { render :show, status: :ok, location: @election }\n else\n format.html { render :edit }\n format.json { render json: @election.errors, status: :unprocessable_entity }\n end\n end\n end",
"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",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n respond_to do |format|\n if election.update_attributes(params[:election] ? election_attributes : {})\n format.html { redirect_to(election, flash: { success: 'Election updated.' }) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => election.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @requester.update(requester_params)\n format.html { redirect_to @requester, notice: 'Requester was successfully updated.' }\n format.json { render :show, status: :ok, location: @requester }\n else\n format.html { render :edit }\n format.json { render json: @requester.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @collaborator = Collaborator.find(params[:id])\n\n respond_to do |format|\n if @collaborator.update_attributes(params[:collaborator])\n format.html { redirect_to @collaborator, notice: 'Collaborator was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @collaborator.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_candidate\n \t@election = Candidate.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @proposal.update(proposal_params)\n format.html { redirect_to @proposal, notice: 'Proposal was successfully updated.' }\n format.json { render :show, status: :ok, location: @proposal }\n else\n format.html { render :edit }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end",
"def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end",
"def set_candidate\n @candidate = params[:id] ? Candidate.find(params[:id]) : Candidate.new(candidate_params)\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def update\n @kickoff = Kickoff.find(params[:id])\n\n respond_to do |format|\n if @kickoff.update_attributes(params[:kickoff])\n format.html { redirect_to @kickoff, notice: 'Kickoff was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kickoff.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @proposal.update(proposal_params)\n format.html { redirect_to :back, notice: 'La proposition a été modifiée.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize [:api, :v1, @requesting_object]\n ticket = ServiceTicket.where(\n client_key: params['avatar_key'],\n id: params['id']\n ).first\n if params['comment_text']\n ticket.comments << Comment.new(author: params['avatar_name'],\n text: params['comment_text'])\n end\n ticket.update(status: params['status']) if params['status']\n render json: { message: 'OK' }, status: :ok\n end",
"def update\n respond_to do |format|\n if @exam_candidate.update_attributes(params[:exam_candidate])\n format.html { redirect_to(@exam_candidate, :notice => 'Candidate was successfully updated.') }\n format.xml { head :ok }\n else\n @exam_candidate.attachments.build\n @exam_candidate.internships.build\n # @exam_candidate.build_address\n\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @exam_candidate.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n #Finding the specific chore where the id matches the one we pass in with the body\n @v1_chore = Chore.where(id: params[:id]).first\n #Here we're checking if we have user_id in our body, and if we do, we'll change the selected chore's properties\n #with the parameters of the body, we go through the specific group to our specific chore with the path\n if v1_chore_params[:user_id]\n @v1_chore.user_id = params[:user_id]\n @v1_chore.assigned = true\n if @v1_chore.save\n render :show, status: :ok\n end\n else\n render json: @v1_chore.errors, status: :unprocessable_entity\n end\n end",
"def update\n course = Course.includes(:professors).find(params[:id])\n course.update!(course_params)\n \n course.professor_ids=(params[:professors])\n\n render json: course.to_json(include: :professors)\n end",
"def update\n @solution = @idea.solutions.find(params[:id])\n\n if @solution.update_attributes(params[:solution])\n render json: { text: \"success\" }\n else\n render json: { text: \"fail\"}\n end\n end",
"def update\n respond_to do |format|\n if @appoint_responsible.update(appoint_responsible_params)\n format.html { redirect_to @appoint_responsible, notice: 'Appoint responsible was successfully updated.' }\n format.json { render :show, status: :ok, location: @appoint_responsible }\n else\n format.html { render :edit }\n format.json { render json: @appoint_responsible.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @election.update(election_params)\n format.html { redirect_to [:admin, @election], notice: 'Election was successfully updated.' }\n format.json { render :show, status: :ok, location: @election }\n else\n format.html { render :edit }\n format.json { render json: @election.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @request.assign_json_attributes(params) if @request.resume?\n respond_to do |format|\n if @request.update(request_params)\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { render :show, status: :ok, location: @request }\n else\n format.html { render :edit }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n 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",
"def update_suggested_course_pathway\n suggested_pathway = SuggestedPathway.find_by(id: params[:id])\n suggested_pathway.name = params[:name]\n suggested_pathway.year = params[:year]\n suggested_pathway.course_id = params[:course_id]\n suggested_pathway.data = params[:data]\n suggested_pathway.save\n render json: suggested_pathway\n end",
"def update\n recipe.update(recipe_params)\n render json: recipe\n end",
"def update\n # @person = Person.find(params[:id])\n # @person.pct_complete = @person.requirement_progress\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, :notice => 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @person.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @completion.update(completion_params)\n format.html { redirect_to @completion, notice: 'Completion was successfully updated.' }\n format.json { render :show, status: :ok, location: @completion }\n else\n format.html { render :edit }\n format.json { render json: @completion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_candidate\n @candidate = Candidate.find(params[:candidate_id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:candidate_id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:candidate_id])\n end",
"def set_candidate\n @candidate = Candidate.find_by id: params[:id]\n authorize @candidate\n end",
"def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end",
"def update\n respond_to do |format|\n if @potential_client.update(potential_client_params)\n format.html { redirect_to @potential_client, notice: 'Potential client was successfully updated.' }\n format.json { render :show, status: :ok, location: @potential_client }\n else\n format.html { render :edit }\n format.json { render json: @potential_client.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @election = Election.find(params[:id])\n\n respond_to do |format|\n if @election.update_attributes(params[:election])\n flash[:notice] = 'Election was successfully updated.'\n format.html { redirect_to(@election) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @election.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @contests = args[:contests] if args.key?(:contests)\n @drop_off_locations = args[:drop_off_locations] if args.key?(:drop_off_locations)\n @early_vote_sites = args[:early_vote_sites] if args.key?(:early_vote_sites)\n @election = args[:election] if args.key?(:election)\n @kind = args[:kind] if args.key?(:kind)\n @mail_only = args[:mail_only] if args.key?(:mail_only)\n @normalized_input = args[:normalized_input] if args.key?(:normalized_input)\n @other_elections = args[:other_elections] if args.key?(:other_elections)\n @polling_locations = args[:polling_locations] if args.key?(:polling_locations)\n @precinct_id = args[:precinct_id] if args.key?(:precinct_id)\n @state = args[:state] if args.key?(:state)\n end",
"def update\n respond_to do |format|\n if @leadership.update(leadership_params)\n format.html { redirect_to @leadership, notice: 'Leadership was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @leadership.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6997068",
"0.6843286",
"0.6768482",
"0.6768482",
"0.6768482",
"0.6768482",
"0.6768482",
"0.6768482",
"0.6768482",
"0.67535204",
"0.65477365",
"0.6542974",
"0.6518262",
"0.6458349",
"0.64341927",
"0.6364452",
"0.63492894",
"0.624964",
"0.61845785",
"0.6174728",
"0.61387515",
"0.61366266",
"0.60592806",
"0.5986286",
"0.5959036",
"0.5920511",
"0.59154475",
"0.58870035",
"0.5873875",
"0.58720976",
"0.5858716",
"0.5844691",
"0.5828282",
"0.58240527",
"0.58112353",
"0.58010906",
"0.5795901",
"0.5795901",
"0.57757664",
"0.5769659",
"0.575372",
"0.5735932",
"0.5734777",
"0.57078874",
"0.5703897",
"0.56987894",
"0.56987894",
"0.56987894",
"0.56987894",
"0.56987894",
"0.56987894",
"0.56987894",
"0.56987894",
"0.56987894",
"0.56987894",
"0.56987894",
"0.56987894",
"0.56845856",
"0.56807595",
"0.5678208",
"0.56728816",
"0.56700325",
"0.56653214",
"0.56653214",
"0.56632763",
"0.56608087",
"0.5653734",
"0.5646902",
"0.5640472",
"0.56397325",
"0.5631545",
"0.5623582",
"0.56233525",
"0.56231695",
"0.56139874",
"0.5607637",
"0.55942726",
"0.558184",
"0.5581213",
"0.55786675",
"0.5575969",
"0.55748516",
"0.55638546",
"0.5561009",
"0.55540925",
"0.55514455",
"0.55433476",
"0.5535228",
"0.5535117",
"0.5533403",
"0.55330044",
"0.5531925",
"0.5531925",
"0.5531925",
"0.55258906",
"0.5525867",
"0.5511647",
"0.55110914",
"0.5509521",
"0.5508668"
] | 0.6686334 | 10 |
DELETE /candidates/1 DELETE /candidates/1.json | def destroy
@candidate.destroy
respond_to do |format|
flash[:notice] = 'Candidate was successfully destroyed.'
format.html { redirect_to candidates_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @candidate = Candidate.find(params[:id])\n @candidate.destroy\n\n respond_to do |format|\n format.html { redirect_to candidates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @candidate = Candidate.find(params[:id])\n @candidate.destroy\n\n respond_to do |format|\n format.html { redirect_to candidates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @candidate.destroy\n respond_to do |format|\n format.html { redirect_to candidates_url, notice: 'Candidate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @candidate.destroy\n respond_to do |format|\n format.html { redirect_to candidates_url, notice: 'Candidate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @candidate.destroy\n respond_to do |format|\n format.html { redirect_to candidates_url, notice: 'Candidate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @candidate.destroy\n respond_to do |format|\n format.html { redirect_to candidates_url, notice: 'Candidate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @candidate.destroy\n respond_to do |format|\n format.html { redirect_to candidates_url, notice: 'Candidate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @candidate.destroy\n respond_to do |format|\n format.html { redirect_to candidates_url, notice: 'Candidate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @candidate.destroy\n respond_to do |format|\n format.html { redirect_to candidates_url, notice: 'Candidate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @candidate.destroy\n respond_to do |format|\n format.html { redirect_to candidates_url, notice: 'Candidate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @candidate.destroy\n respond_to do |format|\n format.html { redirect_to candidates_url, notice: \"Candidate was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @candidate.destroy\n respond_to do |format|\n format.html { redirect_to candidates_url, notice: \"Candidate was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @candidate.destroy\n respond_to do |format|\n format.html { redirect_to candidates_url, notice: \"Candidate was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @candidate.destroy\n respond_to do |format|\n format.html { redirect_to candidates_url, notice: 'Your profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize @vote_candidate\n @vote_candidate.destroy\n respond_to do |format|\n format.html { redirect_to vote_candidates_url, notice: 'Vote candidate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam_candidate.destroy\n\n respond_to do |format|\n format.html { redirect_to(candidates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @candidate_detail.destroy\n respond_to do |format|\n format.html { redirect_to candidate_candidate_details_path(@candidate), notice: 'Candidate detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @candidate_reference.destroy\n respond_to do |format|\n flash[:success] = 'Reference was successfully deleted' \n format.html { redirect_to edit_candidate_references_path(params[:candidate_id])}\n format.json { head :no_content }\n end\n end",
"def destroy\n @candidate.destroy\n redirect_to candidates_url, notice: 'Candidate was successfully destroyed.'\n end",
"def destroy\n @candidate_app = CandidateApp.find(params[:id])\n @candidate_app.destroy\n\n respond_to do |format|\n format.html { redirect_to candidate_apps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @candidatedetail.destroy\n respond_to do |format|\n format.html { redirect_to candidatedetails_url, notice: 'Candidatedetail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @election = Election.find(params[:id])\n @election.destroy\n respond_to do |format|\n format.html { redirect_to user_elections_path, notice: 'Election was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @candidate = Candidate.find(params[:id])\n @candidate.destroy\n redirect_to admin_jobs_url\n end",
"def destroy_candidates\n candidates.each do |candidate|\n candidate.destroy\n end\n end",
"def destroy\n @candidate_revision = CandidateRevision.find(params[:id])\n @candidate_revision.destroy\n\n respond_to do |format|\n format.html { redirect_to(candidate_revisions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @election.destroy\n respond_to do |format|\n format.html { redirect_to elections_url, notice: \"Election was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @election.destroy\n respond_to do |format|\n format.html { redirect_to elections_url, notice: 'Election was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @election.destroy\n respond_to do |format|\n format.html { redirect_to elections_url, notice: 'Election was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nudge.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @candidate.destroy\n respond_to do |format|\n format.html { redirect_to :back , status: 303 , notice: 'Candidato borrado correctamente.' }\n # if !params[:category_id].nil?\n #format.html { redirect_to(category_candidates_path(@category), notice: 'Categoría borrada correctamente.')\n # else\n #format.html { redirect_to candidates_url, notice: 'Candidato borrado correctamente.' }\n # end\n format.json { head :no_content }\n\n end\n end",
"def destroy\n @optin_contestant = OptinContestant.find(params[:id])\n @optin_contestant.destroy\n\n respond_to do |format|\n format.html { redirect_to optin_contestants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @election.destroy\n respond_to do |format|\n format.html { redirect_to admin_elections_url, notice: 'Election was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @collaborator = Collaborator.find(params[:id])\n @collaborator.destroy\n\n respond_to do |format|\n format.html { redirect_to canvases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @election = Election.find(params[:id])\n @election.destroy\n\n respond_to do |format|\n format.html { redirect_to(elections_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @leader.destroy\n respond_to do |format|\n format.html { redirect_to leaders_url, notice: 'leader was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ai_contest = AiContest.find(params[:id])\n @ai_contest.destroy\n\n respond_to do |format|\n format.html { redirect_to ai_contests_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @challenge.destroy\n respond_to do |format|\n format.html { redirect_to challenges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @challenge ||= Challenge.find(params[:id])\n @challenge.destroy\n\n respond_to do |format|\n format.html { redirect_to challenges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vote = Vote.find(params[:id])\n @vote.destroy\n\n respond_to do |format|\n format.html { redirect_to proposal_url(@proposal) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reply_vote = ReplyVote.find(params[:id])\n @reply_vote.destroy\n\n respond_to do |format|\n format.html { redirect_to reply_votes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @election_type = ElectionType.find(params[:id])\n @election_type.destroy\n\n respond_to do |format|\n format.html { redirect_to election_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @contestant = Contestant.find(params[:id])\n @contestant.destroy\n\n respond_to do |format|\n format.html { redirect_to contestants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @challenge = Challenge.find(params[:id])\n @challenge.destroy\n\n respond_to do |format|\n format.html { redirect_to challenges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @challenge = Challenge.find(params[:id])\n @challenge.destroy\n\n respond_to do |format|\n format.html { redirect_to challenges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @leader = Leader.find(params[:id])\n @leader.destroy\n\n respond_to do |format|\n format.html { redirect_to leaders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vote = @votable.votes.find(params[:id])\n @vote.destroy\n respond_to do |format|\n format.html { redirect_to build_path_votes }\n format.json { head :no_content }\n end\n end",
"def destroy\n @compromise = Compromise.find(params[:id])\n @compromise.destroy\n\n head :no_content\n end",
"def destroy\n @coffee_attempt.destroy\n respond_to do |format|\n format.html { redirect_to coffee_attempts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @decision.destroy\n respond_to do |format|\n format.html { redirect_to decisions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client_answer = ClientAnswer.find(params[:id])\n @client_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to client_answers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @compromise = Compromise.find(params[:id])\n @compromise.destroy\n\n respond_to do |format|\n format.html { redirect_to compromises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @election = Election.find(params[:election_id])\n @race = @election.races.find(params[:id])\n @race.destroy\n\n respond_to do |format|\n format.html { redirect_to election_races_url(@election) }\n format.json { head :no_content }\n end\n end",
"def delete!\n Recliner.delete(uri)\n end",
"def destroy\n @residence = Residence.find(params[:id])\n @residence.destroy\n\n respond_to do |format|\n format.html { redirect_to residences_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @counselledperson.destroy\n respond_to do |format|\n format.html { redirect_to counselledpersons_index_url, notice: 'Counselledpersons was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @candy.destroy\n respond_to do |format|\n format.html { redirect_to candies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n\n\n @vote = Vote.find(params[:id])\n\n @vote.destroy\n\n respond_to do |format|\n format.html { redirect_to votes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @proxy_votes_collected.destroy\n respond_to do |format|\n format.html { redirect_to proxy_votes_collected_index_url, notice: 'Proxy votes collected was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comm_vote = CommVote.find(params[:id])\n @comm_vote.destroy\n\n respond_to do |format|\n format.html { redirect_to comm_votes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @candidate_course_score.destroy\n flash[:notice] = 'Course score was successfully destroyed.'\n respond_to do |format|\n format.html { redirect_to candidate_course_scores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @leadership.destroy\n respond_to do |format|\n format.html { redirect_to leaderships_url }\n format.json { head :no_content }\n end\n end",
"def delete_candidate(accountID)\n\t\tputs \"DB::delete #{accountID}\"\n\tend",
"def destroy\n @v1_chore = Chore.where(id: params[:id])\n if @v1_chore.destroy\n head(:ok)\n else\n head(:unprocessable_entity)\n end\n end",
"def destroy\n @client = Client.find(params[:client_id])\n @casenote = Casenote.find(params[:id])\n @casenote.destroy\n\n respond_to do |format|\n format.html { redirect_to client_casenotes_path(@client) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @clientcase = Clientcase.find(params[:id])\n @clientcase.destroy\n\n respond_to do |format|\n format.html { redirect_to clientcases_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @reqdifficulty.destroy\n respond_to do |format|\n format.html { redirect_to reqdifficulties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vote.destroy\n respond_to do |format|\n format.html { redirect_to votes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vote.destroy\n respond_to do |format|\n format.html { redirect_to votes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fundamental_alliance_leader_vote = Fundamental::AllianceLeaderVote.find(params[:id])\n @fundamental_alliance_leader_vote.destroy\n\n respond_to do |format|\n format.html { redirect_to fundamental_alliance_leader_votes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @challenge = Challenge.find(params[:id])\n @challenge.destroy\n\n respond_to do |format|\n format.html { redirect_to(challenges_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @challenge = Challenge.find(params[:id])\n @challenge.destroy\n\n respond_to do |format|\n format.html { redirect_to(challenges_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @election_user.destroy\n respond_to do |format|\n format.html { redirect_to election_users_url, notice: 'Election user was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @completion.destroy\n respond_to do |format|\n format.html { redirect_to completions_url, notice: 'Completion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @candidat.destroy\n respond_to do |format|\n format.html { redirect_to candidats_url, notice: 'Candidat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_suggested_course_pathway\n suggested_pathway = SuggestedPathway.find_by_id(params[:pathway_id])\n suggested_pathway.destroy\n render json: suggested_pathway\n end",
"def destroy\n @clonet = Clonet.find(params[:id])\n @clonet.destroy\n\n respond_to do |format|\n format.html { redirect_to clonets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client_need = ClientNeed.find(params[:id])\n @client_need.destroy\n\n respond_to do |format|\n format.html { redirect_to client_needs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n election.destroy\n\n respond_to do |format|\n format.html { redirect_to(elections_url, flash: { success: 'Election destroyed.' }) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cb_person.destroy\n respond_to do |format|\n format.html { redirect_to cb_people_url, notice: 'Cb person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solution = Solution.find(params[:id])\n @solution.destroy\n\n render json: { text: \"success\" }\n end",
"def destroy\n @challenge = Challenge.find(params[:id])\n @challenge.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_challenges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @borrow_request = BorrowRequest.find(params[:id])\n @borrow_request.destroy\n\n respond_to do |format|\n format.html { redirect_to borrow_requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crowd = Crowd.find(params[:id])\n @crowd.destroy\n\n respond_to do |format|\n format.html { redirect_to crowds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find(params[:group_id])\n @candidate = Candidate.find(params[:id])\n @candidate.destroy\n\n respond_to do |format|\n format.html { redirect_to group_candidates_path(@group) }\n format.xml { head :ok }\n end\n end",
"def destroy\n\t\trequire_admin!\n\t\t@election.destroy\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to elections_url, notice: 'Election was successfully destroyed.' }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend",
"def remove_candidate\n job_candidate = JobCandidate.where(:job_id => params[:job_id],\n :candidate_id => params[:candidate_id]).first\n authorize(job_candidate)\n job_candidate.status = JobCandidate.statuses[:deleted]\n job_candidate.save\n\n tracker = Mixpanel::Tracker.new(ENV[\"NT_MIXPANEL_TOKEN\"])\n tracker.track('employer-'+current_employer.email, 'removed candidate from job')\n\n redirect_to employer_show_path(params[:job_id]), notice: 'Candidate removed'\n end",
"def destroy\n @judge.destroy\n respond_to do |format|\n format.html { redirect_to judges_url, notice: 'Judge was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @response_challenge = ResponseChallenge.find(params[:id])\n @response_challenge.destroy\n\n respond_to do |format|\n format.html { redirect_to response_challenges_url }\n format.json { head :ok }\n end\n end",
"def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end",
"def destroy\n @proposal = Proposal.find(params[:id])\n @proposal.destroy\n\n respond_to do |format|\n format.html { redirect_to proposals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @proposal = Proposal.find(params[:id])\n @proposal.destroy\n\n respond_to do |format|\n format.html { redirect_to proposals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @collaborator = Collaborator.find(params[:id])\n @collaborator.destroy\n\n respond_to do |format|\n format.html { redirect_to collaborators_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @candidato = Candidato.find(params[:id])\n @candidato.destroy\n\n respond_to do |format|\n format.html { redirect_to candidatos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @candidato = Candidato.find(params[:id])\n @candidato.destroy\n\n respond_to do |format|\n format.html { redirect_to candidatos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @leaderboard = Leaderboard.find(params[:id])\n @leaderboard.destroy\n\n respond_to do |format|\n format.html { redirect_to leaderboards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vote = Vote.find(params[:id])\n @vote.destroy\n\n respond_to do |format|\n format.html { redirect_to votes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @vote = Vote.find(params[:id])\n @vote.destroy\n\n respond_to do |format|\n format.html { redirect_to votes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @vote = Vote.find(params[:id])\n @vote.destroy\n\n respond_to do |format|\n format.html { redirect_to votes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n block_non_user\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.7436304",
"0.7436304",
"0.7173674",
"0.717342",
"0.717342",
"0.717342",
"0.717342",
"0.717342",
"0.717342",
"0.717342",
"0.71688795",
"0.71688795",
"0.71688795",
"0.7083692",
"0.68879616",
"0.67611915",
"0.67196244",
"0.6716783",
"0.6708224",
"0.6674849",
"0.6648467",
"0.6633264",
"0.663056",
"0.66255254",
"0.6576449",
"0.6526477",
"0.65194345",
"0.65194345",
"0.64890724",
"0.642545",
"0.6422706",
"0.64081264",
"0.6396868",
"0.63886106",
"0.6381237",
"0.63802",
"0.636675",
"0.6365772",
"0.6364582",
"0.6348014",
"0.63422453",
"0.6327351",
"0.6324292",
"0.63236165",
"0.6322857",
"0.63193166",
"0.6297445",
"0.6291996",
"0.628649",
"0.62850165",
"0.62737197",
"0.62736523",
"0.6264915",
"0.6256736",
"0.6230692",
"0.6227171",
"0.6225559",
"0.6223271",
"0.6216569",
"0.6215832",
"0.6215332",
"0.62119544",
"0.62115073",
"0.62103444",
"0.6207261",
"0.6204181",
"0.62036335",
"0.6199471",
"0.6199471",
"0.61977476",
"0.61927426",
"0.61927426",
"0.6192732",
"0.61917764",
"0.61895466",
"0.61887217",
"0.6180557",
"0.6177055",
"0.6174683",
"0.61686796",
"0.61645234",
"0.616419",
"0.6163393",
"0.6159672",
"0.6159524",
"0.61511433",
"0.6149595",
"0.6149081",
"0.6148826",
"0.61476666",
"0.6146734",
"0.6146734",
"0.61462843",
"0.61453307",
"0.61453307",
"0.6143446",
"0.61318916",
"0.61318916",
"0.61318916",
"0.6129284"
] | 0.7097595 | 13 |
Use callbacks to share common setup or constraints between actions. | def set_candidate
@candidate = Candidate.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def candidate_params
params.require(:candidate).permit( :first_name,:last_name,:dob,:gender, :marital_status, :status,:languages,:summary)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def valid_params_request?; end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def url_whitelist; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def backend_user_params\n params.permit!\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.6981273",
"0.6783789",
"0.67460483",
"0.6742222",
"0.67354137",
"0.65934366",
"0.65028495",
"0.6497783",
"0.64826745",
"0.6479415",
"0.6456823",
"0.6440081",
"0.63800216",
"0.6376521",
"0.636652",
"0.6319898",
"0.6300256",
"0.62994003",
"0.6293621",
"0.6292629",
"0.6291586",
"0.629103",
"0.6282451",
"0.6243152",
"0.62413",
"0.6219024",
"0.6213724",
"0.62103724",
"0.61945",
"0.61786324",
"0.61755824",
"0.6173267",
"0.6163613",
"0.6153058",
"0.61521065",
"0.6147508",
"0.61234015",
"0.61168665",
"0.6107466",
"0.6106177",
"0.6091159",
"0.60817343",
"0.6071238",
"0.6062299",
"0.6021663",
"0.60182893",
"0.6014239",
"0.6011563",
"0.60080767",
"0.60080767",
"0.60028875",
"0.60005623",
"0.59964156",
"0.5993086",
"0.5992319",
"0.5992299",
"0.59801805",
"0.59676576",
"0.59606016",
"0.595966",
"0.59591126",
"0.59589803",
"0.5954058",
"0.5953234",
"0.5944434",
"0.5940526",
"0.59376484",
"0.59376484",
"0.5935253",
"0.5930846",
"0.5926387",
"0.59256274",
"0.5917907",
"0.5910841",
"0.590886",
"0.59086543",
"0.59060425",
"0.58981544",
"0.5898102",
"0.5896809",
"0.5895416",
"0.58947027",
"0.58923644",
"0.5887903",
"0.58830196",
"0.5880581",
"0.5873854",
"0.58697754",
"0.5869004",
"0.58669055",
"0.5866886",
"0.58664906",
"0.5864619",
"0.58630043",
"0.5862495",
"0.5861368",
"0.5859712",
"0.5855544",
"0.58551925",
"0.5851284",
"0.5850602"
] | 0.0 | -1 |
Creates an `and` type query matcher. All conditions in this type of matcher must pass to be considered a "match". It will shortcircuit in the case of a false match. | def and(*array_matchers, **keyword_matchers)
create_matcher('and', array_matchers, keyword_matchers)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def and_matcher(*args)\n AndMatcher.new(args)\n end",
"def and?\n AndPredicate.new self.to_parseable\n end",
"def andand(*spec)\n AndAnd.new(self, spec.flatten)\n end",
"def and_expr\n expr = equality()\n\n while match(:and)\n operator = previous()\n right = equality()\n expr = Expr::Logical.new expr, operator, right\n end\n\n expr\n end",
"def logical_and\n expr = equality\n\n while match?(:and)\n operator = previous\n right = equality\n expr = Ringo::Logical.new(expr, operator, right)\n end\n\n expr\n end",
"def and_clause\n a = factor_list\n\n space\n if accept(/and +/i)\n b = and_clause\n AST.new(:and, [a, b])\n else\n a\n end\n end",
"def and(query = nil, *args)\n merge_query(query, :and, *args) do |left, right|\n NSCompoundPredicate.andPredicateWithSubpredicates([left, right])\n end\n end",
"def andand(*)\n self\n end",
"def and(state)\n safe_statement(state) do |st|\n @statement = Sower::Relation::AndStatement.new(@statement,st)\n end\n end",
"def all_and(*args)\n Term.get AndTerm, *args\n end",
"def fn_and(*conditions)\n {\n \"Fn::And\" => conditions\n }\n end",
"def and_exp(expression)\n @use_conjunction = true\n @conjunction = @builder.and(@conjunction,expression)\n\n self\n end",
"def andp(rule, &block)\n ext(AndPredicate.new(rule), block)\n end",
"def andp(rule, &block)\n ext(AndPredicate.new(rule), block)\n end",
"def and(*exps)\n joined_exps = exps.join(' and ')\n @query[:filters] += \" and #{joined_exps}\"\n self\n end",
"def &(matcher)\n AndMatcher.new([self,matcher])\n end",
"def and(*others)\n self.class.and(self, *others)\n end",
"def And(concat)\n @condition.and when_factory(concat)\n end",
"def and!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 4 )\n\n type = AND\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 125:7: '&&'\n match( \"&&\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 4 )\n\n end",
"def and!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 59 )\n\n type = AND\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 387:7: '&&'\n match( \"&&\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 59 )\n\n end",
"def and( c )\n\t\t@conditions = self.class.and( conditions, c )\n\t\tself\n\tend",
"def and_ a, b\n self.and a, b\n end",
"def and(*cond, &block)\n raise(Error::NoExistingFilter, \"No existing filter found.\") unless @opts[:having] || @opts[:where]\n filter(*cond, &block)\n end",
"def logical_and\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 50 )\n return_value = LogicalAndReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n string_literal232 = nil\n bit_or231 = nil\n bit_or233 = nil\n\n tree_for_string_literal232 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 585:5: bit_or ( '&&' bit_or )*\n @state.following.push( TOKENS_FOLLOWING_bit_or_IN_logical_and_3869 )\n bit_or231 = bit_or\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, bit_or231.tree )\n end\n # at line 585:13: ( '&&' bit_or )*\n while true # decision 53\n alt_53 = 2\n look_53_0 = @input.peek( 1 )\n\n if ( look_53_0 == AND )\n alt_53 = 1\n\n end\n case alt_53\n when 1\n # at line 585:15: '&&' bit_or\n string_literal232 = match( AND, TOKENS_FOLLOWING_AND_IN_logical_and_3874 )\n if @state.backtracking == 0\n\n tree_for_string_literal232 = @adaptor.create_with_payload( string_literal232 )\n root_0 = @adaptor.become_root( tree_for_string_literal232, root_0 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_bit_or_IN_logical_and_3878 )\n bit_or233 = bit_or\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, bit_or233.tree )\n end\n\n else\n break # out of loop for decision 53\n end\n end # loop for decision 53\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 50 )\n\n end\n \n return return_value\n end",
"def &(ce)\n BooleanExpression.new(:AND, self, ce)\n end",
"def and!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 7 )\n\n\n\n type = AND\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 28:6: '&&'\n match( \"&&\" )\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__, 7 )\n\n\n end",
"def virtual_and(&block)\n virtualize_keyword(:and, @and_rewriter, block)\n end",
"def and_a\n end",
"def compose_and(first_condition, second_condition)\n validate_condition(first_condition)\n validate_condition(second_condition)\n first_condition.and(second_condition)\n end",
"def logical_and(input_a, input_b, name: nil)\n input_a, input_b = check_data_types(input_a, input_b)\n _op(:logical_and, input_a, input_b, name: name)\n end",
"def logical_and(input_a, input_b, name: nil)\n check_data_types(input_a, input_b)\n _op(:logical_and, input_a, input_b, name: name)\n end",
"def on_and(ast_node, context)\n left, right = *ast_node\n\n return on_call_boolean(context, left) && on_call_boolean(context, right)\n end",
"def and\n self\n end",
"def rewrite_and(expression)\n first = expression[1]\n second = expression[2]\n\n VirtualKeywords.call_operator_replacement(:call_and, first, second)\n end",
"def and(other)\n self\n end",
"def and *guards, &block\n if guards.empty? \n return self if not self\n else\n guards.each do |cond|\n return self if not send_as_function(cond)\n end\n end\n\n block_given? ? (yield_or_eval(&block) && self) : self\n end",
"def AndExpr(path, parsed); end",
"def bandand\n bandbool :and\n end",
"def and_b\n end",
"def bit_and\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 53 )\n return_value = BitAndReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal241 = nil\n equality240 = nil\n equality242 = nil\n\n tree_for_char_literal241 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 597:5: equality ( '&' equality )*\n @state.following.push( TOKENS_FOLLOWING_equality_IN_bit_and_3943 )\n equality240 = equality\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, equality240.tree )\n end\n # at line 597:14: ( '&' equality )*\n while true # decision 56\n alt_56 = 2\n look_56_0 = @input.peek( 1 )\n\n if ( look_56_0 == AMP )\n alt_56 = 1\n\n end\n case alt_56\n when 1\n # at line 597:17: '&' equality\n char_literal241 = match( AMP, TOKENS_FOLLOWING_AMP_IN_bit_and_3948 )\n if @state.backtracking == 0\n\n tree_for_char_literal241 = @adaptor.create_with_payload( char_literal241 )\n root_0 = @adaptor.become_root( tree_for_char_literal241, root_0 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_equality_IN_bit_and_3952 )\n equality242 = equality\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, equality242.tree )\n end\n\n else\n break # out of loop for decision 56\n end\n end # loop for decision 56\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 53 )\n\n end\n \n return return_value\n end",
"def &(expr2)\n Operator.new(S_AND, self, expr2)\n end",
"def and_(a)\n raise NotImplementedError\n end",
"def on_and(node)\n a, b = node.children.map { |c| @truth.fetch(c, process(c)) }\n\n if a == :true && b == :true\n :true\n elsif a == :false || b == :false\n :false\n else\n nil\n end\n end",
"def And(a, b)\n return a && b\nend",
"def test_unhygienic_andand\n andand = Unhygienic.\n from(:receiver, :message, [:parameters]) {\n receiver.andand.message(parameters)\n }.\n to {\n lambda { |andand_temp|\n andand_temp.message(parameters) if andand_temp\n }.call(receiver)\n }\n assert_equal(\n 'Hello' + ' World', \n with(andand) do\n 'Hello'.andand + ' World'\n end\n )\n assert_nil(\n with(andand) do\n nil.andand + ' World'\n end\n )\n end",
"def eval_and(args)\n # Convert all keys to symbols\n args[:attributes] = args[:attributes].each_with_object({}) { |(k, v), memo| memo[k.to_sym] = v } if args && args[:attributes]\n\n @matchers.all? do |matcher|\n if match_with_key?(matcher)\n matcher.match?(value: args[:matching_key])\n else\n matcher.match?(args)\n end\n end\n end",
"def and(other)\n raise TypeError, \"no conversion from #{other.class.name} to ClaimPredicate\" unless ClaimPredicate === other\n ClaimPredicate.new(ClaimPredicateType::AND, [self, other])\n end",
"def and_d\n end",
"def all &blk\n @condition_blocks << ConditionGroup.new(model, \"AND\", binding, @from, path, &blk)\n @condition_blocks.last\n end",
"def with_scope_with_and(query, &block)\n if Query === query && Query::Conditions::AbstractOperation === query.conditions\n query = query.dup\n scope_stack = self.scope_stack\n scope_stack << query\n\n begin\n yield\n ensure\n scope_stack.pop\n end\n\n else\n with_scope_without_and(query, &block)\n end\n end",
"def conditions(model, hash)\n validate_model(model)\n validate_hash(hash)\n\n definition = select_definition_from_model(model)\n cleaned_query_hash = Clearly::Query::Cleaner.new.do(hash)\n\n # default combiner is :and\n parse_conditions(definition, :and, cleaned_query_hash)\n end",
"def all(*assertions)\n AndAssertion.new(*assertions)\n end",
"def and_l\n end",
"def handle_AND(clause)\n \"#{clause.gsub!(' AND ', ' ').strip!}\"\n clause.gsub!('( ', '(')\n clause.gsub!(' )', ')')\n clause\n end",
"def test_and\n assert_false F & F, 'F & F'\n assert_false F & M, 'F & M'\n assert_false F & T, 'F & T'\n\n assert_false M & F, 'M & F'\n assert_maybe M & M, 'M & M'\n assert_maybe M & T, 'M & T'\n\n assert_false T & F, 'T & F'\n assert_maybe T & M, 'T & M'\n assert_true T & T, 'T & T'\n end",
"def & other\n call_enum \"boolean\", other, :and\n end",
"def and_c\n end",
"def and\n @conjuncted_restriction_type = :all_of\n @conjuncted_restriction = Restriction.new(@column)\n end",
"def and(other)\n if self && !self.nil?\n other\n else\n self\n end\n end",
"def and_to_a(to_and)\n @a &= to_and\n @f = 0x00\n @f |= H_FLAG\n @f |= Z_FLAG if @a == 0x00\n end",
"def process_and(exp)\n lhs = process exp.shift\n rhs = process exp.shift\n\n return \"#{lhs} && #{rhs}\"\n end",
"def fn_and(value)\n result = value.map do |val|\n apply_condition(val)\n end\n if result.to_s.include?(RUNTIME_MODIFIED)\n UNKNOWN_RUNTIME_RESULT\n else\n result.all?\n end\n end",
"def and_split(attr_list)\n expr.and_split(attr_list).map{|e| Predicate.new(e)}\n end",
"def match?(args)\n if @matchers.empty?\n @logger.log_if_debug('[CombiningMatcher] Matchers Empty')\n return false\n end\n\n case @combiner\n when Combiners::AND\n matches = eval_and(args)\n @logger.log_if_debug(\"[CombiningMatcher] Combiner AND result -> #{matches}\")\n return matches\n else\n @logger.log_if_debug(\"[CombiningMatcher] Invalid Combiner Type - Combiner -> #{@combiner}\")\n @logger.error('Invalid combiner type')\n end\n\n false\n end",
"def where(*args)\n self & Criteria.new(*args)\n end",
"def process_and(exp)\n a = exp.shift\n b = exp.shift\n\n res = without_result do\n want_expression do\n with_temporary_variable do |tmp|\n @local_variables_need_no_initialization.add(tmp)\n \"(#{tmp}=#{process(a)}, (#{tmp}!==false&&#{tmp}!==nil) ? (#{process(b)}) : #{tmp})\"\n end\n end\n end\n\n return resultify(res)\n end",
"def and(other_predicate)\n if self == other_predicate then self\n elsif other_predicate.kind_of?(UnboundTaskPredicate::False)\n other_predicate\n else\n And.new(self, other_predicate)\n end\n end",
"def and_relation(relation)\n q = all\n q = q.where(relation.where_clause.ast) if relation.where_clause.present?\n q = q.joins(relation.joins_values + q.joins_values) if relation.joins_values.present?\n q = q.order(relation.order_values) if relation.order_values.present?\n q\n end",
"def allquerymatchers(start_date, end_date, type, category)\n [\n QueryDateMatcher.new(start_date, end_date),\n QueryTypeMatcher.new(type),\n QueryCategoryMatcher.new(category)\n ]\n end",
"def and(e1, e2)\n eval_ex(e1) & eval_ex(e2)\n end",
"def AND(x,y); \tif x==1 && y==1 \tthen 1 else 0 end; end",
"def and(other)\n to_unbound_task_predicate\n .and(other.to_unbound_task_predicate)\n end",
"def querymatchers(start_date, end_date, type, category)\n matchers = []\n matchers << QueryDateMatcher.new(start_date, end_date) unless start_date.nil? && end_date.nil?\n matchers << QueryTypeMatcher.new(type) unless type.nil?\n matchers << QueryCategoryMatcher.new(category) unless category.nil?\n matchers\n end",
"def and_h\n end",
"def and_op(left, right, result) #method\n left = get_dir(left)\n right = get_dir(right)\n @current_context[result] = get_value(left) && get_value(right)\n end",
"def like(table, column, value, and_or=\"and\", ignore_case=false)\n return like_ignore_case(table,column,value,and_or) if ignore_case\n if and_or == \"and\"\n and_exp(@builder.like(@alias[table].get(column),value))\n else\n or_exp(@builder.like(@alias[table].get(column),value))\n end\n self\n end",
"def in(table,column,list,and_or=\"and\")\n if and_or == \"and\"\n @use_conjunction = true\n @conjunction = @builder.and(@conjunction,@builder.in(@alias[table].get(column),list))\n else # or\n @use_disjunction = true\n @disjunction = @builder.and(@disjunction,@builder.in(@alias[table].get(column),list))\n end\n self\n end",
"def m_ar_and_chain_1\n Rows.where(:x && :y)\n end",
"def where_and(str)\n str.include?('WHERE') ? 'AND' : 'WHERE'\nend",
"def search query\n @content = @reader.read if @content.nil?\n @content.select do |doc|\n rs = []\n query.terms.each do |term|\n if term.compare(doc.send(term.field))\n rs << true\n end\n end\n if query.relation == :and\n rs.count == query.terms.count\n else\n !rs.empty?\n end\n end\n end",
"def test_conjunction_and\n processor_ = ::Sawmill::EntryProcessor::build do\n If(And(FilterByBasicFields(:progname => 'rails'),\n FilterByBasicFields(:level => :WARN)), @entries)\n end\n @logger = ::Sawmill::Logger.new(:processor => processor_)\n @logger.warn('Hello 1')\n @logger.warn('rails') {'Hello 2'}\n @logger.info('rails') {'Hello 3'}\n @logger.info('Hello 4')\n assert_equal('Hello 2', @entries.dequeue.message)\n assert_equal(0, @entries.size)\n end",
"def and(other)\n factory.and_node(left_child: self.dup,\n right_child: other)\n end",
"def matches_conditions?(object, query); end",
"def and other_result\n result = dup\n result.matched = hash_intersection(matched, other_result.matched)\n result.not_matched = hash_intersection(not_matched, other_result.not_matched)\n result\n end",
"def where(table, column, value, and_or=\"and\", ignore_case=false)\n if ignore_case\n return where_ignore_case(table, column, value, and_or)\n end\n if and_or == \"and\"\n and_exp(@builder.equal(@alias[table].get(column),value))\n else # or\n or_exp(@builder.equal(@alias[table].get(column),value))\n end\n self\n end",
"def and_e\n end",
"def query\n\t\tQuery.new(\"true\")\n\tend",
"def call_and(caller_object, first, second)\n and_lambda = lambda_or_raise(caller_object, :and)\n and_lambda.call(first, second)\n end",
"def initialize model, from_record = nil, &blk\n @model = model\n @joins = nil\n @from = from_record\n @binding = blk && blk.binding\n @conditions = ConditionGroup.new(@model, \"AND\", @binding, @from, &blk)\n @conditions.assign_joins( join_dependency )\n end",
"def and(other_rule)\n ValidateMyRoutes::ValidationRules.and(self, other_rule)\n end",
"def find_class_options_for_query_with_and(query, options={})\n options\n end",
"def filter_expr(expr = nil, &block)\n expr = nil if expr == EMPTY_ARRAY\n\n if block\n cond = filter_expr(Sequel.virtual_row(&block))\n cond = SQL::BooleanExpression.new(:AND, filter_expr(expr), cond) if expr\n return cond\n end\n\n case expr\n when Hash\n SQL::BooleanExpression.from_value_pairs(expr)\n when Array\n if Sequel.condition_specifier?(expr)\n SQL::BooleanExpression.from_value_pairs(expr)\n else\n raise Error, \"Invalid filter expression: #{expr.inspect}\"\n end\n when LiteralString\n LiteralString.new(\"(#{expr})\")\n when Numeric, SQL::NumericExpression, SQL::StringExpression, Proc, String\n raise Error, \"Invalid filter expression: #{expr.inspect}\"\n when TrueClass, FalseClass\n if supports_where_true?\n SQL::BooleanExpression.new(:NOOP, expr)\n elsif expr\n SQL::Constants::SQLTRUE\n else\n SQL::Constants::SQLFALSE\n end\n when PlaceholderLiteralizer::Argument\n expr.transform{|v| filter_expr(v)}\n when SQL::PlaceholderLiteralString\n expr.with_parens\n else\n expr\n end\n end",
"def filter(*cond, &block)\n clause = (@opts[:having] ? :having : :where)\n cond = cond.first if cond.size == 1\n raise(Error::InvalidFilter, \"Invalid filter specified. Did you mean to supply a block?\") if cond === true || cond === false\n cond = transform_save(cond) if @transform if cond.is_a?(Hash)\n cond = filter_expr(block || cond)\n cond = SQL::BooleanExpression.new(:AND, @opts[clause], cond) if @opts[clause] && !@opts[clause].blank?\n clone(clause => cond)\n end",
"def parse_term\r\n parse_factor\r\n while(@cur_token.kind == :AND)\r\n accept_it\r\n if(@cur_token.kind == :NOT)\r\n accept_it\r\n end\r\n parse_factor\r\n end\r\n end",
"def parse_lexprs()\n\t\tputs \"parsing logical expressions\"\n\t\tif (next_TokenGrabbed( \"and\") and parse_lterm() and parse_lexprs()) \n\t\t\ttrue\n\t\telsif (next_TokenGrabbed(\"and\") and parse_lterm()) #FIXME: formatting\n\t\t\ttrue\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend",
"def evaluate(operator=\"and\")\n unless operator == \"and\" || operator == \"or\"\n raise(ArgumentError, \"operator must be 'and' or 'or'\")\n end\n \n result_data = {}\n\n @conditions.each do |condition|\n result_data[condition[0]] = condition[1].call\n end\n \n result = case operator\n when \"and\"\n result_data.all? { |name, result| result }\n when \"or\"\n result_data.any? { |name, result| result }\n end\n \n return result, result_data\n end",
"def one_of_these(conditions, options = nil)\n options = process_bool_options!(options)\n options[:root][:bool] = {} unless options[:root][:bool]\n options[:root][:bool][:must] = [] unless options[:root][:bool][:must]\n options[:root] = options[:root][:bool][:must]\n\n options[:append] = true\n add_bool_condition(:should, conditions, options)\n end",
"def scan_for_and(token); end",
"def query\n ([query_for_one_keyword] * split_query_string.size).join(' AND ')\n end"
] | [
"0.8204355",
"0.7808722",
"0.7691399",
"0.76274705",
"0.75500953",
"0.7413053",
"0.7325874",
"0.70669675",
"0.6977767",
"0.6858834",
"0.6840731",
"0.6814311",
"0.6762778",
"0.6762778",
"0.66700894",
"0.66392523",
"0.66197526",
"0.66174436",
"0.66068053",
"0.65912163",
"0.6535253",
"0.6527148",
"0.65066123",
"0.6465072",
"0.6454623",
"0.64426863",
"0.64127207",
"0.6408625",
"0.6398699",
"0.6313698",
"0.62888974",
"0.6177429",
"0.615284",
"0.6123027",
"0.6109078",
"0.6107453",
"0.6099622",
"0.60920835",
"0.60280514",
"0.5971109",
"0.5931251",
"0.5917831",
"0.5915077",
"0.589767",
"0.5845618",
"0.5826373",
"0.5821892",
"0.57854956",
"0.57747304",
"0.5741716",
"0.5738727",
"0.5682382",
"0.5674022",
"0.56691927",
"0.5668577",
"0.5648242",
"0.5642111",
"0.5572509",
"0.5557555",
"0.5503808",
"0.5503624",
"0.54563123",
"0.545307",
"0.5437649",
"0.54366606",
"0.54109335",
"0.54103726",
"0.54064184",
"0.53745633",
"0.53733677",
"0.5371402",
"0.531598",
"0.5294252",
"0.52871376",
"0.5260068",
"0.52569693",
"0.5252497",
"0.52094996",
"0.5205254",
"0.5194766",
"0.5181887",
"0.5168131",
"0.5158011",
"0.5153936",
"0.5147569",
"0.5084672",
"0.50784624",
"0.50627726",
"0.5049168",
"0.50458103",
"0.504105",
"0.50392324",
"0.502725",
"0.5005668",
"0.49887177",
"0.4959343",
"0.49592796",
"0.4927019",
"0.4922077"
] | 0.72061265 | 7 |
Creates an `or` type query matcher. Any conditions in this type of matcher must pass to be considered a "match". It will shortcircuit in the case of a true match. | def or(*array_matchers, **keyword_matchers)
create_matcher('or', array_matchers, keyword_matchers)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def or_matcher(*args)\n OrMatcher.new(args)\n end",
"def logical_or\n expr = logical_and\n\n while match?(:or)\n operator = previous\n right = logical_and\n expr = Ringo::Logical.new(expr, operator, right)\n end\n\n expr\n end",
"def or_clause\n a = and_clause\n\n space\n if accept(/or +/i)\n b = or_clause\n AST.new(:or, [a, b])\n else\n a\n end\n end",
"def or(query = nil, *args)\n merge_query(query, :or, *args) do |left, right|\n NSCompoundPredicate.orPredicateWithSubpredicates([left, right])\n end\n end",
"def or(arg)\n if condition_specifier?(arg)\n SQL::BooleanExpression.from_value_pairs(arg, :OR, false)\n else\n raise Error, 'must pass a conditions specifier to Sequel.or'\n end\n end",
"def or_expr\n expr = and_expr()\n\n while match(:or)\n operator = previous()\n right = and_expr()\n expr = Expr::Logical.new expr, operator, right\n end\n\n expr\n end",
"def combine_or(left, right)\n OrQuery.new(left, right)\n end",
"def or(*cond, &block)\n if @opts[:where].nil?\n self\n else\n add_filter(:where, cond, false, :OR, &block)\n end\n end",
"def or(*cond, &block)\n clause = (@opts[:having] ? :having : :where)\n cond = cond.first if cond.size == 1\n if @opts[clause]\n clone(clause => SQL::BooleanExpression.new(:OR, @opts[clause], filter_expr(block || cond)))\n else\n raise Error::NoExistingFilter, \"No existing filter found.\"\n end\n end",
"def or\n @options[:conditional_operator] = \"OR\"\n self\n end",
"def or(*exps)\n joined_exps = exps.join(' and ')\n @query[:filters] += \" or #{joined_exps}\"\n self\n end",
"def or( *args ); { $or => args } end",
"def or_exp(expression)\n @use_disjunction = true\n @disjunction = @builder.and(@disjunction,expression)\n\n self\n end",
"def or( c )\n\t\t@conditions = self.class.or( conditions, c )\n\t\tself\n\tend",
"def fn_or(*conditions)\n {\n \"Fn::Or\" => conditions\n }\n end",
"def or(state)\n OrStatement.new(self, state)\n end",
"def or(*conditions)\n unless (2..10).cover?(conditions.length)\n raise ArgumentError, \"You must specify AT LEAST 2 and AT MOST 10 conditions\"\n end\n {\"Fn::Or\" => conditions}\n end",
"def or(*others)\n self.class.or(self, *others)\n end",
"def or_filter(filters)\n @orFilter ||= {}\n @orFilter.merge!(filters)\n self\n end",
"def |(matcher)\n OrMatcher.new([self,matcher])\n end",
"def |(ce)\n BooleanExpression.new(:OR, self, ce)\n end",
"def virtual_or(&block)\n virtualize_keyword(:or, @or_rewriter, block)\n end",
"def compose_or(first_condition, second_condition)\n validate_condition(first_condition)\n validate_condition(second_condition)\n first_condition.or(second_condition)\n end",
"def all_or(*args)\n Term.get OrTerm, *args\n end",
"def logical_or\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 49 )\n return_value = LogicalOrReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n string_literal229 = nil\n logical_and228 = nil\n logical_and230 = nil\n\n tree_for_string_literal229 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 581:5: logical_and ( '||' logical_and )*\n @state.following.push( TOKENS_FOLLOWING_logical_and_IN_logical_or_3844 )\n logical_and228 = logical_and\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, logical_and228.tree )\n end\n # at line 581:17: ( '||' logical_and )*\n while true # decision 52\n alt_52 = 2\n look_52_0 = @input.peek( 1 )\n\n if ( look_52_0 == OR )\n alt_52 = 1\n\n end\n case alt_52\n when 1\n # at line 581:20: '||' logical_and\n string_literal229 = match( OR, TOKENS_FOLLOWING_OR_IN_logical_or_3849 )\n if @state.backtracking == 0\n\n tree_for_string_literal229 = @adaptor.create_with_payload( string_literal229 )\n root_0 = @adaptor.become_root( tree_for_string_literal229, root_0 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_logical_and_IN_logical_or_3853 )\n logical_and230 = logical_and\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, logical_and230.tree )\n end\n\n else\n break # out of loop for decision 52\n end\n end # loop for decision 52\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 49 )\n\n end\n \n return return_value\n end",
"def or(policy, *others)\n __factory_method__(Or, policy, others)\n end",
"def or(query_hash)\n self | self.class.new(query_hash)\n end",
"def expr\n or_expr\n end",
"def or *guards, &block\n if guards.empty? \n return self if self\n else\n guards.each do |cond|\n return self if send_as_function(cond)\n end\n end\n\n block_given? ? yield_or_eval(&block) : self\n end",
"def or(state)\n safe_statement(state) do |st|\n @statement = Sower::Relation::OrStatement.new(@statement,st)\n end\n end",
"def or( *filterspec )\n\t\topts = self.options\n\t\texisting_filter = self.filter\n\t\traise Treequel::ExpressionError, \"no existing filter\" if\n\t\t\texisting_filter.promiscuous?\n\n\t\tnewfilter = Treequel::Filter.new( *filterspec )\n\n\t\tself.log.debug \"cloning %p with alternative filterspec: %p\" % [ self, filterspec ]\n\t\treturn self.clone( :filter => (self.filter | newfilter) )\n\tend",
"def |(expr2)\n Operator.new(S_OR, self, expr2)\n end",
"def rewrite_or(expression)\n first = expression[1]\n second = expression[2]\n\n VirtualKeywords.call_operator_replacement(:call_or, first, second)\n end",
"def or(other)\n raise TypeError, \"no conversion from #{other.class.name} to ClaimPredicate\" unless ClaimPredicate === other\n ClaimPredicate.new(ClaimPredicateType::OR, [self, other])\n end",
"def or!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 60 )\n\n type = OR\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 388:6: '||'\n match( \"||\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 60 )\n\n end",
"def or(attribute, value, options = {})\n options[:comparison] ||= value.is_a?(Regexp) ? :match : '=='\n if empty?\n @type.where(attribute, value, comparison: options[:comparison], api_client: @api_client)\n else\n merge first.class.where(\n attribute, value,\n comparison: options[:comparison],\n api_client: @api_client\n )\n end\n end",
"def or!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 72 )\n\n type = OR\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 193:6: '||'\n match( \"||\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 72 )\n\n end",
"def or(other)\n other\n end",
"def test_or\n assert_false F | F, 'F | F'\n assert_maybe F | M, 'F | M'\n assert_true F | T, 'F | T'\n\n assert_maybe M | F, 'M | F'\n assert_maybe M | M, 'M | M'\n assert_true M | T, 'M | T'\n\n assert_true T | F, 'T | F'\n assert_true T | M, 'T | M'\n assert_true T | T, 'T | T'\n end",
"def |(other)\n Or.new(self, other)\n end",
"def on_or(ast_node, context)\n left, right = *ast_node\n\n return on_call_boolean(context, left) || on_call_boolean(context, right)\n end",
"def any &blk\n @condition_blocks << ConditionGroup.new(model, \"OR\", binding, @from, path, &blk)\n @condition_blocks.last\n end",
"def or(argument1, argument2)\n argument1 || argument2\n end",
"def OrExpr(path, parsed); end",
"def or!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 8 )\n\n\n\n type = OR\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 29:5: '||'\n match( \"||\" )\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__, 8 )\n\n\n end",
"def or(other)\n if self && !self.nil?\n self\n else\n other\n end\n end",
"def getOr_ r\n or_= []; del_ = []; cur = []\n status = :start\n x = 0\n while x < r.length do\n if r[x] == OR_OPERATOR\n if status == :start\n cur = [r[x-1]]\n status = :cont\n del_.push x-1\n end\n cur.push r[x+1]\n del_ += [x, x+1]\n x += 2\n else\n if status == :cont\n status = :start\n or_.push cur\n cur = []\n end\n x += 1\n end\n end\n if not cur.empty?\n or_.push cur\n end\n return or_, del_\n end",
"def |(validator)\n OrValidator.new(self, Waw::Validation.to_validator(validator))\n end",
"def op_asgn_or(exp, level)\n process s(:or, exp.shift, exp.shift), :expression\n end",
"def or_b\n end",
"def or(other_rule)\n ValidateMyRoutes::ValidationRules.or(self, other_rule)\n end",
"def or(other)\n to_unbound_task_predicate\n .or(other.to_unbound_task_predicate)\n end",
"def generate_OR_clauses(rule)\n #First, split rule into positive and negative sets of clauses.\n parts = rule.split(@NOT)\n positive_clauses = parts[0]\n negative_clauses = parts[1]\n\n @or_clauses_pos = positive_clauses.split('OR')\n @or_clauses_neg = negative_clauses.split('OR')\n end",
"def |( other_filter )\n\t\treturn other_filter if self.promiscuous?\n\t\treturn self.dup if other_filter.promiscuous?\n\n\t\t# Collapse nested ORs into a single one with an additional alternation\n\t\t# if possible.\n\t\tif self.component.respond_to?( :add_alternation )\n\t\t\tself.log.debug \"collapsing nested ORs...\"\n\t\t\tnewcomp = self.component.dup\n\t\t\tnewcomp.add_alternation( other_filter )\n\t\t\treturn self.class.new( newcomp )\n\t\telse\n\t\t\treturn self.class.new( :or, [self, other_filter] )\n\t\tend\n\tend",
"def on_or(node)\n a, b = node.children.map { |c| @truth.fetch(c, process(c)) }\n\n if a == :true || b == :true\n :true\n elsif a == :false && b == :false\n :false\n else\n nil\n end\n end",
"def or_filters\n read_attribute('or_filters') || {}\n end",
"def or(other_predicate)\n if self == other_predicate then self\n elsif other_predicate.kind_of?(UnboundTaskPredicate::False)\n self\n else\n Or.new(self, other_predicate)\n end\n end",
"def or_a\n end",
"def process_or(exp)\n lhs = process exp.shift\n rhs = process exp.shift\n\n return \"#{lhs} || #{rhs}\"\n end",
"def | other\n call_enum \"boolean\", other, :or\n end",
"def test_unique_predicate_or\n g = Grammar.new(\"parser grammar v;\\n\" + \"\\n\" + \"a : {a}? b\\n\" + \" | {b}? b\\n\" + \" ;\\n\" + \"\\n\" + \"b : {c}? (X)+ ;\\n\" + \"\\n\" + \"c : a\\n\" + \" | b\\n\" + \" ;\\n\")\n expecting = \".s0-X->.s1\\n\" + \".s1-{((b&&c)||(a&&c))}?->:s2=>1\\n\" + \".s1-{c}?->:s3=>2\\n\"\n unreachable_alts = nil\n non_det_alts = nil\n ambig_input = nil\n insufficient_pred_alts = nil\n dangling_alts = nil\n num_warnings = 0\n check_decision(g, 3, expecting, unreachable_alts, non_det_alts, ambig_input, insufficient_pred_alts, dangling_alts, num_warnings, false)\n end",
"def or(value=nil, &block)\n return Failure(block.call(@value)) if failure? && block_given?\n return Failure(value) if failure?\n return self\n end",
"def AppendClauseOr(clause,phrase)\n if 0<clause.length then\n clause << \" OR \"\n end\n clause << phrase\n return clause\n end",
"def or_not( c )\n\t\t@conditions = self.class.or_not( conditions, c )\n\t\tself\n\tend",
"def expr\n space\n\n if accept(\"(\")\n self.unclosed_parens += 1\n a = or_clause\n expect(\")\")\n self.unclosed_parens -= 1\n a\n else\n term\n end\n end",
"def process_or(exp)\n a = exp.shift\n b = exp.shift\n\n res = without_result do\n want_expression do\n with_temporary_variable do |tmp|\n @local_variables_need_no_initialization.add(tmp)\n \"(#{tmp}=#{process(a)}, (#{tmp}!==false&&#{tmp}!==nil) ? #{tmp} : (#{process(b)}))\"\n end\n end\n end\n\n return resultify(res)\n end",
"def add_or_filter(field, operator, values=nil)\n # values must be an array\n return unless values.nil? || values.is_a?(Array)\n # check if field is defined as an available filter\n if available_filters.has_key? field\n filter_options = available_filters[field]\n or_filters[field] = {:operator => operator, :values => (values || [''])}\n end\n end",
"def or\n @conjuncted_restriction_type = :any_of\n @conjuncted_restriction = Restriction.new(@column)\n end",
"def or_(a)\n if ((a).nil?)\n return self\n end\n s = self.clone\n s.or_in_place(a)\n return s\n end",
"def or_l\n end",
"def add_or\n\t\t@filters.push([]) if @filters.last && @filters.last.size > 0\n\t\treturn self\n\tend",
"def or_else(*args, &block)\n Utils.assert_arg_or_block!(\"or_else\", *args, &block)\n super.tap do |result|\n Utils.assert_type!(result, left_class, right_class)\n end\n end",
"def rewrite_opts\n rewrite do |ast|\n # ... ~A ~B ... = ... (or A B) ...\n # ... ~A ... = ... (or A) ... = ... A ...\n if ast.children.any?(&:opt?)\n opts, non_opts = ast.children.partition(&:opt?)\n or_node = node(:or, *opts.flat_map(&:children))\n node(ast.type, or_node, *non_opts)\n else\n ast\n end\n end\n end",
"def or other_result\n result = dup\n result.matched = hash_union(matched, other_result.matched)\n result.not_matched = hash_union(not_matched, other_result.not_matched)\n result\n end",
"def or(e1, e2)\n eval_ex(e1) | eval_ex(e2)\n end",
"def combine exp, line = nil\n combined = Sexp.new(:or, self, exp).line(line || -2)\n\n combined.or_depth = [self.or_depth, exp.or_depth].compact.reduce(0, :+) + 1\n\n combined\n end",
"def match?(args)\n if @matchers.empty?\n @logger.log_if_debug('[CombiningMatcher] Matchers Empty')\n return false\n end\n\n case @combiner\n when Combiners::AND\n matches = eval_and(args)\n @logger.log_if_debug(\"[CombiningMatcher] Combiner AND result -> #{matches}\")\n return matches\n else\n @logger.log_if_debug(\"[CombiningMatcher] Invalid Combiner Type - Combiner -> #{@combiner}\")\n @logger.error('Invalid combiner type')\n end\n\n false\n end",
"def expander\n # convert or-clause into expander\n elements = @elements.map do |elt|\n elt.kind_of?(OrExpr) ? elt.expander : elt\n end\n # return an enumerator\n return Enumerator.new {|y| choose_concrete_expr(y, elements, [], nil, 0) }\n end",
"def m_ar_or_chain_1\n Rows.where(:x || :y)\n end",
"def or_c\n end",
"def process_op_asgn_or(exp)\n ref = exp.shift\n asgn = exp.shift\n asgn[2] = [:or, ref, asgn[2]]\n process(asgn)\n end",
"def split_or_clauses(args)\n level = 0\n i = 0\n or_positions = []\n while i < args.length\n arg = args[i]\n if arg == BOOLEAN_OR && level == 0\n or_positions << i\n end\n if arg == OPEN_PAREN\n level += 1\n elsif arg == CLOSE_PAREN\n level -= 1\n if level == -1\n or_positions << i\n return or_positions\n end\n end\n i += 1\n end\n or_positions << args.length unless or_positions.empty?\n or_positions\nend",
"def or_d\n end",
"def or_asgn!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 74 )\n\n type = OR_ASGN\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 195:11: '||='\n match( \"||=\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 74 )\n\n end",
"def parse_expression\r\n parse_term\r\n while(@cur_token.kind == :OR)\r\n accept_it\r\n parse_term\r\n end\r\n end",
"def test_conjunction_or\n processor_ = ::Sawmill::EntryProcessor::build do\n If(Or(FilterByBasicFields(:progname => 'rails'),\n FilterByBasicFields(:level => :WARN)), @entries)\n end\n @logger = ::Sawmill::Logger.new(:processor => processor_)\n @logger.warn('Hello 1')\n @logger.warn('rails') {'Hello 2'}\n @logger.info('rails') {'Hello 3'}\n @logger.info('Hello 4')\n assert_equal('Hello 1', @entries.dequeue.message)\n assert_equal('Hello 2', @entries.dequeue.message)\n assert_equal('Hello 3', @entries.dequeue.message)\n assert_equal(0, @entries.size)\n end",
"def find_class_options_for_query_with_or(query, options={})\n options\n end",
"def call_or(caller_object, first, second)\n or_lambda = lambda_or_raise(caller_object, :or)\n or_lambda.call(first, second)\n end",
"def find_or(method, attrs = {}, &block)\n where(attrs).first || send(method, attrs, &block)\n end",
"def &(matcher)\n AndMatcher.new([self,matcher])\n end",
"def matches_conditions?(object, query); end",
"def and_matcher(*args)\n AndMatcher.new(args)\n end",
"def test_or_implies(stmt)\n l = eval_side(stmt.left)\n r = eval_side(stmt.right)\n if !l.nil? && !l\n set_truth(stmt.right.left) if stmt.right.type == :terminal\n elsif !r.nil? && !r\n set_truth(stmt.left.left) if stmt.left.type == :terminal\n end\n end",
"def ~(arg)\n if condition_specifier?(arg)\n SQL::BooleanExpression.from_value_pairs(arg, :OR, true)\n else\n SQL::BooleanExpression.invert(arg)\n end\n end",
"def bit_or\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 51 )\n return_value = BitOrReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal235 = nil\n bit_xor234 = nil\n bit_xor236 = nil\n\n tree_for_char_literal235 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 589:5: bit_xor ( '|' bit_xor )*\n @state.following.push( TOKENS_FOLLOWING_bit_xor_IN_bit_or_3894 )\n bit_xor234 = bit_xor\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, bit_xor234.tree )\n end\n # at line 589:13: ( '|' bit_xor )*\n while true # decision 54\n alt_54 = 2\n alt_54 = @dfa54.predict( @input )\n case alt_54\n when 1\n # at line 589:15: '|' bit_xor\n char_literal235 = match( PIPE, TOKENS_FOLLOWING_PIPE_IN_bit_or_3898 )\n if @state.backtracking == 0\n\n tree_for_char_literal235 = @adaptor.create_with_payload( char_literal235 )\n root_0 = @adaptor.become_root( tree_for_char_literal235, root_0 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_bit_xor_IN_bit_or_3902 )\n bit_xor236 = bit_xor\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, bit_xor236.tree )\n end\n\n else\n break # out of loop for decision 54\n end\n end # loop for decision 54\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 51 )\n\n end\n \n return return_value\n end",
"def join_with_or ar, **options\n\n\t\t::Xqsr3::Quality::ParameterChecking.check_parameter ar, 'ar', type: ::Array, allow_nil: true\n\t\t::Xqsr3::Quality::ParameterChecking.check_parameter options, 'options', type: ::Hash, allow_nil: false\n\n\t\t::Xqsr3::Quality::ParameterChecking.check_parameter options[:or], ':or', type: ::String, option: true, allow_nil: true\n\t\t::Xqsr3::Quality::ParameterChecking.check_parameter options[:oxford_comma], ':oxford_comma', types: [ ::FalseClass, ::TrueClass ], option: true, allow_nil: true\n\t\t::Xqsr3::Quality::ParameterChecking.check_parameter options[:quote_char], ':quote_char', type: ::String, option: true, allow_nil: true\n\t\t::Xqsr3::Quality::ParameterChecking.check_parameter options[:separator], ':separator', type: ::String, option: true, allow_nil: true\n\n\t\treturn '' if ar.nil?\n\t\treturn '' if ar.empty?\n\n\t\tseparator\t=\toptions[:separator] || ','\n\t\tor_word\t\t=\toptions[:or] || 'or'\n\t\tox_comma\t=\t(options.has_key?(:oxford_comma) && !options[:oxford_comma]) ? '' : separator\n\t\tquote_char\t=\toptions[:quote_char]\n\n\t\tar\t\t\t=\tar.map { |v| \"#{quote_char}#{v}#{quote_char}\" } if quote_char\n\n\t\tcase ar.size\n\t\twhen 1\n\t\t\tar[0]\n\t\twhen 2\n\t\t\t\"#{ar[0]} #{or_word} #{ar[1]}\"\n\t\telse\n\t\t\t\"#{ar[0...-1].join(separator + ' ')}#{ox_comma} #{or_word} #{ar[-1]}\"\n\t\tend\n\tend",
"def one_of_these(conditions, options = nil)\n options = process_bool_options!(options)\n options[:root][:bool] = {} unless options[:root][:bool]\n options[:root][:bool][:must] = [] unless options[:root][:bool][:must]\n options[:root] = options[:root][:bool][:must]\n\n options[:append] = true\n add_bool_condition(:should, conditions, options)\n end",
"def |(other)\n `return other.$r ? Qtrue : Qfalse;`\n end",
"def exclusive_or (p,q)\n p ^ q\nend"
] | [
"0.8073155",
"0.7510881",
"0.74621046",
"0.74611366",
"0.7448392",
"0.7437346",
"0.725626",
"0.7201213",
"0.711074",
"0.71020234",
"0.70318335",
"0.69977015",
"0.69072336",
"0.6886803",
"0.6853424",
"0.677621",
"0.6762472",
"0.6727602",
"0.6656749",
"0.6636346",
"0.6588634",
"0.65512675",
"0.65427506",
"0.65343034",
"0.64996976",
"0.6474419",
"0.644493",
"0.64390045",
"0.6418251",
"0.63819885",
"0.63695115",
"0.63162977",
"0.62878865",
"0.62690943",
"0.62670505",
"0.62513375",
"0.62506235",
"0.6201597",
"0.6173655",
"0.6166623",
"0.6092726",
"0.6025997",
"0.5960312",
"0.5941086",
"0.5934638",
"0.5870775",
"0.5866646",
"0.58619547",
"0.57837576",
"0.5777676",
"0.5693654",
"0.5690954",
"0.56848276",
"0.5652002",
"0.5618198",
"0.55952346",
"0.55913794",
"0.55418384",
"0.55271125",
"0.5525203",
"0.5515425",
"0.5515057",
"0.55106723",
"0.5463855",
"0.5462782",
"0.5448108",
"0.5428197",
"0.54281163",
"0.54256696",
"0.5389905",
"0.53620493",
"0.53238845",
"0.5319953",
"0.5303807",
"0.5283954",
"0.52655876",
"0.52388406",
"0.520288",
"0.519783",
"0.51975465",
"0.5188491",
"0.5178646",
"0.5174917",
"0.51611876",
"0.5158968",
"0.5149135",
"0.5148175",
"0.5120133",
"0.5103165",
"0.503474",
"0.5018835",
"0.5015414",
"0.50053567",
"0.49842662",
"0.49626717",
"0.4961173",
"0.49390417",
"0.49332032",
"0.49240723"
] | 0.730983 | 6 |
Creates a `not` type query matcher. No conditions in this type of matcher should pass to be considered a "match". It will shortcircuit in the case of a true match. | def not(*array_matchers, **keyword_matchers)
create_matcher('not', array_matchers, keyword_matchers)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def not_matcher(matcher)\n NotMatcher.new(matcher)\n end",
"def not( *filterspec )\n\t\tself.log.debug \"cloning %p with negated filterspec: %p\" % [ self, filterspec ]\n\t\tnotfilter = Treequel::Filter.new( :not, *filterspec )\n\t\treturn self.clone( :filter => self.filter + notfilter )\n\tend",
"def where_not(*args)\n build_deeper_query(WhereClause, args, not: true)\n end",
"def hasNot(*conditions)\n nor_hash = {\n :== => :!=,\n :!= => :==,\n :< => :>=,\n :<= => :> ,\n :>= => :<,\n :> => :<=,\n }\n\n if conditions.size == 1\n self.class.new( where( conditions[0], :==, nil ) )\n elsif conditions.size == 2\n where( conditions[0], :!=, conditions[1] )\n elsif conditions.size == 3\n where( conditions[0], nor_hash[conditions[1]], conditions[2] )\n end\n end",
"def parse_logical_not_expression\n next_token # = skip NOT operator\n negated_expression = case peek_token\n when :not; parse_logical_not_expression\n when :lparen; parse_expression_sequence\n else parse_comparison\n end\n\n raise ScopedSearch::QueryNotSupported, \"No operands found\" if negated_expression.empty?\n return ScopedSearch::QueryLanguage::AST::OperatorNode.new(:not, [negated_expression])\n end",
"def must_not(matcher=nil)\n if matcher\n matcher !~ self\n else\n ::Fluidity::Grammer::Must.new(self, true)\n end\n end",
"def not(*exps)\n joined_exps = exps.join(' and ')\n\n if @query[:filters].nil?\n @query[:filters] = \"not (#{joined_exps})\"\n else\n @query[:filters] = \"(#{@query[:filters]}) and not (#{joined_exps})\"\n end\n\n self\n end",
"def not\n ClaimPredicate.new(ClaimPredicateType::NOT, self)\n end",
"def not(v)\n Not.new(v)\n end",
"def not\n Anagram::Matching::NotMatcher.new(self)\n end",
"def MUST_NOT(matcher)\n ::Spectus::Requirement::Required.new(\n isolate: false,\n negate: true,\n matcher: matcher\n )\n end",
"def compose_not(condition)\n validate_condition(condition)\n condition.not\n end",
"def should_not(matcher)\n subject.should_not(matcher)\n end",
"def SHOULD_NOT(matcher)\n ::Spectus::Requirement::Recommended.new(\n isolate: false,\n negate: true,\n matcher: matcher\n )\n end",
"def exclude(query)\n query.negate!\n query\n end",
"def where_not(**mapping)\n render(NEGATION, **mapping)\n end",
"def negate(arg)\n if condition_specifier?(arg)\n SQL::BooleanExpression.from_value_pairs(arg, :AND, true)\n else\n raise Error, 'must pass a conditions specifier to Sequel.negate'\n end\n end",
"def not *a\n return self if guard *a\n s = ':not('\n self + s + (a.flatten.join ')' + s) + ')'\n end",
"def not(arg)\n expression_hash = BlocRecord::Utility.convert_keys(arg)\n key = expression_hash.keys.first\n value = expression_hash[key]\n\n sql = <<-SQL\n SELECT #{columns.join \",\"} FROM #{table}\n WHERE #{key} != #{value};\n SQL\n\n rows = connection.execute(sql, params)\n rows_to_array(rows)\n end",
"def not(rule)\n filter_transformer( lambda {|j| !j}, rule ) # negation transformer\n end",
"def and_not( c )\n\t\t@conditions = self.class.and_not( conditions, c )\n\t\tself\n\tend",
"def not(policy)\n Not.new(policy)\n end",
"def not( arg ); { $not => arg } end",
"def none_of(*queries)\n raise ArgumentError, 'Called none_of() with no arguments.' if queries.none?\n\n AlternativeBuilder.new(:negative, @scope, *queries).build\n end",
"def to_not(matcher=nil, message=nil, &block)\n #prevent_operator_matchers(:to_not, matcher)\n handle_negative_matcher(@target, matcher, message, &block)\n end",
"def ~\n Not.new(self)\n end",
"def not\n require_relative './not'\n \n NRSER::Types.not self\n end",
"def should_not(matcher)\n if Shoulda::Context.current_context\n Shoulda::Context.current_context.should_not(matcher)\n else\n context_name = self.name.gsub(/Test$/, \"\") if name\n context = Shoulda::Context::Context.new(context_name, self) do\n should_not(matcher)\n end\n context.build\n end\n end",
"def neq!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 58 )\n\n type = NEQ\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 179:7: '!='\n match( \"!=\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 58 )\n\n end",
"def ~\n UnaryOperator.new(:not, self)\n end",
"def negation\n \"not\" if negate?\n end",
"def not\n @not = true && self\n end",
"def compose_not_eq_node(node, value)\n validate_node_or_attribute(node)\n validate_basic_class(node, value)\n node.not_eq(value)\n end",
"def should_not(matcher=nil, &block)\n Spec::Expectations::NegativeExpectationHandler.handle_matcher(self, matcher, &block)\n end",
"def condition_not(structure)\n value = if structure.count == 1\n construct_condition structure.flatten(1)\n else\n condition_eq structure\n end\n \"NOT #{value}\"\n end",
"def not!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 61 )\n\n type = NOT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 389:7: '!'\n match( 0x21 )\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__, 61 )\n\n end",
"def is_not(&block)\n [:is_not, block]\n end",
"def is_not(&block)\n [:is_not, block]\n end",
"def not!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 64 )\n\n type = NOT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 185:7: '!'\n match( 0x21 )\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__, 64 )\n\n end",
"def notp(rule, &block)\n ext(NotPredicate.new(rule), block)\n end",
"def notp(rule, &block)\n ext(NotPredicate.new(rule), block)\n end",
"def have_none_of_selectors(...)\n Matchers::HaveNoSelectors.new(...)\n end",
"def not(condition)\n {\"Fn::Not\" => [condition]}\n end",
"def no_where\n @data.where_behavior = :exclude\n return self\n end",
"def compose_not_gteq_node(node, value)\n compose_gteq_node(node, value).not\n end",
"def not(assertion)\n NotAssertion.new(assertion)\n end",
"def not_matching(regexp)\n regexp = Helpers.regexp_to_string regexp if regexp.is_a? Regexp\n @type = :doesNotMatch\n @value = regexp\n @request_builder\n end",
"def apply_negation_nodes(input_array)\n return input_array unless input_array.include?('not')\n last_index = input_array.size - 1\n output_array = Array.new\n i = 0\n while i < input_array.size\n if input_array[i] == 'not'\n raise \"Illegal 'not' operator at end of compound predicate: #{params[:where]}\" if i == last_index\n i += 1\n operand = input_array[i]\n raise \"Can only negate a condition node: #{params[:where]}\" unless operand.is_a?(Arel::Nodes::Node)\n output_array << Arel::Nodes::Not.new(operand)\n else\n output_array << input_array[i]\n end\n i += 1\n end\n output_array\n end",
"def not\n self.class.not(self)\n end",
"def where_not\r\n HigherOrderMessage.new do |id, *args|\r\n reject { |x| x.__send__(id, *args) }\r\n end\r\n end",
"def _not(memory)\n Memory::Value.bool !@left_operand.value\n end",
"def not\n NotWrapper.new(self)\n end",
"def exclude(*cond, &block)\n clause = (@opts[:having] ? :having : :where)\n cond = cond.first if cond.size == 1\n cond = cond.sql_or if (Hash === cond) || ((Array === cond) && (cond.all_two_pairs?))\n cond = filter_expr(block || cond)\n cond = SQL::BooleanExpression.invert(cond)\n cond = SQL::BooleanExpression.new(:AND, @opts[clause], cond) if @opts[clause]\n clone(clause => cond)\n end",
"def not_expression\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 2 )\n return_value = NotExpressionReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n string_literal6 = nil\n atom7 = nil\n\n tree_for_string_literal6 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 18:7: ( 'not' )? atom\n # at line 18:7: ( 'not' )?\n alt_3 = 2\n look_3_0 = @input.peek( 1 )\n\n if ( look_3_0 == T__12 )\n alt_3 = 1\n end\n case alt_3\n when 1\n # at line 18:9: 'not'\n string_literal6 = match( T__12, TOKENS_FOLLOWING_T__12_IN_not_expression_89 )\n\n tree_for_string_literal6 = @adaptor.create_with_payload( string_literal6 )\n root_0 = @adaptor.become_root( tree_for_string_literal6, root_0 )\n\n\n end\n @state.following.push( TOKENS_FOLLOWING_atom_IN_not_expression_95 )\n atom7 = atom\n @state.following.pop\n @adaptor.add_child( root_0, atom7.tree )\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\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 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__, 2 )\n\n end\n \n return return_value\n end",
"def fn_not(cond)\n {\n \"Fn::Not\" => [cond]\n }\n end",
"def or_not( c )\n\t\t@conditions = self.class.or_not( conditions, c )\n\t\tself\n\tend",
"def !=(expr2)\n Operator.new(S_NEQ, self, expr2)\n end",
"def rewrite_not(expression)\n value = expression[1]\n\n s(:call,\n s(:colon2,\n s(:const, :VirtualKeywords),\n :REWRITTEN_KEYWORDS\n ), :call_not,\n s(:array,\n s(:self),\n s(:iter, s(:fcall, :lambda), nil, value)\n )\n )\n end",
"def virtual_not(&block)\n virtualize_keyword(:not, @not_rewriter, block)\n end",
"def find_not_all(conditions={}, &block)\n all.reject { |item| match_all(item, conditions, &block) }\n end",
"def does_not_match?(actual)\n !matches_type?(actual)\n end",
"def does_not_match?(actual)\n !matches_type?(actual)\n end",
"def neq(v)\n NotEqual.new(v)\n end",
"def not(value=DEFAULT_VALUE)\n @negated = !@negated\n take_value(value)\n self\n end",
"def assert_not_predicate(object, predicate, message=nil)\n _wrap_assertion do\n assert_respond_to(object, predicate, message)\n actual = object.__send__(predicate)\n full_message = build_message(message,\n \"<?>.? is false value expected but was\\n\" +\n \"<?>\",\n object,\n AssertionMessage.literal(predicate),\n actual)\n assert_block(full_message) do\n not actual\n end\n end\n end",
"def compose_not_lteq_node(node, value)\n compose_lteq_node(node, value).not\n end",
"def test_boolean_not\n processor_ = ::Sawmill::EntryProcessor::build do\n If(Not(FilterByBasicFields(:progname => 'rails')), @entries)\n end\n @logger = ::Sawmill::Logger.new(:processor => processor_)\n @logger.info('Hello 1')\n @logger.info('rails') {'Hello 2'}\n @logger.info('sawmill') {'Hello 3'}\n assert_equal('Hello 1', @entries.dequeue.message)\n assert_equal('Hello 3', @entries.dequeue.message)\n assert_equal(0, @entries.size)\n end",
"def ne(val)\n expression(:ne, val)\n end",
"def not_regexp(left, right)\n # could be DRYer, but this is more readable than: \"NOT #{self.=~(left,right)}\"\n raise if right.is_a? Regexp\n \"NOT #{left}#{quotify right}\"\n end",
"def neq(val)\n Rule.new error: [:eq, val], predicate: -> { _1 != val }\n end",
"def assertNotMatchTest pattern, value\n assertNotMatch pattern, value\n end",
"def get_query_body conditions, must_not_conditions = []\n query_body = {\n bool: {\n must: conditions\n }\n }\n query_body[:bool][:must_not] = must_not_conditions if must_not_conditions.any?\n query_body\n end",
"def ne!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 54 )\n\n type = NE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 381:6: '!='\n match( \"!=\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 54 )\n\n end",
"def ~(arg)\n if condition_specifier?(arg)\n SQL::BooleanExpression.from_value_pairs(arg, :OR, true)\n else\n SQL::BooleanExpression.invert(arg)\n end\n end",
"def when_negated_expectation(actual)\n expect(result(&actual)).not_to public_send(*expectation_args)\n end",
"def negate\n Negate.new(self)\n end",
"def not_in(attributes)\n update_selector(attributes, \"$nin\")\n end",
"def !=(op)\n not self.==(op)\n end",
"def not_to(matcher = nil, message = nil, &block)\n prevent_operator_matchers(:not_to) unless matcher\n RSpec::Expectations::NegativeExpectationHandler.handle_matcher(@target, matcher, message, &block)\n rescue RSpec::Expectations::ExpectationNotMetError => e\n @@error_message << e.message\n end",
"def not_exist(*fields)\n mapping = fields.map { |field| [field, ANY_VALUE] }.to_h\n\n render(NEGATION, **mapping)\n end",
"def not(filters)\n @nots ||= {}\n @nots.merge!(filters)\n self\n end",
"def unless!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 68 )\n\n type = UNLESS\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 189:10: 'unless'\n match( \"unless\" )\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__, 68 )\n\n end",
"def to_not_sql(rhs, definition, &block)\n \"NOT COALESCE(#{rhs.to_sql(self, definition, &block)}, false)\"\n end",
"def match_none(item, conditions={}, &block)\n conditions.none? { |attribute, condition| condition === access_attribute(item, attribute) } &&\n if block_given? then !yield(item) else true end\n end",
"def not_equal(condition_column, condition_value)\n check_parameter('condition_column', condition_column, String)\n\n @request_url_base += \"&#{condition_column}_neq=#{condition_value}\"\n\n self\n end",
"def assert_have_no_selector(expected)\n hs = HaveSelector.new(expected)\n assert !hs.matches?(response_body), hs.negative_failure_message\n end",
"def build_none(negate = false)\n @null_relation = !negate\n negate ? \"time >= 0\" : \"time < 0\"\n end",
"def prefix_not?\n negation_method? && loc.selector.is?('not')\n end",
"def to_not_sql(rhs, definition, &block)\n \"NOT COALESCE(#{rhs.to_sql(self, definition, &block)}, 0)\"\n end",
"def exclude(condition)\n column, value = _expand_condition(condition)\n conditions.push(Proc.new{ reject! {|r| r.fetch(column) == value} })\n self\n end",
"def assertNotMatchWithMessageTest pattern, value, message\n assertNotMatch pattern, value, message\n end",
"def negate?\n @negate\n end",
"def negate?\n @negate\n end",
"def assert_have_no_selector(expected)\n hs = HaveSelector.new(expected)\n assert !hs.matches?(response), hs.negative_failure_message\n end",
"def != other\n # for equality, we must allow tests against nil\n if other.nil?\n true\n else\n call_enum \"relational\", other, :noteq\n end\n end",
"def is_non_query_condition(table_name, field_name, val)\n # Simple table keys handled by non query conditions\n non_query_condition = table_name.in?(NonQueryTableNames) || is_selection_type(table_name)\n\n # Requesting a return constant in any circumstance requires a non query condition\n non_query_condition = true if field_name == :return_constant\n\n # If there is a nested condition, the key may represent a non query table name\n val_item_key = val.is_a?(Hash) && val.first.is_a?(Hash) && val.first.first\n non_query_condition ||= non_query_nested_key_name?(val_item_key) if val_item_key\n\n non_query_condition\n end",
"def on_call_not(context, expression)\n return !on_call_boolean(context, expression)\n end",
"def negate(input, name: nil)\n _op(:negate, input, nil, name: name)\n end",
"def assert_not_queries_match(query1, query2, filter_exp=nil, sort=false, qrserver_id=0)\n result_xml1 = search(query1, qrserver_id).xmldata\n result_xml2 = search(query2, qrserver_id).xmldata\n assert_not_resultsets_match(result_xml1.split(\"\\n\"), result_xml2.split(\"\\n\"), filter_exp, sort)\n end"
] | [
"0.73200285",
"0.7278146",
"0.7237969",
"0.7124236",
"0.70505756",
"0.6993238",
"0.6782654",
"0.6779925",
"0.67423594",
"0.67321825",
"0.664675",
"0.6599901",
"0.65940684",
"0.65691113",
"0.6559502",
"0.6473227",
"0.63480055",
"0.6260238",
"0.62270045",
"0.6219167",
"0.6218912",
"0.62171745",
"0.6209894",
"0.6206902",
"0.6163095",
"0.6162735",
"0.6117357",
"0.6107383",
"0.6092408",
"0.6088105",
"0.60680825",
"0.6051456",
"0.604856",
"0.6018257",
"0.60077494",
"0.60018027",
"0.5996882",
"0.5996882",
"0.5964039",
"0.5961794",
"0.5961794",
"0.5945685",
"0.5930582",
"0.59159875",
"0.59114844",
"0.59060377",
"0.5895621",
"0.58868337",
"0.5886181",
"0.5868254",
"0.58644193",
"0.5844603",
"0.58407205",
"0.58285",
"0.5811161",
"0.58104956",
"0.5805262",
"0.5786188",
"0.57525724",
"0.57478863",
"0.57263315",
"0.57263315",
"0.57153946",
"0.5687357",
"0.5686645",
"0.5659229",
"0.5653546",
"0.56522185",
"0.5651409",
"0.5612272",
"0.5585773",
"0.5581626",
"0.5559785",
"0.5554405",
"0.5539714",
"0.553792",
"0.5530337",
"0.5529339",
"0.5508755",
"0.5496051",
"0.5429117",
"0.54072934",
"0.5404355",
"0.5403901",
"0.540092",
"0.5388659",
"0.5375427",
"0.5343654",
"0.5337646",
"0.5335743",
"0.5326338",
"0.5321935",
"0.5315106",
"0.53071666",
"0.53009164",
"0.5296548",
"0.5281789",
"0.5273886",
"0.52696323"
] | 0.6743118 | 8 |
Similar to `case`, except it uses a `ResultPatternMatch` instead. | def result_case(target, destructure: false, &fn)
Qo::PatternMatchers::ResultPatternMatch
.new(destructure: destructure, &fn)
.call(target)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def case!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 23 )\n\n type = CASE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 144:8: 'case'\n match( \"case\" )\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__, 23 )\n\n end",
"def match_mixed(test)\n case test\n when 'hello'\n 'hello'\n in [a, b]\n \"a: #{a}, b: #{b}\"\n end\nend",
"def case_insensitive_match; end",
"def match(pattern); end",
"def case_insensitive_match=(_arg0); end",
"def match; end",
"def match; end",
"def not_so_useful_match_as(x)\n case x\n in 0..5 => little_number\n puts \"#{little_number} is a pretty small number\"\n in String => string\n puts \"#{string} is a string\"\n in Hash => hash\n puts \"#{hash} is a hash\"\n end\nend",
"def keyword\n 'case'\n end",
"def keyword\n 'case'\n end",
"def case _args\n \"case _args;\" \n end",
"def match=(_); end",
"def case_result(race_place)\n case race_place\n when 50..60 then 'NOt really good!'\n when 0..10 then \"You are wiiner, in top!\"\n when 20..30 then \"pretty solid\"\n when 100..120 then \"are you kiding? worst time ever..\"\n end\nend",
"def match(input); end",
"def fnmatch(matcher); end",
"def matching(case_cond)\n Rule.new error: [:not_matching, case_cond], predicate: -> { case_cond === _1 }\n end",
"def match()\n end",
"def case_exact\n return @case_exact\n end",
"def switch_statement\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 16 )\n return_value = SwitchStatementReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n\n _last = _first_0 = nil\n string_literal60 = nil\n expression61 = nil\n case_clause62 = nil\n default_clause63 = nil\n\n tree_for_string_literal60 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 95:5: ^( 'switch' expression ( case_clause )* ( default_clause )? )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal60 = match( SWITCH, TOKENS_FOLLOWING_SWITCH_IN_switch_statement_477 )\n\n tree_for_string_literal60 = @adaptor.copy_node( string_literal60 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal60, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_switch_statement_479 )\n expression61 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression61.tree )\n # at line 95:28: ( case_clause )*\n while true # decision 16\n alt_16 = 2\n look_16_0 = @input.peek( 1 )\n\n if ( look_16_0 == CASE )\n alt_16 = 1\n\n end\n case alt_16\n when 1\n # at line 95:28: case_clause\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_case_clause_IN_switch_statement_481 )\n case_clause62 = case_clause\n @state.following.pop\n\n @adaptor.add_child( root_1, case_clause62.tree )\n\n\n else\n break # out of loop for decision 16\n end\n end # loop for decision 16\n # at line 95:41: ( default_clause )?\n alt_17 = 2\n look_17_0 = @input.peek( 1 )\n\n if ( look_17_0 == DEFAULT )\n alt_17 = 1\n end\n case alt_17\n when 1\n # at line 95:41: default_clause\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_default_clause_IN_switch_statement_484 )\n default_clause63 = default_clause\n @state.following.pop\n\n @adaptor.add_child( root_1, default_clause63.tree )\n\n\n end\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 16 )\n\n end\n \n return return_value\n end",
"def match(chrs, op = T.unsafe(nil)); end",
"def casecmp(p0) end",
"def case_clause\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 28 )\n return_value = CaseClauseReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n string_literal116 = nil\n char_literal118 = nil\n expression_list117 = nil\n statement_list119 = nil\n\n tree_for_string_literal116 = nil\n tree_for_char_literal118 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 430:5: 'case' expression_list ':' ( statement_list )?\n string_literal116 = match( CASE, TOKENS_FOLLOWING_CASE_IN_case_clause_2873 )\n if @state.backtracking == 0\n\n tree_for_string_literal116 = @adaptor.create_with_payload( string_literal116 )\n root_0 = @adaptor.become_root( tree_for_string_literal116, root_0 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_expression_list_IN_case_clause_2877 )\n expression_list117 = expression_list\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, expression_list117.tree )\n end\n char_literal118 = match( COLON, TOKENS_FOLLOWING_COLON_IN_case_clause_2880 )\n # at line 430:37: ( statement_list )?\n alt_24 = 2\n look_24_0 = @input.peek( 1 )\n\n if ( look_24_0 == GENERAL || look_24_0 == GET || look_24_0 == ARROW || look_24_0 == IF || look_24_0 == REGEX || look_24_0 == INCR || look_24_0 == BREAK || look_24_0 == RETURN || look_24_0 == IS_DEFINED || look_24_0 == LBRACE || look_24_0 == LBRACK || look_24_0.between?( SEMI, CONST ) || look_24_0.between?( SET, LET ) || look_24_0 == DDOC || look_24_0.between?( DECR, LPAREN ) || look_24_0 == DELETE || look_24_0.between?( DGENERAL, DO ) || look_24_0 == THROW || look_24_0 == TILDE || look_24_0 == TRUE || look_24_0 == TRY || look_24_0.between?( TYPEOF, NEW ) || look_24_0.between?( EACH, UNDEFINED ) || look_24_0.between?( NULL, UNLESS ) || look_24_0 == UNTIL || look_24_0 == FALSE || look_24_0 == VAR || look_24_0.between?( VOID, FOR ) || look_24_0 == WHILE || look_24_0.between?( WITH, YIELD ) || look_24_0.between?( IS_UNDEFINED, DOC ) || look_24_0.between?( T__148, T__150 ) )\n alt_24 = 1\n end\n case alt_24\n when 1\n # at line 430:37: statement_list\n @state.following.push( TOKENS_FOLLOWING_statement_list_IN_case_clause_2884 )\n statement_list119 = statement_list\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, statement_list119.tree )\n end\n\n end\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 28 )\n\n end\n \n return return_value\n end",
"def match(value)\n return _match(@_compiled_pattern, value)\n end",
"def matches?(value, context); end",
"def match\n ->(r, i) { i.match(r) }.curry\n end",
"def case_clause\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 17 )\n return_value = CaseClauseReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n\n _last = _first_0 = nil\n string_literal64 = nil\n expression65 = nil\n statement_list66 = nil\n\n tree_for_string_literal64 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 99:5: ^( 'case' expression ( statement_list )? )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal64 = match( CASE, TOKENS_FOLLOWING_CASE_IN_case_clause_504 )\n\n tree_for_string_literal64 = @adaptor.copy_node( string_literal64 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal64, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_case_clause_506 )\n expression65 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression65.tree )\n # at line 99:27: ( statement_list )?\n alt_18 = 2\n look_18_0 = @input.peek( 1 )\n\n if ( look_18_0.between?( AMP, AMP_ASGN ) || look_18_0 == POST_DECR || look_18_0.between?( GEQ, AREF ) || look_18_0.between?( GREATER, HAT ) || look_18_0.between?( ARROW, HAT_ASGN ) || look_18_0.between?( ASGN, REGEX ) || look_18_0.between?( IN, RETURN ) || look_18_0 == INCR || look_18_0.between?( BREAK, RSHIFT3 ) || look_18_0.between?( LABEL, CATCH ) || look_18_0 == RSHIFT_ASGN || look_18_0 == LEQ || look_18_0.between?( LESS, SLASH ) || look_18_0.between?( SLASH_ASGN, CONTINUE ) || look_18_0.between?( STAR, DECR ) || look_18_0 == STAR_ASGN || look_18_0.between?( LSHIFT, THIS ) || look_18_0 == THROW || look_18_0.between?( MINUS, MOD ) || look_18_0.between?( MOD_ASGN, TYPEOF ) || look_18_0.between?( NEQ, UMINUS ) || look_18_0.between?( NEQQ, UNDEFINED ) || look_18_0.between?( NEW, UPLUS ) || look_18_0.between?( OBJECT, FALSE ) || look_18_0.between?( WITH, PLUS ) || look_18_0.between?( ID, DOC ) )\n alt_18 = 1\n end\n case alt_18\n when 1\n # at line 99:27: statement_list\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_statement_list_IN_case_clause_509 )\n statement_list66 = statement_list\n @state.following.pop\n\n @adaptor.add_child( root_1, statement_list66.tree )\n\n\n end\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 17 )\n\n end\n \n return return_value\n end",
"def matched\n match.to_s if matched?\n end",
"def match(input)\n input \n end",
"def _match column, field, value, field_is_int = false, opts = { }\n b = lambda { | fmt, v | \"(#{field}#{fmt % Content.connection.quote(v)})\" }\n _match_and(column, b, value, field_is_int, opts)\n end",
"def do_match(input)\n @matched = input.match(@on)\n end",
"def match\n true\n end",
"def post_match() end",
"def match_a_string(name)\n case name\n in \"ruby\"\n puts \"https://www.ruby-lang.org/en/\"\n in \"python\"\n puts \"https://www.python.org/\"\n in \"elixir\"\n puts \"https://elixir-lang.org/\"\n else\n puts \"no match\"\n end\nend",
"def pick_when action, type, field, target_value\n if action[\"_type\"] == type and action[field] =~ target_value\n \n end\n end",
"def matcher; end",
"def matcher; end",
"def match(object); end",
"def run(v)\n case v\n when matches { [4,5,x] }\n puts m.x\n when matches { [1,2,x] }\n puts m.x # => 3\n end\n end",
"def test_match_case_sensitive\r\n\t\t#content with exact match\r\n\t\tcontent = \"first line.\\nthis string contains a case sensitive match on: MyMatch123\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch123\"\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tmatch = snort_rule_content.match(content,0)\r\n\t\tassert_equal(60, match,\"no case sensitive match on content.\")\r\n\tend",
"def match(p0) end",
"def match(p0) end",
"def fnmatch?(matcher); end",
"def case(exp, level)\n code = []\n @scope.add_local \"$case\"\n expr = process exp.shift, :expression\n # are we inside a statement_closure\n returnable = level != :statement\n\n until exp.empty?\n wen = exp.shift\n if wen and wen.first == :when\n returns(wen) if returnable\n wen = process(wen, :expression)\n wen = \"else #{wen}\" unless code.empty?\n code << wen\n elsif wen # s(:else)\n wen = returns(wen) if returnable\n code << \"else {#{process wen, :expression}}\"\n end\n end\n\n code = \"$case = #{expr};#{code.join \"\\n\"}\"\n code = \"(function() { #{code} })()\" if returnable\n code\n end",
"def pre_match() end",
"def case_exact=(value)\n @case_exact = value\n end",
"def normalize_matching(default = :pattern)\n case self\n when /^f/i\n :fuzzy\n when /^p/i\n :pattern\n when /^e/i\n :exact\n else\n default.is_a?(Symbol) ? default : default.normalize_matching\n end\n end",
"def cases()\n \n end",
"def activity_case\n\n puts \"what temperature is it?\"\n temp = gets.chomp.to_i\n #case statement\n case temp\n when 80..100 #80 to 100, including 100\n puts \"lets go swimming\"\n when 50...80\n puts \"let's go hiking\"\n when 40...50\n puts \"let's go running\"\n when 0...40\n puts \"Let's cozy up by the fire.\"\n else\n puts \"what planet are you on?\"\n end\nend",
"def match(candidates)\n\t\tself.downcase(candidates)\n\t\t@ed.match(candidates)\n\tend",
"def mag_input_case(number)\n result = case\n when number<=50\n 'Number still less than 50.'\n when number >50 && number<=100\n 'Number still between 50 and 100.'\n when number > 100\n \"You're still breaking the rules.\"\n end\n\n return result\nend",
"def stop_if_match; true; end",
"def casefold?() end",
"def match_to_regex(match, type=:fuzzy)\n match.downcase!\n if type == :exact\n /^#{match}$/\n else\n /#{match}/\n end\n end",
"def destructuring_match_as(environment_reading)\n case environment_reading\n in [:ok, [\"CO2\", _, \"PM2.5\", _] => air_quality]\n puts \"Acceptable air reading: #{air_quality}\"\n in [:warning, [\"CO2\", _, \"PM2.5\", _] => air_quality]\n puts \"Dangerous air reading: #{air_quality}\"\n in [:ok, [\"Temperature\", _, \"Humidity\", _] => weather]\n puts \"Weather update: #{weather}\"\n end\nend",
"def case_aaaa()\n puts \"case aaaa\"\n return 003\n end",
"def match_without_pinning(input)\n case input\n in [a, a] # We'd like to assert that the first and second elements are equal\n a\n else\n '-'\n end\nend",
"def testRegExp(command, input)\n\treturn case command\n\twhen \"a\"\n\t\tssn(input)\n\twhen \"b\"\n\t\tphoneNumber(input)\n\twhen \"c\"\n\t\temail(input)\n\twhen \"d\"\n\t\tname(input)\n\twhen \"e\"\n\t\tdate(input)\n\twhen \"f\"\n\t\taddress(input)\n\twhen \"g\"\n\t\tletter(input)\n\twhen \"h\"\n\t\tmilitaryTime(input)\n\twhen \"i\"\n\t\tcurrency(input)\n\twhen \"j\"\n\t\twebsite(input)\n\twhen \"k\"\n\t\tpassword(input)\n\twhen \"l\"\n\t\tion(input)\n\telse \n\t\t\"Invalid input... try again.\"\n\tend\nend",
"def test_match_case_sensitive_no_match\r\n\t\t#content with case insensitive, but not case sensitive match\r\n\t\tcontent = \"first line.\\nthis string doesn not contain a case insensitive match on: mymatch123\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch123\"\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tassert(!snort_rule_content.match(content,0),\"incorrect case sensitive match on content.\")\r\n\tend",
"def matches?(pattern); end",
"def match(keyword); end",
"def sql_match_pattern(column, value, **opt)\n '(%s)' % sql_test(column, value, **opt)\n end",
"def test_match_case_sensitive_distance\r\n\t\t#content with exact match\r\n\t\tcontent = \"123MyMatch123MyMatch\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch\"\r\n\t\tsnort_rule_content.distance = 1\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tmatch = snort_rule_content.match(content,4)\r\n\t\tassert_equal(13, match,\"no match on content with distance.\") #13 position of second MyMatch\r\n\tend",
"def match(cond)\n getrec if match?(cond)\n end",
"def on_match_pattern(node); end",
"def match?(name); end",
"def match(req)\n end",
"def match?(name, literal) true end",
"def match(pattern, options = {})\n options = {:use_prefix => true, :use_suffix => true, :method => :execute}.merge(options)\n @__cinch_matches ||= []\n @__cinch_matches << Match.new(pattern, options[:use_prefix], options[:use_suffix], options[:method])\n end",
"def match\n extract!\n policy_failure_match! || self\n end",
"def match(str=nil)\n return DelayedMatchConstructor.new unless str\n \n return Atoms::Re.new(str)\n end",
"def myfood(food)\r\n case food\r\n when \"Steak\"\r\n \"Pass the Steak sauce! That's delicious\"\r\n when \"Sushi\"\r\n \"Thats raw. I don't eat raw food\"\r\n when \"Tacos\", \"Burrito\", \"Quesadillas\"\r\n \"The perfect Combination!\"\r\n when \"Tofu\", \"Brussel Sprouts\"\r\n puts \"No Thanks\"\r\n else\r\n \"I don't know that food\"\r\n end\r\nend",
"def match?(pattern)\n do_scan pattern, false, false, true\n end",
"def matcher_name; end",
"def matcher_name; end",
"def with_case(kase)\n previous = @case\n @case = kase\n result = yield(self)\n @case = previous\n result\n end",
"def match!(value, expectation, info = nil)\n match = case expectation\n when :truish then !!value\n when :fail then false\n when Array then\n if expectation.length == 1\n # Array as \"array of elements matching an expectation\"; for example\n # [1,2,3] => [Integer]\n e = expectation.first\n value.each_with_index { |v, idx| match!(v, e, idx) }\n else\n # Array as \"object matching one of given expectations\n expectation.any? { |exp| _match?(value, exp) }\n end\n when Proc then expectation.arity == 0 ? expectation.call : expectation.call(value)\n when Regexp then value.is_a?(String) && expectation =~ value\n when :__block then value.call\n when Hash then Hash === value &&\n expectation.each { |key, exp| match! value[key], exp, key }\n when Module\n if expectation == URI\n _match_uri?(value)\n else\n expectation === value\n end\n else expectation === value\n end\n\n return if match\n fail Mismatch.new(value, expectation, info)\n end",
"def test_match_case_sensitive_binary_no_match\r\n\t\t#content with exact match\r\n\t\tcontent = \"first line.\\nthis string doesnt contains a match on: My\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"M|79|Mat|63 68|123\" #equals MyMatch123\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tassert(!snort_rule_content.match(content,0),\"case sensitive match on no match content.\")\r\n\tend",
"def match(regexp); end",
"def test_match_case_sensitive_depth\r\n\t\t#content with exact match\r\n\t\tcontent = \"123MyMatch and some more\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch\"\r\n\t\tsnort_rule_content.depth = 10\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tmatch = snort_rule_content.match(content,0)\r\n\t\tassert_equal(3, match,\"no match on content with depth.\")\r\n\tend",
"def define_case(sym, *args)\n record(sym, *args)\n end",
"def test_match_case_sensitive_offset\r\n\t\t#content with exact match\r\n\t\tcontent = \"123MyMatch and some more\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch\"\r\n\t\tsnort_rule_content.offset = 3\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tmatch = snort_rule_content.match(content,0)\r\n\t\tassert_equal(3, match,\"no match on content with offset.\")\r\n\tend",
"def test_match_case_sensitive_distance_no_match\r\n\t\t#content with exact match\r\n\t\tcontent = \"123MyMatch123MyMatch\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch\"\r\n\t\tsnort_rule_content.distance = 11\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tassert(!snort_rule_content.match(content,4),\"incorrect match on content with distance.\")\r\n\tend",
"def case(id, *args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = get(\"cases/#{id}\",options)\n response.case\n end",
"def allow_matcher; end",
"def on_match_pattern_p(node); end",
"def pattern_match(file, pattern)\n case\n when pattern.is_a?(Regexp)\n return file.match(pattern)\n when pattern.is_a?(String)\n return File.fnmatch(pattern, file)\n when pattern.is_a?(Proc)\n return pattern.call(file)\n when pattern.is_a?(Rake::FileTask)\n return pattern.to_s.match(file)\n else\n raise \"Cannot interpret pattern #{pattern}\"\n end\n end",
"def match(rex, default=nil)\n m = rex.match self.stdout\n if m\n if m.length > 2\n m[1..-1]\n else\n m[1]\n end\n else\n default\n end\n end",
"def casestatement(number)\nanswer = case\n when number < 0\n \"#{number} is negative\"\n when number <= 50\n \"#{number} is between 0 and 50\"\n when number <= 100\n \"#{number} is between 51 and 100\"\n else\n \"#{number} is greater than 100\"\n end\nputs answer # Note how we just moved this INTO the method.\nend",
"def outward_match(match)\n if match == \"word\"\n return \"kanji\"\n elsif match == \"reading\"\n return \"romaji\"\n else\n return match\n end\n end",
"def match(x)\n $look == x or expected(\"#{x}\")\n getChar\n skipWhite\nend",
"def test_match_case_sensitive_within\r\n\t\t#content with exact match\r\n\t\tcontent = \"123MyMatch123MyMatch\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch\"\r\n\t\tsnort_rule_content.within = 10\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tmatch = snort_rule_content.match(content,10)\r\n\t\tassert_equal(13, match,\"no match on content with within.\") #13 pos of second MyMatch\r\n\tend",
"def match(input, offset=0)\n m = input.match(rule, offset)\n extend_match(m, name) if m\n end",
"def survery_results(vampire_level)\n case vampire_level\n when 0\n puts 'Probably not a vampire'\n when 1 || 6\n puts 'Probably a vampire'\n when 2\n puts 'Almost certainly a vampire'\n when 3\n puts 'Definitely a vampire'\n when 5\n puts 'Results inconclusive.'\n end\n puts '--------------------------------'\nend",
"def match(klass); end",
"def test_match_case_sensitive_depth_no_match\r\n\t\t#content with exact match\r\n\t\tcontent = \"123MyMatch and some more\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch\"\r\n\t\tsnort_rule_content.depth = 9\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tassert(!snort_rule_content.match(content,0),\"incorrect match on content with depth.\")\r\n\tend",
"def food(food)\n case food\n when \"burger\"\n \"bad food\"\n when \"apple\"\n \"good\"\n else\n \"nice\"\n end\nend",
"def test_match_resolution\n exc_handler = HumanParseExceptionHandler.new\n new_str = exc_handler.get_human_result_for_string(\"foobar\",\"ParseException\")\n assert_equal(false, new_str)\n \n exc_handler.add_human_result_for_string(\"foobar\",\"ParseException\",\"FOOBAR\")\n assert_equal(\"FOOBAR\",exc_handler.get_human_result_for_string(\"foobar\",\"ParseException\"))\n end",
"def match(pattern, options = {})\n options = {:use_prefix => true, :use_suffix => true, :method => :execute}.merge(options)\n @matchers << Match.new(pattern, options[:use_prefix], options[:use_suffix], options[:method])\n end",
"def super_match(*args)\n return unless match = match(args.first) \n returning match do |m|\n args[1..-1].each_with_index { |name, index| m.meta_def(name) { self[index+1] } }\n end\n end",
"def match (pattern)\n Predicate.new(:match, pattern: pattern) { |o| pattern === o }\n end"
] | [
"0.662114",
"0.6491278",
"0.63860977",
"0.63575363",
"0.6344473",
"0.62308085",
"0.62308085",
"0.6076645",
"0.6054541",
"0.6054541",
"0.6037954",
"0.60247666",
"0.5977843",
"0.5956351",
"0.59129816",
"0.58484346",
"0.5824745",
"0.58157057",
"0.5803418",
"0.58016825",
"0.57896364",
"0.5712235",
"0.5705769",
"0.56713134",
"0.56643844",
"0.5638317",
"0.5636926",
"0.56330997",
"0.5611502",
"0.56089365",
"0.56030446",
"0.5549309",
"0.55417454",
"0.5519058",
"0.55100197",
"0.55100197",
"0.5490359",
"0.5487817",
"0.5484475",
"0.5473148",
"0.5473148",
"0.5453511",
"0.54464126",
"0.54429585",
"0.5433436",
"0.5426098",
"0.5425828",
"0.5412591",
"0.5405942",
"0.5402576",
"0.5384924",
"0.5363864",
"0.5361268",
"0.53396046",
"0.53065467",
"0.5297894",
"0.5289319",
"0.527233",
"0.52664566",
"0.5262455",
"0.52586657",
"0.52526695",
"0.5251303",
"0.5236863",
"0.5234587",
"0.5231109",
"0.52211386",
"0.5220095",
"0.5194304",
"0.51910895",
"0.5175617",
"0.5175025",
"0.51650196",
"0.51650196",
"0.516319",
"0.5151564",
"0.5147732",
"0.5133842",
"0.512982",
"0.5124962",
"0.51199037",
"0.51168895",
"0.5115491",
"0.5113475",
"0.51071465",
"0.5097172",
"0.5094234",
"0.5092499",
"0.5087661",
"0.50849545",
"0.50800335",
"0.5077516",
"0.507463",
"0.50723493",
"0.5068205",
"0.5063617",
"0.50619864",
"0.5058795",
"0.5058693",
"0.5055411"
] | 0.7665825 | 0 |
Dynamically creates a new branch to be used with custom pattern matchers. | def create_branch(name:, precondition: Any, extractor: IDENTITY, destructure: false, default: false)
Qo::Branches::Branch.create(
name: name,
precondition: precondition,
extractor: extractor,
destructure: destructure,
default: default
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_pattern_match(branches:)\n Qo::PatternMatchers::PatternMatch.create(branches: branches)\n end",
"def create_branch(_base_branch, _new_branch)\n puts 'TODO: Implement Git.create_branch'\n end",
"def create_branch\n @tree_class.new\n end",
"def create_branch new_branch_name\n repo.create_branch new_branch_name\n end",
"def create_branch(name)\n return unless /[a-z0-9\\-_]/.match name\n begin\n res = satelliterepo.create_branch(name)\n rescue\n return nil\n end\n pushtobare name\n res\n end",
"def git_branch_create(new_branch_name)\n repo.create_branch(new_branch_name)\n end",
"def create_branch(name)\n begin\n res = satelliterepo.create_branch(name)\n rescue\n return nil\n end\n pushtobare name\n res\n end",
"def create_branch\n check_current_repo\n exists = `git branch --list #{branch}`.squish == branch\n if exists\n `git checkout #{branch}`\n else\n `git checkout master` unless current_branch == 'master'\n `git checkout -b #{branch}`\n end\nend",
"def branch(name)\n gitrepo.create_branch(name)\n end",
"def patch_branch\n num = 1\n branch_name = form_data[\"title\"].parameterize\n return branch_name unless branch_exists?(branch_name)\n branch = \"#{branch_name}-#{num}\"\n while branch_exists?(branch) do\n num = num + 1\n branch = \"#{branch_name}-#{num}\"\n end\n branch\n end",
"def create_branch(branch)\n client.create_ref repo, \"heads/#{branch}\", base_sha\n end",
"def create_branch(name, target = 'upstream/master')\n # fetch the remote if defined in the target\n unless branch_exist?(name)\n remote_name, ref = target.split('/', 2)\n fetch(remote_name)\n logger.info(\"Creating branch: #{name} for #{path} from #{target}\")\n found_ref = find_ref(target)\n repo.create_branch(name, found_ref)\n else\n repo.branches[name]\n end\n end",
"def create_branch\n sh 'git branch gh-pages'\n sh 'git checkout gh-pages'\n end",
"def create( branch, newattrs={} )\n\t\tnewattrs = normalize_attributes( newattrs ) if newattrs.is_a?( Hash )\n\t\tself.conn.add( branch.to_s, newattrs )\n\n\t\treturn true\n\tend",
"def create_branches(repo)\n @branch_names.collect {|branch_name| \n Branch.new(branch_name ,Grit::Commit.find_all(repo, branch_name).sort_by { |k| k.authored_date}.reverse)}\n end",
"def new_issue_branch(branch, branch_project: nil)\n branch_project ||= project\n link = url_helpers.project_compare_path(branch_project, from: branch_project.default_branch, to: branch)\n\n body = \"created branch [`#{branch}`](#{link}) to address this issue\"\n\n create_note(NoteSummary.new(noteable, project, author, body, action: 'branch'))\n end",
"def create_branch\n ErrorEmittingExecutor.execute(\"git checkout -B #{BRANCH_NAME}\")\n\n # Ensure local branch matches any existing upstream branch; will reset to HEAD by default\n ErrorEmittingExecutor.execute('git reset --hard', exit_on_error: true)\nend",
"def build_branch(branch, params = {}, body = {})\n CircleCi.request(conf, \"#{base_path}/tree/#{branch}\", params).post(body)\n end",
"def newMet\n puts \"Try to create a new branch and then push it back to remote\"\n end",
"def build_branch_list\n local_branches = `git branch`.split(' ')\n active_branch_index = local_branches.index('*')\n\n local_branches.reject { |i| i == '*' }.map.with_index do |b, i|\n BranchModel.new(b, i == active_branch_index)\n end\n end",
"def build_branch(branch, params = {}, body = {})\n CircleCi.request(@conf, \"/project/#{username}/#{project}/tree/#{branch}\", params).post(body)\n end",
"def branch; end",
"def create\r\n if @current_shop.branches_count >= @current_shop.max_branches_count\r\n flash[:error] = t('You have no authories to create more branch.')\r\n redirect_to backend_shop_branches_path(@current_shop.slug)\r\n else\r\n @branch = @current_shop.branches.build(branch_params.except(:supported_order_types, :supported_scratchpad_order_types, :supported_send_sms_order_types))\r\n @branch.supported_order_types = params[:branch][:supported_order_types].nil? ?\r\n nil: params[:branch][:supported_order_types].select{|type| Order::order_types_array.index(type).present? }.join(',')\r\n @branch.supported_scratchpad_order_types = params[:branch][:supported_scratchpad_order_types].nil? ?\r\n nil: params[:branch][:supported_scratchpad_order_types].select{|type| Order::order_types_array.index(type).present? }.join(',')\r\n @branch.supported_send_sms_order_types = params[:branch][:supported_send_sms_order_types].nil? ?\r\n nil: params[:branch][:supported_send_sms_order_types].select{|type| Order::order_types_array.index(type).present? }.join(',')\r\n #@branch = @current_shop.branches.build(branch_params)\r\n respond_to do |format|\r\n if @branch.save\r\n format.html { redirect_to backend_shop_branch_branch_steps_path(@current_shop.slug, @branch) + \"/detail_info\" }\r\n format.json { render action: 'show', status: :created, location: @branch }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @branch.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end\r\n end",
"def test_branch\n #puts \"---------------test_branch-----------------\"\n t1= nil\n t2 = nil\n t11 = nil\n t12 = nil\n GraphBuilder::Builder.build do |b|\n t1 = b.add(Thing1.new)\n b.branch do \n t11 = b.add(Thing11.new)\n t12 = b.add(Thing12.new)\n end\n t2 = b.add(Thing2.new)\n end\n\n r = Thing.links([t1,t2,t11,t12])\n assert_equal 4, r.size\n assert r.include? [t1,t11]\n assert r.include? [t1,t12]\n assert r.include? [t11,t2]\n assert r.include? [t12,t2]\n end",
"def new_branch_in(folder, levels = nil)\n return if flat?\n\n raise Errors::BranchError.new(dir: folder.path) if folder == terminal\n\n raise TreeLimitExceededError.new(tree: self) if folder.count >= folder_limit\n\n levels ||= levels_below folder\n new_branch = new_paths_in folder, levels\n @folders = folders[0..folders.index(folder)].concat new_branch\n folders.last.create!\n end",
"def create_review_branch(repo)\n\trepo = repo.gsub(/\\w*-?\\w*\\//,'')\n\tputs \"\"\n\tputs \"Deleting old and creating new review branch for #{repo}\"\n\t`cd ~/workspace/#{repo}; git checkout master; git branch -d review; git push origin --delete review; git branch review; git push -u origin review`\nend",
"def branch(target, options = {})\n branches << Branch.new(target, options)\n end",
"def branch\n raise NotImplementedError\n end",
"def create_branch_point( *elements )\n return Util::ExpressionForms::BranchPoint.new( *elements )\n end",
"def branches; end",
"def create_releases_for_branch?(branch)\n release_branch == branch\n end",
"def on_branch(node, compiled_grammar)\n steps = process(node.children[0], compiled_grammar)\n\n if node.children[1]\n code = process(node.children[1], compiled_grammar)\n else\n code = nil\n end\n\n return Branch.new(steps, node.source_line, code)\n end",
"def create_module_and_branch?(opts = {})\n if module_obj = module_exists?\n module_branch_exists? || create_module_branch(module_obj)\n else\n create_module_and_branch(create_implementation: opts[:create_implementation])\n end\n end",
"def create_branch_and_checkout(repo_path, commit, branch)\n `(cd \"#{repo_path}\" && git checkout -b #{branch} #{commit})`\n end",
"def create\n @branch = Branch.new(branch_params)\n @starting_range = params[:branch][:text]\n @ending_range = params[:branch][:range]\n @starting_range = Integer(@starting_range)\n @ending_range = Integer(@ending_range)\n if @starting_range <= @ending_range\n @random_number = Random.new.rand(@starting_range..@ending_range)\n @branch.text = @random_number.to_s\n @branch.range = @starting_range.to_s + \" - \" + @ending_range.to_s\n @branch.uid = params[:branch][:uid].strip\n @branch.parent = params[:branch][:parent].strip\n respond_to do |format|\n if @branch.save\n format.html { redirect_to action: \"index\", notice: 'Branch was successfully updated.' }\n format.json { render action: 'show', status: :created, location: @branch }\n else\n format.html { render action: 'new' }\n format.json { render json: @branch.errors, status: :unprocessable_entity }\n end\n end\n else\n format.json { render json: \"[{error: invalid range}]\", status: :unprocessable_entity }\n end\n end",
"def create_module_and_branch(opts = {})\n self.module_class.create_module(self.project, self.local_params, return_module_branch: true, create_implementation: opts[:create_implementation], donot_push_to_repo_manager: true)\n end",
"def create\n @star_branch = Star::Branch.new(params[:star_branch])\n\n respond_to do |format|\n if @star_branch.save\n format.html { redirect_to @star_branch, notice: 'Branch was successfully created.' }\n format.json { render json: @star_branch, status: :created, location: @star_branch }\n else\n format.html { render action: \"new\" }\n format.json { render json: @star_branch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @branch = Branch.new(branch_params.map{|k,v| {k.to_sym => v.class == ActionController::Parameters ? [v.to_hash] : v.to_s}}.reduce({}, :merge))\n\n respond_to do |format|\n if @branch.save\n format.html { redirect_to @branch, success: 'Branch was successfully created.' }\n format.json { render :show, status: :created, location: @branch }\n else\n format.html { render :new }\n format.json { render json: @branch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_branch( tag=next_branch_tag(), sha=nil )\n if not sha\n sha = commits.last.id\n #sha = branches.first.commit.id if not sha\n end\n name = clean_tag(tag)\n update_ref(name, sha)\n name\n end",
"def __branch(arg)\n case arg\n when ::Hash then TupleScope.new(arg, [], self)\n else\n Kernel::raise NotImplementedError, \"Unable to branch with `#{arg}`\"\n end\n end",
"def branch\n parse!\n raise NotImplementedError.new(\"branch() must be implemented by subclasses of AbstractChangeset.\")\n end",
"def other_branch\n @other_branch ||= `git branch | grep #{pattern}`.split.first\n end",
"def test_branch\n \tassert_equal(UI.parseCommand('branch', BranchCmd1*\" \"),UI.main(BranchCmd1))\n \tassert_equal(UI.parseCommand('branch', BranchCmd2*\" \"),UI.main(BranchCmd2))\n \tassert_equal(UI.parseCommand('branch', BranchCmdInv*\" \"),UI.main(BranchCmdInv))\n end",
"def create\n @page_title = t('branches.new.title') \n @branches = Branch.all \n @branch = Branch.new(params[:branch])\n respond_to do |format|\n if @branch.save\n flash[:notice] = t('branches.new.success', :branch_name => @branch.name)\n format.html { redirect_to(edit_branch_url(@branch)) }\n format.xml { render :xml => @branch, :status => :created, :location => @branch }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @branch.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n #@branch = Branch.new(params[:branch])\n\n respond_to do |format|\n if @branch.save\n format.html { redirect_to(@branch, :notice => 'Branch was successfully created.') }\n format.xml { render :xml => @branch, :status => :created, :location => @branch }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @branch.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_branch!(branch)\n self.name = Job.name_for_branch(self.name, branch)\n xml = REXML::Document.new(self.data)\n REXML::XPath.first(xml, '/project/scm/branches/hudson.plugins.git.BranchSpec/name').text = REXML::XPath.first(xml, '/project/scm/branches/hudson.plugins.git.BranchSpec/name').text.gsub /template/, branch\n self.data = xml.to_s\n\n self\n end",
"def branch\n @branch ||= `git branch 2> /dev/null`[/\\*\\s(.+)$/, 1]\n end",
"def add_branch(widget_array, branches)\n score_hash = @scorer.get_score_hash(widget_array)\n score = @scorer.get_total_score(score_hash)\n added = false\n branches_index = 0\n if score_hash[@main_requirement_label] >= 0\n while !added && branches_index < branches.length do\n better_value=@scorer.get_better_score(score, branches[branches_index][1])\n if better_value == :equal || better_value == :first\n branches.insert(branches_index, [score_hash, score, widget_array])\n added = true\n end\n branches_index += 1\n end\n branches.push([score_hash, score, widget_array]) unless added\n end\n end",
"def other_branch\n @other_branch ||= `git branch | grep #{pattern}`.strip\n end",
"def in_pattern_branches\n node_parts[1...-1]\n end",
"def test_empty_branch\n #puts \"---------------test_branch-----------------\"\n t1 = t2 = nil\n GraphBuilder::Builder.build do |b|\n t1 = b.add(Thing1.new)\n b.branch do \n end\n t2 = b.add(Thing2.new)\n end\n\n r = Thing.links([t1,t2])\n assert_equal 1, r.size\n assert r.include? [t1,t2]\n end",
"def create_new_version__type_specific(repo_for_new_branch, new_version, opts = {})\n local = UpdateModule.ret_local(self, new_version, opts)\n # TODO: this is expensive in that it creates new version by parsing the dsl and reading back in;\n # would be much less expsensive to clone from branch to branch\n opts_update = { update_module_refs_from_file: true }.merge(opts)\n response = UpdateModule.new(self).create_needed_objects_and_dsl?(repo_for_new_branch, local, opts_update)\n response[:module_branch_idh].create_object\n end",
"def switch(new_branch)\n self.branch = new_branch\n update\n end",
"def switch(new_branch)\n self.branch = new_branch\n update\n end",
"def switch(new_branch)\n self.branch = new_branch\n update\n end",
"def add_branch ret\n return if @branch.nil?\n return if ret.include? @branch\n ret << @branch\n @branch.reachable ret\n end",
"def branches\n @branches ||= build_branches\n end",
"def new\n @branch = Branch.new\n respond_with(@branch)\n end",
"def branches(type = :master, dir = Dir.pwd, _options = {})\n FalkorLib::Git.config(\"gitflow.branch.#{type}\", dir)\n #confs[type.to_sym]\n end",
"def branch(group:nil)\n case group\n when :remote\n flag = \"-r\"\n when :all\n flag = \"-a\"\n when nil, :local\n flag = \"\"\n end\n\n `git branch #{flag}`.lines.map do |line|\n fields = line.split\n\n if fields.first['*']\n fields[1].strip\n else\n fields.first.strip\n end\n end\nend",
"def create\n @providers_branch = Providers::Branch.new(providers_branch_params)\n\n respond_to do |format|\n if @providers_branch.save\n format.html { redirect_to providers_branches_path, notice: 'Branch was successfully created.' }\n format.json { redirect_to providers_branches_path, status: :created, location: @providers_branch }\n else\n format.html { render :new }\n format.json { render json: @providers_branch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def branches\n zombie_check\n pattern = self.class.branch_pattern(:name => @name)\n @repo.branches.select{ |b| b.name =~ pattern }\n end",
"def branch(options={})\n puts \"#{self.class.name}.#{__method__}\"\n puts options.inspect\n \n new_seam = self.seam.branch(self.id, options)\n if self.seam.errors.present?\n puts self.seam.errors.inspect\n self.errors.add(:branch, \"Unable to branch\")\n else\n return new_seam\n end\n\n end",
"def new\n @branch = Branch.new(parent_id: params[:branch_id])\n if params[:branch_id]\n @branch_details = Branch.find(params[:branch_id])\n @title = \"Create a branch under #{@branch_details.name}\"\n end\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @branch }\n end\n end",
"def branch\n @env.fetch( :branch, \"N/A\" )\n end",
"def expand_when_branches(when_branches); end",
"def branch_name\n @branch_name ||= (0...19).map { (65 + rand(26)).chr }.join.downcase\n end",
"def create\n @branch = Branch.new(branch_params)\n\n respond_to do |format|\n if @branch.save\n format.html { redirect_to @branch, notice: 'Branch was successfully created.' }\n format.json { render action: 'show', status: :created, location: @branch }\n else\n format.html { render action: 'new' }\n format.json { render json: @branch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def clone_branch( )\n raise \"only support taxon root\" unless self.root?\n #raise \"only copy taxon from design site\" unless taxon.site.design?\n #raise \"taxon exists in current site\" if self.class.exists(:permalink=>self.permalink)\n cloned_branch = nil\n current_site_id = Spree::Site.current.id\n #maybe clone taxon from other site\n Spree::MultiSiteSystem.with_context_free_taxon{\n #copy from http://stackoverflow.com/questions/866528/how-to-best-copy-clone-an-entire-nested-set-from-a-root-element-down-with-new-tr\n new_taxonomy = self.taxonomy.dup\n new_taxonomy.site_id = current_site_id\n # should not save new_taxonomy here, or new_taxonomy.root.site_id is not current site id\n h = { self => self.custom_duplicate } #we start at the root\n ordered = self.descendants\n #clone subitems\n ordered.each do |item|\n h[item] = item.custom_duplicate\n end\n #resolve relations\n ordered.each do |item|\n cloned = h[item]\n item_parent = h[item.parent]\n item_parent.children << cloned if item_parent\n # handle icon\n end\n h.values.each{|cloned|\n cloned.site_id = new_taxonomy.site_id\n cloned.taxonomy = new_taxonomy\n }\n new_taxonomy.root = h[self]\n cloned_branch = h[self]\n }\n cloned_branch\n end",
"def create\n @branch = current_user.branches.new(branch_params)\n\n respond_to do |format|\n if @branch.save\n Tools.write2log(current_user.id, 'Добавление', 'Филиалы', 0, branch_params.to_s)\n format.html { redirect_to branches_path, notice: 'Филиал был успешно добавлен.' }\n format.json { render action: 'show', status: :created, location: @branch }\n else\n Tools.write2log(current_user.id, 'Добавление', 'Филиалы', 1, branch_params.to_s)\n format.html { render action: 'new' }\n format.json { render json: @branch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def branch \n extra[\"branch\"] \n end",
"def checkout(branch)\n zombie_check\n workdir = File.join(@repo.dir.to_s, \".worktree\", @name, branch)\n worktree = @repo.new_worktree(workdir, self.class.branch_name(@name, branch: branch)) \n end",
"def branch\n Branch[comparable.segments.first(2).join('.')]\n end",
"def dup_when_branches\n when_branches.dup\n end",
"def determine_branch_type(branch)\n return branch if (branch.downcase == \"develop\")\n branch =~ /^([a-zA-Z]+)-/\n if $1 && (%w(rc hotfix).member? $1.downcase)\n return $1.downcase\n else\n raise \"unrecognised branch prefix in '#{branch}'. Should be hotfix or rc\"\n end\nend",
"def build_branches\n branches_collection(coverage[:branches] || {})\n end",
"def create\n @tree=Tree.find(params[:branch][:tree_id])\n if @tree\n @branch = Branch.new()\n @branch.private=params[:branch][:private]\n @branch.name=params[:branch][:name]\n @branch.tree=@tree\n @latest_tip=@branch.tips.latest.first\n respond_to do |format|\n if @branch.save\n admin=Affiliation::Administration.new\n admin.user=current_user\n admin.entity=@branch\n admin.save\n #@branch.memberships.create({:user => current_user, :admin => true}, :as => :admin)\n format.html { redirect_to tree_branch_url @tree,@branch, notice: 'Branch was successfully created.' }\n format.json\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @branch.errors, status: :unprocessable_entity }\n format.js { render action: \"new\",status: :unprocessable_entity }\n end\n end\n else\n render :json => {:error=>\"not found\"},:status => 404\n end\n end",
"def saveas newbranch, message = nil\n message ||= \"Create new branch: #{newbranch}\"\n # First, create the new branch and switch to it.\n Dir.chdir @root do\n cmd = \"git checkout -b \\\"#{newbranch}\\\"\"\n stdout, stderr, status = Open3.capture3 cmd\n if status != 0\n case stderr\n when /not a valid branch name/\n raise InvalidParameter, \"#{newbranch} is not a valid branch name\"\n when /already exists/\n raise InvalidParameter, \"#{newbranch} already exists\"\n when /Not a git repository/\n raise NotARepositoryError\n else\n raise Error, stderr\n end\n end\n end\n # Next, save any working changes.\n begin\n Twit.save message\n rescue NothingToCommitError\n # New changes are not required for saveas.\n end\n end",
"def branches\n bodies = in_pattern_branches.map(&:body)\n if else?\n # `empty-else` node sets nil because it has no body.\n else_branch.empty_else_type? ? bodies.push(nil) : bodies.push(else_branch)\n end\n bodies\n end",
"def branchset\n\t\treturn Treequel::Branchset.new( self )\n\tend",
"def create_remote_branch\n Gitlab.create_branch(GITLAB_DOCS_REPO, docs_branch, 'master')\n puts \"=> Remote branch '#{docs_branch}' created\"\n\n pipelines = nil\n\n # Wait until the pipeline is started\n loop do\n sleep 1\n puts \"=> Waiting for pipeline to start...\"\n pipelines = Gitlab.pipelines(GITLAB_DOCS_REPO, { ref: docs_branch })\n break if pipelines.any?\n end\n\n # Get the first pipeline ID which should be the only one for the branch\n pipeline_id = pipelines.first.id\n\n # Cancel the pipeline\n Gitlab.cancel_pipeline(GITLAB_DOCS_REPO, pipeline_id)\nrescue Gitlab::Error::BadRequest\n puts \"=> Remote branch '#{docs_branch}' already exists\"\nend",
"def create\n\n @branch = Branch.new(branch_params)\n\n respond_to do |format|\n if @branch.save\n format.html { redirect_to @branch, notice: 'Store branch was successfully created.' }\n format.json { render action: 'show', status: :created, location: @branch }\n else\n format.html { render action: 'new' }\n format.json { render json: @branch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def find_branch(repo, branch)\n name, num = branch.split('-')\n\n variations = [ branch, \"#{name}#{num}\", \"#{name}_#{num}\" ]\n\n branches = %x( cd #{repo} ; git branch --list ).gsub('*', '').split(\"\\n\")\n branches.each do |b|\n b.strip!\n variations.each do |v|\n return b if (b == v)\n end\n end\n\n return nil\nend",
"def create(project_name)\n\t\tnew_branch_name = branch_generator(project_name)\n\t\tif project_name.nil?\n\t\t\tputs \"Missing project name!\"\n\t\telse\n\n\t\t\texec(\"\n\t\t\tmkdir #{@@default_directory}#{project_name.to_s} &&\n\t\t\tcd #{@@default_directory}#{project_name.to_s} &&\n\t\t\tgit init &&\n\t\t\tgit checkout -b master &&\n\t\t\tgit commit --allow-empty -m 'first commit' &&\n\t\t\tgit tag -a v0.0 -m 'first tag' &&\n\t\t\tgit checkout -b #{new_branch_name}\n\t\t\t\")\n\n\t\t\tsystem(\"cd #{@@default_directory}#{project_name.to_s}\")\n\t\t\tsave(project_name)\n\t\tend\n\tend",
"def branches\n bodies = when_branches.map(&:body)\n bodies.push(else_branch) if else?\n bodies\n end",
"def create\n @labbranch = labbranch.new(params[:labbranch])\n\n respond_to do |format|\n if @labbranch.save\n format.html { redirect_to @labbranch, notice: 'labbranch was successfully created.' }\n format.json { render json: @labbranch, status: :created, location: @labbranch }\n else\n format.html { render action: \"new\" }\n format.json { render json: @labbranch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_branch \n branch = case @os_svninfo['URL']\n when /trunk/ then \"trunk\"\n when /branches\\/private\\/([^\\/]+)/ then $1\n when /branches\\/([^\\/]+)/ then $1\n when /patches\\/([^\\/]+)/ then $1\n when /tags\\/([^\\/]+)/ then $1\n else fail(\"Can't determine which branch I'm operating on\")\n end\n branch\n end",
"def saveas newbranch, message = nil\n message ||= \"Create new branch: #{newbranch}\"\n begin\n if @git.empty?\n # For an empty repo, we can \"create a new branch\" by setting HEAD to\n # a symbolic reference to the new branch. Then, the next commit will\n # create that branch (instead of master).\n Rugged::Reference.create(@git, 'HEAD',\n \"refs/heads/#{newbranch}\", true)\n else\n # For a non-empty repo, we just create a new branch and switch to it.\n branch = @git.create_branch newbranch\n @git.head = branch.canonical_name\n end\n rescue Rugged::ReferenceError => error\n case error.message\n when /is not valid/\n raise InvalidParameter, \"#{newbranch} is not a valid branch name\"\n when /already exists/\n raise InvalidParameter, \"#{newbranch} already exists\"\n else\n raise Error, \"Internal Rugged error: #{error.message}\"\n end\n end\n\n # Next, save any working changes.\n begin\n save message\n rescue NothingToCommitError\n # New changes are not required for saveas.\n end\n end",
"def branch(**new_options)\n if self.is_a?(Builder)\n options = self.options\n else\n options = DEFAULT_OPTIONS.merge(processor: self::Processor)\n end\n\n options = options.merge(new_options) do |key, old_value, new_value|\n case key\n when :loader, :saver then old_value.merge(new_value)\n when :operations then old_value + new_value\n else new_value\n end\n end\n\n Builder.new(options.freeze)\n end",
"def build_branch(group, opts = {})\n group_hash = group.to_hash(opts)\n\n group_entries = find_entries(group: group)\n descendant_groups = find_groups(parent: group)\n\n unless group_entries.nil?\n group_hash['entries'] = []\n group_entries.each { |e| group_hash['entries'] << e.to_hash(opts) }\n end\n\n unless descendant_groups.nil?\n group_hash['groups'] = []\n # Recursively build branch for descendant groups\n descendant_groups.each { |g| group_hash['groups'] << build_branch(g, opts) }\n end\n\n group_hash\n end",
"def show_entry( pattern )\n\t\tdir = self.directory\n\t\tbranch = Treequel::Branch.new( dir, pattern )\n\n\t\tif !branch.exists?\n\t\t\tbranch = Treequel::Branch.new( dir, pattern + ',' + dir.base_dn )\n\t\tend\n\n\t\tif !branch.exists?\n\t\t\tbranch = dir.filter( pattern ).first\n\t\tend\n\n\t\tif !branch\n\t\t\tself.prompt.say( self.prompt.color(\"No match.\", :error) )\n\t\tend\n\n\t\tyaml = self.branch_as_yaml( branch )\n\t\tself.prompt.say( yaml )\n\tend",
"def current_branch; end",
"def current_branch; end",
"def create_clone_with_branch(type, module_name, repo_url, branch=nil, version=nil, module_namespace=nil, opts={})\n Response.wrap_helper_actions do\n full_name = module_namespace ? ModuleUtil.resolve_name(module_name, module_namespace) : module_name\n\n modules_dir = modules_dir(type,full_name,version,opts)\n FileUtils.mkdir_p(modules_dir) unless File.directory?(modules_dir)\n\n target_repo_dir = local_repo_dir(type,full_name,version,opts)\n if File.exists?(target_repo_dir)\n # if local copy of module exists then move that module to backups location\n if opts[:backup_if_exist]\n backup_dir = backup_dir(type, full_name)\n FileUtils.mv(target_repo_dir, backup_dir)\n puts \"Backup of existing module directory moved to '#{backup_dir}'\"\n else\n raise ErrorUsage.new(\"Directory '#{target_repo_dir}' is not empty; it must be deleted or removed before retrying the command\", :log_error => false)\n end\n end\n\n begin\n opts_clone = (opts[:track_remote_branch] ? {:track_remote_branch => true} : {})\n GitAdapter.clone(repo_url, target_repo_dir, branch, opts_clone)\n rescue => e\n # Handling Git error messages with more user friendly messages\n e = GitErrorHandler.handle(e)\n\n #cleanup by deleting directory\n FileUtils.rm_rf(target_repo_dir) if File.directory?(target_repo_dir)\n error_msg = \"Clone to directory (#{target_repo_dir}) failed\"\n\n DtkLogger.instance.error_pp(e.message, e.backtrace)\n\n raise ErrorUsage.new(error_msg, :log_error => false)\n end\n {\"module_directory\" => target_repo_dir}\n end\n end",
"def dup\n self_dup = BranchNode.new(@name)\n each_child { |child| self_dup.add_child(child.dup) }\n self_dup\n end",
"def branch\n raise NotImplementedError.new(\"branch() must be implemented by subclasses of AbstractChangeset.\")\n end",
"def add_branch?(new_branch, opts = {})\n add_branch = true\n if get_branches.include?(new_branch)\n if opts[:delete_existing_branch]\n delete_local_and_remote_branch(new_branch)\n else\n add_branch = false\n end\n end\n add_branch(new_branch, opts.merge(add_remote_files_info: nil)) if add_branch\n\n add_remote_files?(new_branch, opts[:add_remote_files_info])\n end",
"def expand_elses(branch); end",
"def expand_elses(branch); end",
"def create\n @branch_route = BranchRoute.new(permitted_params.branch_route)\n\n respond_to do |format|\n if @branch_route.save\n format.html { redirect_to @branch_route, notice: 'Branch route was successfully created.' }\n format.json { render action: 'show', status: :created, location: @branch_route }\n else\n format.html { render action: 'new' }\n format.json { render json: @branch_route.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.74253404",
"0.720424",
"0.70681125",
"0.69828886",
"0.69017947",
"0.6719717",
"0.6583488",
"0.6475421",
"0.6410504",
"0.63235855",
"0.6309198",
"0.6285649",
"0.6161878",
"0.6157274",
"0.60705686",
"0.5995742",
"0.59907097",
"0.5961429",
"0.5957209",
"0.5928284",
"0.5857041",
"0.5837041",
"0.5804782",
"0.5800244",
"0.5744317",
"0.57173836",
"0.56937826",
"0.5665879",
"0.564525",
"0.5636139",
"0.5635192",
"0.56223285",
"0.5585386",
"0.55229634",
"0.5505675",
"0.5455408",
"0.5448008",
"0.544742",
"0.54205525",
"0.54100287",
"0.5392436",
"0.5388212",
"0.5378522",
"0.5370191",
"0.53662074",
"0.5365296",
"0.53650564",
"0.53562206",
"0.5350819",
"0.5349061",
"0.5348811",
"0.5344542",
"0.53397024",
"0.53397024",
"0.53397024",
"0.53237194",
"0.5322983",
"0.53089905",
"0.53059375",
"0.53040785",
"0.5261048",
"0.52415365",
"0.5241273",
"0.5241207",
"0.523016",
"0.52188385",
"0.5212194",
"0.52063423",
"0.52003014",
"0.5193032",
"0.51896834",
"0.51852506",
"0.51839817",
"0.51777023",
"0.5176538",
"0.51740044",
"0.51650465",
"0.5159994",
"0.5154202",
"0.5152269",
"0.51430744",
"0.5136085",
"0.5135447",
"0.5103971",
"0.5102866",
"0.5102665",
"0.51023334",
"0.5101675",
"0.5091278",
"0.5091255",
"0.50747967",
"0.50656784",
"0.50656784",
"0.5064039",
"0.50603896",
"0.50497526",
"0.5045257",
"0.5042914",
"0.5042914",
"0.50419605"
] | 0.69494015 | 4 |
Creates a new type of pattern matcher from a set of branches | def create_pattern_match(branches:)
Qo::PatternMatchers::PatternMatch.create(branches: branches)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_matcher(options, whitelist_option, blacklist_option); end",
"def match(*args)\n if args.first.is_a?(Qo::Matchers::GuardBlockMatcher)\n Qo::Matchers::PatternMatch.new(*args)\n else\n match_target, *qo_matchers = args\n Qo::Matchers::PatternMatch.new(*qo_matchers).call(match_target)\n end\n end",
"def in_pattern_branches\n node_parts[1...-1]\n end",
"def parse_branches\n branches = []\n\n pos = @s.pos\n res = parse_seq\n if res\n branches << res\n else\n @s.pos = pos\n return branches\n end\n\n while @s.scan(/\\s*\\|\\s*/)\n branches << expect(:parse_seq)\n end\n Branches.new branches\n end",
"def branches\n bodies = in_pattern_branches.map(&:body)\n if else?\n # `empty-else` node sets nil because it has no body.\n else_branch.empty_else_type? ? bodies.push(nil) : bodies.push(else_branch)\n end\n bodies\n end",
"def patterns\n # BNodes in statements are existential variables.\n @patterns ||= enum_for(:each_pattern).to_a\n end",
"def case_branches(branches)\n branches.select do |branch|\n id == branch.root_id && branch.start_line != start_line\n end\n end",
"def make_pattern pattern\n state = :close\n rule = ''\n last_ch = ''\n pattern.split('').each do |ch|\n case ch\n when '('\n state = :open\n rule << '('\n when ')'\n state = :close\n rule << ')'\n else\n case state\n when :open\n case last_ch\n when '('\n else\n rule << '|'\n end\n rule << ch\n when :close\n rule << \"[#{ch}]\"\n end\n end\n last_ch = ch\n end\n Regexp.new rule\nend",
"def match(pattern); end",
"def build_branch_list\n local_branches = `git branch`.split(' ')\n active_branch_index = local_branches.index('*')\n\n local_branches.reject { |i| i == '*' }.map.with_index do |b, i|\n BranchModel.new(b, i == active_branch_index)\n end\n end",
"def define_match_any_of\n klass.send(:define_method, :match_any_of) do |tags|\n if tags.empty?\n str(\"\")\n else\n tags.map { |tag| str(tag) }.inject do |tag_chain, tag|\n tag_chain.send :|, tag\n end\n end\n end\n end",
"def expand_when_branches(when_branches); end",
"def nonstrict_match(tokens)\n matchset = MatchSet.new()\n index = 0;\n tokens.each do |token|\n break unless pattern[index]\n tagger_name = pattern[index].to_s\n klass = constantize(tagger_name)\n match = token.has_tag?(klass) \n if match\n matchset << token.get_tag(klass);\n index += 1; \n next; \n else\n next\n end\n end\n\n return false if matchset.size != pattern.size\n return matchset\n end",
"def matchtask(regex, split = nil)\n tasks = []\n regex.each do |r|\n @message.scan(eval(r['pattern'])).each do |arr|\n if split.nil?\n task = PACTask.new(arr[0])\n task.add_commit(self)\n self.referenced = true\n task.label = r['label']\n tasks << task\n else\n arr[0].split(split).each do |s|\n task = PACTask.new(s)\n task.add_commit(self)\n task.label = r['label']\n self.referenced = true\n tasks << task\n end\n end\n end\n end\n\n tasks\n end",
"def initialize\n @matchers = []\n @matches = {}\n end",
"def branches\n bodies = when_branches.map(&:body)\n bodies.push(else_branch) if else?\n bodies\n end",
"def match(tokens, definitions)\n token_index = 0\n @pattern.each do |elements|\n was_optional = false\n elements = [elements] unless elements.is_a?(Array)\n\n elements.each_index do |i|\n name = elements[i].to_s\n optional = name[-1, 1] == '?'\n name = name.chop if optional\n\n case elements[i]\n when Symbol\n if tags_match?(name, tokens, token_index)\n token_index += 1\n break\n else\n if optional\n was_optional = true\n next\n elsif i + 1 < elements.count\n next\n else\n return false unless was_optional\n end\n end\n\n when String\n return true if optional && token_index == tokens.size\n\n if definitions.key?(name.to_sym)\n sub_handlers = definitions[name.to_sym]\n else\n raise \"Invalid subset #{name} specified\"\n end\n\n sub_handlers.each do |sub_handler|\n return true if sub_handler.match(tokens[token_index..tokens.size], definitions)\n end\n else\n raise \"Invalid match type: #{elements[i].class}\"\n end\n end\n\n end\n\n return false if token_index != tokens.size\n return true\n end",
"def init(match)\n self.match = match\n match = match[0] if match.kind_of?(Array) && match.length == 1\n case match\n when String then init_string match\n when Regexp then init_regex match\n when Symbol then init_rule match\n when PatternElementHash then init_hash match\n when Array then init_array match\n else raise \"invalid pattern type: #{match.inspect}\"\n end\n end",
"def or_matcher(*args)\n OrMatcher.new(args)\n end",
"def pattern\n Regexp.union(pattern_classifiers.map(&:pattern))\n end",
"def create_matcher(type, name, &block)\n matcher = StepMatcher.new(name, &block)\n @hash_of_lists_of_matchers[type] << matcher\n matcher\n end",
"def pattern_candidates(pattern,representative)\n candidate_set_for_syntax_trees(representative.head_trees,@category_filters,pattern)\n end",
"def match(*list)\n @match.concat(makelist(list)) unless list.empty?\n @match\n end",
"def match_with(pattern)\n offset = 0\n conditions = [pattern]\n conditions << pattern[0..-2] if pattern != \"/\" && pattern.end_with?(\"/\")\n loop.with_object([]) do |_, candidacies|\n return candidacies unless conditions.any?{ |x| @regexps[offset] === x }\n route = @routes[offset..-1].detect{ |route| Regexp.last_match[\"_#{route.index}\"] }\n candidacies << route\n offset = route.index + 1\n end\n end",
"def matching_sets(path, type); end",
"def af_pattern(tests, id, af)\n asn, vrf, nbr, afi, safi = af.values\n if tests[id][:ensure] == :present\n if vrf[/default/]\n [/router bgp #{asn}/, /neighbor #{nbr}/,\n /address-family #{afi} #{safi}/]\n else\n [/router bgp #{asn}/, /vrf #{vrf}/, /neighbor #{nbr}/,\n /address-family #{afi} #{safi}/]\n end\n else\n if vrf[/default/]\n [/router bgp #{asn}/, /neighbor #{nbr}/]\n else\n [/router bgp #{asn}/, /vrf #{vrf}/, /neighbor #{nbr}/]\n end\n end\nend",
"def match(tokens, definitions); end",
"def pattern_create(length, sets = nil)\n Rex::Text.pattern_create(length, sets)\n end",
"def methods_matching(re); end",
"def get_patterns\n patterns = BASE_PATTERNS\n # add the colour keywords. generate these from the colour wheel's constants\n colours = Yay::ColourWheel::all_names.join('|')\n patterns.unshift [:colour, Regexp.new(\"\\\\b(#{colours})\\\\b\", Regexp::IGNORECASE)]\n return patterns\n end",
"def create pat, args = Hash.new\n negated = args[:negated]\n ignorecase = args[:ignorecase]\n wholewords = args[:wholewords]\n wholelines = args[:wholelines]\n extended = args[:extended]\n multiline = args[:multiline]\n\n flags = pattern_to_flags pat\n arg = flags_to_arg flags\n\n pat = pat.sub @pattern_re, '\\1'\n\n if wholewords\n pat = '\\b' + pat + '\\b'\n elsif wholelines\n pat = '^' + pat + '$'\n end\n\n cls = negated ? NegatedRegexp : Regexp\n return cls.new pat, arg\n end",
"def initialize( *patterns )\n @pending_add = []\n @pending = false\n @exclude_patterns = DEFAULT_IGNORE_PATTERNS.dup\n @exclude_re = nil\n @items = []\n patterns.each { |pattern| include(pattern) }\n yield self if block_given?\n end",
"def bags_containing_target(rules, target: TARGET_BAG)\n tree = create_tree(rules)\n tree.select { |node| node.color != target && node.contains_color?(target) }\nend",
"def test_branches_all\n branches = @lib.branches_all\n assert(branches.size > 0)\n assert(branches.select { |b| b[1] }.size > 0) # has a current branch\n assert(branches.select { |b| /\\//.match(b[0]) }.size > 0) # has a remote branch\n assert(branches.select { |b| !/\\//.match(b[0]) }.size > 0) # has a local branch\n assert(branches.select { |b| /master/.match(b[0]) }.size > 0) # has a master branch\n end",
"def submatchers; end",
"def initialize(pattern, match_opts = {})\n @pattern = pattern\n @match = \"\"\n self.match(match_opts) unless match_opts.empty?\n yield self if block_given?\n end",
"def match(*pattern, &block)\n\t\t\t@rules << Rule.new(pattern, block)\n\t\tend",
"def create_matcher(type, name, &block)\n matcher = Step.new(name, &block)\n @hash_of_lists_of_steps[type] << matcher\n matcher\n end",
"def and_matcher(*args)\n AndMatcher.new(args)\n end",
"def classes_matching_patterns(patterns, ant, platform, build_results)\n out = PathSet.new\n \n patterns.each do |pattern|\n # Yup, gotta use a fresh, new Ant property name each time. Yuck.\n path_property_name = platform.next_ant_property_name('patterns_search_path')\n classes_directory = build_results.classes_directory(self).to_s\n pattern_spec = \"**/%s.class\" % pattern\n \n ant.path(:id => path_property_name) {\n ant.fileset(:dir => classes_directory, :includes => pattern_spec)\n }\n\n property_name = platform.next_ant_property_name('patterns_search_path_property')\n # This turns the path into an Ant property. Double yuck, but necessary.\n ant.property(:name => property_name, :refid => path_property_name)\n out << ant.get_ant_property(property_name)\n end\n \n out\n end",
"def matches?(pattern); end",
"def pattern_candidates(pattern,representative)\n candidate_set_for_syntax_trees(representative_head_trees(representative),@category_filters,pattern) #TODO representative_head_trees?\n end",
"def pattern2regex(pattern); end",
"def candidate_set_for_syntax_trees(trees, filters,pattern=nil)\n candidate_set = @candidate_set_factory.new\n trees.each do |tree|\n names = @simplifier_factory.new(tree).simplify.to_a\n if pattern\n names.select! do |name|\n # Pattern won't match too specific name, e.g.\n # \"X almumni\" does not match /University alumni/\n pattern =~ /#{name}/\n end\n end\n head_node = tree.find_head_noun\n next unless head_node\n head = head_node.content\n names.each do |name|\n simplified_name = singularize_name(name, head)\n candidates = candidates_for_name(simplified_name, filters)\n unless candidates.empty?\n candidate_set.add(name,candidates)\n break\n end\n end\n end\n candidate_set\n end",
"def match(*template)\r\n return parse(template, MATCH_FAILACTION)\r\n end",
"def on_match_pattern(node); end",
"def initialize(*patterns)\n @pending_add = []\n @pending = false\n @exclude_patterns = DEFAULT_IGNORE_PATTERNS.dup\n @exclude_re = nil\n patterns.each { |pattern| include(pattern) }\n yield self if block_given?\n end",
"def match_maker (condition, *input)\n\tresult = []\n\tif condition == true\n\t\tinput.each_slice(2) { |i, j|\n\t\t\tif i == !!j \n\t\t\t\tresult << false \n\t\t\telse\n\t\t\t\tresult << true \n\t\t\tend\n\t\t}\n\telsif condition == false\n\t\tinput.each_slice(2) { |i, j|\n\t\t\tif i == !j\n\t\t\t\tresult << true \n\t\t\telse\n\t\t\t\tresult << false \n\t\t\tend\n\t\t}\n\tend\n\tresult\nend",
"def build_tree( what, preset )\n what.gsub!(/\\r/, '')\n preset = :default unless @@presets[preset]\n\n # 1. get all matches.\n matches = all_matches(@@presets[preset][:re], what)\n\n # 2. step by step check`n`build\n tree = []\n token = false\n token_list = []\n\n matches.each do |match|\n unless match.fake\n if match.plain\n token = get_class(@@presets[preset][:empty]).new\n token.bind self\n token.set_next_preset @@presets[preset][:next]\n token_list = token.build(match.match, tree.last)\n token_list.each do |tok|\n tree << tok\n end if token_list\n else\n no_match = true\n @@presets[preset][:list].each do |item|\n struct = get_class(item).detect(match.match)\n if struct\n token = get_class(item).new\n token.bind self\n token.set_next_preset @@presets[preset][:next]\n token_list = token.build(struct, tree.last)\n token_list.each do |tok|\n tree << tok\n end if token_list\n no_match = false\n break\n end\n end\n if no_match # same as plain, welcome copypaster!\n token = get_class(@@presets[preset][:empty]).new\n token.bind self\n token.set_next_preset @@presets[preset][:next]\n token_list = token.build(match.match, tree.last)\n token_list.each do |tok|\n tree << tok\n end if token_list\n end\n end\n end\n end\n\n tree\n end",
"def on_matching_regex(controller_regex, action_regex = nil)\n @conditions << construct_condition_for_regex(controller_regex, action_regex)\n end",
"def build_match(home_team, away_team)\n raise 'Not Implemented'\n end",
"def test_branch\n #puts \"---------------test_branch-----------------\"\n t1= nil\n t2 = nil\n t11 = nil\n t12 = nil\n GraphBuilder::Builder.build do |b|\n t1 = b.add(Thing1.new)\n b.branch do \n t11 = b.add(Thing11.new)\n t12 = b.add(Thing12.new)\n end\n t2 = b.add(Thing2.new)\n end\n\n r = Thing.links([t1,t2,t11,t12])\n assert_equal 4, r.size\n assert r.include? [t1,t11]\n assert r.include? [t1,t12]\n assert r.include? [t11,t2]\n assert r.include? [t12,t2]\n end",
"def match(&block)\n begin\n @env_used = true\n map = @suite_map ? @env.suite_map_path(@map) : @map\n @match = Bcpm::Tests::TestMatch.new @side, @vs, map, @env, @options\n self.class_eval(&block)\n @matches << @match\n ensure\n @match = nil\n end\n end",
"def match_maker(a, *b)\n\tarray = (0...b.count).to_a\n\tnew_array = []\n\tanswer = []\n\tarray.each_slice(2){ |i| new_array << i }\n\t\nif a == false\n\tnew_array.each { |i| \n\t\tb[i[0]], b[i[1]] = !!b[i[0]], !!b[i[1]]\n\t\tb[i[0]] == b[i[1]] ? answer << true : answer << false }\n\nelsif a == true\n\tnew_array.each { |i|\t\t\n\t\tb[i[0]], b[i[1]] = !!b[i[0]], !!b[i[1]]\n\t\tb[i[0]] != b[i[1]] ? answer << true : answer << false }\nelse\nend\nanswer\nend",
"def match(pattern, options = {})\n options = {:use_prefix => true, :use_suffix => true, :method => :execute}.merge(options)\n @matchers << Match.new(pattern, options[:use_prefix], options[:use_suffix], options[:method])\n end",
"def candidate_set_for_syntax_trees(trees,filters,pattern=nil)\n candidate_set = @candidate_set_factory.new\n trees.each do |tree|\n names = @simplifier_factory.new(tree).simplify.to_a\n if pattern\n names.select! do |name|\n # Pattern won't match too specific name, e.g.\n # \"X alumni\" does not match /University alumni/\n pattern =~ /#{name}/\n end\n end\n head_node = tree.find_head_noun\n next unless head_node\n head = head_node.content\n names.each do |name|\n simplified_names = @nouns.singularize_name(name, head)\n candidates = []\n simplified_names.each do |simplified_name|\n candidates.concat(candidates_for_name(simplified_name, filters))\n end\n unless candidates.empty?\n candidate_set.add(name,candidates)\n break unless @all_subtrees\n end\n end\n end\n candidate_set\n end",
"def patterns; end",
"def any_of(*matcher_names, &action)\n matcher_names.each do |name|\n append_action(matchers[name], action)\n end\n self\n end",
"def initialize(*patterns)\n @pending_add = []\n @pending = false\n @exclude_patterns = DEFAULT_IGNORE_PATTERNS.dup\n @exclude_procs = DEFAULT_IGNORE_PROCS.dup\n @items = []\n patterns.each { |pattern| include(pattern) }\n yield self if block_given?\n end",
"def patterns\n @patterns ||=\n [\n {\n :type => :erb,\n :rx => /\\.erb\\Z/,\n :rep => '',\n },\n {\n :type => :none,\n :rx => /\\Z/,\n :rep => '',\n },\n ]\n end",
"def &(matcher)\n AndMatcher.new([self,matcher])\n end",
"def branches\n zombie_check\n pattern = self.class.branch_pattern(:name => @name)\n @repo.branches.select{ |b| b.name =~ pattern }\n end",
"def matcher; end",
"def matcher; end",
"def build_regexp(level)\n regexp_string = \"^.*?\"\n i = 1\n while i < level\n regexp_string += \"\\/.*?\" \n i +=1\n end\n regexp_string += \"(?=\\/)\"\n Regexp.new(regexp_string)\n end",
"def create_regex(arr)\n return nil if arr.empty?\n\n regex_str = arr.join('|')\n Regexp.new(regex_str)\nend",
"def build_exception_matcher(exceptions); end",
"def branches\n @branches ||= build_branches\n end",
"def Pattern(*pattern)\n (self.class)::B._clear_bindings!(caller_locations(1,1)[0].label)\n ::PatternMatching::PatternMatch.new(*pattern)\n end",
"def fnmatch(matcher); end",
"def matcher(*array_matchers, **keyword_matchers, &fn)\n Qo::Matchers::GuardBlockMatcher.new(*array_matchers, **keyword_matchers, &fn)\n end",
"def build_regex_from_pattern( pattern )\n regex_str = pattern.gsub('/','\\\\/').gsub('+','[^\"\\/\"]+').gsub('\\/#','.*').gsub('#','.*')\n Regexp.new regex_str\n end",
"def build_matcher(trigger)\r\n if trigger[0] == \"/\" && trigger[-1] == \"/\"\r\n trigger = trigger[1..-2]\r\n @matcher = /#{trigger}/\r\n else\r\n @matcher = (self.implicit ? /(^|\\s)#{trigger}($|\\s)/ : /^#{trigger}($|\\s)/)\r\n end\r\n end",
"def each_logical_path(*args, &block)\n return to_enum(__method__, *args) unless block_given?\n\n filters = args.flatten.map { |arg| Manifest.compile_match_filter(arg) }\n logical_paths.each do |a, b|\n if filters.any? { |f| f.call(a, b) }\n if block.arity == 2\n yield a, b\n else\n yield a\n end\n end\n end\n\n nil\n end",
"def each_logical_path(*args, &block)\n return to_enum(__method__, *args) unless block_given?\n\n filters = args.flatten.map { |arg| Manifest.compile_match_filter(arg) }\n logical_paths.each do |a, b|\n if filters.any? { |f| f.call(a, b) }\n if block.arity == 2\n yield a, b\n else\n yield a\n end\n end\n end\n\n nil\n end",
"def initialize(pattern, rep_name, block, params = {})\n # TODO: remove me\n unless pattern.is_a?(Nanoc::Int::StringPattern) || pattern.is_a?(Nanoc::Int::RegexpPattern)\n raise 'Can only create rules with patterns'\n end\n\n @pattern = pattern\n @rep_name = rep_name.to_sym\n @snapshot_name = params[:snapshot_name]\n\n @block = block\n end",
"def reduce_match_string(_production, _range, _tokens, theChildren)\n MatchTest.new(theChildren.last)\n end",
"def glob!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 7 )\n\n type = GLOB\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 42:5: ( '?' | '*' )+\n # at file 42:5: ( '?' | '*' )+\n match_count_12 = 0\n while true\n alt_12 = 2\n look_12_0 = @input.peek( 1 )\n\n if ( look_12_0 == 0x2a || look_12_0 == 0x3f )\n alt_12 = 1\n\n end\n case alt_12\n when 1\n # at line \n if @input.peek(1) == 0x2a || @input.peek(1) == 0x3f\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n else\n match_count_12 > 0 and break\n eee = EarlyExit(12)\n\n\n raise eee\n end\n match_count_12 += 1\n end\n\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 7 )\n\n end",
"def create_match_method(name)\n \n instance_variable_name = :\"@#{name}_implementations\"\n \n instance_variable_set(instance_variable_name, [])\n klass = self\n \n define_method(name) do |*arguments|\n clauses = klass.instance_variable_get(instance_variable_name)\n pattern, proc = clauses.find do |pattern, proc| \n pattern === arguments\n end\n \n unless proc\n begin\n super(*arguments)\n rescue NoMethodError => e\n patterns = clauses.map(&:first)\n raise NoMethodError.new(\"There is no Method matching these Arguments: #{arguments.inspect}, available patterns: #{patterns.inspect}\")\n end\n else\n instance_exec(*arguments, &proc)\n end\n \n end\n end",
"def patterns\n #@rules.every.pattern\n @rules.map {|r| r.pattern }\n end",
"def match_args(matchlist,cmd)\n matches = ArgumentMatches.new \n \n match_proc = []\n cmd_match = []\n matchlist.each do |m|\n if m.is_a? MatchProc\n match_proc << m\n cmd_match << StateProcessorFunction\n else\n cmd_match << m\n end\n end\n\n indifferent_match = lambda do |match,arg|\n if match.is_a?(Symbol) || arg.is_a?(Symbol)\n begin\n return arg if arg.to_sym == match.to_sym \n rescue NoMethodError \n return false\n end\n else\n return arg if arg == match\n end\n end\n\n cmd_match.each_with_index do |arg,i|\n next if arg == StateProcessorFunction\n if arg == StateProcessorMatch\n matches << cmd[i] \n elsif arg == StateProcessorConsume\n matches.save << cmd[i] \n else\n test = cmd[i]\n f = case arg\n when Array \n test = test.to_sym rescue test\n arg.include?(test) \n when Regexp \n arg.match(test.to_s)\n when Hash\n arg == test\n when Proc\n # this seems a hair tacky\n arg === test\n else\n indifferent_match.call(arg, cmd[i])\n end\n matches << arg if f\n end\n end\n\n match_proc.each do |mp|\n cmd.each do |c|\n match_action = mp.call(c)\n if match_action == StateProcessorMatch\n matches << c \n elsif match_action == StateProcessorConsume\n matches.save << c \n end\n end\n end\n \n raise NoMatchException unless matches.total_matches >= matchlist.size\n matches \n end",
"def expand_elses(branch); end",
"def expand_elses(branch); end",
"def match(chrs, op = T.unsafe(nil)); end",
"def parse_branch_right lhs\n parse_eols\n op = @s.scan(/[\\t\\ ]*(\\/[\\*\\+\\?]?)[\\t\\ ]*/)\n return if !op\n op = Token.new('op.branch', op.strip)\n terms = []\n while t = parse_term\n terms << t\n end\n Branch[op, lhs, terms, parse_callback]\n end",
"def match(matcher, handler)\n routes << Route.new(matcher, handler)\n end",
"def underlying_matcher; end",
"def underlying_matcher; end",
"def submatcher; end",
"def submatcher; end",
"def create_matches(matches)\n matches.each do |home_team, away_team|\n create_match(home_team, away_team)\n end\n end",
"def initialize(pattern)\n @pattern = pattern\n end",
"def on_match_pattern_p(node); end",
"def get_target_branches\n unless @target_branches\n fetch_all\n base = @config['branches']['production']\n allowed_branches = @config['branches'].values\n allowed_branches << @config['prefixes']['release'] if @config['prefixes']['release']\n banned_branches = ['HEAD']\n target_branches = `git branch -r origin/#{base} | grep -ie '\\\\(#{allowed_branches.join(\"\\\\|\")}\\\\)' | grep -iv '\\\\(#{banned_branches.join(\"\\\\|\")}\\\\)' | sed -e 's/origin\\\\///g'`\n @target_branches = target_branches.split(\"\\n\").map{|a| a.gsub(/\\s+/, \"\")}\n end\n @target_branches\n end",
"def init_many(hash)\n # generate single_parser\n pattern_element = PatternElement.new(hash[:many], @init_options.merge(name:hash[:as]))\n\n # generate delimiter_pattern_element\n many_delimiter_pattern_element = hash[:delimiter] && PatternElement.new(hash[:delimiter], @init_options.merge(name:hash[:delimiter_name]))\n\n # generate many-parser\n self.parser = lambda do |parent_node|\n parent_node.match_name_is_poly(pattern_element.name)\n\n # fail unless we can match at least one\n return unless parent_node.match pattern_element\n\n if many_delimiter_pattern_element\n parent_node.match_name_is_poly(many_delimiter_pattern_element.name)\n # delimited matching\n while (parent_node.attempt_match do\n parent_node.match_delimiter &&\n parent_node.match(many_delimiter_pattern_element).tap{|md|md&&md.many_delimiter=true} &&\n parent_node.match_delimiter &&\n parent_node.match(pattern_element)\n end)\n end\n else\n # not delimited matching\n while (parent_node.attempt_match do\n parent_node.match_delimiter &&\n parent_node.match(pattern_element)\n end)\n end\n end\n parent_node\n end\n end",
"def match_maker(*el)\n\nnewEl = []\nel.each do |x|\n x == true ? x : x == false ? x : x.nil? == true ? x = false : x = true\n newEl << x\nend\n\ndefiningBool = newEl.shift\n\nresult = []\nnewEl.each_slice(2) { |a,b| result << [a,b]}\n\nif definingBool == false\n\nresult.each_with_index do |arr, index|\nresult[index] = (arr[0] == arr[1] )\nend\n\nelse\n result.each_with_index do |arr, index|\n result[index] = !(arr[0] == arr[1])\nend\n\nend\nresult\n\nend",
"def initialize(env) #:nodoc:\n @env = env.dup\n # a parent router may be assuming a successful match\n # but this subrouter may not, so we explicitly set it to not matched\n # on creation\n not_matched\n @rules = []\n # Actually create the rules so that the procs we create are in the\n # context of an instance of this object. This is most important when the\n # rule is based on a symbol. We need that symbol to resolve to an\n # instance method; however, instance methods are not available until\n # after an instance is created.\n self.class.rules.each {|rule| match *rule }\n\n @prerequisites = []\n self.class.prerequisites.each do |prerequisite|\n @prerequisites << normalize_match_params(prerequisite)\n end\n end",
"def roboclassify(desc)\n @pat_matches = []\n Pattern.all.each do |pattern|\n @pat_matches += pattern.codes if regex(pattern).match(desc)\n end\n @pat_matches\n end",
"def matchers\n Argument::Matcher.subclasses.map { |subclass| subclass.new(@arguments) }\n end",
"def matching_lines(regex); end"
] | [
"0.6051287",
"0.5499758",
"0.54571134",
"0.5445732",
"0.53744024",
"0.5301951",
"0.52606374",
"0.51869124",
"0.5180006",
"0.5111025",
"0.5105657",
"0.5097023",
"0.505593",
"0.5021175",
"0.5005874",
"0.49785346",
"0.49457228",
"0.49292594",
"0.49196014",
"0.490118",
"0.4895908",
"0.48738444",
"0.4863078",
"0.4860664",
"0.485692",
"0.4846122",
"0.48432752",
"0.48234537",
"0.48219657",
"0.48167187",
"0.48158866",
"0.48076978",
"0.48063016",
"0.47902215",
"0.4788251",
"0.47856092",
"0.47841406",
"0.4781095",
"0.47797757",
"0.4764373",
"0.47627124",
"0.47600922",
"0.47598013",
"0.47570115",
"0.4737451",
"0.47251552",
"0.47214967",
"0.47146586",
"0.47095323",
"0.47032505",
"0.4676001",
"0.46631768",
"0.46606293",
"0.46597615",
"0.4659692",
"0.46585968",
"0.46585858",
"0.46545184",
"0.46501184",
"0.46446478",
"0.4640308",
"0.4637789",
"0.46293852",
"0.46293852",
"0.46254784",
"0.46190405",
"0.46183795",
"0.46127677",
"0.46105272",
"0.46000597",
"0.45922002",
"0.45641956",
"0.45575958",
"0.45574123",
"0.45574123",
"0.45503125",
"0.45485115",
"0.45396444",
"0.45334682",
"0.45229626",
"0.45209092",
"0.45208052",
"0.45208052",
"0.4510901",
"0.4501908",
"0.45001808",
"0.44995955",
"0.44995955",
"0.44982728",
"0.44982728",
"0.44917366",
"0.44885135",
"0.44874996",
"0.44859174",
"0.44806856",
"0.44771236",
"0.44669288",
"0.44593823",
"0.44575638",
"0.4456897"
] | 0.7791935 | 0 |
GET /refunds GET /refunds.json | def index
respond_to do |format|
format.html # index.html.erb
format.json { render json: @refunds }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refunds\n RefundRepository.new(api).all(token)\n end",
"def refund(tid, refund)\n begin\n #creating url\n url = \"#{@security.environment}/transactions/#{tid}/refunds\"\n\n # make the request.\n json_response = Rede::CommonRequest::post(url, refund, @security)\n\n # mapping the result.\n response = Rede::RefundResponse.map(json_response)\n\n rescue Exception => e\n response = Rede::RefundResponse.new(:return_code => Rede::ReturnCode::UNSUCCESSFUL, :return_message => e.message)\n end\n\n return response\n end",
"def show\n @refund = Refund.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @refund }\n end\n end",
"def show\n @refund = Refund.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @refund }\n end\n end",
"def index\n @refund_requests = RefundRequest.order 'created_at DESC'\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @refund_requests }\n end\n end",
"def request_refund\n body = { action: \"refund\", key: @@access_key, gen_task_id: @task_id }\n post_request(body)\n end",
"def refund(params)\n request(Resources::RESOURCE_REFUND, HTTP_METHOD_POST, params)\n end",
"def show\n @refund_request = RefundRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @refund_request }\n end\n end",
"def refund(refund); end",
"def refund(params = {})\n req = WebPay::ChargeRequestRefund.create(params)\n raw_response = @client._request(:post, 'charges' + '/' + req.id.to_s + '/' + 'refund', req)\n WebPay::ChargeResponse.new(raw_response)\n end",
"def destroy\n @refund = Refund.find(params[:id])\n @refund.destroy\n\n respond_to do |format|\n format.html { redirect_to refunds_url }\n format.json { head :ok }\n end\n end",
"def request_refund(options = {})\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/request_refund\", options).body)\n @attributes = response['items']\n true\n end",
"def request_refund(options = {})\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/request_refund\", options).body)\n @attributes = response['items']\n true\n end",
"def refund!\n path = self.class.endpoint.gsub(':id', id.to_s) + '/refund'\n client.api_post(path)\n end",
"def destroy\n @refund = Refund.find(params[:id])\n @refund.destroy\n\n respond_to do |format|\n format.html { redirect_to refunds_url }\n format.json { head :no_content }\n end\n end",
"def refresh_refund\n\t\t\n\t\tif self.refund && self.payment_status.nil?\n\t\t\t\n\t\t\talready_accepted_refunds = self.class.where(:refund => true, :payment_status => 1, :updated_at => { :$gte => self.created_at})\n\t\t\t\n\t\t\tif already_accepted_refunds.size > 0\n\t\t\t\t\n\t\t\t\tself.refund_failed\n\t\t\tend\n\t\tend\n\tend",
"def show\n @refund = Refund.find(params[:id])\n \n respond_to do |format|\n format.html { render :action => \"show\"}\n format.xml { render :xml => @refund }\n end\n end",
"def list_refunds_with_http_info(location_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TransactionsApi.list_refunds ...\"\n end\n # verify the required parameter 'location_id' is set\n fail ArgumentError, \"Missing the required parameter 'location_id' when calling TransactionsApi.list_refunds\" if location_id.nil?\n if opts[:'sort_order'] && !['DESC', 'ASC'].include?(opts[:'sort_order'])\n fail ArgumentError, 'invalid value for \"sort_order\", must be one of DESC, ASC'\n end\n # resource path\n local_var_path = \"/v2/locations/{location_id}/refunds\".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'begin_time'] = opts[:'begin_time'] if !opts[:'begin_time'].nil?\n query_params[:'end_time'] = opts[:'end_time'] if !opts[:'end_time'].nil?\n query_params[:'sort_order'] = opts[:'sort_order'] if !opts[:'sort_order'].nil?\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n \n header_params['Square-Version'] = \"2018-07-12\"\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ListRefundsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionsApi#list_refunds\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def new\n @refund = Refund.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @refund }\n end\n end",
"def new\n @refund = Refund.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @refund }\n end\n end",
"def gateway_refund\n resource.direct_refund\n respond_to do |format|\n format.html do\n return redirect_to admin_contributions_path(params[:local_params])\n end\n format.json do\n return render json: []\n end\n end\n end",
"def list_refunds_with_http_info(location_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: V1TransactionsApi.list_refunds ...\"\n end\n # verify the required parameter 'location_id' is set\n fail ArgumentError, \"Missing the required parameter 'location_id' when calling V1TransactionsApi.list_refunds\" if location_id.nil?\n if opts[:'order'] && !['ASC', 'DESC'].include?(opts[:'order'])\n fail ArgumentError, 'invalid value for \"order\", must be one of ASC, DESC'\n end\n if !opts[:'limit'].nil? && opts[:'limit'] > 200\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling V1TransactionsApi.list_refunds, must be smaller than or equal to 200.'\n end\n\n # resource path\n local_var_path = \"/v1/{location_id}/refunds\".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n query_params[:'begin_time'] = opts[:'begin_time'] if !opts[:'begin_time'].nil?\n query_params[:'end_time'] = opts[:'end_time'] if !opts[:'end_time'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'batch_token'] = opts[:'batch_token'] if !opts[:'batch_token'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n \n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<V1Refund>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: V1TransactionsApi#list_refunds\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def refund(id, params = {}, options = {})\n response = request(:post, resource_path(\"captures/#{id}/refund\"), params, options)\n FatZebra::Paypal::Refund.initialize_from(response)\n end",
"def refund(unique_id)\n request('payment/refund', {:refund => {:unique_id => unique_id}})\n end",
"def refund amount, capture_id, options={}\n options[:capture_id] = capture_id if capture_id\n\n if amount\n options[:amount] = assert_currency options[:currency], amount\n end\n\n response = flow_instance.refunds.post @flow_organization, options\n\n if response.try(:id)\n Response.new true, 'Flow refund - Success', { response: response }\n else\n Response.new false, 'Flow refund - Error', { response: response }\n end\n rescue Io::Flow::V0::HttpClient::ServerError => exception\n error_response exception\n end",
"def show\n @refund = Refund.find(params[:id])\n authorize @refund\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @refund }\n end\n end",
"def refund\n request = Remit::Refund::Request.new(transaction_id: transaction_id, caller_reference: caller_reference)\n response = remit.refund request\n response.errors.empty?\n end",
"def refund_with_http_info(sbp_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: VApi#refund ...\"\n end\n \n # verify the required parameter 'sbp_request' is set\n fail \"Missing the required parameter 'sbp_request' when calling refund\" if sbp_request.nil?\n \n # resource path\n path = \"/v1/transaction/refund\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'application/xml']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json', 'application/xml']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(sbp_request)\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SbpResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VApi#refund\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_payinrefunds_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PayinrefundApi.get_payinrefunds ...'\n end\n # resource path\n local_var_path = '/payinrefunds'\n\n # query parameters\n query_params = {}\n query_params[:'accessSignature'] = opts[:'access_signature'] if !opts[:'access_signature'].nil?\n query_params[:'accessTag'] = opts[:'access_tag'] if !opts[:'access_tag'].nil?\n query_params[:'accessUserId'] = opts[:'access_user_id'] if !opts[:'access_user_id'].nil?\n query_params[:'accessUserIp'] = opts[:'access_user_ip'] if !opts[:'access_user_ip'].nil?\n query_params[:'payinId'] = opts[:'payin_id'] if !opts[:'payin_id'].nil?\n query_params[:'payinrefundId'] = opts[:'payinrefund_id'] if !opts[:'payinrefund_id'].nil?\n query_params[:'payinrefundTag'] = opts[:'payinrefund_tag'] if !opts[:'payinrefund_tag'].nil?\n query_params[:'payinrefundStatus'] = opts[:'payinrefund_status'] if !opts[:'payinrefund_status'].nil?\n query_params[:'walletId'] = opts[:'wallet_id'] if !opts[:'wallet_id'].nil?\n query_params[:'payinrefundDate'] = opts[:'payinrefund_date'] if !opts[:'payinrefund_date'].nil?\n query_params[:'userId'] = opts[:'user_id'] if !opts[:'user_id'].nil?\n query_params[:'amount'] = opts[:'amount'] if !opts[:'amount'].nil?\n query_params[:'currency'] = opts[:'currency'] if !opts[:'currency'].nil?\n query_params[:'pageNumber'] = opts[:'page_number'] if !opts[:'page_number'].nil?\n query_params[:'pageCount'] = opts[:'page_count'] if !opts[:'page_count'].nil?\n query_params[:'sortBy'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n query_params[:'sortOrder'] = opts[:'sort_order'] if !opts[:'sort_order'].nil?\n query_params[:'createdDateFrom'] = opts[:'created_date_from'] if !opts[:'created_date_from'].nil?\n query_params[:'createdDateTo'] = opts[:'created_date_to'] if !opts[:'created_date_to'].nil?\n query_params[:'updatedDateFrom'] = opts[:'updated_date_from'] if !opts[:'updated_date_from'].nil?\n query_params[:'updatedDateTo'] = opts[:'updated_date_to'] if !opts[:'updated_date_to'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20018')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PayinrefundApi#get_payinrefunds\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def refund(amount: nil)\n api_request(\"/charges/#{id}/refund\", :post, amount: amount)\n end",
"def create\n @refund = Refund.new(params[:refund])\n\n respond_to do |format|\n if @refund.save\n format.html { redirect_to @refund, notice: 'Refund was successfully created.' }\n format.json { render json: @refund, status: :created, location: @refund }\n else\n format.html { render action: \"new\" }\n format.json { render json: @refund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @refund = Refund.find(params[:id])\n\n respond_to do |format|\n if @refund.update_attributes(params[:refund])\n format.html { redirect_to @refund, notice: 'Refund was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @refund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def refunds_create_with_http_info(token, order_id, refund_reason, cents, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RefundsApi.refunds_create ...\"\n end\n # verify the required parameter 'token' is set\n if @api_client.config.client_side_validation && token.nil?\n fail ArgumentError, \"Missing the required parameter 'token' when calling RefundsApi.refunds_create\"\n end\n # verify the required parameter 'order_id' is set\n if @api_client.config.client_side_validation && order_id.nil?\n fail ArgumentError, \"Missing the required parameter 'order_id' when calling RefundsApi.refunds_create\"\n end\n # verify the required parameter 'refund_reason' is set\n if @api_client.config.client_side_validation && refund_reason.nil?\n fail ArgumentError, \"Missing the required parameter 'refund_reason' when calling RefundsApi.refunds_create\"\n end\n # verify the required parameter 'cents' is set\n if @api_client.config.client_side_validation && cents.nil?\n fail ArgumentError, \"Missing the required parameter 'cents' when calling RefundsApi.refunds_create\"\n end\n # resource path\n local_var_path = \"/api/v1/orders/{order_id}/refunds\".sub('{' + 'order_id' + '}', order_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'token'] = token\n\n # header parameters\n header_params = {}\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n form_params[\"refund_reason\"] = refund_reason\n form_params[\"cents\"] = cents\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 => 'RefundResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RefundsApi#refunds_create\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n @refund = Refund.find(params[:id])\n\n respond_to do |format|\n if @refund.update_attributes(params[:refund])\n format.html { redirect_to @refund, notice: 'Refund was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @refund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_refunds\n @proposal.refunds.each do |bank_account, amount|\n run_task \"add_refunds_#{bank_account}\" do\n if transfer = add_bank_transfer(bank_account, @export.receivables_account, amount)\n current_state[:transfer_id] = transfer['BankTransferID']\n end\n end\n end\n end",
"def do \n validate\n ZipMoney.api.refund(@params)\n end",
"def refund\n @order.refund_payment\n render 'status'\n end",
"def list_refunds(location_id, opts = {})\n data, _status_code, _headers = list_refunds_with_http_info(location_id, opts)\n return data\n end",
"def list_refunds(location_id, opts = {})\n data, _status_code, _headers = list_refunds_with_http_info(location_id, opts)\n return data\n end",
"def decline_refund\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/decline_refund\").body)\n @attributes = response['items']\n true\n end",
"def get_payinrefunds(opts = {})\n data, _status_code, _headers = get_payinrefunds_with_http_info(opts)\n data\n end",
"def destroy\n @refund_request = RefundRequest.find(params[:id])\n @refund_request.destroy\n\n respond_to do |format|\n format.html { redirect_to refund_requests_url }\n format.json { head :ok }\n end\n end",
"def stripe_refund\n return unless charge_id.present?\n Reservation.transaction do\n charge = Stripe::Charge.retrieve(charge_id)\n charge.refunds.create(amount: charge.amount, reverse_transfer: true)\n update_attributes(refunded: true, is_paid: false, billing_phase: :not_billed, charge_id: nil)\n end\n rescue Exception => e\n custom_params = { reservation_id: id, charge_id: charge_id, amount: charge.amount }\n Rollbar.error(e, 'Stripe refund failed', custom_params)\n end",
"def refund_by_amount(amount)\n params = {\n refund_amount: amount,\n }\n @client.make_request(:post, 'referral_customers/refunds', EasyPost::Models::EasyPostObject, params, 'beta')\n # noinspection RubyMismatchedReturnType\n end",
"def refund *args\n warn_on_positional args\n\n options = args.last.is_a?(Hash) ? args.pop : {}\n amount = args[0] || options.fetch(:amount) { nil }\n description = args[1] || options.fetch(:description) { nil }\n\n refund = Refund.new(\n :uri => self.refunds_uri,\n :debit_uri => self.uri,\n :amount => amount,\n :description => description,\n )\n refund.save\n end",
"def refund(item_refund)\n item_refund.save!\n remaining_refund_amount = item_refund.total\n refund_payments = payments(item_refund)\n refund_payments.each do |payment|\n next if remaining_refund_amount <= 0\n amount_to_refund = calculate_amount_to_refund(payment, remaining_refund_amount)\n remaining_refund_amount -= amount_to_refund\n\n create_refund(item_refund, payment, amount_to_refund)\n end\n end",
"def show\n @carbontaxrefund = Carbontaxrefund.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @carbontaxrefund }\n end\n end",
"def process_refund\n express_token ?\n EXPRESS_PAYPAL_GATEWAY.refund(nil, capture_authorization) :\n STANDARD_PAYPAL_GATEWAY.refund(nil, capture_authorization)\n end",
"def refund_order\n\t\t@order = Order.find(params[:order_id])\n\n\t\tif @order.refunded\n\t\t\trender :json => { :error => \"Order has already been refunded\" }\n\t\telse \n\t\t\tcharge = Stripe::Charge.retrieve(order.charge_id)\n\t\t\trefund = charge.refunds.create\n\t\t\trender :json => { :refunded => true, :refund_id => refund.id, :message => \"Order refunded successfully\" }\n\t\tend\n\n\tend",
"def create\n @refund = Refund.new(params[:refund])\n\n respond_to do |format|\n if @refund.save\n format.html { redirect_to @refund, notice: 'El rembolso ha sido almacenado' }\n format.json { render json: @refund, status: :created, location: @refund }\n else\n format.html { render action: \"new\" }\n format.json { render json: @refund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sync_refunds(event)\n payment_method = event.payment_method\n stripe_payment_intent_id = event.data.object.payment_intent\n\n RefundsSynchronizer\n .new(payment_method)\n .call(stripe_payment_intent_id)\n end",
"def get_refund_details(\n amazon_refund_id,\n merchant_id: @merchant_id,\n mws_auth_token: nil\n )\n\n parameters = {\n 'Action' => 'GetRefundDetails',\n 'SellerId' => merchant_id,\n 'AmazonRefundId' => amazon_refund_id\n }\n\n optional = {\n 'MWSAuthToken' => mws_auth_token\n }\n\n operation(parameters, optional)\n end",
"def refund( trans_id, amount_in_cents )\n resp = client.refund(\n token: payment.token,\n trans_id: trans_id,\n amount: amount_in_cents.to_i.abs\n ).body\n\n user.refunds.create!(\n amount_in_cents: amount_in_cents,\n description: \"Refund value\",\n metadata: resp.as_json\n )\n rescue BridgePay::ResponseError => ex\n raise RefundFailure.new( ex.response )\n end",
"def index\n @now = DateTime.new(Time.zone.now.year, Time.zone.now.month, Time.zone.now.day, Time.zone.now.hour, Time.zone.now.min, Time.zone.now.sec)\n @start_date = params[:start_date].nil? ? DateTime.new(@now.year, @now.month, 1, 4, 0) : DateTime.parse(params[:start_date] + \" 04:00:00\")\n @end_date = params[:end_date].nil? ? DateTime.new(@now.year, @now.month, -1, 4, 0) : DateTime.parse(params[:end_date] + \" 04:00:00\")\n \n @refunds = Refund.find(:all, :conditions => ['created_at >= ? and created_at < ?', @start_date, @end_date + 1.day])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @refunds }\n end\n end",
"def show\n @purchase = Purchase.exists?(params[:id]) ? Purchase.find(params[:id]) : Purchase.deleted.select{|p| p.id == params[:id]}.first\n puts @purchase.to_yaml\n @refund = @purchase.refund\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @purchase }\n end\n end",
"def refund_order\n Stripe.api_key = ENV['STRIPE_SECRET_KEY']\n order = Commit.find(params[:order_id])\n charge = Stripe::Charge.retrieve(order.sale.stripe_charge_id, :stripe_account => order.product.wholesaler.stripe_id)\n begin\n refund = charge.refunds.create(:amount => charge.amount, :refund_application_fee => true)\n rescue => e\n return render :json => {\n success: false,\n error: e.message\n }\n end\n if !refund.nil?\n order.refunded = true\n order.sale_made = false\n product_sales = order.product.current_sales.to_f\n new_sales = order.full_price ? product_sales+order.amount.to_f*order.product.price.to_f : product_sales+order.amount.to_f*order.product.discount.to_f\n order.product.current_sales = new_sales\n order.save(validate: false)\n return render :json => {\n success: true,\n order: order,\n charge: charge,\n refund: refund\n }\n end\n end",
"def destroy\n order = Order.find(params[:id])\n response = order.refund\n if response['status'] == 'failed'\n flash[:notice] = 'Refund failed. Please try again shortly'\n else\n flash[:notice] = 'You have successfully refunded this order.'\n end\n respond_to do |format|\n format.html {redirect_to restaurant_orders_restaurant_order_index_path}\n format.json {render json: response}\n end\n end",
"def refund amount=nil, description=nil\n refund = Refund.new(\n :uri => self.refunds_uri,\n :debit_uri => self.uri,\n :amount => amount,\n :description => description,\n )\n refund.save\n end",
"def create\n @refund = Refund.new(refund_params)\n\n respond_to do |format|\n if @refund.save\n format.html do\n redirect_to(\n seller_product_purchases_path(@seller, @product),\n notice: 'Refund was successfully created.'\n )\n end\n format.json { render :show, status: :created, location: @refund }\n else\n format.html { render :new }\n format.json { render json: @refund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def refund(\n amazon_capture_id,\n refund_reference_id,\n amount,\n currency_code: @currency_code,\n seller_refund_note: nil,\n soft_descriptor: nil,\n provider_credit_reversal_details: nil,\n merchant_id: @merchant_id,\n mws_auth_token: nil\n )\n\n parameters = {\n 'Action' => 'Refund',\n 'SellerId' => merchant_id,\n 'AmazonCaptureId' => amazon_capture_id,\n 'RefundReferenceId' => refund_reference_id,\n 'RefundAmount.Amount' => amount,\n 'RefundAmount.CurrencyCode' => currency_code\n }\n\n optional = {\n 'SellerRefundNote' => seller_refund_note,\n 'SoftDescriptor' => soft_descriptor,\n 'MWSAuthToken' => mws_auth_token\n }\n\n optional.merge!(set_provider_credit_reversal_details(provider_credit_reversal_details)) if provider_credit_reversal_details\n\n operation(parameters, optional)\n end",
"def set_refund\n @refund = @current_event.refunds.find(params[:id])\n authorize @refund\n end",
"def refund(money, reference, options = {})\n standard_response\n end",
"def new\n @carbontaxrefund = Carbontaxrefund.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @carbontaxrefund }\n end\n end",
"def refund_params\n params.require(:refund).permit(:credit_base, :credit_fee, :customer_id, :gateway, fields: {})\n end",
"def refund!(amnt = nil)\n RefundRepository.new(api).create(token, amnt)\n end",
"def destroy\n @carbontaxrefund = Carbontaxrefund.find(params[:id])\n @carbontaxrefund.destroy\n\n respond_to do |format|\n format.html { redirect_to carbontaxrefunds_url }\n format.json { head :no_content }\n end\n end",
"def order_refund_with_http_info(id, order_refund_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OrdersApi.order_refund ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling OrdersApi.order_refund\"\n end\n # verify the required parameter 'order_refund_request' is set\n if @api_client.config.client_side_validation && order_refund_request.nil?\n fail ArgumentError, \"Missing the required parameter 'order_refund_request' when calling OrdersApi.order_refund\"\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/orders/{id}/refunds'.sub('{' + 'id' + '}', CGI.escape(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/vnd.conekta-v2.1.0+json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(order_refund_request)\n\n # return_type\n return_type = opts[:debug_return_type] || 'OrderResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"OrdersApi.order_refund\",\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: OrdersApi#order_refund\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_payinrefund_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PayinrefundApi.get_payinrefund ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling PayinrefundApi.get_payinrefund\"\n end\n # resource path\n local_var_path = '/payinrefunds/{id}'.sub('{' + 'id' + '}', id.to_s)\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 = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20018')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PayinrefundApi#get_payinrefund\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def perform_refund\n # make the SOAP API call\n response = Docdata.client.call(:refund, xml: refund_xml)\n response_object = Docdata::Response.parse(:refund, response)\n if response_object.success?\n return true\n else\n return false\n end\n end",
"def refund_a_payment_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PaymentsApi.refund_a_payment ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling PaymentsApi.refund_a_payment\"\n end\n pattern = Regexp.new(/^(pay)_(\\w{26})$/)\n if @api_client.config.client_side_validation && id !~ pattern\n fail ArgumentError, \"invalid value for 'id' when calling PaymentsApi.refund_a_payment, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/payments/{id}/refunds'.sub('{' + 'id' + '}', CGI.escape(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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'Cko-Idempotency-Key'] = opts[:'cko_idempotency_key'] if !opts[:'cko_idempotency_key'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'refund_request'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'RefundAcceptedResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['ApiSecretKey']\n\n new_options = opts.merge(\n :operation => :\"PaymentsApi.refund_a_payment\",\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: PaymentsApi#refund_a_payment\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def refund_params\n params.require(:refund).permit(\n Refund.attribute_names.map(&:to_sym)\n )\n end",
"def list_additional_recipient_receivable_refunds(location_id:,\n begin_time: nil,\n end_time: nil,\n sort_order: nil,\n cursor: nil)\n warn 'Endpoint list_additional_recipient_receivable_refunds in Reporting'\\\n 'Api is deprecated'\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/locations/{location_id}/additional-recipient-receivable-refunds'\n _query_builder = APIHelper.append_url_with_template_parameters(\n _query_builder,\n 'location_id' => location_id\n )\n _query_builder = APIHelper.append_url_with_query_parameters(\n _query_builder,\n 'begin_time' => begin_time,\n 'end_time' => end_time,\n 'sort_order' => sort_order,\n 'cursor' => cursor\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(_response, data: decoded, errors: _errors)\n end",
"def create_refund_mile_payment(body)\r\n # Prepare query url.\r\n _path_url = '/v2/ecommerce/payments/actions/refund'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'content-type' => 'application/json; charset=utf-8'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n headers: _headers,\r\n parameters: body.to_json\r\n )\r\n OAuth2.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n Response.from_hash(decoded)\r\n end",
"def refund_transaction_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PaymentsTransactionsApi.refund_transaction ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling PaymentsTransactionsApi.refund_transaction\"\n end\n # resource path\n local_var_path = \"/transactions/{id}/refunds\".sub('{' + 'id' + '}', id.to_s)\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[:'request'])\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 => 'RefundResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PaymentsTransactionsApi#refund_transaction\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def test_successful_refund\n assert response = @gateway.purchase(@amount, @credit_card, @options)\n assert_successful_response(response)\n\n assert response = @gateway.refund(@amount, response.authorization)\n assert_successful_response(response)\n end",
"def list_additional_recipient_receivable_refunds_with_http_info(location_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ReportingApi.list_additional_recipient_receivable_refunds ...\"\n end\n # verify the required parameter 'location_id' is set\n fail ArgumentError, \"Missing the required parameter 'location_id' when calling ReportingApi.list_additional_recipient_receivable_refunds\" if location_id.nil?\n if opts[:'sort_order'] && !['DESC', 'ASC'].include?(opts[:'sort_order'])\n fail ArgumentError, 'invalid value for \"sort_order\", must be one of DESC, ASC'\n end\n # resource path\n local_var_path = \"/v2/locations/{location_id}/additional-recipient-receivable-refunds\".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'begin_time'] = opts[:'begin_time'] if !opts[:'begin_time'].nil?\n query_params[:'end_time'] = opts[:'end_time'] if !opts[:'end_time'].nil?\n query_params[:'sort_order'] = opts[:'sort_order'] if !opts[:'sort_order'].nil?\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n \n header_params['Square-Version'] = \"2018-07-12\"\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ListAdditionalRecipientReceivableRefundsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ReportingApi#list_additional_recipient_receivable_refunds\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def refund(merchant_access_token)\n Requests::RefundOrder.new(merchant_access_token: merchant_access_token).\n send_to_api(:post, endpoint_path + '/refund')\n end",
"def refund(sbp_request, opts = {})\n data, status_code, headers = refund_with_http_info(sbp_request, opts)\n return data\n end",
"def index\n @api_v1_rewards = Api::V1::Reward.all\n end",
"def new\n add_breadcrumb \"Tramanta\", :bazar_path\n add_breadcrumb \"Solicitud de devolución\", :new_refund_request_path\n \n @refund_request = RefundRequest.new\n @user_id = current_user.id\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @refund_request }\n end\n end",
"def refund transaction\n transaction = Transaction.new transaction\n order_id = transaction.order_id.to_i\n transaction_id = transaction.transaction_id\n transaction_params = ActiveSupport::OrderedHash.new\n transaction_params['amount'] = transaction.amount.to_s\n transaction_params['currency'] = transaction.currency\n transaction_params['reference'] = transaction.reference.to_s\n params = ActiveSupport::OrderedHash.new\n params['apiOperation'] = 'REFUND'\n params['transaction'] = transaction_params\n\n request :put, \"/merchant/#{merchant_id}/order/#{order_id}/transaction/#{transaction_id}\", params\n end",
"def create_refund_with_http_info(location_id, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: V1TransactionsApi.create_refund ...\"\n end\n # verify the required parameter 'location_id' is set\n fail ArgumentError, \"Missing the required parameter 'location_id' when calling V1TransactionsApi.create_refund\" if location_id.nil?\n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling V1TransactionsApi.create_refund\" if body.nil?\n # resource path\n local_var_path = \"/v1/{location_id}/refunds\".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s)\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'V1Refund')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: V1TransactionsApi#create_refund\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n @refund_request = RefundRequest.find(params[:id])\n\n respond_to do |format|\n if @refund_request.update_attributes(params[:refund_request])\n format.html { redirect_to @refund_request, notice: 'Refund request was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @refund_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @funds = Fund.all\n\n render json: @funds\n end",
"def refund(transaction_id, caller_reference, options = {})\n submit Refund.new(options.merge(:transaction_id => transaction_id, :caller_reference => caller_reference))\n end",
"def refund token, payload={}\n payload.merge! :namespace => 'refund', :token => token\n invoke :put, payload\n end",
"def create_refund_with_http_info(location_id, transaction_id, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TransactionsApi.create_refund ...\"\n end\n # verify the required parameter 'location_id' is set\n fail ArgumentError, \"Missing the required parameter 'location_id' when calling TransactionsApi.create_refund\" if location_id.nil?\n # verify the required parameter 'transaction_id' is set\n fail ArgumentError, \"Missing the required parameter 'transaction_id' when calling TransactionsApi.create_refund\" if transaction_id.nil?\n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling TransactionsApi.create_refund\" if body.nil?\n # resource path\n local_var_path = \"/v2/locations/{location_id}/transactions/{transaction_id}/refund\".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s).sub('{' + 'transaction_id' + '}', transaction_id.to_s)\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 header_params['Square-Version'] = \"2018-07-12\"\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'CreateRefundResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionsApi#create_refund\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def refunds_create(token, order_id, refund_reason, cents, opts = {})\n data, _status_code, _headers = refunds_create_with_http_info(token, order_id, refund_reason, cents, opts)\n return data\n end",
"def handle_refund\n if saved_change_to_state == %w(purchased refunded)\n refund = self.build_refund({\n payment_id: payment_id,\n state: :pending,\n })\n refund.save!\n seller.decrease_balance(payment.amount)\n end \n end",
"def post_payinrefunds_with_http_info(payin_id, amount, currency, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PayinrefundApi.post_payinrefunds ...'\n end\n # verify the required parameter 'payin_id' is set\n if @api_client.config.client_side_validation && payin_id.nil?\n fail ArgumentError, \"Missing the required parameter 'payin_id' when calling PayinrefundApi.post_payinrefunds\"\n end\n # verify the required parameter 'amount' is set\n if @api_client.config.client_side_validation && amount.nil?\n fail ArgumentError, \"Missing the required parameter 'amount' when calling PayinrefundApi.post_payinrefunds\"\n end\n # verify the required parameter 'currency' is set\n if @api_client.config.client_side_validation && currency.nil?\n fail ArgumentError, \"Missing the required parameter 'currency' when calling PayinrefundApi.post_payinrefunds\"\n end\n # resource path\n local_var_path = '/payinrefunds'\n\n # query parameters\n query_params = {}\n query_params[:'payinId'] = payin_id\n query_params[:'amount'] = amount\n query_params[:'currency'] = currency\n query_params[:'accessSignature'] = opts[:'access_signature'] if !opts[:'access_signature'].nil?\n query_params[:'accessTag'] = opts[:'access_tag'] if !opts[:'access_tag'].nil?\n query_params[:'accessUserId'] = opts[:'access_user_id'] if !opts[:'access_user_id'].nil?\n query_params[:'accessUserIp'] = opts[:'access_user_ip'] if !opts[:'access_user_ip'].nil?\n query_params[:'payinrefundTag'] = opts[:'payinrefund_tag'] if !opts[:'payinrefund_tag'].nil?\n query_params[:'comment'] = opts[:'comment'] if !opts[:'comment'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(: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 => 'InlineResponse20018')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PayinrefundApi#post_payinrefunds\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def refund_transaction\n data = full_params.merge(\n 'x_trans_id' => transaction_id,\n 'x_type' => \"REFUND\"\n )\n\n astro_curl(@validator_url, data)\n end",
"def refund_by_payment_log(payment_log_id)\n params = {\n payment_log_id: payment_log_id,\n }\n @client.make_request(:post, 'referral_customers/refunds', EasyPost::Models::EasyPostObject, params, 'beta')\n end",
"def test_failed_refund\n response = @gateway.refund(@amount, @invalid_txn)\n assert_failure response\n assert_equal 'Txn not found', response.message\n end",
"def test_refund_partial\n assert refund = @gateway.refund(555, '9999999999') # $5.55 in cents\n assert_success refund\n end",
"def refund(original_reference:, amount:, reference:, merchantAccount: @merchant_account, currency: @currency)\n postJSON(\"/Payment/v12/refund\",\n reference: reference,\n merchantAccount: merchant_account,\n modificationAmount: { value: amount, currency: currency },\n originalReference: original_reference\n )\n end",
"def test_failed_refund\n response = @gateway.refund(@amount, 'thisisnotavalidtrasactionid')\n assert_failure response\n assert_equal 'Error(s)- code:3407, message:The settlement referred to by the transaction response ID you provided cannot be found.', response.message\n end",
"def post_v2_refund_by_order_with_http_info(order_uuid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OrderApi.post_v2_refund_by_order ...'\n end\n # verify the required parameter 'order_uuid' is set\n if @api_client.config.client_side_validation && order_uuid.nil?\n fail ArgumentError, \"Missing the required parameter 'order_uuid' when calling OrderApi.post_v2_refund_by_order\"\n end\n # resource path\n local_var_path = '/order/{order_uuid}/refund'.sub('{' + 'order_uuid' + '}', order_uuid.to_s)\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n 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[:'body'])\n\n return_type = opts[:return_type] || 'InlineResponse2006'\n\n auth_names = opts[:auth_names] || ['Bearer']\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 => return_type)\n\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrderApi#post_v2_refund_by_order\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def execute(input_set = nil)\n resp = super(input_set)\n results = LookupRefundResultSet.new(resp)\n return results\n end",
"def create\n @refund = Refund.new(params[:refund])\n @queued_coupon_refunds = Coupon.find(session[:queued_coupon_refunds])\n \n # create wtd credits\n if @refund.credit_amount > 0\n @credit = Credit.new\n @credit.promotion_code_id = PromotionCode::REFUND_CREDIT\n @credit.value = @refund.credit_amount\n @credit.user_id = @refund.purchase.user.id\n @credit.save\n @refund.credit_id = @credit.id\n end\n \n \n # connect with authorize.net\n @connect = true\n \n if @connect\n # mark coupons as refunded\n @queued_coupon_refunds.each do |coupon|\n coupon.refunded = true\n coupon.save\n end\n \n # clear session\n session[:queued_coupon_refunds] = []\n end\n \n if @refund.save\n flash[:notice] = 'Refund was successfully saved.'\n redirect_to(admin_refund_path(@refund))\n else\n render :action => \"new\"\n end\n end",
"def generate_refund(transaction, amount = nil, options = {})\n raise ArgumentError, \"Invalid transaction state: #{transaction.state}\" if transaction.state != \"completed\"\n raise ArgumentError, \"Transaction is not belongs to the order\" if transaction.order != self\n\n refunds.create(options.merge(amount: amount || transaction.amount, transaction: transaction))\n\n cancel if state != 'wait_refund'\n\n true\n end"
] | [
"0.774411",
"0.7166731",
"0.71120745",
"0.71120745",
"0.6953939",
"0.67905384",
"0.6724481",
"0.6713539",
"0.6691451",
"0.66871655",
"0.66508275",
"0.661992",
"0.661992",
"0.6613698",
"0.66089576",
"0.65944284",
"0.65873724",
"0.6585264",
"0.65592146",
"0.65592146",
"0.6472703",
"0.6458323",
"0.6433718",
"0.6377379",
"0.6366434",
"0.6360209",
"0.63587534",
"0.63452554",
"0.63320094",
"0.6330609",
"0.630039",
"0.62964845",
"0.62747616",
"0.62263954",
"0.62112564",
"0.6193863",
"0.61852205",
"0.61686146",
"0.61686146",
"0.6132785",
"0.6085839",
"0.60829955",
"0.6079001",
"0.60271376",
"0.5993996",
"0.5961901",
"0.5945838",
"0.59248614",
"0.59219146",
"0.5917999",
"0.58988565",
"0.58821887",
"0.5867252",
"0.58342636",
"0.58293664",
"0.58246464",
"0.5821176",
"0.5799716",
"0.57680047",
"0.5751505",
"0.5724384",
"0.5714963",
"0.5682954",
"0.5678868",
"0.56724983",
"0.5649996",
"0.5649661",
"0.564438",
"0.5638627",
"0.5602611",
"0.55988103",
"0.5592676",
"0.5576721",
"0.55383927",
"0.55341077",
"0.55247706",
"0.55101174",
"0.54914004",
"0.54805565",
"0.54733413",
"0.54693764",
"0.5453261",
"0.54342675",
"0.5432249",
"0.5413677",
"0.54120487",
"0.5404898",
"0.5383083",
"0.5376286",
"0.53530306",
"0.533114",
"0.53146595",
"0.52700126",
"0.522001",
"0.52046794",
"0.5202534",
"0.52012134",
"0.51999253",
"0.5191003",
"0.5185546"
] | 0.7228496 | 1 |
GET /refunds/1 GET /refunds/1.json | def show
@refund = Refund.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @refund }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refunds\n RefundRepository.new(api).all(token)\n end",
"def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @refunds }\n end\n end",
"def refund(tid, refund)\n begin\n #creating url\n url = \"#{@security.environment}/transactions/#{tid}/refunds\"\n\n # make the request.\n json_response = Rede::CommonRequest::post(url, refund, @security)\n\n # mapping the result.\n response = Rede::RefundResponse.map(json_response)\n\n rescue Exception => e\n response = Rede::RefundResponse.new(:return_code => Rede::ReturnCode::UNSUCCESSFUL, :return_message => e.message)\n end\n\n return response\n end",
"def show\n @refund_request = RefundRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @refund_request }\n end\n end",
"def new\n @refund = Refund.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @refund }\n end\n end",
"def new\n @refund = Refund.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @refund }\n end\n end",
"def show\n @refund = Refund.find(params[:id])\n \n respond_to do |format|\n format.html { render :action => \"show\"}\n format.xml { render :xml => @refund }\n end\n end",
"def refund!\n path = self.class.endpoint.gsub(':id', id.to_s) + '/refund'\n client.api_post(path)\n end",
"def refund(refund); end",
"def destroy\n @refund = Refund.find(params[:id])\n @refund.destroy\n\n respond_to do |format|\n format.html { redirect_to refunds_url }\n format.json { head :ok }\n end\n end",
"def index\n @refund_requests = RefundRequest.order 'created_at DESC'\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @refund_requests }\n end\n end",
"def destroy\n @refund = Refund.find(params[:id])\n @refund.destroy\n\n respond_to do |format|\n format.html { redirect_to refunds_url }\n format.json { head :no_content }\n end\n end",
"def refresh_refund\n\t\t\n\t\tif self.refund && self.payment_status.nil?\n\t\t\t\n\t\t\talready_accepted_refunds = self.class.where(:refund => true, :payment_status => 1, :updated_at => { :$gte => self.created_at})\n\t\t\t\n\t\t\tif already_accepted_refunds.size > 0\n\t\t\t\t\n\t\t\t\tself.refund_failed\n\t\t\tend\n\t\tend\n\tend",
"def request_refund\n body = { action: \"refund\", key: @@access_key, gen_task_id: @task_id }\n post_request(body)\n end",
"def refund(unique_id)\n request('payment/refund', {:refund => {:unique_id => unique_id}})\n end",
"def refund(params)\n request(Resources::RESOURCE_REFUND, HTTP_METHOD_POST, params)\n end",
"def refund(params = {})\n req = WebPay::ChargeRequestRefund.create(params)\n raw_response = @client._request(:post, 'charges' + '/' + req.id.to_s + '/' + 'refund', req)\n WebPay::ChargeResponse.new(raw_response)\n end",
"def gateway_refund\n resource.direct_refund\n respond_to do |format|\n format.html do\n return redirect_to admin_contributions_path(params[:local_params])\n end\n format.json do\n return render json: []\n end\n end\n end",
"def update\n @refund = Refund.find(params[:id])\n\n respond_to do |format|\n if @refund.update_attributes(params[:refund])\n format.html { redirect_to @refund, notice: 'Refund was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @refund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @refund = Refund.new(params[:refund])\n\n respond_to do |format|\n if @refund.save\n format.html { redirect_to @refund, notice: 'Refund was successfully created.' }\n format.json { render json: @refund, status: :created, location: @refund }\n else\n format.html { render action: \"new\" }\n format.json { render json: @refund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def request_refund(options = {})\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/request_refund\", options).body)\n @attributes = response['items']\n true\n end",
"def request_refund(options = {})\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/request_refund\", options).body)\n @attributes = response['items']\n true\n end",
"def show\n @refund = Refund.find(params[:id])\n authorize @refund\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @refund }\n end\n end",
"def update\n @refund = Refund.find(params[:id])\n\n respond_to do |format|\n if @refund.update_attributes(params[:refund])\n format.html { redirect_to @refund, notice: 'Refund was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @refund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def refund(amount: nil)\n api_request(\"/charges/#{id}/refund\", :post, amount: amount)\n end",
"def refund(id, params = {}, options = {})\n response = request(:post, resource_path(\"captures/#{id}/refund\"), params, options)\n FatZebra::Paypal::Refund.initialize_from(response)\n end",
"def refund\n @order.refund_payment\n render 'status'\n end",
"def refund\n request = Remit::Refund::Request.new(transaction_id: transaction_id, caller_reference: caller_reference)\n response = remit.refund request\n response.errors.empty?\n end",
"def refund amount, capture_id, options={}\n options[:capture_id] = capture_id if capture_id\n\n if amount\n options[:amount] = assert_currency options[:currency], amount\n end\n\n response = flow_instance.refunds.post @flow_organization, options\n\n if response.try(:id)\n Response.new true, 'Flow refund - Success', { response: response }\n else\n Response.new false, 'Flow refund - Error', { response: response }\n end\n rescue Io::Flow::V0::HttpClient::ServerError => exception\n error_response exception\n end",
"def destroy\n @refund_request = RefundRequest.find(params[:id])\n @refund_request.destroy\n\n respond_to do |format|\n format.html { redirect_to refund_requests_url }\n format.json { head :ok }\n end\n end",
"def show\n @carbontaxrefund = Carbontaxrefund.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @carbontaxrefund }\n end\n end",
"def do \n validate\n ZipMoney.api.refund(@params)\n end",
"def refund_with_http_info(sbp_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: VApi#refund ...\"\n end\n \n # verify the required parameter 'sbp_request' is set\n fail \"Missing the required parameter 'sbp_request' when calling refund\" if sbp_request.nil?\n \n # resource path\n path = \"/v1/transaction/refund\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'application/xml']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json', 'application/xml']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(sbp_request)\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SbpResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VApi#refund\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def list_refunds_with_http_info(location_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: V1TransactionsApi.list_refunds ...\"\n end\n # verify the required parameter 'location_id' is set\n fail ArgumentError, \"Missing the required parameter 'location_id' when calling V1TransactionsApi.list_refunds\" if location_id.nil?\n if opts[:'order'] && !['ASC', 'DESC'].include?(opts[:'order'])\n fail ArgumentError, 'invalid value for \"order\", must be one of ASC, DESC'\n end\n if !opts[:'limit'].nil? && opts[:'limit'] > 200\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling V1TransactionsApi.list_refunds, must be smaller than or equal to 200.'\n end\n\n # resource path\n local_var_path = \"/v1/{location_id}/refunds\".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n query_params[:'begin_time'] = opts[:'begin_time'] if !opts[:'begin_time'].nil?\n query_params[:'end_time'] = opts[:'end_time'] if !opts[:'end_time'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'batch_token'] = opts[:'batch_token'] if !opts[:'batch_token'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n \n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<V1Refund>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: V1TransactionsApi#list_refunds\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def list_refunds_with_http_info(location_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TransactionsApi.list_refunds ...\"\n end\n # verify the required parameter 'location_id' is set\n fail ArgumentError, \"Missing the required parameter 'location_id' when calling TransactionsApi.list_refunds\" if location_id.nil?\n if opts[:'sort_order'] && !['DESC', 'ASC'].include?(opts[:'sort_order'])\n fail ArgumentError, 'invalid value for \"sort_order\", must be one of DESC, ASC'\n end\n # resource path\n local_var_path = \"/v2/locations/{location_id}/refunds\".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'begin_time'] = opts[:'begin_time'] if !opts[:'begin_time'].nil?\n query_params[:'end_time'] = opts[:'end_time'] if !opts[:'end_time'].nil?\n query_params[:'sort_order'] = opts[:'sort_order'] if !opts[:'sort_order'].nil?\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n \n header_params['Square-Version'] = \"2018-07-12\"\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ListRefundsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionsApi#list_refunds\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def decline_refund\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/decline_refund\").body)\n @attributes = response['items']\n true\n end",
"def refund_by_amount(amount)\n params = {\n refund_amount: amount,\n }\n @client.make_request(:post, 'referral_customers/refunds', EasyPost::Models::EasyPostObject, params, 'beta')\n # noinspection RubyMismatchedReturnType\n end",
"def create\n @refund = Refund.new(params[:refund])\n\n respond_to do |format|\n if @refund.save\n format.html { redirect_to @refund, notice: 'El rembolso ha sido almacenado' }\n format.json { render json: @refund, status: :created, location: @refund }\n else\n format.html { render action: \"new\" }\n format.json { render json: @refund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def refund_order\n\t\t@order = Order.find(params[:order_id])\n\n\t\tif @order.refunded\n\t\t\trender :json => { :error => \"Order has already been refunded\" }\n\t\telse \n\t\t\tcharge = Stripe::Charge.retrieve(order.charge_id)\n\t\t\trefund = charge.refunds.create\n\t\t\trender :json => { :refunded => true, :refund_id => refund.id, :message => \"Order refunded successfully\" }\n\t\tend\n\n\tend",
"def refunds_create_with_http_info(token, order_id, refund_reason, cents, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RefundsApi.refunds_create ...\"\n end\n # verify the required parameter 'token' is set\n if @api_client.config.client_side_validation && token.nil?\n fail ArgumentError, \"Missing the required parameter 'token' when calling RefundsApi.refunds_create\"\n end\n # verify the required parameter 'order_id' is set\n if @api_client.config.client_side_validation && order_id.nil?\n fail ArgumentError, \"Missing the required parameter 'order_id' when calling RefundsApi.refunds_create\"\n end\n # verify the required parameter 'refund_reason' is set\n if @api_client.config.client_side_validation && refund_reason.nil?\n fail ArgumentError, \"Missing the required parameter 'refund_reason' when calling RefundsApi.refunds_create\"\n end\n # verify the required parameter 'cents' is set\n if @api_client.config.client_side_validation && cents.nil?\n fail ArgumentError, \"Missing the required parameter 'cents' when calling RefundsApi.refunds_create\"\n end\n # resource path\n local_var_path = \"/api/v1/orders/{order_id}/refunds\".sub('{' + 'order_id' + '}', order_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'token'] = token\n\n # header parameters\n header_params = {}\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n form_params[\"refund_reason\"] = refund_reason\n form_params[\"cents\"] = cents\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 => 'RefundResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RefundsApi#refunds_create\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def refund *args\n warn_on_positional args\n\n options = args.last.is_a?(Hash) ? args.pop : {}\n amount = args[0] || options.fetch(:amount) { nil }\n description = args[1] || options.fetch(:description) { nil }\n\n refund = Refund.new(\n :uri => self.refunds_uri,\n :debit_uri => self.uri,\n :amount => amount,\n :description => description,\n )\n refund.save\n end",
"def refund amount=nil, description=nil\n refund = Refund.new(\n :uri => self.refunds_uri,\n :debit_uri => self.uri,\n :amount => amount,\n :description => description,\n )\n refund.save\n end",
"def show\n @purchase = Purchase.exists?(params[:id]) ? Purchase.find(params[:id]) : Purchase.deleted.select{|p| p.id == params[:id]}.first\n puts @purchase.to_yaml\n @refund = @purchase.refund\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @purchase }\n end\n end",
"def get_refund_details(\n amazon_refund_id,\n merchant_id: @merchant_id,\n mws_auth_token: nil\n )\n\n parameters = {\n 'Action' => 'GetRefundDetails',\n 'SellerId' => merchant_id,\n 'AmazonRefundId' => amazon_refund_id\n }\n\n optional = {\n 'MWSAuthToken' => mws_auth_token\n }\n\n operation(parameters, optional)\n end",
"def destroy\n order = Order.find(params[:id])\n response = order.refund\n if response['status'] == 'failed'\n flash[:notice] = 'Refund failed. Please try again shortly'\n else\n flash[:notice] = 'You have successfully refunded this order.'\n end\n respond_to do |format|\n format.html {redirect_to restaurant_orders_restaurant_order_index_path}\n format.json {render json: response}\n end\n end",
"def stripe_refund\n return unless charge_id.present?\n Reservation.transaction do\n charge = Stripe::Charge.retrieve(charge_id)\n charge.refunds.create(amount: charge.amount, reverse_transfer: true)\n update_attributes(refunded: true, is_paid: false, billing_phase: :not_billed, charge_id: nil)\n end\n rescue Exception => e\n custom_params = { reservation_id: id, charge_id: charge_id, amount: charge.amount }\n Rollbar.error(e, 'Stripe refund failed', custom_params)\n end",
"def new\n @carbontaxrefund = Carbontaxrefund.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @carbontaxrefund }\n end\n end",
"def get_payinrefunds_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PayinrefundApi.get_payinrefunds ...'\n end\n # resource path\n local_var_path = '/payinrefunds'\n\n # query parameters\n query_params = {}\n query_params[:'accessSignature'] = opts[:'access_signature'] if !opts[:'access_signature'].nil?\n query_params[:'accessTag'] = opts[:'access_tag'] if !opts[:'access_tag'].nil?\n query_params[:'accessUserId'] = opts[:'access_user_id'] if !opts[:'access_user_id'].nil?\n query_params[:'accessUserIp'] = opts[:'access_user_ip'] if !opts[:'access_user_ip'].nil?\n query_params[:'payinId'] = opts[:'payin_id'] if !opts[:'payin_id'].nil?\n query_params[:'payinrefundId'] = opts[:'payinrefund_id'] if !opts[:'payinrefund_id'].nil?\n query_params[:'payinrefundTag'] = opts[:'payinrefund_tag'] if !opts[:'payinrefund_tag'].nil?\n query_params[:'payinrefundStatus'] = opts[:'payinrefund_status'] if !opts[:'payinrefund_status'].nil?\n query_params[:'walletId'] = opts[:'wallet_id'] if !opts[:'wallet_id'].nil?\n query_params[:'payinrefundDate'] = opts[:'payinrefund_date'] if !opts[:'payinrefund_date'].nil?\n query_params[:'userId'] = opts[:'user_id'] if !opts[:'user_id'].nil?\n query_params[:'amount'] = opts[:'amount'] if !opts[:'amount'].nil?\n query_params[:'currency'] = opts[:'currency'] if !opts[:'currency'].nil?\n query_params[:'pageNumber'] = opts[:'page_number'] if !opts[:'page_number'].nil?\n query_params[:'pageCount'] = opts[:'page_count'] if !opts[:'page_count'].nil?\n query_params[:'sortBy'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n query_params[:'sortOrder'] = opts[:'sort_order'] if !opts[:'sort_order'].nil?\n query_params[:'createdDateFrom'] = opts[:'created_date_from'] if !opts[:'created_date_from'].nil?\n query_params[:'createdDateTo'] = opts[:'created_date_to'] if !opts[:'created_date_to'].nil?\n query_params[:'updatedDateFrom'] = opts[:'updated_date_from'] if !opts[:'updated_date_from'].nil?\n query_params[:'updatedDateTo'] = opts[:'updated_date_to'] if !opts[:'updated_date_to'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20018')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PayinrefundApi#get_payinrefunds\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def refund(item_refund)\n item_refund.save!\n remaining_refund_amount = item_refund.total\n refund_payments = payments(item_refund)\n refund_payments.each do |payment|\n next if remaining_refund_amount <= 0\n amount_to_refund = calculate_amount_to_refund(payment, remaining_refund_amount)\n remaining_refund_amount -= amount_to_refund\n\n create_refund(item_refund, payment, amount_to_refund)\n end\n end",
"def create\n @refund = Refund.new(refund_params)\n\n respond_to do |format|\n if @refund.save\n format.html do\n redirect_to(\n seller_product_purchases_path(@seller, @product),\n notice: 'Refund was successfully created.'\n )\n end\n format.json { render :show, status: :created, location: @refund }\n else\n format.html { render :new }\n format.json { render json: @refund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_refund\n @refund = @current_event.refunds.find(params[:id])\n authorize @refund\n end",
"def process_refund\n express_token ?\n EXPRESS_PAYPAL_GATEWAY.refund(nil, capture_authorization) :\n STANDARD_PAYPAL_GATEWAY.refund(nil, capture_authorization)\n end",
"def add_refunds\n @proposal.refunds.each do |bank_account, amount|\n run_task \"add_refunds_#{bank_account}\" do\n if transfer = add_bank_transfer(bank_account, @export.receivables_account, amount)\n current_state[:transfer_id] = transfer['BankTransferID']\n end\n end\n end\n end",
"def refund_order\n Stripe.api_key = ENV['STRIPE_SECRET_KEY']\n order = Commit.find(params[:order_id])\n charge = Stripe::Charge.retrieve(order.sale.stripe_charge_id, :stripe_account => order.product.wholesaler.stripe_id)\n begin\n refund = charge.refunds.create(:amount => charge.amount, :refund_application_fee => true)\n rescue => e\n return render :json => {\n success: false,\n error: e.message\n }\n end\n if !refund.nil?\n order.refunded = true\n order.sale_made = false\n product_sales = order.product.current_sales.to_f\n new_sales = order.full_price ? product_sales+order.amount.to_f*order.product.price.to_f : product_sales+order.amount.to_f*order.product.discount.to_f\n order.product.current_sales = new_sales\n order.save(validate: false)\n return render :json => {\n success: true,\n order: order,\n charge: charge,\n refund: refund\n }\n end\n end",
"def refund(money, reference, options = {})\n standard_response\n end",
"def new\n add_breadcrumb \"Tramanta\", :bazar_path\n add_breadcrumb \"Solicitud de devolución\", :new_refund_request_path\n \n @refund_request = RefundRequest.new\n @user_id = current_user.id\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @refund_request }\n end\n end",
"def refund( trans_id, amount_in_cents )\n resp = client.refund(\n token: payment.token,\n trans_id: trans_id,\n amount: amount_in_cents.to_i.abs\n ).body\n\n user.refunds.create!(\n amount_in_cents: amount_in_cents,\n description: \"Refund value\",\n metadata: resp.as_json\n )\n rescue BridgePay::ResponseError => ex\n raise RefundFailure.new( ex.response )\n end",
"def refund!(amnt = nil)\n RefundRepository.new(api).create(token, amnt)\n end",
"def destroy\n @carbontaxrefund = Carbontaxrefund.find(params[:id])\n @carbontaxrefund.destroy\n\n respond_to do |format|\n format.html { redirect_to carbontaxrefunds_url }\n format.json { head :no_content }\n end\n end",
"def get_payinrefund_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PayinrefundApi.get_payinrefund ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling PayinrefundApi.get_payinrefund\"\n end\n # resource path\n local_var_path = '/payinrefunds/{id}'.sub('{' + 'id' + '}', id.to_s)\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 = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20018')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PayinrefundApi#get_payinrefund\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def refund(\n amazon_capture_id,\n refund_reference_id,\n amount,\n currency_code: @currency_code,\n seller_refund_note: nil,\n soft_descriptor: nil,\n provider_credit_reversal_details: nil,\n merchant_id: @merchant_id,\n mws_auth_token: nil\n )\n\n parameters = {\n 'Action' => 'Refund',\n 'SellerId' => merchant_id,\n 'AmazonCaptureId' => amazon_capture_id,\n 'RefundReferenceId' => refund_reference_id,\n 'RefundAmount.Amount' => amount,\n 'RefundAmount.CurrencyCode' => currency_code\n }\n\n optional = {\n 'SellerRefundNote' => seller_refund_note,\n 'SoftDescriptor' => soft_descriptor,\n 'MWSAuthToken' => mws_auth_token\n }\n\n optional.merge!(set_provider_credit_reversal_details(provider_credit_reversal_details)) if provider_credit_reversal_details\n\n operation(parameters, optional)\n end",
"def refund_a_payment_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PaymentsApi.refund_a_payment ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling PaymentsApi.refund_a_payment\"\n end\n pattern = Regexp.new(/^(pay)_(\\w{26})$/)\n if @api_client.config.client_side_validation && id !~ pattern\n fail ArgumentError, \"invalid value for 'id' when calling PaymentsApi.refund_a_payment, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/payments/{id}/refunds'.sub('{' + 'id' + '}', CGI.escape(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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'Cko-Idempotency-Key'] = opts[:'cko_idempotency_key'] if !opts[:'cko_idempotency_key'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'refund_request'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'RefundAcceptedResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['ApiSecretKey']\n\n new_options = opts.merge(\n :operation => :\"PaymentsApi.refund_a_payment\",\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: PaymentsApi#refund_a_payment\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def sync_refunds(event)\n payment_method = event.payment_method\n stripe_payment_intent_id = event.data.object.payment_intent\n\n RefundsSynchronizer\n .new(payment_method)\n .call(stripe_payment_intent_id)\n end",
"def index\n @now = DateTime.new(Time.zone.now.year, Time.zone.now.month, Time.zone.now.day, Time.zone.now.hour, Time.zone.now.min, Time.zone.now.sec)\n @start_date = params[:start_date].nil? ? DateTime.new(@now.year, @now.month, 1, 4, 0) : DateTime.parse(params[:start_date] + \" 04:00:00\")\n @end_date = params[:end_date].nil? ? DateTime.new(@now.year, @now.month, -1, 4, 0) : DateTime.parse(params[:end_date] + \" 04:00:00\")\n \n @refunds = Refund.find(:all, :conditions => ['created_at >= ? and created_at < ?', @start_date, @end_date + 1.day])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @refunds }\n end\n end",
"def update\n @refund_request = RefundRequest.find(params[:id])\n\n respond_to do |format|\n if @refund_request.update_attributes(params[:refund_request])\n format.html { redirect_to @refund_request, notice: 'Refund request was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @refund_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def order_refund_with_http_info(id, order_refund_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OrdersApi.order_refund ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling OrdersApi.order_refund\"\n end\n # verify the required parameter 'order_refund_request' is set\n if @api_client.config.client_side_validation && order_refund_request.nil?\n fail ArgumentError, \"Missing the required parameter 'order_refund_request' when calling OrdersApi.order_refund\"\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/orders/{id}/refunds'.sub('{' + 'id' + '}', CGI.escape(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/vnd.conekta-v2.1.0+json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(order_refund_request)\n\n # return_type\n return_type = opts[:debug_return_type] || 'OrderResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"OrdersApi.order_refund\",\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: OrdersApi#order_refund\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def refund transaction\n transaction = Transaction.new transaction\n order_id = transaction.order_id.to_i\n transaction_id = transaction.transaction_id\n transaction_params = ActiveSupport::OrderedHash.new\n transaction_params['amount'] = transaction.amount.to_s\n transaction_params['currency'] = transaction.currency\n transaction_params['reference'] = transaction.reference.to_s\n params = ActiveSupport::OrderedHash.new\n params['apiOperation'] = 'REFUND'\n params['transaction'] = transaction_params\n\n request :put, \"/merchant/#{merchant_id}/order/#{order_id}/transaction/#{transaction_id}\", params\n end",
"def create_refund_with_http_info(location_id, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: V1TransactionsApi.create_refund ...\"\n end\n # verify the required parameter 'location_id' is set\n fail ArgumentError, \"Missing the required parameter 'location_id' when calling V1TransactionsApi.create_refund\" if location_id.nil?\n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling V1TransactionsApi.create_refund\" if body.nil?\n # resource path\n local_var_path = \"/v1/{location_id}/refunds\".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s)\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'V1Refund')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: V1TransactionsApi#create_refund\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def list_refunds(location_id, opts = {})\n data, _status_code, _headers = list_refunds_with_http_info(location_id, opts)\n return data\n end",
"def list_refunds(location_id, opts = {})\n data, _status_code, _headers = list_refunds_with_http_info(location_id, opts)\n return data\n end",
"def test_successful_refund\n assert response = @gateway.purchase(@amount, @credit_card, @options)\n assert_successful_response(response)\n\n assert response = @gateway.refund(@amount, response.authorization)\n assert_successful_response(response)\n end",
"def refund_params\n params.require(:refund).permit(:credit_base, :credit_fee, :customer_id, :gateway, fields: {})\n end",
"def refund_transaction_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PaymentsTransactionsApi.refund_transaction ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling PaymentsTransactionsApi.refund_transaction\"\n end\n # resource path\n local_var_path = \"/transactions/{id}/refunds\".sub('{' + 'id' + '}', id.to_s)\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[:'request'])\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 => 'RefundResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PaymentsTransactionsApi#refund_transaction\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_refund_mile_payment(body)\r\n # Prepare query url.\r\n _path_url = '/v2/ecommerce/payments/actions/refund'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'content-type' => 'application/json; charset=utf-8'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n headers: _headers,\r\n parameters: body.to_json\r\n )\r\n OAuth2.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n Response.from_hash(decoded)\r\n end",
"def refund_status\n nil\n end",
"def refund(transaction_id, caller_reference, options = {})\n submit Refund.new(options.merge(:transaction_id => transaction_id, :caller_reference => caller_reference))\n end",
"def perform_refund\n # make the SOAP API call\n response = Docdata.client.call(:refund, xml: refund_xml)\n response_object = Docdata::Response.parse(:refund, response)\n if response_object.success?\n return true\n else\n return false\n end\n end",
"def refund token, payload={}\n payload.merge! :namespace => 'refund', :token => token\n invoke :put, payload\n end",
"def index\n @api_v1_rewards = Api::V1::Reward.all\n end",
"def show\n @fund = Fund.friendly.find(params[:id])\n\n render json: @fund\n end",
"def retrieve(id)\n @client.make_request(:get, \"insurances/#{id}\", MODEL_CLASS)\n end",
"def test_failed_refund\n response = @gateway.refund(@amount, 'thisisnotavalidtrasactionid')\n assert_failure response\n assert_equal 'Error(s)- code:3407, message:The settlement referred to by the transaction response ID you provided cannot be found.', response.message\n end",
"def refund(merchant_access_token)\n Requests::RefundOrder.new(merchant_access_token: merchant_access_token).\n send_to_api(:post, endpoint_path + '/refund')\n end",
"def refund_by_payment_log(payment_log_id)\n params = {\n payment_log_id: payment_log_id,\n }\n @client.make_request(:post, 'referral_customers/refunds', EasyPost::Models::EasyPostObject, params, 'beta')\n end",
"def test_failed_refund\n response = @gateway.refund(@amount, @invalid_txn)\n assert_failure response\n assert_equal 'Txn not found', response.message\n end",
"def get_payinrefunds(opts = {})\n data, _status_code, _headers = get_payinrefunds_with_http_info(opts)\n data\n end",
"def refund_transaction\n data = full_params.merge(\n 'x_trans_id' => transaction_id,\n 'x_type' => \"REFUND\"\n )\n\n astro_curl(@validator_url, data)\n end",
"def create_refund_with_http_info(location_id, transaction_id, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TransactionsApi.create_refund ...\"\n end\n # verify the required parameter 'location_id' is set\n fail ArgumentError, \"Missing the required parameter 'location_id' when calling TransactionsApi.create_refund\" if location_id.nil?\n # verify the required parameter 'transaction_id' is set\n fail ArgumentError, \"Missing the required parameter 'transaction_id' when calling TransactionsApi.create_refund\" if transaction_id.nil?\n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling TransactionsApi.create_refund\" if body.nil?\n # resource path\n local_var_path = \"/v2/locations/{location_id}/transactions/{transaction_id}/refund\".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s).sub('{' + 'transaction_id' + '}', transaction_id.to_s)\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 header_params['Square-Version'] = \"2018-07-12\"\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'CreateRefundResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionsApi#create_refund\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def refund_params\n params.require(:refund).permit(\n Refund.attribute_names.map(&:to_sym)\n )\n end",
"def test_refund_partial\n assert refund = @gateway.refund(555, '9999999999') # $5.55 in cents\n assert_success refund\n end",
"def handle_refund\n if saved_change_to_state == %w(purchased refunded)\n refund = self.build_refund({\n payment_id: payment_id,\n state: :pending,\n })\n refund.save!\n seller.decrease_balance(payment.amount)\n end \n end",
"def refund(sbp_request, opts = {})\n data, status_code, headers = refund_with_http_info(sbp_request, opts)\n return data\n end",
"def post_v2_refund_by_order_with_http_info(order_uuid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OrderApi.post_v2_refund_by_order ...'\n end\n # verify the required parameter 'order_uuid' is set\n if @api_client.config.client_side_validation && order_uuid.nil?\n fail ArgumentError, \"Missing the required parameter 'order_uuid' when calling OrderApi.post_v2_refund_by_order\"\n end\n # resource path\n local_var_path = '/order/{order_uuid}/refund'.sub('{' + 'order_uuid' + '}', order_uuid.to_s)\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n 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[:'body'])\n\n return_type = opts[:return_type] || 'InlineResponse2006'\n\n auth_names = opts[:auth_names] || ['Bearer']\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 => return_type)\n\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrderApi#post_v2_refund_by_order\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def refund(original_reference:, amount:, reference:, merchantAccount: @merchant_account, currency: @currency)\n postJSON(\"/Payment/v12/refund\",\n reference: reference,\n merchantAccount: merchant_account,\n modificationAmount: { value: amount, currency: currency },\n originalReference: original_reference\n )\n end",
"def refund_path\n Base.current_integration_type_url + TRANSACTION_BASE_PATH + REFUND_TRANSACTION\n end",
"def index\n @funds = Fund.all\n\n render json: @funds\n end",
"def list_additional_recipient_receivable_refunds_with_http_info(location_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ReportingApi.list_additional_recipient_receivable_refunds ...\"\n end\n # verify the required parameter 'location_id' is set\n fail ArgumentError, \"Missing the required parameter 'location_id' when calling ReportingApi.list_additional_recipient_receivable_refunds\" if location_id.nil?\n if opts[:'sort_order'] && !['DESC', 'ASC'].include?(opts[:'sort_order'])\n fail ArgumentError, 'invalid value for \"sort_order\", must be one of DESC, ASC'\n end\n # resource path\n local_var_path = \"/v2/locations/{location_id}/additional-recipient-receivable-refunds\".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'begin_time'] = opts[:'begin_time'] if !opts[:'begin_time'].nil?\n query_params[:'end_time'] = opts[:'end_time'] if !opts[:'end_time'].nil?\n query_params[:'sort_order'] = opts[:'sort_order'] if !opts[:'sort_order'].nil?\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n \n header_params['Square-Version'] = \"2018-07-12\"\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ListAdditionalRecipientReceivableRefundsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ReportingApi#list_additional_recipient_receivable_refunds\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def refund!\n if charged && !canceled\n transaction = Stripe::Charge.retrieve(trans_id)\n if transaction.refund\n update updated: true, canceled: true\n else\n raise result.errors\n end\n end\n end",
"def refund_payment_with_http_info(payment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PaymentsApi.refund_payment ...\"\n end\n # verify the required parameter 'payment_id' is set\n if @api_client.config.client_side_validation && payment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'payment_id' when calling PaymentsApi.refund_payment\"\n end\n if @api_client.config.client_side_validation && payment_id !~ Regexp.new(/\\\\w+-\\\\w+-\\\\w+-\\\\w+-\\\\w+/)\n fail ArgumentError, \"invalid value for 'payment_id' when calling PaymentsApi.refund_payment, must conform to the pattern /\\\\w+-\\\\w+-\\\\w+-\\\\w+-\\\\w+/.\"\n end\n\n # resource path\n local_var_path = \"/1.0/kb/payments/{paymentId}/refunds\".sub('{' + 'paymentId' + '}', payment_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'controlPluginName'] = @api_client.build_collection_param(opts[:'control_plugin_name'], :multi) if !opts[:'control_plugin_name'].nil?\n query_params[:'pluginProperty'] = @api_client.build_collection_param(opts[:'plugin_property'], :multi) if !opts[:'plugin_property'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'X-Killbill-CreatedBy'] = opts[:'x_killbill_created_by'] if !opts[:'x_killbill_created_by'].nil?\n header_params[:'X-Killbill-Reason'] = opts[:'x_killbill_reason'] if !opts[:'x_killbill_reason'].nil?\n header_params[:'X-Killbill-Comment'] = opts[:'x_killbill_comment'] if !opts[:'x_killbill_comment'].nil?\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PaymentsApi#refund_payment\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end"
] | [
"0.7301627",
"0.71893334",
"0.71390665",
"0.71280944",
"0.7020472",
"0.7020472",
"0.6979931",
"0.695762",
"0.6921594",
"0.6905886",
"0.6871424",
"0.68568027",
"0.6736404",
"0.6691081",
"0.66664696",
"0.66564816",
"0.66289157",
"0.66115683",
"0.6606588",
"0.65953076",
"0.659332",
"0.659332",
"0.6577973",
"0.65461695",
"0.6516914",
"0.65152264",
"0.6465218",
"0.6462371",
"0.6449961",
"0.6359617",
"0.6319754",
"0.6296778",
"0.6289187",
"0.6287827",
"0.6271316",
"0.62440896",
"0.6230665",
"0.6224717",
"0.620585",
"0.6181997",
"0.6169876",
"0.61436355",
"0.6139694",
"0.61384684",
"0.6088816",
"0.607563",
"0.60646856",
"0.6027685",
"0.6025777",
"0.6003221",
"0.5980864",
"0.5963239",
"0.5949486",
"0.593453",
"0.5912177",
"0.5896015",
"0.58769697",
"0.58766633",
"0.5866691",
"0.58336353",
"0.58255565",
"0.5819755",
"0.5794943",
"0.57832307",
"0.57824874",
"0.5704307",
"0.56915134",
"0.56887996",
"0.5664279",
"0.5664279",
"0.56613714",
"0.56443024",
"0.5627133",
"0.56242293",
"0.56108004",
"0.5590114",
"0.5586442",
"0.5586232",
"0.557405",
"0.5556423",
"0.55430806",
"0.55310917",
"0.5522849",
"0.55148077",
"0.5486977",
"0.5469376",
"0.54693055",
"0.54669863",
"0.54631734",
"0.5453488",
"0.5442787",
"0.54301554",
"0.5429027",
"0.54204667",
"0.5407188",
"0.5399792",
"0.53743815",
"0.5347028",
"0.53191507"
] | 0.749443 | 1 |
GET /refunds/new GET /refunds/new.json | def new
@refund = Refund.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @refund }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @refund = Refund.new(params[:refund])\n\n respond_to do |format|\n if @refund.save\n format.html { redirect_to @refund, notice: 'Refund was successfully created.' }\n format.json { render json: @refund, status: :created, location: @refund }\n else\n format.html { render action: \"new\" }\n format.json { render json: @refund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n add_breadcrumb \"Tramanta\", :bazar_path\n add_breadcrumb \"Solicitud de devolución\", :new_refund_request_path\n \n @refund_request = RefundRequest.new\n @user_id = current_user.id\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @refund_request }\n end\n end",
"def create\n @refund = Refund.new(params[:refund])\n\n respond_to do |format|\n if @refund.save\n format.html { redirect_to @refund, notice: 'El rembolso ha sido almacenado' }\n format.json { render json: @refund, status: :created, location: @refund }\n else\n format.html { render action: \"new\" }\n format.json { render json: @refund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @carbontaxrefund = Carbontaxrefund.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @carbontaxrefund }\n end\n end",
"def create\n @refund = Refund.new(refund_params)\n\n respond_to do |format|\n if @refund.save\n format.html do\n redirect_to(\n seller_product_purchases_path(@seller, @product),\n notice: 'Refund was successfully created.'\n )\n end\n format.json { render :show, status: :created, location: @refund }\n else\n format.html { render :new }\n format.json { render json: @refund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @breadcrumb = 'create'\n @insurance = Insurance.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @insurance }\n end\n end",
"def new\n @financial = Financial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @financial }\n end\n end",
"def new\n @finance = Finance.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @finance }\n end\n end",
"def new\n @title = t('view.trust_funds.new_title')\n @trust_fund = TrustFund.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trust_fund }\n end\n end",
"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",
"def new\n @income = Income.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @income }\n end\n end",
"def new\n @incomestock = Incomestock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @incomestock }\n end\n end",
"def show\n @refund = Refund.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @refund }\n end\n end",
"def show\n @refund = Refund.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @refund }\n end\n end",
"def new\n @rum = Rum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rum }\n end\n end",
"def new\n @fund = Fund.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_fund }\n end\n end",
"def new\n @reimbursement = Reimbursement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reimbursement }\n end\n end",
"def new\n @reimbursement = Reimbursement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reimbursement }\n end\n end",
"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",
"def new\n @stock_transfer = StockTransfer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock_transfer }\n end\n end",
"def new\n @correlation = Correlation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @correlation }\n end\n end",
"def new\n @auction = Auction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @auction }\n end\n end",
"def new\n @fundraiser = Fundraiser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fundraiser }\n end\n end",
"def new\n @pledge = Pledge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pledge }\n end\n end",
"def new\n @pledge = Pledge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pledge }\n end\n end",
"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",
"def create\n @refund_request = RefundRequest.new(params[:refund_request])\n\n respond_to do |format|\n if @refund_request.save\n NoticeMailer.refund_request_email(@refund_request).deliver\n format.html { redirect_to root_path, notice: 'Solicitud de devolución correctamente ingresada.' }\n format.json { render json: @refund_request, status: :created, location: @refund_request }\n else\n format.html { render action: \"new\" }\n format.json { render json: @refund_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @discount = Discount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @discount }\n end\n end",
"def new\n @discount = Discount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @discount }\n end\n end",
"def new\n @stundent = Stundent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stundent }\n end\n end",
"def new\n @disbursement = Disbursement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @disbursement }\n end\n end",
"def new\n @referral = Referral.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @referral }\n end\n end",
"def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end",
"def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end",
"def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end",
"def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end",
"def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end",
"def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end",
"def new\n @invoice = Invoice.new\n @counter = InvoiceNumbers.first\n @items = Item.find_all_by_invoice_id(@invoice.invoice_id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end",
"def new\n # @invoice = Invoice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end",
"def new\n @budget = Budget.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @budget }\n end\n end",
"def new\n @round = Round.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @round }\n end\n end",
"def new\n @invoice = Invoice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @invoice }\n end\n end",
"def new\n @credit = Credit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @credit }\n end\n end",
"def new\n @credit = Credit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @credit }\n end\n end",
"def new\n @charge = Charge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @charge }\n end\n end",
"def new\n @rsvp = Rsvp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rsvp }\n end\n end",
"def new\n @rsvp = Rsvp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rsvp }\n end\n end",
"def new\n @purchase = Purchase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase }\n end\n end",
"def new\n @purchase = Purchase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase }\n end\n end",
"def new\n @purchase = Purchase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase }\n end\n end",
"def new\n @credit = Credit.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @credit }\n end\n end",
"def new\n @repurchase = Repurchase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @repurchase }\n end\n end",
"def new\n @correction = Correction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @correction }\n end\n end",
"def new\n @report_narrative = ReportNarrative.new\n @report_narrative.uri = params[:uri]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @report_narrative }\n end\n end",
"def new\n @budget = Budget.new\n\n respond_to do |format|\n format.html # new.html.erb\n # format.json { render json: @budget }\n end\n end",
"def new\n @clue = Clue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clue }\n end\n end",
"def new\n @clue = Clue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clue }\n end\n end",
"def new\n # @stock_resource = StockResource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock_resource }\n end\n end",
"def new\n @invoice_status = InvoiceStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice_status }\n end\n end",
"def new\n @purchase_requisition = PurchaseRequisition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase_requisition }\n end\n end",
"def new\n @party = Party.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @party }\n end\n end",
"def new\n @purchased_stock = PurchasedStock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchased_stock }\n end\n end",
"def new\n @purchased_stock = PurchasedStock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchased_stock }\n end\n end",
"def show\n @refund_request = RefundRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @refund_request }\n end\n end",
"def new\n @lookup = Lookup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lookup }\n end\n end",
"def new\n @roof = Roof.find(params[:roof_id])\n @status = @roof.statuses.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status }\n end\n end",
"def new\n @money_receipt = MoneyReceipt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @money_receipt }\n end\n end",
"def new\n @referee = Referee.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @referee }\n end\n end",
"def new\n @stock_transaction = StockTransaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock_transaction }\n end\n end",
"def new\n @preguntum = Preguntum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @preguntum }\n end\n end",
"def new\n @lost = Lost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lost }\n end\n end",
"def new\n @borrow = Borrow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @borrow }\n end\n end",
"def new\n @closing_item = ClosingItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @closing_item }\n end\n end",
"def new\n @income_entry = IncomeEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @income_entry }\n end\n end",
"def new\n @unsolved = Unsolved.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @unsolved }\n end\n end",
"def new\n @endurance = Endurance.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @endurance }\n end\n end",
"def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @refunds }\n end\n end",
"def new\n @total_stock = TotalStock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @total_stock }\n end\n end",
"def new\n @residence = Residence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @residence }\n end\n end",
"def new\n @trap = Trap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trap }\n end\n end",
"def new\n @year_insurances = YearInsurance.active.joins(:family)\n @reimbursement = Reimbursement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reimbursement }\n end\n end",
"def new\n @region = Region.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @region }\n end\n end",
"def new\n @release_loan = ReleaseLoan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @release_loan }\n end\n end",
"def new\n @unpaid_debt = UnpaidDebt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @unpaid_debt }\n end\n end",
"def new\n @contribution = Contribution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contribution }\n end\n end",
"def new\n @our_coin = OurCoin.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @our_coin }\n end\n end",
"def new\n @requisition = Requisition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @requisition }\n end\n end",
"def new\n @purchase_receipt = PurchaseReceipt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase_receipt }\n end\n end",
"def new\n @balance = scope.new\n @routes = current_user.locations.collect(&:routes).flatten\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @balance }\n end\n end",
"def new\n @loan = Loan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @loan }\n end\n end",
"def new\n @stock_type = StockType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock_type }\n end\n end",
"def new\n @recurso = Recurso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recurso }\n end\n end",
"def new\n @rebalance_trade = RebalanceTrade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rebalance_trade }\n end\n end",
"def new\n @reward_rule = RewardRule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reward_rule }\n end\n end",
"def new\n @routing = Routing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @routing }\n end\n end",
"def new\n @withdrawal = Withdrawal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @withdrawal }\n end\n end",
"def new\n @revenue_model = RevenueModel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @revenue_model }\n end\n end",
"def new\n @borrow_request = BorrowRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @borrow_request }\n end\n end"
] | [
"0.7760759",
"0.7684975",
"0.74572015",
"0.744348",
"0.6885683",
"0.6806962",
"0.6689645",
"0.66887814",
"0.6637615",
"0.65879345",
"0.6569617",
"0.6530977",
"0.65274894",
"0.65274894",
"0.65236926",
"0.6481491",
"0.64791125",
"0.64791125",
"0.6474597",
"0.6473745",
"0.64698845",
"0.6463297",
"0.64592624",
"0.64473826",
"0.64473826",
"0.6443648",
"0.6433066",
"0.64232355",
"0.64232355",
"0.6410666",
"0.6408438",
"0.64027554",
"0.6395725",
"0.6395725",
"0.6395725",
"0.6395725",
"0.6395725",
"0.6395725",
"0.638149",
"0.6381145",
"0.63730854",
"0.63642406",
"0.63580066",
"0.6355696",
"0.6355696",
"0.63405234",
"0.6338999",
"0.6338999",
"0.63384473",
"0.63384473",
"0.63384473",
"0.63382894",
"0.6335579",
"0.6335451",
"0.6333978",
"0.63330597",
"0.63289994",
"0.63289994",
"0.6327425",
"0.63271093",
"0.63257486",
"0.631961",
"0.6304503",
"0.6304503",
"0.62983894",
"0.62961835",
"0.62941027",
"0.6290722",
"0.6282945",
"0.6281265",
"0.62804323",
"0.62764",
"0.6262697",
"0.6258622",
"0.625716",
"0.6254299",
"0.6254057",
"0.62519825",
"0.6246757",
"0.6244662",
"0.6243875",
"0.62407047",
"0.623763",
"0.6234411",
"0.62322986",
"0.62283254",
"0.6221116",
"0.6220687",
"0.62174416",
"0.62108815",
"0.6210775",
"0.6209064",
"0.6203408",
"0.6200819",
"0.61996895",
"0.6197532",
"0.61956745",
"0.61913127",
"0.61787206"
] | 0.847749 | 1 |
POST /refunds POST /refunds.json | def create
@refund = Refund.new(params[:refund])
respond_to do |format|
if @refund.save
format.html { redirect_to @refund, notice: 'El rembolso ha sido almacenado' }
format.json { render json: @refund, status: :created, location: @refund }
else
format.html { render action: "new" }
format.json { render json: @refund.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @refund = Refund.new(params[:refund])\n\n respond_to do |format|\n if @refund.save\n format.html { redirect_to @refund, notice: 'Refund was successfully created.' }\n format.json { render json: @refund, status: :created, location: @refund }\n else\n format.html { render action: \"new\" }\n format.json { render json: @refund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def refund(tid, refund)\n begin\n #creating url\n url = \"#{@security.environment}/transactions/#{tid}/refunds\"\n\n # make the request.\n json_response = Rede::CommonRequest::post(url, refund, @security)\n\n # mapping the result.\n response = Rede::RefundResponse.map(json_response)\n\n rescue Exception => e\n response = Rede::RefundResponse.new(:return_code => Rede::ReturnCode::UNSUCCESSFUL, :return_message => e.message)\n end\n\n return response\n end",
"def request_refund\n body = { action: \"refund\", key: @@access_key, gen_task_id: @task_id }\n post_request(body)\n end",
"def refund(params)\n request(Resources::RESOURCE_REFUND, HTTP_METHOD_POST, params)\n end",
"def refund!\n path = self.class.endpoint.gsub(':id', id.to_s) + '/refund'\n client.api_post(path)\n end",
"def refund(refund); end",
"def refunds\n RefundRepository.new(api).all(token)\n end",
"def create\n @refund = Refund.new(refund_params)\n\n respond_to do |format|\n if @refund.save\n format.html do\n redirect_to(\n seller_product_purchases_path(@seller, @product),\n notice: 'Refund was successfully created.'\n )\n end\n format.json { render :show, status: :created, location: @refund }\n else\n format.html { render :new }\n format.json { render json: @refund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_refunds\n @proposal.refunds.each do |bank_account, amount|\n run_task \"add_refunds_#{bank_account}\" do\n if transfer = add_bank_transfer(bank_account, @export.receivables_account, amount)\n current_state[:transfer_id] = transfer['BankTransferID']\n end\n end\n end\n end",
"def refunds_create_with_http_info(token, order_id, refund_reason, cents, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RefundsApi.refunds_create ...\"\n end\n # verify the required parameter 'token' is set\n if @api_client.config.client_side_validation && token.nil?\n fail ArgumentError, \"Missing the required parameter 'token' when calling RefundsApi.refunds_create\"\n end\n # verify the required parameter 'order_id' is set\n if @api_client.config.client_side_validation && order_id.nil?\n fail ArgumentError, \"Missing the required parameter 'order_id' when calling RefundsApi.refunds_create\"\n end\n # verify the required parameter 'refund_reason' is set\n if @api_client.config.client_side_validation && refund_reason.nil?\n fail ArgumentError, \"Missing the required parameter 'refund_reason' when calling RefundsApi.refunds_create\"\n end\n # verify the required parameter 'cents' is set\n if @api_client.config.client_side_validation && cents.nil?\n fail ArgumentError, \"Missing the required parameter 'cents' when calling RefundsApi.refunds_create\"\n end\n # resource path\n local_var_path = \"/api/v1/orders/{order_id}/refunds\".sub('{' + 'order_id' + '}', order_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'token'] = token\n\n # header parameters\n header_params = {}\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n form_params[\"refund_reason\"] = refund_reason\n form_params[\"cents\"] = cents\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 => 'RefundResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RefundsApi#refunds_create\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def refund(params = {})\n req = WebPay::ChargeRequestRefund.create(params)\n raw_response = @client._request(:post, 'charges' + '/' + req.id.to_s + '/' + 'refund', req)\n WebPay::ChargeResponse.new(raw_response)\n end",
"def request_refund(options = {})\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/request_refund\", options).body)\n @attributes = response['items']\n true\n end",
"def request_refund(options = {})\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/request_refund\", options).body)\n @attributes = response['items']\n true\n end",
"def stripe_refund\n return unless charge_id.present?\n Reservation.transaction do\n charge = Stripe::Charge.retrieve(charge_id)\n charge.refunds.create(amount: charge.amount, reverse_transfer: true)\n update_attributes(refunded: true, is_paid: false, billing_phase: :not_billed, charge_id: nil)\n end\n rescue Exception => e\n custom_params = { reservation_id: id, charge_id: charge_id, amount: charge.amount }\n Rollbar.error(e, 'Stripe refund failed', custom_params)\n end",
"def refund(amount: nil)\n api_request(\"/charges/#{id}/refund\", :post, amount: amount)\n end",
"def refund(item_refund)\n item_refund.save!\n remaining_refund_amount = item_refund.total\n refund_payments = payments(item_refund)\n refund_payments.each do |payment|\n next if remaining_refund_amount <= 0\n amount_to_refund = calculate_amount_to_refund(payment, remaining_refund_amount)\n remaining_refund_amount -= amount_to_refund\n\n create_refund(item_refund, payment, amount_to_refund)\n end\n end",
"def refund amount, capture_id, options={}\n options[:capture_id] = capture_id if capture_id\n\n if amount\n options[:amount] = assert_currency options[:currency], amount\n end\n\n response = flow_instance.refunds.post @flow_organization, options\n\n if response.try(:id)\n Response.new true, 'Flow refund - Success', { response: response }\n else\n Response.new false, 'Flow refund - Error', { response: response }\n end\n rescue Io::Flow::V0::HttpClient::ServerError => exception\n error_response exception\n end",
"def refund_params\n params.require(:refund).permit(:credit_base, :credit_fee, :customer_id, :gateway, fields: {})\n end",
"def destroy\n @refund = Refund.find(params[:id])\n @refund.destroy\n\n respond_to do |format|\n format.html { redirect_to refunds_url }\n format.json { head :ok }\n end\n end",
"def new\n @refund = Refund.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @refund }\n end\n end",
"def new\n @refund = Refund.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @refund }\n end\n end",
"def gateway_refund\n resource.direct_refund\n respond_to do |format|\n format.html do\n return redirect_to admin_contributions_path(params[:local_params])\n end\n format.json do\n return render json: []\n end\n end\n end",
"def do \n validate\n ZipMoney.api.refund(@params)\n end",
"def refund(id, params = {}, options = {})\n response = request(:post, resource_path(\"captures/#{id}/refund\"), params, options)\n FatZebra::Paypal::Refund.initialize_from(response)\n end",
"def destroy\n @refund = Refund.find(params[:id])\n @refund.destroy\n\n respond_to do |format|\n format.html { redirect_to refunds_url }\n format.json { head :no_content }\n end\n end",
"def refund_with_http_info(sbp_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: VApi#refund ...\"\n end\n \n # verify the required parameter 'sbp_request' is set\n fail \"Missing the required parameter 'sbp_request' when calling refund\" if sbp_request.nil?\n \n # resource path\n path = \"/v1/transaction/refund\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'application/xml']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json', 'application/xml']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(sbp_request)\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SbpResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VApi#refund\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def refund *args\n warn_on_positional args\n\n options = args.last.is_a?(Hash) ? args.pop : {}\n amount = args[0] || options.fetch(:amount) { nil }\n description = args[1] || options.fetch(:description) { nil }\n\n refund = Refund.new(\n :uri => self.refunds_uri,\n :debit_uri => self.uri,\n :amount => amount,\n :description => description,\n )\n refund.save\n end",
"def create_refund_mile_payment(body)\r\n # Prepare query url.\r\n _path_url = '/v2/ecommerce/payments/actions/refund'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'content-type' => 'application/json; charset=utf-8'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n headers: _headers,\r\n parameters: body.to_json\r\n )\r\n OAuth2.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n Response.from_hash(decoded)\r\n end",
"def refund( trans_id, amount_in_cents )\n resp = client.refund(\n token: payment.token,\n trans_id: trans_id,\n amount: amount_in_cents.to_i.abs\n ).body\n\n user.refunds.create!(\n amount_in_cents: amount_in_cents,\n description: \"Refund value\",\n metadata: resp.as_json\n )\n rescue BridgePay::ResponseError => ex\n raise RefundFailure.new( ex.response )\n end",
"def create\n @refund = Refund.new(params[:refund])\n @queued_coupon_refunds = Coupon.find(session[:queued_coupon_refunds])\n \n # create wtd credits\n if @refund.credit_amount > 0\n @credit = Credit.new\n @credit.promotion_code_id = PromotionCode::REFUND_CREDIT\n @credit.value = @refund.credit_amount\n @credit.user_id = @refund.purchase.user.id\n @credit.save\n @refund.credit_id = @credit.id\n end\n \n \n # connect with authorize.net\n @connect = true\n \n if @connect\n # mark coupons as refunded\n @queued_coupon_refunds.each do |coupon|\n coupon.refunded = true\n coupon.save\n end\n \n # clear session\n session[:queued_coupon_refunds] = []\n end\n \n if @refund.save\n flash[:notice] = 'Refund was successfully saved.'\n redirect_to(admin_refund_path(@refund))\n else\n render :action => \"new\"\n end\n end",
"def process_refund\n express_token ?\n EXPRESS_PAYPAL_GATEWAY.refund(nil, capture_authorization) :\n STANDARD_PAYPAL_GATEWAY.refund(nil, capture_authorization)\n end",
"def refund(unique_id)\n request('payment/refund', {:refund => {:unique_id => unique_id}})\n end",
"def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @refunds }\n end\n end",
"def decline_refund\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/decline_refund\").body)\n @attributes = response['items']\n true\n end",
"def refund_order\n Stripe.api_key = ENV['STRIPE_SECRET_KEY']\n order = Commit.find(params[:order_id])\n charge = Stripe::Charge.retrieve(order.sale.stripe_charge_id, :stripe_account => order.product.wholesaler.stripe_id)\n begin\n refund = charge.refunds.create(:amount => charge.amount, :refund_application_fee => true)\n rescue => e\n return render :json => {\n success: false,\n error: e.message\n }\n end\n if !refund.nil?\n order.refunded = true\n order.sale_made = false\n product_sales = order.product.current_sales.to_f\n new_sales = order.full_price ? product_sales+order.amount.to_f*order.product.price.to_f : product_sales+order.amount.to_f*order.product.discount.to_f\n order.product.current_sales = new_sales\n order.save(validate: false)\n return render :json => {\n success: true,\n order: order,\n charge: charge,\n refund: refund\n }\n end\n end",
"def refund amount=nil, description=nil\n refund = Refund.new(\n :uri => self.refunds_uri,\n :debit_uri => self.uri,\n :amount => amount,\n :description => description,\n )\n refund.save\n end",
"def refund\n request = Remit::Refund::Request.new(transaction_id: transaction_id, caller_reference: caller_reference)\n response = remit.refund request\n response.errors.empty?\n end",
"def create_issue_refund\n @error = \"\"\n if params[:refund_amount].present?\n if params[:refund_amount].to_d > 0.0 && params[:refund_amount].to_d <= @trans.amount\n @refund_trans = Transaction.new(\n amount: params[:refund_amount].to_d, \n transaction_type: \"Payment\",\n status: \"Refunded\",\n from_account_id: current_user.account.id,\n to_account_id: @trans.from_account.id,\n transaction_from: \"User\",\n transaction_to: \"User\",\n kaenko_currency_id: @trans.kaenko_currency_id,\n status: \"Completed\" , \n user_id: current_user.id,\n transaction_from_id: current_user.id,\n transaction_to_id: @trans.transaction_from_id,\n parent_id: @trans.id\n \n )\n Transaction.transaction do\n if @refund_trans.save\n @account_balance = current_user.account.account_balances.where(\n \"kaenko_currency_id = ?\",\n @trans.kaenko_currency_id\n ).first\n @account_balance.update_attributes(balance: @account_balance.balance - params[:refund_amount].to_d)\n @trans.update_attributes(status: \"Refunded\")\n end\n end\n else\n @error = \"Please enter valid amount.\" \n end\n else\n @error = \"Please enter amount.\"\n end\n end",
"def refund!(amnt = nil)\n RefundRepository.new(api).create(token, amnt)\n end",
"def refund_params\n params.require(:refund).permit(\n Refund.attribute_names.map(&:to_sym)\n )\n end",
"def refresh_refund\n\t\t\n\t\tif self.refund && self.payment_status.nil?\n\t\t\t\n\t\t\talready_accepted_refunds = self.class.where(:refund => true, :payment_status => 1, :updated_at => { :$gte => self.created_at})\n\t\t\t\n\t\t\tif already_accepted_refunds.size > 0\n\t\t\t\t\n\t\t\t\tself.refund_failed\n\t\t\tend\n\t\tend\n\tend",
"def refund_order\n\t\t@order = Order.find(params[:order_id])\n\n\t\tif @order.refunded\n\t\t\trender :json => { :error => \"Order has already been refunded\" }\n\t\telse \n\t\t\tcharge = Stripe::Charge.retrieve(order.charge_id)\n\t\t\trefund = charge.refunds.create\n\t\t\trender :json => { :refunded => true, :refund_id => refund.id, :message => \"Order refunded successfully\" }\n\t\tend\n\n\tend",
"def refund_by_amount(amount)\n params = {\n refund_amount: amount,\n }\n @client.make_request(:post, 'referral_customers/refunds', EasyPost::Models::EasyPostObject, params, 'beta')\n # noinspection RubyMismatchedReturnType\n end",
"def refunds_create(token, order_id, refund_reason, cents, opts = {})\n data, _status_code, _headers = refunds_create_with_http_info(token, order_id, refund_reason, cents, opts)\n return data\n end",
"def update\n @refund = Refund.find(params[:id])\n\n respond_to do |format|\n if @refund.update_attributes(params[:refund])\n format.html { redirect_to @refund, notice: 'Refund was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @refund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @refund = Refund.find(params[:id])\n\n respond_to do |format|\n if @refund.update_attributes(params[:refund])\n format.html { redirect_to @refund, notice: 'Refund was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @refund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @refund_request = RefundRequest.find(params[:id])\n @refund_request.destroy\n\n respond_to do |format|\n format.html { redirect_to refund_requests_url }\n format.json { head :ok }\n end\n end",
"def create_financial_transaction_refund_payin ft_to_refund\n financial_transaction = {\n transaction_type: 'payin_refund',\n purpose: ft_to_refund.purpose,\n src_type: :src_payin_vid,\n src_vid: ft_to_refund.transaction_vid\n }\n t = self.financial_transactions.create( financial_transaction )\n\n # called from a BookingProcessPayinRefundJob:\n # t.process!\n BookingProcessPayinRefundJob.perform_later self\n end",
"def test_successful_refund\n assert response = @gateway.purchase(@amount, @credit_card, @options)\n assert_successful_response(response)\n\n assert response = @gateway.refund(@amount, response.authorization)\n assert_successful_response(response)\n end",
"def refund\n @order.refund_payment\n render 'status'\n end",
"def index\n @refund_requests = RefundRequest.order 'created_at DESC'\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @refund_requests }\n end\n end",
"def sync_refunds(event)\n payment_method = event.payment_method\n stripe_payment_intent_id = event.data.object.payment_intent\n\n RefundsSynchronizer\n .new(payment_method)\n .call(stripe_payment_intent_id)\n end",
"def create\n @refund_request = RefundRequest.new(params[:refund_request])\n\n respond_to do |format|\n if @refund_request.save\n NoticeMailer.refund_request_email(@refund_request).deliver\n format.html { redirect_to root_path, notice: 'Solicitud de devolución correctamente ingresada.' }\n format.json { render json: @refund_request, status: :created, location: @refund_request }\n else\n format.html { render action: \"new\" }\n format.json { render json: @refund_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def perform_refund\n # make the SOAP API call\n response = Docdata.client.call(:refund, xml: refund_xml)\n response_object = Docdata::Response.parse(:refund, response)\n if response_object.success?\n return true\n else\n return false\n end\n end",
"def create_refund_with_http_info(location_id, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: V1TransactionsApi.create_refund ...\"\n end\n # verify the required parameter 'location_id' is set\n fail ArgumentError, \"Missing the required parameter 'location_id' when calling V1TransactionsApi.create_refund\" if location_id.nil?\n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling V1TransactionsApi.create_refund\" if body.nil?\n # resource path\n local_var_path = \"/v1/{location_id}/refunds\".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s)\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'V1Refund')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: V1TransactionsApi#create_refund\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def set_refund\n @refund = @current_event.refunds.find(params[:id])\n authorize @refund\n end",
"def handle_refund\n if saved_change_to_state == %w(purchased refunded)\n refund = self.build_refund({\n payment_id: payment_id,\n state: :pending,\n })\n refund.save!\n seller.decrease_balance(payment.amount)\n end \n end",
"def post_payinrefunds(payin_id, amount, currency, opts = {})\n data, _status_code, _headers = post_payinrefunds_with_http_info(payin_id, amount, currency, opts)\n data\n end",
"def create_refund_with_http_info(location_id, transaction_id, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TransactionsApi.create_refund ...\"\n end\n # verify the required parameter 'location_id' is set\n fail ArgumentError, \"Missing the required parameter 'location_id' when calling TransactionsApi.create_refund\" if location_id.nil?\n # verify the required parameter 'transaction_id' is set\n fail ArgumentError, \"Missing the required parameter 'transaction_id' when calling TransactionsApi.create_refund\" if transaction_id.nil?\n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling TransactionsApi.create_refund\" if body.nil?\n # resource path\n local_var_path = \"/v2/locations/{location_id}/transactions/{transaction_id}/refund\".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s).sub('{' + 'transaction_id' + '}', transaction_id.to_s)\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 header_params['Square-Version'] = \"2018-07-12\"\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'CreateRefundResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionsApi#create_refund\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def refund token, payload={}\n payload.merge! :namespace => 'refund', :token => token\n invoke :put, payload\n end",
"def create_financial_transaction_refund_deposit\n if self.sum_deposit_available_for_refund > 0\n financial_transaction = {\n transaction_type: 'payin_refund',\n purpose: 'deposit',\n amount: self.sum_deposit_available_for_refund,\n fees: 0,\n src_type: :src_payin_vid,\n src_vid: self.financial_transactions.payin.finished.take.transaction_vid\n }\n t = self.financial_transactions.create( financial_transaction )\n\n # FIXME(RA): should be triggered from a job:\n t.process!\n else\n LOG.error \"Not possible to refund a negative value.\"\n end\n end",
"def refund(merchant_access_token)\n Requests::RefundOrder.new(merchant_access_token: merchant_access_token).\n send_to_api(:post, endpoint_path + '/refund')\n end",
"def show\n @refund = Refund.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @refund }\n end\n end",
"def show\n @refund = Refund.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @refund }\n end\n end",
"def refund(\n amazon_capture_id,\n refund_reference_id,\n amount,\n currency_code: @currency_code,\n seller_refund_note: nil,\n soft_descriptor: nil,\n provider_credit_reversal_details: nil,\n merchant_id: @merchant_id,\n mws_auth_token: nil\n )\n\n parameters = {\n 'Action' => 'Refund',\n 'SellerId' => merchant_id,\n 'AmazonCaptureId' => amazon_capture_id,\n 'RefundReferenceId' => refund_reference_id,\n 'RefundAmount.Amount' => amount,\n 'RefundAmount.CurrencyCode' => currency_code\n }\n\n optional = {\n 'SellerRefundNote' => seller_refund_note,\n 'SoftDescriptor' => soft_descriptor,\n 'MWSAuthToken' => mws_auth_token\n }\n\n optional.merge!(set_provider_credit_reversal_details(provider_credit_reversal_details)) if provider_credit_reversal_details\n\n operation(parameters, optional)\n end",
"def refund_a_payment_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PaymentsApi.refund_a_payment ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling PaymentsApi.refund_a_payment\"\n end\n pattern = Regexp.new(/^(pay)_(\\w{26})$/)\n if @api_client.config.client_side_validation && id !~ pattern\n fail ArgumentError, \"invalid value for 'id' when calling PaymentsApi.refund_a_payment, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/payments/{id}/refunds'.sub('{' + 'id' + '}', CGI.escape(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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'Cko-Idempotency-Key'] = opts[:'cko_idempotency_key'] if !opts[:'cko_idempotency_key'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'refund_request'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'RefundAcceptedResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['ApiSecretKey']\n\n new_options = opts.merge(\n :operation => :\"PaymentsApi.refund_a_payment\",\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: PaymentsApi#refund_a_payment\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def refund(transaction_id, caller_reference, options = {})\n submit Refund.new(options.merge(:transaction_id => transaction_id, :caller_reference => caller_reference))\n end",
"def destroy\n order = Order.find(params[:id])\n response = order.refund\n if response['status'] == 'failed'\n flash[:notice] = 'Refund failed. Please try again shortly'\n else\n flash[:notice] = 'You have successfully refunded this order.'\n end\n respond_to do |format|\n format.html {redirect_to restaurant_orders_restaurant_order_index_path}\n format.json {render json: response}\n end\n end",
"def generate_refund(transaction, amount = nil, options = {})\n raise ArgumentError, \"Invalid transaction state: #{transaction.state}\" if transaction.state != \"completed\"\n raise ArgumentError, \"Transaction is not belongs to the order\" if transaction.order != self\n\n refunds.create(options.merge(amount: amount || transaction.amount, transaction: transaction))\n\n cancel if state != 'wait_refund'\n\n true\n end",
"def post_payinrefunds_with_http_info(payin_id, amount, currency, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PayinrefundApi.post_payinrefunds ...'\n end\n # verify the required parameter 'payin_id' is set\n if @api_client.config.client_side_validation && payin_id.nil?\n fail ArgumentError, \"Missing the required parameter 'payin_id' when calling PayinrefundApi.post_payinrefunds\"\n end\n # verify the required parameter 'amount' is set\n if @api_client.config.client_side_validation && amount.nil?\n fail ArgumentError, \"Missing the required parameter 'amount' when calling PayinrefundApi.post_payinrefunds\"\n end\n # verify the required parameter 'currency' is set\n if @api_client.config.client_side_validation && currency.nil?\n fail ArgumentError, \"Missing the required parameter 'currency' when calling PayinrefundApi.post_payinrefunds\"\n end\n # resource path\n local_var_path = '/payinrefunds'\n\n # query parameters\n query_params = {}\n query_params[:'payinId'] = payin_id\n query_params[:'amount'] = amount\n query_params[:'currency'] = currency\n query_params[:'accessSignature'] = opts[:'access_signature'] if !opts[:'access_signature'].nil?\n query_params[:'accessTag'] = opts[:'access_tag'] if !opts[:'access_tag'].nil?\n query_params[:'accessUserId'] = opts[:'access_user_id'] if !opts[:'access_user_id'].nil?\n query_params[:'accessUserIp'] = opts[:'access_user_ip'] if !opts[:'access_user_ip'].nil?\n query_params[:'payinrefundTag'] = opts[:'payinrefund_tag'] if !opts[:'payinrefund_tag'].nil?\n query_params[:'comment'] = opts[:'comment'] if !opts[:'comment'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(: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 => 'InlineResponse20018')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PayinrefundApi#post_payinrefunds\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def seed_refund_types\n\tdata = ActiveSupport::JSON.decode(File.read('db/seeds/refund_types.json'))\n\tdata.each do |d|\n\t\tRefundType.create!(d)\n\tend\nend",
"def list_refunds_with_http_info(location_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: V1TransactionsApi.list_refunds ...\"\n end\n # verify the required parameter 'location_id' is set\n fail ArgumentError, \"Missing the required parameter 'location_id' when calling V1TransactionsApi.list_refunds\" if location_id.nil?\n if opts[:'order'] && !['ASC', 'DESC'].include?(opts[:'order'])\n fail ArgumentError, 'invalid value for \"order\", must be one of ASC, DESC'\n end\n if !opts[:'limit'].nil? && opts[:'limit'] > 200\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling V1TransactionsApi.list_refunds, must be smaller than or equal to 200.'\n end\n\n # resource path\n local_var_path = \"/v1/{location_id}/refunds\".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n query_params[:'begin_time'] = opts[:'begin_time'] if !opts[:'begin_time'].nil?\n query_params[:'end_time'] = opts[:'end_time'] if !opts[:'end_time'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'batch_token'] = opts[:'batch_token'] if !opts[:'batch_token'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n \n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<V1Refund>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: V1TransactionsApi#list_refunds\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def refund(original_reference:, amount:, reference:, merchantAccount: @merchant_account, currency: @currency)\n postJSON(\"/Payment/v12/refund\",\n reference: reference,\n merchantAccount: merchant_account,\n modificationAmount: { value: amount, currency: currency },\n originalReference: original_reference\n )\n end",
"def list_refunds_with_http_info(location_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TransactionsApi.list_refunds ...\"\n end\n # verify the required parameter 'location_id' is set\n fail ArgumentError, \"Missing the required parameter 'location_id' when calling TransactionsApi.list_refunds\" if location_id.nil?\n if opts[:'sort_order'] && !['DESC', 'ASC'].include?(opts[:'sort_order'])\n fail ArgumentError, 'invalid value for \"sort_order\", must be one of DESC, ASC'\n end\n # resource path\n local_var_path = \"/v2/locations/{location_id}/refunds\".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'begin_time'] = opts[:'begin_time'] if !opts[:'begin_time'].nil?\n query_params[:'end_time'] = opts[:'end_time'] if !opts[:'end_time'].nil?\n query_params[:'sort_order'] = opts[:'sort_order'] if !opts[:'sort_order'].nil?\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n \n header_params['Square-Version'] = \"2018-07-12\"\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ListRefundsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionsApi#list_refunds\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def new\n @carbontaxrefund = Carbontaxrefund.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @carbontaxrefund }\n end\n end",
"def refund transaction\n transaction = Transaction.new transaction\n order_id = transaction.order_id.to_i\n transaction_id = transaction.transaction_id\n transaction_params = ActiveSupport::OrderedHash.new\n transaction_params['amount'] = transaction.amount.to_s\n transaction_params['currency'] = transaction.currency\n transaction_params['reference'] = transaction.reference.to_s\n params = ActiveSupport::OrderedHash.new\n params['apiOperation'] = 'REFUND'\n params['transaction'] = transaction_params\n\n request :put, \"/merchant/#{merchant_id}/order/#{order_id}/transaction/#{transaction_id}\", params\n end",
"def test_failed_refund\n response = @gateway.refund(@amount, '')\n assert_failure response\n assert_equal 'PaymentDealer.DoCreateRefundRequest.OtherTrxCodeOrVirtualPosOrderIdMustGiven', response.message\n end",
"def refund_transaction\n data = full_params.merge(\n 'x_trans_id' => transaction_id,\n 'x_type' => \"REFUND\"\n )\n\n astro_curl(@validator_url, data)\n end",
"def refund_by_payment_log(payment_log_id)\n params = {\n payment_log_id: payment_log_id,\n }\n @client.make_request(:post, 'referral_customers/refunds', EasyPost::Models::EasyPostObject, params, 'beta')\n end",
"def test_refund_partial\n assert refund = @gateway.refund(555, '9999999999') # $5.55 in cents\n assert_success refund\n end",
"def post_v2_refund_by_order_with_http_info(order_uuid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OrderApi.post_v2_refund_by_order ...'\n end\n # verify the required parameter 'order_uuid' is set\n if @api_client.config.client_side_validation && order_uuid.nil?\n fail ArgumentError, \"Missing the required parameter 'order_uuid' when calling OrderApi.post_v2_refund_by_order\"\n end\n # resource path\n local_var_path = '/order/{order_uuid}/refund'.sub('{' + 'order_uuid' + '}', order_uuid.to_s)\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n 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[:'body'])\n\n return_type = opts[:return_type] || 'InlineResponse2006'\n\n auth_names = opts[:auth_names] || ['Bearer']\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 => return_type)\n\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrderApi#post_v2_refund_by_order\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def destroy\n @carbontaxrefund = Carbontaxrefund.find(params[:id])\n @carbontaxrefund.destroy\n\n respond_to do |format|\n format.html { redirect_to carbontaxrefunds_url }\n format.json { head :no_content }\n end\n end",
"def update\n @refund_request = RefundRequest.find(params[:id])\n\n respond_to do |format|\n if @refund_request.update_attributes(params[:refund_request])\n format.html { redirect_to @refund_request, notice: 'Refund request was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @refund_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_failed_refund\n response = @gateway.refund(@amount, @invalid_txn)\n assert_failure response\n assert_equal 'Txn not found', response.message\n end",
"def set_finalize_refund\n status == REFUND_REQUESTED && update(status: REFUND_FINALIZED)\n end",
"def refund_transaction_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PaymentsTransactionsApi.refund_transaction ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling PaymentsTransactionsApi.refund_transaction\"\n end\n # resource path\n local_var_path = \"/transactions/{id}/refunds\".sub('{' + 'id' + '}', id.to_s)\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[:'request'])\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 => 'RefundResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PaymentsTransactionsApi#refund_transaction\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_refund(location_id, body, opts = {})\n data, _status_code, _headers = create_refund_with_http_info(location_id, body, opts)\n return data\n end",
"def test_failed_refund\n response = @gateway.refund(@amount, 'thisisnotavalidtrasactionid')\n assert_failure response\n assert_equal 'Error(s)- code:3407, message:The settlement referred to by the transaction response ID you provided cannot be found.', response.message\n end",
"def show\n @refund_request = RefundRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @refund_request }\n end\n end",
"def create\n @fund = Fund.new(fund_params)\n\n if @fund.save\n render json: @fund, status: :created, location: @fund\n else\n render json: @fund.errors, status: :unprocessable_entity\n end\n end",
"def create_refund(location_id, transaction_id, body, opts = {})\n data, _status_code, _headers = create_refund_with_http_info(location_id, transaction_id, body, opts)\n return data\n end",
"def refund(money, reference, options = {})\n standard_response\n end",
"def new\n add_breadcrumb \"Tramanta\", :bazar_path\n add_breadcrumb \"Solicitud de devolución\", :new_refund_request_path\n \n @refund_request = RefundRequest.new\n @user_id = current_user.id\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @refund_request }\n end\n end",
"def test_seed_refund_no_adj\n data = {}\n data[:name] = 'Jean-Baptiste Poquelin'\n data[:external_key] = 'jeanpoquelin'\n data[:email] = 'jeanpoquelin@kb.com'\n data[:currency] = 'EUR'\n data[:time_zone] = 'Europe/Paris'\n data[:address1] = '17, rue Saint-Honore'\n data[:address2] = nil\n data[:postal_code] = '75000'\n data[:company] = nil\n data[:city] = 'Paris'\n data[:state] = 'Region Parisienne'\n data[:country] = 'France'\n data[:locale] = 'fr_FR'\n\n @jeanpoquelin = create_account_with_data(@user, data, @options)\n add_payment_method(@jeanpoquelin.account_id, '__EXTERNAL_PAYMENT__', true, nil, @user, @options)\n\n base1 = create_entitlement_base(@jeanpoquelin.account_id, 'reserved-metal', 'MONTHLY', 'DEFAULT', @user, @options)\n wait_for_expected_clause(1, @jeanpoquelin, @options, &@proc_account_invoices_nb)\n\n # Second invoice\n kb_clock_add_days(31, nil, @options) # 2015-09-01\n wait_for_expected_clause(2, @jeanpoquelin, @options, &@proc_account_invoices_nb)\n\n kb_clock_add_days(1, nil, @options) # 2015-09-02\n\n base1.cancel(@user, nil, nil, nil, 'IMMEDIATE', 'END_OF_TERM', nil, @options)\n\n payments = get_payments_for_account(@jeanpoquelin.account_id, @options)\n\n refund(payments[1].payment_id, payments[1].purchased_amount, nil, @user, @options)\n end",
"def partial_refund!(admin, certificate_ids_to_refund)\n raise \"Must be captured or partially refunded to partially refund\" unless captured? || partially_refunded?\n sync_voucher_status_with_third_party! if has_vouchers_generated_by_third_party?\n\n certificate_ids_to_refund = certificate_ids_to_refund.map(&:to_s).uniq\n certs_to_refund = daily_deal_certificates.reject(&:refunded?).select do |cert|\n certificate_ids_to_refund.include?(cert.id.to_s)\n end\n \n unless certs_to_refund.present?\n raise \"None of the requested certificates could be refunded\"\n end\n \n unless certs_to_refund.size.multiple_of?(certificates_to_generate_per_unit_quantity)\n raise \"number of vouchers to refund (#{certs_to_refund.size}) must be a multiple of certificates_to_generate_per_unit_quantity (#{certificates_to_generate_per_unit_quantity}), \" +\n \"but is not\"\n end\n \n total_amount_to_refund = calculate_total_partial_refund_amount(certs_to_refund)\n daily_deal_payment.partial_refund!(admin, total_amount_to_refund) if daily_deal_payment\n certs_to_refund.each do | cert |\n cert.refund!\n end\n send_third_party_voucher_change_notification_as_needed!\n { :number_of_certs_refunded => certs_to_refund.size, :amount_refunded => total_amount_to_refund }\n end",
"def refund(sbp_request, opts = {})\n data, status_code, headers = refund_with_http_info(sbp_request, opts)\n return data\n end",
"def get_payinrefunds_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PayinrefundApi.get_payinrefunds ...'\n end\n # resource path\n local_var_path = '/payinrefunds'\n\n # query parameters\n query_params = {}\n query_params[:'accessSignature'] = opts[:'access_signature'] if !opts[:'access_signature'].nil?\n query_params[:'accessTag'] = opts[:'access_tag'] if !opts[:'access_tag'].nil?\n query_params[:'accessUserId'] = opts[:'access_user_id'] if !opts[:'access_user_id'].nil?\n query_params[:'accessUserIp'] = opts[:'access_user_ip'] if !opts[:'access_user_ip'].nil?\n query_params[:'payinId'] = opts[:'payin_id'] if !opts[:'payin_id'].nil?\n query_params[:'payinrefundId'] = opts[:'payinrefund_id'] if !opts[:'payinrefund_id'].nil?\n query_params[:'payinrefundTag'] = opts[:'payinrefund_tag'] if !opts[:'payinrefund_tag'].nil?\n query_params[:'payinrefundStatus'] = opts[:'payinrefund_status'] if !opts[:'payinrefund_status'].nil?\n query_params[:'walletId'] = opts[:'wallet_id'] if !opts[:'wallet_id'].nil?\n query_params[:'payinrefundDate'] = opts[:'payinrefund_date'] if !opts[:'payinrefund_date'].nil?\n query_params[:'userId'] = opts[:'user_id'] if !opts[:'user_id'].nil?\n query_params[:'amount'] = opts[:'amount'] if !opts[:'amount'].nil?\n query_params[:'currency'] = opts[:'currency'] if !opts[:'currency'].nil?\n query_params[:'pageNumber'] = opts[:'page_number'] if !opts[:'page_number'].nil?\n query_params[:'pageCount'] = opts[:'page_count'] if !opts[:'page_count'].nil?\n query_params[:'sortBy'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n query_params[:'sortOrder'] = opts[:'sort_order'] if !opts[:'sort_order'].nil?\n query_params[:'createdDateFrom'] = opts[:'created_date_from'] if !opts[:'created_date_from'].nil?\n query_params[:'createdDateTo'] = opts[:'created_date_to'] if !opts[:'created_date_to'].nil?\n query_params[:'updatedDateFrom'] = opts[:'updated_date_from'] if !opts[:'updated_date_from'].nil?\n query_params[:'updatedDateTo'] = opts[:'updated_date_to'] if !opts[:'updated_date_to'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20018')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PayinrefundApi#get_payinrefunds\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def refund(money, authorization ,options={})\n post = {\n amount: money\n }\n\n add_reference(post, authorization)\n commit(:refund, post)\n end",
"def order_refund_with_http_info(id, order_refund_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OrdersApi.order_refund ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling OrdersApi.order_refund\"\n end\n # verify the required parameter 'order_refund_request' is set\n if @api_client.config.client_side_validation && order_refund_request.nil?\n fail ArgumentError, \"Missing the required parameter 'order_refund_request' when calling OrdersApi.order_refund\"\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/orders/{id}/refunds'.sub('{' + 'id' + '}', CGI.escape(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/vnd.conekta-v2.1.0+json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(order_refund_request)\n\n # return_type\n return_type = opts[:debug_return_type] || 'OrderResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"OrdersApi.order_refund\",\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: OrdersApi#order_refund\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @refund = Refund.find(params[:id])\n \n respond_to do |format|\n format.html { render :action => \"show\"}\n format.xml { render :xml => @refund }\n end\n end"
] | [
"0.7411639",
"0.72928524",
"0.72220093",
"0.7139806",
"0.70534503",
"0.6982286",
"0.69706225",
"0.6958251",
"0.6841389",
"0.6834011",
"0.6833234",
"0.68022853",
"0.68022853",
"0.677015",
"0.66018367",
"0.6594192",
"0.65577936",
"0.6523444",
"0.65152913",
"0.65089875",
"0.65089875",
"0.64964473",
"0.6489313",
"0.64726526",
"0.6439458",
"0.6430373",
"0.6423734",
"0.642322",
"0.6412631",
"0.6396021",
"0.6363616",
"0.63634527",
"0.6360312",
"0.63543844",
"0.6343752",
"0.63300437",
"0.63256973",
"0.63240606",
"0.63211715",
"0.6305276",
"0.62657607",
"0.6260086",
"0.6231108",
"0.62138927",
"0.62005436",
"0.6133405",
"0.6119347",
"0.6111318",
"0.610953",
"0.61010605",
"0.607899",
"0.6047373",
"0.60456985",
"0.6038976",
"0.60038656",
"0.59850717",
"0.5953146",
"0.5950837",
"0.59181213",
"0.590886",
"0.5900861",
"0.58600163",
"0.58311075",
"0.58311075",
"0.5807716",
"0.57771015",
"0.57721514",
"0.5729569",
"0.5718146",
"0.57163376",
"0.571393",
"0.5660112",
"0.5649134",
"0.56438655",
"0.56350696",
"0.56329095",
"0.5628946",
"0.5617028",
"0.56013536",
"0.5600277",
"0.55934",
"0.5577034",
"0.55698675",
"0.55311424",
"0.5524138",
"0.55209714",
"0.5506459",
"0.5497965",
"0.5485726",
"0.54766953",
"0.5465",
"0.5461084",
"0.54597425",
"0.54380643",
"0.54046196",
"0.5359451",
"0.535448",
"0.5352182",
"0.5350224",
"0.5347851"
] | 0.7141533 | 3 |
PUT /refunds/1 PUT /refunds/1.json | def update
@refund = Refund.find(params[:id])
respond_to do |format|
if @refund.update_attributes(params[:refund])
format.html { redirect_to @refund, notice: 'Refund was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @refund.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @refund = Refund.find(params[:id])\n\n respond_to do |format|\n if @refund.update_attributes(params[:refund])\n format.html { redirect_to @refund, notice: 'Refund was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @refund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def refund!\n path = self.class.endpoint.gsub(':id', id.to_s) + '/refund'\n client.api_post(path)\n end",
"def refund(refund); end",
"def update\n @refund_request = RefundRequest.find(params[:id])\n\n respond_to do |format|\n if @refund_request.update_attributes(params[:refund_request])\n format.html { redirect_to @refund_request, notice: 'Refund request was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @refund_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @refund = Refund.find(params[:id])\n @refund.destroy\n\n respond_to do |format|\n format.html { redirect_to refunds_url }\n format.json { head :ok }\n end\n end",
"def refund *args\n warn_on_positional args\n\n options = args.last.is_a?(Hash) ? args.pop : {}\n amount = args[0] || options.fetch(:amount) { nil }\n description = args[1] || options.fetch(:description) { nil }\n\n refund = Refund.new(\n :uri => self.refunds_uri,\n :debit_uri => self.uri,\n :amount => amount,\n :description => description,\n )\n refund.save\n end",
"def refund(params)\n request(Resources::RESOURCE_REFUND, HTTP_METHOD_POST, params)\n end",
"def create\n @refund = Refund.new(params[:refund])\n\n respond_to do |format|\n if @refund.save\n format.html { redirect_to @refund, notice: 'Refund was successfully created.' }\n format.json { render json: @refund, status: :created, location: @refund }\n else\n format.html { render action: \"new\" }\n format.json { render json: @refund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_refund\n @refund = @current_event.refunds.find(params[:id])\n authorize @refund\n end",
"def destroy\n @refund = Refund.find(params[:id])\n @refund.destroy\n\n respond_to do |format|\n format.html { redirect_to refunds_url }\n format.json { head :no_content }\n end\n end",
"def request_refund\n body = { action: \"refund\", key: @@access_key, gen_task_id: @task_id }\n post_request(body)\n end",
"def refund(amount: nil)\n api_request(\"/charges/#{id}/refund\", :post, amount: amount)\n end",
"def refund amount=nil, description=nil\n refund = Refund.new(\n :uri => self.refunds_uri,\n :debit_uri => self.uri,\n :amount => amount,\n :description => description,\n )\n refund.save\n end",
"def refund(tid, refund)\n begin\n #creating url\n url = \"#{@security.environment}/transactions/#{tid}/refunds\"\n\n # make the request.\n json_response = Rede::CommonRequest::post(url, refund, @security)\n\n # mapping the result.\n response = Rede::RefundResponse.map(json_response)\n\n rescue Exception => e\n response = Rede::RefundResponse.new(:return_code => Rede::ReturnCode::UNSUCCESSFUL, :return_message => e.message)\n end\n\n return response\n end",
"def request_refund(options = {})\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/request_refund\", options).body)\n @attributes = response['items']\n true\n end",
"def request_refund(options = {})\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/request_refund\", options).body)\n @attributes = response['items']\n true\n end",
"def update\n @carbontaxrefund = Carbontaxrefund.find(params[:id])\n\n respond_to do |format|\n if @carbontaxrefund.update_attributes(params[:carbontaxrefund])\n format.html { redirect_to @carbontaxrefund, notice: 'Carbontaxrefund was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @carbontaxrefund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def refund(params = {})\n req = WebPay::ChargeRequestRefund.create(params)\n raw_response = @client._request(:post, 'charges' + '/' + req.id.to_s + '/' + 'refund', req)\n WebPay::ChargeResponse.new(raw_response)\n end",
"def refund token, payload={}\n payload.merge! :namespace => 'refund', :token => token\n invoke :put, payload\n end",
"def refunds\n RefundRepository.new(api).all(token)\n end",
"def create\n @refund = Refund.new(params[:refund])\n\n respond_to do |format|\n if @refund.save\n format.html { redirect_to @refund, notice: 'El rembolso ha sido almacenado' }\n format.json { render json: @refund, status: :created, location: @refund }\n else\n format.html { render action: \"new\" }\n format.json { render json: @refund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def stripe_refund\n return unless charge_id.present?\n Reservation.transaction do\n charge = Stripe::Charge.retrieve(charge_id)\n charge.refunds.create(amount: charge.amount, reverse_transfer: true)\n update_attributes(refunded: true, is_paid: false, billing_phase: :not_billed, charge_id: nil)\n end\n rescue Exception => e\n custom_params = { reservation_id: id, charge_id: charge_id, amount: charge.amount }\n Rollbar.error(e, 'Stripe refund failed', custom_params)\n end",
"def destroy\n @refund_request = RefundRequest.find(params[:id])\n @refund_request.destroy\n\n respond_to do |format|\n format.html { redirect_to refund_requests_url }\n format.json { head :ok }\n end\n end",
"def refund(unique_id)\n request('payment/refund', {:refund => {:unique_id => unique_id}})\n end",
"def refunds_create_with_http_info(token, order_id, refund_reason, cents, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RefundsApi.refunds_create ...\"\n end\n # verify the required parameter 'token' is set\n if @api_client.config.client_side_validation && token.nil?\n fail ArgumentError, \"Missing the required parameter 'token' when calling RefundsApi.refunds_create\"\n end\n # verify the required parameter 'order_id' is set\n if @api_client.config.client_side_validation && order_id.nil?\n fail ArgumentError, \"Missing the required parameter 'order_id' when calling RefundsApi.refunds_create\"\n end\n # verify the required parameter 'refund_reason' is set\n if @api_client.config.client_side_validation && refund_reason.nil?\n fail ArgumentError, \"Missing the required parameter 'refund_reason' when calling RefundsApi.refunds_create\"\n end\n # verify the required parameter 'cents' is set\n if @api_client.config.client_side_validation && cents.nil?\n fail ArgumentError, \"Missing the required parameter 'cents' when calling RefundsApi.refunds_create\"\n end\n # resource path\n local_var_path = \"/api/v1/orders/{order_id}/refunds\".sub('{' + 'order_id' + '}', order_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'token'] = token\n\n # header parameters\n header_params = {}\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n form_params[\"refund_reason\"] = refund_reason\n form_params[\"cents\"] = cents\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 => 'RefundResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RefundsApi#refunds_create\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def refund amount, capture_id, options={}\n options[:capture_id] = capture_id if capture_id\n\n if amount\n options[:amount] = assert_currency options[:currency], amount\n end\n\n response = flow_instance.refunds.post @flow_organization, options\n\n if response.try(:id)\n Response.new true, 'Flow refund - Success', { response: response }\n else\n Response.new false, 'Flow refund - Error', { response: response }\n end\n rescue Io::Flow::V0::HttpClient::ServerError => exception\n error_response exception\n end",
"def refund(item_refund)\n item_refund.save!\n remaining_refund_amount = item_refund.total\n refund_payments = payments(item_refund)\n refund_payments.each do |payment|\n next if remaining_refund_amount <= 0\n amount_to_refund = calculate_amount_to_refund(payment, remaining_refund_amount)\n remaining_refund_amount -= amount_to_refund\n\n create_refund(item_refund, payment, amount_to_refund)\n end\n end",
"def do \n validate\n ZipMoney.api.refund(@params)\n end",
"def update!(**args)\n @invoice_id = args[:invoice_id] if args.key?(:invoice_id)\n @refund_state = args[:refund_state] if args.key?(:refund_state)\n end",
"def refund\n request = Remit::Refund::Request.new(transaction_id: transaction_id, caller_reference: caller_reference)\n response = remit.refund request\n response.errors.empty?\n end",
"def refund!(amnt = nil)\n RefundRepository.new(api).create(token, amnt)\n end",
"def refund( trans_id, amount_in_cents )\n resp = client.refund(\n token: payment.token,\n trans_id: trans_id,\n amount: amount_in_cents.to_i.abs\n ).body\n\n user.refunds.create!(\n amount_in_cents: amount_in_cents,\n description: \"Refund value\",\n metadata: resp.as_json\n )\n rescue BridgePay::ResponseError => ex\n raise RefundFailure.new( ex.response )\n end",
"def create\n @refund = Refund.new(refund_params)\n\n respond_to do |format|\n if @refund.save\n format.html do\n redirect_to(\n seller_product_purchases_path(@seller, @product),\n notice: 'Refund was successfully created.'\n )\n end\n format.json { render :show, status: :created, location: @refund }\n else\n format.html { render :new }\n format.json { render json: @refund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def refund_order\n Stripe.api_key = ENV['STRIPE_SECRET_KEY']\n order = Commit.find(params[:order_id])\n charge = Stripe::Charge.retrieve(order.sale.stripe_charge_id, :stripe_account => order.product.wholesaler.stripe_id)\n begin\n refund = charge.refunds.create(:amount => charge.amount, :refund_application_fee => true)\n rescue => e\n return render :json => {\n success: false,\n error: e.message\n }\n end\n if !refund.nil?\n order.refunded = true\n order.sale_made = false\n product_sales = order.product.current_sales.to_f\n new_sales = order.full_price ? product_sales+order.amount.to_f*order.product.price.to_f : product_sales+order.amount.to_f*order.product.discount.to_f\n order.product.current_sales = new_sales\n order.save(validate: false)\n return render :json => {\n success: true,\n order: order,\n charge: charge,\n refund: refund\n }\n end\n end",
"def refund(id, params = {}, options = {})\n response = request(:post, resource_path(\"captures/#{id}/refund\"), params, options)\n FatZebra::Paypal::Refund.initialize_from(response)\n end",
"def refund_params\n params.require(:refund).permit(:credit_base, :credit_fee, :customer_id, :gateway, fields: {})\n end",
"def refund_with_http_info(sbp_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: VApi#refund ...\"\n end\n \n # verify the required parameter 'sbp_request' is set\n fail \"Missing the required parameter 'sbp_request' when calling refund\" if sbp_request.nil?\n \n # resource path\n path = \"/v1/transaction/refund\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'application/xml']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json', 'application/xml']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(sbp_request)\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SbpResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VApi#refund\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def new\n @refund = Refund.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @refund }\n end\n end",
"def new\n @refund = Refund.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @refund }\n end\n end",
"def refund_order\n\t\t@order = Order.find(params[:order_id])\n\n\t\tif @order.refunded\n\t\t\trender :json => { :error => \"Order has already been refunded\" }\n\t\telse \n\t\t\tcharge = Stripe::Charge.retrieve(order.charge_id)\n\t\t\trefund = charge.refunds.create\n\t\t\trender :json => { :refunded => true, :refund_id => refund.id, :message => \"Order refunded successfully\" }\n\t\tend\n\n\tend",
"def refresh_refund\n\t\t\n\t\tif self.refund && self.payment_status.nil?\n\t\t\t\n\t\t\talready_accepted_refunds = self.class.where(:refund => true, :payment_status => 1, :updated_at => { :$gte => self.created_at})\n\t\t\t\n\t\t\tif already_accepted_refunds.size > 0\n\t\t\t\t\n\t\t\t\tself.refund_failed\n\t\t\tend\n\t\tend\n\tend",
"def show\n @refund = Refund.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @refund }\n end\n end",
"def show\n @refund = Refund.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @refund }\n end\n end",
"def decline_refund\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/decline_refund\").body)\n @attributes = response['items']\n true\n end",
"def refund_by_amount(amount)\n params = {\n refund_amount: amount,\n }\n @client.make_request(:post, 'referral_customers/refunds', EasyPost::Models::EasyPostObject, params, 'beta')\n # noinspection RubyMismatchedReturnType\n end",
"def sync_refunds(event)\n payment_method = event.payment_method\n stripe_payment_intent_id = event.data.object.payment_intent\n\n RefundsSynchronizer\n .new(payment_method)\n .call(stripe_payment_intent_id)\n end",
"def refund\n @order.refund_payment\n render 'status'\n end",
"def add_refunds\n @proposal.refunds.each do |bank_account, amount|\n run_task \"add_refunds_#{bank_account}\" do\n if transfer = add_bank_transfer(bank_account, @export.receivables_account, amount)\n current_state[:transfer_id] = transfer['BankTransferID']\n end\n end\n end\n end",
"def gateway_refund\n resource.direct_refund\n respond_to do |format|\n format.html do\n return redirect_to admin_contributions_path(params[:local_params])\n end\n format.json do\n return render json: []\n end\n end\n end",
"def refund_params\n params.require(:refund).permit(\n Refund.attribute_names.map(&:to_sym)\n )\n end",
"def refund(\n amazon_capture_id,\n refund_reference_id,\n amount,\n currency_code: @currency_code,\n seller_refund_note: nil,\n soft_descriptor: nil,\n provider_credit_reversal_details: nil,\n merchant_id: @merchant_id,\n mws_auth_token: nil\n )\n\n parameters = {\n 'Action' => 'Refund',\n 'SellerId' => merchant_id,\n 'AmazonCaptureId' => amazon_capture_id,\n 'RefundReferenceId' => refund_reference_id,\n 'RefundAmount.Amount' => amount,\n 'RefundAmount.CurrencyCode' => currency_code\n }\n\n optional = {\n 'SellerRefundNote' => seller_refund_note,\n 'SoftDescriptor' => soft_descriptor,\n 'MWSAuthToken' => mws_auth_token\n }\n\n optional.merge!(set_provider_credit_reversal_details(provider_credit_reversal_details)) if provider_credit_reversal_details\n\n operation(parameters, optional)\n end",
"def refund transaction\n transaction = Transaction.new transaction\n order_id = transaction.order_id.to_i\n transaction_id = transaction.transaction_id\n transaction_params = ActiveSupport::OrderedHash.new\n transaction_params['amount'] = transaction.amount.to_s\n transaction_params['currency'] = transaction.currency\n transaction_params['reference'] = transaction.reference.to_s\n params = ActiveSupport::OrderedHash.new\n params['apiOperation'] = 'REFUND'\n params['transaction'] = transaction_params\n\n request :put, \"/merchant/#{merchant_id}/order/#{order_id}/transaction/#{transaction_id}\", params\n end",
"def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @refunds }\n end\n end",
"def destroy\n @carbontaxrefund = Carbontaxrefund.find(params[:id])\n @carbontaxrefund.destroy\n\n respond_to do |format|\n format.html { redirect_to carbontaxrefunds_url }\n format.json { head :no_content }\n end\n end",
"def create_refund_with_http_info(location_id, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: V1TransactionsApi.create_refund ...\"\n end\n # verify the required parameter 'location_id' is set\n fail ArgumentError, \"Missing the required parameter 'location_id' when calling V1TransactionsApi.create_refund\" if location_id.nil?\n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling V1TransactionsApi.create_refund\" if body.nil?\n # resource path\n local_var_path = \"/v1/{location_id}/refunds\".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s)\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'V1Refund')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: V1TransactionsApi#create_refund\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @refund_request = RefundRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @refund_request }\n end\n end",
"def create_refund_with_http_info(location_id, transaction_id, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TransactionsApi.create_refund ...\"\n end\n # verify the required parameter 'location_id' is set\n fail ArgumentError, \"Missing the required parameter 'location_id' when calling TransactionsApi.create_refund\" if location_id.nil?\n # verify the required parameter 'transaction_id' is set\n fail ArgumentError, \"Missing the required parameter 'transaction_id' when calling TransactionsApi.create_refund\" if transaction_id.nil?\n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling TransactionsApi.create_refund\" if body.nil?\n # resource path\n local_var_path = \"/v2/locations/{location_id}/transactions/{transaction_id}/refund\".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s).sub('{' + 'transaction_id' + '}', transaction_id.to_s)\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 header_params['Square-Version'] = \"2018-07-12\"\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'CreateRefundResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionsApi#create_refund\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def refund(money, reference, options = {})\n standard_response\n end",
"def refund(original_reference:, amount:, reference:, merchantAccount: @merchant_account, currency: @currency)\n postJSON(\"/Payment/v12/refund\",\n reference: reference,\n merchantAccount: merchant_account,\n modificationAmount: { value: amount, currency: currency },\n originalReference: original_reference\n )\n end",
"def create_issue_refund\n @error = \"\"\n if params[:refund_amount].present?\n if params[:refund_amount].to_d > 0.0 && params[:refund_amount].to_d <= @trans.amount\n @refund_trans = Transaction.new(\n amount: params[:refund_amount].to_d, \n transaction_type: \"Payment\",\n status: \"Refunded\",\n from_account_id: current_user.account.id,\n to_account_id: @trans.from_account.id,\n transaction_from: \"User\",\n transaction_to: \"User\",\n kaenko_currency_id: @trans.kaenko_currency_id,\n status: \"Completed\" , \n user_id: current_user.id,\n transaction_from_id: current_user.id,\n transaction_to_id: @trans.transaction_from_id,\n parent_id: @trans.id\n \n )\n Transaction.transaction do\n if @refund_trans.save\n @account_balance = current_user.account.account_balances.where(\n \"kaenko_currency_id = ?\",\n @trans.kaenko_currency_id\n ).first\n @account_balance.update_attributes(balance: @account_balance.balance - params[:refund_amount].to_d)\n @trans.update_attributes(status: \"Refunded\")\n end\n end\n else\n @error = \"Please enter valid amount.\" \n end\n else\n @error = \"Please enter amount.\"\n end\n end",
"def show\n @refund = Refund.find(params[:id])\n \n respond_to do |format|\n format.html { render :action => \"show\"}\n format.xml { render :xml => @refund }\n end\n end",
"def update\n [:amount, :refund_amount].each do |a|\n next unless params[:payment].has_key?(a)\n params[:payment][a].gsub!(/[$,]/, \"\")\n params[:payment][a] = (params[:payment][a].to_f * 100).to_i\n end\n\n respond_to do |format|\n if @payment.update(payment_params)\n format.html { redirect_to :payments, notice: \"Payment was successfully updated.\" }\n format.json { render :show, status: :ok, location: @payment }\n else\n @editable = true\n format.html { render :show }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def refund(transaction_id, caller_reference, options = {})\n submit Refund.new(options.merge(:transaction_id => transaction_id, :caller_reference => caller_reference))\n end",
"def test_successful_refund\n assert response = @gateway.purchase(@amount, @credit_card, @options)\n assert_successful_response(response)\n\n assert response = @gateway.refund(@amount, response.authorization)\n assert_successful_response(response)\n end",
"def update\n orig = CardTransaction.find(params[:id])\n debug 'orig loaded'\n trans = orig.clone\n debug 'orig cloned'\n trans.amount = params[:card_transaction][:amount]\n trans.save\n debug 'trans saved'\n debug \"transaction: #{trans.inspect}\"\n stat = do_refund(orig, trans)\n debug stat.inspect\n if transaction['respstat'] == 'A' && trans.receiptData?\n redirect_to payment_receipt_url(trans.id)\n else\n redirect_to payments_url # the list of payments\n end\n rescue\n redirect_to payments_url # the list of payments\n end",
"def refund_a_payment_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PaymentsApi.refund_a_payment ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling PaymentsApi.refund_a_payment\"\n end\n pattern = Regexp.new(/^(pay)_(\\w{26})$/)\n if @api_client.config.client_side_validation && id !~ pattern\n fail ArgumentError, \"invalid value for 'id' when calling PaymentsApi.refund_a_payment, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/payments/{id}/refunds'.sub('{' + 'id' + '}', CGI.escape(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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'Cko-Idempotency-Key'] = opts[:'cko_idempotency_key'] if !opts[:'cko_idempotency_key'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'refund_request'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'RefundAcceptedResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['ApiSecretKey']\n\n new_options = opts.merge(\n :operation => :\"PaymentsApi.refund_a_payment\",\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: PaymentsApi#refund_a_payment\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def handle_refund\n if saved_change_to_state == %w(purchased refunded)\n refund = self.build_refund({\n payment_id: payment_id,\n state: :pending,\n })\n refund.save!\n seller.decrease_balance(payment.amount)\n end \n end",
"def refund!\n if charged && !canceled\n transaction = Stripe::Charge.retrieve(trans_id)\n if transaction.refund\n update updated: true, canceled: true\n else\n raise result.errors\n end\n end\n end",
"def destroy\n order = Order.find(params[:id])\n response = order.refund\n if response['status'] == 'failed'\n flash[:notice] = 'Refund failed. Please try again shortly'\n else\n flash[:notice] = 'You have successfully refunded this order.'\n end\n respond_to do |format|\n format.html {redirect_to restaurant_orders_restaurant_order_index_path}\n format.json {render json: response}\n end\n end",
"def set_RefundID(value)\n set_input(\"RefundID\", value)\n end",
"def process_refund\n express_token ?\n EXPRESS_PAYPAL_GATEWAY.refund(nil, capture_authorization) :\n STANDARD_PAYPAL_GATEWAY.refund(nil, capture_authorization)\n end",
"def update\n respond_to do |format|\n if @api_v1_reward.update(api_v1_reward_params)\n format.html { redirect_to @api_v1_reward, notice: 'Reward was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_reward }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_reward.errors, status: :unprocessable_entity }\n end\n end\n end",
"def perform_refund\n # make the SOAP API call\n response = Docdata.client.call(:refund, xml: refund_xml)\n response_object = Docdata::Response.parse(:refund, response)\n if response_object.success?\n return true\n else\n return false\n end\n end",
"def set_finalize_refund\n status == REFUND_REQUESTED && update(status: REFUND_FINALIZED)\n end",
"def refund(money, authorization ,options={})\n post = {\n amount: money\n }\n\n add_reference(post, authorization)\n commit(:refund, post)\n end",
"def create\n @refund = Refund.new(params[:refund])\n @queued_coupon_refunds = Coupon.find(session[:queued_coupon_refunds])\n \n # create wtd credits\n if @refund.credit_amount > 0\n @credit = Credit.new\n @credit.promotion_code_id = PromotionCode::REFUND_CREDIT\n @credit.value = @refund.credit_amount\n @credit.user_id = @refund.purchase.user.id\n @credit.save\n @refund.credit_id = @credit.id\n end\n \n \n # connect with authorize.net\n @connect = true\n \n if @connect\n # mark coupons as refunded\n @queued_coupon_refunds.each do |coupon|\n coupon.refunded = true\n coupon.save\n end\n \n # clear session\n session[:queued_coupon_refunds] = []\n end\n \n if @refund.save\n flash[:notice] = 'Refund was successfully saved.'\n redirect_to(admin_refund_path(@refund))\n else\n render :action => \"new\"\n end\n end",
"def test_refund_partial\n assert refund = @gateway.refund(555, '9999999999') # $5.55 in cents\n assert_success refund\n end",
"def refund_transaction\n data = full_params.merge(\n 'x_trans_id' => transaction_id,\n 'x_type' => \"REFUND\"\n )\n\n astro_curl(@validator_url, data)\n end",
"def refund(amount, trans_id = nil)\n params = {\n :command => :r,\n :trans_id => trans_id,\n :amount => amount\n }\n requires!(params, :command, :trans_id, :amount)\n commit(params)\n end",
"def create_refund_mile_payment(body)\r\n # Prepare query url.\r\n _path_url = '/v2/ecommerce/payments/actions/refund'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'content-type' => 'application/json; charset=utf-8'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n headers: _headers,\r\n parameters: body.to_json\r\n )\r\n OAuth2.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n Response.from_hash(decoded)\r\n end",
"def refunds_refund_put_with_http_info(transactionid, parameters, authorization, psu_ip_address, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RefundsApi.refunds_refund_put ...'\n end\n # verify the required parameter 'transactionid' is set\n if @api_client.config.client_side_validation && transactionid.nil?\n fail ArgumentError, \"Missing the required parameter 'transactionid' when calling RefundsApi.refunds_refund_put\"\n end\n # verify the required parameter 'parameters' is set\n if @api_client.config.client_side_validation && parameters.nil?\n fail ArgumentError, \"Missing the required parameter 'parameters' when calling RefundsApi.refunds_refund_put\"\n end\n # verify the required parameter 'authorization' is set\n if @api_client.config.client_side_validation && authorization.nil?\n fail ArgumentError, \"Missing the required parameter 'authorization' when calling RefundsApi.refunds_refund_put\"\n end\n # verify the required parameter 'psu_ip_address' is set\n if @api_client.config.client_side_validation && psu_ip_address.nil?\n fail ArgumentError, \"Missing the required parameter 'psu_ip_address' when calling RefundsApi.refunds_refund_put\"\n end\n # resource path\n local_var_path = '/v2/refund/{transactionid}'.sub('{' + 'transactionid' + '}', transactionid.to_s)\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 header_params[:'Authorization'] = authorization\n header_params[:'PSU-IP-Address'] = psu_ip_address\n header_params[:'PSU-Accept-Language'] = opts[:'psu_accept_language'] if !opts[:'psu_accept_language'].nil?\n header_params[:'PSU-User-Agent'] = opts[:'psu_user_agent'] if !opts[:'psu_user_agent'].nil?\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(parameters)\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'RefundMoneyInOutput')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RefundsApi#refunds_refund_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n @breadcrumb = 'update'\n @insurance = Insurance.find(params[:id])\n @insurance.updated_by = current_user.id if !current_user.nil?\n \n respond_to do |format|\n if @insurance.update_attributes(params[:insurance])\n format.html { redirect_to @insurance,\n notice: (crud_notice('updated', @insurance) + \"#{undo_link(@insurance)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @insurance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @refund_requests = RefundRequest.order 'created_at DESC'\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @refund_requests }\n end\n end",
"def credit(credit_cents, payment_id, options)\n order_number = options[:originator].try(:payment).try(:order).try(:number)\n MollieLogger.debug(\"Starting refund for order #{order_number}\")\n\n begin\n amount = credit_cents / 100.0\n Mollie::Payment::Refund.create(\n payment_id: payment_id,\n amount: amount,\n description: \"Refund Spree Order ID: #{order_number}\",\n api_key: get_preference(:api_key)\n )\n MollieLogger.debug(\"Successfully refunded #{amount} for order #{order_number}\")\n ActiveMerchant::Billing::Response.new(true, 'Refund successful')\n rescue Mollie::Exception => e\n MollieLogger.debug(\"Refund failed for order #{order_number}: #{e.message}\")\n ActiveMerchant::Billing::Response.new(false, 'Refund unsuccessful')\n end\n end",
"def set_RefundType(value)\n set_input(\"RefundType\", value)\n end",
"def update\n\n params[:refill_type] = params[:refill_type].to_i\n params[:status] = params[:status].to_i\n params[:cost_basis] = params[:cost_basis].to_i\n params[:other_coverage_code] = params[:other_coverage_code].to_i\n params[:reason_for_delay] = params[:reason_for_delay].to_i\n params[:partial_fill_status] = params[:partial_fill_status].to_i\n params[:reported_to_pmp] = params[:reported_to_pmp].to_i\n\n respond_to do |format|\n if @dispense.update(dispense_params)\n format.html { redirect_to @dispense, notice: 'Dispense was successfully updated.' }\n format.json { render :show, status: :ok, location: @dispense }\n else\n format.html { render :edit }\n format.json { render json: @dispense.errors, status: :unprocessable_entity }\n end\n end\n end",
"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",
"def refund_transaction_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PaymentsTransactionsApi.refund_transaction ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling PaymentsTransactionsApi.refund_transaction\"\n end\n # resource path\n local_var_path = \"/transactions/{id}/refunds\".sub('{' + 'id' + '}', id.to_s)\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[:'request'])\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 => 'RefundResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PaymentsTransactionsApi#refund_transaction\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def list_refunds_with_http_info(location_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TransactionsApi.list_refunds ...\"\n end\n # verify the required parameter 'location_id' is set\n fail ArgumentError, \"Missing the required parameter 'location_id' when calling TransactionsApi.list_refunds\" if location_id.nil?\n if opts[:'sort_order'] && !['DESC', 'ASC'].include?(opts[:'sort_order'])\n fail ArgumentError, 'invalid value for \"sort_order\", must be one of DESC, ASC'\n end\n # resource path\n local_var_path = \"/v2/locations/{location_id}/refunds\".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'begin_time'] = opts[:'begin_time'] if !opts[:'begin_time'].nil?\n query_params[:'end_time'] = opts[:'end_time'] if !opts[:'end_time'].nil?\n query_params[:'sort_order'] = opts[:'sort_order'] if !opts[:'sort_order'].nil?\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n \n header_params['Square-Version'] = \"2018-07-12\"\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ListRefundsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionsApi#list_refunds\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n budgets = update_budgets(params[:budgets])\n\n render json: budgets, status: :ok\n end",
"def update\n @fault_book = FaultBook.find(params[:id])\n\n respond_to do |format|\n if @fault_book.update_attributes(params[:fault_book])\n format.html { redirect_to @fault_book, notice: 'Fault book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fault_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def refund(money, identification, options = {})\n form = {}\n add_txn_id(form, identification)\n add_test_mode(form, options)\n commit(:refund, money, form)\n end",
"def show\n @refund = Refund.find(params[:id])\n authorize @refund\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @refund }\n end\n end",
"def update\n @revenue = Revenue.find(params[:id])\n\n if @revenue.update(params[:revenue])\n head :no_content\n else\n render json: @revenue.errors, status: :unprocessable_entity\n end\n end",
"def list_refunds_with_http_info(location_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: V1TransactionsApi.list_refunds ...\"\n end\n # verify the required parameter 'location_id' is set\n fail ArgumentError, \"Missing the required parameter 'location_id' when calling V1TransactionsApi.list_refunds\" if location_id.nil?\n if opts[:'order'] && !['ASC', 'DESC'].include?(opts[:'order'])\n fail ArgumentError, 'invalid value for \"order\", must be one of ASC, DESC'\n end\n if !opts[:'limit'].nil? && opts[:'limit'] > 200\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling V1TransactionsApi.list_refunds, must be smaller than or equal to 200.'\n end\n\n # resource path\n local_var_path = \"/v1/{location_id}/refunds\".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n query_params[:'begin_time'] = opts[:'begin_time'] if !opts[:'begin_time'].nil?\n query_params[:'end_time'] = opts[:'end_time'] if !opts[:'end_time'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'batch_token'] = opts[:'batch_token'] if !opts[:'batch_token'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n \n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<V1Refund>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: V1TransactionsApi#list_refunds\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n @rum = Rum.find(params[:id])\n\n respond_to do |format|\n if @rum.update_attributes(params[:rum])\n format.html { redirect_to @rum, notice: 'Rum was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @reward = Reward.find(params[:id])\n\n respond_to do |format|\n if @reward.update_attributes(params[:reward])\n flash[:notice] = 'Reward was successfully updated.'\n format.html { redirect_to calendar_configurations_path(params[:calendar_id]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @reward.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @invoice = Invoice.find(params[:id])\n @invoice.year = Date.today.year\n\n @invoice.client_id = params[:clients]\n @invoice.discount_id = params[:discount_id]\n @invoice.tax_id = params[:tax_id]\n\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n format.html { redirect_to @invoice, notice: 'Invoice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_v2_refund_by_order_with_http_info(order_uuid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OrderApi.post_v2_refund_by_order ...'\n end\n # verify the required parameter 'order_uuid' is set\n if @api_client.config.client_side_validation && order_uuid.nil?\n fail ArgumentError, \"Missing the required parameter 'order_uuid' when calling OrderApi.post_v2_refund_by_order\"\n end\n # resource path\n local_var_path = '/order/{order_uuid}/refund'.sub('{' + 'order_uuid' + '}', order_uuid.to_s)\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n 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[:'body'])\n\n return_type = opts[:return_type] || 'InlineResponse2006'\n\n auth_names = opts[:auth_names] || ['Bearer']\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 => return_type)\n\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrderApi#post_v2_refund_by_order\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n respond_to do |format|\n if @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"
] | [
"0.75930625",
"0.7290829",
"0.70791286",
"0.70637393",
"0.6838148",
"0.68328863",
"0.68274236",
"0.6785931",
"0.6768365",
"0.6754151",
"0.6727216",
"0.6710479",
"0.66524756",
"0.662985",
"0.65941256",
"0.65941256",
"0.6587663",
"0.6534057",
"0.65168035",
"0.65012044",
"0.64698064",
"0.64084816",
"0.6404122",
"0.6380492",
"0.636183",
"0.6357749",
"0.63442975",
"0.63159823",
"0.63087183",
"0.6295655",
"0.62946826",
"0.6270428",
"0.627003",
"0.6250573",
"0.6242893",
"0.6220789",
"0.6209883",
"0.6170938",
"0.6170938",
"0.6165969",
"0.6142032",
"0.61300707",
"0.61300707",
"0.60966283",
"0.6079288",
"0.6069728",
"0.6061798",
"0.60261285",
"0.6000968",
"0.5983041",
"0.59155035",
"0.59150696",
"0.5898421",
"0.58643883",
"0.5862958",
"0.5839804",
"0.5832157",
"0.5812738",
"0.58108395",
"0.579539",
"0.5789231",
"0.57701975",
"0.5740069",
"0.5736794",
"0.5732779",
"0.5729023",
"0.572587",
"0.57173276",
"0.5713901",
"0.56911564",
"0.566108",
"0.5657887",
"0.5592024",
"0.55901206",
"0.55783564",
"0.5568465",
"0.55546993",
"0.55351067",
"0.553222",
"0.55249155",
"0.5520491",
"0.5508183",
"0.5493904",
"0.5479255",
"0.547049",
"0.5466833",
"0.5461625",
"0.5458131",
"0.54549056",
"0.54392",
"0.54310495",
"0.5427652",
"0.54226327",
"0.540781",
"0.53879714",
"0.538779",
"0.5381696",
"0.53734946",
"0.53690267",
"0.53646135"
] | 0.75599337 | 1 |
DELETE /refunds/1 DELETE /refunds/1.json | def destroy
@refund = Refund.find(params[:id])
@refund.destroy
respond_to do |format|
format.html { redirect_to refunds_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @refund = Refund.find(params[:id])\n @refund.destroy\n\n respond_to do |format|\n format.html { redirect_to refunds_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @refund_request = RefundRequest.find(params[:id])\n @refund_request.destroy\n\n respond_to do |format|\n format.html { redirect_to refund_requests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @carbontaxrefund = Carbontaxrefund.find(params[:id])\n @carbontaxrefund.destroy\n\n respond_to do |format|\n format.html { redirect_to carbontaxrefunds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n order = Order.find(params[:id])\n response = order.refund\n if response['status'] == 'failed'\n flash[:notice] = 'Refund failed. Please try again shortly'\n else\n flash[:notice] = 'You have successfully refunded this order.'\n end\n respond_to do |format|\n format.html {redirect_to restaurant_orders_restaurant_order_index_path}\n format.json {render json: response}\n end\n end",
"def refund!\n path = self.class.endpoint.gsub(':id', id.to_s) + '/refund'\n client.api_post(path)\n end",
"def destroy\n @api_v1_reward.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_rewards_url, notice: 'Reward was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recharge.destroy\n respond_to do |format|\n format.html { redirect_to recharges_url }\n format.json { head :no_content }\n end\n end",
"def refund(params = {})\n req = WebPay::ChargeRequestRefund.create(params)\n raw_response = @client._request(:post, 'charges' + '/' + req.id.to_s + '/' + 'refund', req)\n WebPay::ChargeResponse.new(raw_response)\n end",
"def refund(params)\n request(Resources::RESOURCE_REFUND, HTTP_METHOD_POST, params)\n end",
"def refund(refund); end",
"def refund(unique_id)\n request('payment/refund', {:refund => {:unique_id => unique_id}})\n end",
"def refund(amount: nil)\n api_request(\"/charges/#{id}/refund\", :post, amount: amount)\n end",
"def destroy\n @barrels_income.destroy\n respond_to do |format|\n format.html { redirect_to barrels_incomes_url }\n format.json { head :no_content }\n end\n end",
"def refunds\n RefundRepository.new(api).all(token)\n end",
"def destroy\n #binding.pry\n @balance = Balance.find(params[:id])\n @balance.destroy\n respond_to do |format|\n format.html { redirect_to balances_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bustour.destroy\n respond_to do |format|\n format.html { redirect_to bustours_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fund.destroy\n respond_to do |format|\n format.html { redirect_to funds_url, notice: 'Fund was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fund.destroy\n respond_to do |format|\n format.html { redirect_to funds_url, notice: 'Fund was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @budget = Budget.find(params[:id])\n @budget.destroy\n\n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @repurchase = Repurchase.find(params[:id])\n @repurchase.destroy\n\n respond_to do |format|\n format.html { redirect_to repurchases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @financial = Financial.find(params[:id])\n @financial.destroy\n\n respond_to do |format|\n format.html { redirect_to financials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rum = Rum.find(params[:id])\n @rum.destroy\n\n respond_to do |format|\n format.html { redirect_to rums_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flat = Flat.find(params[:id])\n @flat.destroy\n\n respond_to do |format|\n format.html { redirect_to flats_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @invoice_status = InvoiceStatus.find(params[:id])\n @invoice_status.destroy\n\n respond_to do |format|\n format.html { redirect_to invoice_statuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @referral = Referral.find(params[:id])\n @referral.destroy\n\n respond_to do |format|\n format.html { redirect_to referrals_url }\n format.json { head :no_content }\n end\n end",
"def decline_refund\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/decline_refund\").body)\n @attributes = response['items']\n true\n end",
"def destroy\n @budget = Budget.find(params[:id])\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flat = Flat.find(params[:id])\n @flat.destroy\n\n respond_to do |format|\n format.html { redirect_to flats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flat = Flat.find(params[:id])\n @flat.destroy\n\n respond_to do |format|\n format.html { redirect_to flats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @finance = Finance.find(params[:id])\n @finance.destroy\n\n respond_to do |format|\n format.html { redirect_to finances_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inquiry.destroy\n respond_to do |format|\n format.html { redirect_to inquiries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flat.destroy\n\n respond_to do |format|\n format.html { redirect_to flats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bank_reconciliations = AccountingBankReconciliations.find(params[:id])\n @bank_reconciliations.destroy\n\n respond_to do |format|\n format.html { redirect_to(accounting_bank_reconciliations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invoice.destroy\n\n Receipt.destroy_all(invoice_id: @invoice)\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Excluido com sucesso.' }\n sweetalert_success('Dados excluidos com sucesso!', 'Sucesso!', useRejections: false)\n format.json { head :no_content }\n end\n end",
"def destroy\n @discount = Discount.find(params[:id])\n @discount.destroy\n\n respond_to do |format|\n format.html { redirect_to discounts_url }\n format.json { head :no_content }\n end\n end",
"def refund(tid, refund)\n begin\n #creating url\n url = \"#{@security.environment}/transactions/#{tid}/refunds\"\n\n # make the request.\n json_response = Rede::CommonRequest::post(url, refund, @security)\n\n # mapping the result.\n response = Rede::RefundResponse.map(json_response)\n\n rescue Exception => e\n response = Rede::RefundResponse.new(:return_code => Rede::ReturnCode::UNSUCCESSFUL, :return_message => e.message)\n end\n\n return response\n end",
"def destroy\n @budget.destroy\n\n respond_to do |format|\n format.html { redirect_to budgets_url, notice: 'Budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @income = Income.find(params[:id])\n @income.destroy\n\n respond_to do |format|\n format.html { redirect_to incomes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hit = Hit.find(params[:id])\n @hit.reactions.destroy_all\n @hit.destroy\n\n respond_to do |format|\n format.html { redirect_to hits_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @much_withdraw.destroy\n respond_to do |format|\n format.html { redirect_to much_withdraws_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reward.destroy\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Reward was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url, notice: 'Budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url, notice: 'Budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url, notice: 'Budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url, notice: \"Budget was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @correlation = Correlation.find(params[:id])\n @correlation.destroy\n\n respond_to do |format|\n format.html { redirect_to correlations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @withdraw.destroy\n respond_to do |format|\n format.html { redirect_to withdraws_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @taxirequest = Taxirequest.find(params[:id])\n @taxirequest.destroy\n\n respond_to do |format|\n format.html { redirect_to taxirequests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Uw factuur is verwijderd.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @consensu = Consensu.find(params[:id])\n @consensu.destroy\n\n respond_to do |format|\n format.html { redirect_to consensus_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @damage = Damage.find(params[:id])\n @damage.destroy\n\n respond_to do |format|\n format.html { redirect_to damages_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @invoice=Invoice.find(params[:id])\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @insurance_query = InsuranceQuery.find(params[:id])\n @insurance_query.destroy\n\n respond_to do |format|\n format.html { redirect_to insurance_queries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trust_fund = TrustFund.find(params[:id])\n @trust_fund.destroy\n\n respond_to do |format|\n format.html { redirect_to trust_funds_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @observance.destroy\n respond_to do |format|\n format.html { redirect_to observances_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @dinosaur = Dinosaur.find(params[:id])\n @dinosaur.destroy\n\n respond_to do |format|\n format.html { redirect_to dinosaurs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @resturant.destroy\n respond_to do |format|\n format.html { redirect_to resturants_url, notice: 'Resturant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reimbursement = Reimbursement.find(params[:id])\n @reimbursement.destroy\n\n respond_to do |format|\n format.html { redirect_to reimbursements_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reimbursement = Reimbursement.find(params[:id])\n @reimbursement.destroy\n\n respond_to do |format|\n format.html { redirect_to reimbursements_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reimbursement = Reimbursement.find(params[:id])\n @reimbursement.destroy\n\n respond_to do |format|\n format.html { redirect_to reimbursements_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @discount = Discount.find(params[:id])\n @discount.destroy\n\n respond_to do |format|\n format.html { redirect_to administration_discounts_url }\n format.json { head :no_content }\n end\n end",
"def destroy_rest\n @entry_instrument = EntryInstrument.find(params[:id])\n @entry_instrument.destroy\n\n respond_to do |format|\n format.html { redirect_to(entry_instruments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @admin_fund = Fund.find(params[:id])\n @admin_fund.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_funds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @burger = Burger.find(params[:id])\n @burger.destroy\n\n respond_to do |format|\n format.html { redirect_to(burgers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @remainder = Remainder.find(params[:id])\n @remainder.update_attributes(quantity: 0)\n # @remainder.destroy\n \n respond_to do |format|\n format.html { redirect_to remainders_url, notice: t(:remainder_destroyed) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stundent = Stundent.find(params[:id])\n @stundent.destroy\n\n respond_to do |format|\n format.html { redirect_to stundents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoicedetail = Invoicedetail.find(params[:id])\n @invoicedetail.destroy\n\n respond_to do |format|\n format.html { redirect_to invoicedetails_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @incomestock = Incomestock.find(params[:id])\n @incomestock.destroy\n\n respond_to do |format|\n format.html { redirect_to incomestocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @referee = Referee.find(params[:id])\n @referee.destroy\n\n respond_to do |format|\n format.html { redirect_to referees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Devis supprime.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ledger.destroy\n respond_to do |format|\n format.html { redirect_to ledgers_url, notice: 'Ledger was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ledger.destroy\n respond_to do |format|\n format.html { redirect_to ledgers_url, notice: 'Ledger was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @referent.destroy\n respond_to do |format|\n format.html { redirect_to referents_url(:id => params[:refId]), notice: 'Referent was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock_transfer = StockTransfer.find(params[:id])\n @stock_transfer.destroy\n\n respond_to do |format|\n format.html { redirect_to stock_transfers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @roof = Roof.find(params[:roof_id])\n @status = @roof.statuses.find(params[:id])\n @status.destroy\n\n respond_to do |format|\n format.html { redirect_to statuseses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n record = InvoiceLineItem.find(params[:id])\n record.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @reconciliation_detail = AccountingReconciliationDetail.find(params[:id])\n @reconciliation_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to(accounting_reconciliation_details_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invoice_tax = InvoiceTax.find(params[:id])\n @invoice_tax.destroy\n\n respond_to do |format|\n format.html { redirect_to invoice_taxes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rush = Rush.find(params[:id])\n @rush.destroy\n\n respond_to do |format|\n format.html { redirect_to rushes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @charge = Charge.find(params[:id])\n @charge.destroy\n\n respond_to do |format|\n format.html { redirect_to charges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @insurance = Insurance.find(params[:id])\n\n respond_to do |format|\n if @insurance.destroy\n format.html { redirect_to insurances_url,\n notice: (crud_notice('destroyed', @insurance) + \"#{undo_link(@insurance)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to insurances_url, alert: \"#{@insurance.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @insurance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @insurance_coverage.destroy\n respond_to do |format|\n format.html { redirect_to insurance_coverages_url, notice: 'Insurance coverage was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fundraiser = Fundraiser.find(params[:id])\n @fundraiser.destroy\n\n respond_to do |format|\n format.html { redirect_to fundraisers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @journal_debit.destroy\n respond_to do |format|\n format.html { redirect_to journal_debits_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trump.destroy\n respond_to do |format|\n format.html { redirect_to trumps_url, notice: 'Trump was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @referral_charge = ReferralCharge.find(params[:id])\n @referral_charge.destroy\n\n respond_to do |format|\n format.html { redirect_to(referral_charges_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n if params[:id] =~ /\\d+/\n @budget = Budget.find(params[:id])\n ActiveRecord::Base.connection.execute(\"delete from budget_products where budget_id = #{params[:id]}\")\n @budget.destroy\n end\n \n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def destroy\n @cobertura.destroy\n respond_to do |format|\n format.html { redirect_to coberturas_url, notice: 'Cobertura was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def refund amount, capture_id, options={}\n options[:capture_id] = capture_id if capture_id\n\n if amount\n options[:amount] = assert_currency options[:currency], amount\n end\n\n response = flow_instance.refunds.post @flow_organization, options\n\n if response.try(:id)\n Response.new true, 'Flow refund - Success', { response: response }\n else\n Response.new false, 'Flow refund - Error', { response: response }\n end\n rescue Io::Flow::V0::HttpClient::ServerError => exception\n error_response exception\n end",
"def destroy\n @tax_rate = TaxRate.find(params[:id])\n @tax_rate.destroy\n\n respond_to do |format|\n format.html { redirect_to tax_rates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @burrito.destroy\n respond_to do |format|\n format.html { redirect_to burritos_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.81669515",
"0.79900545",
"0.7478539",
"0.7146553",
"0.6928762",
"0.6753174",
"0.6579645",
"0.65783507",
"0.65673065",
"0.65597016",
"0.65315986",
"0.65289164",
"0.64688873",
"0.646832",
"0.6432849",
"0.640182",
"0.6395198",
"0.6395198",
"0.6393717",
"0.63912356",
"0.63837403",
"0.6383488",
"0.63823223",
"0.63763356",
"0.63738644",
"0.63697654",
"0.63683593",
"0.63683456",
"0.6366089",
"0.6361573",
"0.6361573",
"0.6360385",
"0.63583773",
"0.6358312",
"0.6352526",
"0.6352526",
"0.6352526",
"0.6352526",
"0.6334483",
"0.6322081",
"0.63217956",
"0.6319829",
"0.6319063",
"0.6312923",
"0.6309625",
"0.630694",
"0.62964225",
"0.6294743",
"0.6294743",
"0.6294743",
"0.6293528",
"0.62906766",
"0.62833226",
"0.62777174",
"0.6276616",
"0.62761843",
"0.62743074",
"0.6273148",
"0.62711716",
"0.62689835",
"0.6268946",
"0.6261866",
"0.62607145",
"0.62579787",
"0.625044",
"0.62471056",
"0.62471056",
"0.62471056",
"0.62456626",
"0.6244637",
"0.62382245",
"0.62382233",
"0.62381434",
"0.6232772",
"0.6230506",
"0.62274915",
"0.62271494",
"0.62266856",
"0.62197924",
"0.62197924",
"0.62189156",
"0.62172747",
"0.62134755",
"0.62115586",
"0.62084323",
"0.6208113",
"0.6203924",
"0.6203824",
"0.6201054",
"0.6200678",
"0.6200384",
"0.62001836",
"0.6192699",
"0.6186017",
"0.6185018",
"0.6184882",
"0.61843616",
"0.61834335",
"0.6180623",
"0.6179569"
] | 0.8130104 | 1 |
Creates a new Command object. message The message/command to be sent to the server. Example: hello = Command.new( "hello" ) client.send( hello ) or client.send( Command.new( "info" ) ) | def initialize( message )
@message = message
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_command(message)\n message = Message.new(params)\n @command = begin\n \"#{message.command.capitalize}Command\".constantize.new(message)\n rescue\n HelpCommand.new(message)\n end\n end",
"def init_message(message)\n command = command_factory.instance.build(message)\n command.respond(self)\n end",
"def create_command(text)\n self.class.concrete_command.new(self, text)\n end",
"def send_command(command)\n @client.write \"#{command}\\r\\n\"\n end",
"def send(message)\n\n response = SendResponse.new\n\n if message.instance_of? BasicMessage\n response = send_basic_message(message)\n end\n\n if message.instance_of? BulkMessage\n response = send_bulk_message(message)\n end\n\n response\n\n end",
"def initialize command\n @command = command\n end",
"def matrix_command(message)\n pfx = @cmd_prefix\n cmd = message.content[:body].split(/\\s+/)[0].gsub(/#{pfx}/, '')\n\n res = 'Invalid command'\n\n res = case cmd\n when 'listcommands'\n \"Currently available commands: #{@all_commands.keys.sort.join(', ')}\"\n when 'help'\n if message.content[:body].split(/\\s+/).count <= 1\n '!help: Get help for a specific command' \\\n \"\\nUsage: !help COMMAND\"\n else\n second_cmd = message.content[:body].split(/\\s+/)[1]\n .gsub(/#{pfx}/, '')\n @all_commands[second_cmd.strip].help_command(message)\n end\n end\n\n room = @client.ensure_room(message.room_id)\n room.send_notice(res)\n end",
"def start_command(message)\n user =\n TelegramUser.where(chat_id: message.chat.id).first_or_initialize\n user.chat_id = message.chat.id\n user.name = \"#{message.from.first_name} #{message.from.last_name}\"\n user.save!\n api_send_message(chat_id: message.chat.id,\n text: \"Hello #{message.from.first_name}\")\n end",
"def _send_command(command)\n # Create the console and get its id\n console = @client.call(\"console.create\")\n\n # Do an initial read / discard to pull out any info on the console\n # then write the command to the console\n @client.call(\"console.read\", console[\"id\"])\n @client.call(\"console.write\", console[\"id\"], \"#{command}\\n\")\n\n # Initial read\n output_string = \"\"\n output = @client.call(\"console.read\", console[\"id\"])\n output_string += \"#{output['data']}\"\n\n # Very very hacky. -- There should be a way to check\n # status of a call to make sure that it isn't in an error\n # state. For now, check the output for known error heuristics\n return output_string if output_string =~ /(\\[-\\]|Error)/\n\n # Read until finished\n while (!output.has_key?(\"result\")) do\n return unless output[\"busy\"]\n output_string += \"#{output['data']}\"\n output = @client.call(\"console.read\", console[\"id\"])\n return \"Error\" if output[\"result\"] == \"failure\"\n # A little bit of sleeping will prevent this infinite loop from\n # hogging up large portions of CPU time. It also adds load to the\n # msfrpc daemon as it will need to process these requests as wel..\n sleep 0.1\n end\n\n # Clean up console\n @client.call(\"console.destroy\", console[\"id\"])\n\n output_string\n end",
"def create_command command_text\r\n DatabaseCommand.new self, command_text\r\n end",
"def message(command, *args)\r\n if @software.include?(command)\r\n if args.size > 0\r\n self.send(command, *args)\r\n else\r\n self.send(command)\r\n end\r\n end \r\n end",
"def command command_string\n connection.command self.id, nil, command_string\n end",
"def cmd(command, *arguments) Command.send(command.to_sym, *arguments) end",
"def command cmd, help = \"\", &blk\n Bot::Commands.create self, cmd, help, &blk\n end",
"def create_message(data)\n message = Discordrb::Message.new(data, self)\n return message if message.from_bot? && !@should_parse_self\n return message if message.webhook? && !@attributes[:webhook_commands]\n\n unless message.author\n Discordrb::LOGGER.warn(\"Received a message (#{message.inspect}) with nil author! Ignoring, please report this if you can\")\n return\n end\n\n event = CommandEvent.new(message, self)\n\n chain = trigger?(message)\n return message unless chain\n\n # Don't allow spaces between the prefix and the command\n if chain.start_with?(' ') && !@attributes[:spaces_allowed]\n debug('Chain starts with a space')\n return message\n end\n\n if chain.strip.empty?\n debug('Chain is empty')\n return message\n end\n\n execute_chain(chain, event)\n\n # Return the message so it doesn't get parsed again during the rest of the dispatch handling\n message\n end",
"def directcommand(server,msg)\n tmp=nil\n if(msg[0]==\":\")\n tmp=Message.new(msg)\n else\n tmp=Message.new(\":* \"+msg)\n end\n \n case tmp.command\n when Event::RECV_CMND_QUIT,\n Event::RECV_CMND_PRIVMSG,Event::RECV_CMND_NOTICE\n @connector.write(server,msg,true)\n else\n @connector.write(server,msg)\n end\n end",
"def send(message)\n if message.length > 0\n # The client will return an empty string\n # on success, or it will return an error\n error = @client.transmit(message)\n if error.length > 0\n new_message(error)\n end\n end\n end",
"def new_message(message)\n if message == \"PING\"\n send(\"PONG\")\n else\n @messages << Message.new(message)\n redraw\n end\n end",
"def handle_command(message)\n text = period = tomorrow = subscribe = type = nil\n valid = false\n case message.text\n when CONST::COMMANDS[:lunch]\n valid = true\n period = :lunch\n when CONST::COMMANDS[:dinner]\n valid = true\n period = :dinner\n when CONST::COMMANDS[:tomorrow]\n valid = true\n tomorrow = true\n when CONST::COMMANDS[:next]\n valid = true\n when CONST::COMMANDS[:unsubscribe]\n valid = true\n subscribe = :destroy\n when CONST::COMMANDS[:subscribe]\n valid = true\n subscribe = :create\n when CONST::COMMANDS[:config]\n valid = true\n text = ''\n @bot.start_config message.from, message.chat\n when CONST::COMMANDS[:update]\n valid = true\n tag = @bandejao.update_pdf ? 'success' : 'error'\n text = CONST::TEXTS[:\"pdf_update_#{tag}\"]\n when CONST::COMMANDS[:feedback]\n valid = true\n text = send_feedback message\n when CONST::COMMANDS[:papoco]\n valid = true\n text = ''\n @bot.start_papoco message.chat\n else\n CONST::COMMANDS.each do |k, v|\n text = CONST::TEXTS[k] if v.match(message.text)\n end\n end\n if subscribe\n type = message.chat.type == 'private' ? :private : :group\n success = @bot.start_subscription subscribe, message\n text = CONST::SUBSCRIBE[subscribe][type][success]\n end\n tomorrow = CONST::COMMANDS[:tomorrow] =~ message.text\n unless valid\n text = '' unless message.chat.type == CONST::CHAT_TYPES[:private]\n end\n [text, period, tomorrow]\n end",
"def initialize(command)\n @command = command\n end",
"def message(server)\n Protocol::Query.new(db_name, Database::COMMAND, selector, options)\n end",
"def message(player, message)\n synchronize do\n return false unless player.admin? || player.chat_mod?\n\n command, args = message.split(\" \", 2)\n args = args.nil? ? [] : self.class.parse_args(args)\n\n # Admin-only commands\n admin_commands = lambda do\n case command\n when \"/adminify\" then cmd_adminify(player, args)\n when \"/set_mod\" then cmd_set_mod(player, args)\n else return false\n end\n\n true\n end\n\n # Regular commands.\n regular_commands = lambda do\n case command\n when \"/help\" then cmd_help(player, args)\n when \"/silence\" then cmd_silence(player, args)\n when \"/log\" then cmd_log(player)\n else return false\n end\n\n true\n end\n\n if player.admin?\n admin_commands.call || regular_commands.call\n else\n regular_commands.call\n end\n end\n end",
"def make_command(msg_id, extra)\r\n\t\t# Two opcodes, get handled differently..\r\n\t\tcase msg_id\r\n\t\twhen 0x30001\r\n\t\t\tdata = [0xf0f0f0f0,0x0004000b,0x0003001c].pack('VVV')\r\n\r\n\t\twhen 0x30002\r\n\t\t\tdata = [0xf0f0f0f1,0xffffffff,0,0x989680,0x00000002].pack('VVVVV')\r\n\r\n\t\tend\r\n\r\n\t\t# Put some data on...\r\n\t\tdata << extra\r\n\r\n\t\t# Pad it to 8 bytes...\r\n\t\tleft = data.length % 8\r\n\t\tdata << (\"\\x00\" * (8 - left)) if (left > 0)\r\n\r\n\t\t# Combine the pieces..\r\n\t\tpkt = [\r\n\t\t\t(data.length / 8) + 1, # chunkLen\r\n\t\t\tmsg_id # msg ID\r\n\t\t].pack('VV')\r\n\t\tpkt << data\r\n\r\n\t\tpkt\r\n\tend",
"def command(id)\n res = @client.get(\"#{path}/commands/#{id}\")\n\n M2X::Client::Command.new(@client, res.json) if res.success?\n end",
"def send_command( command )\n cmd = \"MESSAGET #{command.size}\\n#{command}\\n\"\n logger.debug( \">>> Sending cmd #{cmd.gsub( /\\n/, ' ' )}\" )\n \n out_socket.send( cmd , 0 )\n result = out_socket.recv(100)\n logger.debug( \"<<< Result ==> #{result}\" )\n result\n end",
"def communicate_command( *data )\n\t\t\t\tCommunicateCommand.new @interface, data\n\t\t\tend",
"def command(string)\n @request_id = rand(1000)\n @string1 = string\n @string2 = TRAILER\n @command_type = COMMAND_EXEC\n\n @packet_size = build_packet.length\n\n return self\n end",
"def send(message)\n\t\t\t@conn.send(message)\n\t\tend",
"def command(*a)\n command = Command.new(*a)\n command.node = self\n command\n end",
"def command\n @command ||= Class.new.send(:include, Command)\n end",
"def initialize(name, command)\r\n super(name)\r\n @command = command\r\n end",
"def produce( message )\n @client.set( @name, message )\n return ::Qup::Message.new( message.object_id, message )\n end",
"def command(command_text)\n @command_text = command_text\n end",
"def send_message message\n payload = { \"text\" => message }.to_json\n data = client.post \"#{api_prefix}/rooms/#{id}/chatMessages\", payload\n\n Message.new client, id, data\n end",
"def command(command)\n \n if ! @authed\n raise RCon::NetworkException.new(\"You must authenticate the connection successfully before sending commands.\")\n end\n\n @packet = RCon::Packet::Source.new\n @packet.command(command)\n\n @socket.print @packet.to_s\n rpacket = build_response_packet\n\n if rpacket.command_type != RCon::Packet::Source::RESPONSE_NORM\n raise RCon::NetworkException.new(\"error sending command: #{rpacket.command_type}\")\n end\n\n if @return_packets\n return rpacket\n else\n return rpacket.string1\n end\n end",
"def command(command)\n \n if ! @authed\n raise RCon::NetworkException.new(\"You must authenticate the connection successfully before sending commands.\")\n end\n\n @packet = RCon::Packet::Source.new\n @packet.command(command)\n\n @socket.print @packet.to_s\n rpacket = build_response_packet\n\n if rpacket.command_type != RCon::Packet::Source::RESPONSE_NORM\n raise RCon::NetworkException.new(\"error sending command: #{rpacket.command_type}\")\n end\n\n if @return_packets\n return rpacket\n else\n return rpacket.string1\n end\n end",
"def write_command( command, *args )\n\t\tdata = args.map( &:to_s ).join( \"\\0\" )\n\t\tmessage = [ command + \"\\n\", data.bytesize, data ].pack( COMMAND_TEMPLATE )\n\t\tself.log.debug \"Writing command %p to command server.\" % [ message ]\n\t\tself.writer.write( message )\n\tend",
"def send_message(message)\n check_parenthesis(message)\n puts \"Send: #{message}\" if @debug\n connection{|c| c.write(message)}\n end",
"def send_command(cmd, *args)\n Command.new(next_tag!, cmd, args).tap do |command|\n add_to_listener_pool(command)\n listen_for_tagged_response(command)\n send_command_object(command)\n end\n end",
"def initialize(message:)\n @message = message\n end",
"def send_command(command, *args)\n send_line([command.to_s, *args].join(' '))\n end",
"def send_command(command,args)\n puts \"Send Command #{command}: #{args}\"\n send_socket({command: command, args: args}.to_json)\n end",
"def send_message (*params)\n send_line Message.new(*params)\n end",
"def send(message)\n message\n end",
"def send_message(message)\n @networking.send_message(message)\n end",
"def send_command(command, *args)\n authenticate unless authenticated?\n send_line([\"#{command.to_s.upcase}\", *args].join(' '))\n end",
"def send(command)\n @hub.send_command(command)\n end",
"def send_message(message)\n @socket.send(message << \"\\n\", 0, nil, @client)\n end",
"def send(message)\n ## empty\n end",
"def send_msg(message, *args)\n # Fix in ruby osc gem\n args = args.map { |a|\n case a\n when true then 1\n when false then 0\n else\n a\n end\n }\n\n case message\n when Message, Bundle\n osc_client.send(message)\n else\n osc_client.send Message.new(message, *args)\n end\n\n self\n end",
"def post(command, *params)\n m = Message.new(nil, command, params.map {|s|\n if s\n #s.force_encoding(\"ASCII-8BIT\") if s.respond_to? :force_encoding\n #s.gsub(/\\r\\n|[\\r\\n]/, \" \")\n s.tr(\"\\r\\n\", \" \")\n else\n \"\"\n end\n })\n\n @log.debug \"SEND: #{m.to_s.chomp}\"\n @socket << m.to_s\n end",
"def sendmsg(message)\n text = message.respond_to?(:sendmsg) ? message.sendmsg : message.to_s\n message = \"sendmsg\\n%s\\n\" % text\n self.respond_to?(:send_data) ? send_data(message) : message\n end",
"def tell(command, params = {})\n msg_id = Random.new.rand(2**16)\n @connection.write({ method: command, params: params, id: msg_id }.to_json)\n end",
"def message; Message.new; end",
"def sendM(message)\n\t\t@conexion.puts(message)\t\n\tend",
"def send(**message)\n\t\t\t\t\tdata = dump(message)\n\t\t\t\t\t\n\t\t\t\t\tif data.bytesize > MAXIMUM_MESSAGE_SIZE\n\t\t\t\t\t\traise ArgumentError, \"Message length #{message.bytesize} exceeds #{MAXIMUM_MESSAGE_SIZE}: #{message.inspect}\"\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\tSync do\n\t\t\t\t\t\t@endpoint.connect do |peer|\n\t\t\t\t\t\t\tpeer.send(data)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend",
"def send_command cmd\n raise \"Must be a command object\" unless cmd.is_a? NEAT::Daemon::Command\n @amqp[:exchange].publish Oj.dump(cmd),\n routing_key: @amqp[:routing],\n correlation_id: cmd.call_id,\n reply_to: @amqp[:reply].name\n end",
"def publish(command, options)\n if command == 'request'\n options = {:uri => '', :method => 'GET', :source => ''}.merge(options)\n options[:content_type] = 'vnd.spotify/mercury-mget-request' if options[:payload].is_a?(Schema::Mercury::MercuryMultiGetRequest)\n payload = options.delete(:payload)\n\n # Generate arguments for the request\n args = [\n METHODS[options[:method]] || 0,\n Base64.encode64(Schema::Mercury::MercuryRequest.new(options).encode)\n ]\n args << Base64.encode64(payload.encode) if payload\n\n # Update the command to what Spotify expects\n command = 'sp/hm_b64'\n else\n args = options\n end\n\n message = {\n :id => next_message_id,\n :name => command,\n :args => args || []\n }\n\n logger.debug \"Message sent: #{message.inspect}\"\n @socket.send(message.to_json)\n\n # Add timeout handler\n EventMachine.add_timer(@timeout) do\n dispatch('id' => message[:id], 'command' => 'response_received', 'error' => 'timed out')\n end if @timeout\n\n message[:id]\n end",
"def execute(command)\n raise ClientError, \"#{self.class}#execute must be implemented\"\n end",
"def command(*cmd_parameters)\n\n @@attribute = nil\n @@method_file = nil\n @@method_line = nil\n @@command_options = {}\n \n # Include Commandable in singleton classes so class level methods work\n include Commandable unless self.include? Commandable\n \n # parse command parameters\n while (param = cmd_parameters.shift)\n case param\n when Symbol\n if param == :xor\n @@command_options.merge!(param=>:xor)\n else\n @@command_options.merge!(param=>true)\n end\n when Hash\n @@command_options.merge!(param)\n when String\n @@command_options.merge!(:description=>param)\n end\n end\n @@command_options[:priority] ||= 0\n \n # only one default allowed\n raise ConfigurationError, \"Only one default method is allowed.\" if @@default_method and @@command_options[:default]\n \n set_trace_func proc { |event, file, line, id, binding, classname|\n\n @@attribute = id if [:attr_accessor, :attr_writer].include?(id)\n \n # Traps the line where the method is defined so we can look up \n # the method source code later if there are optional parameters\n if event == \"line\" and !@@method_file\n @@method_file = file\n @@method_line = line\n end\n \n # Raise an error if there is no method following a command definition\n if event == \"end\"\n set_trace_func(nil)\n raise SyntaxError, \"A command was specified but no method follows\"\n end\n }\n end",
"def sendExact(message)\n length = message.size + CommandBase::MesssagSize_WholeLength ;\n ## should use BigEndian (Network Byte Order)\n# wholeMessage = [length].pack(\"I\") + message ;\n @rawMessage = [length].pack(\"N\") + message ;\n # send messagre\n logging(:debug, \"sendExact: dump=\"){ Util::octalDump(@rawMessage); }\n r = @socket.send(@rawMessage,0) ;\n @socket.flush ;\n return r ;\n end",
"def msg(message, options = {})\n defaults = { nickname: nickname, message: message, nicknames: nicknames }\n bot_answer = nil\n brain.message(defaults.merge(options)) do |answer|\n bot_answer = answer\n end\n bot_answer\n end",
"def command(database)\n Protocol::Command.new(database, operation)\n end",
"def create(method, path)\n\t\tJayCutCommand.new(self, method, path)\t\t\n\tend",
"def pipe_message message, command\n rawbody = @context.client.raw_message message.message_id\n output = @context.ui.pipe_to_process(command) do |stream|\n stream.write rawbody\n end\n handle_pipe_output command, output\n end",
"def call_command\n verb = match.captures[match.names.index('command')]\n verb = normalize_command_string(verb)\n public_send(verb)\n end",
"def execute_command(command_class, method, args = [])\n command_class.new.send(method, *args)\n end",
"def initialize message\n @message = message\n end",
"def initialize(message=nil)\n @message = message || self.class.message\n end",
"def newMessage\n @message = Message.new\n end",
"def command\n relation.command(command_type, **command_compiler_options)\n end",
"def execute(command)\n @command = command\n self\n end",
"def new\n @message = Message.new\n end",
"def new\n @message = Message.new\n end",
"def new\n @message = Message.new\n end",
"def new\n @message = Message.new\n end",
"def new\n @message = Message.new\n end",
"def new\n @message = Message.new\n end",
"def new\n @message = Message.new\n end",
"def new\n @message = Message.new\n end",
"def execute command\n if command_exists?\n eval \"Command::#{command}.new.init\"\n else\n raise UnknownCommand, \"Error: unknown command '#{command.downcase.to_s}'.\\nTry --help for help.\"\n end\n end",
"def give_command(command)\n\t\tif command.start_with? \"PLACE\"\n\t\t\tif @robot.robot_placed?\n\t\t\t\tputs \"\"\n\t\t\t\tputs \"Only one robot permitted in this small world\"\n\t\t\telse\n\t\t\t\tplace(command)\n\t\t\tend\n\t\telsif command == \"EXIT\"\n\t\t\tif OS.mac?\n\t\t\t\tcmd =(\"say 'Bye bye, #{$account}!'\" )\n\t\t\t\tsystem cmd\n\t\t\tend\n\t\t\texit\n\t\telsif !valid_command?(command)\n\t\t\tputs \"\"\n\t\t\tputs \"Sorry but \\\"#{command}\\\" is not a valid command\"\n\t\telsif !@robot.robot_placed?\n\t\t\tputs \"\"\n\t\t\tputs \"Sorry #{$account}, but you need to place the robot before \\\"#{command}\\\" will be accepted\"\n\t\telse\n\t\t\tcase command\n\t\t\twhen \"SELFDESTRUCT\" then destruct\n\t\t\twhen \"MOVE\" then move\n\t\t\twhen \"REPORT\" then report\n\t\t\twhen \"LEFT\" then rotate(\"LEFT\")\n\t\t\twhen \"RIGHT\" then rotate(\"RIGHT\")\n\t\t\t#rotate to allow for more directions (e.g. other angles than 90 degrees)\n\t\t\tend\n\t\tend\n\tend",
"def command_object\n @command_object ||= GitPusshuTen::Command.new(cli, configuration, hooks, environment)\n end",
"def create\n message = msg_params\n @msg = Msg.new(msg_params)\n thesender = @msg.sender\n thesentdate = @msg.sent\n theservertime = DateTime.now\n unless @msg.content.empty? || @msg.sender.empty?\n ActionCable.server.broadcast 'room_channel',\n content: @msg.content,\n sender: thesender,\n servertime: theservertime\n end\n end",
"def build_command( item )\n\t\t\t\tBuildCommand.new @interface, item\n\t\t\tend",
"def parse_command(cmd)\n cmd_name, *cmd_args = cmd.split\n method_name = COMMAND_MAP[cmd_name] || ''.freeze\n send(method_name, cmd, *cmd_args)\n rescue ArgumentError, NoMethodError\n output MSG_INVALID_COMMAND\n end",
"def request( command, options={} )\n\t\tmsg = TNetstring.dump([ command, options ])\n\t\tself.log.debug \"Request: %p\" % [ msg ]\n\t\tself.socket << msg\n\n\t\tresponse = self.socket.receive\n\t\tself.log.debug \"Response: %p\" % [ response ]\n\t\treturn unpack_response( response.pop )\n\tend",
"def send_message(message); end",
"def send_message(message); end",
"def cmd command, opts={}\n command = command.to_s\n @last_command = command\n\n # log the command\n log_command(opts[:hide] ? \"<hidden command>\" : command)\n\n # send the command\n sendcmd = opts[:raw_command] ? :print : :puts\n self.__send__(sendcmd, command)\n\n # wait for the output\n waitfor(opts[:prompt], opts)\n end",
"def send_message(message)\n socket.enqueue_packet(message)\n end",
"def do_command\n _, cmd, _, atype, addr_length = @data.unpack(\"C5\")\n header_length = 0\n\n case atype\n when 1, 4 # 1: ipv4, 4 bytes / 4: ipv6, 16 bytes\n ip_length = 4 * atype\n host = IPAddr.ntop @data[4, ip_length]\n port = @data[4 + ip_length, 2].unpack('S>').first\n header_length = ip_length + 6\n when 3 # domain name\n host = @data[5, addr_length]\n port = @data[5 + addr_length, 2].unpack('S>').first\n header_length = addr_length + 7\n else\n panic :address_type_not_supported\n end\n\n case cmd\n when 1\n send_data reply_data(:success)\n @connection = EventMachine.connect(Config.remote_server_host, Config.remote_server_port, Connection)\n @connection.server = self\n @connection.send_encoded_data(\"#{host}:#{port}\")\n @connection.send_encoded_data(@data[header_length, -1])\n clear_data\n Fiber.yield\n when 2, 3 # bind, udp\n panic :command_not_supported\n else\n panic :command_not_supported\n end\n end",
"def write_message( data )\n\t\tmessage = [ data.bytesize, data ].pack( MESSAGE_TEMPLATE )\n\t\tself.log.debug \"Writing message %p to command server.\" % [ message ]\n\t\tself.writer.write( message )\n\tend",
"def command(**options)\n require \"tty-command\"\n TTY::Command.new(options)\n end",
"def command\n raise NotImplementedError, \"`command' is not implemented by #{self.class.name}\"\n end",
"def initialize(message=nil)\n @message=message\n end",
"def initialize(message=nil)\n @message=message\n end",
"def echo message\r\n command 'echo', message\r\n end",
"def _server_control(command, body = nil)\n @connection.comm.server_message(\"#{command} #{body}\")\nend",
"def send command\n raise Error.new('implement me via subclass')\n end"
] | [
"0.7410036",
"0.67147076",
"0.63058007",
"0.61882806",
"0.6128849",
"0.61234385",
"0.61082715",
"0.60230625",
"0.60153383",
"0.60137707",
"0.5953627",
"0.59467757",
"0.5932159",
"0.59318167",
"0.59072393",
"0.58983487",
"0.5891732",
"0.5889023",
"0.5871787",
"0.5868956",
"0.58410054",
"0.583775",
"0.5829337",
"0.58041656",
"0.57714057",
"0.5769928",
"0.57466644",
"0.57353634",
"0.5723934",
"0.5708777",
"0.5694939",
"0.5679024",
"0.5653287",
"0.56491107",
"0.5640384",
"0.5640384",
"0.5637309",
"0.5636574",
"0.56055856",
"0.55815184",
"0.55477756",
"0.554648",
"0.5546459",
"0.55314946",
"0.5525477",
"0.55193913",
"0.55140543",
"0.5503259",
"0.54788524",
"0.54689807",
"0.54653716",
"0.5450298",
"0.5427682",
"0.5422918",
"0.5419306",
"0.5410905",
"0.54089457",
"0.54057765",
"0.5401918",
"0.5399934",
"0.5394513",
"0.5390095",
"0.5386645",
"0.53800714",
"0.5369692",
"0.5354671",
"0.5350322",
"0.5347495",
"0.5345068",
"0.53385484",
"0.53136575",
"0.52992874",
"0.52963537",
"0.52963537",
"0.52963537",
"0.52963537",
"0.52963537",
"0.52963537",
"0.52963537",
"0.52963537",
"0.52819884",
"0.52636385",
"0.52570164",
"0.52524215",
"0.5252139",
"0.52447146",
"0.5240524",
"0.52400416",
"0.52400416",
"0.52390164",
"0.5238023",
"0.5232827",
"0.52307355",
"0.5226741",
"0.5223225",
"0.5217456",
"0.5217456",
"0.5213098",
"0.5209857",
"0.52068007"
] | 0.5556036 | 40 |
update to add this in to items. This doesn't work | def on_landing_page?
link_text = locale('Stop Smoking Guide', 'Guía Para Dejar de Fumar')
find('a', text: link_text)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @@all_items[@id] = self\n end",
"def update(list, item, qty)\n add_item(list, item, qty)\nend",
"def add_or_update_item(list,new_items)\n list.merge!(new_items)\nend",
"def update_order_item\n \n end",
"def updated(item)\n end",
"def update!(**args)\n @items = args[:items] if args.key?(:items)\n end",
"def update!(**args)\n @items = args[:items] if args.key?(:items)\n end",
"def update!(**args)\n @items = args[:items] if args.key?(:items)\n end",
"def update!(**args)\n @items = args[:items] if args.key?(:items)\n end",
"def update!(**args)\n @items = args[:items] if args.key?(:items)\n end",
"def update!(**args)\n @items = args[:items] if args.key?(:items)\n end",
"def update!(**args)\n @items = args[:items] if args.key?(:items)\n end",
"def update!(**args)\n @items = args[:items] if args.key?(:items)\n end",
"def update!(**args)\n @items = args[:items] if args.key?(:items)\n end",
"def update(items)\n # clear!\n self.items.each do |i|\n number = items[i.id].blank? ? 1 : items[i.id].to_i <= 0 ? 1 : items[i.id]\n number.to_i < 99 ? i.quantity = number.to_i : i.quantity=99\n end\n # items.each { |id, quantity| add_items(id, quantity) }\n end",
"def updating_item(list,item,quantity)\r\n\r\n adding_item(list,item, quantity)\r\n\r\nend",
"def item_update(item)\n @item = item\n end",
"def update_quantity(item, list, quantity)\n add_item(item, list, quantity)\nend",
"def update_list(item_name, item_list, quantity)\n add_list(item_name, item_list, quantity)\nend",
"def update!(**args)\n @item = args[:item] if args.key?(:item)\n end",
"def update!(**args)\n @item = args[:item] if args.key?(:item)\n end",
"def update_quantity_of_item(list,item,quantity)\r\n add_item_to_list(list,item,quantity)\r\n list\r\nend",
"def add_to_list(list,item,quantity)\n\tupdate_item(list,item,quantity)\nend",
"def add_to_inventory(item)\n @inventory.push(item)\n update\n end",
"def update_qty(item_list, item, qty)\r\n item_list[item] = qty\r\n item_list\r\nend",
"def add_or_update_item_qty(shopping_list, item, quantity)\n shopping_list[item] = quantity\nend",
"def update_item(list, item_name, new_qty)\n if list.has_key?(item_name)\n list[item_name] = new_qty\n else\n list = add_method(list, item_name, new_qty)\n end\n list\nend",
"def update_it(new_list, item, amount)\n \n new_list[item] = amount\n \n new_list\nend",
"def update_item(item,quantity_changed,first_list)\n first_list[item] = quantity_changed\n\nend",
"def updated_quantity(list, item_name, quantity)\r\n\tlist[item_name] = quantity\r\n\tlist\r\nend",
"def update!(**args)\n @items = args[:items] if args.key?(:items)\n @self_link = args[:self_link] if args.key?(:self_link)\n @total_items = args[:total_items] if args.key?(:total_items)\n end",
"def update!(**args)\n @items = args[:items] if args.key?(:items)\n @self_link = args[:self_link] if args.key?(:self_link)\n @total_items = args[:total_items] if args.key?(:total_items)\n end",
"def save\r\n @@items.push self\r\n end",
"def update_quant (olist, item, quant)\n olist[item] = quant\n olist\nend",
"def update\n @list.append_items!(params.dig(:list, :items), current_user)\n redirect_to [@project, @randomization_scheme], notice: \"Items successfully added.\"\n end",
"def list_update(hash_items, item_name, quantity)\n hash_items[item_name] = quantity\n return hash_items\nend",
"def add_item(current_list, item_added, quantity)\n current_list[item_added] = quantity\n current_list\nend",
"def update_item(list, item, new_quantity)\n\tlist[item] = new_quantity\n\tlist\nend",
"def add_item item\n @items << item\n @@all_items << item\n end",
"def update(item, quantity, list)\n\t# steps: if the item is in the list\n\tif list.include? item.to_sym\n\t\t# update the quantity\n\t\tlist[item.to_sym] = quantity\n\telse \n\t\tadd_item(item, quantity, list)\n\tend\n\t# output: return the updated list\n\tlist\nend",
"def update_qty(shopping_list, item, quantity)\r\n\r\n\tadd_item(shopping_list, item, quantity)\r\n\r\nend",
"def update (list, item, qty)\n list[item] = qty\nend",
"def add_or_update_item(list, item, quantity = 1)\n list[item] = quantity\n list\nend",
"def update_quantity(list, item, updated_quantity)\n list[item] = updated_quantity\n list\nend",
"def update(list, item, quantity)\n list[item] = quantity\n list\nend",
"def update_item(grocery_list, item, quantity)\n grocery_list[item] = quantity\n grocery_list \nend",
"def update_quantity(grocery_list, item, quantity)\r\n add_item(grocery_list, item, quantity)\r\n \r\nend",
"def update(item,quantity,list)\n\tlist[item] = quantity\nend",
"def update!(**args)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n end",
"def update!(**args)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n end",
"def update!(**args)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n end",
"def update!(**args)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n end",
"def update!(**args)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n end",
"def update!(**args)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n end",
"def update!(**args)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n end",
"def update!(**args)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n end",
"def update!(**args)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n end",
"def update!(**args)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n end",
"def update!(**args)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n end",
"def update!(**args)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n end",
"def update!(**args)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n end",
"def update_item (list,item,quantity)\n\tlist[item] = quantity\nend",
"def upsert(kind, item)\n end",
"def update_quant(current_list, item, quantity)\n current_list[item] = quantity\n current_list\nend",
"def update_quantity(new_list, item_name, quantity)\r\n \r\n new_list[item_name] = quantity\r\nend",
"def add_item(olist, item, quant=1)\n new_list = {item => quant}\n olist.merge(new_list)\nend",
"def update_item(list,item,quantity)\n list[item] = quantity\nend",
"def update_item(list,item,quantity)\n list[item] = quantity\nend",
"def update_quantity(master_list, item, quantity)\n master_list.merge!(item => quantity)\n return master_list\nend",
"def update!(**args)\n @items = args[:items] if args.key?(:items)\n @request_id = args[:request_id] if args.key?(:request_id)\n end",
"def update!(**args)\n @items = args[:items] if args.key?(:items)\n @request_id = args[:request_id] if args.key?(:request_id)\n end",
"def update_quantity(list, item, quant)\n list[item] = quant\nend",
"def update_list(new_list,item,new_qty)\n new_list[item]=new_qty\n return new_list\nend",
"def update_item(list, name, quantity)\r\n # steps: \r\n # check if item is present\r\n if list[name] != nil\r\n # update with new amount\r\n list[name] = quantity\r\n end\r\n return list\r\n # output: list\r\nend",
"def add_item(item_list, item, qty)\r\n item_list[item] = qty\r\n item_list\r\nend",
"def update_quantity(list, item, quantity)\n\tadd_to_list(list, item, quantity)\nend",
"def attach_item(item)\r\n equal_item = self.check_for_equal_item(item.name,item.price,item.description)\r\n if equal_item == nil\r\n self.items << item\r\n item.owner = self\r\n item.deactivate\r\n else\r\n equal_item.quantity += item.quantity\r\n equal_item.deactivate\r\n item.delete\r\n end\r\n end",
"def add_or_update_item(list, item, quantity=1)\n\tlist[item] = quantity\nend",
"def update!(**args)\n @list_items = args[:list_items] if args.key?(:list_items)\n end",
"def update_quantity(list, item, quant)\n list[item] = quant\nend",
"def update(list, item, quantity)\n\tlist[item] = quantity\n\tlist\nend",
"def update_qty(list_items, item_name, new_qty)\n raise ArguementError.new(\"This item does not exist\") unless list_items.include?(item_name)\n list_items[item_name] = item_qty\nend",
"def add_item(new_item)\n item = Item.new(new_item)\n items.push(item)\n end",
"def update_item_quantity(list, item, quantity)\n list[item] = quantity\n list\nend",
"def item_add item\n\t\tret = super\n\t\titem.known! if (ret)\n\t\treturn ret\n\tend",
"def update (list, item, quantity)\n\tlist[item] = quantity\nend",
"def update(list, item_name, quantity)\n\tlist[item_name] = quantity\nend",
"def update_quantity(list, item, qty)\n list[item] = qty\n list\nend",
"def update(grocery_list, item, quantity)\n grocery_list[item] = quantity\nend",
"def update_inventory\n self.order_items.each { |item| item.variant.add_pending_to_customer }\n end",
"def update_item_from_list(list, food, update_quantity)\n list[food] = update_quantity\n list\nend",
"def update!(**args)\n @item_id = args[:item_id] if args.key?(:item_id)\n end",
"def update_item\n self.item.update_complete\n end",
"def add_item(list_items, item_name, item_qty)\n if list_items.include?(item_name)\n list_items[item_name] += item_qty\n else\n list_items[item_name] = item_qty\n end\nend",
"def update_item(item, list, quantity)\n if list.has_key?(item)\n list[item] = quantity\n return list\n else\n return list\n end\nend",
"def item_quantity(list, item_to_update, quantity)\n list[item_to_update] = quantity \nend",
"def add_items(items)\n add_items!(unknown_items(items))\n end",
"def update_quantity_of_items(list, item, quantity)\n list[item] = quantity\nend",
"def update_quantity(list, item_name, qty)\n list[item_name] = qty\nend",
"def update_quantity(list, item_name, quantity)\r\n list[item_name] = quantity\r\nend",
"def update_item\n pcp_item.update_new_assmt( self )\n end"
] | [
"0.73811",
"0.72207355",
"0.71282434",
"0.702074",
"0.6990576",
"0.69773734",
"0.69773734",
"0.69773734",
"0.69773734",
"0.69773734",
"0.69773734",
"0.69773734",
"0.69773734",
"0.69773734",
"0.6954292",
"0.69185364",
"0.6756871",
"0.67342347",
"0.67310286",
"0.6722685",
"0.6722685",
"0.67142",
"0.66893595",
"0.6668861",
"0.6644575",
"0.6625887",
"0.66214985",
"0.66090757",
"0.6585399",
"0.65748155",
"0.6570929",
"0.6570929",
"0.65467757",
"0.6527921",
"0.65239894",
"0.65226126",
"0.6511559",
"0.6508331",
"0.650785",
"0.6507266",
"0.64991283",
"0.64979124",
"0.6494232",
"0.64797026",
"0.6468695",
"0.6465689",
"0.6463545",
"0.646132",
"0.6461253",
"0.6461253",
"0.6461253",
"0.6461253",
"0.6461253",
"0.6461253",
"0.6461253",
"0.6461253",
"0.6461253",
"0.6461253",
"0.6461253",
"0.6461253",
"0.6461253",
"0.64611936",
"0.6457636",
"0.6456739",
"0.6455877",
"0.6439334",
"0.64370215",
"0.64370215",
"0.64346313",
"0.6431839",
"0.6431839",
"0.6430755",
"0.6428264",
"0.6419686",
"0.6417774",
"0.64132434",
"0.64098215",
"0.6409118",
"0.6408205",
"0.640707",
"0.6404042",
"0.63955534",
"0.6386597",
"0.6383834",
"0.63805234",
"0.638043",
"0.6379957",
"0.6378694",
"0.63764834",
"0.63718396",
"0.6364958",
"0.6355741",
"0.6344706",
"0.6344518",
"0.6333878",
"0.63331324",
"0.63328683",
"0.633097",
"0.6330756",
"0.6328944",
"0.6322588"
] | 0.0 | -1 |
this will only work for Home, Stop Smoking Guide and Cigarette Counter | def navigate_to(button)
find('.navbar-toggle').click unless has_css?('.glyphicon.glyphicon-cog')
find('.ng-binding', text: button).click
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def superweening_adorningly(counterstand_pyrenomycetales)\n end",
"def robot_counter\n\n\tend",
"def us_troops_available\n us_troop < coin_control_excess ? us_troop : coin_control_excess\n end",
"def battler_hue\n return 0\n end",
"def soft_ace\n # softy method refactor for when an ace is played\nend",
"def cutoffs\n end",
"def active_voice_indicative_mood_imperfect_tense\n end",
"def current_clown; end",
"def current_clown; end",
"def sub_flag\n page(MorePage).touch_subflag\n page(NavTabBarPage).flag_handler(\"Cancel\")\n page(MorePage).touch_subflag\n page(NavTabBarPage).flag_handler(\"Flag\")\n sleeper(25)\n page(MorePage).backpage\n sleeper(16)\n end",
"def active_voice_indicative_mood_future_tense\n end",
"def play_as_master_first\r\n @pending_points = 0\r\n w_cards = []\r\n curr_points_me = @team_mates.inject(0){ |result, name_pl| result + @points_segno[name_pl] }\r\n @cards_on_hand.each do |card_lbl|\r\n card_s = card_lbl.to_s # something like '_Ab'\r\n segno = card_s[2,1] # character with index 2 and string len 1\r\n is_card_lbl_briscola = card_s[2] == @briscola.to_s[2] \r\n curr_w = 0\r\n curr_w += 70 if is_card_lbl_briscola\r\n # check if it is an asso or 3\r\n curr_w += 220 if card_s[1] == \"A\"[0]\r\n curr_w += 200 if card_s[1] == \"3\"[0] \r\n if card_s =~ /[24567]/\r\n # liscio value\r\n lisc_val = (card_s[1] - '0'[0]).to_i\r\n curr_w += 50 + lisc_val\r\n end\r\n curr_w += 60 if card_s[1] == \"F\"[0]\r\n # check horse and king cards\r\n if card_s[1] == \"C\"[0]\r\n if is_mariazz_possible?(segno)\r\n curr_w += 90 + 70\r\n else\r\n curr_w += 30\r\n end\r\n end \r\n if card_s[1] == \"R\"[0]\r\n if is_mariazz_possible?(segno)\r\n curr_w += 100 + 70\r\n else\r\n curr_w += 20\r\n end\r\n end\r\n # penalty for cards wich are not stroz free\r\n curr_w += 10 * @strozzi_on_suite[segno].size\r\n if (curr_points_me + @deck_info.get_card_info(card_lbl)[:points]) > @target_points\r\n curr_w -= (@deck_info.get_card_info(card_lbl)[:points] + 100)\r\n curr_w -= 200 if is_card_lbl_briscola\r\n curr_w -= 1000 if is_card_lbl_briscola and card_s[1] == \"A\"[0]\r\n end\r\n \r\n w_cards << [card_lbl, curr_w ] \r\n end\r\n # find a minimum\r\n #p w_cards\r\n min_list = w_cards.min{|a,b| a[1]<=>b[1]}\r\n @log.debug(\"Play as first: best card#{min_list[0]}, (w_cards = #{w_cards.inspect})\")\r\n return min_list[0]\r\n end",
"def test03_L1DLT03_TC_24418\n\t\t#skipping for now, currently unable to interact with the \"Like\" button\n\tend",
"def timer_checkpoints\n t = self.time_remaining\n if @timer_checkpoint_hash[30] < 3 && t <= 40\n @timer_checkpoint_hash[30] += 1\n tab; \"#{@time_remaining} seconds left.\\n\".typing\n elsif @timer_checkpoint_hash[120] == 0 && t.between?(60, 140)\n @timer_checkpoint_hash[120] += 1\n tab; \"Cutting it close, #{codename}\".typing\n elsif @timer_checkpoint_hash[180] == 0 && t.between?(140, 180)\n @timer_checkpoint_hash[180] += 1\n tab; \"3 minutes. Finish the job.\\n\".typing\n elsif @timer_checkpoint_hash[240] == 0 && t.between?(200, 240)\n @timer_checkpoint_hash[240] += 1\n tab; \"Doing good. 4 minutes left.\\n\".typing\n end\n end",
"def who_we_are\r\n end",
"def reset_counter; end",
"def manage_trains\n @ui.manage_trains_selected_msg\n @ui.input_1_change\n @ui.user_input1.downcase\n\n case @ui.user_input1\n when \"add\" \n manage_trains_add_train\n when \"add route\"\n manage_trains_add_route\n when \"move\"\n manage_trains_move\n when \"cars\"\n manage_trains_cars\n when \"observe\" \n manage_trains_choose_train\n when \"inst\" #Test method for printing value of instance_counter (task form hw-5)\n puts PassengerTrain.instance_counter\n else\n @ui.wrong_input_msg\n end\n end",
"def free_helpers\n if division == 'Small Churches'\n 2\n elsif division == 'Medium Churches'\n 4\n elsif participants.coming.accepted.playing_sport.size <= 80\n 6\n else\n 8\n end\n end",
"def counting_recommendation\n count = @shoe.count\n if count <= 1\n @cold\n elsif count <= 10\n @warm\n else\n @hot\n end\n end",
"def celebration; end",
"def passive_voice_indicative_mood_future_tense\n end",
"def passive_voice_indicative_mood_imperfect_tense\n end",
"def ac_monitor current_temp, ac_working, desired_temp\n # if ((ac_working == true) && (current_temp > desired_temp))\n # \"Turn on the AC.\"\n # elsif (ac_working == true) && (current_temp <= desire_temp))\n # \"Just Right!\"\n # elsif ((ac_working == false) && (current_temp <= desire_temp))\n # \"Fix the AC whenever you have the chance. It's cool\"\n # else\n # \"Fix the AC now! It's hot!\"\n # end\nend",
"def work_out\n self.happiness += 2\n self.hygiene -= 3\n return \"♪ another one bites the dust ♫\" \n end",
"def whiny; end",
"def add_wings_and_take_off\nend",
"def work_out\n self.happiness = @happiness + 2\n self.hygiene = @hygiene - 3\n \"♪ another one bites the dust ♫\"\n end",
"def stopping; end",
"def active_voice_indicative_mood_present_tense\n end",
"def counter_attack\n block_or_win(opponent_token)\n end",
"def setup_game\n\t\t@word = get_word.upcase\n\t\t@misses = []\n\t\t@hits = []\n\t\t@guesses_left = 10\n\tend",
"def aide3()\n\n @indiceFortFlag = TRUE\n @timer.add(120)\n end",
"def game_mode; end",
"def options_when_walking_away_from_desk\n# letting user know whats happening with the door\n puts \"\\nYou walk to the door and... \"\n sleep(2)\n if $items_collected.include?(\"key\") then\n puts \"You use the key to open the door\"\n sleep(2)\n opened_the_door_walked_outside\n else !$items_collected.include?(\"key\")\n puts \"Sorry you dont have the key, go back to the desk!\\n\\n\"\n sleep(2)\n remove_last_item_from_items_collected_at_desk\n end\nend",
"def command_206\r\n $game_player.get_on_off_vehicle\r\n end",
"def no_learn\n 8\n end",
"def updateDaMeter\n @start = 0\n\n if @account_complete == 1\n @start += 1\n end\n\n if @verify_complete == 1\n @start += 1\n end\n\n if @deposit_complete == 1\n @start += 1\n end\n\n if @communication_complete == 1\n @start += 1\n end\n\n if @immunization_complete == 1\n @start += 1\n end\n\n if @residency_complete == 1\n @start += 1\n end\n\n if @finaid_complete == 1\n @start += 1\n end\n\n if @housing_fee_complete == 1\n @start += 1\n end\n\n if @aleks_complete == 1\n @start += 1\n end\n\n if @orientation_complete == 1\n @start += 1\n end\n\n if @learning_comm_complete == 1\n @start += 1\n end\n\n if @oars_complete == 1\n @start += 1\n end\n\n if @reg_complete == 1\n @start += 1\n end\n\n if @tuition_complete == 1\n @start += 1\n end\n\n if @emergency_complete == 1\n @start += 1\n end\n\n if @fau_alert_complete == 1\n @start += 1\n end\n\n end",
"def changerEnBleu\n\t\t@couleur=0\n\tend",
"def online_special_ballot\n end",
"def anti_counter?\n !note[TSBS::AntiCounter].nil?\n end",
"def anti_counter?\n !note[TSBS::AntiCounter].nil?\n end",
"def stop_reason()\n #This is a stub, used for indexing\n end",
"def offenses_to_check; end",
"def cigarette_counter_eng\n @cigarette_counter_eng ||= Participants::CigaretteCounter.new(\n locale: 'english'\n )\nend",
"def cigarette_counter_eng\n @cigarette_counter_eng ||= Participants::CigaretteCounter.new(\n locale: 'english'\n )\nend",
"def tired\t\r\n\tif $hours_asleep >= 8 then\r\n\t $hours_asleep = 0\r\n \t\treturn false\r\n \telse\r\n \t\t$hours_asleep += 1\r\n \t\treturn true\r\n \tend \t\t\r\nend",
"def countDown\n # how many seconds left from 3 second countdown\n timeRemaining = 3 - (Time.now - curPauseTime).to_i\n # updates the countdown time string to render\n @countdownTime = timeRemaining.to_s\n @countdownTimeWidth = font.getWidth(countdownTime)\n # countdown is done\n if timeRemaining < 1\n # starting over after a game over\n if (!resuming)\n reset\n @gameOver = false\n else # resuming from a pause\n @resuming = false\n @gameOver = false\n end\n # this tells the program to stop counting\n @countdown = false\n end\n end",
"def unusual_sport; end",
"def passive_voice_indicative_mood_present_tense\n end",
"def computer_turn(turn_counter)\n if turn_counter.odd? #red turn\n begin\n clue = Word.red_clue\n rescue => e\n e.response\n end\n number = 1\n # clue = Word.red_clue\n puts \"\\e[31mTeam Red\\e[0m, your clue is: \"+clue+ \", \" + number.to_s\n\n elsif turn_counter.even? #blue turn\n # clue = Word.blue_clue\n begin\n clue = Word.blue_clue\n rescue => e\n e.response\n end\n number = 1\n puts \"\\e[34mTeam Blue\\e[0m, your clue is: \"+clue+ \", \" + number.to_s\n end\n number\nend",
"def start_track\r\n 0\r\n end",
"def game_start_cb\n puts \"Try to break the computer's code in less than 8 moves!\"\n i = 0\n while @winner == false && i < 12\n puts \"You have #{12 - i} guesses remaining...\"\n player_guess\n red_peg_check\n white_peg_check\n red_to_white_peg\n check_winner\n i += 1\n end\n if i == 12\n game_over\n end\n end",
"def cider_numbers\n # set getting started step\n @user = current_user\n if @user.getting_started_step < 11\n @user.update_attribute(:getting_started_step, 11) # because current_user is not an object, \"update_attributes\" needs to be used instead of just \"update\"\n end\n \n # set UX variables\n @category = \"cider\"\n @category_choice = \"ciders\"\n @chosen_drinks_per_week = \"hidden\"\n @beer_chosen = \"complete\"\n @cider_chosen = \"current\"\n @user_chosen = \"complete\"\n @drink_chosen = \"current\"\n @subguide = \"drink\"\n \n # indicate this is coming from signup\n @create_drink_profile = true\n \n # get user delivery preferences\n @user_delivery_preference = DeliveryPreference.find_by_user_id(current_user.id)\n \n # find user chosen categories\n @user_cider_preference = UserPreferenceCider.find_by_user_id(current_user.id)\n if !@user_cider_preference.ciders_per_week.nil?\n @chosen_drinks_per_week = \"show\"\n \n if (@user_cider_preference.ciders_per_week % 1).zero?\n @drinks_per_week = @user_cider_preference.ciders_per_week.round\n @chosen_timeframe = \"week\"\n @week_chosen = \"chosen\"\n @month_chosen = nil\n if @user_cider_preference.ciders_per_week > 1\n @drinks_per_week_text = @drinks_per_week.to_s + \" ciders/week\"\n else\n @drinks_per_week_text = @drinks_per_week.to_s + \" cider/week\" \n end\n else\n @drinks_per_week = @user_cider_preference.ciders_per_week * 4\n @chosen_timeframe = \"month\"\n @week_chosen = nil\n @month_chosen = \"chosen\"\n if @user_cider_preference.ciders_per_week > 1\n @drinks_per_week_text = @drinks_per_week.to_s + \" ciders/week\"\n else\n @drinks_per_week_text = @drinks_per_week.to_s + \" cider/week\" \n end\n end\n \n if @drinks_per_week != 0\n session[:cider_number] = @drinks_per_week\n end\n session[:cider_timeframe] = @chosen_timeframe\n end\n \n # set last saved\n @last_saved = @user_cider_preference.updated_at\n \n end",
"def congrats_or_taunt\n\t\tif @current_state.include?(\" _ \")\n\t\t\tp \"Aw man, you didn't get it this time!\"\n\t\telse\n\t\t\tp \"Woot woot! You're a hangman expert now!\"\n\t\tend\n\tend",
"def reset_statuses\n @player1.deuce = false\n @player2.deuce = false\n @player1.advantage = false\n @player2.advantage = false\n end",
"def default_stop\n @total ||= 1_000\n end",
"def takeoff\n if @engine_on == false\n return \"airplane not started, please start\"\n elsif @engine_on == true && @flying == false\n @flying = true\n @fuel -= 15\n return \"airplane launched\"\n else\n return \"airplane already flying\"\n end\n end",
"def game_over\n end",
"def command_use_point\r\r\n if $game_actors[@actor.id].skill_tree[0] == 0 || confirm_skill_add\r\r\n Sound.play_buzzer\r\r\n @confirm.close\r\r\n @confirm.active = false\r\r\n else\r\r\n @skills_icons[@skill_selected].opacity = 255\r\r\n $game_actors[@actor.id].skill_tree[0] -= 1\r\r\n $game_actors[@actor.id].lose_jp(Actor[@actor.id][@skill_selected]['JP'])\r\r\n $game_actors[@actor.id].skill_mult[Actor[@actor.id][@skill_selected]['Skill_id']] += Actor[@actor.id][@skill_selected]['Multiply']\r\r\n $game_actors[@actor.id].skill_tree[Actor[@actor.id][@skill_selected]['Skill_id']] += 1\r\r\n $game_actors[@actor.id].learn_skill(Actor[@actor.id][@skill_selected]['Skill_id'])\r\r\n @info_window.refresh(@actor, @tree)\r\r\n Audio.se_play(\"Audio/SE/Skill3\",75,100)\r\r\n @confirm.close\r\r\n @confirm.active = false\r\r\n if $game_switches[19] # achievement available?\r\r\n #------------------------------------------------------------------------------- \r\r\n # Trophic: Markspony\r\r\n #-------------------------------------------------------------------------------\r\r\n earn_trophic = true\r\r\n for i in 546..561\r\r\n if !$game_actors[@actor.id].skill_learned?(i) && !$ACH_markspony\r\r\n earn_trophic = false\r\r\n break\r\r\n end\r\r\n end\r\r\n \r\r\n if earn_trophic && !$ACH_markspony\r\r\n $ACH_markspony = true\r\r\n GameJolt.award_trophy(\"53491\")\r\r\n p sprintf(\"Achievement unlock - markspony\")\r\r\n $game_system.earn_achievement(:markspony)\r\r\n end\r\r\n #------------------------------------------------------------------------------- \r\r\n # Trophic: Elementalist\r\r\n #------------------------------------------------------------------------------- \r\r\n earn_trophic = true\r\r\n for i in 563..582\r\r\n next if i == 567 || i == 571 || i == 577 || i == 581 \r\r\n if !$game_actors[@actor.id].skill_learned?(i) && !$ACH_elementalist\r\r\n earn_trophic = false\r\r\n break\r\r\n end\r\r\n end\r\r\n \r\r\n if earn_trophic && !$ACH_elementalist\r\r\n $ACH_elementalist = true\r\r\n GameJolt.award_trophy(\"53485\") \r\r\n p sprintf(\"Achievement unlock - elementalist\")\r\r\n $game_system.earn_achievement(:elementalist)\r\r\n end\r\r\n #---------------------------------------------------\r\r\n end\r\r\n end\r\r\n end",
"def startCountdown\n # get the current time in milliseconds for reference use\n @curPauseTime = Time.now\n # this tells the program to start counting\n @countdown = true\n end",
"def stop_smoking_guide_eng\n @stop_smoking_guide_eng ||= Participants::StopSmokingGuide.new(\n locale: 'english'\n )\nend",
"def stop_smoking_guide_eng\n @stop_smoking_guide_eng ||= Participants::StopSmokingGuide.new(\n locale: 'english'\n )\nend",
"def pbTrainerPC\n Kernel.pbMessage(_INTL(\"\\\\se[computeropen]{1} booted up the PC.\",$Trainer.name))\n pbTrainerPCMenu\n pbSEPlay(\"computerclose\")\n $PokemonTemp.dependentEvents.refresh_sprite\nend",
"def check_win_or_lose\n if !@word_with_guesses.include?(\"-\")\n return :win\n elsif @word_with_guesses.include?(\"-\") && @attempts >= 8\n return :lose\n else \n return :play \n end\n end",
"def ac_monitor current_temp, ac_working, desired_temp\n if current_temp > desired_temp && ac_working == true\n return \"Turn on the AC.\"\n end\n if current_temp <= desired_temp && ac_working == true\n return \"Just right!\"\n end\n if current_temp > desired_temp && ac_working == false\n return \"Fix the AC now! It's hot!\"\n end\n if current_temp <= desired_temp && ac_working == false\n return \"Fix the AC whenever you have the chance. It's cool.\"\n end\nend",
"def pre_game\n clear\n mission_directive_text\n clear\n codebreaker_protocol_text\n begin_mission_text\n end",
"def tired\t\n\tif $hours_asleep >= 8 then\n\t $hours_asleep = 0\n \t\treturn false\n \telse\n \t\t$hours_asleep += 1\n \t\treturn true\n \tend \t\t\nend",
"def spouse; end",
"def kids_musical; end",
"def num_tankoubon; end",
"def start_round\n super\n @game_options_array = ['Skip', 'Take card', 'Open up']\n end",
"def disable_ht_markets?\n # return false if sport.uid != '6046' || not_started?\n running_time.to_i >= 42 && in_progress?\n end",
"def update_status\n # If B button was pressed\n if Input.trigger?(Input::B)\n # Play cancel SE\n $game_system.se_play($data_system.cancel_se)\n # Make command window active\n @command_window.active = true\n @status_window.active = false\n @status_window.index = -1\n return\n end\n # If C button was pressed\n if Input.trigger?(Input::C)\n # Branch by command window cursor position\n case @command_window.index\n when 1 # skill\n # If this actor's action limit is 2 or more\n if $game_party.actors[@status_window.index].restriction >= 2\n # Play buzzer SE\n $game_system.se_play($data_system.buzzer_se)\n return\n end\n # Play decision SE\n $game_system.se_play($data_system.decision_se)\n # Switch to skill screen\n $scene = Scene_Skill.new(@status_window.index)\n when 2 # equipment\n # Play decision SE\n $game_system.se_play($data_system.decision_se)\n # Switch to equipment screen\n $scene = Scene_Equip.new(@status_window.index)\n when 3 # piercings\n # Play decision SE\n $game_system.se_play($data_system.decision_se)\n # Switch to piercings screen\n $scene = Scene_Piercings.new(@status_window.index)\n when 5 # status\n # Play decision SE\n $game_system.se_play($data_system.decision_se)\n # Switch to status screen\n $scene = Scene_Status.new(@status_window.index)\n end\n return\n end\n end",
"def analyze_hand\n pairs = 0\n straight = 0\n flush = 0\n\n # for now be conservative\n @play = 3\n\n # check for pairs\n\n\n # check for flush\n\n # check for straight\n\n\n\n # check for special hands\n #full house\n #royal flush\n #straight flush\n \n end",
"def pbPokeCenterPC\n Kernel.pbMessage(_INTL(\"\\\\se[computeropen]{1} booted up the PC.\",$Trainer.name))\n loop do\n commands=PokemonPCList.getCommandList()\n command=Kernel.pbMessage(_INTL(\"Which PC should be accessed?\"),\n commands,commands.length)\n if !PokemonPCList.callCommand(command)\n break\n end\n end\n pbSEPlay(\"computerclose\")\n $PokemonTemp.dependentEvents.refresh_sprite\nend",
"def update_status(guesses) \n \t_count = 0\n \tguesses.each do |guess|\n \t\tif (guess.status == \"hit\") && (self.is_at(guess.x, guess.y))\n \t\t\t_count += 1\n \t\tend\n \tend\n\n \tself.status = _count === self.size ? \"sunk\" : \"safe\"\n\n \tself.status\n end",
"def tenders_adv(start, num)\n\nend",
"def key_skill; end",
"def sw_temp\n return $game_switches[SW_TEMP]\nend",
"def time_setup\n @player.profbirchhomeupstairs == 'first' ? @map[2][8] = 'other_icon' : nil\n end",
"def suivre; end",
"def safety_start_player_turn\n ai_done_tb if (@safety_tb+=1)> TM::Defaults::SafetyTimer &&TM.queues_empty?\n end",
"def start_conversation(friend, topic) \n case(topic)\nwhen \"politics\" \n friend.happiness -= 2\n self.happiness -= 2\n return \"blah blah partisan blah lobbyist\"\nwhen \"weather\"\n friend.happiness += 1\n self.happiness += 1\n return \"blah blah sun blah rain\"\n#use else because it tells us if none of the above check out then do the following\nelse \n return \"blah blah blah blah blah\" \n end \nend",
"def play_as_master_second\r\n \r\n end",
"def ajust_weather_switches\n weather = current_weather\n $game_switches[::Yuki::Sw::WT_Rain] = (weather == 1)\n $game_switches[::Yuki::Sw::WT_Sunset] = (weather == 2)\n $game_switches[::Yuki::Sw::WT_Sandstorm] = (weather == 3)\n $game_switches[::Yuki::Sw::WT_Snow] = (weather == 4)\n $game_switches[::Yuki::Sw::WT_Fog] = (weather == 5)\n end",
"def promotion_check\n\t\tif @player_play[1][1] == \"8\" && @current_player.color == \"white\"\n\t\t\tpromotion_menu\n\t\telsif @player_play[1][1] == \"1\" && @current_player.color == \"black\"\n\t\t\tpromotion_menu\n end\n\tend",
"def sprinting?\n if $window.button_down?(Gosu::KbLeftShift) && @tired <= 0\n @sprinting = true\n else\n @sprinting = false\n @tired -= 1 unless @tired <= 0\n end\n \n if @sprinting\n @sprint -= 1\n @tired = 300 if @sprint <= 0\n else\n @sprint += 1 unless @sprint >= 100\n end\n end",
"def super_wrench\n @teacher = Teacher.first\n\n # calc number of bad sessions, bad session events\n @bad_sessions_count = v0dot5_num_bad_sessions()\n @bad_events_count = v0dot5_num_bad_events()\n @unending_sessions_count = v0dot5_num_sessions_without_end()\n end",
"def thirty_minute_yoga_classes\n end",
"def w_vs_m\n\t\tweightlifting = reviews.where(weightlifting_focus: true).count\n metcon = reviews.where(metcon_focus: true).count\n \n if weightlifting == 0 && metcon == 0\n @focus = \"\"\n elsif weightlifting > metcon\n @focus = \"This gym focuses on weightlifting\"\n elsif metcon > weightlifting\n @focus = \"This gym focuses on metcon training\"\n else \n @focus = \"This gym offers a balance of weightlifting and metcon training\"\n end \n return @focus\n end",
"def recorder_mgmt_demo(screen, button)\r\n\r\n $instruct1 = screen.get_named_widget(\"Instruct1\")\r\n $instruct2 = screen.get_named_widget(\"Instruct2\")\r\n $instruct3 = screen.get_named_widget(\"Instruct3\")\r\n $instruct4 = screen.get_named_widget(\"Instruct4\")\r\n $instruct5 = screen.get_named_widget(\"Instruct5\")\r\n $instruct6 = screen.get_named_widget(\"Instruct6\")\r\n $instruct7 = screen.get_named_widget(\"Instruct7\")\r\n\r\n if (button == \"INFO\")\r\n \r\n display(\"CFS_KIT RECORDER_MGMT_DEMO_INFO_SCREEN\",500,50) \r\n\r\n elsif (button == \"NEXT\")\r\n \r\n $rmd_step += 1\r\n $rmd_demo = 0\r\n \r\n if ($rmd_step <= RMD_LAST_STEP)\r\n rmd_set_instruct_text($rmd_step)\r\n end\r\n\r\n case $rmd_step\r\n when 1\r\n display(\"CFS_KIT RECORDER_MGMT_SCREEN\",500,50) \r\n cmd(\"CFE_EVS ENA_APP_EVENT_TYPE with APPNAME DS, BITMASK 0x01\") # Enable debug events\r\n when 2..RMD_LAST_STEP\r\n # Keep case statement for maintenance\r\n else\r\n cmd(\"CFE_EVS DIS_APP_EVENT_TYPE with APPNAME DS, BITMASK 0x01\") # Disable debug events\r\n $rmd_step = 0\r\n clear(\"CFS_KIT RECORDER_MGMT_SCREEN\") \r\n clear(\"CFS_KIT RECORDER_MGMT_DEMO_SCREEN\")\r\n clear(\"CFS_KIT RECORDER_MGMT_DEMO_INFO_SCREEN\")\r\n end # Step Case\r\n \r\n elsif (button == \"DEMO\")\r\n \r\n case $rmd_step\r\n\r\n # 1- \r\n when 1\r\n if ($rmd_demo == 0)\r\n # Don't increment rmd_demo; okay if user repeats cmd\r\n end\r\n \r\n # 2 - \r\n when 2\r\n case $rmd_demo\r\n when 0 \r\n $rmd_demo += 1\r\n when 1 \r\n $rmd_demo += 1\r\n when 2 \r\n $rmd_demo += 1\r\n when 3\r\n $rmd_demo += 1\r\n else\r\n $rmd_demo = 0\r\n end # Case $rmd_demo\r\n\r\n # 3 - \r\n when 3\r\n if ($rmd_demo == 0)\r\n $rmd_demo += 1\r\n elsif ($rmd_demo == 1)\r\n $rmd_demo += 1\r\n elsif ($rmd_demo == 2)\r\n # Don't increment rmd_demo; okay if user repeats cmd\r\n end\r\n\r\n # 4 - \r\n when 4\r\n if ($rmd_demo == 0)\r\n $rmd_demo += 1\r\n elsif ($rmd_demo == 1)\r\n # Don't increment rmd_demo; okay to repeat last command\r\n end\r\n\r\n end # Step Case\r\n end # Demo\r\n \r\nend",
"def offenses; end",
"def offenses; end",
"def offenses; end",
"def ounce_troy? = unit == 'ounce-troy'",
"def set_counting_recommendation_strings\n @cold = \"The deck is cold. Play conservatively. There are more low cards than high cards. The dealer is less likely to bust, but so are you. Doubling down will be less useful. Blackjacks are less common.\"\n @warm = \"The deck is warm. There are more high cards than low cards. Blackjacks will be common. Doubling down when appropriate will be advantagous. The dealer is likely to bust.\"\n @hot = \"The deck is hot! Your biggest worry at this point is the dealer stealing your Blackjacks. This deck is stacked!\"\n end",
"def active; end",
"def active; end",
"def travel_game airline_compony\n if airline_compony.downcase == 'delta'\n 'Congrats you are going to Europe'\n \n elsif airline_compony.downcase == 'spirit'\n 'Congrats you are going to Bahams'\n \n end\nend",
"def medical_use; end",
"def instrument_to_index(instrument_type)\n case instrument_type\n when \"guitars\"\n 0\n when \"microphones\"\n 1\n when \"amps\"\n 2\n when \"drumkit\"\n 3\n when \"keyboard\"\n 4\n else\n puts \"next time, please choose one in this list: (guitars,microphones,amps,drumkit,keyboard)\"\n puts\n exit\n end\nend"
] | [
"0.5726029",
"0.56404406",
"0.5627096",
"0.54890275",
"0.5480502",
"0.5444819",
"0.5440449",
"0.54349625",
"0.54349625",
"0.54049987",
"0.5381794",
"0.5361006",
"0.5329698",
"0.5322982",
"0.5297912",
"0.5294948",
"0.5291153",
"0.5278019",
"0.5277868",
"0.5266389",
"0.5254258",
"0.5220713",
"0.52182144",
"0.52109176",
"0.520387",
"0.51955605",
"0.519092",
"0.51889193",
"0.5170446",
"0.5166808",
"0.51655245",
"0.51647073",
"0.5164523",
"0.5152198",
"0.51516676",
"0.5138482",
"0.51340455",
"0.5119497",
"0.5109796",
"0.51083636",
"0.51083636",
"0.51048285",
"0.5102686",
"0.5099524",
"0.5099524",
"0.50989616",
"0.5092757",
"0.5086806",
"0.5072771",
"0.50711936",
"0.50669885",
"0.50657254",
"0.50638264",
"0.5060135",
"0.5059032",
"0.504739",
"0.5044399",
"0.50381875",
"0.5036943",
"0.50286937",
"0.5025835",
"0.5025835",
"0.5024425",
"0.50239295",
"0.50230324",
"0.50229853",
"0.501902",
"0.50138",
"0.5012985",
"0.50075847",
"0.5007269",
"0.5002632",
"0.4994324",
"0.4993442",
"0.49922165",
"0.4991721",
"0.4991081",
"0.49893844",
"0.49883768",
"0.49877554",
"0.49871555",
"0.49840972",
"0.49832538",
"0.49832046",
"0.49787283",
"0.49759814",
"0.49741793",
"0.49700588",
"0.49679288",
"0.4965761",
"0.49592713",
"0.49591634",
"0.49591634",
"0.49591634",
"0.49571532",
"0.4954288",
"0.49537927",
"0.49537927",
"0.49524447",
"0.49518645",
"0.49485213"
] | 0.0 | -1 |
this will work for set quit date, review consent, and sign out | def go_to(button)
find('.navbar-toggle').click unless has_css?('.glyphicon.glyphicon-cog')
find('.dropdown-toggle').click
find('.ng-binding', text: button).click
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_days_checkin(options = Hash.new)\n raise unless options[:date].present?\n options[:notify] ||= false\n options[:private] ||= false\n options[:share_twitter] ||= false\n options[:share_facebook] ||= false\n \n # Figure out what date we're answering questions for\n @todays_date = self.todays_date\n \n # Make sure we're finalizing a valid date\n if options[:date] <= @todays_date \n program_player = self.program_player\n \n # Post to Facebook Open Grap\n if facebook_oauth = program_player.user.oauth_for_site_token('facebook') and facebook_oauth.present?\n og_url = \"https://#{SECURE_DOMAIN}/store/program/#{program_player.program.token}\"\n facebook_oauth.save_graph_action('website', 'play', og_url)\n end \n \n # Only save an entry if there's at least 1 checkin, or a message, or they're sharing this.\n related_checkins = self.checkins.where(:date => options[:date])\n if related_checkins.present? or options[:message].present? or options[:share_twitter] or options[:share_facebook]\n \n # Come up with a default message for when no message is given (or should that happen on the fly?)\n original_message = options[:message]\n if options[:message].blank?\n options[:message_type] == 'checkin'\n options[:message] = \"I checked in to the #{self.program_player.program.name} program!\"\n elsif options[:message_type] == 'secret'\n if options[:message].length > 58\n options[:message] = \"My secret ingredient is #{options[:message]}\" \n else\n options[:message] = \"My secret ingredient for the #{self.program_player.program.name} program is #{options[:message]}\" \n end \n elsif options[:message_type] == 'nemesis'\n if options[:message].length > 68\n options[:message] = \"My nemesis is #{options[:message]}\" \n else\n options[:message] = \"My nemesis in the #{self.program_player.program.name} program is #{options[:message]}\" \n end\n end\n \n @entry_attributes = {:user_id => self.program_player.user_id,\n :program_id => self.program_player.program_id,\n :program_player_id => self.program_player_id,\n :program_budge_id => self.program_budge_id,\n :player_budge_id => self.id,\n :parent_id => nil,\n :location_context_id => (options[:location_context].present? ? options[:location_context].id : nil),\n :privacy_setting => (options[:private] ? 0 : 10),\n :message => options[:message],\n :message_type => options[:message_type],\n :original_message => original_message,\n :date => Time.zone.today.to_date,\n :post_to_coach => true,\n :post_to_twitter => options[:share_twitter],\n :post_to_facebook => options[:share_facebook]}\n\n @existing_entry = Entry.where(:user_id => self.program_player.user_id,\n :player_budge_id => self.id,\n :date => Time.zone.today.to_date).first\n if @existing_entry\n @existing_entry.update_attributes(@entry_attributes)\n @existing_entry.save_metadata\n @existing_entry.post_remotely\n else\n @entry = Entry.create(@entry_attributes)\n end\n end\n \n end\n return true\n end",
"def schedule_future_check_out(user, future_date)\n\n end",
"def user_consenting=(_arg0); end",
"def user_consenting; end",
"def confirmation_period_expired?; end",
"def confirmed?; end",
"def user_consenting?; end",
"def quit_params\n params.require(:quit).permit(:user_id, :length, :start_date, :substance, :investment, :partner_email)\n end",
"def survey_clicked\n @user = self.current_user \n @profile = @user.profile\n @profile.survey_clicked = true\n @profile.survey_clicked_date = DateTime.now\n @profile.save\n render :text=>\"\" \n end",
"def check_if_needs_approval\r\n self.suspended_at = Time.now if Setting.user_signup == :needs_approval && !self.admin\r\n end",
"def check_off(verifier)\n if verifier != self.workshifter || verifer.role === 'Workshift Manager' || verifier.role === 'Unit-Level Admin'\n self.verifier = verifier\n self.status = \"complete\"\n self.sign_off_time = Time.zone.now # NEEDS TO BE FIXED PROBABLY\n gen_next_assignment\n self.save!\n end\n end",
"def signout\n #Made changes to show feedback form at certain intervals as per discussion & also signout auditors gracefully\n #Author: Ashish Wadekar\n #Date: 16th February 2017\n if @current_user.auditor?\n logout_user\n elsif @current_user.login_count < 6 || @current_user.login_count % 50 == 0\n redirect_to login_logout_feedback_path\n else\n logout_user\n end\n end",
"def sepa\n mandate = @user.mandates.last\n if mandate.present? && mandate.ready?\n redirect_to_for_user_or_admin and return\n end\n redirect_to mandate.slimpay_approval_url and return if mandate && mandate.waiting?\n mandate = Mandate.sign(@user)\n if mandate.present?\n redirect_to mandate.slimpay_approval_url\n else\n redirect_to_for_user_or_admin(true)\n end\n end",
"def generate_invoices_status\n MorLog.my_debug \" ********* \\n for period #{session_from_date} - #{session_till_date}\"\n change_date\n MorLog.my_debug \"for period #{session_from_date} - #{session_till_date}\"\n\n unless params[:invoice]\n dont_be_so_smart\n redirect_to(:root) && (return false)\n end\n owner_id = correct_owner_id\n if params[:date_issue].present?\n issue_date = Time.mktime(params[:date_issue][:year],\n params[:date_issue][:month],\n params[:date_issue][:day])\n end\n\n type = %W[postpaid prepaid user].include?(params[:invoice][:type].downcase)? params[:invoice][:type] : 'postpaid'\n\n from_time = Time.parse(session_from_datetime_no_timezone)\n till_time = Time.parse(session_till_datetime_no_timezone)\n\n if type == 'user'\n @user = User.where(['users.id = ?', params[:s_user_id]]).first if params[:s_user_id]\n unless @user\n flash[:notice] = _('User_not_found')\n redirect_to(action: :generate_invoices) && (return false)\n end\n valid_period = validate_period_user(@user, till_time)\n else\n valid_period = validate_period(type, till_time)\n end\n\n redirect_to(action: :generate_invoices) && (return false) unless valid_period\n\n if from_time > till_time\n flash[:notice] = _('Date_from_greater_thant_date_till')\n redirect_to(action: :generate_invoices) && (return false)\n end\n\n invoice_type_confline = (type == 'prepaid' && (admin? || accountant?)) ? 'Prepaid_' : ''\n invoice_number_type = Confline.get_value(\"#{invoice_type_confline}Invoice_Number_Type\", owner_id).to_i\n\n unless [1, 2].include?(invoice_number_type)\n flash[:notice] = _('Please_set_invoice_params')\n usertype = session[:usertype].to_s\n unless accountant?\n if %w(reseller partner).include?(usertype)\n redirect_to(controller: 'functions', action: \"#{usertype}_settings\") && (return false)\n else\n redirect_to(controller: 'functions', action: 'settings') && (return false)\n end\n else\n redirect_to(action: 'generate_invoices') && (return false)\n end\n end\n BackgroundTask.create(\n task_id: 5,\n owner_id: owner_id,\n created_at: Time.now,\n status: 'WAITING',\n user_id: params[:s_user_id].present? ? params[:s_user_id].to_i : -2,\n data1: session_from_datetime_no_timezone,\n data2: session_till_datetime_no_timezone,\n data3: type,\n data4: issue_date.to_s,\n data5: params[:currency]\n )\n system(\"/usr/local/mor/mor_invoices elasticsearch &\")\n flash[:status] = _('bg_task_for_generating_invoice_successfully_created')\n if admin?\n redirect_to(controller: 'functions', action: 'background_tasks') && (return false)\n else\n redirect_to(action: 'invoices') && (return false)\n end\n end",
"def check_in()\n @due_date = nil\n end",
"def check_in()\n @due_date = nil\n end",
"def appeal_location_date_reset\n test_appeal_id = params[\"DISPATCH_ME\"][:vacols_id]\n if full_grant_ids.include?(test_appeal_id)\n decision_type = :full\n elsif partial_and_remand_ids.include?(test_appeal_id)\n decision_type = :partial\n else\n flash[:error] = \"#{test_appeal_id} is not a testable appeal!\"\n redirect_to action: \"index\"\n return\n end\n\n # Cancel existing EPs and reset the dates\n cancel_eps = params[\"DISPATCH_ME\"][:cancel_eps] == \"Yes\" ? true : false\n @dispatch_appeal = Appeal.find_or_create_by_vacols_id(test_appeal_id)\n TestDataService.prepare_claims_establishment!(vacols_id: @dispatch_appeal.vacols_id,\n cancel_eps: cancel_eps,\n decision_type: decision_type)\n redirect_to establish_claims_path\n end",
"def report_login(return_date=nil)\n self.return_date = return_date || Time.new\n save\n end",
"def configure_sign_in_params\n if !!current_end_user && current_end_user&.is_withdrawal != true #ユーザーが存在する場合(true)かつユーザーの退会フラグがfalseの時\n reset_session\n flash[:alert] = \"このアカウントは退会済みです。\"\n redirect_to request.referer\n end\n end",
"def set_expiration_date\n self.expiry_date = Date.today + 365.days\n end",
"def checkin\n if self.current_user == nil\n redirect_to \"/account/login\"\n end\n @workout = Workout.new\n @workout.workout_date = Time.now.to_date #.strftime(\"%x\")\n end",
"def generate_econsent_document\n @user_loan_app = self # used in the erb\n @user = self.app_user&.user\n @servicer = self.app_user&.servicer_profile\n loan_doc = nil # going to return this\n\n # for servicer submitted loan apps, the app user will be nil and we swon't have an app_user.servicer_profile. So skip generation.\n if @servicer.present?\n\n json = JSON.parse( self.loan_app_json )\n econsent_fields = econsent_fields_lookup\n\n #in multiphase loans, we nil out the submitted_at date. If we need to regenerate this, the date will be nil, so lets temporarily set it to the last log entry so\n # we can regenerate. We won't save it though.\n temporarily_set_submitted_at = false\n if self.submitted_at.nil?\n created_at = user_loan_app_logs.where(event: 'submit').last&.created_at\n self.submitted_at = created_at\n temporarily_set_submitted_at = true\n end\n\n if self.submitted_at.present? && !econsent_fields.empty? && econsent_fields[:borrower].present?\n\n @borrower_email = json[\"values\"][\"email\"].present? ? json[\"values\"][\"email\"] : @user.email\n @borrower_first_name = json[\"values\"][\"first_name\"].present? ? json[\"values\"][\"first_name\"]\n : json[\"values\"][\"borrower_first_name\"].present? ? json[\"values\"][\"borrower_first_name\"]\n : @user.name\n @borrower_last_name = json[\"values\"][\"last_name\"].present? ? json[\"values\"][\"last_name\"]\n : json[\"values\"][\"borrower_last_name\"].present? ? json[\"values\"][\"borrower_last_name\"]\n : @user.last_name\n\n @coborrower_first_name = json[\"values\"][\"coborrower_first_name\"]\n @coborrower_last_name = json[\"values\"][\"coborrower_last_name\"]\n @coborrower_email = json['values']['coborrower_email']\n\n @econsent_field = econsent_fields[:borrower]\n @coborrower_econsent_field = econsent_fields[:coborrower]\n\n @borrower_accepted = false\n if @econsent_field.present?\n @borrower_accepted = self.value_is_truthy(json[\"values\"][@econsent_field[\"key\"]])\n end\n\n @coborrower_accepted = false\n if @coborrower_econsent_field.present?\n @coborrower_accepted = self.value_is_truthy(json[\"values\"][@coborrower_econsent_field[\"key\"]])\n end\n\n\n begin\n econsent_erb = ERB.new(SystemSetting.econsent_template)\n econsent_html = econsent_erb.result(binding)\n Rails.logger.info \"[e-consent] going to html_to_pdf\"\n new_pdf = HtmlToPdf::html_to_pdf(econsent_html).force_encoding('utf-8')\n Rails.logger.info \"[e-consent] back from html_to_pdf\"\n hash = Digest::MD5.hexdigest(new_pdf)\n filename = \"E-Consent Document.pdf\"\n\n Rails.logger.info \"[e-consent] creating new loandoc\"\n loan_doc = LoanDoc.new\n loan_doc.app_user = self.app_user\n loan_doc.user = self.app_user&.user\n if self.owner_loan.present?\n loan_doc.owner = self.owner_loan\n else\n loan_doc.owner = self\n end\n loan_doc.name = filename\n loan_doc.status = 'los-import'\n loan_doc.doc_type = 'econsent'\n loan_doc.origin = 'system'\n loan_doc.fingerprint = hash\n loan_doc.save!\n Rails.logger.info \"[e-consent] saved new loan doc: #{loan_doc}\"\n\n\n # since we just saved the doc, force the read from the slave so we can guarantee we have the record\n ActiveRecordSlave.read_from_master do\n loan_doc.reload\n end\n\n begin\n Rails.logger.info \"[e-consent] #{loan_doc.guid} - #{self.guid} - reload new loan doc id: #{loan_doc.id}\"\n doc_name = \"#{loan_doc.guid}-#{filename}\"\n doc_file = FilelessIO.new(new_pdf)\n doc_file.original_filename = doc_name\n doc_file.content_type = MimeMagic.by_path(doc_name)\n loan_doc.image.store!(doc_file)\n loan_doc.save!\n Rails.logger.info \"[e-consent] #{loan_doc.guid} - #{self.guid} - saved new loan doc to s3: #{loan_doc.image_url}\"\n rescue => ex\n NewRelic::Agent.notice_error(ex)\n Rails.logger.error(\"[e-consent] #{loan_doc.guid} - #{self.guid} - #{ex}\")\n end\n\n if @servicer&.effective_loan_los.blank?\n SendEconsentDocToLoJob.perform_later(\n :sp_id => @servicer.id,\n :loan_doc_id => loan_doc.id\n )\n end\n rescue => ex\n NewRelic::Agent.notice_error(ex)\n Rails.logger.error ex.message + \"\\n\" + ex.backtrace.join(\"\\n\")\n end\n end\n if temporarily_set_submitted_at\n self.submitted_at = nil\n end\n end\n\n return loan_doc\n end",
"def save\n params = {}\n params[:signup_date] = signup_date if field_present?(signup_date)\n params[:return_date] = return_date if field_present?(return_date)\n params[:active] = active if field_present?(active)\n post_update(id, params)\n end",
"def confirmation_period_valid?; end",
"def\n check_in()\n @due_date = nil\n end",
"def logout\r\n return unless request.post?\r\n \r\n cookies.delete :journal_entry\r\n \r\n # Do not log out if the user did not press the \"Yes\" button\r\n #if params[:yes].nil?\r\n # redirect_to survey_start_url and return if current_user.login_user\r\n # redirect_to main_url and return\r\n #end\r\n \r\n # Otherwise delete the user from the session\r\n \t\tself.remove_user_from_session!\r\n \r\n flash[:notice] = \"Du er blevet logget ud.\"\r\n render file: 'start/finish' #redirect_to login_url\r\n end",
"def user_takeout\n\n check_for_signed_in_user_and_issues\n\n @personal_roll_export = :true\n\n unless @user_signed_in\n @custom_error = \"Sorry, you must be signed in to export your data.\"\n else\n @display_export_form = :true\n end\n\n render '/home/landing'\n end",
"def sign_up\n if @worksession.free == false\n respond_to do |format|\n format.html {\n flash[:notice] = 'Worksession is unavailable. Please choose another'\n redirect_to available_path\n }\n end\n else\n if !params[:notes].nil?\n @worksession.notes = params[:notes]\n end\n booking = Booking.create(user_id: @user.id, worksession_id: @worksession.id, notes: params[:notes])\n\n if Rails.env.production?\n url = URI.parse('http://worksessions-notifier.pierobotics.org/api/v0/signup/')\n else\n url = URI.parse('http://worksessions-notifier-staging.pierobotics.org/api/v0/signup/')\n end\n Net::HTTP.post_form(url, {\n 'notes' => booking.notes,\n 'date' => @worksession.date.strftime(\"%m/%d/%Y\"),\n 'start_time' => @worksession.begin_at.strftime(\"%I:%M %P\"),\n 'end_time' => @worksession.end_at.strftime(\"%I:%M %P\"),\n 'school' => @user.team_name,\n })\n\n # @worksession.users << @user\n if (@worksession.date.wday.between?(0, 1) and @worksession.users.size >= 8) or (@worksession.date.wday.between?(5, 6) and @worksession.users.size >= 4)\n @worksession.free = false\n @worksession.save\n end\n redirect_to available_path\n end\n\n end",
"def logout\r\n return unless request.post?\r\n\r\n cookies.delete :journal_entry\r\n\r\n # Do not log out if the user did not press the \"Yes\" button\r\n if params[:yes].nil?\r\n redirect_to survey_start_url and return if current_user.login_user\r\n redirect_to main_url and return\r\n end\r\n\r\n # Otherwise delete the user from the session\r\n\t\tself.remove_user_from_session!\r\n\r\n flash[:notice] = \"Du er blevet logget ud.\"\r\n redirect_to login_url\r\n end",
"def signup(signup_date=nil)\n self.signup_date = signup_date || Time.new\n save\n end",
"def do_user_takeout\n\n check_for_signed_in_user_and_issues\n\n @personal_roll_export = :true\n\n unless @user_signed_in\n @custom_error = \"Sorry, you must be signed in to export your data.\"\n else\n @display_export_form = :true\n if ((@export_to_email = params.delete(:email)) && (@export_to_email.length > 0))\n if (Shelby::API.export_user_public_roll(@signed_in_user['id'], @export_to_email, request.headers['HTTP_COOKIE']))\n @export_success = :true\n else\n @custom_error = \"Sorry, something went wrong. Please try again.\"\n end\n else\n @custom_error = \"Please enter your email address.\"\n end\n end\n\n render '/home/landing'\n end",
"def response_lifetime_date\n response_reset_date || CommitteeMember::DEFAULT_RESPONSE_LIFETIME.ago\n end",
"def set_dates \n if self.date_entered.nil?\n self.date_entered = Date.current\n end \n if self.shopping_date.nil?\n self.shopping_date = self.date_entered\n end\n return true\n end",
"def expiration_date\n end",
"def date_approval=(date)\n super parse_date(date)\n end",
"def execute_submit(form)\n # Logout\n user = ::GDO::User::GDO_User.current\n ::GDO::User::GDO_User.current = nil\n # Call event\n publish(:gdo_user_signed_out, user)\n # Build response\n success(t(:msg_signed_out))\n end",
"def cancel\n if !current_user.worksessions.include?(@worksession)\n respond_to do |format|\n format.html {\n redirect_to user_worksessions_path(params[:user_id]), notice: 'You cannot cancel a worksession you are not signed up for.'\n }\n format.json { render :show, status: :created, location: @worksession }\n end\n else\n @user.worksessions.delete(@worksession)\n @worksession.users.delete(@user)\n @user.save\n if (@worksession.date.wday.between?(0, 1) and @worksession.users.size < 8) or (@worksession.date.wday.between?(5, 6) and @worksession.users.size < 4)\n @worksession.free = true\n @worksession.save\n end\n redirect_to available_path(current_user)\n @worksession.save\n end\n end",
"def agree_to_copyright\n # Check whether user agreed to our terms/conditions\n if params[:agree_to_copyright]\n session[:agree_to_copyright] = true\n # Check whether or not UVa user and redirect as appropriate\n if params[:is_uva]\n if params[:is_uva] == 'yes'\n redirect_to uva_requests_url\n else\n redirect_to public_requests_url\n end\n else\n redirect_to requests_path, :notice => 'You must indicate whether or not you are affiliated with U.Va. to continue.'\n end\n else\n redirect_to requests_path, :notice => 'You must agree to the terms and conditions to continue.'\n end\n end",
"def complete_termination\n self.deleted_at = Time.now.utc\n self.end_date = Date.today\n end",
"def logout\n self.status = STATUS[:absent]\n self.logout_time = Time.zone.now\n self.access_token = nil\n self.expires = Time.zone.now.to_i - 60\n self.user_events.build(event_name: 'Logout', event_time: Time.zone.now)\n save\n end",
"def finish\n @rental = Rental.find(params['id'])\n authorize @rental, :finish?\n @rental.finish_date = Date.today\n if @rental.save\n redirect_to books_url, notice: 'Book was successfully returned'\n else\n redirect_to books_url, notice: 'Book could not be returned'\n end\n end",
"def signed_out\n @time = Time.now\n end",
"def test_ID_25840_edit_profile_resident_since\n login_as_user1\n go_to_edit_profile_page\n verify_day_can_only_be_selected_from_1_to_31 \"test_ID_25835_edit_profile_desc\", 1, 31\n verify_month_can_only_be_selected_from_Jan_to_Dec \"test_ID_25835_edit_profile_desc\", 1, 12\n time = Time.new\n verify_year_can_only_be_selected_from_1900_to_current_year \"test_ID_25835_edit_profile_desc\", \"1900\", \"#{time.year}\"\n verify_user_can_save_date \"March\",\"18\",\"1981\"\n verify_user_can_return_date_to_the_default \"Month\",\"Day\",\"Year\"\n verify_user_is_not_able_to_specify_only_the_month_drop_down \"March\",\"Day\",\"Year\"\n verify_user_is_not_able_to_specify_only_the_day_drop_down \"Month\",\"12\",\"Year\"\n #verify_user_is_not_able_to_specify_only_the_year_drop_down \"Month\",\"Day\",\"1970\" Bug\n end",
"def test03_EventCancel\n\t\tloginPost\n\t\t$browser.goto($patch_event)\n\t\t\t\n\t\t\tsleep 2\n\t\t\tif $post_pick_group.exists?\n \t\t\t\tpostGroupPop\n \t\t\t\t$post_event_title.set(\"Event #{random}\")\n \t\t\t\t$post_event_calendar_start_text.set(\"2013-12-12\") \n \t\t\t\t$post_event_time_start_field.click\n \t\t\t\t$post_event_select_time.select(\"8:00 AM\")\n \t\t\t\t$post_event_location.set(\"Location #{random}\")\n \t\t\t\t$browser.execute_script(\"jQuery('iframe.wysihtml5-sandbox').contents().find('body').prepend('Automated Text')\")\n\t\t\t\t$post_cancel.click\n\t\t\t\tsleep 2\n\t\t\telse puts \"PC01T03: FAILED! User able to cancel.\"\n\t\t\tend\n\t\t\t\n\t\tsleep 1\n\t\tif $post_cancel.exists?\n\t\t\tputs (\"PC01T06: FAILED! User unable to cancel.\")\n\t\t\telse nil\n\t\tend\n\tend",
"def remember_to_review\n if self.id and self.redeemed_at \n RunOncePeriodicJob.create!(:name => 'RememberToReview',\n :job => \"Credit.review_reminder(#{self.id})\",\n :next_run_at => (7.days.from_now)) unless self.redeemed_at.nil?\n end\n end",
"def release_notification\n @has_data = Settings.has_user_data\n @data = Settings.getSavedData\n \n #reset date. otherwise it's being shown all the time, once it's been set \n $choosed['1'] = nil\n end",
"def set_termination_date\n if effective_date and approved_details.try(:duration) and (effective_date_changed? or approved_details_id_changed?)\n self.termination_date = Date.new(\n effective_date.year + approved_details.duration,\n effective_date.month,\n effective_date.day )\n end\n end",
"def consent_revoked?\n !consent_revoked_at.nil?\n end",
"def cancel(*)\n super.tap do\n __debug_sim('USER has decided to withdraw the submission.')\n end\n end",
"def forgot_card\n { review_date: Date.today + 1, interval: 0, success_reviews: 0 }\n end",
"def better_to_confirm\n ! (self.confirmed && (((Time.zone.now - self.confirmed).to_i / 86400) < 365))\n end",
"def confirmed\n confirmed_date.present?\n end",
"def welcome_back\n @univ_choice = University.find(params[:univ_id])\n\n if request.post?\n\n begin \n params[:terms] = true # cust already accepted once!\n\n # find order\n #\n oo = Order.for_cust(@customer).for_univ(@univ_choice.id).last\n raise \"error - no #{@univ_choice.name} univ for customer #{@customer.email}!\" unless oo\n \n # set cc\n #\n card = CreditCard.secure_setup(params[\"credit_card\"], @customer)\n card_success = card.save\n raise \"problem w CC\" unless card_success\n \n # set addr\n #\n addr_success = private_addr_do\n raise \"problem w addr\" unless addr_success\n\n # test CC\n #\n charge_amount = 0.01\n success, msg = ChargeEngine.charge_credit_card(card, charge_amount, oo.id, \"test charge\") \n raise \"we tested your credit card and had a problem: #{msg}\" unless success\n \n # apply 1 month credit\n #\n @customer.add_account_credit(0, nil, 1) if @customer.credit_months <= 0\n\n # reenable univ\n #\n oo.reinstate\n\n session[:reinstated_univ_id] = oo.id\n return redirect_to :univstore_welcome_back_done, :flash => { :message => \"success!\" }\n\n rescue Exception => e\n\n return redirect_to :back, :flash => { :message => e.message }\n end\n end\n\n end",
"def registration_approval_required?; false; end",
"def create\n\n expire_action :action => [:shadyside, :south_side, :lawrenceville, :oakland, :bloomfield, :strip_district, :downtown]\n @event = current_user.events.build(event_params)\n #@event = Event.new(event_params)\n if @event.day == \"Weekdays\"\n @event.day = \"Monday\"\n @event_tue = current_user.events.build(event_params)\n @event_tue.day = \"Tuesday\"\n @event_wed = current_user.events.build(event_params)\n @event_wed.day = \"Wednesday\"\n @event_thu = current_user.events.build(event_params)\n @event_thu.day = \"Thursday\"\n @event_fri = current_user.events.build(event_params)\n @event_fri.day = \"Friday\"\n\n\n respond_to do |format|\n if @event.save && @event_tue.save && @event_wed.save && @event_thu.save && @event_fri.save\n #EventMailer.sample_email(current_user, @event).deliver\n\n Venue.where(id: @event.venue_id).first.update_attribute(:venue_verify, Time.now)\n format.html { redirect_to Venue.where(id: @event.venue_id).first, notice: 'Hour was successfully created.' }\n format.json { head :no_content }\n format.js { render :layout => false }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n elsif @event.day == \"Everyday\"\n @event.day = \"Monday\"\n @event_tue = current_user.events.build(event_params)\n @event_tue.day = \"Tuesday\"\n @event_wed = current_user.events.build(event_params)\n @event_wed.day = \"Wednesday\"\n @event_thu = current_user.events.build(event_params)\n @event_thu.day = \"Thursday\"\n @event_fri = current_user.events.build(event_params)\n @event_fri.day = \"Friday\"\n @event_sat = current_user.events.build(event_params)\n @event_sat.day = \"Saturday\"\n @event_sun = current_user.events.build(event_params)\n @event_sun.day = \"Sunday\"\n\n\n respond_to do |format|\n if @event.save && @event_tue.save && @event_wed.save && @event_thu.save && @event_fri.save && @event_sat.save && @event_sun.save\n #EventMailer.sample_email(current_user, @event).deliver\n\n Venue.where(id: @event.venue_id).first.update_attribute(:venue_verify, Time.now)\n format.html { redirect_to Venue.where(id: @event.venue_id).first, notice: 'Hour was successfully created.' }\n format.json { head :no_content }\n format.js { render :layout => false } \n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n elsif @event.day == \"Weekend\"\n @event_sat = current_user.events.build(event_params)\n @event_sat.day = \"Saturday\"\n @event_sun = current_user.events.build(event_params)\n @event_sun.day = \"Sunday\"\n\n respond_to do |format|\n if @event.save && @event_sun.save\n #EventMailer.sample_email(current_user, @event).deliver\n\n Venue.where(id: @event.venue_id).first.update_attribute(:venue_verify, Time.now)\n format.html { redirect_to Venue.where(id: @event.venue_id).first, notice: 'Hour was successfully created.' }\n format.json { head :no_content }\n format.js { render :layout => false }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n if @event.save\n #EventMailer.sample_email(current_user, @event).deliver\n\n Venue.where(id: @event.venue_id).first.update_attribute(:venue_verify, Time.now)\n format.html { redirect_to Venue.where(id: @event.venue_id).first, notice: 'Hour was successfully created.' }\n format.json { head :no_content }\n format.js { render :layout => false }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def reviewoftheday\n @review = Rails.env.development? ? Review.first : Review.where(review_of_the_day: Date.today).first\n if params[:number_of_clicks]\n \tif params[:tipo] == \"iframe\"\n \t\t@review.number_of_iframe_clicks += params[:number_of_clicks].to_i\n\t \t@review.save!\n\t elsif params[:tipo] == \"home\"\n\t \t@review.number_of_home_clicks += params[:number_of_clicks].to_i\n\t \t@review.save!\n \tend\n end\n\n expires_in 6.hours\n fresh_when @review\n\n end",
"def set_expiring_date\n # p \"-------------------\"\n # p date = ((self.purchase_date+11) - Date.today).to_i\n # p \"-------------------\"\n if self.tag_list == [\"Fruits\"]\n self.update!(expire_date: (self.purchase_date + 6))\n elsif self.tag_list == [\"Meat\"]\n self.update!(expire_date: (self.purchase_date + 3))\n elsif self.tag_list == [\"Seafood\"]\n self.update!(expire_date: (self.purchase_date + 3))\n elsif self.tag_list == [\"Veggies\"]\n self.update!(expire_date: (self.purchase_date + 4))\n elsif self.tag_list == [\"Dairy\"]\n self.update!(expire_date: (self.purchase_date + 5))\n elsif self.tag_list == [\"Condiments\"]\n self.update!(expire_date: (self.purchase_date + 10))\n elsif self.tag_list == [\"Eggs\"]\n self.update!(expire_date: (self.purchase_date + 14))\n end\n end",
"def check_dates\n if(self.d_publish.nil?) && (self.d_remove.nil?)\n self.d_remove = \"2094-03-25\"\n self.d_publish = Time.zone.today\n elsif(self.d_publish?)\n self.d_remove = \"2094-03-25\"\n elsif(self.d_remove?)\n self.d_publish = Time.zone.today\n end\n end",
"def add_event\n clear\n puts \"\\n===== DELETE EVENT OPTION =====\"\n description = prompt(\"Enter new event description\")\n location = prompt(\"Enter a location of your event\")\n start = prompt(\"Enter start date and time in YYYY/MM/DD HH:MM\")\n end_event = prompt(\"Enter end date and time in YYYY/MM/DD HH:MM\")\n\n new_event = Event.create({description: description, location: location, start: start, :end => end_event, :calendar_id => })\n # if new_event.future_check.first == \"End time must be before start time\"\n # puts \"#{new_event.future_check.first}\"\n # sleep(2)\n # add_event\n # else\n puts \"'#{new_event.description}' at #{new_event.location} has been saved in your calendar\"\n main_menu\n # end\nend",
"def test_bp_cancel_entitlement_with_requested_date_in_future_ent_only\n bp = create_entitlement_base(@account.account_id, 'Sports', 'MONTHLY', 'DEFAULT', @user, @options)\n check_entitlement(bp, 'Sports', 'BASE', 'MONTHLY', 'DEFAULT', DEFAULT_KB_INIT_DATE, nil)\n\n # Move clock after the trial to have a CTD\n kb_clock_add_days(31, nil, @options)\n\n # Cancel BP in trial with no arguments\n requested_date = '2013-09-15'\n entitlement_policy = nil\n billing_policy = nil\n use_requested_date_for_billing = false\n\n bp.cancel(@user, nil, nil, requested_date, entitlement_policy, billing_policy, use_requested_date_for_billing, @options)\n\n canceled_bp = get_subscription(bp.subscription_id, @options)\n check_subscription(canceled_bp, 'Sports', 'BASE', 'MONTHLY', 'DEFAULT', DEFAULT_KB_INIT_DATE, requested_date, DEFAULT_KB_INIT_DATE, '2013-09-30')\n end",
"def sign_approval\n approval = params[:approval]\n approval_by = \"#{approval}_by\"\n approval_date = \"#{approval}_date\"\n @return[approval_by] = current_user.id\n @return[approval_date] = Time.now\n if @return.save\n respond_to do |format|\n format.js {}\n end\n end\n end",
"def unrevoke_consent!\n update(consent_revoked_at: nil)\n end",
"def autogradeDone(dave,submission,feedback)\n autogradeModule = UserModule.load(\"Autograde\",@assessment.id)\n # Get the key from the dave value used in the url,\n # then use the key to get the submission\n # daveNum = autogradeModule.getByVal(\"dave_key\",dave) \n #if (daveNum == nil) then\n # return #TODO: this should do something\n # end\n # userVersion = autogradeModule.get(\"dave_user\",daveNum)\n \n @user = submission.course_user_datum.user\n\n assessmentDir = File.join(AUTOCONFIG_COURSE_DIR, submission.course_user_datum.course.name, submission.assessment.name)\n\n filename = @submission.course_user_datum.email + \"_\" + \n @submission.version.to_s + \"_\" +\n @assessment.name + \"_\" +\n \"autograde.txt\"\n\n feedbackFile = File.join(assessmentDir, @assessment.handin_directory, filename)\n COURSE_LOGGER.log(\"Looking for Feedbackfile:\" + feedbackFile)\n\n submission = Submission.find(submission)\n\n begin\n f = File.open(feedbackFile, \"w\")\n f.write(feedback)\n ensure\n f.close unless f.nil?\n end\n \n saveAutograde(submission,feedbackFile)\n \n # Now remove the entries and file\n # autogradeModule.delete(\"dave_key\", daveNum)\n # autogradeModule.delete(\"dave_user\", daveNum)\n\n end",
"def update\n puts params\n @question = Question.find(params[:id])\n if params[:commit] == 'Answer'\n @question.resolved = true\n @question.end_time = Time.now\n @question.username = current_user.email.split('@')[0]\n if @question.update(update_question_params)\n redirect_to solve_path\n end\n end\n\n if params[:commit] == 'Escalate'\n @question.escalated = true\n @escalate = @question.escalatings.create();\n @question.save\n @escalate.username = current_user.email.split('@')[0]\n @escalate.save\n redirect_to solve_path\n end \n \n end",
"def check_out\n rental = Rental.new(movie: @movie, customer: @customer, due_date: params[:due_date])\n\n if rental.save\n render status: :ok, json: {}\n else\n render status: :bad_request, json: { errors: rental.errors.messages }\n end\n end",
"def create\n end_date = params[:survey][:end_date]\n @survey = current_space.surveys.new(survey_params)\n @survey.end_date = customized_date\n @survey.admin = current_user\n\n respond_to do |format|\n if @survey.save\n format.html { redirect_to edit_survey_path(id: @survey.id), info: t('surveys.add') }\n format.json { render :show, status: :created, location: @survey }\n else\n format.html { redirect_to create_a_survey_path, danger: @survey.errors.full_messages }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def release_on_approval\n super == 'true'\n end",
"def cancel(**options)\n if pay_subscription.on_trial?\n pay_subscription.update(ends_at: pay_subscription.trial_ends_at)\n else\n pay_subscription.update(ends_at: Time.current.end_of_month)\n end\n end",
"def shiftsignup2\n if current_member.can_admin_calendar?\n @today = Date.today\n oldestdate = @today - 3.days\n formdate = params[:received].nil? ? @today : params[:received].to_date\n shiftdate = params[:shiftdate].nil? ? nil : params[:shiftdate].to_date\n if shiftdate && formdate >= oldestdate && shiftdate >= oldestdate\n @caldate = shiftdate\n @shifts = Shift.find_all_in_day(@caldate, false)\n check_and_change_shift(1, params[:s1_emt1], params[:s1_emt2], params[:s1_d])\n check_and_change_shift(2, params[:s2_emt1], params[:s2_emt2], params[:s2_d])\n check_and_change_shift(3, params[:s3_emt1], params[:s3_emt2], params[:s3_d])\n check_and_change_shift(4, params[:s4_emt1], params[:s4_emt2], params[:s4_d])\n end\n redirect_to :action => 'index', :thedate => shiftdate.to_s\n else\n render_forbidden\n end\n end",
"def dfp_date_used()\n @credential_handler.include_in_user_agent(\"DfpDate\")\n end",
"def set_finance\r\n end",
"def set_admitted!\n if remote?\n update(admitted: true, start_date: Date.today.to_datetime, \n graduation_date: (Date.today + 1.month).to_datetime, remaining_mentor_sessions: 4, \n bootstrap_access: true, ruby_access: true)\n elsif immersive?\n update(admitted: true, start_date: Date.today.to_datetime, \n graduation_date: (Date.today + 2.month).to_datetime, bootstrap_access: true, ruby_access: true)\n end\n end",
"def confirmed=(val)\n self.confirmed_date = (val && val != \"false\") ? confirmed_date || DateTime.now : nil\n end",
"def assign_trial_end_date\n self.trial_end_date = 2.weeks.from_now\n save!\n end",
"def done_req_to_del\n\n return if self.status != Team::STATUS_DEACTIVATED\n\n class << self\n def record_timestamps; false; end\n end\n\n attrs = ActionController::Parameters.new({req_to_del_at: Time.now})\n self.update_attributes(attrs.permit(Team::PERMIT_BASE))\n\n class << self\n remove_method :record_timestamps\n end\n end",
"def set_project_end_date\n if state_was == STATE['Completed']\n end_date = nil\n active = true\n else\n active = false\n end_date = Date.current\n end\n end",
"def fortune_cookie; end",
"def sign_in\n \n user = nil \n \n #session[:cas_user] = \"testguy\"\n \n # Check if the user has signed in with CAS\n if session[:cas_user].present?\n email = session[:cas_user] + \"@purdue.edu\"\n user = StudyUser.find_user_by_email( email ) \n end\n \n # Sign in the user\n testing_enabled_today = TestMeta.test_enabled_today?\n if user and testing_enabled_today\n session[:user] = user.id\n redirect_to welcome_test_index_path\n else\n flash[:user_does_not_exist] = true unless user\n redirect_to root_path\n end \n end",
"def save_advance_rank_safety(actual, clicked, date)\n if actual.to_i == 1 \n case clicked.to_i\n when 2\n session[:aforo] = 0\n else\n session[:aforo] = date\n end\n end\n end",
"def create\n @user = User.new(user_params)\n @meal_dates = [\"2013-07-08\",\"2013-07-09\",\"2013-07-10\",\"2013-07-11\",\"2013-07-12\",\"2013-07-13\",\"2013-07-14\"]\n @programs = Program.all\n start = DateTime.new(2013,7,10,0,0,0)\n finish = DateTime.new(2013,7,12,0,0,0)\n @range = start..finish\n respond_to do |format|\n if @user.save\n session[:user_id] = @user.id\n UserMailer.confirmation_email(@user).deliver\n\n format.html { redirect_to @user, notice: t('user_created') }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def setup_preapproval\n api.execute :Preapproval, preapproval_payment_options\nend",
"def set_defaults\n\t\tself.start_date ||= (Date.today - 6.days)\n\tend",
"def check_out(due_date)\n @due_date = due_date\n end",
"def create\n @event_sign_in = EventSignIn.new(event_sign_in_params)\n @event_sign_in.event_date = Time.now\n\n respond_to do |format|\n if @event_sign_in.save\n format.html { redirect_to @event_sign_in, notice: 'Event sign in was successfully created.' }\n format.json { render :show, status: :created, location: @event_sign_in }\n else\n format.html { render :new }\n format.json { render json: @event_sign_in.errors, status: :unprocessable_entity }\n end\n end\n end",
"def confirm!\n update_attribute('portal_last_confirm_date__c', Time.now)\n settings.update_attribute('token',generate_token)\n end",
"def set_and_authorize_due_date\n @due_date = policy_scope(DueDate).find(params[:id])\n authorize @due_date\n end",
"def after_update_challenge\n send_email_after_canceled_reactive\n send_email_after_change_start_date\n end",
"def sign_out\n @request.env[:clearance].sign_out\n end",
"def after_remembered\n end",
"def enter_end_date(test_data)\n hide_notifications_bar\n wait_for_element_and_type(end_date_input, test_data[UseOfCollections::END_DATE.name])\n hit_enter\n end",
"def quit_date_eng\n @quit_date_eng ||= Participants::QuitDate.new(locale: 'english')\nend",
"def destroy\n self.current_checkin.touch :checked_out_at\n redirect_to :root\n end",
"def select_subscription_period\n set_user_input\n if @user_input == 0\n @session.update_attributes(subscription_id: nil)\n @response = Registration.subscription_selection(@screen_id)\n else\n @subscription = Subscription.find_by_ussd_id(@user_input)\n if @subscription\n @session.update_attributes(subscription_id: @subscription.id, req_no: @req_no)\n @response = Registration.question_type_selection(@screen_id)\n else\n @response = Error.invalid_subscription_period(@screen_id)\n end\n end\n end",
"def check_user_account!\n if(current_user.present? && (current_user.service_type == 'pending' || !current_user.is_active?))\n service_type = current_user.service_type\n sign_out(current_user)\n redirect_to root_path, :flash => {:notice => \"Your account is in waiting list for approval by Aa Express Staff.You will be notified when your account is ready.\"} and return if service_type == 'pending'\n redirect_to root_path, :flash => {:notice => \"Your account is de-activated by Aa Express Staff, please contact to Aa Express Staff for account activation.\"}\n end\n end",
"def update\n \t\t@start_date=Date.new(system_renewal_params[\"start_date(1i)\"].to_i,system_renewal_params[\"start_date(2i)\"].to_i,system_renewal_params[\"start_date(3i)\"].to_i)\n @end_date=Date.new(system_renewal_params[\"end_date(1i)\"].to_i,system_renewal_params[\"end_date(2i)\"].to_i,system_renewal_params[\"end_date(3i)\"].to_i)\n\t\t\n\t\t@start_date_google=system_renewal_params[\"start_date(1i)\"].to_s + '-' + system_renewal_params[\"start_date(2i)\"].to_s + '-' + system_renewal_params[\"start_date(3i)\"].to_s + 'T10:00:52-05:00'\n\t\t@end_date_google=system_renewal_params[\"end_date(1i)\"].to_s + '-' + system_renewal_params[\"end_date(2i)\"].to_s + '-' + system_renewal_params[\"end_date(3i)\"].to_s + 'T10:00:52-05:00'\n\t renovacion = System::Renewal.find(params[:id])\n \n x=renovacion.contract\n\t\tputs 'aki va el ID del calendariooooooooooooooooooooooooooooooooooooooooo'\n\t\tputs System::Renewal.find(params[:id]).google_event_start\n\t\tputs 'aki termina el ID del calendariooooooooooooooooooooooooooooooooooooooooo'\n\t\tSystem::Renewal.event_update(@start_date_google,@start_date_google,x.description,'neuro',System::Renewal.find(params[:id]).google_event_start)\n\t\tSystem::Renewal.event_update(@end_date_google,@end_date_google,x.description,'neuro',System::Renewal.find(params[:id]).google_event_end)\n\n \n @email = renovacion.contract.supplier.email\n @system_contract = renovacion.contract\n \n System::Renewal.delayed_event_delete(System::Renewal.find(params[:id]).delayed_id_start)\n System::Renewal.delayed_event_delete(System::Renewal.find(params[:id]).delayed_id_end)\n \n if params[:notification_date].nil?\n file_yaml = YAML.load_file \"#{Rails.root}/config/config.yml\"\n @before_days = file_yaml[\"production\"]['notification_time'].to_i.days\n else\n @before_days = params[:notification_date].to_i.days\n end\n \n @recordar1 = @start_date - @before_days\n @recordar2 = @start_date - @before_days\n \n @email_departamento = @system_contract.device.location.email \n array_mailer = [@email, @email_departamento]\n \n @delayed_id_start = ApplicationMailer.delay(run_at: @recordar1).send_mail(array_mailer, @system_contract,'update_renewal', @start_date, @end_date)\n @delayed_id_end = ApplicationMailer.delay(run_at: @recordar2).send_mail(array_mailer, @system_contract,'update_renewal', @start_date, @end_date)\n \n \n respond_to do |format|\n if @system_renewal.update(contract_id: x.id, start_date: @start_date, end_date: @end_date, monto: system_renewal_params[:monto], delayed_id_start: @delayed_id_start.id, delayed_id_end: @delayed_id_end.id)\n format.html { redirect_to @system_renewal, notice: 'Renewal was successfully updated.' }\n format.json { render :show, status: :ok, location: @system_renewal }\n format.js { redirect_to @system_renewal, notice: 'Renewal was successfully updated.' }\n else\n format.html { render :edit }\n format.json { render json: @system_renewal.errors, status: :unprocessable_entity }\n format.js { render :edit }\n end\n end\n end",
"def handle_unverified_request\n employee_sign_out\n company_sign_out\n super\n end",
"def finalise(_ = nil)\n self.submitted_at = Time.zone.now\n current_answers.select(&:attempting?).each(&:finalise!)\n\n assign_zero_experience_points if assessment.questions.empty?\n end",
"def set_dates(start_date = nil, end_date = nil)\n\n\t if (start_date.nil? and not end_date.nil?)\n\n\t\t start_date = (@utils.get_date_object(end_date)) - (MAX_HISTORICAL_DAYS * (24 * 60 * 60))\n\n\t\t @start_date = start_date.to_s\n\t\t @end_date = end_date.to_s\n\n\t elsif (not start_date.nil? and end_date.nil?)\n\n\t\t end_date =(@utils.get_date_object(start_date)) + (MAX_HISTORICAL_DAYS * (24 * 60 * 60))\n\n\t\t if end_date > Time.new.utc\n\t\t\tend_date = nil #Let API default to Now.\n\t\t end\n\n\t\t @start_date = start_date.to_s\n\t\t @end_date = end_date.to_s if not end_date.nil?\n\n\t end\n end",
"def choose_dates\n authorize! :choose_dates, :Reservation\n\n if(session[:rental_category_id].nil?)\n redirect_to shopping_path\n end\n\n @start_date = Date.today.next_month.beginning_of_month\n\n # pick_up_dates is the first full week of next month starting from the first weekday\n @pick_up_start_date = @start_date\n @pick_up_start_date += 1.days until @pick_up_start_date.wday == 1 # wday 1 is monday, etc.\n @pick_up_dates = @pick_up_start_date..(@pick_up_start_date + 5.days)\n\n # return_dates is the last full week of next month ending on the last weekday\n @return_end_date = Date.today.next_month.end_of_month\n @return_end_date -= 1.days until @return_end_date.wday == 1 # wday 1 is monday, etc.\n @return_dates = (@return_end_date)..(@return_end_date + 5.days)\n @end_date = @return_dates.last\n end",
"def test02_post_event_outside_home_TC_27491\t\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_flatiron_event_new)\n\t\n\t\t$post_event_title.when_present.set(\"Super fun run #{random}\")\n \t\t$post_event_calendar_start_text.when_present.set(\"#{next_year}-09-03\") \n \t\t$post_event_time_start_field.when_present.click\n \t\t$post_event_select_time.when_present.select(\"8:00 AM\")\n \t\t$post_event_location.when_present.set(\"Location #{random}\")\n \t\t$browser.execute_script(\"jQuery('iframe.wysihtml5-sandbox').contents().find('body').prepend('lava is hot.')\")\n\t\tsleep 4\n\t\t$post_now_event.fire_event(\"onclick\")\n\t\tsleep 3\n\t\tassert $post_edit_post.exists?\n\tend",
"def send_email_request_cancelled\n send_email_request_approved\n end"
] | [
"0.5892683",
"0.5649029",
"0.56375986",
"0.54219",
"0.5409681",
"0.5395786",
"0.538308",
"0.53477335",
"0.53390795",
"0.53245574",
"0.53098416",
"0.5299804",
"0.5293742",
"0.5287283",
"0.52549624",
"0.52549624",
"0.52306736",
"0.5189639",
"0.5184601",
"0.5183032",
"0.51772493",
"0.5173926",
"0.5153864",
"0.51417154",
"0.5141265",
"0.513783",
"0.513647",
"0.5134546",
"0.51265794",
"0.5096779",
"0.50889236",
"0.50888306",
"0.5071697",
"0.5071277",
"0.5064495",
"0.5056423",
"0.50542516",
"0.5054091",
"0.5047913",
"0.504538",
"0.50448114",
"0.5036603",
"0.5024526",
"0.5021439",
"0.5019938",
"0.50198567",
"0.5019031",
"0.50052994",
"0.5004885",
"0.49913633",
"0.49840677",
"0.498028",
"0.49718896",
"0.49648374",
"0.49601567",
"0.4956725",
"0.49540123",
"0.49498206",
"0.49487913",
"0.49486038",
"0.49465522",
"0.49412516",
"0.4937722",
"0.49367145",
"0.49366006",
"0.49332774",
"0.49302167",
"0.49289322",
"0.49213052",
"0.49179682",
"0.49175468",
"0.4912753",
"0.49036688",
"0.48988637",
"0.48911613",
"0.4891003",
"0.48882297",
"0.4885532",
"0.4883603",
"0.48826298",
"0.48803255",
"0.48803177",
"0.48616254",
"0.48589998",
"0.48575515",
"0.4854726",
"0.48538813",
"0.4853375",
"0.4845983",
"0.4844444",
"0.48440504",
"0.48436135",
"0.4840853",
"0.48401532",
"0.48393166",
"0.4837982",
"0.48372072",
"0.4835418",
"0.48336717",
"0.4831069",
"0.48288253"
] | 0.0 | -1 |
This will only work for switching languages | def switch_language
language = locale('Español', 'English')
go_to language
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def language; end",
"def language; end",
"def language; end",
"def language; end",
"def lang(orig); end",
"def lang; end",
"def lang; end",
"def lang; end",
"def lang; end",
"def language_server; end",
"def verificar_locale\n \n end",
"def select_language\n I18n.backend.send(:init_translations) unless I18n.backend.initialized?\n lang = PatientHelper.languages(primary_language)&.dig(:code)&.to_sym || :en\n lang = :en unless %i[en es es-PR so fr].include?(lang)\n lang\n end",
"def change_lang\n eng = :en\n jap = :ja\n if I18n.locale == eng\n params[:locale] = :ja\n I18n.locale = :ja\n elsif I18n.locale == jap\n params[:locale] = :en\n I18n.locale = :en\n end\n end",
"def language_client; end",
"def apply_locale; end",
"def set_language\n params[:lang] ||= 'en'\n Localization.use params[:lang]\n end",
"def do_change_lang\n language = $document.at_css('#tryruby-lang-select').value\n $document.root['lang'] = language\n set_cookie('tryruby_nl_language', language)\n get_content_from_server(language)\n end",
"def language \n \"language\" \n end",
"def lang=(_arg0); end",
"def lang=(_arg0); end",
"def language=(lang)\n case\n when lang==\"ENG\" then self.ENU=true; self.ENG=true; self.SPM=false; self.SPE=false; self.FRC=false; self.FRF=false; self.ITI=false; self.DUN=false; self.GED=false\n when lang==\"SPE\" then self.ENU=false; self.ENG=false; self.SPM=true; self.SPE=true; self.FRC=false; self.FRF=false; self.ITI=false; self.DUN=false; self.GED=false\n when lang==\"FRF\" then self.ENU=false; self.ENG=false; self.SPM=false; self.SPE=false; self.FRC=true; self.FRF=true; self.ITI=false; self.DUN=false; self.GED=false\n when lang==\"ITI\" then self.ENU=false; self.ENG=false; self.SPM=false; self.SPE=false; self.FRC=false; self.FRF=false; self.ITI=true; self.DUN=false; self.GED=false\n when lang==\"DUN\" then self.ENU=false; self.ENG=false; self.SPM=false; self.SPE=false; self.FRC=false; self.FRF=false; self.ITI=false; self.DUN=true; self.GED=false\n when lang==\"GED\" then self.ENU=false; self.ENG=false; self.SPM=false; self.SPE=false; self.FRC=false; self.FRF=false; self.ITI=false; self.DUN=false; self.GED=true\n end\n end",
"def set_language\n I18n.locale = params[:locale] || I18n.default_locale\n @lang = Wzs::Multilang::get_language(I18n.locale)\n end",
"def translit_non_latin_lang(lang)\n case lang\n when \"ar\",\"ru\",\"el\"\n self.translit\n else\n self\n end\n end",
"def on_load_language; load_language('lang/login'); end",
"def set_language\r\n session[:language] = 'english'\r\n end",
"def lang_switcher\n I18n.available_locales.each do |loc|\n locale_param = request.path == root_path ? root_path(locale: loc) : params.merge(locale: loc)\n if I18n.locale != loc\n concat content_tag(:li, (link_to I18n.t(\"l#{loc}\"), locale_param), class: nil)\n end\n end\n end",
"def set_locale\n end",
"def language\n return 'en' if code == \"ind2:0\"\n \n return 'se' if code == \"ind2:4\"\n\n return nil\n end",
"def language\n self\n end",
"def set_language\n self.language = I18n.locale.to_s unless self.language.present?\n end",
"def set_lang(lang)\n\t\t\tlang = 'en' unless languages.include? lang\n\t\t\t@lang = lang.to_sym\n\t\tend",
"def operate_switch_language(code)\n #callback(:before_switch_language)\n @translation_cache = {} if @translation_cache.nil?\n facet_names = self.class.globalize_facets\n @translation_cache[language_code] = @attributes.dup.delete_if {|key, value| !facet_names.include? key.to_sym}\n Locale.switch(code) do\n set_original_language\n if @translation_cache.include? code\n @attributes.update @translation_cache[code]\n elsif @original_language == Locale.base_language and !@new_record\n reload\n elsif !@new_record\n trs = ModelTranslation.find(:all, \n :conditions => [ \"table_name = ? AND item_id = ? AND language_id = ? AND \" +\n \"facet IN (#{[ '?' ] * facet_names.size * ', '})\", self.class.table_name,\n self.id, @original_language.id ] + facet_names.map {|facet| facet.to_s} )\n trs ||= []\n trs.each do |tr|\n attr = tr.text || base[tr.facet.to_s]\n write_attribute( tr.facet, attr )\n end\n end\n \n operate_switch_language_on_associations(code)\n \n #callback(:after_switch_language)\n end\n end",
"def lang\n # get current page url hash\n back_hash = Rails.application.routes.recognize_path request.referer\n Rails.logger.debug(\"original back_hash: #{back_hash.inspect}\")\n # change the locale code in the current page url hash\n back_hash[:locale] = @locale_code\n Rails.logger.debug(\"redirect to: #{back_hash.inspect}\")\n # see current page in new locale!\n redirect_to back_hash\n end",
"def set_language\n @lecture.update(locale: I18n.default_locale.to_s)\n end",
"def set_current_language(lang)\n GetText.locale, prev_value = sanitize_lang(lang), GetText.locale\n prev_value\n end",
"def set_language_from\n session[:lang_from] = params[:lang].to_sym\n I18n.locale = session[:lang_from]\n render nothing: true\n end",
"def language\n case \n when self.ENU || self.ENG then \"ENG\"\n when self.SPM || self.SPE then \"SPE\"\n when self.FRC || self.FRF then \"FRF\"\n when self.ITI then \"ITI\"\n when self.DUN then \"DUN\"\n when self.GED then \"GED\"\n end\n end",
"def specifyLanguage\n l = Language.all\n l_list = []\n l.each do |language|\n l_list << language.abbreviation\n end\n if (user_signed_in?)\n @languageSelected = current_user.language\n elsif (cookies.has_key?(:language) && l_list.include?(cookies[:language]))\n @languageSelected = cookies[:language]\n else\n @languageSelected = \"EN\"\n cookies[:language] = \"EN\"\n end\n end",
"def language_switch\n content_tag(:ul, id: 'switch') do\n I18n.available_locales.each do |loc|\n locale_param = request.path == root_path ? root_path(locale: loc) : params.merge(locale: loc).permit!\n concat content_tag(:li, (link_to I18n.t(:language, locale: loc), locale_param), class: (I18n.locale == loc ? \"active\" : \"\"))\n end\n end\n end",
"def translations; end",
"def set_locale\n #logger.debug \"* Accept-Language: #{request.env['HTTP_ACCEPT_LANGUAGE']}\"\n #logger.debug request.env['HTTP_ACCEPT_LANGUAGE']\n\n if session[:default_locale] != nil\n I18n.locale = (session[:default_locale]).to_sym\n mapping_locale_to_area\n return\n end\n\n logger.debug \"'#{I18n.locale}'\"\n\n I18n.locale = extract_locale_from_accept_language_header\n\n logger.debug \"'#{I18n.locale}'\"\n\n if I18n.locale == :\"zh\"\n \n logger.debug env['HTTP_ACCEPT_LANGUAGE'][3]\n # Ealin: 84 == 'T' (特別處理: zh_TW)\n if env['HTTP_ACCEPT_LANGUAGE'][3] == 84 || env['HTTP_ACCEPT_LANGUAGE'][3] == 116 || \\\n env['HTTP_ACCEPT_LANGUAGE'][3] == 'T' || env['HTTP_ACCEPT_LANGUAGE'][3] == 't'\n\n #\n # Ealin: 避免繁體與簡體可能混淆, 將繁體的locale name設為zh_tw\n #\n I18n.locale = :zh_tw\n end\n end\n\n # save mapped area to session[:default_area]\n mapping_locale_to_area\n \n #logger.debug I18n.locale.length\n #logger.debug \"* Locale set to '#{I18n.locale}'\"\n end",
"def set_locale\n #I18n.locale = params[:lang] ? params[:lang] : I18n.default_locale\n end",
"def switch_language\n I18n.locale = params[:lang]\n session[:lang] = params[:lang]\n respond_to do |f|\n f.js \n f.html\n end\n end",
"def set_website_locale\n app_locales = %w(es ca)\n I18n.locale = params[:lang] if app_locales.include?(params[:lang])\n end",
"def locale_switch_link(language)\n path = request.original_fullpath\n if params.to_unsafe_h.include? 'locale'\n path.gsub(%r{locale=#{I18n.locale}}, \"locale=#{language}\")\n elsif request.query_parameters.empty?\n path + \"?locale=#{language}\"\n else\n path + \"&locale=#{language}\"\n end\n end",
"def detect_language\n self.language = LanguageDetector.new(self).detect\n end",
"def set_language\n return if request.fullpath.match(/^\\/(\\S+)preview/)\n unless current_user.nil?\n I18n.locale = current_user.language\n end\n I18n.locale = session[:lang] if session[:lang]\n end",
"def hello_world language\n if language == \"es\"\n puts \"Hola, Mundo\"\n elsif language == \"de\"\n puts \"Hallo Welt\"\n elsif language == \"ru\"\n puts \"Privet, mir\"\n elsif language == \"ja\"\n puts \"Kon'nichiwa sekai\"\n else\n puts \"Hello, World\"\n end\nend",
"def set_locale\n \n #raise \"params[:locale] = #{params[:locale].present?}\"\n #raise \"params[:locale] = #{params[:locale].blank?}\"\n # Se non ho assegnato il parametro :locale allora gli passo la lingua impostata sul browser \n # (per testare usa Google chrome Extension: Locale Switcher)\n params[:locale] = request.env.fetch('HTTP_ACCEPT_LANGUAGE', '').scan(/[a-z]{2}/).first if params[:locale].blank?\n #raise \"params[:locale] = #{params[:locale]}\"\n\n case params[:locale]\n when \"it\", \"en\"\n I18n.locale = params[:locale]\n else\n I18n.locale = I18n.default_locale\n end\n end",
"def default_locale; end",
"def set_locale\n accept_language = request.headers['Accept-Language']\n return if accept_language.blank?\n\n available = %w{en ja}\n accept_language.split(',').each do |locale_set|\n locale = locale_set.split(';').first\n if available.include?(locale)\n I18n.locale = locale\n break\n end\n end\n end",
"def select_languages_localized\n available_languages.map{ |x| known_languages.assoc(x)}.map{ |y| [y[2],y[0]]}.sort!\n end",
"def generate_language_switcher_link(locale)\n\t\tvis = nil\n\t\torg = nil\n\n\t\tif @organization\n\t\t\torg = OrganizationTranslation.where(:locale => locale, :organization_id => @organization.id)\n\t\tend\n\n\t\tif @visualization\n\t\t\tvis = VisualizationTranslation.where(:locale => locale, :visualization_id => @visualization.id)\n\t\tend\n\n category = nil\n if params[:category]\n category = params[:category]\n index = @categories.index{|x| x.permalink == params[:category]}\n if index\n category = CategoryTranslation.where(:locale => locale, :category_id => @categories[index].id)\n if !category.blank?\n category = category.first.permalink\n end\n end\n end\n\n\t\tclas = 'language-switcher-item-link'\n clas += locale == I18n.locale ? ' is-active' : ''\n\n\t\tif !vis.blank? && !org.blank?\n\t\t\tlink_to t(\"app.language_abbreviation.#{locale}\"), params.merge(:locale => locale,\n\t\t\t\t:organization_id => org.first.permalink,\n\t\t\t\t:id => vis.first.permalink,\n :category => category\n\t\t\t), title: t(\"app.language.#{locale}\"), class: clas\n\t\telsif !vis.blank?\n\t\t\tlink_to t(\"app.language_abbreviation.#{locale}\"), params.merge(:locale => locale,\n\t\t\t\t:id => vis.first.permalink,\n :category => category), title: t(\"app.language.#{locale}\"), class: clas\n\t\telsif !org.blank?\n\t\t\tlink_to t(\"app.language_abbreviation.#{locale}\"), params.merge(:locale => locale,\n\t\t\t\t:id => org.first.permalink,\n :category => category), title: t(\"app.language.#{locale}\"), class: clas\n\t\telse\n\t\t\tlink_to t(\"app.language_abbreviation.#{locale}\"), params.merge(:locale => locale,\n :category => category), title: t(\"app.language.#{locale}\"), class: clas\n\t\tend\n\tend",
"def store_language\n self.language ||= I18n.locale.to_s\n end",
"def language_aware!\n\t\traise_if_error C.glyr_opt_lang_aware_only(to_native, true)\n\tend",
"def set_lang\n return true unless lang = params[:lang]\n cookies[:lang] = {:value => lang, :expires => Time.now+1.day, :path => '/'}\n end",
"def generate_language_switcher_link(locale)\n distrct = nil\n place = nil\n year = nil\n event = nil\n\n if params[:district].present? && @districts.present?\n index = @districts.map{|x| x.permalink}.index(params[:district])\n if index\n x = CategoryTranslation.where(:locale => locale, :category_id => @districts[index].id)\n if x.present?\n district = x.first.permalink\n end\n end\n end\n\n if params[:place].present? && @places.present?\n index = @places.map{|x| x.permalink}.index(params[:place])\n if index\n x = CategoryTranslation.where(:locale => locale, :category_id => @places[index].id)\n if x.present?\n place = x.first.permalink\n end\n end\n end\n\n if params[:year].present? && params[:year] != I18n.t('filters.time.unknown', :locale => :en) && @years.present?\n index = @years.map{|x| x.permalink}.index(params[:year])\n if index\n x = YearRangeTranslation.where(:locale => locale, :year_range_id => @years[index].id)\n if x.present?\n year = x.first.permalink\n end\n end\n end\n\n if params[:event].present? && @events.present?\n index = @events.map{|x| x.permalink}.index(params[:event])\n if index\n x = CategoryTranslation.where(:locale => locale, :category_id => @events[index].id)\n if x.present?\n event = x.first.permalink\n end\n end\n end\n\n\n\t link_to t(\"app.language.#{locale}\"), params.merge(:locale => locale, :event => event, :year => year, :district => district, :place => place)\n\n\tend",
"def hello_world lang\n if lang == 'de'\n p ' Hallo Welt'\n elsif lang == 'es'\n p 'Hola Mundo' \n elsif lang == 'ru'\n p 'Привет, мир'\n elsif lang == 'ja'\n p 'こんにちは世界'\n else\n p 'Hello World'\n end\nend",
"def display_all_languages\n # Interface method\n end",
"def hello_world(lang)\n lang.downcase!\n if lang == \"es\"\n return \"Hola Mundo\"\n elsif lang == \"de\"\n return \"Hallo Welt\"\n else\n return \"Hello World\"\n end\nend",
"def lang\n # get current page url hash\n back_hash = Rails.application.routes.recognize_path request.referer\n Rails.logger.debug(\"original back_hash: #{back_hash.inspect}\")\n # change the locale code in the current page url hash\n back_hash[:locale] = @locale_code\n back_hash[:dim_type] = params[:dim_type] if params[:dim_type]\n Rails.logger.debug(\"redirect to: #{back_hash.inspect}\")\n # see current page in new locale!\n redirect_to back_hash\n end",
"def hello_world lang\n if lang == 'es'\n puts 'Hola mundo'\n elsif lang == 'de'\n puts 'Hallo welt'\n else puts 'Hello world'\n end\nend",
"def language=(v)\n @language = v.is_a?(String) ? [v] : v \n end",
"def init_linguistics\n Linguistics::use(:en)\nend",
"def current_language=(new_lang)\n if loaded_languages.include? new_lang.to_sym\n @@current_language = new_lang.to_sym\n else\n raise LangFileNotLoaded.new(new_lang, loaded_languages)\n end\n end",
"def current_language=(new_lang)\n if loaded_languages.include? new_lang.to_sym\n @@current_language = new_lang.to_sym\n else\n raise LangFileNotLoaded.new(new_lang, loaded_languages)\n end\n end",
"def use_i18n; end",
"def html_lang\n\t'en-US'\nend",
"def check_language!\n condition { self.class.languages.include?(params[:lang]) }\n end",
"def activate\n\tAVAILABLE_LOCALES.clear.merge!('en-US' => \"English US\", 'mx' =>\"Spanish ES\")\n end",
"def test_language_in_countries\n sarah = set_up\n outcome_one = sarah.language_in('japan')\n outcome_two = sarah.language_in('china')\n outcome_three = sarah.language_in('iceland')\n\n assert_equal(outcome_one, 'ja')\n assert_equal(outcome_two, 'zh')\n assert_equal(outcome_three, 'is')\n end",
"def set_lang()\n lang = nil\n loop do\n puts \"Sprichst du Deutsch (DE)? Or do you speak English (EN)?\"\n lang = gets.chomp.downcase\n if lang.start_with?('e')\n lang = 'eng'\n break\n end\n if lang.start_with?('d')\n lang = 'de'\n break\n end\n puts \"\\nBad Input.\\n\"\n end\n\n messages = MESSAGES[lang].values\n LOCMESS.each_key { |key| LOCMESS[key] = messages.shift } \nend",
"def validate_language(params)\n if(params.to_s == \"english\" or params.to_s == \"spanish\")\n true\n else\n false\n end\n end",
"def generate_language_switcher_link(locale)\n cat_permalink = nil\n tag_permalink = nil\n \n if params[:category].present?\n cat_permalink = Category.get_differnt_locale_permalink(Category::TYPES[:category], locale, params[:category])\n end\n \n if params[:tag].present?\n tag_permalink = Category.get_differnt_locale_permalink(Category::TYPES[:tag], locale, params[:tag])\n end\n \n if cat_permalink && tag_permalink\n\t\t\tlink_to t(\"app.language.#{locale}\"), params.merge(:locale => locale,\n :category => cat_permalink, :tag => tag_permalink)\n elsif cat_permalink\n\t\t\tlink_to t(\"app.language.#{locale}\"), params.merge(:locale => locale,\n :category => cat_permalink, :tag => nil)\n elsif tag_permalink\n\t\t\tlink_to t(\"app.language.#{locale}\"), params.merge(:locale => locale,\n :category => nil, :tag => tag_permalink)\n else\n\t\t\tlink_to t(\"app.language.#{locale}\"), params.merge(:locale => locale,\n :category => nil, :tag => nil)\n end\n \n end",
"def language; languages.first; end",
"def language; languages.first; end",
"def save_lang(resource, resource_language)\n a = ['en','fr','zh']\n if a.include?(resource_language)\n\n language = Language.find_by_code(resource_language)\n resource.language_id = language.id\n if resource.save\n puts \"I saved?\"\n end\n\n else\n resource.language_id = 0\n resource.save\n end\n end",
"def greet_with_language(name, language = 'pt')\n case language.downcase\n when 'en'\n puts \"Hello, #{name.capitalize}\"\n when 'es'\n puts \"Hola, #{name.capitalize}\"\n else\n puts \"Olá, #{name.capitalize}\"\n end\nend",
"def lang?\n self.lang.nil? ? false : true\n end",
"def language\n \tread_attribute(:language) || Language::MULTIPLE_LANGUAGES\n\tend",
"def change_locale\n # Toma la variable del lenguaje\n # de los parametros\n locale = params[:locale]\n # verifica si la variable existe sino toma la\n # que viene por defecto\n I18n.locale = I18n.available_locales.include?(locale.strip.to_sym) ? locale.strip.to_sym : I18n.default_locale\n # crea la cookie\n cookies[:locale] = locale\n if request.referrer\n redirect_to request.referrer\n else\n redirect_to \"/\"\n end\n end",
"def locale_backend; end",
"def vobsub_lang \n send_cmd(\"vobsub_lang\")\n end",
"def language=(value)\n return unless GameData::Text::Available_Langs.include?(value)\n @language = value\n GameData::Text.load\n end",
"def display_language(val)\n lang = LanguageList::LanguageInfo.find(val)\n lang ? lang.name : val\n end",
"def language=(code)\n self[code.downcase.to_sym] = true if code\n end",
"def language_code\n self[:language_code] || (self.person ? self.person.default_language : Utility.language_code)\n end",
"def language_code\n self[:language_code] || (self.person ? self.person.default_language : Utility.language_code)\n end",
"def language_code\n self[:language_code] || (self.person ? self.person.default_language : Utility.language_code)\n end",
"def set_language\n\n if current_user.nil? || params[:controller] =~ /rails_admin/i\n I18n.locale = params[:language] || I18n.default_locale\n else\n I18n.locale = params[:language] || current_user.language.try(:iso_code) || I18n.default_locale\n end\n end",
"def validate_language(params)\n if(params.to_s == \"english\" or params.to_s == \"spanish\")\n true\n else\n false\n end\n end",
"def set_language_to\n session[:lang_to] = params[:lang].to_sym\n \n respond_to do |format|\n format.html { redirect_to root_url } \n format.js { render nothing: true }\n end\n end",
"def change_to_english\n if session[:user_id] != nil\n @user = User.find(session[:user_id])\n @user.prefered_language=\"english\"\n @user.save\n redirect_to '/home'\n #redirect_to(:back)\nelse\n session[:language]=\"english\"\n redirect_to '/home'\nend\nend",
"def lang_code\n (self.path_lang && self.path_lang.length > 0) ? self.path_lang : @settings['default_lang']\n end",
"def locale_to_translate_into\n multilanguage_site = settings.multilanguage_site\n default_language = settings.default_language\n if multilanguage_site and session[:locale] != default_language\n session[:locale]\n else\n nil\n end\n end",
"def set_language\r\n @language = Language.find(params[:id]) rescue Language.find(params[:language_id])\r\n end",
"def set_defaults\n \tdefault_language = lexeme.try(:language) || Language.new\n \n \tself.language ||= default_language\n\tend",
"def set_user_language\n I18n.locale = 'es-VE'\n end",
"def set_locale\n available = TRANSLATIONS.map(&:code)\n if cookies[:locale] && available.include?(cookies[:locale])\n selected = cookies[:locale]\n end\n I18n.locale = selected ||\n http_accept_language.preferred_language_from(available) ||\n I18n.default_locale\n end",
"def language\n Coursemology::Polyglot::Language.find_by(type: super)\n end"
] | [
"0.75204027",
"0.75204027",
"0.75204027",
"0.75204027",
"0.74501675",
"0.73938185",
"0.73938185",
"0.73938185",
"0.73938185",
"0.7377426",
"0.72867656",
"0.72524875",
"0.7218356",
"0.7210764",
"0.7185844",
"0.710356",
"0.7046074",
"0.70344025",
"0.70297027",
"0.70297027",
"0.7011357",
"0.70101815",
"0.700264",
"0.69429094",
"0.6941341",
"0.6938631",
"0.691947",
"0.6873524",
"0.68442273",
"0.6838403",
"0.683693",
"0.68355507",
"0.6826343",
"0.6805782",
"0.6786177",
"0.6780665",
"0.6760077",
"0.6743138",
"0.6732767",
"0.672188",
"0.6719467",
"0.6711479",
"0.6697951",
"0.6686041",
"0.6666254",
"0.6661804",
"0.6660597",
"0.6654912",
"0.66256136",
"0.6621925",
"0.66165537",
"0.6609442",
"0.66047573",
"0.6604481",
"0.6602787",
"0.6601697",
"0.66004574",
"0.6598617",
"0.658921",
"0.65854543",
"0.6580063",
"0.65685254",
"0.6541794",
"0.65392894",
"0.65373445",
"0.65373445",
"0.6530157",
"0.6526331",
"0.65261513",
"0.6525894",
"0.6523273",
"0.65204",
"0.6515894",
"0.65101105",
"0.6501137",
"0.6501137",
"0.6488345",
"0.64812696",
"0.6474501",
"0.64735985",
"0.64685726",
"0.6453495",
"0.6452797",
"0.64500916",
"0.64494973",
"0.6449337",
"0.6444226",
"0.6444226",
"0.6444226",
"0.64417565",
"0.64411837",
"0.6440384",
"0.6430291",
"0.6425932",
"0.6424808",
"0.64231586",
"0.64104754",
"0.64098215",
"0.64043105",
"0.6401019"
] | 0.76059306 | 0 |
returns everywhere this item can be worn. | def worn_locs
arr = @type_attributes.select {|att| att.is_a?(EquipmentType) }
locs = []
arr.each do |att|
locs += att.worn.keys
end
return locs.uniq
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def worn_or_wielded? item\n object = @inventory.find item\n return false if object.nil?\n\n pos = position_of object\n\n return false if object.nil?\n\n if [:left_wield, :right_wield, :dual_wield].include? pos\n return \"You will need to unwield #{object.name} first.\"\n else\n return \"You will need to remove #{object.name} first.\"\n end\n end",
"def rarety\n return @item_rarety\n end",
"def has_item?(item)\n return true if drops_item?(item)\n return true if can_steal_item?(item)\n false\n end",
"def usable_item_conditions_met?(item)\r\n movable? && occasion_ok?(item)\r\n end",
"def can_buy?(item)\r\n item.buyable_by?(self)\r\n end",
"def item_can_use?(item)\n return false unless item.is_a?(RPG::Item)\n return false if item_number(item) == 0\n if $game_temp.in_battle\n return item.battle_ok?\n else\n return item.menu_ok?\n end\n end",
"def ill_item?(instance)\n instance['source'] == 'FOLIO' &&\n instance['discoverySuppress'] == true &&\n instance['staffSuppress'] == false\n end",
"def can_buy?(item)\n item.buyable_by?(self)\n end",
"def check_buyable\n raise PermissionDeniedError, \"出品したアイテムはサポートできません\" if @item.owner?(current_user)\n end",
"def item_usable?\r\n user.usable?(item) && item_effects_valid?\r\n end",
"def cant_counter_item(current)\n return (self.actor? and not $game_party.item_can_use?(current)) if current.numeric?\n for item_id in current\n return false if $game_party.item_can_use?(item_id) or not self.actor?\n end\n return true\n end",
"def item_usable?\n user.usable?(item) && item_effects_valid?\n end",
"def dismantlable?\n return false unless self.is_a?(RPG::Item) || self.is_a?(RPG::EquipItem)\n return true unless @dismantle_items.empty?\n return false\n end",
"def keep_item?(item)\n keep_all? or interesting_item?(item)\n end",
"def items_to_check\n User.not_admins\n end",
"def uncertain?\r\n @@maybes\r\n end",
"def item_usable?\n return false unless @item\n return @actor ? @actor.usable?(@item) : $game_player.usable?(@item)\n end",
"def item_effect_scope(item)\r\n return (((item.scope == 3 or item.scope == 4) and self.hp == 0) or\r\n ((item.scope == 5 or item.scope == 6) and self.hp >= 1))\r\n end",
"def item_conditions_met?(item)\r\n usable_item_conditions_met?(item) && $game_party.has_item?(item)\r\n end",
"def find_items_like_mine\n\t\tif self.forsale\n\t\t\treturn Item.where('ownership_id == ? AND lower(name) == ?', WANTED, self.name.downcase) \n\t\telsif self.wanted \n\t\t\treturn Item.where('ownership_id == ? AND lower(name) == ?', FORSALE, self.name.downcase)\n\t else \n\t \t\treturn nil \t \n\t end \n\tend",
"def find_items_like_mine\n if self.forsale\n return Item.where('ownership_id == ? AND lower(name) == ?', WANTED, self.name.downcase)\n elsif self.wanted\n return Item.where('ownership_id == ? AND lower(name) == ?', FORSALE, self.name.downcase)\n else\n return nil\n end\n end",
"def newly_craftable?(item)\n !item.nil? && item.synthesis_level == @level\n end",
"def test_physicalAttackItem\n f = ItemFilter.new(\"physical_attack\", true)\n new_list = @usableItems.find_all{|x| f.apply(x)}\n return new_list.size == 2\n end",
"def test_physicalAttackUsableItem\n f = UsableItemFilter.new(\"physical_attack\", true)\n new_list = @usableItems.find_all{|x| f.apply(x)}\n return new_list.size == 12\n end",
"def test_attackItem\n f = ItemFilter.new(\"attack\", true)\n new_list = @usableItems.find_all{|x| f.apply(x)}\n return new_list.size == 9\n end",
"def canYouGiveMeATreasure\n return !@hiddenTreasures.empty?\n end",
"def can_loot?\n false\n end",
"def canYouGiveMeATreasure\n !getVisibleTreasures.empty?\n end",
"def pbIsMedicine?(item)\n return [1, 2, 6, 7].include?(GameData::Item.get(item).battle_use) && !GameData::Item.get(item).is_berry?\nend",
"def enable?(item)\n true#$game_party.usable?(item)\n end",
"def valid?\r\n (forcing && item) || subject.usable?(item)\r\n end",
"def sealed?(item)\n !unsealed?(item)\n end",
"def hungry?\n @stuff_in_belly <= 2\n end",
"def hungry?\n @stuff_in_belly <= 2\n end",
"def hungry?\n @stuff_in_belly <= 2\n end",
"def hungry?\n\t\t@stuff_in_belly <= 2\n\tend",
"def hungry?\n\t\t@stuff_in_belly <= 2\n\tend",
"def hungry?\n\t @stuff_in_belly <= 2\n\tend",
"def buyable_private_mines(entity)\n if entity == @hw\n @minors.select { |m| (!m.owner || @players.include?(m.owner)) && @minor_info[m][:vor_harzer] }\n else\n @minors.select { |m| !m.owner || @players.include?(m.owner) }\n end\n end",
"def test_healingItem\n f = ItemFilter.new(\"healing\", true)\n new_list = @usableItems.find_all{|x| f.apply(x)}\n return new_list.size == 6\n end",
"def current_item_enabled?\n return true\n end",
"def in_safe_space?\n not taking_damage? and not next_to_enemy?\n end",
"def current_item_enabled?\n true\n end",
"def owner_only_offers_reward?\n self.rewards_count == 1 && self.rewards.visible[0].sender == self.person\n end",
"def canMakeTreasureVisible(t)\n \n end",
"def hungry?\n\t@stuff_in_belly <= 2\nend",
"def current_item_enabled?() target end",
"def ready_for_war?\n return true if (self.embassy && self.army)\n end",
"def movable?\r\n exist? && restriction < 4\r\n end",
"def usable?(item)\n return false if item.nil?\n tb = battler\n return tb.usable?(item) # tb.is_a?(Game_Actor) ? <- : false\n end",
"def hungry?\n\n\t\t @stuff_in_belly <= 2\n\t\tend",
"def i_books_store_blocked\n return @i_books_store_blocked\n end",
"def item_effect_effective_setup(item)\r\n effective = false\r\n return effective |= item.common_event_id > 0\r\n end",
"def check_item_condition?\n # disallow usage if item button disabled\n return false if !$game_system.item_button\n # disallow usage\n item_condition = false\n # if using direct hotkeys\n if BlizzABS::Config::DIRECT_HOTKEYS\n # check direct hotkeys\n item_condition = self.item_hotkeys?\n # if item button pressed\n elsif Input.trigger?(Input::Item)\n # allow usage\n item_condition = true\n end\n # return result\n return item_condition\n end",
"def pick_up(item)\n expected_weight = items_weight + item.weight\n if expected_weight <= 250\n item.is_a?(Weapon) ? @equipped_weapon = item : items << item \n else\n return false\nend\nend",
"def borrowable_items\n# items.where(\"borrower_id = 0\")\n Item.all.where(\"borrower_id = 0 and lender_id != :owner\", {owner: self.id})\n end",
"def hungry?\n @stuffInBelly <= 2\n end",
"def inventory_worth\n get_worth_of( shared_inventory )\n end",
"def hungry?\n@stuff_in_belly <= 2\nend",
"def common?\n self.sightings.size > 30\n end",
"def include?(item)\r\n $game_party.usable?(item)\r\n end",
"def air_drop_blocked\n return @air_drop_blocked\n end",
"def collect_eligible(items)\n items.select{|item| eligible?(item) }\n end",
"def blocked?\n !self.blocked.nil?\n end",
"def blood_magic_conditions_met?(item)\n return false if item.blood_magic_required && !blood_magic_activated?\n return true\n end",
"def any_items_ready?\n ready = false\n if items.blank?\n ready = true\n else\n items.each do |i|\n if !i.obsolete\n if i.digital_object\n ready = i.state_reached_for_order(:ready_at_use_location, self.id)\n else\n ready = i.state_reached_for_order(:ready_at_temporary_location, self.id)\n end\n end\n break if ready\n end\n end\n ready\n end",
"def should_i_buy?(item)\n !!list[item.to_sym]\n end",
"def is_cuffed?\n return weapon_id == 33\n end",
"def not_waste_producer_water_discount?\n (application_type != 'WP-WD')\n end",
"def allow?(item)\n @whitelist.include?(item) || !@blacklist.include?(item)\n end",
"def item_owner?\n unless user_signed_in? && !current_user.items.find_by(id: params[:id]).nil?\n flash.alert = \"You are not authorized to access that!\"\n redirect_to root_path\n end\n end",
"def enable?(item)\n return false if item.nil?\n return false if $game_party.gold < item.dismantle_gold_fee \n return item.dismantlable?\n end",
"def occupied?\n !!@boat\n end",
"def get_active_items\r\n self.items.select { |i| i.active? } #TODO only fixed or only auction\r\n end",
"def allows_reward?\n self.class.allows_reward?\n end",
"def hasDrops\n return @ucVictoryItemsList.size > 0\n end",
"def can_view_private_items\n return @can_view_private_items\n end",
"def enable?(item)\n return false if item.nil?\n return false unless has_recipebook?\n return false if item.tocrafting_gold_fee > $game_party.gold\n return false if $game_party.item_max?(item)\n return false unless have_tools?(item)\n return false unless have_actors?(item)\n return true if item.ingredient_list.empty?\n return have_ingredients?(item)\n end",
"def check_resource_ownership\n if admin_user.is_not_root?\n\n condition_typus_users = @item.respond_to?(Typus.relationship) && !@item.send(Typus.relationship).include?(admin_user)\n condition_typus_user_id = @item.respond_to?(Typus.user_foreign_key) && !admin_user.owns?(@item)\n\n not_allowed if (condition_typus_users || condition_typus_user_id)\n end\n end",
"def strong?\n self.health >= 100\n end",
"def surrounding_mines?\n mine_count > 0\n end",
"def party_worth\n get_worth_of( shared_inventory + actors_inventory )\n end",
"def can_activate?(item)\r\n item.activatable_by?(self)\r\n end",
"def check_visibility\n raise Helpedia::ItemNotVisible unless @user.visible_for?(current_user)\n end",
"def within_limit_of?(item, user)\r\n @member_limits.fetch(user.email).has_resources_for?(item.price)\r\n end",
"def not_losers\n players.reject { |p| p.hand.overkill? }\n end",
"def has_own_bed?\n false\n end",
"def displace_item_must_be_displaceable\n return unless displace_item && fund_item\n unless displaceable_items.include?( displace_item )\n errors.add :displace_item, \"cannot be displaced by this item\"\n end\n end",
"def has_places?\n capacity > 0\n end",
"def extra_item?\n false\n end",
"def blocked?\n @blocked\n end",
"def has2w\n #equips.count { |equip| equip.is_a?(RPG::Weapon) } >= 2\n armi = 0\n equips.each { |equipment|\n armi += 1 if equipment.is_a?(RPG::Weapon)\n }\n armi >= 2\n end",
"def test_physicalAttackUsableItemNullValue\n f = UsableItemFilter.new(\"physical_attack\")\n new_list = @usableItems.find_all{|x| f.apply(x)}\n return new_list.size == 0\n end",
"def should_rest?(warrior)\n\t\t!@took_damage && warrior.health < MIN_HEALTH\n\tend",
"def self_owned?; owners.include?(Distributed) end",
"def get_active_items\n self.items.select { |i| i.active? } #TODO only fixed or only auction\n end",
"def just_started_taking_damage?\n taking_damage? and @map.is_safe_location?(@map.previous_location)\n end",
"def have_lives?\r\n @chances >= 1\r\n end",
"def test_physicalAttackItemNullValue\n f = ItemFilter.new(\"physical_attack\")\n new_list = @usableItems.find_all{|x| f.apply(x)}\n return new_list.size == 0\n end",
"def won?\n safe_tiles = @grid.flatten.select { | tile | tile.value != BOMB }\n safe_tiles.all? { | tile | tile.revealed }\n end",
"def forbidden?\n @forbidden\n end"
] | [
"0.6814608",
"0.6522901",
"0.64822346",
"0.6469756",
"0.641332",
"0.63831747",
"0.636795",
"0.6363406",
"0.6339425",
"0.63063496",
"0.6290353",
"0.628202",
"0.6259389",
"0.62508565",
"0.62500757",
"0.6195417",
"0.6191886",
"0.61498815",
"0.6092678",
"0.6048875",
"0.60383105",
"0.6021648",
"0.5984178",
"0.5975513",
"0.595003",
"0.5942137",
"0.5925266",
"0.5917763",
"0.5895123",
"0.588546",
"0.58826435",
"0.5878845",
"0.5853688",
"0.5853688",
"0.5853688",
"0.58471406",
"0.58471406",
"0.5842344",
"0.5833016",
"0.5824449",
"0.5824421",
"0.5810291",
"0.57880795",
"0.578694",
"0.5786353",
"0.57724315",
"0.57579225",
"0.57262594",
"0.5725019",
"0.57244575",
"0.57068306",
"0.57024604",
"0.5701441",
"0.5694661",
"0.56877345",
"0.56780314",
"0.567674",
"0.5676521",
"0.5676155",
"0.56724346",
"0.56657314",
"0.56516975",
"0.5648252",
"0.56465966",
"0.56409866",
"0.5640583",
"0.5637855",
"0.56364006",
"0.5635258",
"0.56312853",
"0.5630146",
"0.5625613",
"0.56243384",
"0.5622252",
"0.5615891",
"0.5604767",
"0.5603945",
"0.5603743",
"0.560274",
"0.5596848",
"0.55939054",
"0.55936503",
"0.5592466",
"0.5583254",
"0.5581271",
"0.5580596",
"0.5578442",
"0.5577054",
"0.55686545",
"0.55682224",
"0.556292",
"0.5562313",
"0.5560964",
"0.5557493",
"0.55530185",
"0.55514956",
"0.5550239",
"0.5550044",
"0.55499864",
"0.55490696",
"0.5546625"
] | 0.0 | -1 |
uncomment when you have `each` working and `Enumerable` included | def to_s
inject([]) { |acc, link| acc << "[#{link.key}, #{link.val}]" }.join(", ")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(*) end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def each\n raise 'Not implemented'\n end",
"def each_identity; end",
"def each(&a_proc); end",
"def each(&block)\n raise NotImplementedError\n end",
"def each\n to_a.each\n end",
"def each\n to_a.each\n end",
"def each\n to_a.each\n end",
"def each(&block)\n raise NotImplementedError\n end",
"def _each(&block)\n _next.each(&block) if _next\n end",
"def each(&block)\nend",
"def each(&block)\n end",
"def each(&block)\n\n end",
"def each &block\n end",
"def each\n end",
"def each\n end",
"def each\n end",
"def each\n end",
"def each\n end",
"def each\n end",
"def each\n for each element\n yield(element)\n end\nend",
"def each(&blk); each_value(&blk) ; end",
"def each # And define each on top of next\n loop {yield self.next }\n end",
"def each\n end",
"def each\n end",
"def my_each(&prc)\n end",
"def each_raw\n iterator.each { |i| yield i }\n end",
"def each(&blk)\n to_a.each(&blk)\n end",
"def each_set\n \n end",
"def each(&block) # block into proc\n\nend",
"def each(&blk)\r\n to_a.each(&blk)\r\n end",
"def each(&block)\n to_a.each(&block)\n end",
"def each\n yield self\n end",
"def custom_each(array)\r\n i = 0 \r\n while i < array.length \r\n yield array[i]\r\n i += 1\r\n end\r\nend",
"def each(&block)\n to_a.each(&block)\n end",
"def each # And define each on top of next\n loop { yield self.next }\n end",
"def each\n end",
"def through; end",
"def deep_each\n \n end",
"def each\n # passes block - if any - to upstream each.\n to_a.each(&Proc.new)\n end",
"def each(options={}, &block)\n end",
"def each\n# And define each on top of next\nloop { yield self.next }\nend",
"def each\n# And define each on top of next\nloop { yield self.next }\nend",
"def each(&block)\n to_a.each(&block)\n end",
"def each(&block)\n to_a.each(&block)\n end",
"def each(&block)\n internal_collection.each(&block)\n end",
"def test_try_each_instead_of_collect_change_array\n array = [1, 2, 3]\n array = array.each { |item| item + 10 }\n #assert_equal [11, 12, 13], array\n assert_equal [1, 2, 3], array\n end",
"def each(&block)\n if use_eager_all?\n all(&block)\n else\n super\n end\n end",
"def each()\n self.to_a.each { |elt| yield elt }\n end",
"def custom_each(array)\n i = 0\n while i < array.length\n yield array[i]\n i += 1\n end\nend",
"def each(&block)\n return enum_for :each unless block\n\n @data.each(&block)\n\n self\n end",
"def each(&block)\n @collection.each(&block)\n end",
"def each(&block)\n all.each(&block)\n end",
"def each\n self.to_a.each do |el|\n yield(el)\n end\n end",
"def custom_each(array)\n i = 0\n while i < array.length\n #yield will pass this element to the block\n yield array[i] #each and single element of array iterate\n i += 1 #to stop infinite loop\n end\nend",
"def each(&block)\n @all.each(&block)\n end",
"def each\n all.each do |el|\n yield el\n end\n end",
"def each(node, &block); end",
"def each\n @collection.each { |c| yield c }\n end",
"def each(&block)\n return all.each(&block)\n end",
"def each(&block)\n to_set.each(&block)\n end",
"def each(&block)\n @collection.each(&block)\n end",
"def iterator()\n raise NotImplementedError\n end",
"def each\n all.each do |el|\n yield el\n end\n end",
"def each_pair(*) end",
"def each\n\n\t\t@a.each do |x|\n\t\t\tyield x\n\t\tend\n\tend",
"def each_value(&block); end",
"def each\n @base.each { |item| (yield item) if @filter.call(item) }\n end",
"def each_with_iterator\n\n iterator = get_iterator_fast\n while (iterator.has_next?)\n yield iterator.get_next, iterator if block_given?\n end\n \n end",
"def each\n # Include every to be inside enumerable:\n yield \"pizza\"\n yield \"spaghetti\"\n yield \"salad\"\n yield \"water\"\n yield \"bread\"\n end",
"def each\n return enum_for(:each) unless block_given?\n results.each(&Proc.new)\n self\n end",
"def iterate\n raise \"You should implement this\"\n end",
"def each()\n yield izq\n yield der\n end",
"def my_each\n return to_enum unless block_given?\n\n i = 0\n arr = to_a\n while i <= arr.length - 1\n yield (arr[i])\n i += 1\n end\n self\nend",
"def test_each_is_a_method_on_arrays\n assert_equal true, [].methods.include?(as_name(:each))\n end",
"def each\n while true do\n yield\n break if ! advance\n end\n end",
"def each\n\t\t\t@elements.each\n\t\tend",
"def each(&block)\n self.entries.each(&block)\n end",
"def each(&block)\n\t\t\t@ordered.each(&block)\n\t\tend",
"def each(&block)\n @succ.each(&block)\n end",
"def each\n return enum_for(:each) unless block_given?\n\n @data.collection.each { |item| yield item }\n end",
"def each\n self\n end",
"def each a\n\ti = 0\n\tuntil i == a.size\n\t\tyield a[i]\n\t\ti += 1\n\tend\n\ta\nend",
"def each\r\n @many = true\r\n yield(self)\r\n end"
] | [
"0.729552",
"0.729552",
"0.729552",
"0.729552",
"0.729552",
"0.729552",
"0.7163506",
"0.7115632",
"0.7115632",
"0.7115632",
"0.7115632",
"0.7115632",
"0.7115632",
"0.7115632",
"0.7115632",
"0.7115632",
"0.7115632",
"0.7115632",
"0.70454085",
"0.70422536",
"0.6950336",
"0.67962986",
"0.6785345",
"0.6785345",
"0.6785345",
"0.6769122",
"0.67689735",
"0.6761285",
"0.6760564",
"0.67484224",
"0.670535",
"0.6691466",
"0.6691466",
"0.6691466",
"0.6691466",
"0.6691466",
"0.6691466",
"0.65371907",
"0.65258676",
"0.6522973",
"0.6517588",
"0.6517588",
"0.65108895",
"0.6491474",
"0.6480453",
"0.6447932",
"0.64402527",
"0.6432575",
"0.6425434",
"0.6420477",
"0.64058363",
"0.6389031",
"0.63806725",
"0.63749486",
"0.6358362",
"0.6350714",
"0.6331007",
"0.6308578",
"0.629094",
"0.629094",
"0.6287402",
"0.6287402",
"0.62584895",
"0.62507784",
"0.62379384",
"0.6236218",
"0.6233514",
"0.61990553",
"0.61748576",
"0.6174535",
"0.6169708",
"0.61646897",
"0.61598593",
"0.61364555",
"0.6130905",
"0.61122656",
"0.6075232",
"0.60705495",
"0.60688484",
"0.6068011",
"0.60412186",
"0.6033586",
"0.60155994",
"0.6005511",
"0.60011655",
"0.5992693",
"0.5988352",
"0.59776527",
"0.59730136",
"0.595645",
"0.59448767",
"0.59445673",
"0.59279287",
"0.5916175",
"0.59131575",
"0.5907706",
"0.59056437",
"0.5896799",
"0.5880981",
"0.58792335",
"0.58730495"
] | 0.0 | -1 |
set up the session context information, so that it gets logged with the job log lines also set up a unique tmpdir, which will get removed at the end of the job. | def configure_for_job(job)
previous_tmpdir = ENV.fetch("TMPDIR", nil)
self.class.running_job(job) do
dir = Dir.mktmpdir("job-#{job.id}-#{name.gsub(/[^\w.]/, ".")}-")
begin
ENV["TMPDIR"] = dir
yield
ensure
FileUtils.remove_entry(dir, true)
end
end
ensure
ENV["TMPDIR"] = previous_tmpdir
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup\n @current_session = new_session\n end",
"def prepare\n FileUtils.rm_rf(@tempdirs, secure: true) if @tempdirs\n @tempdirs = []\n @base_options = nil\n @mode_options = nil\n @user_recipients = nil\n @user_keys = nil\n @system_identifiers = nil\n end",
"def tmpdir\n @tmpdir ||= begin\n Dir.mktmpdir\n end\n end",
"def tmpdir; end",
"def tmpdir=(_arg0); end",
"def setup\n tempdir_original_setup\n @tempdir = create_tempdir\n @stdout = @tempdir + \"/stdout\"\n @stdin = @tempdir + \"/stdin\"\n @stderr = @tempdir + \"/stderr\"\n end",
"def setup_environment\n `rm -rf /tmp/#{@upload_id} && mkdir /tmp/#{@upload_id}`\n Dir.chdir(\"/tmp/\" + @upload_id)\n end",
"def setup\n @env = { Rack::Session::Abstract::ENV_SESSION_KEY => '123456', Rack::Session::Abstract::ENV_SESSION_OPTIONS_KEY => Rack::Session::Abstract::ID::DEFAULT_OPTIONS}\n SmartSessionApp.test_proc = nil\n end",
"def tmpdir\n @tmpdir ||= configuration[:copy_dir] || Dir.tmpdir\n end",
"def tmpdir\n @tmpdir ||= configuration[:copy_dir] || Dir.tmpdir\n end",
"def setup\n open_session\n end",
"def prepare\n unless File.directory?(@log_dir)\n Dir.mkdir(@log_dir)\n @logger.info(\"[SETUP] Writing to the following folder: #{@log_dir}\")\n end\n ADB.kill_monkeys(@device_list)\n end",
"def initialize\n @tmp_dir = Dir.mktmpdir(file_name)\n end",
"def context\n @_context ||= {\n :argv => START_CTX[:argv].map { |arg| arg.dup },\n :cwd => START_CTX[:cwd].dup,\n 0 => START_CTX[0].dup,\n }.tap do |ctx|\n rewrite_context(ctx)\n end\n end",
"def logging_context\n if logger_context_hash?\n { \"uniquejobs\" => \"reaper\" }\n else\n \"uniquejobs=orphan-reaper\"\n end\n end",
"def with_tmp_dir(&block)\n Dir.mktmpdir do |tmp_dir|\n Dir.chdir(tmp_dir, &block)\n end\n end",
"def generate_tmpdir\n pipeline.generate_tmpdir\n end",
"def tmpdir\n @tmpdir = (\n dir = ENV['XDG_CACHE_HOME'] || '~/.cache'\n dir = File.expand_path(File.join(dir, 'ruby'))\n ensure_directory(dir) # TODO: do this here?\n )\n end",
"def tempdir #:doc:\n Dir.tmpdir\n end",
"def save_details_to_session(job_name, filename, correlation_id)\n session[:job] = {\n name: job_name,\n filename: filename,\n submission_time: submission_time,\n correlation_id: correlation_id\n }\n end",
"def setup_cache\n @caching_settings ||= {}\n @cache_tmpdir ||= Dir.mktmpdir(CACHE) unless @caching_settings[:metastore]\n @cache_meta = @caching_settings[:metastore] || ('file:' + @cache_tmpdir + '/meta')\n @cache_tmpdir ||= Dir.mktmpdir(CACHE) unless @caching_settings[:entitystore]\n @cache_entity = @caching_settings[:entitystore] || ('file:' + @cache_tmpdir + '/entity')\n @cache_tmpdir || nil\n end",
"def initialize_session\n # Save the thread incase we need to forcibly kill it\n @puppet_thread = Thread.current\n @puppet_thread_id = @puppet_thread.object_id.to_i\n end",
"def make_sessions_logs\n sessions_uuids = []\n sessions_info = []\n info = ''\n hist_file = ''\n hist_file_name = ''\n log_list = []\n\n # Create list of sessions with base info\n framework.db.workspace.events.each do |e|\n if not e.info.nil? and e.info[:session_type] =~ /shell/ or e.info[:session_type] =~ /meter/\n if e.info[:command] != 'load stdapi'\n if not sessions_uuids.include?(e.info[:session_uuid])\n sessions_uuids << e.info[:session_uuid]\n sessions_info << {:uuid => e.info[:session_uuid],\n :type => e.info[:session_type],\n :id => e.info[:session_id],\n :info => e.info[:session_info]}\n end\n end\n end\n end\n\n sessions_uuids.each do |su|\n sessions_info.each do |i|\n if su == i[:uuid]\n print_line(\"Exporting Session #{i[:id]} history\")\n hist_file_name = \"#{framework.db.workspace.name}_session_#{i[:id]}_#{::Time.now.strftime('%Y%m%d.%H%M%S')}.log\"\n i.each do |k, v|\n info << \"#{k.to_s}: #{v.to_s} \"\n end\n break\n end\n end\n hist_file << \"# Info: #{info}\\n\"\n info = ''\n framework.db.workspace.events.each do |e|\n if not e.info.nil? and e.info.has_key?(:command) or e.info.has_key?(:output)\n if e.info[:session_uuid] == su\n if e.info.has_key?(:command)\n hist_file << \"#{e.updated_at}\\n\"\n hist_file << \"#{e.info[:command]}\\n\"\n elsif e.info.has_key?(:output)\n hist_file << \"#{e.updated_at}\\n\"\n hist_file << \"#{e.info[:output]}\\n\"\n end\n end\n end\n end\n\n # Set RC file path and file name\n session_hist_path = ::File.join(Msf::Config.log_directory, 'projects', framework.db.workspace.name)\n session_hist_fullpath = ::File.join(session_hist_path, hist_file_name)\n\n # Create folder\n ::FileUtils.mkdir_p(session_hist_path)\n\n print_line(\"Saving log file to #{session_hist_fullpath}\")\n file_write(session_hist_fullpath, hist_file)\n hist_file = ''\n print_line('Log file written')\n log_list << session_hist_fullpath\n end\n\n return log_list\n end",
"def tmpdir\n @tmpdir ||= ::Dir.mktmpdir('creek__drawing')\n end",
"def mys_setup current, &block\n user={id:current.id, token:current.auth_token}\n timer=Time.now\n session[:logged]={user: user, master: user.dup, timer: timer}\n block.call\n end",
"def tmpdir(id=:default)\n @tmpdirs[id] ||= Dir.mktmpdir\n end",
"def tmpdir\n @tmpdir ||= File.join(Dir.tmpdir, 'sample_file', 'image')\n end",
"def initialize(session_id)\n @session_id = session_id\n super \"Create the First Job\"\n end",
"def setup\n TestUtils.set_workday_default\n TestUtils.enable_module_on_project 1\n @request.session[:user_id] = 1\n @rc_cfg = Red_Counter::Config.new\n end",
"def new_tempfile\n intopdir = Pathname.new(Tempfile.new('dummy').path)\n subdir = intopdir.parent + 'manual/'\n subdir.mkpath\n Pathname.new(Tempfile.new(['data-ids', '.csv'], subdir).path)\nend",
"def set_session_file\n case @type\n when 'before_push' then sf = BeforePushTasksFile\n when 'after_push' then sf = AfterPushTasksFile\n end\n @session_file = sf\n end",
"def clean_tmp_dir\n system \"rm -rf #{TMP_PATH}\"\n system \"mkdir #{TMP_PATH}\"\n yield\n system \"rm -rf #{TMP_PATH}\"\n system \"mkdir #{TMP_PATH}\"\n end",
"def tmpdir(*args); end",
"def in_tmpdir\n Dir.mktmpdir do |dir|\n Dir.chdir dir do\n yield\n end\n end\n end",
"def with_tmp_dir(&block)\n Dir.mktmpdir(SecureRandom.hex(3)) do |tmp_dir|\n Dir.chdir(tmp_dir, &block)\n end\n end",
"def prepare_session(env)\n session_was = env[ENV_SESSION_KEY]\n env[ENV_SESSION_KEY] = SessionHash.new(self, env)\n env[ENV_SESSION_OPTIONS_KEY] = OptionsHash.new(self, env, @default_options)\n env[ENV_SESSION_KEY].merge! session_was if session_was\n end",
"def fork_session(session, context)\n sess_id = next_free_id\n session.set_session_id(sess_id)\n context.session_id = sess_id\n end",
"def _prepare_context\n @view_flow = OutputFlow.new\n @output_buffer = ActionView::OutputBuffer.new\n @virtual_path = nil\n end",
"def initialize(*args)\n @queue = []\n @workdir = Pathname.new(Pathname.pwd)\n @env = {}\n super\n end",
"def initialize(*)\n @id = SecureRandom.uuid\n @submitted_at = Time.now\n mkdir_p dir\n yield if block_given?\n save\n rescue Errno::ENOSPC\n raise SystemError, 'Not enough disk space to start a new job'\n rescue Errno::EACCES\n raise SystemError, \"Permission denied to write to #{DOTDIR}\"\n rescue => e\n rm_rf dir\n raise e\n end",
"def setup_session\n @session_id ||= if @smug_user.email\n setup_session_with_username\n else \n setup_session_anonymously\n end\n end",
"def container_tmpdir\n '/tmp'\n end",
"def setup!(delete=true)\n FileUtils.rm_rf(@root_dir) if File.exist?(@root_dir) and delete\n FileUtils.mkdir_p(@root_dir)\n FileUtils.mkdir_p(@files_dir)\n FileUtils.mkdir_p(@queues_dir)\n FileUtils.mkdir_p(@logs_dir)\n FileUtils.mkdir_p(@current_queue_dir)\n FileUtils.mkdir_p(@next_queue_dir)\n\n File.open(@error_log, 'w+') {|f|}\n File.open(@action_log, 'w+') {|f|}\n\n # the queue_version file contains the number of\n # switches from current->next queue.\n File.open(@queue_version, 'w+') {|f| f.puts \"0\"}\n end",
"def make_tmpdir\n unless @tmpdir\n @tmpdir = Dir.tmpdir\n at_exit { FileUtils.rm_rf(@tmpdir) }\n end\n @tmpdir\n end",
"def setup\n @extractions = []\n @sandbox_dir = Dir.mktmpdir \"#{self.class.name}_#{@NAME}\", TEST_SANDBOX\n @repo_dir = File.join @sandbox_dir, \"repo.git\"\n @extracted_dir = File.join @sandbox_dir, \"extracted.git\"\n end",
"def initialize( * )\n\t\tsuper\n\t\t@session = nil\n\t\t@session_namespace = nil\n\tend",
"def teardown!\n FileUtils.rm_rf(@tmpdir) if File.exist?(@tmpdir)\n end",
"def set_session\n \n end",
"def create_temp_log\n dir_path = Dir.mktmpdir\n file_path = File.join(dir_path, 'log.xml')\n # Suppress all added whitespace, even newline, to facilitate text comparison.\n StructuredLog.open(file_path, {:xml_indentation => -1}) do |log|\n yield log\n end\n file_path\n end",
"def checkpoint\n remove_processed_tx_files\n Modsec::Tailer.write_resume_file(@logfile)\n end",
"def mktmpdir\n prefix = File.basename($0).sub(/\\.rb$/, '-')\n dir = Dir.mktmpdir(prefix)\n at_exit do\n FileUtils.rm_rf dir, secure: true\n end\n dir\nend",
"def setup\n TestUtils.set_workday_default\n TestUtils.enable_module_on_project 1\n @request.session[:user_id] = 1\n end",
"def session_options=(_arg0); end",
"def session_options=(_arg0); end",
"def teardown\n FileUtils.remove_entry @tmpdir\n end",
"def clean_thread_context(logger: nil, namespace: nil)\n if store(namespace).present?\n if logger.nil?\n puts \"WARNING: ThreadAccessor variables set outside ThreadAccessor context: #{store(namespace).keys.join(\", \")}\"\n else\n logger.warn(\"ThreadAccessor variables set outside ThreadAccessor context: #{store(namespace).keys.join(\", \")}\")\n end\n end\n\n yield\n ensure\n store(namespace).clear\n end",
"def handle_request( * ) # :nodoc:\n\t\tself.log.debug \"[:sessions] Adding sessions to the transaction.\"\n\t\tsuper\n\tend",
"def in_temp_dir\n tmpdir = Dir.mktmpdir\n tmpdir_realpath = File.realpath(tmpdir)\n Dir.chdir(tmpdir_realpath) do\n yield tmpdir_realpath\n end\n ensure\n FileUtils.rm_rf(tmpdir_realpath) if tmpdir_realpath\n # raise \"Temp dir #{tmpdir} not removed. Remaining files : #{Dir[\"#{tmpdir}/**/*\"]}\" if File.exist?(tmpdir)\n end",
"def configure_training_session\n available_ledgers :training_session\n set_training_session\n end",
"def _prepare_context; end",
"def prepare\n return if @@prepared\n @@prepared = true\n FileUtils.mkdir_p(File.dirname(logfile))\n File.write(logfile, '')\n end",
"def _init_filesystem\n\t\t# Prepare temporary work directory\n\t\tcommand_send(\"sudo rm -rf /tmp/.captain\")\n\t\tcommand_send(\"mkdir -p /tmp/captain/transfers\")\n\t\tcommand_send(\"mkdir -p /tmp/captain/checkpoints/export\")\n\t\tcommand_send(\"mkdir -p /tmp/captain/checkpoints/import\")\n\tend",
"def cleanup\n @session_id = nil\n end",
"def do_into_tmpdir(t)\n Dir.mktmpdir do |dir|\n do_into_dir(dir, t)\n end\nend",
"def setup_workspace\n\n if ! File.exist?( @app_data )\n\n @logger.trace \"Creating configuration in \" + @app_data\n Dir.mkdir( @app_data )\n f = File.open( Config.formulate_config_file_name( @app_data ), \"w\" )\n f.puts @@yaml_config\n f.close\n\n @whois_cache_dir = File.join( @app_data, \"whois_cache\" )\n Dir.mkdir( @whois_cache_dir )\n\n @tickets_dir = File.join( @app_data, \"tickets\" )\n Dir.mkdir( @tickets_dir )\n\n else\n\n @logger.trace \"Using configuration found in \" + @app_data\n @whois_cache_dir = File.join( @app_data, \"whois_cache\" )\n @tickets_dir = File.join( @app_data, \"tickets\" )\n\n end\n\n end",
"def init_temp_anchor\n @temp_anchor_path = session[:anchor_temp_path]\n @temp_anchor_hash = session[:anchor_hash]\n end",
"def set_session\n @session = current_session\n end",
"def tmp_dir\n @tmp_dir ||= root / 'tmp'\n end",
"def initialize(ctx)\r\n @verbose = false\r\n @context = ctx\r\n end",
"def setup\n load_configs\n\n backups = $GLOBAL.fetch('backups', {})\n paths = backups.fetch('paths', {})\n encryption = @config.fetch('encryption', {})\n s3 = @config.fetch('s3', {})\n prefix = get_prefix()\n date_path = get_date_path()\n timestamp = get_timestamp()\n backup_dir = paths.fetch('backups', '/tmp/backups')\n\n @backup = @config.fetch('backup', {})\n @options = @config.fetch('options', {})\n @connection = @backup.fetch('connection', {})\n @secret = encryption.fetch('secret', nil)\n @cleanup = @options.fetch('cleanup', true)\n @name = @config.fetch('_name')\n @group = @name.gsub(/[^0-9A-Za-z]/, '_')\n\n job_name = \"#{prefix}-#{timestamp}\"\n @source_dir = \"#{backup_dir}/#{@name}\"\n @job_dir = \"#{@source_dir}/#{job_name}\"\n @job_zip = \"#{@source_dir}/#{job_name}.zip\"\n @job_size = nil\n\n s3_path = s3.fetch('path', \"\")\n @s3_region = s3.fetch('region', \"eu-west-1\")\n @s3_bucket = s3.fetch('bucket', nil)\n @s3_active = s3.fetch('active', @s3_bucket != nil)\n @s3_prefix = \"#{s3_path}/#{@name}/#{date_path}\"\n\n @report = {\n started: Time.now,\n completed: nil,\n file: nil,\n size: nil,\n report: nil,\n }\n end",
"def initialize (context_or_dir=nil)\n\n @workdir = get_work_directory(context_or_dir) + '/out/'\n\n @reply_anyway = false\n end",
"def initialise_job_tracking\n self.overall_count = 0\n self.overall_duration_seconds = 0\n self.overall_data_length_bytes = 0\n end",
"def session=(_arg0); end",
"def setup_filesystem\n FileUtils.mkdir_p($out_pth)\n FileUtils.mkdir_p($log_dir)\n end",
"def initialize( opts, config, headers )\n @opts = opts\n @config = config\n @headers = headers\n \n ## todo: check if we need to use expand_path - Dir.pwd always absolute (check ~/user etc.)\n @usrdir = File.expand_path( Dir.pwd ) # save original (current) working directory \n end",
"def context\n unless @instance_context\n @instance_context = TaskContext.new(@version , @params['workspace_sid'], @params['sid'])\n end\n @instance_context\n end",
"def create_workspace\n @workspace = Dir.mktmpdir.chomp\n end",
"def setup_config_defaults!(cfg)\n cfg.session_type ||= default_session_type\n cfg.session_path ||= default_session_path\n cfg.session_options ||= {}\n cfg.sessions ||= []\n end",
"def save_context(context)\n session[:context] = context\n end",
"def setup\n t = Thread.new { build_directories_records }\n @adapter = initialize_adapter\n t.join\n end",
"def using_session(name, &block)\n self.last_used_session = name\n super\n ensure\n self.last_used_session = nil\n end",
"def context\n unless @instance_context\n @instance_context = TaskContext.new(@version, @params['workspace_sid'], @params['sid'], )\n end\n @instance_context\n end",
"def setupTmpDir(iSrcDir, iBaseName = nil)\n # Find a good temporary directory name\n lTmpDir = nil\n if (!defined?(@@UniqueCounter))\n @@UniqueCounter = 0\n end\n if (iBaseName == nil)\n lTmpDir = \"#{Dir.tmpdir}/WEACERegression/Dir_#{@@UniqueCounter}\"\n else\n lTmpDir = \"#{Dir.tmpdir}/WEACERegression/#{iBaseName}_#{@@UniqueCounter}\"\n end\n @@UniqueCounter += 1\n # Copy the directories\n log_debug \"-> Create image of #{iSrcDir} in #{lTmpDir}\"\n # Clean first if already present\n if (File.exists?(lTmpDir))\n FileUtils::rm_rf(lTmpDir)\n end\n copyDir(iSrcDir, lTmpDir)\n # Call the code (protected)\n begin\n yield(lTmpDir)\n ensure\n # Delete the temporary directory\n if (!debug_activated?)\n FileUtils::rm_rf(lTmpDir)\n end\n end\n end",
"def createContext\n\n begin\n \n # Get context name\n if not params[:contextname]\n render :text => \"Error in creating context, contextname needed! \\n\", :status => 409\n return\n end\n contextname = params[:contextname].downcase\n \n if params[:i_am_client]\n username = authenticateClient\n elsif session[:username]\n username = session[:username]\n end\n \n # Make sure user is signed in as the user who context will be created to\n if username == nil\n render :text => \"Not authorized to create context! \\n\", :status => 409\n return\n end\n \n \n @user = User.find_by_username(username)\n \n #puts \"username: #{@user.id.to_s}\"\n #puts \"contextname: #{contextname.to_s}\"\n #puts \"location: #{location.to_s}\"\n \n # Location name is optional?\n if not contextname or not @user #or not location \n render :text => \"Not all the details that are needed was given! \\n\", :status => 300\n return\n end\n \n \n # Checks that user doesn't already have group with same name as context\n group_contextname = \"context_\"+contextname\n if Group.find_by_user_id_and_name(@user.id, group_contextname) != nil\n render :text => \"Group with context name already exist, use another context name! \\n\", :status => 409\n return \n end\n \n # Checks that user doesn't already have context saved with same name\n if ContextName.find_by_user_id_and_name(@user.id, contextname) != nil\n render :text => \"Context name already in use for this user! \\n\", :status => 409\n return \n end\n\n # Create unique hash for context\n context_hash = Digest::SHA1.hexdigest(@user.username+\".\"+contextname+Time.now.tv_sec.to_s)\n\n if params[:icon_data]\n icon_name = \"#{context_hash}.png\"\n icon_path = \"public/thumbnails/context_thumbnails/\"\n puts \"icon created!\" if createIcon(params[:icon_data].read, icon_name, icon_path)\n \n end\n \n \n metadatas = []\n query_part = \"\"\n \n metadata = params[:metadata] ? params[:metadata].split('+') : []\n tags = \"\"\n metadata.each_index do |i|\n md = metadata[i]\n type, value = md.split('/')\n if type and value\n metadatas.push({type => value})\n # There can be multiple values for tag -> they are all collected to tags\n if type == \"tag\"\n tags += '+' if tags != \"\"\n tags += value\n else\n query_part += '&' if query_part != \"\"\n query_part += \"q[#{type}]=#{value}\"\n end\n end\n end\n \n # If tags were found, add them to query url\n if tags != \"\"\n query_part += '&' if query_part != \"\"\n query_part += \"q[tag]=#{tags}\"\n end\n \n private_context = params[:private] ? params[:private] : true \n \n \n #puts \"query_part #{query_part}\"\n query_uri = \"/files.atom?#{query_part}\"\n \n \n icon_uri = params[:icon_data] ? \"/thumbnails/context_thumbnails/#{context_hash}.png\" : \"/thumbnails/vR_context_1.png\"\n \n description = params[:description] ? params[:description] : \"\"\n \n begin_time = params[:begin_time] ? QueryController::transform_date(params[:begin_time]) : \"\"\n end_time = params[:end_time] ? QueryController::transform_date(params[:end_time]) : \"\"\n \n \n location = nil\n \n if params[:location]\n \n location = params[:location].strip.downcase\n \n # To see if geonames search didn't throw exception\n geonames_success = false\n #### Geonames has been down from time to time. uncomment the below to take geonames back to use.\n=begin begin\n # Gets the location details of the given location string\n details = getLocationDetails(location)\n # Generate metadata from the location details\n details.each do |type, value|\n metadatas.push({type.to_s => value})\n \n # Found details from geonames, no need for OpenStreetMap\n geonames_success = true\n \n end\n rescue Exception => exp\n putsE(exp)\n puts \"Could not connect to GeoNames. Will try OpenStreetMap.\"\n # metadatas.push({\"context_location_name\" => location})\n=end end\n \n # If coudn't get location details from geonames, try openStreetmap instead:\n if not geonames_success\n begin\n # Gets the location details of the given location string\n details = getLocationDetailsFromOSM(location) \n # Generate metadata from the location details\n details.each do |type, value|\n puts \"type: #{type.to_s} . Value: #{value}\"\n metadatas.push({type.to_s => value})\n end\n \n rescue Exception => exp\n putsE(exp)\n puts \"Could not connect to OpenStreetMap either.\"\n metadatas.push({\"context_location_name\" => location}) \n end\n \n end\n end\n \n # Creates XMPP node for the context. Node naming goes: /home/<host>/visualrestmain_node/<context_hash>\n node_path, node_service = XmppHelper::createContextNode(context_hash)\n if not node_path or not node_service\n node_path = \"\" \n node_service = \"\"\n end\n \n #query_uri += \"&sparse=false\"\n \n # Add context_hash to query_uri\n query_uri += \"&q[context_hash]=#{context_hash}\"\n \n # Create the context\n @new_context = Context.create(:name => contextname, :user_id => @user.id, :query_uri => query_uri,\n :icon_url => icon_uri, :description => description,\n :location_string => location,\n :begin_time => begin_time, :end_time => end_time, :private => private_context,\n :context_hash => context_hash,\n :node_path => node_path, :node_service => node_service)\n \n if not @new_context\n raise Exception.new(\"Couldn't save the context!\")\n end\n\n\n # Create context_name for the creator of context\n ContextName.create(:context_id => @new_context.id,\n :name => @new_context.name,\n :context_hash => @new_context.context_hash,\n :user_id => @user.id,\n :username => @user.username)\n\n \n # Creates a group named context_contextName and authorizes the group to context\n \n new_group = Group.create(:name => group_contextname, :user_id => @user.id)\n \n if not new_group\n puts \"Error creating group for the context\"\n end\n\n ContextGroupPermission.create(:group_id => new_group.id,\n :context_id => @new_context.id)\n \n # Adds creator of context to the group\n Usersingroup.find_or_create_by_user_id_and_group_id(:user_id => @user.id, :group_id => new_group.id)\n\n # Adds users given in parameters into new_group that was created \n if params[:user]\n user = params[:user] ? params[:user].split('+') : \"\"\n \n # Go through every user in params\n user.each do |x|\n \n # Find the user\n u = User.find_by_username(x)\n if u\n \n # Add user to the new_group\n Usersingroup.find_or_create_by_user_id_and_group_id(:user_id => u.id, :group_id => new_group.id)\n \n # Get suggestions for contextname for this user\n sugg = suggestContextNames(u.username, contextname)\n \n ## Notifies every device of users that they were added to the context\n \n # Go through all devices of user\n u_devices = Device.find_all_by_user_id(u.id)\n if u_devices\n # Create xmpp message\n message = '<vr-xmpp-message>\n <message>You have been authorized for a new context! You can add it to your contexts with a name that you like</message>'\n\n sugg.each do |x|\n message += '<suggested-transition>\n <description>'+x+'</description>\n <url method=\"put\">http://visualrest.cs.tut.fi/user/'+u.username+'/contexts/'+x+'</url>\n <parameters>\n <context_hash>'+@new_context.context_hash+'</context_hash>\n <i_am_client>true</i_am_client>\n <auth_username>'+u.username+'</auth_username>\n <auth_timestamp></auth_timestamp>\n <auth_hash></auth_hash>\n </parameters>\n </suggested-transition>' \n end\n message += '</vr-xmpp-message>'\n \n u_devices.each do |dev| \n # Send xmpp message with link. If user goes to the link, he is added to the group\n # XmppHelper::sendXmppMessage(dev.xmppname, message)\n #puts dev.xmppname\n #puts message\n end\n end\n end \n end\n end\n\n\n # Authorizes given groups to the context\n group_names = []\n \n if params[:group]\n group_names = params[:group] ? params[:group].split('+') : \"\"\n group_names.each do |gn|\n group = Group.find(:first, :conditions => [\"name = ? and user_id = ?\", gn, @user.id])\n if group != nil\n ContextGroupPermission.find_or_create_by_group_id_and_context_id(:group_id => group.id,\n :context_id => @new_context.id)\n end \n end\n end\n \n \n # Creates the given metadatas for the context\n metadatas.each do |md|\n md.each do |type,value|\n metadata_type = MetadataType.find_by_name(type)\n if metadata_type\n if @@multi_metadata_types_for_context.include?(metadata_type.name)\n \n new_mdata = ContextMetadata.find_or_create_by_context_id_and_metadata_type_id_and_value(\n :context_id => @new_context.id, \n :metadata_type_id => metadata_type.id,\n :value => value.downcase)\n else\n new_mdata = ContextMetadata.find_or_create_by_context_id_and_metadata_type_id(\n :context_id => @new_context.id, \n :metadata_type_id => metadata_type.id,\n :value => value.downcase)\n end\n end\n end\n end\n \n \n rescue Exception => exp\n putsE(exp)\n render :text => \"Error in creating context \\n\", :status => 409\n return\n end\n\n\n \n\n\n\n\n # atom feed needs @context and @context_metadatas\n @context = @new_context\n # get metadatas with sql, gets also metadata_type names\n @context_metadatas = ContextMetadata.find_by_sql(\"SELECT context_metadatas.context_id as id, \n context_metadatas.value as value, \n metadata_types.name as type_name,\n metadata_types.value_type as value_type\n FROM context_metadatas, metadata_types\n WHERE context_metadatas.metadata_type_id = metadata_types.id AND \n context_metadatas.context_id = #{@context.id}\")\n \n @owner = @context.user\n @contextname = @context.name\n @context_named_by_user = @context.name\n\n sql = \"SELECT users.* \n FROM context_group_permissions, groups, usersingroups, users \n WHERE context_group_permissions.context_id=#{@context.id} AND \n context_group_permissions.group_id = groups.id AND \n groups.id=usersingroups.group_id AND usersingroups.user_id=users.id;\"\n @members = User.find_by_sql(sql)\n\n\n begin\n puts \"Sends notification to node!\"\n XmppHelper::publishToContextGeneralNode(@context)\n puts \"Notification sent!\"\n rescue Exception => ee\n putsE(ee)\n end\n\n\n\n # Create atom-feed. Returns info about the created context. \n @host = @@http_host\n respond_to do |format|\n format.atom {render :getcontext, :layout=>false }\n end\n end",
"def set_session\n unless logged_in?\n create_new_user\n clear_old_sessions if $USE_SQL_SESSION_MANAGEMENT\n # expire home page fragment caches after specified internal to keep it fresh\n if $CACHE_CLEARED_LAST.advance(:hours => $CACHE_CLEAR_IN_HOURS) < Time.now\n expire_cache('home')\n $CACHE_CLEARED_LAST = Time.now()\n end\n end\n end",
"def init_globals\n $process_vars = ThreadSafeHash::ThreadSafeHashMonitored.new(Params['enable_monitoring'])\n $tmp_content_data_file = nil # will be init during execution\n $testing_memory_active = false\n $testing_memory_log = nil\n $indexed_file_count = 0\n $local_content_data = nil\n $local_content_data_lock = nil\n $remote_content_data_lock = nil\n $remote_content_data = nil\n $last_content_data_id = nil\n end",
"def initialize context\n @context = context\n @store = context.store\n\n @seen = {}\n end",
"def temporary_jobs\n @jobs = Job.all\n @cart = current_cart unless session[:cart_id].blank?\n end",
"def setup\n unless @admin_session.log_in('admin@mit.edu', 'mit')\n unless @admin_session.sign_up('admin@mit.edu', 'mit')\n raise 'Failed to sign up admin@mit.edu'\n end\n unless @admin_session.log_in('admin@mit.edu', 'mit')\n raise 'Failed to log in after signing up admin@mit.edu'\n end\n end\n unless @admin_session.view_course_home(@course)\n unless @admin_session.create_course(@course)\n raise 'Failed to create course'\n end\n end\n\n @staff_session = LoadTestSession.new @root_url\n unless @staff_session.log_in('staff@mit.edu', 'mit')\n unless @staff_session.sign_up('staff@mit.edu', 'mit')\n raise 'Failed to sign up staff@mit.edu'\n end\n unless @staff_session.log_in('staff@mit.edu', 'mit')\n raise 'Failed to log in after signing up staff@mit.edu'\n end\n unless @staff_session.register_staff(@course)\n raise 'Failed to register staff@mit.edu as course staff'\n end\n unless @admin_session.approve_staff_requests(@course) >= 1\n raise 'Failed to approve staff@mit.edu as course staff'\n end\n end\n\n assignment_id = nil\n unless assignments = @staff_session.list_assignments(@course)\n raise 'Failed to list course assignments'\n end\n unless assignment_id = assignments['Load Lab']\n analyzer_path = File.expand_path(\n '../../fixtures/files/analyzer/fib_small.zip', __FILE__)\n unless assignment_id = @staff_session.create_load_test_assignment(\n @course, 'Load Lab', analyzer_path)\n raise 'Failed to create load test assignment'\n end\n unless @staff_session.release_assignment(@course, assignment_id)\n raise 'Failed to release load test assignment'\n end\n end\n\n @assignment_id = assignment_id\n end",
"def prepare_for_configuration \n # clear_base_directory\n make_base_directory\n copy_misc_templates\n copy_custom_monitors\n store_keys_in_file\n Script.save!(self)\n # not my favorite...\n copy_ssh_key\n before_configuration_tasks\n end",
"def tmp_root_path\n @tmp_root_path ||= File.realpath(Dir.mktmpdir)\n end",
"def make_tmp_dir\n FileUtils.mkdir_p @log_dir\n Dir[\"#{@log_dir}/*\"].each do |file|\n FileUtils.rm_rf file\n end\n end",
"def cleanup\n if @logfile #make sure there is a log file meaning keylog started and migration was successful, if used.\n finish_up if session_good?\n time_stamp(\"exited\")\n end\n end",
"def execution_context\n initialize_context!(Object.new)\n end",
"def setup_environment\n puts \"===== setup_environment ======\"\n puts Time.now\n pp params\n pp session\n\n # Set some standard variables.\n @command = params[:cmd]\n @loddef = params[:loddef]\n @view_name = params[:viewname]\n @entity = params[:entity]\n @application, @task = get_task\n @view = @task.get_view( @view_name ) if @view_name\n puts \"view = #{@view}\"\n @messages = session[:messages]\n session[:messages] = []\n\n if @loddef\n jloddef = @application.getLodDef( @task.jtask, @loddef )\n # Default entity to root of loddef\n if @entity.nil?\n @entity = jloddef.getRoot.getName\n @parent_entity = @entity\n @root_entity = @entity\n else\n jparent = jloddef.getEntityDef( @entity ).getParent\n @parent_entity = jparent.nil? ? @entity : jparent.getName\n @root_entity = jloddef.getRoot.getName\n end\n end\nend",
"def mk_tmp_dir\n Dir.mktmpdir('janna-tmp-download-', '/tmp')\n end",
"def tmpdir\n File.join(Dir.tmpdir, 'ruby')\n end",
"def tmpdir\n used? ? File.join(DOCKER_MACHINE_DOCKER_HOME, 'tmp', Dir.tmpdir) : Dir.tmpdir\n end",
"def init \n\t\t\t@user_id, user_name = \"SELECT user_id, user_name FROM BULK_USER WHERE user_id=? AND user_pwd=?\", @user_name, @password\n\t\t\tif !@user_id || !user_name\n\t\t\t\traise \"login denied\"\n\t\t\tend\n\n\t\t\t@session_token = class.generateSessionToken @user, @client_ip\n\t\t\t\n\t\t\t\"INSERT INTO bulk_session (session_token, user_id, since, last_seen, ip_address)\n\t\t\t\tVALUES (?, ?, date('now'), date('now'), ?)\", @session_token, user_id, @client_ip\n\n\t\t\t@session_id= 'SELECT last_inserted_value'\n\t\t\t\n\t\tend",
"def test_check_and_maybe_load_taskstore\r\n=begin\r\n # if logging in, .path should equal /userdata/foo\r\n session[:id] = 1 # should simulate logging in\r\n logged_in_store = check_and_maybe_load_taskstore(@store)\r\n assert_match(/\\/userdata\\//, logged_in_store.path) # a /tmp/ path has been called\r\n # if logging out, .path should equal /tmp/foo\r\n session.clear # should simulate logging out\r\n logged_out_store = check_and_maybe_load_taskstore(@my_own_store)\r\n assert_match(/\\/tmp\\//, logged_in_store.path) # a /tmp/ path has been called\r\n=end\r\n end"
] | [
"0.6003464",
"0.5945935",
"0.5819618",
"0.5753736",
"0.569681",
"0.5682621",
"0.5508562",
"0.5484854",
"0.5477067",
"0.5477067",
"0.5443726",
"0.5436414",
"0.5398018",
"0.5394001",
"0.5382443",
"0.5358069",
"0.5342104",
"0.5337471",
"0.53160423",
"0.5294716",
"0.52557176",
"0.5251616",
"0.5242529",
"0.52293974",
"0.522236",
"0.5221786",
"0.5210291",
"0.5209593",
"0.519477",
"0.51946384",
"0.51783276",
"0.5176431",
"0.51715934",
"0.51591724",
"0.51583254",
"0.5141405",
"0.5137319",
"0.51361203",
"0.51309764",
"0.51235485",
"0.5105853",
"0.50889796",
"0.5074305",
"0.5068345",
"0.5060758",
"0.5050691",
"0.5037337",
"0.5034927",
"0.50338084",
"0.50305724",
"0.5021879",
"0.50137377",
"0.5000653",
"0.5000653",
"0.49990833",
"0.4997345",
"0.49898797",
"0.4980573",
"0.4974966",
"0.49670458",
"0.49604785",
"0.49545157",
"0.494945",
"0.4942925",
"0.49339372",
"0.4932127",
"0.49115905",
"0.48978648",
"0.48971885",
"0.48964387",
"0.4893734",
"0.48900905",
"0.48890698",
"0.488898",
"0.48867986",
"0.4882495",
"0.48819724",
"0.48816076",
"0.48739502",
"0.48579207",
"0.4854311",
"0.484594",
"0.48411885",
"0.48384833",
"0.48384786",
"0.4827059",
"0.4822142",
"0.48105532",
"0.48047507",
"0.4804374",
"0.48008555",
"0.47940865",
"0.479346",
"0.47913757",
"0.47906458",
"0.4789082",
"0.47852767",
"0.47729507",
"0.4769155",
"0.47684026"
] | 0.63703877 | 0 |
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.actionmailer.contact_mailer.notification.subject | def notification(contact)
@contact = contact
mail :to => @contact.email,
:subject => @contact.subject,
:body => @contact.body
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subject (recipient)\n subject_variables = alert_variables[:subject].dup\n subject_variables.merge!(recipient_details(recipient))\n subject = \"#{I18n.t(\"#{recipient_type.to_s}_subject_#{alert_name.to_s}\", subject_variables)}\"\n subject\n end",
"def translate(mapping, key)\n I18n.t(:\"notifications_subject\", :scope => [:eventifier, :notifications, key],\n :default => [:subject, key.to_s.humanize])\n end",
"def message_subject=(value)\n @message_subject = value\n end",
"def translate(mapping, key)\n I18n.t(:\"#{mapping.name}_subject\", :scope => [:devise, :mailer, key],\n :default => [:subject, key.to_s.humanize])\n end",
"def subject\n @mail.subject\n end",
"def subject\n @subject ||= Envelope::MessageTools.normalize(message.subject || '')\n end",
"def subject\n self['subject'] || msg['subject']\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def formatted_subject(text)\n name = PersonMailer.global_prefs.app_name\n label = name.blank? ? \"\" : \"[#{name}] \"\n \"#{label}#{text}\"\n end",
"def subject=(subject); @message_impl.setSubject subject; end",
"def subject_for(template, attributes = {})\n subject = EmailTemplate.subject_for(template)\n subject = I18n.t(\"email_templates.#{template}.default_subject\") if subject.nil?\n subject = \"No Subject\" if subject.nil?\n Florrick.convert(subject, add_default_attributes(attributes))\n end",
"def subject() self.headers[\"Subject\"] || \"[NO SUBJECT]\" end",
"def deliver_invitation(options = {})\n super(options.merge(subject: _('A Data Management Plan in %{application_name} has been shared with you') % {application_name: Rails.configuration.branding[:application][:name]}))\n end",
"def message_subject\n return @message_subject\n end",
"def subject=(string)\n set('Subject', string)\n end",
"def get_email_subject(email_type)\n email_subject = email_type\n case(email_type)\n when \"welcome\"\n email_subject = \"Welcome to Aspera Files\"\n when \"reset\"\n email_subject = \"Password Reset\"\n end\n return email_subject\n end",
"def email_subject(form)\n \"#{form.type_of_enquiry} - #{reference}\"\n end",
"def getEmailDefaults(subject, toEmail, ccEmail = nil)\n if Rails.env.eql? 'development'\n subject = \"[BASL-DEV] #{subject}\"\n toEmail = 'paigepon@gmail.com'\n ccEmail = toEmail\n else\n subject = \"[BASL] #{subject}\"\n end\n mailInfo = {\n :to => toEmail,\n :subject => subject,\n :cc => ccEmail\n }\n mailInfo\n end",
"def subject\n message.subject\n end",
"def subject\n @subject ||= \"(sans sujet)\"\n if @no_header_subject.nil?\n \"#{header_subject}#{@subject}\"\n else\n @subject\n end\n end",
"def subject\n @options.fetch(:subject) { \"Invitation\" }\n end",
"def setSubject(subject)\n @fields['subject'] = subject\n self\n end",
"def setSubject(subject)\n @fields['subject'] = subject\n self\n end",
"def setSubject(subject)\n @fields['subject'] = subject\n self\n end",
"def setSubject(subject)\n @fields['subject'] = subject\n self\n end",
"def course_notification_item_details(course)\n t('notifications.subscribe_course')\n end",
"def subject_name=(value)\n @subject_name = value\n end",
"def question_notification(asker, subject, details)\n @asker = asker\n @subject = subject\n @details = details\n\n mail to: \"Alex Yang <alexyang.personal@gmail.com>\",\n from: \"BaseRails <notifications@baserails.com>\",\n subject: \"#{asker} posted a new question on BaseRails\"\n end",
"def choose_subject(action, params = {})\n scope = [:mailers, mailer_name, action]\n key = :subject\n experiment_name = \"#{mailer_name}_mailer_#{action}_subject\".to_sym\n if experiment_active?(experiment_name)\n scope << key\n key = ab_test(experiment_name)\n end\n params.merge!(scope: scope)\n I18n.t(key, params)\n end",
"def new_notification_email(notification,receiver)\n @notification = notification\n @receiver = receiver\n #DIFFERENT FROM ORIGINAL----------------------\n subject = notification.subject.to_s\n subject = decode_basic_notification(subject,notification.notified_object)\n subject = subject.gsub(/\\n/,'')\n #END OF DIFFERENCE----------------------------\n subject = strip_tags(subject) unless subject.html_safe?\n mail(:to => receiver.send(Mailboxer.email_method,notification), :subject => t('mailboxer.notification_mailer.subject', :subject => subject)) do |format|\n format.text {render __method__}\n format.html {render __method__}\n end\n end",
"def headers\n { subject: \"#{I18n.t('cms.contact_form.subject_prefix')}: #{reason}: #{subject}\",\n to: Account.current.preferred_support_email,\n from: Account.current.preferred_support_email,\n reply_to: %(\"#{name}\" <#{email}>) }\n end",
"def subject\n self['subject']\n end",
"def translation_scope\n \"mailers.#{mailer_name.tr(\"/\", \".\").sub(\"_mailer\", \"\")}.#{action_name}\"\n end",
"def notification_msg\n author_name = author.firstname\n \"An issue has been reported by #{author_name}\"\n end",
"def email_subject\n sponsor_name = @config.plan.sponsor_name\n display_date = @date.to_s()\n if @config.div_id.present?\n email_subject = \"Payroll report for #{sponsor_name} for division #{@config.division_name}: #{display_date}\"\n else\n email_subject = \"Payroll report for #{sponsor_name}: #{display_date}\"\n end\n return email_subject\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def compose_email\n @title = t 'conclusion_draft_review.send_by_email'\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject_name\n return @subject_name\n end",
"def headers\n {\n :subject => \"Contact Form:#{subject}\",\n :to => Sufia::Engine.config.contact_email, \n :from => Sufia::Engine.config.from_email\n }\n end",
"def konsalt_mail params\n build_params params\n send_email t('emails.konsalta_mail.subject')\n end",
"def subject; @message_impl.getSubject; end",
"def subject_name\n subject_full_name\n end",
"def mailer_to\n resolve_value(_notification_email)\n end",
"def default_sender_address\n address = Mail::Address.new(Gitlab.config.gitlab.email_from)\n address.display_name = \"GitLab\"\n address\n end",
"def headers\n {\n :subject => %(#{subject}),\n :to => Contact.first.email,\n :body => %(#{message}),\n :from => %(\"#{email}\")\n }\n end",
"def headers\n {\n subject: I18n.t('contact.subject'),\n to: info_email,\n from: \"Deskspotting <#{info_email}>\"\n }\n end",
"def sender\n ENV['NOTIFICATION_FROM_EMAIL'] || 'noreply@some.gov'\n end",
"def default_i18n_subject(interpolations = {})\n ''\n end",
"def email_subject(&blk)\n @email_subject_block = blk if blk\n @email_subject_block\n end",
"def push_message_title\n case notification_type\n when 'conversation_creation'\n I18n.t('notifications.notification_title.conversation_creation', display_id: primary_actor.display_id, inbox_name: primary_actor.inbox.name)\n when 'conversation_assignment'\n I18n.t('notifications.notification_title.conversation_assignment', display_id: primary_actor.display_id)\n when 'assigned_conversation_new_message'\n I18n.t(\n 'notifications.notification_title.assigned_conversation_new_message',\n display_id: conversation.display_id,\n content: primary_actor.content&.truncate_words(10)\n )\n when 'conversation_mention'\n \"[##{conversation.display_id}] #{transform_user_mention_content primary_actor.content}\"\n else\n ''\n end\n end",
"def i18n_label\n \"email.#{name}_label\"\n end",
"def set_subject(subject)\n\t\tend",
"def send_notification(user, questionnaire)\n I18n.default_locale = I18n.locale = questionnaire.language.locale\n headers = {\n :from => 'Bnei Baruch <internet@kbb1.com>',\n :subject => I18n.t('notification.mailer.new_questionnaire_for_you'),\n :to => user.email,\n :date => Time.now.to_formatted_s(:rfc822)\n }\n @user = user\n @questionnaire = questionnaire\n mail(headers)\n end",
"def custom_mail( user, subject, title, contents )\n @user = user\n @host = GogglesCore::AppConstants::WEB_MAIN_DOMAIN_NAME\n @contents = contents\n @title = title\n #subject: \"[#{ GogglesCore::AppConstants::WEB_APP_NAME }@#{ @host }] #{ subject }\",\n mail(\n subject: \"#{ subject } [#{GogglesCore::AppConstants::WEB_APP_NAME}]\",\n to: user.email,\n date: Time.now\n )\n end",
"def subject(options = {})\n options = { :capitalize => true, :case => Grammar::Case::SUBJECT }.merge(options)\n pronoun_or_noun(@subject, @audience, options)\n end",
"def subject_alternative_name\n extensions[R509::Cert::Extensions::SubjectAlternativeName]\n end",
"def headers\n { subject: \"#{site_name} contact form\", to: site_email, from: email }\n end",
"def headers\n {\n subject: \"[#{Setting.site_name}] Neue Quelle eingesendet\",\n to: Setting.email,\n reply_to: email,\n from: Setting.get('from'),\n }\n end",
"def reminder_email(user)\n @user = user\n I18n.with_locale user.locale do\n mail to: @user.email\n end\n end",
"def community_member_email(sender, recipient, email_subject, email_content, community)\n @email_type = \"email_from_admins\"\n set_up_layout_variables(recipient, community, @email_type)\n with_locale(recipient.locale, community.locales.map(&:to_sym), community.id) do\n @email_content = email_content\n @no_recipient_name = true\n premailer_mail(:to => recipient.confirmed_notification_emails_to,\n :from => community_specific_sender(community),\n :subject => email_subject,\n :reply_to => \"\\\"#{sender.name(community)}\\\"<#{sender.confirmed_notification_email_to}>\")\n end\n end",
"def setup_email(user)\n @recipients = user.email\n @body[:user] = user\n @from = FROM_EMAIL\n @subject = case ENV['RAILS_ENV'] \n when 'development': \"[YourApp Development] \"\n when 'staging': \"[YourApp Staging] \"\n else \"[YourApp] \"\n end\n @sent_on = Time.now\n headers \"Reply-to\" => FROM_EMAIL\n end",
"def notice(notification)\n @notification = notification\n\n mail to: @notification.user_email, :subject => \"Cipher-tech wants you to know: #{@notification.notifier_type} #{@notification.message}\"\n end",
"def set_title\n @title = t(:message_2, :scope => [:controller, :exams])\n end",
"def get_subject_name\n subject_name = subject_header.text.sub! 'Subject:', ''\n subject_name = subject_name.strip!\n subject_name\n end",
"def welcome_email(resource)\n \n @resource = resource\n\n mail :to => @resource.email, :from => \"email@domain.com\", :subject => \"Subject line\"\n \n end",
"def headers\n {\n :subject => \"Contact from website\",\n :to => Site.current.preferred_contact_email,\n :from => %(\"#{lastname}\" <#{email}>)\n }\n end",
"def headers\n {\n :subject => \"Contact from website\",\n :to => Site.current.preferred_contact_email,\n :from => %(\"#{lastname}\" <#{email}>)\n }\n end",
"def send_questionnaire_notification(user, questionnaire)\n @locale = questionnaire.language.locale\n headers = {\n :from => 'Bnei Baruch <internet@kbb1.com>',\n :subject => I18n.t('notification.mailer.new_questionnaire_for_you', :locale => @locale),\n :to => user.email,\n :date => Time.now.to_formatted_s(:rfc822)\n }\n @user = user\n @questionnaire = questionnaire\n mail(headers) do |format|\n format.text\n format.html\n end\n end",
"def notify(type,subject,target=nil)\n self.notices.create :type => type, :subject => subject, :target => target\n end",
"def SetSubject(subject)\n\t\t#Subject of document\n\t\t@subject = subject\n\tend",
"def headers\n {\n :subject => %(<#{subject}>),\n\t\t\t:to => %(#{to}),\n :from => \"info@dreamyourweb.nl\"\n }\n end",
"def subject_titles\n @subject_titles ||= sw_subject_titles\n end",
"def headers\n {\n :subject => \"澄清:對於#{candidate_name}的#{record_type}\",\n # :to => \"wevote@watchout.tw\",\n :to => Setting.email.clarify,\n :from => %(\"#{name}\" <#{email}>)\n }\n end",
"def tutor_reserved_notification\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def subject\n title \n end",
"def twiki_created_notification(person, options={})\n @person = person\n mail(:to=>[@person.personal_email],\n :subject=>options[:subject] || \"Twiki account information (\"+@person.email+\")\",\n :date=>Time.now)\n end",
"def notify(msg, subject)\n end",
"def send_questionnaire_notification(user, questionnaire)\n @locale = questionnaire.language.locale\n headers = {\n :from => 'Bnei Baruch <noreply@svivatova.com>',\n :subject => I18n.t('notification.mailer.new_questionnaire_for_you', :locale => @locale),\n :to => user.email,\n :date => Time.now.to_formatted_s(:rfc822)\n }\n @user = user\n @questionnaire = questionnaire\n mail(headers) do |format|\n format.text\n format.html\n end\n end",
"def headers\n {\n :subject => \"#{subject}\",\n :to => \"tempress@temple.edu\",\n :from => %(\"#{name}\" <#{email}>)\n }\n end",
"def email_us(subject, body)\n unless ENV['RACK_ENV'] == 'development'\n recipient = \"The Awesome Team <openhsv@gmail.com>\"\n\n # First, instantiate the Mailgun Client with your API key\n mg_client = Mailgun::Client.new ENV['MAILGUN_PRIVATE']\n\n # Define your message parameters\n message_params = { from: 'postmaster@sandboxa148f93a5c5f4813a81365d1b873ee8f.mailgun.org',\n to: recipient,\n subject: subject,\n html: body,\n text: Nokogiri::HTML(body).text\n }\n\n # Send your message through the client\n mg_client.send_message 'sandboxa148f93a5c5f4813a81365d1b873ee8f.mailgun.org', message_params\n end # unless ENV['RACK_ENV'] == 'development'\n end",
"def subject\n @subject=EzCrypto::Name.new(@cert.subject) unless @subject\n @subject\n end",
"def notify_course_teaching_assignment( user , course ) \n @course = course\n @subject = @course.subject \n @school = @subject.school\n @user = user\n mail( :to => user.email, \n :subject => \"potoSchool | Tuga Mengajar pelajaran #{@subject.name}, kelas #{@course.name} \" )\n end",
"def new_motification_email(motification, receiver)\n @motification = motification\n @receiver = receiver\n set_subject(motification)\n mail :to => receiver.send(Mailboxer.email_method, motification),\n :subject => t('mailboxer.motification_mailer.subject', :subject => @subject),\n :template_name => 'new_motification_email'\n end",
"def mmm_test_subj_call\n ->(candidate) { I18n.t('email.test_monthly_mail_subject_initial_input', candidate_account_name: candidate.account_name) }\n end"
] | [
"0.7243274",
"0.7023452",
"0.70085",
"0.6858497",
"0.6765852",
"0.67308056",
"0.6669901",
"0.6416116",
"0.6415689",
"0.6414621",
"0.64133817",
"0.64133346",
"0.636281",
"0.6346839",
"0.6248559",
"0.62042373",
"0.6184172",
"0.6164868",
"0.6082074",
"0.60807705",
"0.6056458",
"0.60455936",
"0.60360235",
"0.60321134",
"0.5980061",
"0.5980061",
"0.5980061",
"0.5980061",
"0.5978432",
"0.597385",
"0.5973325",
"0.5972895",
"0.5931111",
"0.59038234",
"0.58920515",
"0.587451",
"0.58655375",
"0.58636177",
"0.5855147",
"0.5855147",
"0.5855147",
"0.5855147",
"0.5855147",
"0.5855147",
"0.5855147",
"0.5855147",
"0.58514726",
"0.5834878",
"0.5834878",
"0.5834878",
"0.5834878",
"0.5834878",
"0.5834878",
"0.5830373",
"0.58225256",
"0.5796473",
"0.579586",
"0.5761099",
"0.5751974",
"0.5749175",
"0.57393926",
"0.57334507",
"0.5706546",
"0.56986934",
"0.56945384",
"0.567465",
"0.56729865",
"0.5658617",
"0.56307817",
"0.56058586",
"0.5605761",
"0.5605635",
"0.55991864",
"0.5592348",
"0.5586634",
"0.5584536",
"0.5578913",
"0.5574619",
"0.5551195",
"0.5541664",
"0.55323917",
"0.55252427",
"0.55252427",
"0.5524281",
"0.5522316",
"0.5517671",
"0.55045116",
"0.5493372",
"0.5486999",
"0.54772717",
"0.5474505",
"0.54715663",
"0.5463406",
"0.5461399",
"0.5453612",
"0.5451787",
"0.5440714",
"0.54320264",
"0.54288816",
"0.5428544"
] | 0.54320997 | 97 |
before_action :set_calendar_properties before_action :set_mentee_id | def index
@latest_resources = Ebook.order("created_at desc").limit(5)
@coach_events = @current_user.events.where("endtime >= ? and coach_mentee_relation_id is null", Time.now).order("starttime asc").page params[:page] if @current_user.events
@coach_meetings = @current_user.events.where("endtime >= ? and coach_mentee_relation_id is not null", Time.now).order("starttime asc").page params[:page]
@user = @current_user
@mentees = @user.mentees.page params[:page]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_calendar_action\n @calendar_action = CalendarAction.find(params[:id])\n end",
"def set_mentee\n @mentee = Mentee.find(params[:id])\n end",
"def set_meal_schedule\n @meal_schedule = current_owner.meal_schedules.find(params[:id])\n end",
"def set_calendar_event\n @calendar_event = CalendarEvent.find(params[:id])\n end",
"def set_calendar_event\n @calendar_event = CalendarEvent.find(params[:id])\n end",
"def set_calendar\n @calendar = @hairdresser.calendars.find(params[:calendar_id])\n end",
"def assign_calendar\n @event.calendar = Calendar.find(params[:calendars_event][:calendar_id])\n end",
"def set_calender_event\n @calender_event = CalenderEvent.find(params[:id])\n end",
"def set_calendar_date\n @calendar_date = CalendarDate.find(params[:id])\n end",
"def set_calendar\n @calendar = Calendar.find(params[:id])\n end",
"def set_calender\n @calender = Calender.find(params[:id] || params[:calender_id])\n end",
"def set_event_attacment\n @event_attacment = EventAttacment.find(params[:id])\n end",
"def set_calendar_day\n @calendar_day = CalendarDay.find(params[:id])\n end",
"def set_calendar_day\n @calendar_day = CalendarDay.find(params[:id])\n end",
"def set_event_date\n @event_date = EventDate.find(params[:id])\n end",
"def set_event_date\n\t @event_date = EventDate.find(params[:id])\n\tend",
"def set_timeline_event\n @timeline_event = TimelineEvent.find(params[:id])\n end",
"def set_before_and_after\n @before_and_after = BeforeAndAfter.find(params[:id])\n end",
"def set_calendar\n @calendar = Calendar.find(params[:id])\n end",
"def set_calendar\n @calendar = Calendar.find(params[:id])\n end",
"def set_calendar\n @calendar = Calendar.find(params[:id])\n end",
"def set_calendar\n @calendar = Calendar.find(params[:id])\n end",
"def set_calendar\n @calendar = Calendar.find(params[:id])\n end",
"def set_calendar\n @calendar = Calendar.find(params[:id])\n end",
"def set_inspection_schedule\n @inspection_schedule = InspectionSchedule.find(params[:id])\n end",
"def set_webinar_attendee\n @webinar_attendee = WebinarAttendee.find(params[:id]) if params[:id]\n end",
"def set_calender\n @calender = Calender.find(params[:id])\n end",
"def set_tools_attendance_event\n @tools_attendance_event = Tools::Attendance::Event.find(params[:id])\n end",
"def correct_calendar\n @calcheck=Department.find(Calendar.find(params[:id]).department_id)\n redirect_to(calendars_url) unless current_emp.id==@calcheck.enterprise_id || current_user.role>3 \n end",
"def set_event_date\n @event_date = EventDate.find(params[:id])\n end",
"def set_employee_event\n @employee_event = EmployeeEvent.find(params[:id])\n end",
"def set_admin_event\n @admin_event = Event.find(params[:id])\n end",
"def set_event \n if current_user != nil\n @event = Event.find(params[:id])\n else\n redirect_to('/login?force=true')\n end\n end",
"def before_validation() \n #logger.info \"Tend: #{tend} // class: #{tend.class}\"\n self.published = true unless attribute_present?(\"published\") # pubblicato: yes\n self.starred = false unless attribute_present?(\"starred\") # starred: no\n #ric_change_parameter('starred',false)\n #self.birthday = Date.civil(1901,1,1) unless attribute_present?(\"birthday\") # compleanno 1gen1901\n self.nickname = _fake_nickname unless attribute_present?(\"nickname\") # i.e. 'rcarlesso'\n self.created_by ||= current_user.name rescue \"ModelCreatedBy: #{$!}\"\n self.updated_by = current_user.name rescue \"Probably Updated from shell and not from web: ''#{$!}''\"\n if (attribute_present?(\"organisation\") && ! attribute_present?(\"work_venue_id\") ) # --> autocreate workplace obj from string! Cool!\n self.work_venue = Venue.find_or_create_by_name(organisation.strip) rescue nil\n end\n if (attribute_present?(\"location\") && ! attribute_present?(\"venue_id\") ) # --> autocreate workplace obj from string! Cool!\n self.venue = Venue.find_or_create_by_name(location.strip) rescue nil\n end\n self.relevance = 42 unless attribute_present?(\"relevance\") # rilevanza 42\n # NON HO ACCESSO AL CURRENTUSER DA QUI! SOLO VIEW E CONTROLLER!!!\n #self.feed = \"Person:_:BeforeValidation(): person changed by ''#{@current_user rescue 'BOH'}'' on #{Time.now}\" unless attribute_present?(\"feed\") \n #self.nickname = self.nickname.nicknamize rescue nil # minuscolizza e toglie spazi\n self.email = self.email.strip if attribute_present?(\"email\")\n end",
"def set_attend_event\n @attend_event = AttendEvent.find(params[:id])\n end",
"def set_event\n @event = Event.find_by_id(params[:id])\n @event = {} if different_user?(@event)\n end",
"def set_e_date\n @e_date = EDate.find(params[:id])\n end",
"def set_post_event\n @post_event = PostEvent.find(params[:id])\n end",
"def set_expected_event\n \t\t@expected_event = ExpectedEvent.find(params[:id])\n \tend",
"def set_etablissement\n @etablissement = Etablissement.find(params[:id])\n end",
"def set_event_attendance\n @event_attendance = EventAttendance.find(params[:id])\n end",
"def set_event_day\n @event_day = EventDay.find(params[:id])\n end",
"def set_event\n @attendances = Attendances.find(params[:id])\n end",
"def set_entertainment\n @entertainment = Entertainment.find(params[:id])\n end",
"def set_schedule_day\n @schedule_day = ScheduleDay.find(params[:id])\n end",
"def set_event\n @attendance = Attendance.find(params[:id])\n end",
"def controller_issues_edit_before_save(context={ })\n\n issue = context[:issue]\n time_entry = context[:time_entry]\n\n if issue && time_entry\n # insere os dados no atributo auxiliar\n issue.ayty_before_time_entry = time_entry\n end\n\n end",
"def set_calendar\n @calendar = Calendar.find(params[:id])\n end",
"def set_meeting\n end",
"def set_incidente\n @incidente = Incidente.accessible_by(current_ability).find(params[:id])\n end",
"def before_action \n end",
"def set_establishment\n @establishment = Establishment.find(params[:id])\n unless @establishment.location\n @establishment.build_location\n end\n\n unless @establishment.social_link\n @establishment.build_social_link\n end\n\n @social_link = @establishment.social_link\n\n unless @establishment.profile_image\n @establishment.build_profile_image\n @establishment.profile_image.processed = true\n end\n\n unless @establishment.banner_image\n @establishment.build_banner_image\n @establishment.banner_image.processed = true\n end\n\n # set_service_times()\n end",
"def set_attendance_other\n @attendance_other = AttendanceOther.find(params[:id])\n end",
"def set_admin_event\n @admin_event = AdminEvent.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n @event = @participant.event\n @organization = @participant.organization\n end",
"def set_exceptional_date\n @exceptional_date = ExceptionalDate.find(params[:id])\n end",
"def set_event\n @event = Event.find(params[:attended_event_id])\n end",
"def set_event_action\n @event_action = EventAction.find(params[:id])\n end",
"def set_enfermeras_paciente\n @enfermeras_paciente = EnfermerasPaciente.find(params[:id])\n end",
"def set_edesalfact\n @edesalfact = Edesalfact.find(params[:id])\n end",
"def set_event\n # Get only current user events\n @event = current_user.events.find(params[:id])\n end",
"def set_the_event\n @event = Event.find(params[:id])\n @lectures = Lecture.where(event_id: params[:id])\n @workshops = Workshop.where(event_id: params[:id])\n end",
"def set_person_event\n @person_event = PersonEvent.find(params[:id])\n end",
"def set_event\n @event = current_user.events.find(params[:id])\n end",
"def set_scheduled_event\n @scheduled_event = ScheduledEvent.find(params[:id])\n end",
"def set_admin_calender\n @admin_calender = Admin::Calender.find(params[:id])\n end",
"def set_dates_schedule\n @dates_schedule = DatesSchedule.find(params[:id])\n end",
"def set_event\n @event = Event.find(params[:id]) if(Event.find_by_id(params[:id]) != nil)\n end",
"def set_maker\n @maker = MakerDeadline.find(params[:id])\n end",
"def set_etablissement\n @etablissement = Etablissement.find(params[:id])\n end",
"def set_schedule_action\n @schedule_action = ScheduleAction.find(params[:id])\n end",
"def edit_start_time\n authorize @event\n end",
"def set_lunch_event\n @lunch_event = LunchEvent.find(params[:id])\n end",
"def set_tender\n @tender = Core::Tender.find(params[:tender_id])\n end",
"def set_tender\n @tender = Core::Tender.find(params[:tender_id])\n end",
"def set_post_event\n @post_event = PostEvent.find(params[:id])\n end",
"def set_center_attention_employee\n @center_attention_employee = CenterAttentionEmployee.find(params[:id])\n end",
"def set_postulation_date\n @postulation_date = PostulationDate.find(params[:id])\n end",
"def set_default_line_calendar\n @default_line_calendar = DefaultLineCalendar.find(params[:id])\n end",
"def set_default_line_calendar\n @default_line_calendar = DefaultLineCalendar.find(params[:id])\n end",
"def set_event_owner\n @event = EventOwner.find(params[:id])\n end",
"def set_door_event\n @door_event = DoorEvent.find(params[:id])\n end",
"def set_event\n @event = Event.find_by(id: params[:id])\n if(@event == nil)\n flash[:warning] = [\"Este evento nao existe\"]\n redirect_to events_path\n end\n end",
"def set_announcement_for\n @announcement_for = AnnouncementFor.find(params[:id])\n end",
"def create\n @mentee = Mentee.new(mentee_params)\n @users=User.all\n @user=@users.last\n @mentee[:user_id] = @user.id\n if @mentee.save\n if current_user.mentor && current_user.mentee\n @mentor = Mentor.new()\n render 'additional_mentor'\n else\n redirect_to home_path\n end\n end\n end",
"def set_incidencia_empleado\n @empleado = Empleado.find(params[:empleado_id])\n @incidencia_empleado = @empleado.incidencia_empleados.find(params[:id])\n end",
"def create\n getFullNameEmployees\n @announcement = Announcement.new(announcement_params)\n if @announcement.global\n @announcement.employee_id=0\n end\n @announcement.accepted = false\n\n # @announcement.global = true\n respond_to do |format|\n\n if @announcement.save\n format.html { redirect_to @announcement, notice: 'Anuncio fue creado.' }\n format.json { render :show, status: :created, location: @announcement }\n else\n format.html { render :new }\n format.json { render json: @announcement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_asistencia_evento\n @asistencia_evento = AsistenciaEvento.find(params[:id])\n end",
"def set_person_schedule\n @person_schedule = PersonSchedule.find(params[:id])\n end",
"def create\n if params[:start_date].present?\n mes_para_consulta = params[:start_date].to_date\n else\n mes_para_consulta = Date.current\n end\n\n beginning_of_month = mes_para_consulta.beginning_of_month\n end_of_month = beginning_of_month.end_of_month\n\n @appointments_todos = Appointment.where(schedule_on: beginning_of_month..end_of_month)\n @appointments_todos = @appointments_todos.para_o_calendar(current_user.calendar_id)\n\n\n\n @appointment = Appointment.new(appointment_params)\n @appointment.calendar_id = current_user.calendar_id\n\n respond_to do |format|\n if @appointment.save\n format.html { redirect_to @appointment, notice: t('create_success') }\n format.json { render :show, status: :created, location: @appointment }\n else\n format.html { render :new }\n format.json { render json: @appointment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_announcement\n @announcement = Announcement.find(params[:id])\n end",
"def set_empolyee\n @empolyee = Empolyee.find(params[:id])\n end",
"def set_elective_day\n @elective_day = ElectiveDay.find(params[:id])\n end",
"def set_calendar\n @calendar = Calendar.find(params[:id])\n @site = @calendar.site\n end",
"def set_staffevent\n @staffevent = Staffevent.find(params[:id])\n end",
"def create\n\n if params[:event][:user_id].nil?\n params[:event][:user_id] = current_user.id.to_s\n end \n \n @event = Event.create(params[:event].except(:participants))\n current_user.events.push @event\n @event.participants.create(:user_id => current_user.id, :hasResponded => false, :isAttending => true ,:isAdmin => true ).save\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to(:controller => \"calendar\", :action => \"index\", :notice => 'Event was successfully created.') }\n format.xml { render :xml => @event, :status => :created, :location => @event }\n format.js\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n\n\n\n end",
"def set_employee_shift\n @employee_shift = EmployeeShift.find(params[:id])\n end"
] | [
"0.6450391",
"0.62939703",
"0.6256227",
"0.6177849",
"0.6177849",
"0.6173744",
"0.614772",
"0.61113065",
"0.61035067",
"0.6067273",
"0.6054016",
"0.60212815",
"0.59946847",
"0.59946847",
"0.5960237",
"0.5957285",
"0.5943573",
"0.5926493",
"0.5924956",
"0.5924956",
"0.5924956",
"0.5924956",
"0.5924956",
"0.5924956",
"0.59151345",
"0.5910006",
"0.58907217",
"0.5878436",
"0.58571076",
"0.58565205",
"0.5850916",
"0.58180714",
"0.5810379",
"0.5796598",
"0.5793708",
"0.57900786",
"0.57844615",
"0.5771469",
"0.57547104",
"0.5750651",
"0.5744993",
"0.574462",
"0.5743811",
"0.57409054",
"0.5740041",
"0.5728524",
"0.5725796",
"0.57253623",
"0.57193726",
"0.57184136",
"0.5710233",
"0.5702909",
"0.5702007",
"0.56872815",
"0.5685811",
"0.5669597",
"0.5665918",
"0.56373245",
"0.56250715",
"0.5623755",
"0.5620037",
"0.5617176",
"0.5612546",
"0.56021327",
"0.5592935",
"0.5591516",
"0.55895925",
"0.5587513",
"0.5586281",
"0.5581304",
"0.5571747",
"0.5567172",
"0.5567055",
"0.55660015",
"0.55660015",
"0.5562088",
"0.5560436",
"0.55588174",
"0.5555086",
"0.5555086",
"0.555156",
"0.5550895",
"0.55430603",
"0.553755",
"0.55365455",
"0.5534593",
"0.55343866",
"0.5533032",
"0.5529441",
"0.55285835",
"0.5528211",
"0.5528211",
"0.5528211",
"0.5528211",
"0.5528211",
"0.5527011",
"0.5520238",
"0.55193245",
"0.55154043",
"0.55134314",
"0.5512495"
] | 0.0 | -1 |
The first indentation becomes the maximum indentation to remove. | def test_unindent_4()
string = <<-heredoc
one
two
three
heredoc
expected = "one\ntwo\n three\n"
result = string.unindent
assert_equal( expected, result )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unindent!\n gsub!(/^[ \\t]{#{minimum_leading_whitespace}}/, '')\n end",
"def unindent\n @__indent__ ||= 0\n @__indent__ -= indentation\n end",
"def reset_indentation!(modifier = 0)\n indent!(-find_least_indentation + modifier)\n end",
"def reset_indentation(modifier = 0)\n indent(-find_least_indentation + modifier)\n end",
"def reset_indentation_length()\n puts \"reset_indentation_length\"\n end",
"def strip_leading_indentation\n if (indent = leading_indentation_length) > 0\n collect { |line| line =~ /^[\\s]+[^\\s]/ ? line[indent..-1] : line }.join\n else\n self\n end\n end",
"def unindent_base_old(in_place, warn_first_not_min)\n margins = self.scan(/^[ \\t]*/).map(&:size)\n margins_min = margins.min\n if margins.first != margins_min && warn_first_not_min\n puts \"warning: margin of the first line differs from minimum margin\"\n end\n return in_place ? nil : self.dup unless margins_min != 0\n re = Regexp.new('^\\s{' + margins_min.to_s + '}' )\n in_place ? gsub!(re, '') : gsub(re, '')\n end",
"def indentation; end",
"def indentation; end",
"def unindent\n gsub(/^#{self[/\\A\\s*/]}/, \"\")\n end",
"def decrement_indent\n\t\t\t@indent[-1] -= 1\n\t\tend",
"def unindent\n self.gsub(/^#{self[/\\A\\s*/]}/, \"\")\n end",
"def unindent(s)\n s.gsub(/^#{s.scan(/^[ \\t]+(?=\\S)/).min}/, \"\")\n end",
"def unindent(text)\n lines = text.split(\"\\n\")\n lines.shift while lines.first =~ /^\\s*$/ && !lines.empty?\n lines.pop while lines.last =~ /^\\s*$/ && !lines.empty?\n min_indent = lines.reject { |ln| ln =~ /^\\s*$/ }\n .map { |ln| ln.scan(/^\\s*/) }.flatten.map(&:length).min\n lines.map { |ln| ln.sub(/^\\s{#{min_indent}}/, '') }.join(\"\\n\")\nend",
"def unindent_base_new(in_place, warn_first_not_min, args)\n args = DefaultUnindentBaseNewArgs.merge(args)\n m_first = nil\n m_min = nil\n if args[:ignore_empty] || args[:ignore_blank]\n rl = self.lines # relevant lines\n if args[:ignore_blank]\n rl.reject! {|l| l[/^[ \\t]*$/] }\n elsif\n rl.reject! {|l| l.chomp.empty? }\n end\n margins = rl.map {|l| l.gsub(/(\\s*)\\S?.*\\n/,'\\1').size }\n m_first = margins.first\n m_min = margins.min\n else\n self.scan(/^[ \\t]*/) do |m|\n ms = m.size\n m_first ||= ms\n m_min = ms if !m_min || ms < m_min\n # break if ms == 0 ## only worth if the probability of marginless line above certain threshold\n end\n end\n if m_first != m_min && warn_first_not_min\n puts \"warning: margin of the first line differs from minimum margin\"\n end\n return in_place ? nil : self.dup unless m_min > 0\n re = Regexp.new('^[ \\t]{,' + m_min.to_s + '}' )\n in_place ? gsub!(re, '') : gsub(re, '')\n end",
"def unindent(txt, n = 2)\n txt.gsub /^[ ]{#{n}}/, ''\n end",
"def unindent\n (other = dup) and other.unindent! and other\n end",
"def outdent(n)\n indent(-n)\n end",
"def outdent(n)\n indent(-n)\n end",
"def fixed_indent(n)\n self.outdent(self.level_of_indent).indent(n)\n end",
"def indent; end",
"def indent; end",
"def indent; end",
"def indent; end",
"def indent; end",
"def unindent(dirty_text, left_padding = 0)\n text = dirty_text.sub(/\\A[ \\t]+\\z/, '') # Empty blank lines.\n\n # Find the longest common whitespace to all indented lines. Ignore lines\n # containing just -- or ++ as these seem to be used by comment authors\n # as delimeters.\n scanned_text = text.scan(/^[ \\t]*(?!--\\n|\\+\\+\\n)(?=[^ \\t\\n])/)\n margin = scanned_text.inject do |current_margin, next_indent|\n if next_indent.start_with?(current_margin)\n current_margin\n elsif current_margin.start_with?(next_indent)\n next_indent\n else\n ''\n end\n end\n\n text.gsub(/^#{margin}/, ' ' * left_padding)\n end",
"def unindent line\n if @options[:unindent] and\n @program.new_line? and\n margin = @margins.last and\n crown = @crowns.first\n then\n line.gsub(/^#{margin}/, crown)\n else\n line\n end\n end",
"def normalize_indentation text\n lines = text.split(\"\\n\")\n return text if lines.empty?\n\n indent = if lines[0] =~ /^(\\s+)(.+?)$/\n $1.length\n else\n 0\n end\n lines.map{|l| l[indent..-1]}.join \"\\n\"\n end",
"def indentation_level\n spaces = (@source.size - @stripped_source.size)\n spaces == 0 ? 0 : spaces / 2\n end",
"def indent1\n ' ' * 2\n end",
"def find_minimum_indent\n self.lines.map { |s| s.index(/[^\\s]/) unless s.empty? }.compact.min\n end",
"def unindent(text, left_padding = 0)\n # Empty blank lines\n text = text.sub(/^[ \\t]+$/, '')\n\n # Find the longest common whitespace to all indented lines\n margin = text.scan(/^[ \\t]*(?=[^ \\t\\n])/).inject do |current_margin, next_indent|\n if next_indent.start_with?(current_margin)\n current_margin\n elsif current_margin.start_with?(next_indent)\n next_indent\n else\n \"\"\n end\n end\n\n text.gsub(/^#{margin}/, ' ' * left_padding)\n end",
"def indent_in\n @indent.slice!(-1, 1)\n end",
"def unexpected_indent_offset; end",
"def undent\n indent = split(\"\\n\").select { |line| !line.strip.empty? }.map { |line| line.index(/[^\\s]/) }.compact.min || 0\n gsub(/^[[:blank:]]{#{indent}}/, '').chomp\n end",
"def level_of_indent\n self.scan(/^ *(?=\\S)/).map { |space| space.length }.min || 0\n end",
"def level_of_indent\n self.scan(/^ *(?=\\S)/).map { |space| space.length }.min || 0\n end",
"def backdent(line)\n @indent_level -= 1\n @lines << indent(line)\n @indent_level += 1\n end",
"def unindent(text)\n return \"\" if text.nil?\n\n len = text.split(\"\\n\").reject { |l| l.strip.empty? }.map { |x| x.index(/[^\\s]/) }.compact.min\n text.gsub(/^[[:blank:]]{#{len}}/, \"\").strip\n end",
"def indent\n return unless blank?\n write(' ' * @indentation)\n self\n end",
"def indent()\n #This is a stub, used for indexing\n end",
"def increment_indent\n\t\t\t@indent[-1] += 1\n\t\tend",
"def strip_indent(str) # :nodoc:\n if str =~ /\\A\\s*?\\n( *)(.*)\\z/m\n indent, str = $1, $2, $3\n \n if indent.length > 0\n str.gsub!(/^ {0,#{indent.length}}/, '')\n end\n end\n \n str\n end",
"def correct_indentation(node); end",
"def indentation\n \" \" * @indent_size * @indent_level\n end",
"def unindent(text)\n text.strip.gsub(/^\\s+/, \"\")\n end",
"def change_indent plus\n # nothing here\n end",
"def unindent_markdown(markdown)\n return nil if markdown.nil?\n\n natural_indent = markdown.lines.collect { |l| l.index(/[^ ]/) }.select { |l| !l.nil? && l.positive? }.min || 0\n markdown.lines.map { |l| l[natural_indent..-1] || \"\\n\" }.join.lstrip\nend",
"def deindent(str, leading_spaces: T.unsafe(nil)); end",
"def outdent( str )\n\t\t\tstr.gsub( /^(\\t|[ ]{1,#{TabWidth}})/, '')\n\t\tend",
"def indent=(_arg0); end",
"def nominal_indent\n @nominal_indent ||= stats(whitespace_indents.reject(&:empty?)).mode || ' '\n end",
"def indent\n @__indent__ ||= 0\n @__indent__ += indentation\n end",
"def indentation_pattern()\n return /^(?: \\t)+/\n end",
"def set_default_indent(line)\n $default_indent = count_indent(line)\nend",
"def unindent(text)\n lines = text.lines\n whitespace = lines.first.scan(/^\\s*/).first\n lines.map do |l|\n l.gsub(/^#{whitespace}/, \"\")\n end.join\nend",
"def cut_indent(lines, redundant_spaces)\n lines.map do |line|\n line.strip.empty? ? line : line[redundant_spaces..-1]\n end\nend",
"def strip_listing(code)\n code = code.dup\n code.gsub!(/\\t/, \" \")\n lines = code.split(\"\\n\")\n first_code_line = lines.index { |l| l =~ /\\S/ }\n last_code_line = lines.rindex { |l| l =~ /\\S/ }\n code_lines = lines[first_code_line..last_code_line]\n line_indents = code_lines.map { |l| l.index(/\\S/) || 0 }\n min_indent = line_indents.min\n unindented_code = code_lines.map { |l| l[min_indent..-1] }.join(\"\\n\")\n unindented_code.strip\n end",
"def with_indent ()\n thread[:indent] += 1\n yield\n ensure\n thread[:indent] -= 1\n end",
"def close_indentation!\n outdent_token(@indent)\n end",
"def indent_each_line!(indent_sequence=\"\\t\")\n\t\treturn self.collect!{ |line|\t\"#{indent_sequence}#{line}\" }\n\tend",
"def logend\n @@indentation_level -= 1\n\n LOGGERS.each {|logger|\n logger.change_indent(false)\n }\nend",
"def process_indent(line)\n return unless line.tabs <= @template_tabs && @template_tabs > 0\n\n to_close = @template_tabs - line.tabs\n to_close.times {|i| close unless to_close - 1 - i == 0 && mid_block_keyword?(line.text)}\n end",
"def strip_heredoc\n indent = scan(/^[ \\t]*(?=\\S)/).min.try(:size) || 0\n gsub(/^[ \\t]{#{indent}}/, '')\n end",
"def haml_indent\n ' ' * haml_buffer.tabulation\n end",
"def max_common_indentation(lines)\n indent = Float::INFINITY\n lines.each do |line|\n unless line.strip.empty?\n spaces = line[/^ */].size\n if spaces < indent\n indent = spaces\n end\n end\n end\n indent == Float::INFINITY ? 0 : indent\nend",
"def clean path, indent=0\n path = path.gsub(/.+?\\//, \" \")\n indent == 0 ?\n path :\n path.sub(/^#{indent}/, '')\n end",
"def decreases_indent_level?(input)\n last_token = input.chomp[/[\\w\\d]+\\z/]\n last_token == \"end\"\n end",
"def outdent(flag=nil)\r\n current_indent = @indents.last\r\n \r\n if current_indent.nil?\r\n yield\r\n else\r\n flag ||= \":outdent_#{rand(10000000)}:\"\r\n @outdents << flag\r\n \r\n write \"#{flag}#{current_indent.length}:#{rstrip}\"\r\n @indents << ''\r\n \r\n yield\r\n \r\n @indents.pop\r\n \r\n write \"#{flag}#{rstrip}\"\r\n end\r\n \r\n self\r\n end",
"def unindent str\n lines = str.split(\"\\n\")\n spaces = minimum_leading_spaces lines\n lines.collect do |line|\n line.slice(spaces, line.length).rstrip\n end.join(\"\\n\")\n end",
"def optimize_indentation(value, amount = 0) # :doc:\n return \"#{value}\\n\" unless value.is_a?(String)\n\n if value.lines.size > 1\n value.strip_heredoc.indent(amount)\n else\n \"#{value.strip.indent(amount)}\\n\"\n end\n end",
"def _Indent\n _tmp = scan(/\\G(?-mix:\\t| )/)\n set_failed_rule :_Indent unless _tmp\n return _tmp\n end",
"def close_lower_level_tags\n # If indentation level is less than or equal to previous level\n if @current_level <= @previous_level\n # Close all indentations greater than or equal to indentation level of this line\n while @open_tags.length > 0 and @open_tags[@open_tags.length - 1][0] >= @current_level do\n self.close_tag\n end\n end\n self\n end",
"def heredoc_unindent!(warn_first_not_min=true, args={})\n unindent_base(true, warn_first_not_min, args)\n end",
"def indent_atom; \" \"; end",
"def indent_for(line); end",
"def indent(n)\n if n >= 0\n gsub(/^/, ' ' * n)\n else\n gsub(/^ {0,#{-n}}/, \"\")\n end\n end",
"def indent(n)\n if n >= 0\n gsub(/^/, ' ' * n)\n else\n gsub(/^ {0,#{-n}}/, \"\")\n end\n end",
"def outdent(text)\n lines = text.split(\"\\n\")\n indented_with = /^ +/.match(lines.first)[0]\n lines.map { |line| line.gsub(/^#{indented_with}/, '') }.join(\"\\n\") + \"\\n\"\n end",
"def process_current_level\n @previous_level = @current_level * 1\n leading_whitespace = self.class.get_leading_whitespace_from_text @text\n if leading_whitespace == \"\"\n @current_level = 0\n \n # If there is leading whitespace but indent_token is still empty string\n elsif @indent_token == \"\"\n @indent_token = leading_whitespace\n @current_level = 1\n \n # Else, set current_level to number of repetitions of index_token in leading_whitespace\n else\n i = 0\n while leading_whitespace.index(@indent_token) == 0 do\n leading_whitespace = leading_whitespace[@indent_token.length..-1]\n i += 1\n end\n @current_level = i\n end\n \n self\n end",
"def heredoc_unindent(warn_first_not_min=true, args={})\n args, warn_first_not_min = warn_first_not_min, true if warn_first_not_min.is_a? Hash\n unindent_base(false, warn_first_not_min, args)\n end",
"def process_indent(count, line)\n if count <= @template_tabs && @template_tabs > 0\n to_close = @template_tabs - count\n\n to_close.times do |i|\n offset = to_close - 1 - i\n unless offset == 0 && mid_block_keyword?(line)\n close\n end\n end\n end\n end",
"def optimize_indentation(value, amount = 0)\n return \"#{value}\\n\" unless value.is_a?(String)\n \"#{value.strip_heredoc.indent(amount).chomp}\\n\"\n end",
"def optimize_indentation(value, amount = 0)\n return \"#{value}\\n\" unless value.is_a?(String)\n \"#{value.strip_heredoc.indent(amount).chomp}\\n\"\n end",
"def flush_left text\n indents = []\n\n text.each_line do |line|\n indents << (line =~ /[^\\s]/ || 9999)\n end\n\n indent = indents.min\n\n flush = []\n\n text.each_line do |line|\n line[/^ {0,#{indent}}/] = ''\n flush << line\n end\n\n flush.join\n end",
"def change_indent plus\n super(plus)\n puts plus ? \"<li><ul class=\\\"pre\\\">\" : \"<li class =\\\"none\\\">LAST</li> </ul></li>\"\n end",
"def with_indentation(&block) # :doc:\n @indentation += 1\n instance_eval(&block)\n ensure\n @indentation -= 1\n end",
"def close_stack indent_level\r\n while @token_stack.size > 0 and @token_stack[-1].indent_level >= indent_level\r\n if @token_stack.size > 1 # if this is not the last token, add to parents\r\n @token_stack[-2].add_block_code self.convert(@token_stack[-1])\r\n else # this is the last token in the stack\r\n dump self.convert(@token_stack[-1])\r\n end\r\n @token_stack.pop\r\n end\r\n end",
"def flush_left text\n indent = 9999\n\n text.each_line do |line|\n line_indent = line =~ /\\S/ || 9999\n indent = line_indent if indent > line_indent\n end\n\n empty = ''\n empty = RDoc::Encoding.change_encoding empty, text.encoding\n\n text.gsub(/^ {0,#{indent}}/, empty)\n end",
"def indent(n)\n if n >= 0\n gsub(/^/, ' ' * n)\n else\n gsub(/^ {0,#{-n}}/, \"\")\n end\n end",
"def strip_heredoc(string)\n indent = string.scan(/^[ \\t]*(?=\\S)/).min.try(:size) || 0\n string.gsub(/^[ \\t]{#{indent}}/, '')\n end",
"def outdent(str)\n str =~ /\\A(?:\\s*?\\n)( *)(.*)\\z/m ? $2.gsub!(/^ {0,#{$1.length}}/, '') : str\n end",
"def add_indentation!(p_size, p_type)\n self.replace(add_indentation(p_size, p_type))\n end",
"def insert_indentation(line, indentation)\n line ? \" \" * indentation + line.to_s : \"\"\n end",
"def indentation(parents, last, symbols)\n i = parents.map do |parent_last|\n if !parent_last\n SYMBOLS[symbols][:has_parent]\n else\n SYMBOLS[symbols][:no_parent]\n end\n end\n\n if last\n i.join(\"\") + SYMBOLS[symbols][:last_item]\n else\n i.join(\"\") + SYMBOLS[symbols][:item]\n end\n end",
"def indent!(num)\n replace( ' ' * num + self.gsub(\"\\n\", \"\\n\"+' '*num))\n self\n end",
"def unexpected_indent_offset\n configured_indentation_width - expected_indent_offset\n end",
"def indent!(amount, indent_string = nil, indent_empty_lines = false)\n indent_string = indent_string || self[/^[ \\t]/] || ' '\n re = indent_empty_lines ? /^/ : /^(?!$)/\n gsub!(re, indent_string * amount)\n end",
"def format_source(source)\n source.chomp!\n indent = source.split(/\\r?\\n/).last[/^([ \\t]*)/, 1].length\n source.gsub(/^[ \\t]{#{indent}}/, '')\n end",
"def indent!(amount, indent_string=nil, indent_empty_lines=false)\n indent_string = indent_string || self[/^[ \\t]/] || ' '\n re = indent_empty_lines ? /^/ : /^(?!$)/\n gsub!(re, indent_string * amount)\n end"
] | [
"0.7653984",
"0.75669205",
"0.72395664",
"0.71688294",
"0.7151941",
"0.7103",
"0.70871073",
"0.699855",
"0.699855",
"0.6996303",
"0.69561476",
"0.68298674",
"0.68219024",
"0.6774511",
"0.6697048",
"0.6565999",
"0.6537174",
"0.6495629",
"0.6495629",
"0.64640224",
"0.6423903",
"0.6423903",
"0.6423903",
"0.6423903",
"0.6423903",
"0.6370875",
"0.63705015",
"0.63647956",
"0.6359746",
"0.63328874",
"0.63314563",
"0.63232213",
"0.63171685",
"0.6313086",
"0.6261977",
"0.62498385",
"0.62498385",
"0.62289494",
"0.62122995",
"0.62051344",
"0.61880696",
"0.61736465",
"0.6169544",
"0.6165364",
"0.61622083",
"0.6119756",
"0.6117002",
"0.6113512",
"0.6102086",
"0.60841703",
"0.6072194",
"0.6066215",
"0.60396475",
"0.60252595",
"0.6024427",
"0.60159343",
"0.5988236",
"0.5984476",
"0.5973487",
"0.595773",
"0.5940356",
"0.59381706",
"0.5928245",
"0.5907563",
"0.5893199",
"0.582803",
"0.5820622",
"0.5811065",
"0.5809822",
"0.5808782",
"0.5792913",
"0.5777592",
"0.5775085",
"0.57670236",
"0.5752186",
"0.57375574",
"0.5737252",
"0.57363266",
"0.57304764",
"0.5723392",
"0.57138854",
"0.57096285",
"0.5704694",
"0.5704694",
"0.57025677",
"0.56594014",
"0.5650775",
"0.5627058",
"0.5619517",
"0.5615427",
"0.5612112",
"0.56059724",
"0.559555",
"0.55701053",
"0.5545367",
"0.5543056",
"0.5523474",
"0.5519656",
"0.5484274",
"0.54784095"
] | 0.5759754 | 74 |
Nonmatches are returned as a oneelement array. | def test_gpartition2_1()
string = 'This is a test'
expected = [ string ]
rx = %r{Not matching}
result = string.gpartition2( rx )
assert_equal_array( expected, result )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_a\n [self] + matches\n end",
"def matches\n @matches ||= []\n end",
"def aggressive\n\t# make a matches array. this returns the equivalent of the matches[] block above\n\tm=[]\n\n\n\t# return the matches array, even if it's emtpy\n\tm\nend",
"def remove_errant_matches_from(pot_ex_array)\n correct_match_arr = []\n pot_ex_array.each do |example|\n constituents = example.construct_constituents_array\n constituents.each do |const_array|\n if const_array[0] == self.word && const_array[1] == self.hiragana && const_array[3] == self.reading # For this to work, the constituents have to be normalized to dictionary_forms.\n correct_match_arr << example\n end\n end\n end\n return correct_match_arr\n end",
"def find_array\n set_pattern\n @array.reject! do |item|\n item.match(@pattern) == nil\n end\n end",
"def unmatched\n Array((operands.detect {|op| op.is_a?(Array) && op[0] == :unmatched} || [:unmatched])[1..-1])\n end",
"def matches(max_mismatches)\n out = []\n\n (0..text_len-patt_len).each do |i|\n out << i if quasi_match?(i, max_mismatches)\n end\n\n out\n end",
"def not\n Anagram::Matching::NotMatcher.new(self)\n end",
"def matching_text_element_lines(regex, exclude_nested = T.unsafe(nil)); end",
"def remove_bad_ident_matches(matches)\n passed_matches = []\n matches.each do |m|\n next if (m[\"match_type\"] == \"content_body\" &&\n m[\"matched_content\"] == \"(?-mix:Drupal)\")\n\n next if (m[\"match_type\"] == \"content_cookies\" &&\n m[\"matched_content\"] == \"(?i-mx:ADRUM_BTa)\" &&\n m[\"product\"] == \"Jobvite\")\n\n passed_matches << m\n end\n passed_matches\n end",
"def all_not_wild\n result = []\n for card in @cards\n result << card unless card.wild? \n end\n return result\n end",
"def mapped\n @matches.map(&:unpack)\n end",
"def test_all_match_no_elements\n stream = FromArray.new([])\n assert(\n stream.all_match { |val| val % 2 == 1 },\n 'Expected true because the stream is empty!'\n )\n end",
"def test_not_all_elements_match\n stream = FromArray.new([2, 4, 5, 6, 8])\n assert(\n stream.all_match { |val| val % 2 == 0 } == false,\n 'Expected false because not all elements are a match!'\n )\n end",
"def extract!(array)\n out = []\n array.reject! do |e|\n next false unless yield e\n out << e\n true\n end\n out\n end",
"def no_match() \n if $match_index_arr == []\n $turns = $turns - 1\n $index = $index + 1\n end\n end",
"def not_matched_keys\n @not_matched.keys\n end",
"def match_result\n [match_x, match_y]\n end",
"def incorrect_answers\n results = []\n for quiz_response in self.quiz_responses\n if ! quiz_response.correct?\n results << quiz_response.position\n end\n end\n return results\n end",
"def others(array)\n array.select{|elt| not(elt.kind_of?(Meta))}\n end",
"def extract_matched_items(items)\n []\n end",
"def not_covered\n items = Array.new\n\n vehicles.each do |v|\n unless v.covered?\n items << v\n end\n end\n\n items\n end",
"def bad_results\n select {|r| !r.success }\n end",
"def ret_array(_array, _ret, _id)\n if !_ret.nil?\n _ret.each do |_r|\n _array = _array << _r.read_attribute(_id) unless _array.include? _r.read_attribute(_id)\n end\n end\n end",
"def ret_array(_array, _ret, _id)\n if !_ret.nil?\n _ret.each do |_r|\n _array = _array << _r.read_attribute(_id) unless _array.include? _r.read_attribute(_id)\n end\n end\n end",
"def ret_array(_array, _ret, _id)\n if !_ret.nil?\n _ret.each do |_r|\n _array = _array << _r.read_attribute(_id) unless _array.include? _r.read_attribute(_id)\n end\n end\n end",
"def ret_array(_array, _ret, _id)\n if !_ret.nil?\n _ret.each do |_r|\n _array = _array << _r.read_attribute(_id) unless _array.include? _r.read_attribute(_id)\n end\n end\n end",
"def all\n match(nil)\n end",
"def missed_lines\n to_a.map(&:missed_lines).inject(:+)\n end",
"def all_matches( re, what )\n matches = []\n m = true\n\n matches << OpenStruct.new({\n :match => \"!fake!\",\n :start => 0,\n :end => 0,\n :fake => true\n })\n\n while m\n if matches.size == 1\n m = what.match(re)\n else\n m = (@@allMatchesSpecialChar + what).match(re)\n end\n\n if m\n pos = what.index(m[0])\n\n if pos > 0\n matches << OpenStruct.new({\n :match => what[0, pos],\n :start => matches.last.end,\n :end => matches.last.end + pos,\n :plain => true\n })\n end\n\n matches << OpenStruct.new({\n :match => m[0],\n :start => matches.last.end,\n :end => matches.last.end + m[0].length\n })\n\n what = what[pos + m[0].length..-1]\n end\n end\n\n if what.length > 0\n matches << OpenStruct.new({\n :match => what,\n :start => matches.last.end,\n :end => matches.last.end + what.length,\n :plain => true\n })\n end\n\n matches\n end",
"def array_nl()\n #This is a stub, used for indexing\n end",
"def remove_duplicate_matches(matches)\r\n # Sort the items.\r\n # Sort the array without matches[0], since we need it to\r\n # stay in place no matter what.\r\n if matches.length>0\r\n matches[1..-2] = matches[1..-2].sort.uniq\r\n end\r\n matches\r\n end",
"def missing_player_box_scores\n nba_matchups - player_box_scores.map(&:nba_matchup)\n end",
"def missing_data\n only_missing.to_a\n end",
"def matches\n m = (1..9).map { |i| ss[i] }\n m.pop until m[-1] or m.empty?\n m\n end",
"def matches\n m = (1..9).map { |i| ss[i] }\n m.pop until m[-1] or m.empty?\n m\n end",
"def matches\n m = (1..9).map { |i| ss[i] }\n m.pop until m[-1] or m.empty?\n m\n end",
"def matches\n m = (1..9).map { |i| ss[i] }\n m.pop until m[-1] or m.empty?\n m\n end",
"def matches\n m = (1..9).map { |i| ss[i] }\n m.pop until m[-1] or m.empty?\n m\n end",
"def matches\n m = (1..9).map { |i| ss[i] }\n m.pop until m[-1] or m.empty?\n m\n end",
"def my_reject(&prc)\n\t\tnew_array = []\n\n\t\tself.my_each do |ele|\n\t\t\tnew_array << ele if !prc.call(ele)\t\t\t\t\n\t\tend\n\n\t\tnew_array\n\tend",
"def valid_result_sets\n Array.new\n end",
"def never_lines\n to_a.map(&:never_lines).inject(:+)\n end",
"def matches\n parse\n end",
"def return_difficulties_array(doc)\n difficulties = doc.css(\".search-content .teaser-item__info-item--skill-level\")\n recipe_difficulties = []\n difficulties.each do |element|\n recipe_difficulties << element.text.strip\n end\n return recipe_difficulties\n end",
"def matched\n Array((operands.detect {|op| op.is_a?(Array) && op[0] == :matched} || [:matched])[1..-1])\n end",
"def matches\n process_events! unless @matches\n @matches\n end",
"def matches\n attributes.fetch(:matches)\n end",
"def bracket_remove(matches)\n clean_matches = matches.map{|i| i.map{|j| j.gsub(/^\\s?\\[+\\s?/, \"\")}}\n clean_matches.delete([\"XXX\"])\n return clean_matches\n end",
"def term_non_matches\n @terms.reject { |t| self.class.match_against_term?(t) }\n end",
"def to_a\n @patterns\n end",
"def others(array)\n array.select{|elt| not(any?{|name| elt.kind_of?(name)})}\n end",
"def missing\n (@_cells.values.reduce(:|) - @_cells.keys).to_a\n end",
"def matches(str)\n each_match(str).to_a\n end",
"def put_in_array(elem)\n array = []\n elem.each {|e| array << e.text}\n return array\nend",
"def missing\n\t\t\tmissing, array = [], self.rangify\n\t\t\ti, length = 0, array.size - 1\n\n\t\t\twhile i < length \n\t\t\t\tcurrent = comparison_value(array[i], :last)\n\t\t\t\tnextt = comparison_value(array[i+1], :first)\n\t\t\t\tmissing << (current + 2 == nextt ? current + 1 : (current + 1)..(nextt - 1))\n\t\t\t\ti += 1\n\t\t\tend\n\t\t\tmissing\n\t\tend",
"def all_matches\n # Returns an array of all users whom I have a match with, i.e. they are likers of me, and I am liker of them.\n self.matches_from.map { |match| match.liker } & self.matches_to.map { |match| match.liked }\n end",
"def matchers\n @matchers ||= []\n end",
"def instances_from_matches\n return single_class_results if one_class\n \n groups = results[:matches].group_by { |match|\n match[:attributes][\"class_crc\"]\n }\n groups.each do |crc, group|\n group.replace(\n instances_from_class(class_from_crc(crc), group)\n )\n end\n \n results[:matches].collect do |match|\n groups.detect { |crc, group|\n crc == match[:attributes][\"class_crc\"]\n }[1].compact.detect { |obj|\n obj.primary_key_for_sphinx == match[:attributes][\"sphinx_internal_id\"]\n }\n end\n end",
"def elements_missing\n elements_to_check.reject { |name| there?(name) }\n end",
"def to_s\n @matches.join(\"\\n\")\n end",
"def extract_badgenames()\n@badgenames_array = []\n file = File.open('app/assets/post.html')\n doc = Nokogiri::HTML(file)\n doc.search('.mb_div > a').map do |element|\n @badgenames_array << element.inner_text\n end\n return @badgenames_array\nend",
"def narray_attributes\n @attributes.select(&:narray?)\n end",
"def matching_lines(regex); end",
"def regexps; end",
"def my_reject(&prc)\n arr = []\n self.my_each { |el| arr << el if !prc.call(el) }\n arr\n end",
"def grab_elements(content_array, filter)\n content_array.grep(Regexp.new filter)\n end",
"def retrieve_elements(filter)\n elements_array = Array.new\n\n if NOKOGIRI\n @xml.xpath(filter.to_s).each { |pelem|\n elements_array << pelem.text if pelem.text\n }\n else\n @xml.elements.each(filter.to_s) { |pelem|\n elements_array << pelem.text if pelem.text\n }\n end\n\n if elements_array.size == 0\n return nil\n else\n return elements_array\n end\n\n end",
"def matching_types(&matcher)\n yield(self) ? [self] : []\n end",
"def match_maker(determine, *elements)\n # Create a new array\n return_array = []\n # Loop through each item in the elements array, slicing into two\n elements.each_slice 2 do | first, last |\n # Create a variable that checks if the element is the opposite\n first = !!first\n last = !!last\n result = determine ? first != last : first == last\n # Push the result to the array\n return_array << result\n end\n # Return the array\n return_array\nend",
"def string_matchers()\n []\n end",
"def uncovered_lines(results)\n results.fetch(:lines)\n .each_with_index\n .select { |c, _| c == 0 }\n .map { |_, i| i }\n .compact\n end",
"def full_pairs\n match_items.reject do |pair|\n pair[0].nil? || pair[1].nil?\n end\n end",
"def airports_highlighted\n return Array.new\n end",
"def ary\n @ary ||= rule.sep('[').maybe(elements).sep(']')\n end",
"def all_matches\n b = GenerateBets.new(1, 1, 40)\n # ap b.generate_sameple\n return b.generate_sameple\n # return b.example_feed\n end",
"def raw_elements\n _elms.tap do |e|\n raise(OperaWatir::Exceptions::UnknownObjectException) if e.empty?\n end\n end",
"def getNegativeWordsArray\n return @negativeWordsArray\n end",
"def remove_non_strings (array)\n temp = []\n array.each do |data|\n if data.class == String\n temp << data\n end\n end\n temp\nend",
"def visible_array(ary)\n new_array = Array.new\n ary.each do |t|\n if check_visible(t)\n new_array << t\n end\n end\n return new_array\n end",
"def missing1(array)\n (array.first..array.last).to_a - array\nend",
"def home_ads(ads_not_user)\n @matches_ads = Array.new\n ads_not_user.all.each do |ad|\n if Ad.matches_user(ad, current_user.id)\n @matches_ads.push(ad)\n end\n end\n return @matches_ads\n end",
"def match_array(string, match_string)\n arr = []\n string.scan(Regexp.new(match_string)) do |element|\n arr << element\n end\n return arr\n end",
"def filter_without_image(response)\n resp = []\n response.each do |artist_info|\n resp << artist_info if artist_info.dig('image', -2, '#text').present?\n end\n resp\n end",
"def discardable\n []\n end",
"def filter_matched_items(items)\n []\n end",
"def filter_out\n result,i = [],0\n while(i < size)\n if yield(e = self.at(i))\n result << e\n delete_at(i)\n else\n i += 1\n end\n end\n result\n end",
"def get_elements_temp_ios_fix\n selector_params = self.get_selector_params(self.configuration)\n #Get rid of any shit at the end, //blah/element[1] becomes //blah/element only for numeric indexes, going to add a numeric index\n\n elements_array = Array.new\n\n index = 1\n find_element_failure = false\n until find_element_failure\n selector_params[:selector] = selector_params[:selector].gsub(/\\[\\d+\\]$/, '')\n selector_params[:selector] = selector_params[:selector] + \"[#{index}]\"\n\n begin\n if self.driver_object.exists?(selector_params[:selector_method], selector_params[:selector])\n elements_array.push(self.driver_object.find_element(selector_params[:selector_method], selector_params[:selector]))\n else\n find_element_failure = true\n break\n end\n rescue\n find_element_failure = true\n break\n end\n\n index += 1\n end\n\n return elements_array\n end",
"def another; return []; end",
"def to_a; Array(force) end",
"def to_a\n a = []\n a << [ 'reference' ] + reference.to_a\n similarities.each do |similar|\n a << [ 'duplicate' ] + similar.to_a\n end\n a\n end",
"def returns_array?\n false\n end",
"def returns_array?\n false\n end",
"def non_nil_indices(array)\n a = []\n array.each do |x|\n if x != \"\"\n i = self.index(x)\n if a.include?(i)\n i = self.index(i+1)\n end\n a << i\n end\n end\n end",
"def available_values\n result = []\n for i in (0 .. @tag.length - 1)\n result << @tag[i].parent(\"p\").span.innerText.strip if @tag[i].parent(\"p\").span.exists\n end\n return result\n end",
"def test_match_sets_discard\n assert_not_equal(nil, @exp.expect(/null/))\n assert_not_equal('', @exp.discard)\n end",
"def airports_normal\n return Array.new\n end",
"def not_x\n x = @x.content\n z = Array.new @z.length, 0\n\n @z.length.times { |i| z[i] = (x[i] == 1) ? 0 : 1 } \n\n @z.content = z\n end",
"def matched_positions\n _response_entity.fetch(\"matchingTokens\", [])\n end",
"def test_two_artgs\n assert_true ArrayPatternMatcher.new(1, 2) === [1, 2]\n assert_true ArrayPatternMatcher.new(Integer, 2) === [1, 2]\n assert_true ArrayPatternMatcher.new(/\\s/, 'a') === [' ', 'a']\n assert_false ArrayPatternMatcher.new(/\\s/, 'b') === [' ', 'a']\n assert_false ArrayPatternMatcher.new(/\\s/) === [' ', 'a']\n end",
"def my_array_method(my_array)\n results = []\n # .instance_of is only returns true if the object is an instance of that exact class, not a subclass.\n results << my_array.select { |x| x.is_a? Fixnum} # [3, 2]\n results << my_array.select { |x| !x.is_a? Fixnum} # [\"I\", \"want\", \"pets\", \"but\", \"only\", \"have\"]\n return results #[[2, 3], [\"I\", \"want\", \"pets\", \"but\", \"only\"]]\nend"
] | [
"0.6602046",
"0.6199159",
"0.6160869",
"0.60641927",
"0.60401726",
"0.5936576",
"0.5919308",
"0.57038003",
"0.5664711",
"0.55451477",
"0.54877365",
"0.54728293",
"0.54172426",
"0.54122007",
"0.5356007",
"0.52644175",
"0.5238384",
"0.5234284",
"0.52290916",
"0.52195257",
"0.52186424",
"0.52072763",
"0.51755714",
"0.51722157",
"0.51722157",
"0.51722157",
"0.51722157",
"0.5159927",
"0.5159331",
"0.5138761",
"0.5135649",
"0.5107605",
"0.5097711",
"0.5088153",
"0.5082091",
"0.5082091",
"0.5082091",
"0.5082091",
"0.5082091",
"0.5082091",
"0.5061633",
"0.5061463",
"0.50513226",
"0.50391495",
"0.5038874",
"0.50342464",
"0.503227",
"0.5022694",
"0.50189155",
"0.50119966",
"0.49858776",
"0.49797222",
"0.49671474",
"0.49602103",
"0.49592882",
"0.4953011",
"0.49267447",
"0.49243137",
"0.49223983",
"0.49152115",
"0.49004966",
"0.4896564",
"0.48864302",
"0.48724264",
"0.48700574",
"0.48613682",
"0.4857461",
"0.48553944",
"0.48528257",
"0.4852688",
"0.48449183",
"0.48423567",
"0.48410314",
"0.48329106",
"0.48281646",
"0.48263314",
"0.48228085",
"0.48169678",
"0.48156324",
"0.48147935",
"0.48063502",
"0.48052973",
"0.48051673",
"0.47930574",
"0.4792772",
"0.4792574",
"0.47895387",
"0.4786196",
"0.47851062",
"0.47847095",
"0.47629285",
"0.47573283",
"0.47573283",
"0.47545657",
"0.4752754",
"0.47449",
"0.4738935",
"0.4735351",
"0.47232598",
"0.47188693",
"0.47139737"
] | 0.0 | -1 |
Matches are returned as a threeelement array. | def test_gpartition2_2
string = 'aaabbbcccddd'
expected = [ 'aaa', 'bbb', 'cccddd' ]
rx = %r{bbb}
result = string.gpartition2( rx )
assert_equal_array( expected, result )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matches\n @matches ||= []\n end",
"def to_a\n [self] + matches\n end",
"def mapped\n @matches.map(&:unpack)\n end",
"def match_result\n [match_x, match_y]\n end",
"def matches\n parse_file.lines.each_with_object([]) do |line, matches|\n matches << line.scan(REGEXP[:name_and_score])\n end\n end",
"def aggressive\n\t# make a matches array. this returns the equivalent of the matches[] block above\n\tm=[]\n\n\n\t# return the matches array, even if it's emtpy\n\tm\nend",
"def process_match3(exp)\n right = exp.shift\n left = exp.shift \n return process(s(:call, left, :=~, s(:array, right)))\n end",
"def matches\n parse\n end",
"def matches()\n sql = \"SELECT matches.* FROM matches WHERE away_team_id = #{@id} OR home_team_id = #{@id};\"\n matches = SqlRunner.run( sql )\n result = matches.map { |match| Match.new(match) }\n return result\n end",
"def all_matches( re, what )\n matches = []\n m = true\n\n matches << OpenStruct.new({\n :match => \"!fake!\",\n :start => 0,\n :end => 0,\n :fake => true\n })\n\n while m\n if matches.size == 1\n m = what.match(re)\n else\n m = (@@allMatchesSpecialChar + what).match(re)\n end\n\n if m\n pos = what.index(m[0])\n\n if pos > 0\n matches << OpenStruct.new({\n :match => what[0, pos],\n :start => matches.last.end,\n :end => matches.last.end + pos,\n :plain => true\n })\n end\n\n matches << OpenStruct.new({\n :match => m[0],\n :start => matches.last.end,\n :end => matches.last.end + m[0].length\n })\n\n what = what[pos + m[0].length..-1]\n end\n end\n\n if what.length > 0\n matches << OpenStruct.new({\n :match => what,\n :start => matches.last.end,\n :end => matches.last.end + what.length,\n :plain => true\n })\n end\n\n matches\n end",
"def doc_matches(matchers)\n matches = []\n matchers.each do |query|\n if query.is_a?(String)\n if el = doc.search(query).first\n if el.name.downcase == \"meta\"\n matches << el[\"content\"]\n else\n matches << el.inner_text\n end\n end\n elsif query.is_a?(Array)\n doc.search(query.first).map do |node|\n el = query.last.call(node)\n matches << el if el.present?\n end\n end\n end\n matches.flatten\n rescue => e\n puts \"#{e.message}\"\n []\n end",
"def hashes_for(*args)\n return matches_for(*args).map { |match| match.hash }\n end",
"def matches\n\t\t\tcompetition.matches\n\t\tend",
"def matches_by\n Array(options_by_type(:matches_by))\n end",
"def all_matches\n # Returns an array of all users whom I have a match with, i.e. they are likers of me, and I am liker of them.\n self.matches_from.map { |match| match.liker } & self.matches_to.map { |match| match.liked }\n end",
"def get_matches(path)\n matches = []\n\n @routes.each_with_index do |route, i|\n score, pars = score_route(route[:parts], path)\n matches << [i, score, pars] if score > 0\n end\n\n matches\n end",
"def matches(str)\n each_match(str).to_a\n end",
"def matches(input)\n (0...input.length).reduce([]) do |memo, offset|\n memo + matches_at_offset(input, offset)\n end\n end",
"def player_matches(player, playerdiv)\n result = Match.joins(:results).where(:results => {:player_id => player}).where(:division_id => playerdiv)\n @player_matches = Array.new\n result.each do |m|\n @player_matches << m.id\n end\n return @player_matches\n end",
"def find_matches(*arrays)\n hash = Hash.new(0)\n arrays.flatten.each do |num|\n hash[num] += 1\n end\n hash.keys.find_all do |num|\n\t\thash[num] == 3\n\tend\nend",
"def matches\n attributes.fetch(:matches)\n end",
"def matches\n m = (1..9).map { |i| ss[i] }\n m.pop until m[-1] or m.empty?\n m\n end",
"def matches\n m = (1..9).map { |i| ss[i] }\n m.pop until m[-1] or m.empty?\n m\n end",
"def matches\n m = (1..9).map { |i| ss[i] }\n m.pop until m[-1] or m.empty?\n m\n end",
"def matches\n m = (1..9).map { |i| ss[i] }\n m.pop until m[-1] or m.empty?\n m\n end",
"def matches\n m = (1..9).map { |i| ss[i] }\n m.pop until m[-1] or m.empty?\n m\n end",
"def matches\n m = (1..9).map { |i| ss[i] }\n m.pop until m[-1] or m.empty?\n m\n end",
"def instances_from_matches\n return single_class_results if one_class\n \n groups = results[:matches].group_by { |match|\n match[:attributes][\"class_crc\"]\n }\n groups.each do |crc, group|\n group.replace(\n instances_from_class(class_from_crc(crc), group)\n )\n end\n \n results[:matches].collect do |match|\n groups.detect { |crc, group|\n crc == match[:attributes][\"class_crc\"]\n }[1].compact.detect { |obj|\n obj.primary_key_for_sphinx == match[:attributes][\"sphinx_internal_id\"]\n }\n end\n end",
"def find_matches\n @match_distances = Match.find_match(current_user, \"Any\", nil)\n end",
"def matchdata\n @matchdata\n end",
"def result\n\n # start the matching of the ruleby engine if not yet called\n unless @engine_has_matched\n @engine.match\n @engine_has_matched = true\n end\n\n # return the result array\n @result_rules\n\n end",
"def match_array(string, match_string)\n arr = []\n string.scan(Regexp.new(match_string)) do |element|\n arr << element\n end\n return arr\n end",
"def matches\n @matches = @question.match(/(-?\\d+) (plus|minus|divided by|multiplied by) (-?\\d+)/)\n puts \"@matches = #{@matches[1]}, #{@matches[2]}, #{@matches[3]}\"\n end",
"def results(do_all=false)\n [].tap do |res|\n if do_all || term_matches.present?\n res << IndexedSearch::Match::Result.new(self, term_map, rank_multiplier, term_multiplier, limit_reduction_factor, type_reduction_factor)\n end\n end\n end",
"def matched_keys\n @matched.keys\n end",
"def all_matches\n\t\t@@logger.info { \"Retrieving all matches.\" } if have_logger?\n\t\tMatch.dataset.filter(:tournament_id => self.id).all\n\tend",
"def values\n @values ||= begin\n matches = []\n\n text.scan(VALUE_REGEXP) do\n offset = Regexp.last_match.offset(1)\n matches << loc.expression.adjust(begin_pos: offset.first)\n .with(end_pos: loc.expression.begin_pos + offset.last)\n end\n\n matches\n end\n end",
"def tests(subject)\n subject.match_expressions.each do |match_expression|\n tests = integration.all_tests.select do |test|\n match_expression.prefix?(test.expression)\n end\n return tests if tests.any?\n end\n\n EMPTY_ARRAY\n end",
"def webmock_match_array(array)\n array.sort\n end",
"def matches(max_mismatches)\n out = []\n\n (0..text_len-patt_len).each do |i|\n out << i if quasi_match?(i, max_mismatches)\n end\n\n out\n end",
"def matchers\n @matchers ||= []\n end",
"def matches( input )\n matches = Array.new\n\n input.shorter.each_with_index do |char, idx|\n input.window_range( idx ).each do |widx|\n if input.longer[widx] == char then\n matches << widx\n break\n end\n end\n end\n\n return matches\n end",
"def extract_matched_items(items)\n []\n end",
"def matches\n process_events! unless @matches\n @matches\n end",
"def matched\n Array((operands.detect {|op| op.is_a?(Array) && op[0] == :matched} || [:matched])[1..-1])\n end",
"def get_expected_scores \n answer = [] \n scores = self.expected_score\n i = 0\n while i < scores.length\n s = scores[i, 4]\n answer.push(s.unpack('4f')[0])\n i += 4\n end \n return answer \n end",
"def matched_positions\n _response_entity.fetch(\"matchingTokens\", [])\n end",
"def if_match(teams, start)\n\tmatch = Array.new\n\ttest = FuzzyStringMatch::JaroWinkler.create( :native )\n\twhile start < RC_C.num_rows\n\t\tteams.each do |team|\n\t\t\ti = test.getDistance(team, RC_C.rows[start][1])\n\t\t\tif i > 0.65\n\t\t\t\tmatch.push(team)\n\t\t\t\t# puts \"match, #{team} matches #{RC_C.rows[start][1]}\"\n\t\t\tend\n\t\tend\n\t\tstart += 1\n\tend\n\treturn match\nend",
"def match(array_of_words)\n matches = [] #Flag\n anagram_execute = anagram.split(//)\n anagram_execute = anagram_execute.sort!\n array_of_words.each do |possible_match|\n array_of_letters = possible_match.split(//)\n array_of_letters = array_of_letters.sort!\n matches << possible_match if array_of_letters == anagram_execute\n #use truncated, cleaner if statement\n end\n matches #return the matches array\n end",
"def matchers\n @components.values\n end",
"def teams\n parse_file.lines.each_with_object([]) do |line, matches|\n teams = line.strip.split(',')\n teams.each { |team| matches << team.scan(REGEXP[:name_and_score]) }\n end.map { |v| v[0][0] }.uniq\n end",
"def matched_words\n _matched_words\n end",
"def read_file\n match_file = File.new(\"matches.txt\", \"r\")\n no_of_match = match_file.gets\n if no_of_match != nil\n for i in 0..no_of_match.to_i - 1\n match_result = match_file.gets\n @matchesarr << match_result\n end\n end\n match_file.close\n end",
"def get_all_participants\n\t\tparticipants_array = []\n\t\tmatch.teams.each do |t|\n\t\t\tparticipants_array << get_team_participants(t)\n\t\tend\n\t\tparticipants_array\n\tend",
"def exact_match_count\n (0..3).inject(0) do |count, index|\n count + (exact_match?(index) ? 1 : 0)\n end\n end",
"def repeated_matches\n\t\t@@logger.info { \"Retrieving repeated matches.\" } if have_logger?\n\t\tMatch.dataset.filter(:tournament_id => self.id).filter(:repeated => true).all.length\n\tend",
"def test_find_matches\n @fdb = setup\n @list = @fdb.find_matches(\"Ch\")\n assert(@list.length >= 2, \"Expected at least 2 entries to be found, didn't get that much\")\n end",
"def matches(smarts_or_string, uniq=true)\n each_match(smarts_or_string, uniq).map.to_a\n end",
"def return_match\n\t\treturn @matched\n\tend",
"def upcoming_matches\n matches = Event.upcoming.map do |ev| \n match = ev.wattball_match\n\n # Get non-null matches that the team is playing in\n match if match and (match.team1 == self or match.team2 == self)\n end\n\n matches.compact\n end",
"def match_maker(logic, *arrays)\n\t\tnew_arrays =[]\n\t\tarrays.each_slice(2){|a,b| new_arrays << [a,b]}\n\t\tputs new_arrays\n\t\tputs logic\n\tend",
"def build_array\n setup\n while @e <= l\n make_word_candidates\n validate_word_match\n bank_valid_word_match(validate_word_match)\n begin_find_next_word(make_word_candidates)\n not_a_match(make_word_candidates)\n return array1\n end\n #return array1\n end",
"def all_matches\n b = GenerateBets.new(1, 1, 40)\n # ap b.generate_sameple\n return b.generate_sameple\n # return b.example_feed\n end",
"def matches(s, re)\r\n start_at = 0\r\n matches = [ ]\r\n while(m = s.match(re, start_at))\r\n matches.push(m)\r\n start_at = m.end(0)\r\n end\r\n return matches\r\n end",
"def matcher(match)\n match = match.flatten.uniq\n match.each do |m|\n @counter.count(m)\n end\n end",
"def all_matchday_times\n all_matches = fetch_matches\n matchtimes = Hash[(1..38).collect { |md| [md, []] }]\n all_matches.each do |m|\n matchtimes[m['matchday']].push(m['utcDate'])\n end\n matchtimes\n end",
"def match_captures; end",
"def results\n\t\t\tArray(result)\n\t\tend",
"def matches\n @subject.matches\n end",
"def results\n @results ||= with_hit.map(&:first)\n end",
"def to_a\n @patterns\n end",
"def matching_lines(regex); end",
"def array_result\n [@result['results']].flatten\n end",
"def games\n self.results.map {|r|;r.game}\n end",
"def create_matches(matches)\n matches.each do |home_team, away_team|\n create_match(home_team, away_team)\n end\n end",
"def find_matches(req, screen_res)\n matches = []\n MATCHER_METHODS.each do |method|\n id = self.send(method, req, screen_res)\n matches << id if id\n end\n matches += match_devices(req, screen_res)\n # sort from high confidence to low confidence\n matches.sort! {|x,y| y.confidence <=> x.confidence }\n end",
"def captures_array\n captures_hash.flat_map { |piece, count| ::Array.new(count, piece) }.sort\n end",
"def to_json\n (@matches.map {|m| m.to_json}).to_json\n end",
"def singles\n results = []\n @match[:\"501\"].each do |ply|\n player = ply[1]\n result = Stats::Player501.new(player).match_stats\n result[:week] = @week\n result[:season_id] = @season_id\n results << result\n end\n results\n end",
"def identify(result)\n matchers.inject([]) do |hits, matcher|\n instance = matcher.new(result)\n hits << instance if instance.match?\n hits\n end\n end",
"def buildMatchMatrix(fields, headers)\n matrix = []\n fields.each_with_index do |f,fi|\n matrix.append []\n headers.each_with_index do |h,hi|\n lcs_length = lcs(fields[fi].downcase,headers[hi].downcase).length.to_f\n x = lcs_length / fields[fi].length.to_f\n y = lcs_length / headers[hi].length.to_f\n avg = (x + y) / 2\n matrix[fi].append avg\n end\n end\n matrix\n end",
"def match_strings(matched_lines)\n matched_strings = []\n\n matched_lines.each do |line|\n check_patterns.each do |pattern|\n line.scan(pattern).each do |matched|\n matched_strings += matched\n end\n end\n end\n\n return matched_strings\n end",
"def get_results()\n restriction_nodes = []\n result_nodes = []\n if !(@inputs.nil? || @inputs.empty? || @inputs.first.empty?)\n input_set = @inputs.first\n restriction_nodes= input_set.nodes\n result_nodes = input_set.breadth_first_search(true){|node| node.item.text.downcase.include?(@keyword_phrase.to_s.downcase)} \n end\n \n if !@inplace\n results = @server.match_all(parse_keyword_phrase(), restriction_nodes) \n result_nodes = results.map{|item| Xplain::Node.new(item: item)}\n end\n \n result_nodes\n \n end",
"def match(array)\n ary = []\n array.each do |w| \n if w.split(\"\").sort == @word.sort\n ary << w\n end \n end\n ary\n end",
"def process_match2(exp)\n left = exp.shift\n right = exp.shift\n return process(s(:call, left, :=~, s(:array, right)))\n end",
"def results\n arr = []\n flag = 0 # iteration flag\n @obj['results'].each do |data|\n arr[flag] = Spreader::Bot.new(data)\n flag += 1\n end\n arr\n end",
"def get_teams\n\tteam = Array.new\n\ti = 1\n\twhile i < RC_A.num_rows\n\t\tteam[i-1] = RC_A[(i+1), 1]\n\t\ti += 1\n\tend\n\treturn team\nend",
"def get_teams\n\tteam = Array.new\n\ti = 1\n\twhile i < RC_A.num_rows\n\t\tteam[i-1] = RC_A[(i+1), 1]\n\t\ti += 1\n\tend\n\treturn team\nend",
"def group(array)\n array.map do |item|\n {\n item: item,\n matches: (array - [item]).map do |item_cmp|\n {\n match: item_cmp,\n distance: calculate_distance(item, item_cmp)\n }\n end\n }\n end\n end",
"def all\n match(nil)\n end",
"def turn_result\n puts \"matches: #{exact_matches}\"\n puts \"color matches: #{color_matches(get_code_remainder, get_guess_remainder)}\"\n end",
"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(r)\n end\n out\n end",
"def match(array)\n #selects and returns array elements that match condition\n array.select do |array_word|\n #Anagram class word split into characters and sort and compare\n (@word.split(\"\").sort) == (array_word.split(\"\").sort)\n end\n end",
"def get_matches\n @data ||= begin\n str = APIS[ @league.downcase.to_sym ]\n str = str.gsub( '$year$', @year.to_s )\n\n get( str ) ## use \"memoized\" / cached result\n end\n end",
"def match(test_array)\n\t\tindex_test_array = 0\n\t\t#iterate through each word in an array\n\t\ttest_array.each do |item|\n\t\t\t#iterate through each letter in item\n\t\t\titem.each do |letter|\n\t\t\t\t#iterate through each \"letter\" in the class Anagram object's word\n\t\t\t\tword.each do |test_letter|\n\t\t\t\t\t#compare the letter from parameter word to the object word\n\t\t\t\t\tif letter != test_letter\n\t\t\t\t\t\tputs letter\n\t\t\t\t\t\t#index_test_array += 1\n\t\t\t\t\t\t#break\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def user_matches \n\t\t@matches = Match.personal_matches(current_user)\n\tend",
"def parse_matching_rules( needles, haystack, include_wildcard = true )\n needles = [*needles]\n\n needles.push( WILDCARD_KEY ) if include_wildcard\n\n matched_values = []\n\n needles.each do | needle |\n matched_values += haystack[needle].split( /\\s*,\\s*/ ) if haystack.key?( needle )\n end\n\n return matched_values\n end",
"def get_matches_by_recno(query_type, filter, recnos)\r\n result_struct = get_result_struct(query_type, filter)\r\n match_array = KBResultSet.new(self, filter, filter.collect { |f|\r\n @field_types[@field_names.index(f)] })\r\n\r\n tbl_rec = @table_class.new(self)\r\n\r\n @db.engine.get_recs_by_recno(self, recnos).each do |rec|\r\n next if rec.nil?\r\n tbl_rec.populate(rec)\r\n\r\n match_array << create_result_rec(query_type, filter,\r\n result_struct, tbl_rec, rec)\r\n end\r\n return match_array\r\n end",
"def get_teams_a\n\n return [] if self.teams.nil? or self.teams.empty?\n\n array = self.teams.split('|')\n array.compact!\n array.delete('')\n\n return array\n end",
"def match(anagram_array)\n matched_anagrams = []\n\n anagram_array.each do |anagram|\n anagram.split(\"\").sort == @word.split(\"\").sort ? matched_anagrams << anagram : matched_anagrams\n end\n matched_anagrams\n end",
"def available_matches\n\t\t@@logger.info { \"Retrieving not checkedout and undecided matches.\" } if have_logger?\n\t\tMatch.dataset.filter(:tournament_id => self.id).filter(:result => nil).filter(:checked_out => false).filter(:planned => false).all\n\tend"
] | [
"0.70891434",
"0.69736856",
"0.6655341",
"0.645374",
"0.63257414",
"0.626255",
"0.61811453",
"0.6101565",
"0.60626495",
"0.5934238",
"0.5926803",
"0.5817396",
"0.58093405",
"0.57898766",
"0.57182753",
"0.5699816",
"0.5683024",
"0.56393665",
"0.56289953",
"0.562126",
"0.56060636",
"0.5567759",
"0.5567759",
"0.5567759",
"0.5567759",
"0.5567759",
"0.5567759",
"0.55592006",
"0.5555432",
"0.55491585",
"0.5524846",
"0.5517719",
"0.54529434",
"0.5430638",
"0.54298675",
"0.54129785",
"0.5371643",
"0.53631103",
"0.53519094",
"0.53374213",
"0.5335439",
"0.53260905",
"0.5312772",
"0.53093123",
"0.5308942",
"0.5301546",
"0.52982956",
"0.5295736",
"0.525437",
"0.52428585",
"0.5242503",
"0.5222191",
"0.5220184",
"0.5218867",
"0.520609",
"0.5203625",
"0.52004784",
"0.5199624",
"0.5199595",
"0.516979",
"0.51654965",
"0.5157661",
"0.51420414",
"0.51310337",
"0.51252764",
"0.51132536",
"0.511142",
"0.5094892",
"0.50944495",
"0.50869554",
"0.5080689",
"0.5074126",
"0.5066908",
"0.5065885",
"0.5048205",
"0.50439185",
"0.5027478",
"0.50268763",
"0.50072783",
"0.49965966",
"0.49944392",
"0.4985729",
"0.4983564",
"0.49832803",
"0.49824995",
"0.4979552",
"0.49721757",
"0.49721757",
"0.49668163",
"0.49660417",
"0.49593604",
"0.49555436",
"0.4954436",
"0.49539497",
"0.49479944",
"0.4947661",
"0.49378464",
"0.49075618",
"0.49045736",
"0.48929405",
"0.48875687"
] | 0.0 | -1 |
recurse down the hiearchy | def nested_subclasses(parent=self)
subclasses(parent).collect {|subclass|
{subclass => nested_subclasses(subclass)}
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recursive => nil",
"def traverse; end",
"def recursive_search(path,current_depth)\n # If we haven't hit our max depth\n if current_depth < @depth \n sub_hash = @wiki\n # Follow our path down the hash\n path.each do |node|\n sub_hash = sub_hash[node]\n end\n\n # Expand this node of the sub-tree\n sub_hash.keys.each do |link|\n sub_hash[link] = get_links(\"http://en.wikipedia.org#{link}\")\n # Here's our magic recursion, add this node to the\n # path, increment our depth, and traverse that\n recursive_search(path+[link],current_depth+1)\n end\n\n end\nend",
"def solution(t)\n # write your code in Ruby 2.2\n depth = 0\n childs = []\n\n childs << t.l if t.l\n childs << t.r if t.r\n\n while not childs.empty? do\n depth += 1\n\n cc = []\n childs.each do |t|\n cc << t.l if t.l\n cc << t.r if t.r\n end\n\n childs = cc\n end\n\n depth\nend",
"def visit_nodes(node)\n return if node.blank?\n if node.respond_to?(:each) # e.g. a list of nodes from a has_many association\n node.each { |n| visit_nodes(n) }\n else\n class_name = node.class.name\n @hash[class_name] ||= Set.new\n @hash[class_name] << visit(node)\n get_associations(node).each do |assoc|\n @logger.debug(\"Visiting #{assoc.name}\")\n new_nodes = node.send(assoc.name)\n next if new_nodes.blank?\n\n if new_nodes.respond_to?(:find_each)\n new_nodes.find_each { |n| visit_nodes(n) }\n else\n visit_nodes(new_nodes)\n end\n end\n\n end\n end",
"def traverse_folders(nav_level, parent, parent_link, parent_full_link, node_folder_path) \n\n\t\tnode_list = []\n\t\n\t\t#puts \"traverse_folders(#{nav_level.to_s}, #{parent}, #{node_folder_path})\"\n\t\n\t\tsubfolders = nil\n\t\tbegin\n\t\t\tsubfolders = Dir.entries(node_folder_path).select {|entry| File.directory? File.join(node_folder_path, entry) and !(entry == '.' || entry == '..' || entry == 'assets' || entry == 'images') }\n\t\trescue Errno::ENOENT\n\t\t\tputs \"ERROR: No File or Directory [#{node_folder}]\"\n\t\t\tputs puts\n\t\t\texit\n\t\tend\t \n\t\t\n\t\tsubfolders.each do |folder|\n\t\t\tnode = Map.new\n\n\t\t\tsub_path = node_folder_path + \"/\" + folder\n\t\t\n\t\t\tlink = (parent_link.length == 0 ? \"\" : parent_link + \"/\" ) + folder\n\t\t\tfull_link =\t (parent_full_link.length == 0 ? \"/\" : parent_full_link + \"/\" ) + folder\n\t\t\t\t\n\t\t\tnode = Map.new({\n\t\t\t\tdoctype: \"nav\",\n\t\t\t\tsubtype: \"nav_\" + nav_level.to_s,\n\t\t\t\tnav_type: (File.exist?(\"#{sub_path}/../#{folder}.markdown\") ? \"folder+markdown\" : \"folder\"),\n\t\t\t\tnav_level: nav_level,\n\t\t\t\tnav_order: 9000,\n\t\t\t\tnav_title: process_navigation_name(folder),\t\t\t \n\t\t\t\tsource: folder,\n\t\t\t\tlink: link,\n\t\t\t\tfull_link: full_link,\n\t\t\t\tparent: parent,\n\t\t\t\tparent_nav_title: process_navigation_name(parent_link),\n\t\t\t\tparent_link: parent_link,\n\t\t\t\tparent_full_link: parent_full_link,\n\t\t\t\tparent_path: node_folder_path,\n\t\t\t\tsource_path: sub_path,\n\t\t\t\tancestors: [],\n\t\t\t\tancestors_links: [],\n\t\t\t\tsiblings: [],\n\t\t\t\tsiblings_links: [],\n\t\t\t\tdescendants: [],\n\t\t\t\tdescendants_links: [],\n\t\t\t\tnavigation_yml: (File.exists? (sub_path + \"/aaaa-navigation.yml\")),\n\t\t\t\tindex_erb: (File.exists? (sub_path + \"/index.erb\"))\n\t\t\t})\n\t\t\t\t\n\t\t\titems = traverse_folders(nav_level + 1, folder, link, full_link, sub_path)\n\t\t\n\t\t\tif items.size > 0\n\t\t\t\t node.children = {}\n\t\t\t\t node.children.count = items.size\n\t\t\t\t node.children.items = items\n\t\t\tend\n\t\t\n\t\t\tnode_list << node\n\t\tend\n\t\n\t\tnode_list\n\t \n\tend",
"def recursiveTreeTraversal(element)\n if StereotypesHelper.hasStereotype(element, $veStereotype)\n findRefinedParameters(element)\n end\n for child in element.getOwnedElement()\n recursiveTreeTraversal(child)\n end\nend",
"def deep_each\n \n end",
"def get_kids(obj)\n # if it's a hash, then there are more layers\n if(obj.class.to_s == \"Hash\")\n # drill down and keep getting kids\n obj.keys.map{|name| {:name=>name, :children=> get_kids(obj[name])}}\n else\n # Otherwise, we're at the edge. Just build an array of \"name\" hashes.\n obj.map{|name| {:name=>name}}\n end\nend",
"def recursiveTreeTraversal(element)\n if StereotypesHelper.hasStereotype(element, $veStereotype)\n findOrCreateRefinedParameters(element)\n end\n for child in element.getOwnedElement()\n recursiveTreeTraversal(child)\n end\nend",
"def traverse\n @result.clear\n @queue.clear\n\n @queue.enqueue(@node)\n @result.push @node\n\n\n while not @queue.empty?\n node = @queue.dequeue\n return @result unless node\n # puts \"Visiting node: #{node}\"\n return node if (@search and node==@search)\n node && node.children.each do |node|\n unless @result.include?(node)\n @result.push(node)\n @queue.enqueue(node)\n end\n end\n end\n return result\n end",
"def rebuild_hierarchies!\n query(\"MATCH (:Page)-[parent:parent]->(:Page) DELETE parent\")\n query(\"MATCH (:Page)-[in_clade:in_clade]->(:Page) DELETE in_clade\")\n missing = {}\n related = {}\n # HACK HACK HACK HACK: We want to use Resource.native here, NOT ITIS!\n itis = Resource.where(name: \"Integrated Taxonomic Information System (ITIS)\").first\n raise \" I tried to use ITIS as the native node for the relationships, but it wasn't there.\" unless itis\n Node.where([\"resource_id = ? AND parent_id IS NOT NULL AND page_id IS NOT NULL\",\n itis.id]).\n includes(:parent).\n find_each do |node|\n page_id = node.page_id\n parent_id = node.parent.page_id\n next if missing.has_key?(page_id) || missing.has_key?(parent_id)\n page = page_exists?(page_id)\n page = page.first if page\n if page\n relate(\"in_clade\", page, page)\n end\n next if related.has_key?(page_id)\n parent = page_exists?(parent_id)\n parent = parent.first if parent\n if page && parent\n if page_id == parent_id\n puts \"** OOPS! Attempted to add #{page_id} as a parent of itself!\"\n else\n relate(\"parent\", page, parent)\n relate(\"in_clade\", page, parent)\n related[page_id] = parent_id\n # puts(\"#{page_id}-[:parent]->#{parent_id}\")\n end\n else\n missing[page_id] = true unless page\n missing[parent_id] = true unless parent\n end\n end\n related.each do |page, parent|\n puts(\"#{page}-[:in_clade*]->#{parent}\")\n end\n puts \"Missing pages in TraitBank: #{missing.keys.sort.join(\", \")}\"\n end",
"def search_recursive(root,target_value)\n\n return root if root.payload == target_value\n\n root.children.each do |child|\n node = search_recursive(child,target_value)\n return node if node\n end\n\n return nil\n\nend",
"def get_children_recursion(node)\n\tif node.class == SOCIAL_NETWORK[0].class\n\t\tnode.children.each do |child|\n\t\t\tget_children_recursion(delegate_word(child))\n\t\tend\n\tend\nend",
"def crawl(&blk)\r\n while crawlNext(&blk)\r\n end\r\n end",
"def render_recursively(output_path, title, obj, parent = '')\n renderer.render(output_path, parent, title, obj.get_thumbs, obj.filter)\n\n # For Doc object, returns a list of makes. For the NodeSet object, returns a list of models.\n obj.filter.each do |key|\n # Only recurse if not the same as the parent to avoid an infinite loop\n if title != key\n nodes = obj.search('work:contains(\"' + key + '\")')\n render_recursively(output_path, key, nodes, title)\n end\n end\n end",
"def test_recursive_methods\n assert_equal 0, find_node(1).ancestors_r.size\n assert_equal 8, find_node(1).descendants_r.size\n assert_equal 4, find_node('1_1_2_1_1').ancestors_r.size\n end",
"def recursiveTreeTraversal(element)\n begin\n requirementsTree = findRequirementsTree(element)\n unless requirementsTree == nil\n checkForDuplicateRoots(requirementsTree)\n end\n for child in element.getOwnedElement()\n recursiveTreeTraversal(child)\n end\n rescue SystemStackError\n $logger.log(\"Recursive Issue1: \" + element.getName())\n end\nend",
"def recurse_otml_dirs(&block)\n return unless self.has_otmls\n yield(self)\n self.children.each do |child|\n child.recurse_otml_dirs(&block)\n end\nend",
"def traverse(person)\n loop = false\n queue = []\n queue << tree\n\n until loop || queue.size <= 0\n current = queue.pop()\n found = current.generation.compact.map(&:name).include?(person)\n\n if found\n loop = true\n return current unless block_given?\n\n yield(current)\n else\n children = current.children\n (children || []).each do |child|\n queue << child\n end\n end\n end\n end",
"def traverse\n link = @remaining_links.first\n if link\n @remaining_links.shift\n yield link\n @links[link]\n else\n @father\n end\n end",
"def find_beeper()\n while not next_to_a_beeper?()\n move_toward_beeper()\n end\n end",
"def collect_tree_up_from (foliage,\n parents,\n except_homepage,\n except_page,\n except_with_children)\n ancestry_string = parents.collect {|x| x.id.to_s }.join(\"/\")\n name_prefix = parents.collect {|x| x.title }.join(\" / \")\n name_prefix += \" / \" if name_prefix.present?\n\n our_mans_indexes = []\n foliage.each_index do |indx|\n if foliage[indx].ancestry.to_s == ancestry_string\n our_mans_indexes << indx\n end\n end\n\n leaves = []\n\n our_mans_indexes.reverse!\n our_mans_indexes.each do |indx|\n leaves << foliage.delete_at(indx)\n end\n\n leaves.sort! {|a,b| (a.prior == b.prior) ? a.id <=> b.id : a.prior <=> b.prior }\n result = []\n\n leaves.each do |leaf|\n do_writing = true\n if (except_page && leaf == except_page) || (except_homepage && leaf.home?)\n do_writing = false\n end\n result << [ name_prefix + leaf.title, leaf.id ] if do_writing\n unless do_writing == false && except_with_children\n result += collect_tree_up_from foliage,\n (parents + [ leaf ]),\n except_homepage,\n except_page,\n except_with_children\n end\n end\n\n result\n end",
"def traverse obj=self, &block\n case\n when obj.respond_to?(:parent?) && obj.respond_to?(:child?)\n block.call obj\n obj.children.each { |c| traverse(c, &block) }\n when obj.respond_to?(:parent?)\n obj.children.each { |c| traverse(c, &block) }\n when obj.respond_to?(:child?)\n block.call obj\n end\n end",
"def populate_inheritance_heirarchy\n apps_and_templates = appTemplates + templates\n apps_and_templates.each do |temp| \n temp.attributes[:parent].to_s != '' ? app_or_temp = temp.attributes[:parent] :\n temp.attributes[:template].to_s != '' ? app_or_temp = temp.attributes[:template]:\n next\n next if app_or_temp == \"what the fuck?\"\n # if temp.attributes[:parent].is_a? String or temp.attributes[:template].is_a? String\n if not app_or_temp.empty?\n parent_template = self.templates.find { |template| template.name.downcase == app_or_temp.downcase }\n temp.child_of << parent_template\n parent_template.parent_of << temp\n end\n end \n end",
"def depth_first_search(array)\n array.append(self.name)\n self.children.each do |child|\n child.depth_first_search(array)\n end\n return array\n\n end",
"def ascendants(result = nil, depth = 0)\n \n if (result.nil?)\n result = Hash.new\n end\n \n parents.each do |par|\n node = Array.new\n node[0] = par\n par_spice = par.spice\n if (!par_spice.nil? && par_spice.length > 0)\n # TBD: I know there is a Ruby way to copy an array but can't look it up on the plane - just copy myself for now\n spouse_list = Array.new\n par_spice.each do |s|\n spouse_list << s\n end\n node[1] = spouse_list\n end\n result[node] = depth\n par.ascendants(result, depth + 1)\n end \n \n return result\n \n end",
"def depth; end",
"def descendants\n tree.tap(&:shift)\n end",
"def walk; end",
"def DFS(root, target)\n ## base case: \n return nil if root.nil?\n return root if root.value == target\n ##indecutive step: \n ## DFS on the left side then DFS on the right side \n root.children.each do |child|\n search_result = DFS(child, target) ## better to save the actual value then check the value then return nil\n return search_result unless search_result.nil?\n end \n return nil\nend",
"def each_child\n \n end",
"def recurse_trade(node, route, items, visited={})\n \tif node == route[0]\n \t\troute << node\n \t\treturn route\n \telsif visited[node]\n \t\treturn\n \telse\n \t\tvisited[node] = true\n \t\troute << node\n \t\titems_children(node, items).each do |child|\n if child.new_owner\n next\n end\n \t\t\tresult = recurse_trade(child, route, items, visited)\n if result and result.count > 1\n # puts \"RESULT is #{result.count}\"\n # puts \"Result first is #{result.first}\"\n # puts \"Result last is #{result.last}\"\n return result\n else\n end\n \t\t\t# return result if result\n \t\tend\n \tend\t\t\n end",
"def generate_recurse(entry)\n keyword = entry.full_name\n\n if keyword\n puts keyword\n @current_content = service.info(keyword) #lookup(keyword)\n else\n keyword = ''\n @current_content = \"Welcome\"\n end\n\n file = entry.file_name\n file = File.join(output, file)\n\n #file = keyword\n #file = file.gsub('::', '--')\n #file = file.gsub('.' , '--')\n #file = file.gsub('#' , '-')\n #file = File.join(output, file + '.html')\n\n write(file, service.info(keyword))\n\n cmethods = entry.class_methods.map{ |x| x.to_s }.sort\n cmethods.each do |name|\n mname = \"#{entry.full_name}.#{name}\"\n mfile = WebRI.entry_to_path(mname)\n mfile = File.join(output, mfile)\n #mfile = File.join(output, \"#{entry.file_name}/c-#{esc(name)}.html\")\n write(mfile, service.info(mname))\n end\n\n imethods = entry.instance_methods.map{ |x| x.to_s }.sort\n imethods.each do |name|\n mname = \"#{entry.full_name}##{name}\"\n mfile = WebRI.entry_to_path(mname)\n mfile = File.join(output, mfile)\n #mfile = File.join(output, \"#{entry.file_name}/i-#{esc(name)}.html\")\n write(mfile, service.info(mname))\n end\n\n entry.subspaces.each do |child_name, child_entry|\n next if child_entry == entry\n @directory_depth += 1\n generate_recurse(child_entry)\n @directory_depth -= 1\n end\n end",
"def findme(subtree)\n if subtree.class == Hash\n if subtree.keys.first.to_s == @name\n @subtree = subtree\n else\n subtree.values.first.each do |subelement|\n findme(subelement)\n end\n end\n end\n end",
"def navigation_children\n sorted_children\n end",
"def traverse(trail = [], visited = {}, &block)\n trail.push(self)\n begin\n dependencies.each do |dep|\n next unless dep.runtime?\n dep.matching_specs(true).each do |dep_spec|\n next if visited.has_key?(dep_spec)\n visited[dep_spec] = true\n trail.push(dep_spec)\n begin\n result = block[self, dep, dep_spec, trail]\n ensure\n trail.pop\n end\n unless result == :next\n spec_name = dep_spec.name\n dep_spec.traverse(trail, visited, &block) unless\n trail.any? {|s| s.name == spec_name }\n end\n end\n end\n ensure\n trail.pop\n end\n end",
"def scan_patterns\n @max_level = 0\n @root.bfs do |r|\n reached = false\n curr_instances = yield(r.parent_id)\n curr_instances.each do |c_instance|\n q = @query.new.extend(Pbuilder::Query)\n q = q.search_next_instances(c_instance.uri, r.node.edge, r.node.value)\n q.execute do |i|\n @action.call(i, r.id, r.level, r.node.edge, c_instance.id)\n reached = true\n end\n end if ! curr_instances.nil?\n @max_level = r.level if r.level > @max_level\n reached\n end if @pass\n @max_level\n end",
"def traverse\n keys = []\n load_page 0\n while @current_page.next_page != 0\n @current_page.keys.each do |j|\n next if j == 0 \n keys << j\n end\n load_page @current_page.next_page\n end\n @current_page.keys.each do |j|\n next if j == 0 \n keys << j\n end\n # keys.each do |key|\n # sleep 0.005\n # $logger.logs key\n # end\n #$logger.logs keys.join(\",\")\n keys\n end",
"def descendants(result = nil, depth = 0)\n \n if (result.nil?)\n result = Hash.new\n end\n \n children.each do |kid|\n node = Array.new\n node[0] = kid\n kid_spice = kid.spice\n if (!kid_spice.nil? && kid_spice.length > 0)\n # TBD: I know there is a Ruby way to copy an array but can't look it up on the plane - just copy myself for now\n spouse_list = Array.new\n kid_spice.each do |s|\n spouse_list << s\n end\n node[1] = spouse_list\n end\n result[node] = depth\n kid.descendants(result, depth + 1)\n end \n \n return result\n \n end",
"def iterate root_child_itr\t\t\t#to iterate over the nodes\t\t\n\t \n\t ## Collect root_child_itr.children in a variable since it being used twice\n\t ## Can you try using some other conditional construct other than loop and break?\n\t\twhile true\n\t\t ###### Use an intuitive variable name\n\t\t\tchild = root_child_itr.children\n\t\t\t\n\t\t\t##### if temp.children[0]\n\t\t\tif child.children[0] == nil\t\t\t#checking if the node is innermost as innermost node will not be having any childnode\n\t\t\t\t@@arr.push child\n break\n\t\t\telse\n\t\t\t\tscan root_child_itr\t\t# iterate over the childnodes if it is not the parent of the innermost node\n break\n\t\t\tend\t\t\n\t\tend\n\tend",
"def depth_first_search_recursive(source)\n visited.add(source)\n\n source.neighbors.each do |neighbor|\n unless visited.include?(neighbor)\n depth_first_search_recursive(neighbor)\n meta[neighbor] = source\n end\n end\n end",
"def recurse(record)\n raise \"This gem only knows how to extract stuff w ActiveRecord\" unless record.kind_of? ActiveRecord::Base\n key = record.class.base_class.to_s # the base_class is key for correctly handling STI\n @output_hash[key] ||= Set.new # Set ensures no duplicates\n return if @output_hash[key].include?(record) # Prevent infinite loops as association cache on record with inverse_of will cause this method to stack overflow\n @output_hash[key].add(record)\n record.association_cache.each_pair do |assoc_name,association_def|\n Array(association_def.target).each do |a|\n self.recurse(a)\n end\n end\n end",
"def walkthrough_test( object)\r\n\t counter=4\r\n\t i,j =0\r\n\t \r\n\t # This Two Loops run the intire nested hash Array along\r\n\t # Ignores all fields which are empty\r\n\t # The loop goes for each position there an object through four Methods\r\n\t # The Methods returns a number of found objects in a same line\r\n\t while i < 8\r\n\t j=0\r\n\t while j < 8\r\n\t \r\n\t if @nha2[i][j] != nil\r\n\t if @nha2[i][j] == object\r\n\t\r\n\t ru1= walkhigh(i,j,object) \r\n\t if ru1==0\r\n\t # puts \"WINNER1\"\r\n\t return true\r\n\t break\r\n\t end\r\n\t \r\n\t ru2 = walkright(i,j,object)\r\n\t if ru2==0\r\n\t # puts \"WINNER2\"\r\n\t return true\r\n\t break\r\n\t end\r\n\t \r\n\t ru3 = walkleft_down(i,j,object)\r\n\t if ru3==0\r\n\t # puts \"WINNER3\"\r\n\t return true\r\n\t break\r\n\t end\r\n\t \r\n\t ru4 = walkright_down(i,j,object)\r\n\t if ru4==0\r\n\t # puts \"WINNER4\"\r\n\t return true\r\n\t break\r\n\t end\r\n\t end\r\n\t end \r\n\t j+=1\r\n\t end \r\n\t i+=1 \r\n\t end\r\n end",
"def traverse_down(&block)\n block.call(self)\n if(!children.nil?)\n children.each{ |child| child.traverse_down(&block) }\n end\n end",
"def dfs(root, target)\n return root if root.value == target\n root.children.each do |child|\n search_result = dfs(child, target)\n return search_result unless search_result.nil?\n end\n\n nil\nend",
"def each_recursive(&block)\n tree.each_recursive(&block)\n end",
"def each_ancestor # :nodoc:\n end",
"def each_leaf!\n raise \"Method not yet written.\"\n\n self.each do |leaf|\n yield(leaf)\n end\n end",
"def scan_path(path)\n assigns = {}\n node = self\n path.each do |p|\n new_node = node.children.find do |child| \n res = @@find_compare.call(child,to_node(p))\n assigns = assigns.merge(res) if res.instance_of?(Hash) \n res \n end\n if !new_node \n return nil\n end\n node = new_node\n end\n { :node => node, :assigns => assigns }\n end",
"def grab_children(father)\n local_list = []\n father.each_pair do |key, value| \n local_list.push(key)\n local_list.push(grab_children(value))\n end\n return local_list\nend",
"def look_deeper contexts, deep, max_item_depth = 9, max_aspect_depth = 9, item_depth = 0\n unless item_depth == 0\n deep = look_wider contexts, deep, max_aspect_depth, 0\n deep[:row] += 1\n end\n deep[:indents] ||= []\n # deep[:numberings] ||= []\n deep[:indents ][deep[:row]] = item_depth || 0\n # deep[:numberings][deep[:row]] = self.class.numbering_list || []\n self.class.numbering_push\n unless (item_depth += 1) >= max_item_depth\n items.each do |item|\n self.class.numbering_increment\n deep = (item.recursive_ref || item).look_deeper contexts, deep, max_item_depth, max_aspect_depth, item_depth\n end\n end\n self.class.numbering_pop\n item_depth -= 1\n deep\n end",
"def traverse(flag=nil,&op)\n\t\top.call(self)\n\t\tall_children_deep(flag).each do |c|\n\t\t\top.call(c)\n\t\tend\n\tend",
"def traverse_with_h(tree,height=nil,&block)\n\n tree.children.each do |t|\n traverse_with_h(t,height+1,&block)\n end\n\n if block_given?\n yield tree, height\n end\n\n end",
"def find_reaching_nodes\n @visit = CAN_REACH_TARGET\n for node, count in @parents\n if node.visit == UNVISITED\n node.find_reaching_nodes\n end\n end\n end",
"def generate_hierarchy(node, id = nil)\n loc = {}\n $navigation_html += '<ul><li>'\n node.each_element do |element|\n if element.name == 'node_name' && !id.nil?\n loc[:id] = id\n loc[:location] = element.text\n loc[:sub_loc] = []\n $navigation_html += \"<a href='#{loc[:location]}.html'>#{loc[:location]}</a>\"\n else\n loc[:sub_loc] << generate_hierarchy(element, element.attributes['atlas_node_id'])\n end\n end\n $navigation_html += '</li></ul>'\n return loc\nend",
"def visit(visitor, result=Array.new, level=0)\n # {{{\n if visitor.match(self) then\n result += self\n \n my_children_groups = User_Group_Hierarchy.select { |g|\n g.where(g['node_id__parent'] == attr['user_group_id'])\n }\n \n my_children_groups.each { |g|\n g.visit(visitor, result, level+1)\n }\n return result\n \n end\n return nil\n end",
"def traverse_sort_and_add_nav_order_to_nodes(node)\n\t\n\t\t# traverse subfolders, go deep\n\t\tif node_has_children(node)\n\t\t\n\t\t\t node.children.items.each_with_index do |child|\n\t\t\t\t if child.nav_type == \"folder\" || child.nav_type == \"folder+markdown\"\n\t\t\t\t\t items = traverse_sort_and_add_nav_order_to_nodes(child)\n\t\t\t\t\t child.children.items = items if items and items.size > 0\n\t\t\t\t end\n\t\t\t end\n\t\t \n\t\tend\t \n\t\n\t\thas_navig_yml = File.exist?(\"#{node.source_path}/aaaa-navigation.yml\")\n\t\n\t\tif has_navig_yml and node.children and node.children.items?\n\t\n\t\telse\n\t\t\treturn nil\t\t\n\t\tend \n\t\n\t\tsorted_nav_items = nil\n\t\n\t\tif node.children? and node.children.items?\n\t\t\tsorted_nav_items = node.children.items\n\t\tend\n\t\n\t\tif File.exists?(\"#{node.source_path}/aaaa-navigation.yml\")\n\t\t\t# load aaaa-navigation.yml\n\t\t\tnaml = Map.new(YAML.load_file(\"#{node.source_path}/aaaa-navigation.yml\"))\t\t\n\t\n\t\t\t# iterate and re-order navigation.yml\n\t\t\tsorted_nav_items = node.children.items\n\n\t\t\tsorted_nav_items.each_with_index do |sni, i| \n\t\t\t\tsni.nav_order = i + 1000\n\t\t\tend\n\n\t\t\tnaml.nav_items.each_with_index do |naml_item, i|\n\t\t\t\tsorted_nav_items.each do |sni| \n\t\t\t\t\tsni.nav_order = i if sni.source == naml_item.source\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tsorted_nav_items.sort! { |x, y| x.nav_order <=> y.nav_order }\n\n\t\t\tsorted_nav_items.each_with_index do |sni, i| \n\t\t\t\tsni.nav_order = i + 1\n\t\t\tend\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \n\t\tend\n\t\n\t\tsorted_nav_items\n\tend",
"def traverse_nav_markdown(node)\n\t\n\t\t# traverse subfolders, go deep\n\t\tif node_has_children(node)\n\t\t\t node.children.items.each_with_index do |child|\n\n\t\t\t\t items = traverse_nav_markdown(child)\n\t\t\t\t child.children = Map.new unless child.children?\n\t\t\t\t child.children.count = 0 unless child.children.count?\n\t\t\t\t child.children.items = [] unless child.children.items?\n\t\t \n\t\t\t\t child.children.count = items.size\n\t\t\t\t child.children.items = items\t\t\t\t\n\n\t\t\t end\n\t\tend\n\t\n\t\tnode_list = nil\n\t\tif node.children? and node.children.items?\n\t\t\tnode_list = node.children.items\n\t\tend\n\t\n\t\tmarkdowns = Dir.glob(\"#{node.source_path}/*.markdown\")\n\t\n\t\t# if we are at the root node (content source), don't process markdowns here (home.markdown handled separately, special)\n\t\tmarkdowns = [] if node.nav_level == 0\n\t\n\n\t\tif markdowns.size > 0 and node.nav_level > 0\n\n\t\t\t#puts\n\t\t\t#puts \"#{node.source} - #{node.children?}\"\n\t\t\tnode.children = Map.new unless node.children?\n\t\t\tnode.children.count = 0 unless node.children.count?\n\t\t\tnode.children.items = [] unless node.children.items?\n\t\t\t#puts \"#{node.source} - #{node.children?} - #{node.children.count?}\"\n\t\t\n\t\t\tnode_list = node.children.items\n\t\t\t\n\t\t\tmarkdowns.each do |md|\t\t\t\t\t\t\n\t\t\t\tsource = md.gsub(/#{node.source_path}\\//, \"\").gsub(/.markdown/, \"\")\n\t\t\t\n\t\t\t\tis_cbdoc_special_file = source.start_with? \"aaab-\"\n\t\t\t\n\t\t\t\tunless is_cbdoc_special_file\t\t\t\t\n\t\t\t\t\n\t\t\t\t\tif node.link?\n\t\t\t\t\t\tlink = node.link + \"/\" + source \n\t\t\t\t\telse\t\t \n\t\t\t\t\t\tnode.link = \"undefined\"\n\t\t\t\t\t\tputs node.nav_type\n\t\t\t\t\t\texit\n\t\t\t\t\tend\n\t\t\t\t\n\t\t\t\t\tsource_path = node.source_path + \"/\" + source\t\t\t \n\n\t\t\t\t\tis_markdown_and_folder = (File.exist?(\"#{source_path}\") && File.directory?(\"#{source_path}\"))\n\t\t\t\n\t\t\t\t\tunless is_markdown_and_folder\t\t \n\t\t\t\t\t\n\t\t\t\t\t\tfull_link = (node.link.start_with?(\"/#{CONTENT_LINK_PREFIX}/\") ?\tlink : \"/#{CONTENT_LINK_PREFIX}/\" + link )\n\t\t\t\t\t\tparent_path = node.source_path\n\t\t\t\t\t\tparent_full_link = (node.link.start_with?(\"/#{CONTENT_LINK_PREFIX}/\") ?\t node.link : \"/#{CONTENT_LINK_PREFIX}/\" + node.link )\n\t\t\t\t\n\t\t\t\t\t\titem = Map.new({\n\t\t\t\t\t\t\tdoctype: \"nav\",\n\t\t\t\t\t\t\tsubtype: \"nav_\" + (node.nav_level + 1).to_s,\n\t\t\t\t\t\t\tnav_type: \"markdown\",\n\t\t\t\t\t\t\tnav_level: node.nav_level + 1,\t\t\t\t\n\t\t\t\t\t\t\tnav_order: 9000,\n\t\t\t\t\t\t\tnav_title: process_navigation_name(source),\n\t\t\t\t\t\t\tsource: source,\n\t\t\t\t\t\t\tlink: link,\n\t\t\t\t\t\t\tfull_link: full_link,\n\t\t\t\t\t\t\tparent: node.source,\n\t\t\t\t\t\t\tparent_nav_title: node.nav_title,\n\t\t\t\t\t\t\tparent_link: node.link,\n\t\t\t\t\t\t\tparent_full_link: parent_full_link,\n\t\t\t\t\t\t\tparent_path: parent_path,\n\t\t\t\t\t\t\tsource_path: source_path,\n\t\t\t\t\t\t\tancestors: [],\n\t\t\t\t\t\t\tancestors_links: [],\n\t\t\t\t\t\t\tsiblings: [],\n\t\t\t\t\t\t\tsiblings_links: [],\n\t\t\t\t\t\t\tdescendants: [],\n\t\t\t\t\t\t\tdescendants_links: []\t\t\t\t \n\t\t\t\t\t\t})\n\t\t\t\t\t\n\t\t\t\t\t\tnode_list << item \n\t\t\t\t\tend\t\t \n\t\t\t\tend\n\t\t\tend\t\t \n\t\tend\n\t\n\t\t#ap node_list\n\t\n\t\tnode_list\n\tend",
"def traverse(root_node, i, level)\n name = root_node.values.first\n catid = root_node.keys.first\n english_name = root_node.values.first\n \n Session.product_type = @retailer\n \n #print catid + ' '\n \n french_name = BestBuyApi.get_category(catid, false)[\"name\"]\n \n # These categories are left singular in the feed\n # Regex is used fit file encoding (could change it to UTF 8 (according to stackoverflow post) and use the string normally with 'e' accent aigu)\n if english_name == \"Digital SLR\" && /^Appareil photo reflex (?<need_accent_numerique>num.rique)$/ =~ french_name\n english_name = \"Digital SLRs\"\n french_name = \"Appareils photo reflex #{need_accent_numerique}s\"\n end\n \n prefix = @retailer\n \n cat = ProductCategory.new(:product_type => prefix + catid, :feed_id => catid, :retailer => @retailer, \n :l_id => i, :level => level)\n \n i = i + 1\n children = BestBuyApi.get_subcategories(catid).values.first\n children.each do |child|\n i = traverse(child, i, level+1)\n end\n \n cat.r_id = i\n @categories_to_save << cat\n @translations_to_save << [cat.product_type, english_name, french_name]\n \n i = i + 1\n return i\n end",
"def trace\n \n path = WikiPath.new\n \n page = self\n\n wikipage = Wikipedia.find(title)\n\n # If page has a parent we must stop (we can fetch the cached path or it's a loop)\n # If there's no page... we reached the end of the road\n while !page.blank? and page.parent_id.blank? \n \n path.pages << page\n \n # We must get rid of infoboxes, metadata and Image and FIle links before we get the link title\n first_link_title = wikipage.content.gsub(\"\\n\", \"\").gsub(/\\{\\{[^\\}]*\\}\\}/, \"\").gsub(\"[[Image:\", \"\").gsub(\"[[File:\", \"\").match(/\\[\\[[^\\]]*\\]\\]/)[0]\n first_link_title = first_link_title.split(\"|\").first.gsub(\"]\", \"\").gsub(\"[\", \"\") unless first_link_title.nil?\n\n if first_link_title.nil?\n page.update_attributes :is_root => true\n page = nil\n else\n\n wikipage = Wikipedia.find(first_link_title)\n\n parent_page = WikiPage.find_by_title(first_link_title)\n parent_page ||= WikiPage.create :url => \"\", :title => first_link_title, :fetched_at => Time.now\n\n page.update_attributes :parent_id => parent_page.id\n\n\n page = parent_page \n end\n end\n\n unless page.blank?\n path.pages << page\n unless page.parent_id.blank?\n \n parent_pos = path.pages.index page.parent\n # If parent is not in the path then we have a cached path\n if parent_pos.nil?\n path.pages.concat(page.ancestors.reverse)\n else # If parent is in the path then we have a loop\n\n # remove pages from path\n roots = path.pages.slice! parent_pos, path.pages.length - parent_pos\n\n # create a tree\n tree = WikiTree.create :name => roots.map(&:title).join(\" - \")\n # we remove the parent page to every root and indicate it's a root\n roots.each do |root|\n root.update_attributes :is_root => true, :parent_id => nil\n end\n\n end\n\n end\n end\n\n path.pages.each do |page|\n tree.pages << page\n page.reload\n end\n\n path\n\n end",
"def traverse\n nodes = [self]\n until nodes.empty?\n node = nodes.pop\n yield node\n nodes += node.children.reverse unless node.children.empty?\n end\n end",
"def nested_set_recurse(&block)\n self.each do |x| \n x.nested_set_recurse(self, &block)\n end\n end",
"def each\n Directory.all.each do |node_id|\n yield find node_id\n end\n end",
"def traverse_tree(idea=self, depth=1, &blk)\n if idea.has_citations?\n blk.call(idea, depth)\n depth += 1\n idea.citations.each { |citation| traverse_tree(citation, depth, &blk) }\n else\n blk.call(idea, depth)\n end\n end",
"def visit_all(&block)\n visit &block\n children.each {|c| c.visit_all &block}\n end",
"def build_tree( n , d )\n \n if d.key?('v')\n n < d['v'] ? build_tree(n , d['l']) : build_tree(n, d['r'])\n else\n d['l'] = {}\n d['v'] = n\n d['r'] = {}\n end\n \nend",
"def parse_category_tree\n dry_run_notification\n\n page_html = get_page_html \"#{@donor.url}/mall/index.htm\"\n return display_error \"\\e[33;1m#{self.class}##{__method__}\\e[0m failed to get page html\" if page_html.blank?\n\n page_html.css('#headerWarp .cateAllList ul li').each do |menu_item|\n category_link_level_1 = get_link menu_item.at_css('dt a')\n category_level_1 = save_category(category_link_level_1) unless DRY_RUN\n display_category_structure category_link_level_1, \"#{'-' * 80}\\n\"\n\n menu_item.css('dd a').each do |menu_sub_item|\n category_link_level_2 = get_link menu_sub_item\n save_category(category_link_level_2, category_level_1.id) unless DRY_RUN\n display_category_structure category_link_level_2, ' '\n end\n end\n end",
"def find_element(h)\n h.each do |key, value|\n if value.is_a? Hash\n find_element(h[key])\n else\n puts value\n end\n end\nend",
"def traverse base, arcs\n objs = [base]\n arcs.each_with_index do |arc,i|\n objs.map! { |obj| traverse_one obj, arc, i==0 }\n objs.flatten!\n end\n objs\n end",
"def process_child_nodes(node); end",
"def optimize\n @h.each { |k,_| parent(k) }\n end",
"def cache_ancestry\n self.names_depth_cache = path.map(&:name).join('/')\n end",
"def generate_class_tree_level(parent='')\n $all.map { |klass|\n if parent == klass['parentname']\n [\n klass['name'],\n \"classes/#{klass['fullname']}.html\", # klass.path, \n '',\n generate_class_tree_level(klass['fullname'])\n ]\n else\n nil\n end\n }.compact\nend",
"def in_order_traverse(tree, array)\n if !tree.nil?\n in_order_traverse(tree.left, array)\n array.append(tree.value)\n in_order_traverse(tree.right, array)\n end\n return array\n\n\nend",
"def descend(&block)\n paths = descendants\n paths.each(&block) if block\n paths\n end",
"def traverse(map, right, down)\n bottom = map.count\n x, y, level, trees = 0, 0, 1, 0\n\n while level < bottom do\n x += right\n y += down\n trees += 1 if map[y][x.remainder(map[0].size)] == \"#\"\n level += down\n end\n trees\nend",
"def walk &blk\n self.children.each do |child|\n yield child\n end\n self.children.each do |child|\n child.walk &blk\n end\n end",
"def each_with_level(objects)\n path = [nil]\n objects.sort_by(&left_column_name.to_sym).each do |o|\n if o._parent_id != path.last\n # we are on a new level, did we decent or ascent?\n if path.include?(o._parent_id)\n # remove wrong wrong tailing paths elements\n path.pop while path.last != o._parent_id\n else\n path << o._parent_id\n end\n end\n yield(o, path.length - 1)\n end\n end",
"def walk(node)\n return unless componentizable?(node)\n @component_xpaths.push(node.path)\n node.children.each { |c| walk(c) }\n end",
"def find_path(target)\n queue = [root_node]\n until queue.empty?\n p current_node = queue.shift\n p queue\n return current_node if current_node.value == target\n current_node.children.each do |child|\n queue << child\n end\n end\n nil\nend",
"def recurse\n children = (self[:recurse] == :remote) ? {} : recurse_local\n\n if self[:target]\n recurse_link(children)\n elsif self[:source]\n recurse_remote(children)\n end\n\n # If we're purging resources, then delete any resource that isn't on the\n # remote system.\n mark_children_for_purging(children) if self.purge?\n\n # REVISIT: sort_by is more efficient?\n result = children.values.sort { |a, b| a[:path] <=> b[:path] }\n remove_less_specific_files(result)\n end",
"def get_children()\n {}\n end",
"def traverse(&block)\n\t\t\t\treturn to_enum(:traverse) unless block_given?\n\t\t\t\t\n\t\t\t\ttraverse_recurse(@order-1, 0, 0, self.origin, self.size, &block)\n\t\t\tend",
"def find_nodes\n puts '1st pass: find nodes'\n find :nodes\n self\n end",
"def nested_set_recurse(set, &block)\n block.call self, lambda{\n index = set.index(self) + 1\n while set[index].parent_id == self.id\n set[index].nested_set_recurse(set, &block)\n index += 1\n end\n }\n end",
"def apply_children\n \n end",
"def each\n @children.each {|child| yield child}\n end",
"def get_children(h, n)\n rr = h[n[:id]]\n if !rr.nil?\n rr[:children]\n else\n []\n end\n end",
"def get_children(h, n)\n rr = h[n[:id]]\n if !rr.nil?\n rr[:children]\n else\n []\n end\n end",
"def find_paths(&block)\n follow,kill,find,continue = SearchParams.process(&block)\n\n paths,path = [],[]\n search = lambda do |node|\n if find[node]\n paths << path.dup\n next if not continue[node]\n end\n next if kill[node]\n [*follow[node]].each do |n|\n next if path.include? n\n path.push(n)\n search[n]\n path.pop\n end\n end\n\n [*follow[self]].each do |n| \n path.push(n)\n search[n] \n path.pop\n end\n\n paths\n end",
"def nesting() end",
"def iterate(itr)\n itr.call(@leaf)\n end",
"def find_all_parents\n end",
"def ancestors() end",
"def dfs_object(root_node, target)\n #two base cases\n return root_node if root_node.value == target\n # return nil if root_node.parent.nil? #when there are no parents, we know we're back at the actual root of the tree\n\n root_node.children.each do |child_node|\n result = dfs(child_node, target)\n\n #returning nil at this point would cut short\n if result #is not nil\n return result\n end\n end\n\n nil\nend",
"def printlewis(node)\r\n\tputs node.to_s + \" =\"\r\n\tif node.nodes?\r\n\t\ttemp = Array.new\r\n\t\tnode.nodes.each { |n|\r\n\t\t\tif n == nil\r\n\t\t\t\tputs \":\"\r\n\t\t\telsif n == node.parent\r\n\t\t\t\tputs n\r\n\t\t\telsif !temp.include?(n)\r\n\t\t\t\ttemp << n\r\n\t\t\t\tputs n\r\n\t\t\telse\r\n\t\t\t\tputs n\r\n\t\t\tend\r\n\t\t}\r\n\t\tif !temp.empty?\r\n\t\t\ttemp.each { |n|\r\n\t\t\t\tputs \"========\"\r\n\t\t\t\tprintlewis(n)\r\n\t\t\t}\r\n\t\tend\r\n\tend\r\nend",
"def traverse(&block)\n children.each{|j| j.traverse(&block) }\n block.call(self)\n end",
"def visit_root(node)\n visit_rule_level(node.children)\n end",
"def traverse(&block); end",
"def traverse(&block); end"
] | [
"0.6688524",
"0.6639508",
"0.65458906",
"0.6249526",
"0.61509085",
"0.6118658",
"0.60941094",
"0.6067594",
"0.6064181",
"0.60232764",
"0.6012892",
"0.5970194",
"0.59203327",
"0.58866405",
"0.58642113",
"0.58613795",
"0.58338946",
"0.5832352",
"0.581534",
"0.5802425",
"0.57779366",
"0.57682556",
"0.57650286",
"0.5756843",
"0.57505995",
"0.5741802",
"0.5740202",
"0.5739105",
"0.5732886",
"0.57284987",
"0.57241005",
"0.570917",
"0.5683147",
"0.5677634",
"0.56682205",
"0.564479",
"0.5641796",
"0.56198376",
"0.5612907",
"0.56126916",
"0.56097203",
"0.5607109",
"0.5604968",
"0.56035477",
"0.56026405",
"0.5597538",
"0.55917823",
"0.5589899",
"0.55878985",
"0.5584349",
"0.5581274",
"0.55652547",
"0.5562386",
"0.5560501",
"0.55583733",
"0.5556948",
"0.55538213",
"0.55471",
"0.5543036",
"0.55338234",
"0.5531576",
"0.55308545",
"0.5523443",
"0.5509928",
"0.5505403",
"0.55029434",
"0.55025697",
"0.55008614",
"0.54991746",
"0.54940933",
"0.5490984",
"0.5485531",
"0.5484717",
"0.5481014",
"0.54736704",
"0.54728705",
"0.54655373",
"0.5446321",
"0.54396",
"0.5437658",
"0.54341096",
"0.54299915",
"0.5429116",
"0.54233944",
"0.5414813",
"0.54088926",
"0.54076785",
"0.54017115",
"0.5377417",
"0.5377417",
"0.5376412",
"0.5374358",
"0.5370475",
"0.53680485",
"0.53678226",
"0.5364551",
"0.536249",
"0.53614616",
"0.5359994",
"0.53587395",
"0.53587395"
] | 0.0 | -1 |
Takes elapsed ms and turns it into HH:MM:SS | def benchmark_summary_str(prefix, elapsed_ms)
summary_time = Time.at(elapsed_ms / 1000).utc.strftime('%H:%M:%S')
"#{prefix} SUMMARY Elapsed: #{summary_time}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def elapsed\n add(:elapsed, '00:00:00', '%s') { |v,elapsed|\n sprintf('%02i:%02i:%02i', \n elapsed / 3600, # hours, \n elapsed / 60 % 60, #minutes, \n elapsed % 60 #seconds\n )\n }\n end",
"def time\n a=[1, 1000, 60000, 3600000]*2\n ms = duration\n \"%02d\" % (ms / a[3]).to_s << \":\" << \n \"%02d\" % (ms % a[3] / a[2]).to_s << \":\" << \n \"%02d\" % (ms % a[2] / a[1]).to_s #<< \".\" << \n #\"%03d\" % (ms % a[1]).to_s\n end",
"def secs_to_hms\n frac = self % 1\n mins, secs = divmod(60)\n hrs, mins = mins.divmod(60)\n if frac.round(5) > 0.0\n format('%02<hrs>d:%02<mins>d:%02<secs>d.%<frac>d',\n { hrs: hrs,\n mins: mins, secs: secs,\n frac: frac.round(5) * 100 })\n else\n format('%02<hrs>d:%02<mins>d:%02<secs>d',\n { hrs: hrs, mins: mins, secs: secs })\n end\n end",
"def to_s\n\t\ts, m = @sec % 60, @sec / 60\n\t\th = m / 60\n\t\tm = m % 60\n\t\treturn (\"%02d:%02d:%02d\" % [h, m, s])\n\tend",
"def secondstoHMS(sec)\n seconds = sec % 60\n minutes = (sec / 60) % 60\n hours = sec / 3600\n\n format(\"%02d:%02d:%02d\", hours, minutes, seconds) #=> \"01:00:00\"\nend",
"def secs_to_hms( secs )\n secs = secs.to_i\n [secs/3600, secs/60 % 60, secs % 60].map { |t| t.to_s.rjust( 2, '0' ) }.join( ':' )\n end",
"def to_ftime\n mm, ss = divmod(60)\n hh, mm = mm.divmod(60)\n dd, hh = hh.divmod(24)\n format('%d days, %d hours, %d minutes, and %d seconds', dd, hh, mm, ss)\n end",
"def elapsed_time(start_time, finish_time)\n duration = finish_time.to_i - start_time.to_i\n hours = duration / 3600\n remainder = duration - (hours * 3600)\n minutes = remainder / 60\n seconds = remainder - (minutes * 60)\n sprintf \"%02d:%02d:%02d\", hours, minutes, seconds\n end",
"def pretty_runtime\n return nil if total_time.nil?\n t = total_time / 1000\n minutes = t / 60\n seconds = t - 60 * minutes\n sprintf '%d:%02d', minutes, seconds\n end",
"def elapsed\n ms = duration\n s = ms.to_i\n ms = ((ms - s) * 1000).to_i\n h = s / 3600\n s = s % 3600\n d = h / 24\n h = h % 24\n m = s / 60\n s = s % 60\n return d, h, m, s, ms\n end",
"def hms(seconds)\n\t\tTime.at(seconds).utc.strftime \"%H:%M:%S\"\n\tend",
"def time_conversion(mins)\n hour = mins/60\n min = mins.modulo(60)\n return '%02d:%02d' %[hour,min]\nend",
"def time_string\n hours = @seconds / 3600\n minutes = (@seconds % 3600) / 60\n secs = (@seconds % 3600) % 60\n \n sprintf(\"%02d:%02d:%02d\", hours, minutes, secs)\n end",
"def as_time_elapsed(secs)\n TIME_RANGE.map do |count, name|\n next unless secs > 0\n secs, n = secs.divmod(count)\n n = if name == :seconds\n n.round(4)\n else\n n.to_i\n end\n \"#{n} #{name}\"\n end.compact.reverse.join(' ')\n end",
"def time_conversion(mins)\r\n\r\n [mins /60, mins %60].map {|t| t.to_s.rjust(2, '0')}.join(':')\r\nend",
"def h # human\n \"%02d:%02d:%02d\" % [total/3600%24, total/60%60, total%60]\n end",
"def sbv_time(t)\r\n i = t.to_i\r\n \"%d:%02d:%02d.%03d\" % [i/3600, i/60%60, i%60, (t*1000).to_i%1000]\r\nend",
"def TimeConvert(num)\n\n # code goes here\n return (num/60).to_s + \":\" + (num%60).to_s\n \nend",
"def time_string\r\n clock = @seconds.divmod(60)\r\n if clock[0] > 59\r\n \tb = clock[1]\r\n a = clock[0].divmod(60)\r\n clock = a.push(b)\r\n else\r\n clock.unshift(0)\r\n end\r\nclock.map! do |final|\r\n if final < 10\r\n \"0\" + final.to_s\r\n else\r\n final \r\n end\r\nend\r\n clock.join(\":\")\t\r\nend",
"def to_time(secs)\n\t\thours = (secs/60/60).to_i\n\t\tsecs -= hours*60*60\n\t\tmins = (secs/60).to_i\n\t\tsecs -= mins*60\n\t\tsecs = secs.to_i\n\t\treturn \"#{hours.to_s}:#{mins.to_s.rjust(2,\"0\")}:#{secs.to_s.rjust(2,\"0\")}\"\n\tend",
"def timeConvert(num)\n\t\n\treturn \"#{num/60}:#{num%60}\"\nend",
"def format_time(seconds)\n if seconds < 60\n sprintf \"%ds\", seconds\n elsif seconds < 60 * 60\n sprintf \"%dm:%02ds\", seconds / 60, seconds % 60\n else\n sprintf \"%dh:%02dm\", seconds / (60 * 60), seconds % (60 * 60) / 60\n end\nend",
"def time_convert(num)\n hr, min = num.divmod(60)\n \"#{hr}:#{min}\"\nend",
"def time_conversion(minutes)\n hours = minutes / 60\n remaining_minutes = minutes % 60\n \"%s:%02d\" % [hours, remaining_minutes]\nend",
"def time_as_human\n return Knj::Strings.secs_to_human_time_str(self.time_total, :secs => false)\n end",
"def elapsed_time format=TrackingConfig[:elapsed_format], show_seconds=TrackingConfig[:show_elapsed_seconds]\n\t\t\t# Calculate the elapsed time and break it down into different units\n\t\t\tseconds = ((self.current? ? Time.now : @end_time) - @start_time).floor\n\t\t\tminutes = hours = days = 0\n\t\t\tif seconds >= 60\n\t\t\t\tminutes = seconds / 60\n\t\t\t\tseconds = seconds % 60\n\t\t\t\tif minutes >= 60\n\t\t\t\t\thours = minutes / 60\n\t\t\t\t\tminutes = minutes % 60\n\t\t\t\t\tif hours >= 24\n\t\t\t\t\t\tdays = hours / 24\n\t\t\t\t\t\thours = hours % 24\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\t# Return a string of the formatted elapsed time\n\t\t\tformat = elapsed_time_preset(format, show_seconds) if format.class == Symbol\n\t\t\treturn format % [days, hours, minutes, seconds]\n\t\tend",
"def time_string\n\n\t\thours = @seconds/3600 #if not an hour will be stored as 0\n\t\tremainder = @seconds%3600 #modulo gives the amount that remains\n\t\tsprintf(\"%02d:%02d:%02d\", hours, remainder/60, remainder%60) #string formatting\n\t\t\n\tend",
"def transform_secs(seconds) \n time = ''\n \n h = (seconds.to_f / 3600.0).floor\n seconds = seconds - (h * 3600)\n time << \"#{h.to_s.rjust(2, '0')}:\" if h > 0\n \n m = (seconds.to_f / 60.0).floor\n seconds = seconds - (m * 60)\n time << \"#{m.to_s.rjust(2, '0')}:\"\n \n time << \"#{seconds.to_s.rjust(2, '0')}\"\n \n time\nend",
"def in_ms(seconds)\n \"#{'%.2f' % (seconds * 1000).round(2)}ms\"\nend",
"def format_time_difference(delta)\n format_time(delta, '%H:%M:%S')\n end",
"def get_timing\r\n (time_swam.minutes.to_i > 0 ? \"#{time_swam.minutes.to_i}'\" : '') +\r\n format('%02.0f\"', time_swam.seconds.to_i) +\r\n format('%02.0f', time_swam.hundreds.to_i)\r\n end",
"def to_dot_time(time)\r\n time = time.to_i\r\n hours = time/3600.to_i\r\n minutes = (time/60 - hours * 60).to_i\r\n seconds = (time - (minutes * 60 + hours * 3600))\r\n # [hours, minutes, seconds].join(\":\")\r\n [format('%02d', hours),format('%02d', minutes) , format('%02d', seconds)].join(\":\")\r\n end",
"def print_time(nbr_secs)\n secs = nbr_secs.to_i\n mins = secs / 60\n hours = mins / 60\n return \"#{hours}:#{sprintf('%.2d',mins % 60)}:#{sprintf('%.2d',secs % 60)}\"\n end",
"def show_time(duration)\n time_taken = Time.at(duration).utc\n time_taken.strftime('%-H hours, %-M Minutes and %-S seconds')\n end",
"def TimeConvert(str)\r\n\r\n inTime = str.to_i\r\n hrs = inTime / 60\r\n mins = inTime - (hrs * 60)\r\n \r\n return hrs.to_s + \":\" + mins.to_s\r\n \r\nend",
"def formatted_duration(total_seconds)\n total_seconds = total_seconds.round # to avoid fractional seconds potentially compounding and messing up seconds, minutes and hours\n hours = total_seconds / (60*60)\n minutes = (total_seconds / 60) % 60 # the modulo operator (%) gives the remainder when leftside is divided by rightside. Ex: 121 % 60 = 1\n seconds = total_seconds % 60\n [hours, minutes, seconds].map do |t|\n # Right justify and pad with 0 until length is 2. \n # So if the duration of any of the time components is 0, then it will display as 00\n t.round.to_s.rjust(2,'0')\n end.join(':')\nend",
"def formatted_duration(total_seconds)\n total_seconds = total_seconds.round # to avoid fractional seconds potentially compounding and messing up seconds, minutes and hours\n hours = total_seconds / (60*60)\n minutes = (total_seconds / 60) % 60 # the modulo operator (%) gives the remainder when leftside is divided by rightside. Ex: 121 % 60 = 1\n seconds = total_seconds % 60\n [hours, minutes, seconds].map do |t|\n # Right justify and pad with 0 until length is 2. \n # So if the duration of any of the time components is 0, then it will display as 00\n t.round.to_s.rjust(2,'0')\n end.join(':')\nend",
"def duration\n return unless seconds\n\n m = seconds / 60\n s = sprintf('%02d', (seconds % 60))\n\n \"#{m}:#{s}\"\n end",
"def humanize_time(seconds)\n\tminutes = seconds / 60\n \t[[60, :m], [24, :h], [100000, :d]].map{ |count, name|\n if minutes > 0\n minutes, n = minutes.divmod(count)\n \"#{n.to_i}#{name}\"\n end\n }.compact.reverse.join('')\nend",
"def time_string()\n #Get numerical representations for each value\n @hours = seconds / 60 / 60\n @minutes = (seconds / 60) % 60\n @seconds = seconds % 60\n\n #Convert the values to properly formatted strings\n @hours = padded(@hours)\n @minutes = padded(@minutes)\n @seconds = padded(@seconds)\n \n #return the string\n @hours + ':' + @minutes + ':' + @seconds\n end",
"def TimeConvert(num)\n\n hours = num / 60\n minutes = num - hours * 60\n return \"#{hours}:#{minutes}\"\n \nend",
"def display_time(secs)\n [[60, :s], [60, :m], [9999, :h]].map do |count, name|\n if secs > 0\n secs, n = secs.divmod(count)\n\n \"#{n.to_i}#{name}\" unless n.to_i == 0\n end\n end.compact.reverse.join(' ')\n end",
"def TimeConvert(num)\n\thour = num / 60\n\tmin = num % 60\n\treturn \"#{hour}:#{min}\"\nend",
"def to_s\n \"%02d:%02d:%02d\" % [@hour, @minute, @second]\n end",
"def TimeConvert(num)\n hours = num/60\n minutes = num % 60\n \"#{hours}:#{minutes}\"\nend",
"def format_start(start_time)\n start_time.strftime('%H:%M')\n end",
"def tout_time(tout)\n current_time = Time.now.utc\n tout = Time.parse(tout)\n seconds = (current_time - tout).to_i\n if seconds >= 60\n minutes = seconds / 60\n if minutes >= 60\n hours = minutes / 60\n if hours >= 24\n days = hours / 24\n return days.to_s + \" days\"\n else\n return hours.to_s + \" hours\"\n end\n else\n return minutes.to_s + \" mins\"\n end\n else\n return seconds.to_s + \" seconds\"\n end\n end",
"def time_conversion(minutes)\n hours, minutes = minutes.divmod(60)\n minutes = ('0' + minutes.to_s)[-2, 2]\n \"#{hours}:#{minutes}\"\nend",
"def format_seconds value\n '%02d:%02d:%02d' % [(value/3600).floor,((value/60)%60).floor,(value%60)]\n end",
"def get_timing( time_swam = @time_swam )\r\n (time_swam.minutes.to_i > 0 ? \"#{time_swam.minutes.to_i}'\" : '') +\r\n format('%02.0f\"', time_swam.seconds.to_i) +\r\n format('%02.0f', time_swam.hundreds.to_i)\r\n end",
"def TimeConvert(num)\n hours = num / 60\n minutes = num % 60\n \n \"#{hours}:#{minutes}\"\nend",
"def format_time_difference_detailed(delta)\n format_time(delta, '%H:%M:%S.%L')\n end",
"def time_conversion(minutes)\n hours = 0\n counter = 0\n Array(1..minutes).each do |i|\n counter += 1\n if counter == 60\n minutes -= 60\n hours += 1\n counter -= 60\n end\n end\n minutes = '0' + minutes.to_s if minutes < 10\n return hours.to_s + \":\" + minutes.to_s\nend",
"def formattime2(unformattedtime)\n unformattedtime.strftime('%H:%M:%S')\n end",
"def TimeConvert(num)\n\nhour= num.div(60)\n min=num.remainder(60)\n \n return \"#{hour}\" + \":\" + \"#{min}\"\n \nend",
"def float_time_to_hhmmss(float_time)\n return if float_time.class == String\n if (float_time && float_time > 0)\n min = float_time.floor\n mm = (min % 60).floor\n hh = (min / 60).floor\n ss = ((float_time - min) * 60).round\n\n if float_time < 10.0\n return \"#{format('%01d', mm)}:#{format('%02d', ss)}\"\n elsif float_time < 60.0\n return \"#{format('%02d', mm)}:#{format('%02d', ss)}\"\n else\n return \"#{hh.to_s}:#{format('%02d', mm)}:#{format('%02d', ss)}\"\n end\n else\n return \"\"\n end\n end",
"def format_ms(in_seconds)\n ms = in_seconds * 1000.0\n whole_ms = ms.floor\n dec = ms - whole_ms\n \"#{'%3d' % whole_ms}#{('%.3f' % dec).gsub('0.', '.')}ms\"\n end",
"def time_diff(start_time, end_time)\n seconds_diff = (start_time - end_time).to_i.abs\n\n hours = seconds_diff / 3600\n seconds_diff -= hours * 3600\n\n minutes = seconds_diff / 60\n seconds_diff -= minutes * 60\n\n seconds = seconds_diff\n\n \"#{hours.to_s.rjust(2, '0')}:#{minutes.to_s.rjust(2, '0')}:#{seconds.to_s.rjust(2, '0')}\"\nend",
"def time_as_s time\n time.strftime('%H:%M:%S')\n end",
"def time_offset seconds\n shift = (@video.duration > seconds.to_f ? seconds : @video.duration).to_i\n hours, mins = (shift / 360), (shift / 60)\n sec = shift - (hours * 360 + mins * 60)\n \"%02d:%02d:%02d\" % [hours, mins, sec]\n end",
"def time_string(time)\n\th = time/3600.to_i\t\t# Heures\n\tm = time/60.to_i-h*60\t\t# Minutes\n\ts = time - h*3600 - m*60\t# Secondes\n\th=pres(h)\n\tm=pres(m)\n\ts=pres(s)\n\treturn [h,m,s].join(\":\")\nend",
"def time_format(seconds)\nend",
"def time_format(seconds)\nend",
"def proper_time_since start_time\n total_time = Time.now.to_f - start_time.to_f\n return \"#{total_time.round(2)} sec\" if total_time < 60\n return \"#{(total_time.to_f/60).round(2)} min\" if total_time < 3600\n return \"#{(total_time.to_f/3600).round(2)} h\"\nend",
"def format_time\n hours = format_hour @hour\n minutes = format_minute @minutes\n ampm = @hour < 12 ? @@ampm_hash['a'] : @@ampm_hash['p']\n time = ''\n time += hours[0] + minutes[0] + ' ' + ampm[0] + \"\\n\"\n time += hours[1] + minutes[1] + ' ' + ampm[1] + \"\\n\"\n time += hours[2] + minutes[2] + ' ' + ampm[2] + \"\\n\"\n time\n end",
"def time\n result = veeamconfig('schedule', 'show', '--jobId', get_job_id).lines\n # get the time\n t = result[1].strip.split(': ')[1]\n # split hours and minutes (will use these to pad first)\n bits = t.split(':')\n # pad both the hour and the minute with a zero if needed\n bits[0] = \"%02d\" % bits[0]\n bits[1] = \"%02d\" % bits[1]\n\n # return the joined value (HH:MM)\n bits.join(':')\n end",
"def formatted_duration\n hours = self.duration / 60\n minutes = self.duration % 60\n if minutes == 0\n \"#{hours}h\"\n else\n \"#{hours}h#{minutes}min\"\n end\n end",
"def to_s(pretty=true)\n d, h, m, s, ms = elapsed\n e_t = (d > 0) ? \"#{d.to_s}d \" : ''\n if pretty\n e_t += ('%02u:' % [h]) if (d + h) > 0\n e_t += ('%02u:' % [m]) if (d + h + m) > 0\n e_t += '%02u.%03u' % [s, ms]\n else\n e_t << '%02u:%02u:%02u.%03u' % [h,m,s, ms]\n end\n end",
"def time_string(time)\n h = time/3600.to_i # heure\n m = time/60.to_i-h*60 # minute\n s = time - h * 3600 - m * 60 # seconde\n h=pres(h)\n m=pres(m)\n s=pres(s)\n return [h,m,s].join(\":\")\n end",
"def format_time(time_in_seconds)\n min, sec = time_in_seconds.divmod(60)\n hrs, min = min.divmod(60)\n \"#{format(\"%02d\",hrs)}:#{format(\"%02d\",min)}:#{format(\"%02d\",sec.round)}\"\n end",
"def format_time(time_in_seconds)\n min, sec = time_in_seconds.divmod(60)\n hrs, min = min.divmod(60)\n \"#{format(\"%02d\",hrs)}:#{format(\"%02d\",min)}:#{format(\"%02d\",sec.round)}\"\n end",
"def elapsed_time_preset preset, show_seconds=TrackingConfig[:show_elapsed_seconds]\n\t\t\tcase preset\n\t\t\twhen :colons\n\t\t\t\tpreset = '%02d:%02d:%02d'\n\t\t\t\tpreset_secs = ':%02d'\n\t\t\twhen :letters\n\t\t\t\tpreset = '%02dd %02dh %02dm'\n\t\t\t\tpreset_secs = ' %02ds'\n\t\t\tend\n\t\t\tpreset += preset_secs if show_seconds\n\t\t\treturn preset\n\t\tend",
"def puttime\n if gameover?\n return\n end\n setpos(TIMELINE,0)\n addstr( (Time.now.to_i - @start).to_s + \" sec\")\n end",
"def time_convert (num)\n hour = (num/60).to_s\n min = (num % 60).to_s\n puts hour + \":\"+ min\nend",
"def to_s\n '%02d:%02d' % [(@hours % 24), @minutes]\n end",
"def str_elapsed(t)\n seconds = Time.now.to_i - t\n return \"now\" if seconds <= 1\n\n length,label = time_lengths.select{|length,label| seconds >= length }.first\n units = seconds/length\n \"#{units} #{label}#{'s' if units > 1} ago\"\nend",
"def to_time(value)\n\n hour = (value/3600).floor\n minute = ((value - hour*3600)/60).floor\n second =(value - hour*3600 - minute*60).floor\n\n hour = \"0.#{Hour}\" if (hour.length == 1 )\n minute = \"0.#{minute}\" if (minute.length == 1 )\n second = \"0.#{second}\" if (second.length == 1 )\n\n return (\"#{hour}.:.#{minute}}.:.#{second}\")\n end",
"def timer\n seconds = (@panel_input % 100) % 60\n minutes = @panel_input / 100 + (@panel_input % 100) / 60\n \"%02<mm>d:%02<ss>d\" .% mm: minutes, ss: seconds\n end",
"def format_time_diff(tstart)\n diff = Time.now - tstart\n format_time(diff)\nend",
"def nice_time\n Time.at(time).utc.strftime('%-M:%Ss')\n end",
"def timestr(subsec = true)\n if(subsec)\n \"%02d:%02d:%06.3f\" % [ getHour(nil).to_i,\n getMin().to_i,\n getSec().to_f ] ;\n else\n \"%02d:%02d:%02d\" % [ getHour(nil).to_i,\n getMin().to_i,\n getSec().to_i ] ;\n end\n\n end",
"def time_str\n Time.at(time[0..-4].to_f + time[-3..-1].to_f / 1000)\n .strftime(\"%M:%S.%L\")\n end",
"def time_conversion2(minutes)\n hours = 0\n\n while minutes >= 60 # keep substracting 60 untill leaving just minutes less than 60\n hours += 1\n minutes -= 60\n end\n\n if minutes < 10 # less than two digit minutes\n minutes_s = \"0\" + minutes.to_s\n else # more than 10\n minutes_s = minutes.to_s\n end\n\n return hours.to_s + \":\" + minutes_s\nend",
"def format_duration\n if duration % 60 != 0\n \"#{duration/60} hours #{duration%60} minutes\"\n else\n \"#{duration/60} hours\"\n end\n end",
"def vtt_string\n format('%02d:%02d:%02d.%03d', @hours, @minutes, @seconds, @milliseconds)\n end",
"def milliseconds_to_formatted_time(milliseconds, include_fractions = true)\n total_seconds = milliseconds / 1000\n hours = total_seconds / (60 * 60)\n minutes = (total_seconds / 60) % 60\n seconds = total_seconds % 60\n fractional_seconds = milliseconds.to_s[-3, 3].to_i\n fractional_seconds = (include_fractions && fractional_seconds.positive? ? \".#{fractional_seconds}\" : '')\n\n output = ''\n if hours > 0\n output += \"#{hours}:\"\n end\n\n output += \"#{minutes.to_s.rjust(2,'0')}:#{seconds.to_s.rjust(2,'0')}#{fractional_seconds}\"\n output\n end",
"def time_conversion(minutes)\n hours = 0\n if minutes < 10\n minutes = \"0\" + minutes.to_s\n elsif minutes % 60 == 0 \n hours = minutes / 60\n minutes = \"00\"\n else\n hours = minutes / 60\n minutes = minutes % 60\n end\n return hours.to_s + \":\" + minutes.to_s\nend",
"def time_conversion(minutes)\n hr = 0\n min = 0\n \n while minutes >= 0\n if minutes >= 60\n minutes = minutes - 60\n hr = hr + 1\n elsif minutes < 10\n min = 0.to_s + minutes.to_s\n return hr.to_s + ':' + min.to_s\n else\n min = minutes\n return hr.to_s + ':' + min.to_s\n end\n end\nend",
"def elapsed_time\n (Time.now.to_f - @start_time) * 1000000\n end",
"def tt(time, format=:short); '13:37'; end",
"def TimeConvert(num)\n hour = num/60\n minute = num % 60\n puts (\"#{hour}:#{minute}\")\n\nend",
"def log_fmt_timestamp(time)\n [(time/3600).to_i, (time/60 % 60).to_i, (time % 60).to_i].map{|t| t.to_s.rjust(2,'0')}.join(':')\n end",
"def pretty_time(num_seconds)\n\ttemp = num_seconds\t\n\n\thours = temp/3600\n\ttemp = temp%3600\n\n\tminutes = temp/60\n\ttemp = temp%60\n\n\tif hours > 0\n\t\treturn \"#{hours} Hours, #{minutes} Minutes, and #{temp} Seconds\"\n\telsif minutes > 0\n\t\treturn \"#{minutes} Minutes and #{temp} Seconds\"\n\telse\n\t\treturn \"#{temp} Seconds\"\n\tend\nend",
"def draw_playtime(x, y, width, align)\n hour = @total_sec / 60 / 60\n min = @total_sec / 60 % 60\n sec = @total_sec % 60\n time_string = sprintf(\"%02d:%02d:%02d\", hour, min, sec)\n self.contents.font.color = normal_color\n self.contents.draw_text(x, y, width, WLH, time_string, 2)\n end",
"def to_s\n ms, neg = @msecs < 0 ? [ -@msecs, true ] : [ @msecs, false ]\n secs = ( ms % MIN_TO_MS ) / SEC_TO_MS_F\n mmins = ( ms / MIN_TO_MS ).to_i\n hours, mins = mmins / 60, mmins % 60\n\n pad = ( secs < 10.0 ) ? '0' : '';\n\n if hours > 0\n hours = -hours if neg\n \"%+d:%02d:%s%g\" % [ hours, mins, pad, secs ]\n elsif mins > 0\n mins = -mins if neg\n \"%+d:%s%g\" % [ mins, pad, secs ]\n else\n secs = -secs if neg\n \"%+g\" % [ secs ]\n end\n end",
"def separated_time_string(seconds, separator)\n secs = seconds % 60\n mins = seconds / 60 % 60\n hours = seconds / 60 / 60 \n time_string = sprintf(\"%02d#{separator}%02d#{separator}%02d\", hours, mins, secs)\n end",
"def friendly_duration\n min = @duration / 60\n utes = 60 * min\n sec = @duration - utes\n return \"#{min} Minutes and #{sec} seconds\" \n end",
"def elapsed_time\n (Time.now.to_f - @start_time) * 1000\n end",
"def time_string(seconds)\n Time.at(seconds).utc.strftime(\"%H:%M:%S\")\nend",
"def prep_time_passed\n return \"7:34\"\n end",
"def elapsed_time\n if end_time && start_time\n return ((end_time - start_time)/60).round\n else\n return 0\n end\n end"
] | [
"0.7458337",
"0.7422375",
"0.74212736",
"0.7382089",
"0.7271856",
"0.72502214",
"0.7144826",
"0.71034366",
"0.7089622",
"0.7075168",
"0.7062447",
"0.70397794",
"0.7038349",
"0.7020916",
"0.7020913",
"0.7018163",
"0.6989756",
"0.69843936",
"0.697557",
"0.6966947",
"0.6938702",
"0.69317704",
"0.6863896",
"0.6859765",
"0.68570775",
"0.68499786",
"0.6849365",
"0.6809337",
"0.679637",
"0.6789663",
"0.6757555",
"0.6753725",
"0.6753576",
"0.6724735",
"0.6717071",
"0.6715201",
"0.6715201",
"0.67107975",
"0.67021376",
"0.6697655",
"0.6695783",
"0.669374",
"0.6685572",
"0.668098",
"0.66759616",
"0.6675004",
"0.66132784",
"0.6606983",
"0.6599652",
"0.659297",
"0.6579596",
"0.6577664",
"0.6563087",
"0.6557857",
"0.6557389",
"0.6555981",
"0.65496695",
"0.6535321",
"0.65296406",
"0.6528473",
"0.65269357",
"0.6508377",
"0.6508377",
"0.65039027",
"0.65027344",
"0.6498433",
"0.6485812",
"0.64777535",
"0.6462279",
"0.6456003",
"0.6456003",
"0.6453421",
"0.64523566",
"0.6449199",
"0.64446276",
"0.64425087",
"0.643888",
"0.6425413",
"0.6396335",
"0.63917804",
"0.63895255",
"0.6386193",
"0.63822687",
"0.6380435",
"0.6376887",
"0.6354215",
"0.6353565",
"0.6353386",
"0.63499415",
"0.63461196",
"0.63460356",
"0.63397235",
"0.6338413",
"0.6336945",
"0.6329746",
"0.6327903",
"0.63270694",
"0.6325496",
"0.6320331",
"0.6318933",
"0.6310829"
] | 0.0 | -1 |
Adds argument to list, along with link to previous node, which in turn has link to this new node. | def <<(data)
node = DoubleNode.new(:data => data)
# list has nodes, add this to last
if @tail
@tail.tail = node
node.head = @tail
# list empty, add first node
else
@head = node
end
# node always added to end of list
@tail = node
@size += 1
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push arg\n if @items.nil?\n\t @items = Link.new(arg)\n\telse\n\t n = Link.new(arg)\n\t n.next = @items\n\t @items = n\n\tend\n\treturn @items\n end",
"def add_to_front(node)\n node.next = self.head # previous head becomes second, after the node\n self.head = node # the node becomes the new head\n if self.tail == nil\n self.tail = node # if the list was empty, then the node is also the new tail\n end\n end",
"def add_node(node)\n node.prev = head\n node.next = head.next\n\n head.next.prev = node\n head.next = node\n end",
"def add_to_front(node)\n node.next = self.head\n self.head = node\n end",
"def add_to_front(node)\n node.next = self.head\n self.head = node\n end",
"def add_to_front(node)\n node.next = self.head\n self.head = node\n end",
"def set_prev(node)\n @prev_node = node\n end",
"def push(value) #adding element at the end of LL\n new_node = Node.new(value) #create new node\n return @head = new_node if @head == nil #if head is nil(list is empty) new node becomes head\n #if list is not empty, we must traverse to last element in the list \n temp_node = @head #starting from the head\n until temp_node.link == nil #last element in the list is element whit link pointing to nil\n temp_node = temp_node.link #traversing through list using link variable\n end\n temp_node.link = new_node #to append node we assign new node ad last nodes link variable\n end",
"def add_to_front(node)\n node.next = @head\n @head = node\n end",
"def unshift(val)\n self.double_link_linked_list.prepend(val)\n end",
"def add_previous_sibling(node_or_tags); end",
"def set_prev(node)\n\t\t\t@prev = node\n\t\tend",
"def reverse_list(list, previous=nil)\r\n # do stuff\r\n if list\r\n next_node = list.next_node\r\n list.next_node = previous\r\n if next_node\r\n reverse_list(next_node, list)\r\n else\r\n return list\r\n end\r\n end\r\nend",
"def addToList(x)\n if @first.nil? # Queue empty? new node is both first and last\n @first = @last = Node.new_x x\n else\n @last.next = Node.new_x x # Otherwise insert at back and update @last\n @last = @last.next\n end\n @size += 1 # Update @size\n self # Return receiver to enable cascading of enqueue calls\n end",
"def add_to_front(node)\n temp = @head\n @head = node\n @head.next = temp\n end",
"def add_to_front(node)\n node.set_next(@head)\n @head = node\n end",
"def add_to_front(node)\n temp_node = @head\n @head = node\n @head.next = temp_node\n end",
"def add_to_front(node)\n temp_node = @head\n @head = node\n @head.next = temp_node\n end",
"def prepend(*args)\n update(*args)\n @list.unshift(args[0])\n end",
"def reverse_list(list, previous=nil)\n start = list.next_node\n list.next_node = previous\n if start\n reverse_list(start, list)\n else\n list\n end\n\nend",
"def push_before(node, new_node)\n new_node.previous_node = node.previous_node\n new_node.next_node = node\n node.previous_node.next_node = new_node\n node.previous_node = new_node\n end",
"def append(x)\n elem = ListElement.new(x)\n elem.prev = self\n self.next = elem\n end",
"def add_to_front(node)\n if @head == nil\n return add_to_tail(node)\n else\n old_head = @head\n @head = node\n @head.next = old_head\n return\n end\n end",
"def add_to_front(node)\n @tail ||= node\n node.next = @head if @head\n @head = node\n end",
"def add_to_front(node)\n if (!@head)\n @head = node\n @tail = node\n else\n prior_head = @head\n @head = node\n @head.next = prior_head\n end\n end",
"def add_to_front(node)\n if self.head == nil\n self.head = node\n self.tail = node\n else\n node.next = self.head\n self.head = node\n end\n end",
"def add_to_front(node)\n if self.head == nil\n self.head = node\n self.tail = node\n else\n node.next = self.head\n self.head = node\n end\n end",
"def append(value)\n a = Node.new(value);\n a.prev = last;\n a.next = nil;\n a.prev.next = a; #prev now 2nd last\n end",
"def add_to_front(node)\n if @head === nil\n @head = node\n @tail = node\n else\n node.next = @head\n @head = node\n end\n end",
"def add_to_front(node)\n node.next = self.head\n self.head = node\n if self.tail == nil && node.next == nil\n self.tail = node\n end\n end",
"def previous_sibling=(other); end",
"def add_node_front(input)\n if !@head\n @head = Node.new(input)\n else\n temp = @head\n @head = Node.new(input)\n @head.next = temp\n end\n end",
"def insertBack(object=nil) #we need more of these\n tempNode = Node.new(object)\n tempNode.next = @last\n tempNode.prev = @last.prev\n @last.prev.next = tempNode\n @last.prev = tempNode\n @size += 1\n return @last.prev \n \n end",
"def add_to_front(node)\n if @head.nil?\n @tail = node\n else\n node.next = @head\n end\n @head = node\n end",
"def add_to_front(node)\n if self.head.nil?\n self.head = node\n self.tail = node\n else\n temp = self.head\n self.head = node\n self.head.next = temp\n end\n end",
"def add_to_front(node)\n node.next = self.head\n self.head.nil? && self.tail.nil? ? (self.head = node && self.tail = node) : self.head = node\n end",
"def reverse_list_mutation(list, previous=nil)\n next_node = list.next_node\n list.next_node = previous\n\n if next_node\n reverse_list_mutation(next_node, list)\n else\n list\n end\nend",
"def add_to_front(node)\n node.next = @head\n @head = node\n if @tail.nil?\n @tail = node\n end\n end",
"def add_to_front(node)\n node.next = @head\n @head = node\n if @tail.nil?\n @tail = node\n end\n end",
"def add_to_front(node)\n node.next = @head\n @head = node\n if @tail.nil?\n @tail = node\n end\n end",
"def push_after(node, new_node)\n new_node.previous_node = node\n new_node.next_node = node.next_node\n node.next_node = new_node\n end",
"def reverse_util(old_list, new_list, previous_node)\n if previous_node == nil\n return new_list\n end\n\n current_node = new_list.last_node\n next_node = old_list.last_node\n new_list.insert_after(current_node, next_node)\n old_list.remove(old_list.last_node)\n\n reverse_util(old_list, new_list, old_list.last_node)\n end",
"def +(args)\n raise 'bad arg to +' unless args.is_a?(Hash)\n\n NodeCall.new(_e, engine, node, params.merge(args))\n end",
"def append_list (list1, list2)\n list1.nextnode.nil? ? list1.nextnode = list2 : append_list(list1.nextnode, list2)\nend",
"def previous=(node_or_tags); end",
"def reverse_list(list, previous_node=nil)\n \t\thead = list.next_node\n \t\treverse_list(list, head)\n return head\n end",
"def add(info)\n\t\t_new = Node.new(info, previous: @tail)\n\t\tif @head.nil?\n\t\t\t@head = _new\n\t\t\t@tail = @head\n\t\telse\n\t\t\t@tail.next = _new\n\t\t\t@tail = _new\n\t\tend\n\t\t@length += 1\n\t\tself\n\tend",
"def add_node(node); end",
"def append(*args)\n update(*args)\n @list.push(args[0])\n end",
"def add_at_head(val)\n if @llist\n old_head = @llist\n @llist = Node.new(val)\n @llist.add_next_node old_head\n else\n @llist = Node.new(val)\n end\n end",
"def append(value)\n #needs .last method\n #self.last\n last.next = Node.new(value)\n end",
"def unshift(node)\n if @head.nil?\n @head = node\n @tail = node\n else\n node.next = @head\n @head = node\n end\n end",
"def push (nodo)\n raise unless nodo.is_a? (ListNode)\n nodo.prev=@tail\n @tail.next=nodo\n @tail=nodo\n \n end",
"def myNextFunc(list, last)\n list << last\nend",
"def reverse!\n old_list = self\n new_list = List.new(self.last_node)\n previous_node = self.get_previous_node(self.last_node)\n old_list.remove(old_list.last_node)\n reverse_util(old_list, new_list, previous_node)\n end",
"def prepend(entry)\n node = new_node(entry)\n node.next_node = head\n @head = node\n end",
"def prepend(data)\n\t\t@previous_head = @head\n\t\t@head = Node.new(data, @previous_head)\n\tend",
"def argument_node; end",
"def append( value )\n last.next = Node.new value\n end",
"def add_node(value)\n add_node_support(value, :linked_list)\n end",
"def insert_before(x,rel)\n x = ListElement.new(x) \n\n #inserting at the beginnig of the list \n if rel == head\n x.next = head\n self.head = x\n\n #inserting in the tail of the list\n else\n el = head\n prev = head\n while el and el != rel\n prev = el\n el = el.next\n end\n\n if el.nil?\n raise ListError, \"List element not found\"\n else\n prev.next = x\n x.next = el\n end\n end\n end",
"def insert_next prev_node, data\n\t\tnew_node = Node.new data\n\t\tif self.length == 0\n\t\t\tself.head = new_node.next = new_node\n\t\telse\n\t\t\tnew_node.next = prev_node.next\n\t\t\tprev_node.next = new_node\n\t\tend\n self.length += 1\n \n new_node\n\tend",
"def reverse_list(list, previous=nil)\n\twhile list\t\n\t\toriginal_next_node = list.next_node\n\n\t\tlist.next_node = previous\n\t\tprevious = list\n \n\t\tlist = original_next_node\n\tend\n\n \t previous\n \t \nend",
"def prepend( value )\n new_node = Node.new value\n\n # Whatever node was at the start of the list, it\n # is now the 'next' node for our newly created node\n new_node.next = @head\n\n # The new head of the list is set to be the new\n # node that we just created\n @head = new_node\n end",
"def prepend( value )\n new_node = Node.new value\n\n # Whatever node was at the start of the list, it\n # is now the 'next' node for our newly created node\n new_node.next = @head\n\n # The new head of the list is set to be the new\n # node that we just created\n @head = new_node\n end",
"def push(stack, node)\n if stack.argument_definitions.last\n arg_type = stack.argument_definitions.last.type.unwrap\n if arg_type.kind.input_object?\n argument_defn = arg_type.arguments[node.name]\n else\n argument_defn = nil\n end\n elsif stack.directive_definitions.last\n argument_defn = stack.directive_definitions.last.arguments[node.name]\n elsif stack.field_definitions.last\n argument_defn = stack.field_definitions.last.arguments[node.name]\n else\n argument_defn = nil\n end\n stack.argument_definitions.push(argument_defn)\n stack.path.push(node.name)\n end",
"def add(*args)\n @list << args\n @list.flatten!\n end",
"def prepend(node)\n node.next = @head.next\n @head.next = node\n end",
"def insert value\r\n current_head = @head\r\n #create a new node with:\r\n #\"value\" that come from LIST-INSERT argument\r\n #\"next\" that point to the node that is currently at the head\r\n #\"prev\" that is NULL since it will be spliced onto the front of the list\r\n new_node = Node.new value, current_head, nil\r\n #if the list is not empty (L.head != NULL)(there exist at least one node in the list)\r\n if current_head != nil\r\n #point the old head node prev pointer to the new node\r\n current_head.set_prev_node new_node\r\n #OPTIONAL: if the list is empty, set tail to the the first node\r\n else\r\n @tail = new_node\r\n end\r\n #point L.head to the new node\r\n @head = new_node\r\n #You can return a pointer to the new node so you can access it quickly (e.g. for reading, updating or deleting)\r\n return new_node\r\n #You can return the list so that you can chain methods\r\n return self\r\n end",
"def ll_append(data)\n new_node = Node.new(data)\n \n if @num_nodes == 0\n @head = new_node\n @tail = new_node\n else\n end_node = @tail\n end_node.set_Next(new_node)\n @tail = new_node\n end\n \n @num_nodes += 1\n end",
"def add_to_tail(node)\n if self.head == nil # if the list is empty, node becomes new head\n self.head = node\n else\n self.tail.next = node # otherwise, is the next node after the previous tail\n end\n node.next = nil # no next\n self.tail = node # it becomes the new tail\n end",
"def insert_after prev_node, new_data\n # 1. check if the given prev_node exists\n if prev_node == nil\n puts \"the given previous node cannot be NULL\"\n end\n # 2. Create new node\n # 3. Put in the data\n new_node = Node.new(new_data)\n # 4. Make next of new Node as next of prev_node\n new_node.next_node = prev_node.next_node\n # 5. make next of prev_node as new_node\n prev_node.next_node = new_node\n # 6. Make prev_node ass previous of new_node\n new_node.prev_node = prev_node\n # 7. Change previous of new_nodes's next node\n if new_node.next_node != nil\n new_node.next_node.prev_node = new_node\n end\n end",
"def follow(other)\n following << other\n other.followers << self\n end",
"def freshen(link, value)\n link.prev.next = link.next\n link.next.prev = link.prev\n attach_to_tail(link)\n link.val = value\n link\n end",
"def prepend (number)\n # create a new node\n this_node = Node.new(number)\n \n # make new node point to head, and save it to head\n this_node.next_node = head\n @head = this_node\n end",
"def reverse_list(current_node)\n return current_node if current_node == nil or current_node.next_node == nil\n\n next_node = current_node.next_node\n new_head = reverse_list(current_node.next_node)\n next_node.next_node = current_node\n current_node.next_node = nil\n return new_head\nend",
"def append(value)\n new_node = ListNode.new(value)\n if self.head.nil?\n self.head = self.tail = new_node\n self.size = 1\n else\n set_next_and_prev(self.tail, new_node)\n self.tail = new_node\n self.size += 1\n end\n self.as_string\n end",
"def node_insert_after!(x, prev, level)\n netx = node_next(prev, level) # 'next' is a reserved word in ruby\n \n # forward links\n x[0][level] = netx\n prev[0][level] = x\n \n # backward links\n x[3][level] = prev\n netx[3][level] = x\n end",
"def ll_push(data)\n new_node = Node.new(data)\n if @num_nodes == 0\n @head = new_node\n @tail = new_node\n else\n current = @head\n new_node.set_Next(current)\n @head = new_node\n end\n \n @num_nodes += 1\n end",
"def add_to_tail(node)\n if @head == nil # no head exist, so we need to create one\n @head = node\n @tail = @head # both head and tail are same (e.g. n1)\n else\n @tail.next = node # set the pointer (e.g. n1 points to n2)\n @tail = node # then set the new tail value to n2\n end\n end",
"def prepend(value)\n if @head.nil?\n @head = Node.new(value)\n else\n old_point = @head\n @head = Node.new(value)\n @head.next = old_point\n # old_next = @head.next\n # p old_next\n # @head = Node.new(value)\n # @head.next = old_next\n # head is hi\n # replace head with new value\n # make head next the hi attribute\n end\n end",
"def add_last(node)\n if @head.nil?\n @head = node\n return\n end\n\n iterate do |curr_node|\n if curr_node.next_node.nil?\n curr_node.next_node = node\n node.prev_node = curr_node\n return\n end\n end\n end",
"def prepend(x)\n el = ListElement.new(x)\n el.next = @head\n @head = el\n end",
"def prepend(value)\n newNode = Node.new(value)\n if @list == nil\n @list = newNode\n else\n prevList = list\n @list = newNode\n @list.nextNode = prevList\n end\n end",
"def linkItem _obj, _args\n \"_obj linkItem _args;\" \n end",
"def make_int_list(args)\n head = Node.new args[0]\n args[1..args.length - 1].each { |arg| head.append arg }\n head\nend",
"def cat list\n return nil unless list \n \n # Point the previous pointer of the head of the list we are appending to the tail of the current list\n list.head.prev = self.tail\n # Point the next pointer of the tail of the current list to the head of the list we are appending\n self.tail.next = list.head\n # Set the tail of the current list to the tail of the list we are appending\n self.tail = list.tail\n # Adjust current list length\n self.length += list.length\nend",
"def prepend(value)\n #Instantiate the object to be the new head\n new_node = Node.new value\n #Set its next value to the current head\n new_node.next = @head\n @head.before = new_node\n #Set the new one as the new head by repointing SinglyLinkedList head to it\n @head = new_node\n end",
"def unsorted_add(item)\n @head = Node.new(item,@head)\n end",
"def add(*arguments)\n if arguments[0].is_a?(Node)\n if arguments[1]\n fail ArgumentError, 'The second argument must not be specified, when passing a VObject Node'\n end\n arguments[0].parent = self\n new_node = arguments[0]\n elsif arguments[0].is_a?(String)\n new_node = @root.create(*arguments)\n else\n fail ArgumentError, 'The first argument must either be a Node or a string'\n end\n\n name = new_node.name\n if @children.key?(name)\n @children[name] << new_node\n else\n @children[name] = [new_node]\n end\n\n new_node\n end",
"def push_front(nodo)\n\t\tif @head == nil\n\t\t\t@head = Node.new(nodo,nil,nil)\n\t\t\t@tail = @head\n\t\telse\n\t\t\taux = @head\n\t\t\t@head = Node.new(nodo, aux, nil)\n\t\t\taux.prev = @head\n\t\tend\n\tend",
"def prepend(newEntry)\n if @head.nil?\n @head = newEntry\n @tail = newEntry \n else\n newEntry.next = @head \n @head = newEntry\n end \n end",
"def append(x)\n elem = ListElement.new(x)\n self.next = elem\n end",
"def add_at_head(val)\n @list.unshift(val)\n end",
"def prepend(value)\n new_node = create_node(value)\n new_node.next_node = head\n self.head = new_node\n self.size += 1\n end",
"def add(user) \n # when linked list is empty\n if @head.nil?\n # create a new node and set it to the head\n @head = Node.new(user)\n return \n end\n\n # check if age is less than the head user age of the linked list\n if @head.value.age > user.age\n # if so then do the following:\n # - store original head reference in originalHead\n # - create a new node\n # - set the new node's next reference to the original head reference\n # - set the head of the list to this new node\n # - return from the method\n\n # we are inserting this user to the beginning of the list\n originalHead = @head\n newNode = Node.new(user)\n newNode.next = originalHead\n @head = newNode\n return\n end\n\n # all other circumstances follow from here\n\n # we store the head initially as currentNode\n # and the next node as nextNode\n currentNode = @head\n nextNode = @head.next\n\n # start looping until nextNode is nil\n # under the circumstance where the linked list is of size 1,\n # the if statement here will skip looping and jump to the bottom\n # where we assume this user will be inserted into the end of the list\n while nextNode\n # check if user's age is less than the age of the nextNode's user age\n if nextNode.value.age > user.age\n # if so then do the following:\n # - create a new node\n # - set the currentNode next reference to this newly created node\n # - set the new node's next reference to the nextNode\n # - return from the method\n\n # in essence we are inserting this new user object in between\n # the currentNode and the nextNode\n currentNode.next = Node.new(user)\n currentNode.next.next = nextNode\n return\n end\n\n # set currentNode to nextNode\n currentNode = nextNode\n\n # set currentNode to the next node in the linked list\n nextNode = nextNode.next\n end\n\n # at this point we've looped to the end of the list\n # therefore we can assume the node belongs at the end of list\n currentNode.next = Node.new(user)\n end",
"def add(val)\n # debugger\n current = @head\n while current.next != nil\n current = current.next\n end\n current.next = Node.new(val, nil)\n \n # current.next.value\n self\n end",
"def insert_node_between(a, b, new_one)\n a.next = new_one\n new_one.prev = a\n new_one.next = b\n b.prev = new_one\n @length += 1\n end",
"def add_children(anEnumerable, theBacklog)\n anEnumerable.reverse_each do |elem|\n theBacklog.unshift(elem)\n end\n end",
"def add_to_tail(node)\n @head ||= node\n\n @tail.next = node if @tail\n @tail = node\n end",
"def prepend(value)\n new_node = Node.new(value)\n new_node.next = @node\n @node = new_node\n end"
] | [
"0.6259902",
"0.62184787",
"0.6046957",
"0.6009113",
"0.6009113",
"0.6009113",
"0.5971723",
"0.59058404",
"0.5894818",
"0.58859855",
"0.58841693",
"0.5860966",
"0.58264726",
"0.58177996",
"0.5787734",
"0.5783298",
"0.578321",
"0.578321",
"0.57747746",
"0.57646984",
"0.57616234",
"0.57538617",
"0.5749289",
"0.5735759",
"0.57343554",
"0.57278186",
"0.57278186",
"0.57268465",
"0.57099205",
"0.5667795",
"0.5658547",
"0.5657433",
"0.56568116",
"0.5642402",
"0.5619597",
"0.5611576",
"0.5610679",
"0.56001514",
"0.56001514",
"0.56001514",
"0.5592123",
"0.5588064",
"0.55696285",
"0.5561978",
"0.55496997",
"0.55376977",
"0.55311763",
"0.5525729",
"0.5521605",
"0.55119675",
"0.5491866",
"0.54706967",
"0.5440843",
"0.54325634",
"0.54268944",
"0.54249287",
"0.54112047",
"0.5401833",
"0.54010797",
"0.5400237",
"0.5397913",
"0.539091",
"0.5390415",
"0.5383742",
"0.5383742",
"0.53835356",
"0.53823304",
"0.5376884",
"0.537217",
"0.53714764",
"0.53671753",
"0.53652227",
"0.53626907",
"0.53580046",
"0.534522",
"0.5340283",
"0.5332806",
"0.53314865",
"0.5326722",
"0.5316618",
"0.531211",
"0.53072375",
"0.5305048",
"0.52990127",
"0.5296894",
"0.52890795",
"0.52854806",
"0.5283425",
"0.5278393",
"0.5271718",
"0.5270014",
"0.5265227",
"0.52605206",
"0.5256566",
"0.52551484",
"0.52486104",
"0.5246359",
"0.52461445",
"0.52455175",
"0.52449065",
"0.5239657"
] | 0.0 | -1 |
Removes the last node. Returns: last node data if successful, nil if list is empty. | def pop
return nil unless @head && @tail
old_head = @tail.head
old_data = @tail.data
@tail = @tail.head
@tail.tail = nil if @tail
@size -= 1
old_data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_last\n raise 'Cannot remove element from an empty list.' if empty?\n\n # Extract the data off of the tail node\n # Move the tail to the previous node\n data = @tail.data\n @tail = @tail.prev_node\n @size -= 1\n\n # removes the same element from @head, if it was final element/node\n if empty?\n @head = nil\n else\n # send to garbage collector\n @tail.next_node = nil\n end\n\n return data\n end",
"def remove_last\n raise 'Cannot remove element from an empty list.' if empty?\n\n # Extract the data off of the tail node\n # Move the tail to the previous node\n data = @tail.data\n \n if size < 2\n return remove_first\n else\n each_cons(2) do |node, next_node|\n if next_node.next_node == nil\n @tail = node\n @tail.next_node = nil\n break\n end\n end\n end\n\n @size -= 1\n\n return data\n end",
"def remove_last\n return nil if empty?\n node = @sentinel.prev\n e = node.data\n node.prev.next = @sentinel\n @sentinel.prev = node.prev\n e\n end",
"def remove_last\n return nil if empty?\n node = @sentinel.prev\n e = node.data\n node.prev.next = @sentinel\n @sentinel.prev = node.prev\n e\n end",
"def remove_last\n # if the head is nil, then we just return nil\n return nil if head.nil?\n # if it's only one node, thet remove_last is equal to pop\n return pop if head.next_node.nil?\n\n # we keep searching for the next node until\n # current.next_node is nil\n prev = @head\n current = @head\n\n while !current.next_node.nil?\n prev = current\n current = current.next_node\n end\n # since current.next_node is nil, we just\n # disconnect it and update the tail reference\n prev.next_node = nil\n @tail = prev\n return current.value\n end",
"def pop\n node = remove_node(head)\n return nil unless node\n self.size -= 1\n node.data\n end",
"def ll_pop()\n current = @head\n \n if @num_nodes == 0\n return nil\n elsif @num_nodes == 1\n @head = nil\n @tail = nil\n else\n second = @head.get_Next()\n @head = second\n end\n \n @num_nodes -= 1\n return current.get_Data()\n end",
"def pop\n return if list == nil\n\n lastElem = nil\n if list.nextNode == nil\n lastElem = list\n @list = nil\n else\n node = @list\n while (node != nil)\n if (node.nextNode != nil && node.nextNode.nextNode == nil)\n lastElem = node.nextNode\n node.nextNode = nil\n break\n end\n node = node.nextNode\n end\n end\n lastElem\n end",
"def remove_last\n raise 'No such element' if @size == 0\n elt = @tail.value\n if @size == 1\n @head = nil\n @tail = nil\n else\n @tail = @tail.previous\n @tail.next.previous = nil\n @tail.next = nil\n end\n @size -= 1\n return elt\n end",
"def pop() #delete last element in the LL\n return nil if @head == nil #if list is empty return nil\n return @head = nil if self.list_size == 1 #list has 1 element(head) assign head to nil\n temp_node = @head #if list has more then 1 element, travres till last element\n #stop conditon is when second element from current link to nil, means that first\n #from current is last element in the list\n until temp_node.link.link == nil \n temp_node = temp_node.link\n end\n temp_node.link = nil #cat the link with last element by assigning previous link to nil\n end",
"def pop\n if @head.nil?\n 'List is empty'\n else\n current_node = @head\n current_node = current_node.next_node until current_node.next_node.next_node.nil?\n last_node = current_node.next_node\n current_node.next_node = nil\n end\n last_node\n end",
"def get_last\n return nil if @head.nil?\n return last_node.data\n end",
"def remove node\n # if the node is at beginning or end of list\n # handle this separately\n return remove_first if node.prev_node == nil\n return remove_last if node.next_node == nil\n\n # tell adjacent nodes to 'skip' over this node\n node.next_node.prev_node = node.prev_node\n node.prev_node.next_node = node.next_node\n\n # store the data, so we can return it\n data = node.data\n\n # send to garbage collector\n node.data = nil\n node = node.prev_node = node.next_node = nil\n\n @size -= 1\n\n return data\n end",
"def remove_last_child\n @elements.pop\n end",
"def remove_first\n raise 'Cannot remove element from an empty list.' if empty?\n\n # Extract the data off of the head node\n # Move the head to the next node\n data = @head.data\n @head = @head.next_node\n @size -= 1\n\n # removes the same element from @tail, if it was final element/node\n if empty?\n @tail = nil\n end\n\n return data\n end",
"def get_last\n return nil if @head == nil\n\n current_node = @head\n\n while current_node.next != nil\n current_node = current_node.next\n end\n\n return current_node.data\n end",
"def pop\n last_node = self.tail\n self.at(self.size - 2).next_node = nil\n return last_node\n end",
"def pop\n node = @head\n if node.data == nil\n remove = \"\"\n else\n node = node.next_node until node.next_node.next_node.nil?\n remove = node.next_node.data\n node.next_node = nil\n end\n remove\n end",
"def get_last\n # return nil unless @head\n if @head == nil\n return nil\n end\n current = @head\n while !current.next.nil?\n current = current.next\n end\n \n return current.data\n end",
"def remove_first\n raise 'Cannot remove element from an empty list.' if empty?\n\n # Extract the data off of the head node\n # Move the head to the next node\n data = @head.data\n @head = @head.next_node\n @size -= 1\n\n # removes the same element from @tail, if it was final element/node\n if empty?\n @tail = nil\n else\n # send to garbage collector\n @head.prev_node = nil\n end\n\n return data\n end",
"def get_last\n return nil if @head.nil?\n current = @head\n until current.next.nil?\n current = current.next\n end\n return current.data\n end",
"def get_last\n return nil if @head.nil?\n\n current = @head\n\n until current.next.nil?\n current = current.next\n end\n\n return current.data\n end",
"def get_last\n node = head\n until node.next.nil?\n node = node.next\n end\n return node.data\n end",
"def get_last\r\n # return nil if the linked list is empty\r\n if @head.nil?\r\n return nil\r\n end\r\n \r\n # otherwise, go to end of list ...\r\n current = @head\r\n until current.next.nil?\r\n # ... until 'current' is the last node ...\r\n current = current.next\r\n end\r\n \r\n # ... and return data from last node\r\n return current.data\r\n \r\n end",
"def pop\n return nil if @head.nil?\n if self.size > 1\n @tail = self.at(self.size-1) \n @tail.next = nil\n else # only 1 node\n @tail = @head = nil\n end\t\n end",
"def get_last\n # return nil unless @head\n if @head == nil\n return nil\n end\n current = @head\n while current.next != nil \n current = current.next\n end\n return current.data\n end",
"def pop\n node = self.double_link_linked_list.delete_tail\n node ? node.value : nil\n end",
"def pop\n\t\tlocation = @head.next_node\n\t\twhile location.next_node.next_node != nil\n\t\t\tlocation = location.next_node\n\t\tend\n\t\tlast = location.next_node\n\t\tlocation.next_node = nil\n\t\treturn last\n\t\tlocation = @head\n\tend",
"def pop\n last = find_tail.data\n node = find_before(last)\n node.next = nil\n end",
"def get_last\n return if @head == nil\n\n current = @head\n\n until current.next.nil?\n current = current.next\n end\n\n return current.data\n end",
"def get_last\n return nil unless @head\n current = @head\n\n while current.next\n current = current.next\n end\n\n return current.data\n end",
"def get_last\n return @head if @head.nil?\n current_node = @head\n\n until current_node.next.nil?\n current_node = current_node.next\n end\n return current_node.data\n end",
"def get_last\n return nil if !@head\n current = @head\n while current.next\n current = current.next\n end\n return current.data\n end",
"def last\n list = self\n list = list.tail until list.tail.empty?\n list.head\n end",
"def remove()\n return nil if self.empty?\n\n # swap root node and last leaf node (swap head and rear of internal array) and pop it\n last_index = @store.length - 1\n swap(0, last_index)\n removed = @store.pop\n\n # ensure heap property via calling heap_down\n heap_down(0)\n return removed.value\n end",
"def remove_tail\n if self.head == nil # does nothing to an empty list\n return nil\n end\n \n delete (self.tail) # otherwise, deletes the tail\n end",
"def last\n \tbegin\n \t raise ArgumentError, \"Empty LinkedList\" if @size <= 0\n \t return @last.prev.data\n \t rescue\n \t puts \"Empty\" \t\t \n\t\t end\n \tend",
"def pop\n if data\n element = data\n @data = data.next_node\n return element.value\n else\n return nil\n end\n end",
"def pop\n return nil if @head.nil? || self.size == 0\n current_node = @head\n prev_node = nil\n (self.size - 1).times do\n prev_node = current_node\n current_node = current_node.next\n end\n current_node = nil\n @tail = prev_node\n end",
"def last\n node = @head;\n return node if node.next.nil?\n until (node.next.nil?) #until end of list\n node = node.next\n return node if node.next.nil?\n end\n end",
"def get_last\n return nil if @head.nil? \n pointer = @head \n while !pointer.next.nil?\n pointer = pointer.next\n end\n return pointer.data\n end",
"def pop\n tmp = @data.value rescue nil\n @data = @data.next_node unless @data.nil?\n return tmp\n end",
"def get_last\r\n return unless @head\r\n \r\n last = @head\r\n last = last.next until last.next.nil?\r\n last.data\r\n end",
"def get_last\r\n return nil if !@head\r\n\r\n prev = nil\r\n curr = @head \r\n\r\n while curr \r\n if curr.next \r\n prev = curr\r\n curr = curr.next \r\n else \r\n return curr.data\r\n end\r\n end\r\n\r\n end",
"def last_node\n return nil if @head.nil?\n current = @head\n while current.next != nil\n current = current.next\n end\n return current\n end",
"def last\n self.each {|node| return node if node.next_node == nil}\n end",
"def pop\n node = last\n last = node.prv\n last.nxt = nil\n node.prv = nil\n node\n end",
"def get_last\n if length == 0\n return nil?\n elsif length == 1\n return @head.data\n else\n current = @head\n (length - 1).times do\n current = current.next\n end\n return current.data\n end\n end",
"def get_last\n current = head\n if head.nil?\n last_node = head\n else\n while !current.nil?\n last_node = current\n current = current.next\n end\n end\n return last_node.data\n end",
"def get_last\n return nil if @head.nil? \n pointer = @head\n\n until pointer.next.nil?\n pointer = pointer.next\n end\n return pointer.data\n end",
"def pop\r\n return nil if self.data == nil\r\n value = self.data.value\r\n @data = self.data.next_node\r\n return value\r\n end",
"def get_last\n return @tail ? @tail.data : nil\n end",
"def pop\n current = @head\n\n # loop to second to last element of list\n until current.next_node == tail\n current = current.next_node\n end\n\n # update tail\n @tail = current\n\n # set next_node to nil\n current.next_node = nil\n end",
"def pop\n\t\tif (!@head) then return nil end\n\t\ttemp = @head\n\t\t@head = @head.get_next()\n\t\tif (@head) then @head.set_prev(nil)\n\t\telse @tail = nil\n\t\tend\n\t\t@size -= 1\n\t\treturn temp.get_item()\n\tend",
"def remove\n node = @head\n\n if node\n @head = node.next_node\n @tail = nil unless @head\n\n node.data\n end\n end",
"def remove_tail\n if self.head.nil? || self.head.next.nil?\n self.tail = nil\n else\n last_node = self.head\n prev_to_last = nil\n\n until last_node.next.nil?\n prev_to_last = last_node\n last_node = last_node.next\n end\n\n prev_to_last.next = nil\n self.tail = prev_to_last\n return prev_to_last\n end\n end",
"def pop\n\t\tcurrent_node = @head \n\t\tif current_node.next_node == nil \n\t\t\t@head = nil \n\t\tend \n\t\tuntil current_node.next_node.next_node == nil \n\t\t\tcurrent_node = current_node.next_node\n\t\tend \n\t\tcurrent_node.next_node = nil \n\tend",
"def pop\n return nil if head.nil?\n\n curr = head\n if curr.next.nil?\n @head = nil\n return curr\n end\n curr = curr.next until curr.next.next.nil?\n last = curr.next\n curr.next = nil\n last.value\n end",
"def pop()\n \n return nil if @head.nil?\n \n result = @head\n \n @head.next_node.nil? ? @head = nil : @head = @head.next_node \n \n result.val\n end",
"def pop\n current_node = @head\n prev_node = nil\n while current_node.next_node\n prev_node = current_node\n current_node = current_node.next_node\n end\n @tail = prev_node\n @tail.next_node = nil unless tail.nil?\n @size -= 1\n current_node.value\n end",
"def pop\n if @length == 0\n return nil\n elsif @length == 1\n node = @head\n @head = nil\n @tail = nil\n @length -= 1\n return node.value\n else\n node = @tail\n @tail = node.previous\n @length -= 1\n return node.value\n end\n end",
"def getLastNode #not counting the sentinel node\n\tunless (@size == 0)\n\t\treturn @last.prev\n\telse\n\t\treturn nil\n\tend\nend",
"def tail\n node = list\n while (node != nil)\n if node.nextNode == nil\n break\n end\n node = node.nextNode\n end\n node\n end",
"def pop\r\n removed_item = @data\r\n @data = @data.next_node\r\n removed_item.next_node = nil\r\n removed_item\r\n end",
"def pop\n\t\t\t\tif @length == 0\n\t\t\t\t\traise RuntimeError.new(\"Cannot pop from empty list.\")\n\t\t\t\telse\n\t\t\t\t\tif @tail.prev == nil\n\t\t\t\t\t\t# there is only one element\n\t\t\t\t\t\t@head = nil\n\t\t\t\t\t\t@tail = nil\n\t\t\t\t\telse\n\t\t\t\t\t\t@tail.prev.next = nil\n\t\t\t\t\t\t@tail = @tail.prev\n\t\t\t\t\tend\n\t\t\t\t\t@length -= 1\n\t\t\t\tend\n\t\t\tend",
"def pop\r\n # I RETURN A VALUE\r\n data1 = @data\r\n data1.next_node.previous = nil\r\n @data = data1.next_node\r\n return data1\r\n end",
"def pop\n return nil unless @tail\n value = @tail[:data].pop\n @tail = @tail[:forward] while @tail and @tail[:data].size == 0\n @set.delete(value)\n value\n end",
"def pop_last\n @driver_instance.pop_list_last(@key)\n end",
"def pop\r\n return nil if @head == nil\r\n res = @head\r\n @head = @head.next_node\r\n return res.value\r\n end",
"def add_last(data)\n if @head.nil?\n @head = Node.new(data)\n return @head.data\n else\n current = self.last_node\n current.next = Node.new(data)\n return current.next.data\n end\n end",
"def remove_at_tail\n\t\t\treturn nil if self.empty?\n\t\t\telement = self.head\n\t\t\tprevious_element = @head\n\n\t\t\tuntil element.next.nil?\n\t\t\t\tprevious_element = element\n\t\t\t\telement = element.next\n\t\t\tend\n\n\t\t\tprevious_element.next = nil\n\t\t\telement\n\t\tend",
"def get_last\r\n return nil unless @head\r\n cursor = @head\r\n while cursor.next\r\n cursor = cursor.next\r\n end\r\n return cursor.data\r\n end",
"def pop\n return nil unless @tail\n\n popped = @tail\n @tail = @tail.head # remove tail\n @size -= 1\n\n popped.data\n end",
"def pop\n return nil if @data.nil?\n return_value = @data.value\n @data = @data.next_node\n return_value# I RETURN A VALUE\n end",
"def pop\n if head == nil\n \"Nothing to remove\"\n else\n prev = nil\n cur = head\n while cur.next_node != nil\n prev = cur\n cur = cur.next_node\n end\n prev.next_node = nil\n end\n end",
"def pop()\n head = @head\n if head == nil then\n return nil\n end\n @head = head.prev\n return head.val\n end",
"def get_last\n return nil if @head.nil?\n return get_last_helper(@head)\n end",
"def remove\n unless self.empty?\n swap(0, @store.length - 1)\n removed_node = @store.pop\n\n heap_down(0)\n\n return removed_node.value\n end\n end",
"def pop\n if @tail != nil\n ret = @tail\n @tail = @tail.previous\n if @tail != nil\n @tail.next_node = nil\n end\n @length -= 1\n if @head == ret\n @head = nil\n end\n return ret.value\n elsif @head\n ret = @head\n @head = nil\n @length -= 1\n return ret.value\n else\n return nil\n end\n end",
"def pop\n if @tail != nil\n ret = @tail\n @tail = @tail.previous\n if @tail != nil\n @tail.next_node = nil\n end\n @length -= 1\n if @head == ret\n @head = nil\n end\n return ret.value\n elsif @head\n ret = @head\n @head = nil\n @length -= 1\n return ret.value\n else\n return nil\n end\n end",
"def dequeue\n return nil if @head.nil?\n\n # Remove the head element and return the value.\n @count -= 1\n old_node = @head\n @head = @head.next\n old_node.next = nil\n\n # We can also nullify the tail if the head is nil now.\n @tail = nil if @head.nil?\n\n old_node.value\n end",
"def pop\n return nil unless self.length > 0\n \n self.head = self.head.next\n self.tail = nil if self.length == 1\n self.length -= 1\n end",
"def pop_back\n return nil if @size.zero?\n\n if @size == 1\n temp = @head.data\n @head = @tail = nil\n else\n temp = @tail.data\n @tail.prev.next = nil\n @tail = @tail.prev\n end\n @size -= 1\n temp\n end",
"def last\n node = @head\n while node.next\n node = node.next\n end\n node\n end",
"def last\n node = @head\n while node.next\n node = node.next\n end\n node\n end",
"def pop\n current_node = @head\n if current_node.next_node.nil?\n @head.nil?\n else\n while current_node.next_node\n previous = current_node\n current_node = current_node.next_node\n end\n previous.next_node = nil\n end\n end",
"def pop\n old = @tail\n if @tail == nil\n return nil\n else\n prev = @tail\n @tail = @tail.prev_value\n @length -= 1\n return prev.value\n end\n end",
"def pop\n @data.delete_at @data.length - 1 if @data.length > 0\n end",
"def delete_tail\r\n delete_node @tail\r\n end",
"def remove node\n # if the node is at beginning or end of list\n # handle this separately\n return remove_first if node == @head\n return remove_last if node == @tail\n\n # store the data, so we can return it\n data = node.data\n\n # iterate through nodes, two at a time\n each_cons(2) do |search_node, next_node|\n # if our second item in a pair is the node we are looking for\n if next_node == node\n # then make the previous node's (i.e the search_node) next node equal to the FOLLOWING\n search_node.next_node = next_node.next_node\n next_node = nil\n break\n end\n end\n\n @size -= 1\n\n return data\n end",
"def pop\n value = @head.value\n @head = @head.next_node\n if isEmpty?\n @tail = nil\n end\n value\n end",
"def pop\n curr = items\n ret = curr.pop\n\n serialize(curr)\n\n ret.nil? ? nil : ret\n end",
"def pop\n if(self.size == 0)\n return false\n end\n popped_node = self.first\n new_first = popped_node.next\n if(!new_first)\n self.last = new_first\n end\n popped_node.next = nil\n self.first = new_first\n self.size -= 1\n\n #pretty_print_node(popped_node)\n return popped_node\n end",
"def pop\n node_count = self.size\n\n @tail = self.at(node_count-2) #-2 because of how size works\n @tail.next_node = nil\n end",
"def pop\n # I RETURN A VALUE\n if @data != nil\n value = @data.value\n @data = @data.next_node\n return value\n end\n end",
"def remove\n # Can you delete any other node besides the root?\n return nil if @store.empty?\n\n swap(0, @store.length - 1)\n target = @store.pop\n\n heap_down(0)\n return target.value\n end",
"def pop\n head\n tempNode = ''\n until @current_node.next == nil do\n tempNode = @current_node\n self.next_node\n end\n tempNode.next = nil\n @tail = tempNode\n end",
"def pop\n current_node = @head\n until current_node.next_node.nil?\n previous_node = current_node\n current_node = current_node.next_node\n end\n previous_node.next_node = nil\n @tail = previous_node\n current_node \n end",
"def pop\n node_value = @data.value\n\n @data = @data.next_node\n\n return node_value\n end",
"def pop\n return nil if @head.nil?\n\n to_remove = @head\n @head = @head.next\n to_remove.next = nil\n @count -= 1\n\n to_remove.value\n end"
] | [
"0.8167208",
"0.7734307",
"0.739937",
"0.739937",
"0.7346911",
"0.7330842",
"0.73251325",
"0.71692276",
"0.7151837",
"0.7147149",
"0.70847285",
"0.69072646",
"0.6769227",
"0.67589366",
"0.6745421",
"0.67409384",
"0.67336637",
"0.67242146",
"0.6721628",
"0.67189157",
"0.6712796",
"0.6707478",
"0.6690616",
"0.66895217",
"0.6688184",
"0.66876453",
"0.66790617",
"0.6655916",
"0.66442865",
"0.6619342",
"0.660803",
"0.660289",
"0.65958214",
"0.65654635",
"0.65542996",
"0.6551099",
"0.6534031",
"0.65196335",
"0.651336",
"0.65034926",
"0.6503407",
"0.64624447",
"0.6457916",
"0.64556515",
"0.64504105",
"0.64485323",
"0.644355",
"0.64413553",
"0.64367384",
"0.64302915",
"0.64184374",
"0.64182985",
"0.6404839",
"0.63969886",
"0.6394919",
"0.6376704",
"0.63731205",
"0.6342335",
"0.6340166",
"0.63129807",
"0.6306152",
"0.6286072",
"0.6282053",
"0.62794566",
"0.6278177",
"0.62728274",
"0.6266592",
"0.6265817",
"0.6263965",
"0.6258042",
"0.62424445",
"0.6238215",
"0.6237495",
"0.6234308",
"0.62069356",
"0.61984",
"0.61974573",
"0.6195014",
"0.6188129",
"0.6188129",
"0.61653817",
"0.6164996",
"0.6159771",
"0.61590046",
"0.61590046",
"0.6140167",
"0.61390996",
"0.61284834",
"0.6121141",
"0.61165667",
"0.61138374",
"0.6113226",
"0.6111014",
"0.61091286",
"0.6108161",
"0.61057854",
"0.60970116",
"0.60946804",
"0.6083212",
"0.6065271"
] | 0.649149 | 41 |
Private: Used by insert to replace old node with new node. | def insert_at!(data, position)
node, head, tail = set_insert_vars(data, position)
# before: head -> position -> tail
# after: head -> node -> tail
head.tail = node if head
node.tail = tail
tail.head = node if tail
node.head = head
# set @tail for list or it will use old tail
if position.tail?
@tail = node
end
# orphan the old node
position.head = nil
position.tail = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_node!(node)\n @store.remove(node.key)\n @store.append(node.key, node.val)\n end",
"def replace_head(node)\n self.head = node\n end",
"def update(node); end",
"def insertAfter(node, new_node)\n end",
"def update_children(node, new_node)\n\t\tleft \t= node.left\n\t\tright = node.right\n\t\tleft.parent = new_node unless left.nil? \n\t\tright.parent = new_node unless right.nil?\n\tend",
"def update_node!(node)\n hash = {lft: node.left, rgt: node.right, parent_id: node.parent, depth: node.depth, restricted: node.restricted}\n\n if urlname != node.url\n LegacyPageUrl.create(page_id: id, urlname: urlname)\n hash[:urlname] = node.url\n end\n\n update_columns(hash)\n end",
"def replace(new_node)\n if new_node.is_a?(Document)\n raise ArgumentError, <<-EOERR\nNode.replace requires a Node argument, and cannot accept a Document.\n(You probably want to select a node from the Document with at() or search(), or create a new Node via Node.new().)\n EOERR\n end\n replace_with_node new_node\n end",
"def insert_node(new_node_val)\n new_node = Node.new(new_node_val)\n @nodes << new_node\n @_node_map[new_node_val] = new_node\n new_node\n end",
"def replace_with(node) \n raise \"Cannot replace a node with itself!\" if node == self\n @in.each do |i|\n i.out.map! { |n| n == self ? node : n } if i != node\n end\n @graph.start = node if @graph.start == self\n @graph.remove(self) if not node.forward.include? self\n end",
"def swap(node_or_tags); end",
"def swap(node_or_tags); end",
"def replace(node_or_tags); end",
"def replace(node_or_tags); end",
"def replace_child src_parent, src_idx, new_child\n old = src_parent.children[src_idx]\n no('no') unless old\n old.parent_clear!\n new_child.parent_id = src_parent.parse_id\n src_parent.children[src_idx] = new_child\n old\n end",
"def swap_node_position(higher_node, lower_node)\n temp_element_title = higher_node.title\n temp_element_rating = higher_node.rating\n higher_node.title = lower_node.title\n higher_node.rating = lower_node.rating\n lower_node.title = temp_element_title\n lower_node.rating = temp_element_rating\n lower_node\n end",
"def replace_with(child); end",
"def replace_data(node, data)\n node.data\n ensure\n node.data = data\n end",
"def replace(replacement)\n @parent.replace_node(self, replacement)\n end",
"def from_node(original_node); end",
"def insert(root, new_node)\n new_node.id = @count + 1\n current = find_parent(root, new_node)\n\n current.left.nil? ? current.left = new_node : current.right = new_node\n new_node.parent = current\n\n heapify(new_node)\n @count += 1\n end",
"def node=(node)\n retract[:node] = node\n end",
"def insert_after prev_node, new_data\n # 1. check if the given prev_node exists\n if prev_node == nil\n puts \"the given previous node cannot be NULL\"\n end\n # 2. Create new node\n # 3. Put in the data\n new_node = Node.new(new_data)\n # 4. Make next of new Node as next of prev_node\n new_node.next_node = prev_node.next_node\n # 5. make next of prev_node as new_node\n prev_node.next_node = new_node\n # 6. Make prev_node ass previous of new_node\n new_node.prev_node = prev_node\n # 7. Change previous of new_nodes's next node\n if new_node.next_node != nil\n new_node.next_node.prev_node = new_node\n end\n end",
"def replace(idx, node)\n if idx.zero?\n remove_first\n add_first(node)\n return node\n end\n\n iterate do |curr_node, count|\n if count == idx - 1\n node.next_node = curr_node.next_node.next_node\n curr_node.next_node = node\n node.prev_node = curr_node\n\n unless curr_node.next_node.next_node.nil?\n curr_node.next_node.next_node.prev_node = node\n end\n\n return node\n end\n end\n end",
"def insert(new_value)\n if new_value > @value\n @right ? @right.insert(new_value) : (@right = Node.new(new_value))\n else\n @left ? @left.insert(new_value) : (@left = Node.new(new_value))\n end\n end",
"def swap(node_or_tags)\n replace node_or_tags\n self\n end",
"def mutate(new_node, remove: false)\n root_node.mark_as_dirty\n\n parent_object = parent.object\n new_arel_node = new_node.is_a?(Arel::Enhance::Node) ? new_node.object : new_node\n new_arel_node = [] if remove && object.is_a?(Array)\n\n if parent_object.respond_to?(\"#{local_path.value}=\")\n parent_object.send(\"#{local_path.value}=\", new_arel_node)\n\n elsif parent_object.instance_values.key?(local_path.value)\n parent_object.instance_variable_set(\"@#{local_path.value}\", new_arel_node)\n\n elsif local_path.arguments? && parent_object.respond_to?(local_path.method[0])\n if remove\n parent_object.delete_at(local_path.value)\n\n else\n parent_object[local_path.value] = new_arel_node\n end\n elsif parent_object.is_a?(Arel::Nodes::TableAlias) && local_path.value == 'relation'\n parent_object.instance_variable_set('@left', new_arel_node)\n else\n raise \"Don't know how to replace `#{local_path.value}` in #{parent_object.inspect}\"\n end\n\n if new_node.is_a?(Arel::Enhance::Node)\n parent.add(local_path, new_node)\n parent[local_path.value]\n else\n new_parent_tree = Visitor.new.accept_with_root(parent_object, parent)\n parent.parent.add(parent.local_path, new_parent_tree)\n new_parent_tree[local_path.value]\n end\n end",
"def update_nodes\n incr = 0\n self.original_nodes.build(:displayed => true) if not new_record? and self.original_nodes.count == 0 # Insure at least 1 node\n self.original_nodes.each do |node|\n node.title = self.name\n node.menu_name = self.name\n incr = (node.new_record? ? node.set_safe_shortcut(self.name.parameterize.html_safe, 0, incr) : node.set_safe_shortcut(self.name.parameterize.html_safe, node.id, incr))\n node.displayed = self.display\n incr += 1\n end\n end",
"def delete_node_improved(node)\n node.val = node.next.val\n node.next = node.next.next\nend",
"def insert(node, &block); end",
"def insert(node, &block); end",
"def insert(node)\n @prv.nxt = node.first if @prv\n node.first.prv = @prv\n node.last.nxt = self\n node\n end",
"def push_before(node, new_node)\n new_node.previous_node = node.previous_node\n new_node.next_node = node\n node.previous_node.next_node = new_node\n node.previous_node = new_node\n end",
"def node=(_); end",
"def node=(_); end",
"def replace(tree_,value)\n if value==-1\n Node2.new(@val,tree_,@right)\n else\n Node2.new(@val,@left,tree_)\n end\n end",
"def push_after(node, new_node)\n new_node.previous_node = node\n new_node.next_node = node.next_node\n node.next_node = new_node\n end",
"def replace_child! child, nu\n idx = index_of_child child\n self[idx] = nu\n # debugger; 'make sure to_ruby works'\n nil\n end",
"def update_tree(element); end",
"def insert(node)\n\t\t#this is how you link the nodes together\n\t\t@tail.pointer = node\n\t\t#the tail is now equal to the last node that was entered into the linked list\n\t\t@tail = @tail.pointer\n\tend",
"def replace(node)\n `#@native.parentNode.replaceChild(#@native, #{Native.try_convert(node)})`\n\n node\n end",
"def insert( new_key )\n if new_key <= @key\n @left.nil? ? @left = Node.new( new_key ) : @left.insert( new_key )\n elsif new_key > @key\n @right.nil? ? @right = Node.new( new_key ) : @right.insert( new_key )\n end\n end",
"def prepend(val)\n\t\t# create a new node\n\t\tnew_node = Node.new(val, @head)\n\t\t# update head\n\t\t@head = new_node\n\tend",
"def node=(node)\n purge_node[:node] = node\n end",
"def update_parent(node, num, new_node)\n\t\tparent = node.parent\n\t\tunless parent.nil?\n\t\t\tif parent.key > num\n\t\t\t\tparent.left = new_node\n\t\t\telse\n\t\t\t\tparent.right = new_node\n\t\t\tend\n\t\tend\n\tend",
"def moved_node\n current_tree.find(node_2.id)\n end",
"def delete_node(node)\n ## just copy the information of the next node and then cut it out\n node.id = node.next.id\n node.next = node.next.next\nend",
"def insert (node, splice_position)\n _insert(node, splice_position)\n\n delete_old_nodes\n\n node\n end",
"def move_node_to_head(node) \n removed = remove_node(node)\n\n add_head(removed)\n end",
"def add_node(node); end",
"def deleteNode node\n node.val = node.next.val\n node.next = node.next.next\nend",
"def replace_element_by_own_content(element)\n if element.has_children_elements?\n element.get_children_elements.each do |child|\n element.insert_before(child)\n end\n element.remove_node\n elsif element.has_children?\n element.replace_node(element.get_first_node_child)\n end\n end",
"def insert(data)\n node = Node.new data\n\n if @head.nil?\n node.next_node = node\n else\n # the new node will have the same trailing node as old\n node.next_node = @head.next_node\n # the old head will become the tail\n @head.next_node = node\n end\n\n @head = node\n end",
"def put_in_place\n if place==:append\n item = self\n self.class.with_tree_scope(self) do\n root.append(item)\n end\n end\n end",
"def child_node=(_); end",
"def insert_at(data, index)\n\t\t@current_node = at(index)\n\t\t@insert_node = Node.new(data, @current_node)\n\n\t\t#Handeling the case that user inserts a node at head position (even though prepend exists for that)\n\t\tif @current_node != @head\n\t\t\t@old_link_node = at(index - 1)\n\t\t\t@old_link_node.next_node = @insert_node\n\t\telse\n\t\t\t@head = @insert_node\n\t\tend\n\tend",
"def replace_child(to_replace, replacement); end",
"def insert(node)\n @tail.next = node\n @tail = @tail.next\n end",
"def replace(oldthing, newthing)\n k,v=@hash_references.select {|k,v| v==oldthing}.flatten\n @hash_references[k]=newthing\n @fields.map! {|atom|\n if atom==oldthing\n newthing\n else\n if atom.is_a? Binstruct\n atom.replace(oldthing,newthing)\n end\n atom\n end\n }\n end",
"def insert_before(node)\n @prev_node = node.prev_node\n @next_node = node\n node.prev_node.next_node = self\n node.prev_node = self\n self\n end",
"def replaceValue(xml, nodeName, toReplaceWith)\n\n puts \"\\n\\n--_________-----------______________________\\n#{xml}\"\n if( xml[\"nodeName\"] == nodeName )\n xml[\"nodeValue\"] = toReplaceWith\n end\n\n attribs = xml[\"nodeAttributes\"]\n size = xml[\"childCount\"].to_i\n for j in 0..size\n\n values = xml[j]\n if values != nil\n if values[\"nodeName\"] == nodeName\n\n # if(values.get(\"0\") == null)\n # {\n \t # System.out.println(\"Adding val\");\n # Hashtable childMe = new Hashtable(); //Create a new Hashtable this represents the Node\n # childMe.put(\"nodeName\",\"#text\"); //This is the Node Name ie(<nodeName></nodeName>)\n # childMe.put(\"nodeValue\",toReplaceWith); //This is the Node Value ie(<nodeName>NodeValue</nodeName>)\n # childMe.put(\"nodeAttributes\",new Hashtable()); //These are the Node attributesie(<nodeName nodeAttribute=\"value\"></nodeName>)\n # childMe.put(\"childCount\",new Integer(\"\"+0)); //Amount of children Nodes\n #\n # this.addNodeAtPos(values, childMe,nodeName);\n # }\n # else\n # {\n \t # System.out.println(\"Replacing val\");\n # Hashtable hmValue = (Hashtable)values.get(\"0\");\n # hmValue.put(\"nodeValue\",toReplaceWith);\n # }\n values[\"nodeValue\"] = toReplaceWith\n\n else\n\n count = values[\"childCount\"].to_i\n puts \"Count is #{count}\"\n if count > 0\n for k in 0..count\n replaceValue(values[k],nodeName,toReplaceWith)\n end\n end\n end\n end\n end\n end",
"def insert(new_node)\n\n if self.root.nil?\n self.root = new_node\n self.size = 1\n return {root: new_node.value, size: self.size}\n end\n\n current = self.root\n\n until current.nil?\n if current.value == new_node.value\n return \"{value} already present in tree\"\n elsif current.value < new_node.value && current.right.nil?\n current.right = new_node\n new_node.parent = current\n self.size += 1\n elsif current.value > new_node.value && current.left.nil?\n current.left = new_node\n new_node.parent = current\n self.size += 1\n elsif current.value < new_node.value\n current = current.right\n elsif current.value > new_node.value\n current = current.left\n end\n end\n end",
"def add_node(new_node)\n @nodes[new_node] ||= Array.new #only adds if not in graph\n @node_dir_ancestors[new_node] ||= Array.new\n end",
"def node=(node)\n @node = node\n end",
"def prepend_child(node_or_tags); end",
"def prepend_child(node_or_tags); end",
"def prepend(val)\n new_node = Node.new(val, @head)\n @head = new_node\n end",
"def node_insert_after!(x, prev, level)\n netx = node_next(prev, level) # 'next' is a reserved word in ruby\n \n # forward links\n x[0][level] = netx\n prev[0][level] = x\n \n # backward links\n x[3][level] = prev\n netx[3][level] = x\n end",
"def set_attribute_node( new_attr )\n if new_attr.owner_document != self.owner_document then\n raise \"WRONG_DOCUMENT_ERR\"\n end\n if not new_attr.owner_element.nil? then\n raise \"INUSE_ATTRIBUTE_ERR\"\n end\n old_attr = nil\n @attr_nodes << new_attr\n new_attr._set_owner_element( self )\n old_attr\n end",
"def swap_parent_reference_to_node(parent, first_node, second_node)\n unless parent.nil?\n kids = parent.kids\n index = kids.index first_node\n kids[index] = second_node\n end\n end",
"def replace(node_or_tags)\n raise(\"Cannot replace a node with no parent\") unless parent\n\n # We cannot replace a text node directly, otherwise libxml will return\n # an internal error at parser.c:13031, I don't know exactly why\n # libxml is trying to find a parent node that is an element or document\n # so I can't tell if this is bug in libxml or not. issue #775.\n if text?\n replacee = Nokogiri::XML::Node.new \"dummy\", document\n add_previous_sibling_node replacee\n unlink\n return replacee.replace node_or_tags\n end\n\n node_or_tags = parent.coerce(node_or_tags)\n\n if node_or_tags.is_a?(XML::NodeSet)\n node_or_tags.each { |n| add_previous_sibling n }\n unlink\n else\n replace_node node_or_tags\n end\n node_or_tags\n end",
"def insert_at(index)\n at(index)\n temp = @current_node.next\n blankNode = Node.new('Inserted Node')\n @current_node.next = blankNode\n blankNode.next = temp\n end",
"def add_node(node)\n @nodes[node.uri] ||= node\n end",
"def move( branch, newdn )\n\t\tsource_rdn, source_parent_dn = branch.split_dn( 2 )\n\t\tnew_rdn, new_parent_dn = newdn.split( /\\s*,\\s*/, 2 )\n\n\t\tif new_parent_dn.nil?\n\t\t\tnew_parent_dn = source_parent_dn\n\t\t\tnewdn = [new_rdn, new_parent_dn].join(',')\n\t\tend\n\n\t\tif new_parent_dn != source_parent_dn\n\t\t\traise Treequel::Error,\n\t\t\t\t\"can't (yet) move an entry to a new parent\"\n\t\tend\n\n\t\tself.log.debug \"Modrdn (move): %p -> %p within %p\" % [ source_rdn, new_rdn, source_parent_dn ]\n\n\t\tself.conn.modrdn( branch.dn, new_rdn, true )\n\t\tbranch.dn = newdn\n\tend",
"def update_index(name, node); end",
"def update_nodes\n incr = 0\n self.nodes.build(:displayed => true) if not new_record? and self.nodes.count == 0 # Insure at least 1 node\n self.nodes.each do |node|\n node.title = name\n node.menu_name = name\n node.set_safe_shortcut(\"#{incr.to_s}-#{name}\")\n node.displayed = display\n incr += 1\n end\n end",
"def prepend(node)\n node.next = @head.next\n @head.next = node\n end",
"def add_to_tree(item, node)\n return rebalance(super(item, node))\n end",
"def replace( other )\n\t\t@data.replace( other )\n\tensure\n\t\t@modified = true\n\tend",
"def set_node(val)\n self.node = val\n self\n end",
"def set_node(val)\n self.node = val\n self\n end",
"def replace\n result = super\n delete_backup!(@old) if result && delete_backup?\n result\n end",
"def insert(node, position)\n node_before_position = index(position-1)\n node_at_position = index(position)\n node_before_position.next = node\n node.next = node_at_position\n @size += 1\n node\n # returns inserted node\n end",
"def add_or_find_duplicate(node)\n @nodes[node.path] ||= node\n @nodes[node.path]\n end",
"def nodes\n if self.original_nodes.count == 0 and not new_record?\n self.save # Triggers callback of update_node\n end\n self.original_nodes\n end",
"def insert_into_tree(root, new_value, index)\n if root.val == new_value\n return root\n elsif new_value < root.val\n if root.left\n insert_into_tree(root.left, new_value, index)\n else\n root.left = TreeNode.new(new_value, index )\n end\n else\n if root.right\n insert_into_tree(root.right, new_value, index)\n else\n root.right = TreeNode.new(new_value, index)\n end\n end\nend",
"def update(leaf_id, new_value)\n @nodes[@leaf_count + leaf_id] = new_value\n visit_path_to_root(leaf_id) do |node|\n next if leaf_node?(node)\n \n @nodes[node] = HashTree.node_hash node, @nodes[HashTree.left_child(node)],\n @nodes[HashTree.right_child(node)]\n end\n self\n end",
"def insert_edge(new_edge_val, node_from_val, node_to_val)\n nodes = { node_from_val => nil, node_to_val => nil }\n @nodes.each do |node|\n next unless nodes.include?(node.value)\n nodes[node.value] = node\n break if nodes.all? { |_node_val, node_obj| node_obj }\n end\n nodes.each do |node_val, _node_obj|\n nodes[node_val] = nodes[node_val] || insert_node(node_val)\n end\n node_from = nodes[node_from_val]\n node_to = nodes[node_to_val]\n new_edge = Edge.new(new_edge_val, node_from, node_to)\n node_from.edges << new_edge\n node_to.edges << new_edge\n @edges << new_edge\n new_edge\n end",
"def insert_into_merged_list_and_shift_left(bst_node, head)\n puts \"appending #{bst_node.value} to \" + (head.nil? ? \"nil\" : \"#{head.value}\") if $debug\n bst_node.right = head\n head = bst_node\n bst_node = bst_node.left\nend",
"def delete\n @prev_node.next_node = @next_node\n @next_node.prev_node = @prev_node\n @prev_node = @next_node = nil\n @value\n end",
"def push(node)\n node.parent = self if node.respond_to? :parent\n super(node)\n end",
"def insert(data)\n @head = Node.new(data, @head)\n end",
"def delete_node(current_node)\n\nend",
"def insert_before(node, obj)\n obj = obj.value if obj.is_a?(Node)\n node = Node.new(obj)\n\n if @head == node\n @head = new_node\n new_node.next = node\n else\n previous = node.previous\n previous.next = new_node\n new_node.previous = previous\n new_node.next = node\n end\n self\n end",
"def push new_data\n # 1 & 2: Allocate the Node & Put in the data\n new_node = Node.new(new_data)\n # 3. Make next of new Node as head\n new_node.next_node = @head\n # 4. change prev of head node to new_node\n if @head != nil\n @head.prev_node = new_node\n end\n # 5. move the head to point to the new node\n @head = new_node\n end",
"def prepend(value)\n new_node = Node.new(value)\n new_node.next = @node\n @node = new_node\n end",
"def clean(node)\n update node, false, true, nil\n end",
"def insert new_value\n if new_value <= @value\n @left.nil? ? @left = Node.new(new_value) : @left.insert(new_value)\n elsif new_value > @value\n @right.nil? ? @right = Node.new(new_value) : @right.insert(new_value)\n end\n end",
"def insert_at(node, index)\n target = self.at(index)\n target_prev = target.prev\n set_next_and_prev(target_prev, node)\n set_next_and_prev(node, target)\n self.size += 1\n end",
"def become_root(new_root, old_root)\n raise NotImplementedError\n end",
"def add_to_tree(curr_node, new_node, queue = [])\n if curr_node.nil?\n curr_node = new_node\n elsif curr_node.left_node.nil?\n curr_node.left_node = new_node\n elsif curr_node.right_node.nil?\n curr_node.right_node = new_node\n else\n queue.push(curr_node.left_node)\n queue.push(curr_node.right_node)\n next_node = queue.shift\n next_node = add_to_tree(next_node, new_node, queue)\n end\n curr_node\n end",
"def insert_after_node(node, to_insert)\n return unless node\n\n new_node = Node.new(to_insert, node, node.next)\n\n if node.next\n node.next.prev = new_node\n end\n\n if node == @tail\n @tail = new_node\n end\n\n node.next = new_node\n @length += 1\n return new_node\n end"
] | [
"0.6948148",
"0.6616172",
"0.6540583",
"0.6531678",
"0.6491444",
"0.647986",
"0.6412449",
"0.6394911",
"0.6363294",
"0.6316136",
"0.6316136",
"0.62616694",
"0.62616694",
"0.62473536",
"0.62408864",
"0.62151796",
"0.6172578",
"0.6156053",
"0.61483955",
"0.6117277",
"0.6109629",
"0.60959184",
"0.6080128",
"0.60793376",
"0.6066334",
"0.6055235",
"0.6053977",
"0.60325193",
"0.6020593",
"0.6020593",
"0.6000697",
"0.5978381",
"0.59742707",
"0.59742707",
"0.5962513",
"0.5920439",
"0.58859897",
"0.5846338",
"0.5833241",
"0.583182",
"0.5810255",
"0.58100075",
"0.58082986",
"0.5803878",
"0.5794771",
"0.57867694",
"0.5746687",
"0.5738874",
"0.5735665",
"0.57296807",
"0.5728439",
"0.57260686",
"0.5722057",
"0.5717178",
"0.57148457",
"0.570123",
"0.5694084",
"0.5691352",
"0.5686386",
"0.5679445",
"0.56623745",
"0.5658739",
"0.5642785",
"0.563326",
"0.563326",
"0.56189233",
"0.561806",
"0.5617829",
"0.56070817",
"0.5592586",
"0.5589121",
"0.5588394",
"0.5587495",
"0.5581858",
"0.55783874",
"0.5573923",
"0.5572371",
"0.55701184",
"0.55684006",
"0.55684006",
"0.55640346",
"0.5554495",
"0.55531126",
"0.55406916",
"0.5539906",
"0.5537814",
"0.55369794",
"0.5533571",
"0.5523661",
"0.5521417",
"0.55176705",
"0.55117124",
"0.5506575",
"0.5496899",
"0.548476",
"0.547095",
"0.54660046",
"0.54658014",
"0.5463169",
"0.54624724",
"0.5457011"
] | 0.0 | -1 |
Private: Used by insert to add new node in specified position. | def insert_at(data, position)
node, head, tail = set_insert_vars(data, position)
# before: head -> position
# after: head -> node -> position
head.tail = node
node.tail = position
position.head = node
node.head = head
@size += 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert(node, position)\n node_before_position = index(position-1)\n node_at_position = index(position)\n node_before_position.next = node\n node.next = node_at_position\n @size += 1\n node\n # returns inserted node\n end",
"def insert(position, surname)\n new_node = Node.new(surname)\n current = self[position-1] #self is [] method\n add_to_count\n saved_node = current.next_node\n current.next_node = new_node\n new_node.next_node = saved_node\n return new_node\n end",
"def insert_at(position = 1)\n move_to_child_with_index(parent, position - 1)\n end",
"def insert_at!(data, position)\n node, head, tail = set_insert_vars(data, position)\n\n # before: head -> position -> tail\n # after: head -> node -> tail\n head.tail = node if head\n node.tail = tail\n tail.head = node if tail\n node.head = head\n\n # set @tail for list or it will use old tail\n if position.tail?\n @tail = node\n end\n\n # orphan the old node\n position.head = nil\n position.tail = nil\n end",
"def insert_at(data, index)\n\t\t@current_node = at(index)\n\t\t@insert_node = Node.new(data, @current_node)\n\n\t\t#Handeling the case that user inserts a node at head position (even though prepend exists for that)\n\t\tif @current_node != @head\n\t\t\t@old_link_node = at(index - 1)\n\t\t\t@old_link_node.next_node = @insert_node\n\t\telse\n\t\t\t@head = @insert_node\n\t\tend\n\tend",
"def insert_node(new_node_val)\n new_node = Node.new(new_node_val)\n @nodes << new_node\n @_node_map[new_node_val] = new_node\n new_node\n end",
"def insert_at(position = acts_as_list_top)\n insert_at_position(position)\n end",
"def add_node(node); end",
"def insert_at(index)\n at(index)\n temp = @current_node.next\n blankNode = Node.new('Inserted Node')\n @current_node.next = blankNode\n blankNode.next = temp\n end",
"def insertNodeAtPosition(llist, data, position)\n tracked_node = llist\n new_node = SinglyLinkedListNode.new data\n\n unless llist\n return new_node\n end\n if position == 0\n new_node.next = llist\n return new_node\n end\n\n current_position = 0\n current_node = llist\n while(current_position != position - 1 && llist.next != nil)\n current_node = current_node.next\n current_position += 1\n end\n node_at_position = current_node.next\n current_node.next = new_node\n new_node.next = node_at_position\n\n return tracked_node\n\nend",
"def insert (node, splice_position)\n _insert(node, splice_position)\n\n delete_old_nodes\n\n node\n end",
"def insert_node\n insert_node_helper(@root)\n end",
"def add(point, index, attrib, metadata = nil)\n item = node_class.new(point, attrib, @insert_point, metadata)\n @lookup[index] = item\n @items[@insert_point] = item\n heapify(@insert_point)\n @insert_point += 1\n end",
"def insert_position(position = nil)\n return @insert_position unless position\n @insert_position = position\n end",
"def insert_node(index, word, definition)\n node_before_index = find_node(index - 1)\n node_at_current_index = find_node(index)\n new_node = Node.new(word, definition, node_at_current_index)\n node_before_index.next_node = new_node\n @counter += 1\n end",
"def insert_at(node, index)\n target = self.at(index)\n target_prev = target.prev\n set_next_and_prev(target_prev, node)\n set_next_and_prev(node, target)\n self.size += 1\n end",
"def insert_at(index, e)\n push e if index > @length - 1\n node = get_node index\n insert_node_between node.prev, node, ListNode.new(e)\n end",
"def insert_at(position, element)\n\t\t\t\tif position == 0\n\t\t\t\t\t@head = newNode(nil, element, @head)\n\t\t\t\t\tif tail == nil\n\t\t\t\t\t\t@tail = @head\n\t\t\t\t\tend\n\t\t\t\telsif position == @length\n\t\t\t\t\tif @tail == nil\n\t\t\t\t\t\t@tail = newNode(@head, element, nil)\n\t\t\t\t\t\t@head.next = @tail\n\t\t\t\t\telse\n\t\t\t\t\t\t@tail = newNode(@tail, element, nil)\n\t\t\t\t\t\t@tail.prev.next = @tail\n\t\t\t\t\tend\n\t\t\t\telsif position < @length\n\t\t\t\t\t_insert_in_list(@head.next, position - 1, element)\n\t\t\t\telse\n\t\t\t\t\traise RuntimeError.new(\"position must be in range\")\n\t\t\t\tend\n\t\t\t\t@length += 1\n\t\t\tend",
"def insert_in_list_at(position = 1)\n insert_at_position(position)\n end",
"def insert_in_list_at(position = 1)\n insert_at_position(position)\n end",
"def insert(node, &block); end",
"def insert(node, &block); end",
"def position_inserted(position)\n end",
"def insert_at(data, index)\n return nil if index < 0 || index > @size \n new_node = Node.new(data, at(index))\n at(index - 1).next_node = new_node\n @size += 1\n end",
"def insertAfter(node, new_node)\n end",
"def addNodeAtPos(xml, toAdd, nodeOver)\n\n size = xml[\"childCount\"].to_i\n if(xml[\"nodeName\"] == nodeOver)\n\n xml[\"childCount\"] = size+1\n xml[size] = toAdd\n return\n end\n for j in 0..size\n\n values = xml[j]\n if(values[\"nodeName\"] == nodeOver)\n addNodeAtPos(values, toAdd, nodeOver)\n break\n else\n\n countVals = values[\"childCount\"].to_i\n for k in 0..countVals\n addNodeAtPos(values[k], toAdd,nodeOver)\n end\n end\n end\n end",
"def insert(loc, data)\n if @head.data == nil\n @head = Node.new(data)\n else\n counter = 1\n node = @head\n until counter == loc\n node = node.next_node\n counter += 1\n end\n new_node = Node.new(data)\n new_node.next_node = node.next_node\n node.next_node = new_node\n end\n end",
"def insert(nodo, pos)\n if (nodo.instance_of? Nodo) == false\n nodo = Nodo.new(nodo,nil,nil)\n end\n raise \"Error la posicion la debe indicar un entero\" unless ( pos.instance_of? Integer)\n raise \"Error posicion inadecuada\" unless ( pos <= @nodos )\n if pos == 0\n insert_head(nodo)\n elsif pos == @nodos\n insert_tail(nodo)\n else\n i = 1\n a = @head\n while i != pos\n i = i+1\n a = a.next\n end\n b = a.next\n nodo.prev = a\n nodo.next = b\n a.next = nodo\n b.prev = nodo\n @nodos = @nodos +1\n nodo\n end\n end",
"def insert_at(index,data)\n return nil if @head.nil? || index > self.size - 1\n if index == 0\n self.prepend(data)\n elsif index == self.size - 1\n self.append(data)\n else\n new_node = Node.new(data)\n current_node = @head\n prev_node = nil\n index.times do\n prev_node,current_node = current_node,current_node.next\n end\n end\n new_node.next,prev.next = current_node,new_node \n end",
"def insert_node( word, definition, index )\n\n\t\tcount = 0\n\t\tcurrent_node = @head\n\t\tlast_node = nil\n\n\n\t\tlast_node, count = find_node( index )\n\t\tcurrent_node = last_node.next\n\n\t\tif last_node.next.nil?\n\n\t\t\tadd_node( word, definition )\n\n\t\telse\n\n\t\t\tnew_node = Node.new( word, definition )\n\t\t\tnew_node.next = current_node\n\t\t\tlast_node.next = new_node\n\n\t\t\tputs \"Inserted #{new_node.word} at index: #{count}\"\n\n\t\tend\n\n\tend",
"def test_add_at_specific_position\n assert(!@root.has_children?, \"Should not have any children\")\n\n assert_equal(1, @root.size, \"Should have 1 node (the root)\")\n @root.add(@child1) # First Child added at position 0\n # Validate that children = [@child1]\n assert_equal(@child1, @root[0])\n\n @root << @child2 # Second child appended at position 1.\n # Validate that children = [@child1, @child2]\n assert_equal(@child1, @root[0])\n assert_equal(@child2, @root[1])\n assert_equal(2, @root.children.size, \"Should have two child nodes\")\n\n @root.add(@child3, 1) # Third child inserted at position 1 (before @child2)\n # Validate that children = [@child1, @child3, @child2]\n assert_equal(@child1, @root[0])\n assert_equal(@child3, @root[1])\n assert_equal(@child2, @root[2])\n assert_equal(3, @root.children.size, \"Should have three child nodes\")\n\n @root.add(@child4, @root.children.size) # Fourth child inserted at the end (equivalent to plain #add(child4)\n # Validate that children = [@child1, @child3, @child2, @child4]\n assert_equal(@child1, @root[0])\n assert_equal(@child3, @root[1])\n assert_equal(@child2, @root[2])\n assert_equal(@child4, @root[3])\n assert_equal(4, @root.children.size, \"Should have four child nodes\")\n\n # Now, a negative test. We are preventing addition to a position that does not exist.\n assert_raise(RuntimeError) {\n @root.add(@child5, @root.children.size + 1) # Fifth child inserted beyond the last position that is valid (at 5th pos).\n }\n # Validate that we still have children = [@child1, @child3, @child2, @child4]\n assert_equal(@child1, @root[0])\n assert_equal(@child3, @root[1])\n assert_equal(@child2, @root[2])\n assert_equal(@child4, @root[3])\n assert_nil(@root[4])\n assert_equal(4, @root.children.size, \"Should have four child nodes\")\n\n # Another negative test. Lets attempt to add from the end at a position that is not available\n assert_raise(RuntimeError) {\n @root.add(@child5, -(@root.children.size+2)) # Fifth child inserted beyond the first position that is valid; i.e. at -6\n }\n assert_nil(@root[-5])\n assert_equal(@child1, @root[-4])\n assert_equal(@child3, @root[-3])\n assert_equal(@child2, @root[-2])\n assert_equal(@child4, @root[-1])\n assert_equal(4, @root.children.size, \"Should have four child nodes\")\n\n # Lets correctly add the fifth child from the end to effectively prepend the node.\n @root.add(@child5, -(@root.children.size+1)) # Fifth child inserted beyond the first position; i.e. at -5\n assert_nil(@root[-6])\n assert_equal(@child5, @root[-5])\n assert_equal(@child1, @root[-4])\n assert_equal(@child3, @root[-3])\n assert_equal(@child2, @root[-2])\n assert_equal(@child4, @root[-1])\n assert_equal(5, @root.children.size, \"Should have five child nodes\")\n end",
"def insert_at(index)\n if index < 0 || index >= @size\n return nil\n end\n\n next_to_last = nil\n new_node = nil\n if index == 0\n return prepend\n elsif index == @size-1\n return append\n else\n search_index = @head\n index.times {|i|\n if i == index - 1\n next_to_last = search_index\n end\n search_index = search_index.next_node\n }\n new_node = Node.new\n next_to_last.next_node = new_node\n new_node.next_node = search_index\n end\n @size += 1\n new_node\n end",
"def add_at(child, position)\n raise \"Child already added\" if @children_hash.has_key?(child.name)\n\n @children_hash[child.name] = child\n @children = @children.insert(position, child)\n child.parent = self\n return child\n\n end",
"def insert_at(value, index)\n prev = self.at(index - 1)\n next_node = prev.next_node\n prev.next_node = Node.new(value, next_node)\n end",
"def insert_at(index, node_value)\n if index == 0\n node = Node.new(node_value)\n node.next_node = @head\n @head = node\n else\n target = at(index)\n if target.nil?\n append(node_value)\n else\n node = Node.new(node_value)\n pre_target = at(index - 1)\n node.next_node = target\n pre_target.next_node = node\n end\n end\n\n node\n end",
"def insert_after(idx, data)\n curr_node = node_at(idx)\n fail ArgumentError, \"index is out of range\" unless curr_node\n new_node = Node.new(data)\n new_node.next_node = curr_node.next_node\n curr_node.next_node = new_node\n end",
"def insert_at_index(index, value)\n new_node = Node.new(value)\n if index.zero?\n new_node.next_node = first_node\n self.first_node = new_node\n else\n current_node = first_node\n current_index = 0\n while current_index < (index - 1)\n current_node = current_node.next_node\n current_index += 1\n end\n new_node.next_node = current_node.next_node\n current_node.next_node = new_node\n end\n end",
"def insert_at(value, index, current_index = 0, node = @head)\n return 'Not a valid index' if index > size || index.negative?\n return append(value) if index == size\n return prepend(value) if index.zero?\n\n if current_index + 1 == index\n new_node = Node.new(value)\n new_node.next_node = node.next_node\n node.next_node = new_node\n return\n end\n insert_at(value, index, current_index + 1, node.next_node)\n end",
"def add_node(n)\n @nodes.push n unless @nodes.include? n\n end",
"def assign_position\n # Position for new nodes is (number of siblings + 1), but only for new categories\n if self.read_attribute(parent_id_column).nil?\n self.write_attribute(position_column, self.class.roots(true).size + 1)\n else\n self.write_attribute(position_column, self.class.find(:all, :conditions => [\"#{parent_id_column} = ?\", self.read_attribute(parent_id_column)]).size + 1)\n end\n end",
"def insert_node(node)\n raise \"Node must be a leaf\" unless node.is_leaf?\n if (self.view) \n node.position = self.view.get_node_position(node)\n node.visible = self.view.get_node_visibility(node)\n node.search_value = self.view.get_node_search_value(node)\n end\n leafs << node\n end",
"def insert_at(value, index)\n if index == 0\n prepend(value)\n elsif index >= self.size\n append(value)\n else\n prev = nil\n cur = head\n i = 0\n until i == index\n prev = cur\n cur = cur.next_node\n i += 1\n end\n prev.next_node = Node.new(value, cur)\n end\n end",
"def insert(val, index)\n node = LinkedListNode.new(val)\n prev_ele = self.nth_element(index - 1)\n next_ele = prev_ele.next\n node.next = next_ele\n prev_ele.next = node\n end",
"def insert_child\n insert_node('insert_child')\n end",
"def insert(index, content)\n\t\tif index==1 and @length!=0\n\t\t\tnode = Node.new(content, nil, @first)\n\t\t\t@first = node\n\t\telsif @length+1==index\n\t\t\tpush(content)\n\t\telse\n\t\t\ttmp = get(index)\n\t\t\tnode = Node.new(content, tmp.back, tmp)\n\t\t\ttmp.back.front = node\n\t\t\ttmp.back = node\n\t\tend\n\t\t@length+=1\n\tend",
"def add_node(node)\n @nodes.add node\n end",
"def insert(index, value)\n if index == @size\n append(value)\n else\n assert_in_range(index)\n \n current, previous = get_node(index)\n inserted = LinkedListNode.new(:successor => current, :value => value)\n previous.successor = inserted if previous\n \n @head = inserted if current == @head \n @size += 1\n end\n end",
"def insert_at(i,data)\n if i<0 || i>= @size\n \treturn nil\n end\n node=Node.new\n node.value=data\n if i==0\n \tnode.next_node=@root\n \t@root=node\n else\n pre_node=at(i-1)\n node.next_node=pre_node.next_node\n pre_node.next_node=node\n end\n @size+=1\n end",
"def insert_at(value, index)\n current = @head\n (index - 1).times do\n current = current.next_node\n end\n\n current.next_node = Node.new(value, current.next_node)\n \n end",
"def insert(idx, node)\n if idx.zero?\n add_first(node)\n return\n end\n\n iterate do |curr_node, count|\n if count == idx - 1\n old_next = curr_node.next_node\n curr_node.next_node = node\n node.next_node = old_next\n old_next.prev_node = node unless old_next.nil?\n node.prev_node = curr_node\n\n return\n end\n end\n end",
"def insert_at(index, value)\n node = Node.new\n node.value = value\n counter = 0\n current_node = @head\n until counter == index\n previous_node = current_node\n current_node = current_node.next_node\n counter += 1\n end\n previous_node.next_node = node\n node.next_node = current_node\n end",
"def insert_at(index, info)\n\t\tcurr = get(index)\n\t\tif !curr.nil?\n\t\t\t_new = Node.new(info, previous: curr.previous, _next: curr)\n\t\t\tcurr.previous.next = _new if !curr.previous.nil?\n\t\t\tcurr.previous = _new\n\t\t\t@head = _new if @head == curr\n\t\t\t@tail = _new if @tail == curr\n\t\t\t@length += 1\n\t\telse\n\t\t\tfor i in (@length...index)\n\t\t\t\tself << nil\n\t\t\tend\n\t\t\tadd(info)\n\t\tend\n\t\tself\n\tend",
"def add_node( node )\n super( node )\n __add_node__( node )\n end",
"def insert(node_score, node_title)\n new_node = Node.new(node_score, node_title)\n if self.root.nil?\n self.root = new_node\n return 0\n else\n recursive_insert(self.root, new_node, 0)\n end\n end",
"def insert(data)\n @head = Node.new(data, @head)\n end",
"def insert_node(index, word, definition)\n\n counter = 0\n current_node = @head\n previous_node = nil\n\n until counter == index do\n previous_node = current_node\n current_node = current_node.next\n counter += 1\n end\n\n # insert and point to node that was just bumped back\n new_node = Node.new(word, definition, current_node)\n # redirect previous node pointer to the inserted node\n previous_node.next = new_node\n\n end",
"def push_at(index, value)\n new_node = create_node(value)\n node = node_at(index - 1)\n push_after(node, new_node) if node\n self.head = new_node if index == 0\n self.size += 1\n new_node.data\n end",
"def insert_at(newEntry, index)\n return false if @head.nil? || index > self.size # will not consider a index out of list\n \n if self.size == 1 || index == 1 #list has just 1 node or it is the first one\n prepend(newEntry) \n else\t\n temp_node = self.at((index-1))\n newEntry.next = temp_node.next\n temp_node.next = newEntry\n end\n return true\t\n end",
"def insert_at(inode, index)\n return nil if index < 1 || index > size\n\n prev_node = get_prev_node(index) unless index == 1\n\n if index > 1\n inode.next = prev_node.next\n\n prev_node.next = inode\n\n self.size += 1\n else\n prepend(inode)\n end\n\n inode\n end",
"def put_text_node_at(position)\n clear_insert_toolbar_before(@current_edited_node_position)\n @current_edited_node_position = position\n nodes.insert(position + 1, PostNode.new(node: PostText.new, node_type: 'PostText'))\n set_state post: state.post\n end",
"def insert(name, score, current = @root, depth = 0)\n if root == nil\n @root = Node.new(name, score)\n depth\n else\n insert_helper(name, score, current, depth)\n end\n end",
"def insert(score, title)\n @total_nodes +=1 \n if @root_node.nil?\n @root_node = Node.new(score, title)\n else\n @root_node.insert(score, title)\n end\n depth_of(score) \nend",
"def insert_node(word, definition, index)\n node = Node.new(word, definition, nil)\n if index == 0\n node.next = @head\n @head = node\n else\n counter = 0\n current_node = @head\n prev_node = nil\n while counter < index\n prev_node = current_node\n current_node = current_node.next\n counter += 1\n end\n node.next = current_node\n prev_node.next = node\n puts \"Inserting node at index #{index} with value: #{node.word}\"\n end\n end",
"def add(val)\n get_node(val) #every new element that has to be added should point to a new node correponding to it.\n list_size = @elements.size\n last_element_index = list_size - 1\n @elements[last_element_index].next_node = list_size\n new_element_index = list_size\n @elements[new_element_index] = @node\n end",
"def insert(new_value)\n if new_value > @value\n @right ? @right.insert(new_value) : (@right = Node.new(new_value))\n else\n @left ? @left.insert(new_value) : (@left = Node.new(new_value))\n end\n end",
"def insert(index, element)\n if index == 0\n insert_first(element)\n else\n node_before_index = get(index - 1)\n node_at_index = get(index)\n node_before_index.next_node = element\n element.next_node = node_at_index\n @size += 1\n end\n end",
"def add_position(record_id, pos)\n add_record(record_id)\n @records[record_id] << pos\n end",
"def add_node(node)\n nodes[node.value] = node\n end",
"def set_insert_vars(data, position)\n node = DoubleNode.new(:data => data)\n\n head = position.head\n tail = position.tail\n\n [node, head, tail]\n end",
"def insert(data)\n @nodes << data\n heapify_up\n end",
"def insert_at_index(index, data)\n current_pointer = self.head\n (1..index - 1).each do |number|\n if current_pointer.next.nil? && (index != number)\n current_pointer.next = Node.new(nil, nil)\n end\n current_pointer = current_pointer.next\n end\n if current_pointer\n old_next = current_pointer.next\n current_pointer.next = Node.new(data, old_next)\n end\n end",
"def add_node(node)\n\t\t\tunless has_node?(node)\n\t\t\t\t@nodes[node] = new_node(node)\n\t\t\t\t@order += 1\n\t\t\tend\n\t\t\tself\n\t\tend",
"def add(node)\r\n @nodes << node\r\n end",
"def insert_after(child1, child2); end",
"def insert_at(value, index)\n node = Node.new\n node.value = value\n curr = head\n return (@head = node) if index.zero?\n\n index.downto(2) do |_|\n break if curr.next.nil?\n\n curr = curr.next\n end\n node.next = curr.next\n curr.next = node\n head\n end",
"def insert(word, definition, index)\n new_node = Node.new(word, definition, nil)\n count = 2\n current_node = @head\n next_node = @head.next\n while count < index\n current_node = current_node.next\n next_node = next_node.next\n count += 1\n end\n new_node.next = next_node\n current_node.next = new_node\n end",
"def add_piece(piece, pos)\n\n end",
"def push(item)\n @start = Node.new(item, @start)\n self\n end",
"def add(tag, klass, position = -1)\n self.instance.add(tag, klass, position)\n end",
"def insert_at(value, index)\n length = size - 1\n if @head.nil?\n set_head(value)\n elsif index > length\n puts \"the list does not have a value associated with your given index.\"\n else\n old_node = at_no_data(index)\n old_next_node = at_no_data(index + 1)\n prev_node = at_no_data(index - 1)\n prev_node.next_node.data = value\n prev_node.next_node = old_node\n end\nend",
"def add_node(new_node)\n @nodes[new_node] ||= Array.new #only adds if not in graph\n @node_dir_ancestors[new_node] ||= Array.new\n end",
"def put_in_place\n if place==:append\n item = self\n self.class.with_tree_scope(self) do\n root.append(item)\n end\n end\n end",
"def insert(node)\n case @value <=> node.value\n when 1\n # alphabetically greater than, insert to left\n insert_into(:left, node)\n when 0\n # same value, so increase count of `self` node\n @count += 1\n when -1\n # alphabetically less than, insert to right\n insert_into(:right, node)\n end\n end",
"def insert_after value\n node = Node.new value, @nxt, self\n @nxt.prv = node if @nxt\n @nxt = node\n end",
"def insert(key, value, __level = nil)\n @mutex.synchronize do\n newlevel = __level || random_level\n x = anchor\n level = node_level(x)\n update = Array.new(level)\n x = find_with_update(x, level, key, update)\n \n # rewrite existing key\n \t if node_compare(x, key) == 0\n \t node_set_value!(x, value)\n \t # insert in a middle\n \t else\n \t level = newlevel\n \t newx = new_node(newlevel, key, value)\n \t while level > 0\n \t level -= 1\n \t node_insert_after!(newx, update[level], level)\n end\n \t end\n end\n \tself\n \tend",
"def insert_after( node, value )\n # Find the specified node, and add a new node\n # with the given value between that found node\n # and the next\n\n end",
"def insert_node(atlas_node_id, node_name, node)\n return if atlas_node_id.blank? || node_name.blank?\n current_node = TaxGenerator::TaxonomyNode.new(atlas_node_id, node_name)\n node << current_node\n current_node\n end",
"def test_insert_adds_node_at_root\n @tree.insert(\"a\")\n assert_equal \"a\", @tree.root.value\n end",
"def insert(node, root=nil, &block)\n return super(node, root) do | inserted_node | \n inserted_node.update_left_size(nil, 1) unless inserted_node.nil?\n block.call(inserted_node) if block\n end\n end",
"def add_node(p_node_text, p_node_type, p_parent_node = nil, p_node_color = nil)\n new_node = create_node(p_node_text, p_node_type, p_node_color)\n # add new node on top level per default\n if p_parent_node.nil?\n p_parent_node = @nodes[0]\n end\n p_parent_node[\"nodes\"].insert(0, new_node)\n return new_node\n end",
"def insert(data)\n @head = Node.new(data, head)\n end",
"def insert_at(index, insertion)\n prev = get_index(index)\n post = get_index(index+1)\n\n #if index of insertion is bigger than list size it will insert at the end\n if prev.nil?\n @tail.next_node = insertion\n @tail = insertion #problem alert\n @tail.next_node = nil\n else\n prev.next_node = insertion\n insertion.next_node = post\n end\n end",
"def insert(node)\n @prv.nxt = node.first if @prv\n node.first.prv = @prv\n node.last.nxt = self\n node\n end",
"def place_piece(piece, pos)\n raise 'position not empty' unless empty?(pos)\n \n self[pos] = piece\n end",
"def add_position\n self.position = self.max_position + 1\n end",
"def insert(value, index)\n end",
"def insert(index, *args, **_arg2, &block); end",
"def add_node(node)\n @nodes[node.uri] ||= node\n end",
"def insert_node(parent, type, text, additional = '', object = nil)\n text = text.to_s\n additional = additional.to_s if additional\n iter = self.model.append(parent)\n iter.set_value(Value::ICON, render_icon(@formats[type][0], Gtk::IconSize::MENU, text))\n iter.set_value(Value::TEXT, text)\n iter.set_value(Value::ADDITIONAL_TEXT, additional) if additional\n iter.set_value(Value::OBJECT, object) if object\n iter\n end",
"def insert new_value\n if new_value <= @value\n @left.nil? ? @left = Node.new(new_value) : @left.insert(new_value)\n elsif new_value > @value\n @right.nil? ? @right = Node.new(new_value) : @right.insert(new_value)\n end\n end"
] | [
"0.7950374",
"0.7509472",
"0.7481829",
"0.74788064",
"0.7257622",
"0.72214186",
"0.71629435",
"0.714674",
"0.71291023",
"0.7113394",
"0.70786136",
"0.70153815",
"0.6981719",
"0.6958616",
"0.6956231",
"0.6948699",
"0.6945686",
"0.69395214",
"0.6927987",
"0.6927987",
"0.69208604",
"0.69208604",
"0.6895728",
"0.68632025",
"0.6849785",
"0.67750967",
"0.67502934",
"0.67284554",
"0.6700936",
"0.6675128",
"0.66348135",
"0.6621063",
"0.6616102",
"0.66138893",
"0.66121244",
"0.6608721",
"0.6582271",
"0.6576079",
"0.65550715",
"0.6552702",
"0.65504",
"0.6530385",
"0.6518214",
"0.6506384",
"0.6500949",
"0.6499687",
"0.6496687",
"0.64786166",
"0.64723986",
"0.647059",
"0.6456623",
"0.64420927",
"0.64318985",
"0.6418271",
"0.64126575",
"0.6405343",
"0.6404114",
"0.6377525",
"0.636421",
"0.6362024",
"0.63089776",
"0.62832725",
"0.62821096",
"0.6278485",
"0.62765133",
"0.6267071",
"0.6240332",
"0.6233902",
"0.621558",
"0.6202932",
"0.61967045",
"0.6184866",
"0.6180553",
"0.6180202",
"0.6176511",
"0.616464",
"0.6164403",
"0.61521465",
"0.6151019",
"0.612171",
"0.61161643",
"0.61075705",
"0.60997266",
"0.609634",
"0.6094762",
"0.6094325",
"0.60898244",
"0.60879546",
"0.6077389",
"0.6076842",
"0.6071648",
"0.6060254",
"0.60576457",
"0.6048152",
"0.6046561",
"0.6032542",
"0.60320646",
"0.602482",
"0.60226965",
"0.6007129"
] | 0.7567862 | 1 |
Private: Variables common to insert_at and insert_at!. Returns: Array. | def set_insert_vars(data, position)
node = DoubleNode.new(:data => data)
head = position.head
tail = position.tail
[node, head, tail]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_(array, item, index)\n array = array.insert(index, item)\n puts array\n return array\n \nend",
"def values_at(*) end",
"def create_int_array\n [first.time_to_int, last.time_to_int]\n end",
"def to_a\n [ xnow, ynow ]\n end",
"def test_insert_negative_index_append\n assert_equal([\"a\",\"b\",\"c\",7,8,9], @array.insert(-1, 7, 8, 9))\n end",
"def insertion_sort(arr)\n return arr\nend",
"def current_lead_at\n []\n end",
"def get_times_array(padding = true)\n @times = (padding) ? [@start_dt - 1.hour] : [@start_dt]\n \n # and including every 1/2 hour until one hour after the selected end time\n while true do\n tmp = @times.last + 30.minutes\n (padding) ? (tmp == (@end_dt + 1.hour)) ? break : '' : (tmp == @end_dt) ? break : ''\n @times.push(tmp)\n end\n end",
"def reposition(arr, from, to)\n arr.insert(to, arr.delete_at(from))\n end",
"def insert(buf); @a.copy(buf); end",
"def my_array_modification_method!(source, thing_to_modify)\n first_integer = []\n first_integer.push(i_want_pets[2])\n i_want_pets.delete_at(2)\n i_want_pets.insert(2, (first_integer.join.to_i + thing_to_modify) )\n\n second_integer = []\n second_integer.push(i_want_pets[7])\n i_want_pets.delete_at(7)\n i_want_pets.push(second_integer.join.to_i + thing_to_modify)\n\nend",
"def ordered_insert(value)\n if @coordinates.empty?\n @coordinates << value\n else\n idx = @coordinates.find_index { |x| x[:latitude] > value[:latitude] && x[:longitude] > value[:longitude] }\n if idx.nil?\n @coordinates << value\n else\n temp = @coordinates.slice!(idx, @coordinates.length - idx)\n @coordinates << value\n @coordinates.concat temp\n end\n end\n end",
"def using_insert(array, element)\n array = array.insert(4, element)\n\n \nend",
"def position_inserted(position)\n end",
"def get_arr_x(x, y) \n x # this coordinate doesn't change\nend",
"def all_moves_array(initial_x, initial_y)\n\t\tfinal = []\n\t\tx = initial_x + 2\n\t\tfinal << [x, initial_y+1] << [x, initial_y-1]\n\t\tx = initial_x - 2\n\t\tfinal << [x, initial_y+1] << [x, initial_y-1]\n\t\ty = initial_y + 2\n\t\tfinal << [initial_x+1, y] << [initial_x-1, y]\n\t\ty = initial_y - 2\n\t\tfinal << [initial_x+1, y] << [initial_x-1, y]\n\t\tfinal\n\tend",
"def array_start\n []\n end",
"def normalized_offsets\n array = []\n \n if parent\n merges_array = parent.\n child_merges.\n sort_by(&:created_at)\n \n merges_array.each_with_index do |m, i|\n # Setting up the first values \n \n if m.child_offset > 0\n m.child_jingle.offset = m.child_offset\n \n m.child_jingle.absolute_offset = m.child_offset\n \n array << m.child_jingle\n if i > 0\n array.each do |a|\n array.each_with_index do |x,y|\n if a.id == m.child_jingle.id && a.absolute_offset > x.absolute_offset\n #Rails.logger.debug(\"#{a.id} vs. #{m.child_jingle.id} OFFSETS: #{a.absolute_offset} > #{x.absolute_offset}\")\n array.insert(y-1, array.delete_at(-1))\n break\n end\n \n if a.id == m.child_jingle.id && a.absolute_offset < x.absolute_offset\n #Rails.logger.debug(\"#{a.id} vs. #{m.child_jingle.id} OFFSETS: #{a.absolute_offset} < #{x.absolute_offset}\")\n array.insert(y+1, array.delete_at(-1))\n break\n end\n end\n end\n end\n else\n m.child_jingle.offset = 0\n array.unshift(m.child_jingle)\n end\n \n # Sets up the first merge\n if i == 0\n # If the first merge has a parent offset\n if m.parent_offset > 0\n m.parent_jingle.offset = m.parent_offset\n m.parent_jingle.absolute_offset = m.parent_offset\n array << m.parent_jingle\n else\n m.parent_jingle.offset = 0\n m.parent_jingle.absolute_offset = 0\n array.unshift(m.parent_jingle)\n end\n end\n \n if m.parent_offset > 0\n array[1].offset = m.parent_offset\n array.each_with_index do |a,n|\n a.absolute_offset = 0 if a.absolute_offset.nil?\n unless n == 0\n a.absolute_offset += m.parent_offset unless a.id == m.child_jingle.id\n end\n end\n end\n end\n end\n \n array = array.reverse\n \n array.each_with_index do |a,n|\n unless a.offset == 0 # Skip the first track\n Rails.logger.debug(\"MATH: #{a.id} - #{array[n+1].absolute_offset}\")\n a.absolute_offset = 0 if a.absolute_offset.blank? # In case of a nil\n array[n+1].absolute_offset = 0 if array[n+1].absolute_offset.blank? # In case of a nil\n a.offset = (a.absolute_offset - array[n+1].absolute_offset).abs\n end\n end\n #array.each {|a| Rails.logger.debug(\"OFFSET: ID#{a.id} #{a.offset}\")}\n return array\n end",
"def insertion_sort(arr)\n\t1.upto(arr.length - 1) do |n|\n\t\tinsert_me = arr[n]\n\n\t\tuntil arr[n - 1] < insert_me || (n - 1) < 0\n\t\t\tarr[n] = arr[n - 1]\n\t\t\tarr[n - 1] = insert_me\n\n\t\t\tn -= 1\n\t\tend\n\tend\n\n\treturn arr\nend",
"def using_insert (array, element)\n return array.insert(4, element)\nend",
"def insertion_sort(arr)\n<<<<<<< HEAD\n\tarr.each_with_index do |num, i|\n if i > 0\n while arr[i] < arr[i-1] && i > 0\n arr[i], arr[i-1] = arr[i-1], arr[i]\n i -= 1\n end\n \tend\n end\n=======\n>>>>>>> upstream/master\n return arr\nend",
"def current_pos\n\t\treturn arr = [pos_x, pos_y]\n\tend",
"def coord_array\n _coords.dup\n end",
"def to_a\n nodes.map(&:at)\n end",
"def added(array)\nend",
"def using_insert(array, element)\n array.insert(4,element)\nend",
"def using_insert(array,element)\n array.insert(4,element)\nend",
"def create_new_players_moves_array\n player_moves = Array.new(2) { Array.new }\n player_moves[0] = @data[0].dup\n player_moves[1] = @data[1].dup\n return player_moves\n end",
"def x_points\n points = [[], []]\n (0...height).each do |y|\n (0...width).each do |x|\n if (array[y][x]).nonzero? && (x - 1 < 0 || (array[y][x - 1]).zero?)\n points[0] << Point.new(x - 1, y) + @position\n end\n\n if (array[y][x]).nonzero? && (x + 1 >= length || (array[y][x + 1]).zero?)\n points[1] << Point.new(x + 1, y) + @position\n end\n end\n end\n\n points\n end",
"def insertion_sort(arr)\n arr.each_with_index do |_, i|\n j = 0\n while j < i\n if arr[i] < arr[j]\n reposition(arr, i, j)\n break\n end\n j += 1\n end\n end\n end",
"def using_insert(array, i)\n array.insert(4, i)\nend",
"def index_arr_add(arr, index, element)\n # Add `element` at position `index` to the Array variable `arr` and return `arr`\n return arr.insert(index, element)\nend",
"def points #:nodoc:\n [self]\n end",
"def points #:nodoc:\n [self]\n end",
"def using_insert(array, element)\n array.insert(4, element)\nend",
"def using_insert(array, element)\n array.insert(4, element)\nend",
"def using_insert(array, element)\n array.insert(4, element)\nend",
"def using_insert(array, element)\n array.insert(4, element)\nend",
"def using_insert(array, element)\n array.insert(4, element)\nend",
"def inserted_ids\n @results[INSERTED_IDS]\n end",
"def using_insert(array, item)\n array.insert(4, item)\nend",
"def using_insert(array, element)\n \n array.insert(4, element)\n \nend",
"def insertion_sort(array)\n array.each_with_index do |item, index|\n new_card = array[index]\n @index_position = index\n array[0..index].each_with_index do |_item, index_2|\n next if index == 0\n compare_index = index - index_2\n if new_card < array[index - index_2]\n array.insert(compare_index, array.delete_at(@index_position))\n p \"Intermediate array step: #{array}\"\n @index_position = compare_index\n end\n end\n p array\n end\nend",
"def insertion_sort(array)\n (1..array.length - 1).to_a.each do |index|\n tmp_value = array[index]\n position = index - 1\n\n while position >= 0 do\n if array[position] > tmp_value\n array[position + 1] = array[position]\n position = position - 1\n else\n break\n end\n end\n\n array[position + 1] = tmp_value\n end\n\n return array\nend",
"def time_travel_offsets\n @time_travel_offsets ||= []\n end",
"def position\n [@x, @y]\n end",
"def add_to_array(x, y)\n combined_array = x\n combined_array.push(y)\nend",
"def to_a\n [left, bottom, tip, top, right]\n end",
"def insert_timestamps\n timestamps = {}\n if model_class.columns.include?(:created_at)\n timestamps[:created_at] = Sequel.function(:NOW)\n end\n if model_class.columns.include?(:updated_at)\n timestamps[:updated_at] = Sequel.function(:NOW)\n end\n timestamps\n end",
"def using_insert(arr, elem)\n arr.insert(4, elem)\nend",
"def insert(data)\n @array << data\n i = @array.size - 1\n while (i >= 0) && (data > @array[(i -1)/2])\n @array[(i -1)/2], @array[i] = @array[i], @array[(i -1)/2]\n i = parent(i)\n end\n @array\n end",
"def insertion_sort(array)\n for index in (1...array.size)\n stored_value = array[index]\n gap = index\n while array[gap - 1] > stored_value && gap - 1 >= 0\n array[gap] = array[gap - 1]\n gap -= 1\n end\n array[gap] = stored_value\n end\n array\nend",
"def push_dup; end",
"def to_a\r\n @locs.dup\r\n end",
"def year_array\n return ['x'] +(@earliest_year..@latest_year).to_a\n end",
"def insertion_sort!(array)\n array.each_with_index do |el, i|\n j = i\n j -= 1 while j > 0 && el < array[j-1]\n array[i] = array[i-1] and i -= 1 while i > j\n array[j] = el\n end\n\n array\nend",
"def position\n return [@x, @y, @heading]\n end",
"def to_a\n [top, bottom]\n end",
"def insert_array(data, start_cell, direction = 'right')\n direction = get_direction(direction)\n row_offset = 0\n col_offset = 0\n\n data.each do |val|\n @ws.range(start_cell).offset(row_offset, col_offset).value = val\n case direction\n when DOWN\n row_offset += 1\n when UP\n row_offset += -1\n when TORIGHT\n col_offset += 1\n when TOLEFT\n col_offset += -1\n end\n end\n end",
"def to_a\n (@start_date..@end_date).to_a\n end",
"def stamp_new_rows\n db.query(\"UPDATE #{audit} SET `_copied_at` = NOW() WHERE `_copied_at` IS NULL\")\n end",
"def _bulkinsert (data,first)\n @length = 0\n cur = first\n while cur\n k = data[cur]\n # FIXME: Check for `Deleted`?\n if k\n if not_deleted?(k)\n # FIXME: Doing k == Deleted or k != Deleted here fails.\n # FIXME: Combining these on one line triggers bug.\n v = data[cur + 1]\n self[k] = v\n end\n end\n cur = data[cur + 2]\n end\n nil\n end",
"def insertion_sort(array)\n for index in (1...array.size)\n stored_value = array[index]\n gap = index # gap is the index at which we can overwrite.\n # ^ initially, it's `index` because that's what he have stored\n while gap > 0 && array[gap - 1] > stored\n array[gap] = array[gap - 1]\n gap -= 1 # now we can overwrite *this* index, having moved corresp. value to the right\n end\n array[gap] = stored_value # remember, `gap` is the index at which we can overwrite\n end\n array\nend",
"def values_at(*rest) end",
"def values_at(*rest) end",
"def values_at(*rest) end",
"def sort_and_fill\n \treturn @array if array_is_too_small\n\n diffs = differences_between_elements\n return @array if differences_are_same diffs\n\n insert_new_elements(diffs)\n @array\n end",
"def pos_inode_array\n pos_list_entry + size_list_entry\n end",
"def insertion_sort(arr)\n\tn = arr.length\n\t(1...n).each do |i|\n\t\tj = i\n\t\twhile arr[j] < arr[j-1] #&& j >= 1\n\t\t\tx = arr[j]\n\t\t\tarr[j] = arr[j-1]\n\t\t\tarr[j-1] = x\n\t\t\tj -= 1\n\t\t\tbreak if j == 0\n\t\tend\n\tend\n\treturn arr\nend",
"def before(val) insertion(val, 0) end",
"def split(range = nil)\n if self.record_category and self.activity?\n entry_end = self.end_timestamp || Time.now\n time = range ? [self.timestamp, range.begin.midnight.in_time_zone].max : self.timestamp\n end_time = range ? [entry_end, range.end.midnight.in_time_zone].min : entry_end\n list = Array.new\n while time < end_time\n new_end = [entry_end, (time + 1.day).midnight.in_time_zone].min\n list << [time, new_end, self]\n time = new_end\n end\n else\n return [self.timestamp, nil, self]\n end\n list\n end",
"def insert(x,a)\r\n c = a.dup\r\n c.push(x)\r\n c = c.sort\r\nend",
"def return_arr_txts\r\n IO.write(\"./DEBUG\", \"docclass=\"+@doc.to_s+\" andinfoclass= \"+@@info_past.class.to_s+\"=\"+@@info_past.to_s)\r\n @doc = @@info_past[1]\r\n if @doc[\"doc\"].empty?\r\n return [\"0\"]\r\n else\r\n return @doc[\"doc\"] #retorna os nomes dentro de um Array\r\n end\r\n end",
"def save_pos\n [pos, @previous_pos, @previous_line_number]\n end",
"def insert(p0, p1) end",
"def timestamps\n c = datetime_attr :created_at\n u = datetime_attr :updated_at\n [c, u]\n end",
"def insert_sort(start_arr=[])\n index = 1\n (start_arr.length-1).times do \n current = start_arr[index]\n sub_arr_index = index - 1 \n while sub_arr_index >= 0 && start_arr[sub_arr_index]>current do\n start_arr[index] == start_arr[sub_arr_index]\n sub_arr_index += 1 \n end\n index +=1\n end\n return start_arr\nend",
"def time_fragments\n []\n end",
"def to_a\n [time.sec, time.min, time.hour, time.day, time.mon, time.year, time.wday, time.yday, dst?, zone]\n end",
"def create_event_array(start_at_array, end_at_array, event_name, activity_id)\n\t\tevents_array = Array.new\n\n\t\tstart_at_array.each_index do |index|\n\t\t\tevent_hash = Hash.new\n\n\t\t\tevent_hash[:start_at] = start_at_array[index]\n\t\t\tevent_hash[:end_at] = end_at_array[index]\n\t\t\tevent_hash[:name] = event_name\n\t\t\tevent_hash[:activity_id] = activity_id\n\n\t\t\tevents_array[index]= event_hash\n\t\tend\n\n\t\treturn events_array\n\tend",
"def insertion(a)\n\tlen = a.length\t\n\tfor i in 0..(len-1) #going through each element\n\t\tfor j in i..0 #elements go from right to left <-\n\t\t\tif a[j-1] > a[j]\n\t\t\t\ttemp = a[j-1]\n\t\t\t\ta[j - 1] = a[j]\n\t\t\t\ta[j] = temp\n\t\t\tend\n\t\tend\n\tend\n\treturn a\n\nend",
"def add_and_return_array(data)\n # Create new array\n days = []\n # Loop through dates\n (1.week.ago.to_date..Date.today).each do |date|\n # Set datetime to beginning of day\n date = date.midnight\n # Push to hash into array\n days << { m: date, a: data[date] }\n end\n # return days as array\n days\n end",
"def position\n [ @row_offset, @col_offset ]\n end",
"def existing\n []\n end",
"def using_insert(array,element)\n array.insert(4,element)\n end",
"def insert_before_multi(range, content); end",
"def insertion_sort(array) \r\narray.each_with_index do |el,i| \r\n j = i - 1 \r\n while j >= 0 \r\n break if array[j] <= el \r\n array[j + 1] = array[j] \r\n j -= 1 \r\n end \r\n array[j + 1] = el \r\nend \r\nend",
"def insertion_sort(array)\t\t\t\t\t\t\t\t\t\t\t\t#This is not my code. I do not understand this code. I tried very hard to understand it but could not.\r\n final = [array[0]]\r\n array.delete_at(0)\r\n # main code\r\n for i in array\r\n final_index = 0\r\n while final_index < final.length\r\n if i <= final[final_index]\r\n final.insert(final_index,i)\r\n break\r\n elsif final_index == final.length-1\r\n final.insert(final_index+1,i)\r\n break\r\n end\r\n final_index+=1\r\n end\r\n end\r\n # output\r\n final\r\nend",
"def to_a\n [value, timestamp]\n end",
"def using_insert(array, element)\n array.insert(4, element)\n end",
"def insertion_sort(array)\n binding.pry\n (1..array.length - 1).each do |n|\n number_to_insert = array[n]\n j = n - 1\n while array[j] > number_to_insert && j >= 0\n array[j + 1] = array[j]\n j -= 1\n end\n array[j + 1] = number_to_insert\n end\n array\nend",
"def offset(*) end",
"def position\n\t\t[ @x, @y ]\n\tend",
"def next_possible_moves\n positions_array = []\n x = @position[0]\n y = @position[1]\n next_position = [x+1,y+2]\n positions_array << next_position if position_check(next_position)\n next_position = [x+1,y-2]\n positions_array << next_position if position_check(next_position)\n next_position = [x-1,y+2]\n positions_array << next_position if position_check(next_position)\n next_position = [x-1,y-2]\n positions_array << next_position if position_check(next_position)\n next_position = [x+2,y+1]\n positions_array << next_position if position_check(next_position)\n next_position = [x+2,y-1]\n positions_array << next_position if position_check(next_position)\n next_position = [x-2,y+1]\n positions_array << next_position if position_check(next_position)\n next_position = [x-2,y-1]\n positions_array << next_position if position_check(next_position)\n positions_array\n end",
"def coordinates\n coordinates = Array.new\n \n coordinates.push self.lat\n coordinates.push self.lng\n \n return coordinates\n end",
"def points\n []\n end",
"def coordinates\n arr = []\n (0...@size).each do |row|\n (0...@size).each do |column|\n arr << Coordinate.new(x: row,y: column)\n end\n end\n arr\n end",
"def insertion_sort(arr)\n\t# variables for holding our two comparisons and the array maker\n\tc = 0\n\td = 1\n\tmark = 1\n\t# repeat unill you are through the whole array\n\twhile mark <= arr.length\n\t# assign the values in arr[c] to a and arr[d] to b\n\ta = arr[c]\n\tb = arr[d]\n\t\t# if they are not in ascending order\n\t\tif a > b\n\t\t\t# if c is 0\n\t\t\tif c == 0\n\t\t\t\t# assign the value of b to arr[c] and the value of a to arr[d]\n\t\t\t\tarr[c] = b\n\t\t\t\tarr[d] = a\n\t\t\t# increase c,d, & e by 1\n\t\t\tc += 1\n\t\t\td += 1\n\t\t\tmark += 1\n\t\t\t# if is is not 0\n\t\t\telse\n\t\t\t\t# assign the value of b to arr[c] and the value of a to arr[d]\n\t\t\t\tarr[c] = b\n\t\t\t\tarr[d] = a\n\t\t\t\t# decriment c and d by 1\n\t\t\t\tc -= 1\n\t\t\t\td -= 1\n\t\t\tend\n\t\t# if they are in ascending order\n\t\telse\n\t\t\t# increase c,d, & e by 1\n\t\t\tc += 1\n\t\t\td += 1\n\t\t\tmark += 1\n\t\tend\n\tend\n\treturn arr\nend",
"def search_insert_position(nums, target)\n\nend",
"def create_copy(arr)\n copy = []\n arr.each { |e| copy.unshift(e) }\n copy\nend",
"def push_elements_into_array(arr, ele)\n arr.push(ele)\n arr\nend"
] | [
"0.57874453",
"0.57719773",
"0.550062",
"0.54866475",
"0.5440545",
"0.54352283",
"0.5366205",
"0.5331532",
"0.5198489",
"0.51765555",
"0.51702535",
"0.515979",
"0.51575434",
"0.5148266",
"0.51380247",
"0.5136711",
"0.5123887",
"0.51232594",
"0.5112809",
"0.50788295",
"0.50757027",
"0.5071524",
"0.5067835",
"0.506691",
"0.50632715",
"0.5059482",
"0.50564545",
"0.5054203",
"0.5048962",
"0.5044962",
"0.5037723",
"0.5035349",
"0.5027929",
"0.5027929",
"0.50234795",
"0.50234795",
"0.50234795",
"0.50234795",
"0.50234795",
"0.5023282",
"0.50122654",
"0.5003361",
"0.4999016",
"0.49987704",
"0.49935892",
"0.49669668",
"0.49627188",
"0.49620977",
"0.49566415",
"0.49549904",
"0.49506012",
"0.4949614",
"0.49445662",
"0.49398234",
"0.49392354",
"0.49327156",
"0.49326935",
"0.49166778",
"0.49021828",
"0.48997185",
"0.4893188",
"0.4887525",
"0.48803467",
"0.487177",
"0.487177",
"0.48706335",
"0.48688373",
"0.48658037",
"0.4864468",
"0.48612002",
"0.48611626",
"0.4859837",
"0.48500335",
"0.48477232",
"0.4845248",
"0.48432595",
"0.48387164",
"0.48363778",
"0.48346406",
"0.4832187",
"0.48304176",
"0.48293397",
"0.48282766",
"0.48263946",
"0.48245806",
"0.4822639",
"0.4822616",
"0.48115575",
"0.48099938",
"0.4798199",
"0.47955552",
"0.4795001",
"0.47845525",
"0.47799975",
"0.47777614",
"0.4776857",
"0.4775387",
"0.47731903",
"0.4763722",
"0.4763626",
"0.47632325"
] | 0.0 | -1 |
POST /events POST /events.xml | def create
self.resource = new_resource
respond_to do |format|
if resource.save
format.html do
flash[:notice] = "#{resource_name.humanize} was successfully created."
redirect_to edit_challenge_attempt_path(resource.challenge, resource)
end
format.js
format.xml { render :xml => resource, :status => :created, :location => resource_url }
else
format.html { render :action => "new" }
format.js { render :action => "new" }
format.xml { render :xml => resource.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n Rails.logger.debug(\"Received event #{params[:event]}\")\n head :ok\n end",
"def create_event event, data={}\n data[:event] = event\n post '/event', data\n end",
"def save_event(event)\n method = (event.id == nil || event.id == '') ? :post : :put\n query_string = (method == :put) ? \"/#{event.id}\" : ''\n @connection.send(Addressable::URI.parse(events_url + query_string), method, event.to_xml)\n end",
"def create\n megam_rest.post_event(to_hash)\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n EventAddedNotifier.created(@event).deliver\n format.html { redirect_to(@event, :notice => 'Event was successfully created.') }\n format.xml { render :xml => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_events\n end",
"def create\n setup_variables\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n flash[:notice] = 'Event was successfully created.'\n format.html { redirect_to(admin_event_path(@event)) }\n format.xml { render :xml => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n if @event.save\n render json: @event, status: :created, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to(@event, :notice => 'Event was successfully created.') }\n format.xml { render :xml => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to(@event, :notice => 'Event was successfully created.') }\n format.xml { render :xml => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to(@event, :notice => 'Event was successfully created.') }\n format.xml { render :xml => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to(@event, :notice => 'Event was successfully created.') }\n format.xml { render :xml => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n puts params[:event]\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to events_path, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n flash[:notice] = 'Event was successfully created.'\n format.html { redirect_to(@event) }\n format.xml { render :xml => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n flash[:notice] = 'Event was successfully created.'\n format.html { redirect_to(@event) }\n format.xml { render :xml => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n flash[:notice] = 'Event was successfully created.'\n format.html { redirect_to(@event) }\n format.xml { render :xml => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n flash[:notice] = 'Event was successfully created.'\n format.html { redirect_to(@event) }\n format.xml { render :xml => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n flash[:notice] = 'Event was successfully created.'\n format.html { redirect_to(@event) }\n format.xml { render :xml => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to(@event, :notice => 'Event was successfully created.') }\n format.xml { render :xml => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @event = IndrelEvent.new(indrel_event_params)\n\n respond_to do |format|\n if @event.save\n flash[:notice] = 'Event was successfully created.'\n format.html { redirect_to(@event) }\n format.xml { render xml: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.xml { render xml: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def record_event(params = {})\n self.class.get('/event/record', params)\n end",
"def create\r\n @event = Event.new(event_params)\r\n convert_timezone @event\r\n event_type_status @event\r\n if @event.save_without_exception\r\n update_theme @event\r\n add_event_categories @event\r\n add_event_location @event\r\n create_group_guest_list @event\r\n add_photos @event\r\n # Create Groups and contacts through CSV\r\n contacts_imports\r\n render json: SuccessResponse.new(\r\n code: 200, message: 'Event Created.', location: '/events/List?id=' + @event.id.to_s, eventID: @event.id\r\n ), adapter: :json, status: :ok\r\n else\r\n render json: ErrorResponse.new, adapter: :json, status: :unprocessable_entity\r\n end\r\n end",
"def save\n event = params\n # This assumes that all keys exists. Yay no error handling...\n toSave = Event.new(update_type: event[:event],\n start_time: event[:payload][:event][:start_time_pretty],\n end_time: event[:payload][:event][:end_time_pretty],\n location: event[:payload][:event][:location],\n invitee_name: event[:payload][:invitee][:name],\n duration: event[:payload][:event_type][:duration],\n event_kind: event[:payload][:event_type][:kind])\n toSave.save\n render json: {}, status: 200\n end",
"def create\n event = Event.new(event_params)\n event.save!\n render json: event\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.json { render :show, status: :created, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.json { render :show, status: :created, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Events::Event.new(event_params)\n respond_to do |format|\n if @event.save\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",
"def create\n \n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, :notice => 'Event was successfully created.' }\n format.json { render :json => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event]) \n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n format.xml do\n render :xml => \"<result>sucess</result>\", :status => :created \n end\n\n \n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n respond_to do |format|\n if @event.save\n track_activity @event\n format.html { redirect_to :back, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n after_event_created_mail @event\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n if @event.save\n head :created\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def create\n params[:event] = convert_datetimes( params[:event] )\n @event = @current_account.events.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event_event = Event::Event.new(params[:event_event])\n\n respond_to do |format|\n if @event_event.save\n format.html { redirect_to @event_event, notice: 'Event was successfully created.' }\n format.json { render json: @event_event, status: :created, location: @event_event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # TODO: this is a bit too hackish, and deals too much with handling attributes\n # -> move to model\n\n attrs = params[:event]\n attrs['location'] = Location.find_by_id_or_build_by_name(attrs['location'],\n attrs['location_id'])\n attrs['date'] = EuropeanDate.to_iso(attrs['date'])\n # attr location already contains loc, so we omit loc_id\n @event = Event.new(attrs.reject { |k,v| k == 'location_id' })\n\n respond_to do |format|\n if @event.save\n flash[:notice] = 'Tapahtuma luotu.'\n format.html { redirect_to events_path }\n # format.xml { render :xml => ... }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @event.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to \"/#{@event.url}\" }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n result = Event::CreateEvent.perform(event_context)\n\n respond_to do |format|\n if result.success?\n @event = result.event\n format.json { render action: 'show', status: :created }\n else\n format.json { render json: { :errors => result.errors.full_messages }, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, :notice => 'Event was successfully created.' }\n format.json { render :json => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_rest\n @page_usage_event = PageUsageEvent.new(params[:page_usage_event])\n\n respond_to do |format|\n if @page_usage_event.save\n flash[:notice] = 'PageUsageEvent was successfully created.'\n format.html { redirect_to(@page_usage_event) }\n format.xml { render :xml => @page_usage_event, :status => :created, :location => @page_usage_event }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @page_usage_event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to events_path, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: events_path(@event) }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @evento = Evento.new(params[:evento])\n\n respond_to do |format|\n if @evento.save\n flash[:notice] = 'Evento was successfully created.'\n format.html { redirect_to(@evento) }\n format.xml { render :xml => @evento, :status => :created, :location => @evento }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @evento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'El evento fue creado exitosamente.' }\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",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: \"You're event has been received. Once approved it will be included in the next mailing.\" }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n flash[:notice] = 'Event was successfully created.'\n format.html { redirect_to([:admin, :canada, @event]) }\n format.xml { render :xml => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n respond_to do |format|\n if @event.save\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",
"def create\n @event = Event.new(event_params)\n respond_to do |format|\n if @event.save\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",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to events_path, 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",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: t(:event_created) }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to events_path, notice: \"Event #{@event} was successfully created.\" }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, success: '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",
"def create\n @event = Event.new(event_params)\n\n if @event.save\n render :show, status: :created, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\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",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\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",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\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",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\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",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\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",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\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",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\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",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\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",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\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",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\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",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\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",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\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",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\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",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\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",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\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",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\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",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\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",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\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",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\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",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\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",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\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",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\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",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\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",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\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",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\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",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\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",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\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",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, flash: {success: '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",
"def create\n @event = Event.new(event_params)\n\n if @event.save\n \tdata = { data: @event, status: :created, message: \"Event was successfully created.\" }\n render :json => data\n else\n \tdata = { data: @event.errors, status: :unprocessable_entity }\n render :json => data\n end\n end",
"def create\r\n @event = Event.new(event_params)\r\n @event.save\r\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Aula cadastrada com sucesso.' }\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",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\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, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\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, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n flash[:success] = \"Event was successfully created.\"\n format.html { redirect_to @event }\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",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, event: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = @member.events.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: '创建成功' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: { message: @event.errors }, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n @event.url = BASE_URL + @event.name.gsub(' ', '_')\n \n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render action: 'show', status: :created, location: @event }\n else\n format.html { render action: 'new' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to new_event_path, 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",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to action: :index, 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",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6938859",
"0.6832928",
"0.6629996",
"0.6572941",
"0.65628463",
"0.64595443",
"0.644994",
"0.6432171",
"0.64178646",
"0.64178646",
"0.64178646",
"0.64178646",
"0.6415361",
"0.6409476",
"0.6409476",
"0.6409476",
"0.6409476",
"0.6409476",
"0.637794",
"0.6374196",
"0.633384",
"0.6307433",
"0.63063586",
"0.6299404",
"0.62923956",
"0.62923956",
"0.62886095",
"0.62618375",
"0.6257976",
"0.6241782",
"0.62316203",
"0.6231454",
"0.6212256",
"0.6200595",
"0.61951303",
"0.6194776",
"0.6176754",
"0.6176712",
"0.6174857",
"0.6172675",
"0.61664474",
"0.61655915",
"0.61570466",
"0.61376786",
"0.61376786",
"0.6134283",
"0.61309135",
"0.612782",
"0.6122845",
"0.61193013",
"0.6114203",
"0.6114203",
"0.6114203",
"0.6114203",
"0.6114203",
"0.6114203",
"0.6114203",
"0.6114203",
"0.6114203",
"0.6114203",
"0.6114203",
"0.6114203",
"0.6114203",
"0.6114203",
"0.6114203",
"0.6114203",
"0.6114203",
"0.6114203",
"0.6114203",
"0.6114203",
"0.6114203",
"0.6114203",
"0.6114203",
"0.6114203",
"0.6114203",
"0.6114203",
"0.6114203",
"0.61126834",
"0.61082745",
"0.6106766",
"0.6104844",
"0.6103146",
"0.6103146",
"0.61015546",
"0.60985756",
"0.60910577",
"0.60899395",
"0.6089661",
"0.6079662",
"0.60780895",
"0.60738915",
"0.60738915",
"0.60738915",
"0.60738915",
"0.60738915",
"0.60738915",
"0.60738915",
"0.60738915",
"0.60738915",
"0.60738915",
"0.60738915"
] | 0.0 | -1 |
PUT /events/1 PUT /events/1.xml | def update
self.resource = find_resource
respond_to do |format|
if resource.update_attributes(params[resource_name])
format.html do
flash[:notice] = "#{resource_name.humanize} was successfully updated."
redirect_to challenge_attempt_path(resource.challenge, resource)
end
format.js
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.js { render :action => "edit" }
format.xml { render :xml => resource.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_event(event)\n method = (event.id == nil || event.id == '') ? :post : :put\n query_string = (method == :put) ? \"/#{event.id}\" : ''\n @connection.send(Addressable::URI.parse(events_url + query_string), method, event.to_xml)\n end",
"def put_events(args)\n\tapi_url = \"#{@base_url}/#{args[:collection]}/#{args[:key]}/events/#{args[:event_type]}\"\n\tputs do_the_put_call( url: api_url, user: @user, json: args[:json] )\nend",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n flash[:notice] = 'Event was successfully updated.'\n format.html { redirect_to(@event) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n flash[:notice] = 'Event was successfully updated.'\n format.html { redirect_to(@event) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n flash[:notice] = 'Event was successfully updated.'\n format.html { redirect_to(@event) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n flash[:notice] = 'Event was successfully updated.'\n format.html { redirect_to(@event) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n flash[:notice] = 'Event was successfully updated.'\n format.html { redirect_to(@event) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n flash[:notice] = 'Event was successfully updated.'\n format.html { redirect_to(@event) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n flash[:notice] = 'Event was successfully updated.'\n format.html { redirect_to(@event) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n flash[:notice] = 'Event was successfully updated.'\n format.html { redirect_to(@event) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to(edit_event_path(@event), :notice => 'Event was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to(@event, :notice => 'Event was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to(@event, :notice => 'Event was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to(@event, :notice => 'Event was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to(@event, :notice => 'Event was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n setup_variables\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n flash[:notice] = 'Event was successfully updated.'\n format.html { redirect_to(admin_event_path(@event)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(event_params)\n format.html { redirect_to(@event, :notice => 'Event was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n update_event_data\n format.html { redirect_to(@event, :notice => 'Event was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\tif @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def update\n @event = Event.find(params[:id])\n#TODO fazer o update event via jquery, retornando rjs\n respond_to do |format|\n if @event.update_attributes(params[:event])\n flash[:notice] = 'Event was successfully updated.'\n format.html { redirect_to(tasks_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n \n @event = @current_user.events.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n flash[:notice] = 'Event was successfully updated.'\n format.html { redirect_to(:root) }\n format.xml { head :ok }\n else\n format.html { render(:event => \"edit\") }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { head :no_content }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\t @events = Event.find(:all)\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html {\n\n flash[:notice] = 'Event was successfully updated.'\n redirect_to \"/admin/events/2010/4\"\n \n }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\r\n @event.update(event_params)\r\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { render :show, status: :ok, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { render :show, status: :ok, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n if @event.update(params[:event])\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def update\n @event = Event.using(:shard_one).find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n\n\n\n end",
"def update\n if @event.update(event_params)\n render json: @event, status: 201\n else\n render json: { message: \"Error. Error. Please try again.\"}, status: 400\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def update_rest\n @page_usage_event = PageUsageEvent.find(params[:id])\n\n respond_to do |format|\n if @page_usage_event.update_attributes(params[:page_usage_event])\n flash[:notice] = 'PageUsageEvent was successfully updated.'\n format.html { redirect_to(@page_usage_event) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @page_usage_event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to([:admin, @event], notice: 'Event was successfully updated.') }\n format.xml { head :ok }\n website.add_log(user: current_user, action: \"Updated event: #{@event.name}\")\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event.update(event_params)\n end",
"def update\n respond_to do |format|\n if @event.update Fenix::Store::Converter::Flattener.event params[:event]\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event.update(event_params) \n end",
"def update\n @event_event = Event::Event.find(params[:id])\n\n respond_to do |format|\n if @event_event.update_attributes(params[:event_event])\n format.html { redirect_to @event_event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n \n @event = Event.find(params[:id])\n\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: t(:event_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n \n end\n end",
"def update\n # @event = Event.find(params[:id])\n\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @event.update(event_params)\n render :show, status: :ok, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @event.update(event_params)\n render :show, status: :ok, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { render json: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event_meta = EventMeta.find(params[:id])\n\n respond_to do |format|\n if @event_meta.update_attributes(params[:event_meta])\n flash[:notice] = 'EventMeta was successfully updated.'\n format.html { redirect_to(@event_meta) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event_meta.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @event.update(event_params)\n\n format.html { redirect_to @event }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @event.update(event_params(params))\n render json: @event, status: 200\n else\n render :json => @event.errors, :status => 422\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n if @event.update(event_params)\n render :show, status: :ok, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n @event.update(status: \"Pending\")\n else\n @reopen = true\n format.json { render json: @event.errors, status: :unprocessable_entity }\n format.html { render :show }\n end\n end\n end",
"def update\n @evento = Evento.find(params[:id])\n respond_to do |format|\n if @evento.update_attributes(params[:evento])\n flash[:notice] = 'Evento was successfully updated.'\n format.html { redirect_to(@evento) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @evento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @event.update(event_params)\n render json: { location: format_event(@event) }\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n @event.save!\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event}\n flash[:success] = \"Event was successfully updated.\"\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @axis_event.update(axis_event_params)\n format.html { redirect_to @axis_event, notice: 'Axis event was successfully updated.' }\n format.json { render :show, status: :ok, location: @axis_event }\n else\n format.html { render :edit }\n format.json { render json: @axis_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, flash: {success: 'Event was successfully created.'} }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @create_event = CreateEvent.find(params[:id])\n\n respond_to do |format|\n if @create_event.update_attributes(params[:create_event])\n format.html { redirect_to @create_event, notice: 'Create event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @create_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html {redirect_to events_path }\n format.xml { head :ok }\n\t\t\t\tformat.js\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n\t\t\t\tformat.js\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { redirect_to @event }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @evento = Evento.find(params[:id])\n\n respond_to do |format|\n if @evento.update_attributes(params[:evento])\n format.html { redirect_to(@evento, :notice => 'Evento was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @evento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @evento = Evento.find(params[:id])\n\n respond_to do |format|\n if @evento.update_attributes(params[:evento])\n format.html { redirect_to(@evento, :notice => t('cambio')) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @evento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n # @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n debugger\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n @event.tags.clear()\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n\n\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to '/', notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html do\n gflash :notice\n redirect_to @event\n end\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.68006223",
"0.66227084",
"0.6586422",
"0.6582029",
"0.6582029",
"0.6582029",
"0.6582029",
"0.6582029",
"0.6582029",
"0.6582029",
"0.6538628",
"0.6528396",
"0.6528396",
"0.6528396",
"0.6528396",
"0.6504651",
"0.64950335",
"0.64886147",
"0.6481964",
"0.6477629",
"0.6464071",
"0.6452036",
"0.6444751",
"0.64445305",
"0.64273465",
"0.64273465",
"0.6421036",
"0.6408289",
"0.63956994",
"0.6383137",
"0.6383137",
"0.6382263",
"0.6376763",
"0.6366921",
"0.6360658",
"0.63419574",
"0.6332709",
"0.63224745",
"0.6297658",
"0.62903327",
"0.62903327",
"0.6281635",
"0.6271169",
"0.62595165",
"0.62544787",
"0.6250515",
"0.6247461",
"0.6247461",
"0.6247461",
"0.6240219",
"0.62338644",
"0.62286377",
"0.6223936",
"0.6221245",
"0.62210834",
"0.6216093",
"0.62095135",
"0.6206554",
"0.6206554",
"0.6206554",
"0.6206554",
"0.6206554",
"0.6206554",
"0.6206554",
"0.6206554",
"0.6201804",
"0.6199105",
"0.6199105",
"0.6199105",
"0.6199105",
"0.6199105",
"0.6199105",
"0.6199105",
"0.6199105",
"0.6199105",
"0.6199105",
"0.6199105",
"0.6199105",
"0.6199105",
"0.6199105",
"0.6199105",
"0.6199105",
"0.6199105",
"0.6199105",
"0.6199105",
"0.6199105",
"0.619516",
"0.6184536",
"0.61808336",
"0.6179439",
"0.61708736",
"0.61653763",
"0.6162454",
"0.61577106",
"0.61559707",
"0.61469",
"0.6140562",
"0.6140562",
"0.6140562",
"0.6140562",
"0.6140562"
] | 0.0 | -1 |
===== ===== ===== ===== ===== | def create_tag_stage
self.tag_stages.create
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def schubert; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def operations; end",
"def operations; end",
"def suivre; end",
"def formation; end",
"def stderrs; end",
"def terpene; end",
"def verdi; end",
"def refutal()\n end",
"def berlioz; end",
"def custom; end",
"def custom; end",
"def trd; end",
"def villian; end",
"def intensifier; end",
"def identify; end",
"def implementation; end",
"def implementation; end",
"def weber; end",
"def operation; end",
"def who_we_are\r\n end",
"def r; end",
"def r; end",
"def bs; end",
"def malts; end",
"def isolated; end",
"def isolated; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def internal; end",
"def extra; end",
"def hd\n \n end",
"def anchored; end",
"def zuruecksetzen()\n end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def transformations; end",
"def tld; end",
"def tld; end",
"def handle; end",
"def guct\n end",
"def dh; end",
"def processor; end",
"def wrapper; end",
"def apply\n\t\t\n\tend",
"def apply\n\t\t\n\tend",
"def offences_by; end",
"def celebration; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def relatorios\n end",
"def sitemaps; end",
"def blg; end",
"def initialize\n\t\t\n\tend",
"def returns; end",
"def parslet; end",
"def parslet; end",
"def parslet; end",
"def parslet; end",
"def rossini; end",
"def flags; end",
"def feruchemist; end",
"def code_of_conduct; end",
"def eplore\n end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end"
] | [
"0.7783363",
"0.71039706",
"0.6781318",
"0.665193",
"0.665193",
"0.665193",
"0.665193",
"0.66294456",
"0.66294456",
"0.65280795",
"0.6499372",
"0.64624846",
"0.64504683",
"0.63405323",
"0.6339505",
"0.6308749",
"0.63046265",
"0.63046265",
"0.63043773",
"0.62257403",
"0.62083846",
"0.6203696",
"0.6186835",
"0.6186835",
"0.61582255",
"0.6133213",
"0.6125722",
"0.6077327",
"0.6077327",
"0.60717595",
"0.6059884",
"0.60357726",
"0.60357726",
"0.603485",
"0.603485",
"0.603485",
"0.603485",
"0.603485",
"0.603485",
"0.603485",
"0.603485",
"0.603485",
"0.6025695",
"0.6025695",
"0.6025695",
"0.6025695",
"0.5996232",
"0.59951097",
"0.5979228",
"0.59573364",
"0.59444267",
"0.5933282",
"0.5933282",
"0.5933282",
"0.5933282",
"0.5933282",
"0.5933282",
"0.5933282",
"0.5933282",
"0.5932614",
"0.59304655",
"0.59304655",
"0.5919924",
"0.5918447",
"0.5908908",
"0.5894821",
"0.5894746",
"0.58909273",
"0.58909273",
"0.5889198",
"0.58799",
"0.5868347",
"0.5868347",
"0.5868347",
"0.5868347",
"0.5868347",
"0.5868347",
"0.5868347",
"0.5868347",
"0.58573776",
"0.5850196",
"0.5845306",
"0.58326286",
"0.5825213",
"0.582066",
"0.582066",
"0.582066",
"0.582066",
"0.5817779",
"0.58058137",
"0.5802785",
"0.579791",
"0.5797783",
"0.57920563",
"0.57920563",
"0.57920563",
"0.57920563",
"0.57920563",
"0.57920563",
"0.57920563",
"0.57920563"
] | 0.0 | -1 |
Determine if there is a chapter after the current page | def next_chapter_path
return false unless current_page.is_a? Book::Chapter
current_page.next_chapter
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_chapter?()\n end",
"def whole_chapter?\n starting_bibleverse.verse.zero?\n end",
"def end_of_chapter\n end",
"def whole_book?\n starting_bibleverse.chapter.zero?\n end",
"def chapters?\n !chapters.empty?\n end",
"def last_page?; ! @doc.has_key? 'next' end",
"def last?\n event.user.chapters.ascending.last == self\n end",
"def has_single_chapter?(reference)\n fail NotImplementedError, \"You must override #has_single_chapter? in your language class.\"\n end",
"def chapter_valid?(chapter)\n chapter.positive? && chapter <= nr_of_chapters\n end",
"def completed?(chapter)\n chapters_completed.include? chapter\n end",
"def previous_page?\n page > 1\n end",
"def more?\n @current < @pages\n end",
"def first?\n event.user.chapters.ascending.first == self\n end",
"def last_page?\n current_page == pages.end\n end",
"def has_previous_page?\n @current_page != 1\n end",
"def previous?\n return @page > 1\n end",
"def chapter_link(book_id, book, starting, jump)\n min_chapter = book[\"prelude\"] ? 0 : 1\n total_chapters = book[\"chapters\"]\n go_to_chapter = starting.to_i + jump\n is_chapter = (go_to_chapter <= total_chapters) && (go_to_chapter >= min_chapter)\n if is_chapter\n return visual_chapter_path(book_id, go_to_chapter)\n elsif jump > 0\n # if you were headed forward but can't get there just go to last chapter\n return visual_chapter_path(book_id, total_chapters)\n else\n # if you were headed backwards but can't get there just go to the first\n return visual_chapter_path(book_id, 1)\n end\n end",
"def one_verse?\n same_chapter? && same_verse?\n end",
"def has_previous?\n return self.current_page != 1 && self.total_pages > 1\n end",
"def last_page?\n current_page == total_pages - 1\n end",
"def last_page?\n return true if total_pages < 1\n return (page == total_pages)\n end",
"def prev?\n current_page > 1\n end",
"def last_page?\n !next_page_url\n end",
"def next_page?\n page.zero? || page < total_pages\n end",
"def last_page?\n return true\n # hack to remove this call so we don't do any counting\n #current_page >= total_pages\n end",
"def has_previous_part?\n index = part_index(current_part.slug)\n !! (index && index > 0)\n end",
"def last_page?\n page == total_pages\n end",
"def is_first_page?\n p_index.to_i == 1\n end",
"def last_page?\n current_page >= num_pages\n end",
"def has_next_page\n @agent.page.links.find { |l| l.text == \"Next →\" } == nil ? false : true\n end",
"def chapter_link(link, prep_display = '')\n get_chapter_from_link(link, prep_display, '.html') do |page|\n page.xpath('//div[@class=\"l\"]').text.split.last.to_i\n end\n end",
"def last_page?\n current_page >= num_pages\n end",
"def last_page?\n current_page >= num_pages\n end",
"def has_previous_page\n if last\n paged_nodes.length >= last\n else\n false\n end\n end",
"def next?\n return @pages > @page\n end",
"def has_next?\n return self.current_page != self.total_pages && self.total_pages > 1\n end",
"def last?\n\t locate == self.comic.live_pages.length\n\tend",
"def next_page?\n page_number < last_page_number\n end",
"def has_previous_page\n @agent.page.links.find { |l| l.text == \"← Previous\" } == nil ? false : true\n end",
"def next?\n current_page < total_pages\n end",
"def last_page?\n current_page == total_pages\n end",
"def prev_page?\n page_number > first_page_number\n end",
"def first_page?\n current_page == pages.begin\n end",
"def last_page?\n page_number < last_page_number\n end",
"def first_page?\n page == 1\n end",
"def has_next_page?\n @current_page < page_count\n end",
"def current_is_last_page?\n @current_page.next_page == 0\n end",
"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",
"def last_page?\n current_page_number == total_pages\n end",
"def begin_next_chapter\n if self.books[0].cur_chapter<chapters\n for book in self.books do\n book.begin_next_chapter\n end\n end\n self.reload\n assign_chapters(self.books, self.writers, 0)\n end",
"def next_page?\n !next_page_number.nil?\n end",
"def has_next_page\n if first\n paged_nodes.length >= first\n else\n false\n end\n end",
"def current?(page)\n @current == page\n end",
"def first_page?\n current_page == 0\n end",
"def last_page?\n !out_of_bounds? && next_page.nil?\n end",
"def next_page?\n @page.next_page_token?\n end",
"def previous_page?\n !previous_page_number.nil?\n end",
"def first_page?\n current_page == 1\n end",
"def first_page?\n current_page == 1\n end",
"def next_page?\n !!fetch[\"next_page\"]\n end",
"def on_page?\n raise NotImplementedError, \"implement me, e.g. using #has_title?\"\n end",
"def first_page?\n current_page == 1\n end",
"def first_page?\n current_page == 1\n end",
"def first_page?\n current_page == 1\n end",
"def first_page?\n current_page == 1\n end",
"def next_page?\n !next_page_link.nil?\n end",
"def add_to_path?(current_goods_nomenclature, previous_goods_nomenclature)\n current_goods_nomenclature.number_indents > previous_goods_nomenclature.number_indents ||\n previous_goods_nomenclature.chapter? && current_goods_nomenclature.heading?\n end",
"def first_page_in_class?\n @current_class == \"Druid\" ? false : @cards.current_page == 1\n end",
"def last_page?\n\t\t\t!next_page_url if paginated?\n\t\tend",
"def chapter_available?(chapter)\n return false if licensed?\n @chapters.key?(chapter)\n end",
"def page_active? page\n @breadcrumb ||= breadcrumb(@page)\n @breadcrumb.include? page\n end",
"def last_page?\n current_page == page_count\n end",
"def load_chapter\n end",
"def test_transition_open_to_writing?\n if self.chapters > self.writers.length then\n return false\n else\n return true\n end\n end",
"def possible_chapter(toks, toksnp, tokslcnp, idx)\n if @possible_chapter\n @possible_chapter\n else\n @possible_chapter =\n ((possible_editor(toks, toksnp, tokslcnp, idx) and\n (toks.join(\" \") =~ /[\\.,;]\\s*in[:\\s]/i)) ?\n \"possibleChapter\" : \"noChapter\")\n end\n end",
"def page?\n !!self.page_id\n end",
"def current_page?(url); end",
"def online_chapter\n if @chapter.nil?\n return\n end\n redirect_to sections_path unless (current_user.sk.admin? || @chapter.online)\n end",
"def last_page?\n last_page_number.nil?\n end",
"def test_more_chapters\n Republic::DirBinder.write(Republic::Book.new { |b|\n b << Republic::HtmlChapter.new { |c| \n c.text = \"<p>This is chapter 1</p>\"\n }\n b << Republic::HtmlChapter.new { |c| \n c.text = \"<p>This is chapter 2</p>\"\n }\n b << Republic::HtmlChapter.new { |c| \n c.text = \"<p>This is chapter 3</p>\"\n }\n }, TEST_DIR + \"/book2\")\n\n assert File.file?(TEST_DIR + \"/book2/chap0000.xhtml\"), \"First chapter present\"\n assert File.file?(TEST_DIR + \"/book2/chap0001.xhtml\"), \"Second chapter present\"\n assert File.file?(TEST_DIR + \"/book2/chap0002.xhtml\"), \"Third chapter present\"\n\n assert_match /.*This is chapter 1.*/, IO.read(TEST_DIR + \"/book2/chap0000.xhtml\")\n assert_match /.*This is chapter 2.*/, IO.read(TEST_DIR + \"/book2/chap0001.xhtml\")\n assert_match /.*This is chapter 3.*/, IO.read(TEST_DIR + \"/book2/chap0002.xhtml\")\n end",
"def first_page?\n page_number > first_page_number\n end",
"def ending\n # If there's a next chapter, return that timestamp\n # Else, if there's an event, but it's before the end of this chapter, return the timestamp of this chapter\n # Else return the timestamp of the user's last event\n if self.next\n self.next.beginning\n else\n Time.now + 1.hour\n end\n end",
"def current_page?(page)\n @current_page == page\n end",
"def find_page_end\n \n end",
"def previous_page?\n !previous_page_link.nil?\n end",
"def has_next_page?\n !@raw_page['nextRecordsUrl'].nil?\n end",
"def nextChapter\n @project = Project.find(params[:id])\n if @currentUser.id == 1 or @currentUser==@project.owner\n @project.begin_next_chapter\n @page_title = @project.name\n else\n flash[:notice]=\"Error. You do not have the power to do that.\"\n end\n\n redirect_to :action => \"individualProject\", :id => params[:id]\n end",
"def next_page?\n !next_page_token.nil? && !next_page_token.empty?\n end",
"def is_before_last?(elt)\n self[self.size - 2][:page].url == elt.url or self[self.size - 2][:driver].popup_name == elt.popup_name\n end",
"def aria_current?(url)\n return 'page' if current_page?(url)\n end",
"def more_pages?\n return false if start_index == 0\n (self.start_index + self.page_length) -1 < self.total_result_count\n end",
"def first_page?\n\t\t\t!prev_page_url if paginated?\n\t\tend",
"def chapter_title(item) # rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity\n title = \"\"\n chapter_href = item.attributes[\"href\"].text || \"\"\n if chapter_href.present?\n nav_tocs = @doc.xpath(\"//nav[@type='toc']\")\n ::EPub.logger.info(\"Warning: Missing nav type toc node\") if nav_tocs.empty?\n ::EPub.logger.info(\"Warning: Multiple nav type toc nodes!\") if nav_tocs.length != 1\n nav_tocs.each do |nav_toc|\n title = nav_toc.xpath(\"//a[@href='#{chapter_href}']\").text\n\n # Many more ifs will come to infest this space...\n if title.blank?\n base_href = File.basename(chapter_href)\n title = nav_toc.xpath(\"//a[@href='#{base_href}']\").text\n end\n\n if title.blank?\n upone_href = \"../\" + chapter_href\n title = nav_toc.xpath(\"//a[@href='#{upone_href}']\").text\n end\n\n break # use the first found toc only!\n end\n end\n ::EPub.logger.info(\"Can't find chapter title for #{chapter_href}\") if title.blank?\n title\n end",
"def more?\n all_contents[next_offset].present?\n end",
"def assert_not_first_page\n assert_link PREV_LABEL\n end",
"def assert_last_page\n assert_no_link NEXT_LABEL\n end",
"def chapter_title\n self.part_title_by_type('Chapter')\n end",
"def part_of_head?\n return true if self.position == 0\n begin\n if self.nominal?\n # there are no non-nominal segments between given\n # segment and the beginning of its spelling\n gap = false\n self.spelling.segments.each do |prev_segment|\n break if prev_segment == self\n gap = true if !prev_segment.nominal?\n end\n !gap\n end\n rescue Exception => ex\n #puts ex\n false\n end\n end",
"def compute_chapter\n unless Article.published.blank?\n Article.published.reverse.index(self) + 1\n end\n end",
"def page_title?\n @_page_title.present?\n end"
] | [
"0.72224975",
"0.70645046",
"0.697479",
"0.65666264",
"0.6426701",
"0.63711345",
"0.63204855",
"0.6284475",
"0.6268844",
"0.62505114",
"0.6212323",
"0.6190456",
"0.615414",
"0.6149218",
"0.6134336",
"0.6120063",
"0.60991955",
"0.6035204",
"0.6030053",
"0.6027291",
"0.6017554",
"0.601464",
"0.6013607",
"0.6005899",
"0.6003739",
"0.5992355",
"0.5989842",
"0.59723717",
"0.59686065",
"0.5966331",
"0.5963774",
"0.596019",
"0.596019",
"0.59441125",
"0.59410214",
"0.5927223",
"0.59095323",
"0.590451",
"0.59044427",
"0.5901152",
"0.58963275",
"0.5887664",
"0.5866326",
"0.5855687",
"0.5855029",
"0.5850077",
"0.5829976",
"0.5822221",
"0.58202285",
"0.5810972",
"0.5791162",
"0.57842845",
"0.57734406",
"0.5766926",
"0.5743701",
"0.57394755",
"0.5727559",
"0.5709999",
"0.5709999",
"0.57043827",
"0.57025176",
"0.5698395",
"0.5698395",
"0.5698395",
"0.5698395",
"0.56972575",
"0.5683805",
"0.56807154",
"0.5674147",
"0.56728274",
"0.5667087",
"0.56627774",
"0.5658927",
"0.5640687",
"0.56289816",
"0.56027204",
"0.5593928",
"0.5578062",
"0.5577253",
"0.55755746",
"0.55656874",
"0.556281",
"0.5551957",
"0.5549997",
"0.5537016",
"0.5529378",
"0.5528315",
"0.55221564",
"0.5519767",
"0.55069566",
"0.5498044",
"0.54905546",
"0.5485198",
"0.5484421",
"0.54835504",
"0.5478511",
"0.54722464",
"0.5469609",
"0.54682153",
"0.5463808"
] | 0.7099606 | 1 |
return 0 where are you inserting values in into the hash? | def first_uniq_char(s)
hash = Hash.new
s.each_char do |i|
if hash.has_key?(i)
hash[i] += 1
else
hash[i] = 1
end
end
hash.each do |k,v|
return s.index(k) if v == 1
end
return -1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n 0\n end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() #:nodoc:\n prime = 31;\n result = 1;\n result = prime * result + @amount.to_i\n result = prime * result + @new_balance.to_i\n result = prime * result + (@date.nil? ? 0 : Bankjob.date_time_to_ofx(@date).hash);\n result = prime * result + (@raw_description.nil? ? 0 : @raw_description.hash);\n result = prime * result + (@type.nil? ? 0 : @type.hash);\n # don't use value date\n return result;\n end",
"def hash\n @symbols.hash + 37*positive?.hash\n end",
"def hash\n return super unless has_size?\n\n res = 0\n each do |el|\n res += el.hash\n end\n return res\n end",
"def hash\r\n a = 0\r\n @id.each_byte {|c| a += c.to_i}\r\n (a + @paired.to_i) * HASH_PRIME\r\n end",
"def hash(*) end",
"def checkSum\n h = Hash.new\n # get the counts of each character\n (0..@value.length - 1).each do |idx|\n char = @value[idx]\n h[char] = h.fetch(char,0) + 1\n end\n h.delete(\"-\")\n h.sort_by{|k,v| [-v,k]}.to_h.keys.join[0..4]\n end",
"def chkall\n (1..@@pow2_N).to_a.each do |i|\n h = sha32b(\"#{i}\")\n @allhash[h] = 0 if !@allhash[h]\n @allhash[h] += 1\n end\n @allhash.size\n end",
"def hash\n @hash || @hash = (value.hash * -1)\n end",
"def hash\n num = 0\n self.each do |k,v|\n if k.is_a?(Integer) && v.is_a?(Integer)\n num += k * 26 + v\n elsif k.is_a?(Integer) && !v.is_a?(Integer)\n num += k * 26 + ALPHA_NUMBERS[v.to_s.downcase]\n elsif v.is_a?(Integer) && !k.is_a?(Integer)\n num += v * 26 + ALPHA_NUMBERS[k.to_s.downcase]\n elsif !k.nil? && !v.nil?\n num += ALPHA_NUMBERS[k.to_s.downcase] * ALPHA_NUMBERS[v.to_s.downcase]\n end\n end\n num\n end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash_code; end",
"def calcIt\n a = [\"1\",\"5\",\"2\",\"3\",\"4\"]\n h = Hash.new(0)\n a.each do |v|\n h[v] += 1\n end\n h\n end",
"def hash\n @points.inject(0) { |sum, point| sum += point.x + point.y }\n end",
"def testHash(a)\n\n\t\tunless @mem_hash.has_key?(a)\n\t\t\t@mem_hash[a] = @next_empty\n\t\t\t@next_empty += 1\n\t\tend\n\t\ttoBin15 @mem_hash[a].to_i\n\n\tend",
"def hash\n excl = @excl ? 1 : 0\n hash = excl\n hash ^= @begin.hash << 1\n hash ^= @end.hash << 9\n hash ^= excl << 24;\n # Are we throwing away too much here for a good hash value distribution?\n return hash & Fixnum::MAX\n end",
"def hash()\n #This is a stub, used for indexing\n end",
"def hash_to_id(h,i)\n\tif h[i] == 0\n\t\th[i] = h.size+1\n\tend\n\th[i]\nend",
"def size\n return @hash.length\n end",
"def hash\n @hash || calculate_hash!\n end",
"def calcular_total hash\n p hash.inject(0) { |sum, tuple| sum += tuple[1] }\n end",
"def hash\n code = 17\n code = 37*code + @x.hash\n code = 37*code + @y.hash\n # Add lines like this for each significant instance variable\n code # Return the resulting code\n end",
"def hash\n num = @high << 64\n num |= @low\n num.hash\n end",
"def hash=(_arg0); end",
"def hash_sum\n total = 0\n places_hash.each do |k, v|\n total = total + v\n end\n return total\nend",
"def hash\n h = @e.nil? ? 0 : @e\n h = (h << 1) ^ @r.hash\n h = (h << 1) ^ @v.hash\n end",
"def hash_sum(hash)\n return 0 if hash.empty?\n hash.values.inject(&:+)\nend",
"def add(hash); end",
"def occurences_count\n\t\t\t\t\t\tHash.new(0).tap do |result|\n\t\t\t\t\t\t each { |item| result[item] += 1 }\n\t\t\t\t\t\tend\n\t\t\t\tend",
"def value_count(hash, value)\n count = 0\n hash.each { |elem| count += 1 if elem[1]==value }\n count\nend",
"def hash; map{|el| \"#{el.name} @ #{el.hash}\"}; map(&:hash).reduce(:+) % 2**32; end",
"def hash_length\n super\n end",
"def status\n if @item_count === 0.0\n puts \"There are no entries in this hash.\"\n puts \"Load Factor for hash is 0.\"\n else\n @items.each do |pair|\n unless pair.nil?\n index = self.index(pair.key, @items.length)\n puts \"Entry #{pair} is located at Index #{index} and has a value of \" + \"\\\"\" + \"#{pair.value}\" + \"\\\"\" + \".\"\n end\n end\n puts \"Load Factor for hash is #{@item_count / @items.length}.\"\n end\n end",
"def hash_data_add(hash, key)\n if hash.has_key?(key)\n hash[key] = hash[key] + 1\n else \n hash[key] = 1\n end\n end",
"def size\n @hash.size + @converted.size\n end",
"def status\n if @item_count === 0.0\n puts \"There are no entries in this hash.\"\n puts \"Load Factor for hash is 0.\"\n else\n @items.each do |ll|\n unless ll.nil?\n current = ll.head\n index = self.index(current.key, @items.length)\n until current.nil?\n puts \"Entry #{current} is located at Index #{index} and has a value of \" + \"\\\"\" + \"#{current.value}\" + \"\\\"\" + \".\"\n current = current.next\n end\n end\n end\n puts \"Load Factor for hash is #{@item_count / @items.length}.\"\n end\n end",
"def hash\n # Memoizing such a simple hash value seems silly, however the\n # profiler showed the Card#hash method as having 22% of the runtime. My\n # memoizing the hash value that was reduced to 12%.\n return @hash unless @hash.nil?\n @hash = @value.hash ^ @suit.hash\n end",
"def hash\n value = 0\n my_rows = @rows\n r_size = my_rows.size\n for i in 0..r_size-1 do\n a_row = my_rows[i]\n a_size = a_row.size\n for j in 0..a_size-1 do\n value ^= a_row[j].hash\n end\n end\n return value\n end",
"def hash_code\n prime = 31\n result = 1\n result = prime * result + x\n result = prime * result + y\n return result;\n end",
"def hash() source.hash ^ (target.hash+1); end",
"def hash() source.hash ^ (target.hash+1); end",
"def hash\n prime = 31\n result = 1\n result = result * prime + (@decision_target == nil ? 0 : @decision_target.hash)\n result = prime * result + (@string_id == nil ? 0 : @string_id.hash)\n result\n end",
"def size\n @hash.size\n end",
"def size\n @hash.size\n end",
"def size\n @hash.size\n end",
"def length\n hash.keys.length\n end",
"def hash\n @hash ||= begin\n result = 17\n result = 31 * result + self.class.hash\n result = 31 * result + ord\n result.is_a?(Fixnum) ? result : result.hash\n end\n end",
"def hash\n @hash ||= begin\n result = 17\n result = 31 * result + self.class.hash\n result = 31 * result + ord\n result.is_a?(Fixnum) ? result : result.hash\n end\n end",
"def key_for_min_value(hash)\n aa = 1000000000\n i = nil\n hash.each do |key, value|\n if value <= aa\n aa = value\n i = key\n end\n end\n return i\nend",
"def hash_map_two_sum(arr,target_sum)\n count = {}\n arr.each do |ele|\n count[ele] = true\n return true if count[target_sum - ele] \n \n end\n false\nend",
"def food_stand(hash)\n sum = 0\n hash.each do |k, v|\n # hash[k] = v\n sum += v\n end\n return sum\nend",
"def total_students( students_hash)\n st_counter =0\n students_hash.each do |key,value|\n st_counter += value\n #puts (\"#{key}: #{value} students\")\n end\n return st_counter\nend",
"def hash\n @vector\n end",
"def update_counting_hash(hash, key)\n hash[key] ? hash[key] += 1 : hash[key] = 1\n hash\nend",
"def hashcode_with_internal_hashes(key)\n h, full_hs = phf_with_hashes(key)\n if @g[h] == @r\n return NON_KEY, full_hs # no key\n end\n a, b = h.divmod(RANK_SUPERBLOCKSIZE)\n if a == 0\n result = 0\n else\n result = @rs[a-1]\n end\n b, c = b.divmod(RANK_BLOCKSIZE)\n if b != 0\n result += @rb[a*(RANK_SUPERBLOCKSIZE/RANK_BLOCKSIZE-1)+b-1]\n end\n (h-c).upto(h-1) {|i|\n result += 1 if @g[i] != @r\n }\n return result, full_hs\n end",
"def hash\n values.hash ^ known_data.hash\n end",
"def length\n return @ghash.length\n end",
"def hash_code\n hash_code = {}\n self.seq.each do |letter|\n hash_code.keys.include?(letter) ? hash_code[letter] += 1 : hash_code[letter] = 1\n end\n hash_code\n end",
"def hash\n @vbits.hash\n end",
"def hash\n shasum.hash\n end",
"def hash\n shasum.hash\n end",
"def hash\n shasum.hash\n end",
"def calculate_values_hashes\n @values_hashes || recalculate_values_hashes\n end",
"def solution(x,a)\n counter_hash = {}\n a.each_with_index do |value, index|\n counter_hash[value] = true\n return index if counter_hash.size == x\n end\n -1\nend",
"def test_many\n result_hash={}\n 1000.times do\n x = square_same_color?(random_chess_board_square, random_chess_board_square)\n result_hash[x] ? result_hash[x] += 1 : result_hash[x] = 1\n end\n p result_hash\nend",
"def hash(key); end",
"def hash_set_up\n Hash.new { |hash, key| hash[key] = Array.new(1) { 0 } }\n end",
"def update_counting_hash(hash, key)\n if hash[key] \n hash[key] += 1\n else\n hash[key] = 1\n end\n hash\nend",
"def hash()\n #This is a stub, used for indexing\nend",
"def calculate_hash!\n prefix = PREFIX_NAME_LOOKUP[self.type]\n # add special cases for refs\n self.hash_id = NodeId.sha1(\"#{prefix} #{self.size}\\0#{self.content}\")\n end",
"def incorrect_hash(arr)\nincorrectStats = {}\narr.each do |q|\nif incorrectStats[q.question_id]\n incorrectStats[q.question_id] = incorrectStats[q.question_id] + 1\nelse \n incorrectStats[q.question_id] = 1\nend\nend\nincorrectStats\nend",
"def num_keys\n end",
"def hash\n size.hash ^ rank.hash\n end",
"def mayor_venta(hashito)\n aux = 0\n hashito.each_value do |value|\n aux = value if aux < value\n end\n puts aux\nend",
"def single_number(nums)\n hash = Hash.new(0)\n nums.each do |val|\n if nums.include?val \n hash[val] += 1\n end\n end\n p hash.keys\nend",
"def count(r)\n c = Hash.new(0)\n r.each { |z| c[z] += 1}\n c\nend",
"def hash\n end",
"def hash\n end",
"def hash\n end",
"def index\n Dictionary.db.zrank(@key, @value).to_i\n end",
"def hash\n @rank.hash ^ @suit.hash\n end",
"def hash\n [host_list, total_matching, total_returned].hash\n end",
"def hashed_coord(x, y)\n num = 0\n num += 65536 if x < 0\n num += 65536 * y\n num += x\n num\nend",
"def inject_total(unique_values, &block)\n unique_values.inject(0) do |total, num|\n n_in_code = count_hits(num, secret_code)\n n_in_guess = count_hits(num, guess)\n total += block.call(n_in_code, n_in_guess)\n end\nend",
"def cost( source, dest )\n return 0 if source.nil?\n return 0 if @seen_keys.include?( source )\n\n @seen_keys << source\n return 1\n end"
] | [
"0.72909075",
"0.66508615",
"0.66508615",
"0.66508615",
"0.66508615",
"0.66508615",
"0.66508615",
"0.66508615",
"0.65098673",
"0.64389193",
"0.63296735",
"0.6272316",
"0.62533224",
"0.6248042",
"0.6236307",
"0.62136334",
"0.6212024",
"0.6177703",
"0.6177703",
"0.6177703",
"0.6177703",
"0.6177703",
"0.6177703",
"0.6177703",
"0.6177703",
"0.6177703",
"0.6177703",
"0.6103273",
"0.6097993",
"0.6095998",
"0.60776436",
"0.60764945",
"0.6075065",
"0.59886754",
"0.5972635",
"0.59702086",
"0.59662974",
"0.59489614",
"0.5942607",
"0.594033",
"0.58860457",
"0.5868664",
"0.58542484",
"0.5852595",
"0.58514726",
"0.5823164",
"0.58229053",
"0.5814556",
"0.57930803",
"0.5782709",
"0.57823074",
"0.5758761",
"0.57577133",
"0.57571703",
"0.5755507",
"0.5747079",
"0.5747079",
"0.57468295",
"0.5735863",
"0.5735863",
"0.5735863",
"0.57346267",
"0.57244456",
"0.57244456",
"0.5706239",
"0.5694187",
"0.5693611",
"0.56905997",
"0.56716514",
"0.5670732",
"0.56683356",
"0.56657016",
"0.5653258",
"0.56477654",
"0.5647231",
"0.5645795",
"0.5645795",
"0.5645795",
"0.5642275",
"0.5636051",
"0.56345946",
"0.5632069",
"0.5622048",
"0.5612768",
"0.5608319",
"0.5590438",
"0.5586404",
"0.558027",
"0.55794626",
"0.55663925",
"0.5557805",
"0.55568755",
"0.5556228",
"0.5556228",
"0.5556228",
"0.5551221",
"0.5532133",
"0.553053",
"0.5527753",
"0.5527335",
"0.5523344"
] | 0.0 | -1 |
Returns a string representing a null value. | def inspect
'null'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_value_to_null(_value)\n 'null'\n end",
"def process_nil(exp)\n return \"NULL\"\n end",
"def to_s\n res = \"\"\n self.each {|current| res << \" ( #{current.data} ) -> \" }\n res << \"nil\"\n end",
"def nil \n \"nil\" \n end",
"def inspect\n nil? ? 'nil' : \":#{to_s}\"\n end",
"def convert_nillable_string(value, definition)\n value == '-' ? nil : value\n end",
"def process_nil(exp)\n return \"Qnil\"\n end",
"def to_s\n NA\n end",
"def displayNull \n \"displayNull\" \n end",
"def convert_nillable_string(value, _definition)\n value == '-' ? nil : value\n end",
"def to_s (o)\n o ? o.to_s : nil\n end",
"def to_s; nil; end",
"def replace_nil\n lambda { |val| val.nil? ? 'NULL' : val }\n end",
"def set_null(params)\n params == \"NA\" ? \"null\" : params\n end",
"def replace_null(value)\n return 'U' if value.nil?\n\n value\nend",
"def to_s\n \"{#{map(&method(:format_value_or_null)).join(\",\")}}\"\n end",
"def val_s(val)\n emptyval?(val) ? EMPTYVAL : val.to_s\n end",
"def null \n return @raw.null \n end",
"def to_s\n (value.zero?) ? '' : \"#{value}#{symbol}\"\n end",
"def write_nil\n end",
"def to_s\n str = ''\n temp = @head\n while temp\n str << \"( #{temp.value} ) -> \"\n temp = temp.next_node\n end\n str << 'nil'\n end",
"def to_s\n unknown? ? 'x' : @value.to_s\n end",
"def sql_null_to_blank\n self.map {|v| \"IFNULL(#{v}, '')\" }\n end",
"def to_s\n value.zero? ? '' : \"#{value}#{symbol}\"\n end",
"def to_s\n \"\"\n end",
"def to_s\n if @value.nil?\n \"<#{@type.inspect}>\"\n else\n \"<#{@type.inspect}, #{@value.inspect}>\"\n end\n end",
"def void_string(*args)\n return nil.to_s\n end",
"def s_str(value=nil)\n if value.nil? or value.size == 0\n return s(:nil)\n else\n return s(:str, value.to_s)\n end\n end",
"def to_s\n nil? ? '' : super\n end",
"def dump(val)\n (val || default).to_s\n end",
"def to_s\n \"\"\n end",
"def to_s\n \"\"\n end",
"def to_s\n ''\n end",
"def to_s\n ''\n end",
"def to_s\n ''\n end",
"def concat_null(fields) # :nodoc:\n @concat.gsub(/\\%s/, subs(@nul, fields).join(','))\n end",
"def singleq2null\n self.gsub(\"'\", '%00%27')\n end",
"def write_null\n\t\twrite_byte(5)\n\tend",
"def objNull \n \"objNull\" \n end",
"def null\n Sass::Script::Value::Null.new\n end",
"def null_or_value(value)\n return \"NULL\" if value.empty?\n # Escape any single quotes to encure values returned do not not cause\n # issues with the SQL insert statement\n return \"'#{value.gsub(\"'\", \"\\\\\\\\'\")}'\"\nend",
"def to_s\n\t\t\"\"\n\tend",
"def to_s\n return \"-> nil\" if @head == nil\n\n node = @head\n\n string = \"\"\n until node.next_node.nil?\n string << \"( #{node.value} ) -> \"\n node = node.next_node\n end\n\n string << \"( #{@tail.value} ) -> nil\"\n\n string\n end",
"def write_attr_integer(value)\n value.to_s.empty? ? 'NULL' : value.to_s\n end",
"def c_str(name, value=nil, options={})\n\t\tfield(name, Str, value, {:action=>action(NullTerminate)}.merge(options))\n\tend",
"def default_value\n default_db_value ? default_db_value.to_s : \"null\"\n end",
"def netrc_nil(value = nil)\n\t\t\tif value && value != \"\"\n\t\t\t\tif value == \"nothing-here\"\n\t\t\t\t\treturn nil\n\t\t\t\telse\n\t\t\t\t\treturn value\n\t\t\t\tend\n\t\t\telse\n\t\t\t\treturn \"nothing-here\"\n\t\t\tend\n\t\tend",
"def to_s(obj = T.unsafe(nil)); end",
"def transform_empty_to_nil stringVal\n stringVal = nil unless stringVal.nil? || stringVal.length > 0\n stringVal\n end",
"def to_s\n \"#{@value}\"\n end",
"def to_s\n nil.to_s if head.nil?\n\n curr = head\n str = String.new\n until curr.nil?\n str << '( ' << curr.value.to_s << ' )' << ' -> '\n curr = curr.next\n end\n str << 'nil'\n str\n end",
"def null_value\n match = /((\\w*) NULL)/i.match(definition)\n return true unless match\n\n match[2].downcase == 'not' ? false : true\n end",
"def to_s\n if z\n \"<#{x ? x : 'nil'}, #{y ? y : 'nil'}, #{z}>\"\n else\n \"<#{x ? x : 'nil'}, #{y ? y : 'nil'}>\"\n end\n end",
"def if_nil(argument)\n if argument == nil \n \"\"\n else\n argument\n end\n end",
"def to_s\n results = ''\n current_node = @head\n counter = 0\n until current_node.nil?\n results += \" ( #{current_node.value} ) -> \"\n current_node = current_node.next_node\n counter += 1\n end\n results += 'nil'\n results\n end",
"def to_s\n currNode = @list\n str = \"\"\n while currNode != nil\n str += currNode.value + \" -> \"\n currNode = currNode.nextNode\n end\n str += \"nil\"\n end",
"def to_s\n \"#{@value}\"\n end",
"def to_str() @value.to_s end",
"def to_s\r\n if @right == nil && @left == nil\r\n return @value.to_s\r\n elsif @right != nil && @left == nil\r\n return @value.to_s + \" \" + @right.to_s\r\n elsif @right == nil && @left != nil\r\n return @left.to_s + \" \" + @value.to_s\r\n else\r\n return @left.to_s + \" \" + @value.to_s + \" \" + @right.to_s\r\n end\r\n end",
"def to_s\n if @value then \"#{@name}=#{@value}\"\n else \"#{@name}\"\n end\n end",
"def to_s\n if @sig == nil && @ant == nil\n \"#{@value} \" \n else \n \"#{@value} <-> \" \n end\n end",
"def test_NilClass_InstanceMethod_to_s\n\t\tassert_equal(\"\", nil.to_s)\n\tend",
"def value_or_blank(value)\n value.blank? ? \"-\" : h(value)\n end",
"def to_str\n @value\n end",
"def empty_to_null\n attributes_before_type_cast.each do | key, value |\n write_attribute(key, nil) if value.kind_of?( String ) && value.empty?\n end\n end",
"def to_s\n\t\tatom ? atom.to_s : nil\n\t end",
"def to_s\n format(:default)\n end",
"def defaults_str\n \"\"\n end",
"def value\n @string || to_s\n end",
"def to_s\n return @value.to_s\n end",
"def to_str\n @value.to_s\n end",
"def to_s\n \"#{@value}\"\n end",
"def to_s\n \"#{@value}\"\n end",
"def sql_valuify\n nil? ? 'NULL' : \"'#{to_s.gsub(/\\\\/, '\\&\\&').gsub(/'/, \"''\").gsub(/\\t/, \"\\\\t\").gsub(/\\r/, \"\\\\r\").gsub(/\\n/, \"\\\\n\")}'\"\n end",
"def to_s\n if(@VAR_OBJECT == nil)\n return \"ID=[\" + @VAR_ID.to_s() + \"], Name=[\" + @VAR_NAME + \"], Value=[nil]\"\n else\n return \"ID=[\" + @VAR_ID.to_s() + \"], Name=[\" + @VAR_NAME + \"], Value=[\" + @VAR_OBJECT.to_s() + \"], Type=[\" + @VAR_OBJECT.class.to_s() + \"]\"\n end\n end",
"def null\n end",
"def value\n nil\n end",
"def value\n nil\n end",
"def is_null(val)\n @builder.is_null(LLVM::Script::Validate(val, :value))\n end",
"def value\n @value || ''\n end",
"def to_s\n current = @head\n \n until current.next_node.nil?\n print \"( #{current.value} ) -> \"\n current = current.next_node\n end\n print \"( #{current.value} ) -> nil\"\n end",
"def to_s\n val.to_s\n end",
"def string(value, default_value=nil)\n s = value.to_s\n if s.empty?\n default_value\n else\n s\n end\n end",
"def to_str()\n @value.to_s\n end",
"def to_str()\n @value.to_s\n end",
"def to_s\n val.to_s\n end",
"def to_s\n val.to_s\n end",
"def is_null\n @value, @operator = nil, :is_null\n self\n end",
"def to_str; value; end",
"def nstr(item)\n return if item.nil?\n\n item.to_s\nend",
"def to_str\n value.to_s\n end",
"def to_s\n @string || case\n when @object.nan? then 'NaN'\n when @object.infinite? then @object.to_s[0...-'inity'.length].upcase\n else @object.to_s\n end\n end",
"def to_s\r\n value.inspect\r\n end",
"def default_name\n \"Dux::NullObject(#{inspect_id(self)})\"\n end",
"def value\n nil\n end",
"def value\n nil\n end",
"def nil_if_empty(value)\n value = value.strip\n return nil if value.empty?\n return value\n end",
"def format_null(params = {}, &block)\n component[:null_formatter] = (params[:using] or block)\n component[:null_formatter] ||= proc do |value|\n params[:with] % value\n end\n end",
"def to_s\n @value\n end"
] | [
"0.8211108",
"0.7048803",
"0.7043745",
"0.7012862",
"0.6994924",
"0.6943016",
"0.68878585",
"0.6871274",
"0.6862378",
"0.68563944",
"0.6749207",
"0.6742523",
"0.6727192",
"0.6701522",
"0.66402394",
"0.6625559",
"0.66101575",
"0.66003495",
"0.65823054",
"0.655089",
"0.6538632",
"0.65356517",
"0.6521248",
"0.65133",
"0.65065515",
"0.650523",
"0.64993024",
"0.6497785",
"0.6481703",
"0.6457002",
"0.64527005",
"0.64527005",
"0.6450968",
"0.6450968",
"0.6450968",
"0.6449027",
"0.64409834",
"0.64179313",
"0.6402231",
"0.6401775",
"0.63677424",
"0.63384837",
"0.63072884",
"0.6304258",
"0.6277188",
"0.62623674",
"0.6255757",
"0.62446535",
"0.6219154",
"0.6207683",
"0.6200667",
"0.61939913",
"0.6186257",
"0.6152177",
"0.61495906",
"0.6146352",
"0.6127664",
"0.61053646",
"0.61019355",
"0.60860604",
"0.60779333",
"0.607063",
"0.6052524",
"0.6040078",
"0.60287064",
"0.6014198",
"0.6010213",
"0.5994335",
"0.59774005",
"0.597699",
"0.5975268",
"0.59645355",
"0.59645355",
"0.5961487",
"0.5955878",
"0.59558195",
"0.5936944",
"0.5936944",
"0.59327483",
"0.5928708",
"0.5923307",
"0.5921361",
"0.5920827",
"0.5919315",
"0.5919315",
"0.591776",
"0.591776",
"0.5914294",
"0.591224",
"0.59096885",
"0.5906935",
"0.5906596",
"0.59031945",
"0.59015006",
"0.5895304",
"0.5895304",
"0.5889344",
"0.5888969",
"0.58733636"
] | 0.74179316 | 2 |
Create a new curation. | def create_curation(engine_name, options)
post("engines/#{engine_name}/curations", options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def curation\n end",
"def create\n @creative_configuration = CreativeConfiguration.new(creative_configuration_params)\n\n respond_to do |format|\n if @creative_configuration.save\n format.html { redirect_to @creative_configuration, notice: 'Creative configuration was successfully created.' }\n format.json { render :show, status: :created, location: @creative_configuration }\n else\n format.html { render :new }\n format.json { render json: @creative_configuration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @facturation_milk = FacturationMilk.new\n end",
"def create \n Configurations.create ( configurations_params)\n end",
"def new\n @convention = Convention.new\n end",
"def create\n @constitution = Constitution.new(params[:constitution])\n\n respond_to do |format|\n if @constitution.save\n format.html { redirect_to @constitution, notice: 'Constitution was successfully created.' }\n format.json { render json: @constitution, status: :created, location: @constitution }\n else\n format.html { render action: \"new\" }\n format.json { render json: @constitution.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @cocktail = Cocktail.new\n end",
"def create\n @hr_config_discipline_type = Hr::Config::DisciplineType.new(hr_config_discipline_type_params)\n\n respond_to do |format|\n if @hr_config_discipline_type.save\n format.html { redirect_to @hr_config_discipline_type, notice: 'Discipline type was successfully created.' }\n format.json { render :show, status: :created, location: @hr_config_discipline_type }\n else\n format.html { render :new }\n format.json { render json: @hr_config_discipline_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new \n curation_concern.publisher = ['McGill University']\n super\n end",
"def new\n @discipline = Discipline.new\n end",
"def create\n in_directory do\n raise(\"Please use a specific Condom class, not Base.\")\n end\n end",
"def create\n @conf[:sandboxes].each do |v|\n create_sandbox(v)\n add_dispatching(v)\n end\n start_monit\n save_conf CONF_FILE\n end",
"def new(options) \n Client.get(\"/colors/new\", :query => options)\n end",
"def new\n @contra = Contra.new\n end",
"def new\n # category instance\n @category = Category.new\n end",
"def create\n @constat = Constat.new(constat_params)\n\n respond_to do |format|\n if @constat.save\n format.html { redirect_to @constat, notice: 'Constat was successfully created.' }\n format.json { render :show, status: :created, location: @constat }\n else\n format.html { render :new }\n format.json { render json: @constat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @circulation = Circulation.new(params[:circulation])\n\n respond_to do |format|\n if @circulation.save\n format.html { redirect_to @circulation, notice: 'Circulation was successfully created.' }\n format.json { render json: @circulation, status: :created, location: @circulation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @circulation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def category_new\n @finance_transaction_category = FinanceTransactionCategory.new\n end",
"def create\n @conclusion = Conclusion.new(params[:conclusion])\n\n respond_to do |format|\n if @conclusion.save\n format.html { redirect_to @conclusion, notice: 'Conclusion was successfully created.' }\n format.json { render json: @conclusion, status: :created, location: @conclusion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @conclusion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @construction_style = ConstructionStyle.new(params[:construction_style])\n\n respond_to do |format|\n if @construction_style.save\n format.html { redirect_to @construction_style, notice: 'Construction style was successfully created.' }\n format.json { render json: @construction_style, status: :created, location: @construction_style }\n else\n format.html { render action: \"new\" }\n format.json { render json: @construction_style.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @catogory = Catogory.new\n end",
"def new\n @cat = Cat.new\n end",
"def new\n @cat = Cat.new\n end",
"def new\n @config_value = ConfigValue.new\n end",
"def construct( &block )\n self.instance_eval(&block)\n @options\n end",
"def new\n @instrument = Instrument.new\n @category = [\"bowed strings\", \"wood wind\", \"brass\", \"percussions\", \"keyboard\" , \"guitar family\"]\n end",
"def create_category(options = {})\n ActiveSupport::Deprecation.warn('create_category deprecated. Will be removed. Use community.categories.create.')\n self.categories.create options\n end",
"def create\n @colegiatura = Colegiatura.new(params[:colegiatura])\n\n respond_to do |format|\n if @colegiatura.save\n format.html { redirect_to @colegiatura, notice: 'Colegiatura was successfully created.' }\n format.json { render json: @colegiatura, status: :created, location: @colegiatura }\n else\n format.html { render action: \"new\" }\n format.json { render json: @colegiatura.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cover_cat = CoverCat.new(params[:cover_cat])\n\n respond_to do |format|\n if @cover_cat.save\n format.html { redirect_to @cover_cat, notice: 'Cover cat was successfully created.' }\n format.json { render json: @cover_cat, status: :created, location: @cover_cat }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cover_cat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @constituency = Constituency.new(params[:constituency])\n\n respond_to do |format|\n if @constituency.save\n flash[:notice] = 'Constituency was successfully created.'\n format.html { redirect_to(@constituency) }\n format.xml { render :xml => @constituency, :status => :created, :location => @constituency }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @constituency.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @color_saturation = ColorSaturation.new(params[:color_saturation])\n\n respond_to do |format|\n if @color_saturation.save\n format.html { redirect_to @color_saturation, notice: 'Color saturation was successfully created.' }\n format.json { render json: @color_saturation, status: :created, location: @color_saturation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @color_saturation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(id, name: nil, type: :PRODUCTION, labels: nil, clusters: nil)\n end",
"def new \n @intervention = Intervention.new\n logger.info(\"INTERVENTIONS CONTROLLER \") \n end",
"def create\n @catebg = Catebg.new(params[:catebg])\n\n respond_to do |format|\n if @catebg.save\n format.html { redirect_to @catebg, notice: 'Catebg was successfully created.' }\n format.json { render json: @catebg, status: :created, location: @catebg }\n else\n format.html { render action: \"new\" }\n format.json { render json: @catebg.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n name_to_const.new\n end",
"def create\n @contractor_category = ContractorCategory.new(contractor_category_params)\n\n respond_to do |format|\n if @contractor_category.save\n format.html { redirect_to @contractor_category, notice: 'Contractor category was successfully created.' }\n format.json { render :show, status: :created, location: @contractor_category }\n else\n format.html { render :new }\n format.json { render json: @contractor_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @color = Color.new\n end",
"def create\n @contry = Contry.new(contry_params)\n\n respond_to do |format|\n if @contry.save\n format.html { redirect_to @contry, notice: 'Contry was successfully created.' }\n format.json { render :show, status: :created, location: @contry }\n else\n format.html { render :new }\n format.json { render json: @contry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n \t@category = Category.new\n end",
"def create\n @disc_color = DiscColor.new(params[:disc_color])\n\n respond_to do |format|\n if @disc_color.save\n format.html { redirect_to @disc_color, notice: 'Disc color was successfully created.' }\n format.json { render json: @disc_color, status: :created, location: @disc_color }\n else\n format.html { render action: \"new\" }\n format.json { render json: @disc_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @discipline = Discipline.new(params[:discipline])\n @discipline.discipline_id = UUIDTools::UUID.timestamp_create().to_s\n\n respond_to do |format|\n if @discipline.save\n format.html { redirect_to @discipline, notice: t(:discipline_successfully_created) }\n format.json { render json: @discipline, status: :created, location: @discipline }\n else\n format.html { render action: \"new\" }\n format.json { render json: @discipline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @exhibitior_category = ExhibitiorCategory.new(params[:exhibitior_category])\n\n respond_to do |format|\n if @exhibitior_category.save\n format.html { redirect_to @exhibitior_category, notice: 'Exhibitior category was successfully created.' }\n format.json { render json: @exhibitior_category, status: :created, location: @exhibitior_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exhibitior_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initialize(options={})\r\n @contingency_info = ContingencyInfo.new if options[:contingency_info].nil?\r\n end",
"def initialize(fur_color, name, anger_level)\n @fur_color = fur_color\n @name = name\n @anger_level = anger_level\n\n @@all << self # storing a reference to the cat instance\n end",
"def create\n @cict = Cict.new(cict_params)\n\n respond_to do |format|\n if @cict.save\n format.html { redirect_to @cict, notice: 'Cict was successfully created.' }\n format.json { render :show, status: :created, location: @cict }\n else\n format.html { render :new }\n format.json { render json: @cict.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n \t@category =Category.new\n end",
"def new\n # build a 'temporary' post which is written to DB later (create-method)\n @criterion = Criterion.new\n end",
"def new\n\t\t@category = Category.new\n\tend",
"def new\n\t\t@category = Category.new\n\tend",
"def create\n init = params[:category][:name][0]\n division = Division.find_by_name(params[:division_id].upcase)\n category_number = Category.create_number(params)\n @category = Category.new(category_params.merge(:code => (('%03d' % ((Category.last.code.to_i rescue 0)+1)))).merge(:division_id => division.id))\n if @category.save\n flash[:notice] = 'Category was successfully added'\n redirect_to categories_path\n else\n flash[:error] = @category.errors.full_messages\n render \"new\"\n end\n end",
"def create(attribs={})\n obj = new\n obj.send :create, attribs\n obj\n end",
"def create\n @cp_category = Category.new(cp_category_params)\n\n respond_to do |format|\n if @cp_category.save\n format.html { redirect_to @cp_category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @cp_category }\n else\n format.html { render :new }\n format.json { render json: @cp_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @congty = Congty.new(congty_params)\n\n respond_to do |format|\n if @congty.save\n format.html { redirect_to admin_congties_url, notice: 'Congty was successfully created.' }\n format.json { render :show, status: :created, location: @congty }\n else\n format.html { render :new }\n format.json { render json: @congty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n tmpl = ERB.new(load_erb_file('rubocop/rubocop.yml'))\n data = tmpl.result(binding)\n\n info 'Setting up Rubocop configuration'\n write_file(cookbook_file_path('.rubocop.yml'), data)\n end",
"def new\n @style = Style.new()\n end",
"def create\n @connection_category_class = ConnectionCategoryClass.new(params[:connection_category_class])\n\n respond_to do |format|\n if @connection_category_class.save\n format.html { redirect_to @connection_category_class, notice: 'Connection category class was successfully created.' }\n format.json { render json: @connection_category_class, status: :created, location: @connection_category_class }\n else\n format.html { render action: \"new\" }\n format.json { render json: @connection_category_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @contest = Contest.new\n end",
"def new\n @contest = Contest.new\n end",
"def create\n @ilance_category = IlanceCategory.new(ilance_category_params)\n\n respond_to do |format|\n if @ilance_category.save\n format.html { redirect_to @ilance_category, notice: 'Ilance category was successfully created.' }\n format.json { render :show, status: :created, location: @ilance_category }\n else\n format.html { render :new }\n format.json { render json: @ilance_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cdg_configuration = CdgConfiguration.new(cdg_configuration_params)\n\n respond_to do |format|\n if @cdg_configuration.save\n format.html { redirect_to @cdg_configuration, notice: 'Cdg configuration was successfully created.' }\n format.json { render :show, status: :created, location: @cdg_configuration }\n else\n format.html { render :new }\n format.json { render json: @cdg_configuration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(atts = {})\n rec = self.new(atts)\n rec.save && rec\n end",
"def create\n @construction_equipment_category = ConstructionEquipmentCategory.new(construction_equipment_category_params)\n\n respond_to do |format|\n if @construction_equipment_category.save\n format.html { redirect_to @construction_equipment_category, notice: 'Construction equipment category was successfully created.' }\n format.json { render :show, status: :created, location: @construction_equipment_category }\n else\n format.html { render :new }\n format.json { render json: @construction_equipment_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new \n @cuber = Cuber.new\n end",
"def create(options={})\n unless options[:ostemplate]\n # We need at least a valid ostemplate\n raise ArgumentError, \"Create requires argument :ostemplate.\"\n end\n\n cmd = \"#{@vzctl} create #{@ctid}\"\n\n options.each do |opt,val|\n cmd << \" --#{opt}\"\n cmd << \" #{val}\"\n end\n\n execute(cmd)\n\n Log.debug(\"Reading new container configuration file: #{@configfile}\")\n @config = Config.new(load_config_file)\n @config.add_observer(self)\n end",
"def create\n @congregation = Congregation.new(congregation_params)\n\n respond_to do |format|\n if @congregation.save\n format.html { redirect_to @congregation, notice: 'Congregation was successfully created.' }\n format.json { render :show, status: :created, location: @congregation }\n else\n format.html { render :new }\n format.json { render json: @congregation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n # new cocktail part\n # @cocktail = Cocktail.new\n end",
"def create\n @climate = Climate.new(params[:climate])\n\n respond_to do |format|\n if @climate.save\n format.html { redirect_to @climate, notice: 'Climate was successfully created.' }\n format.json { render json: @climate, status: :created, location: @climate }\n else\n format.html { render action: \"new\" }\n format.json { render json: @climate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @exhibitor_category = ExhibitorCategory.new(params[:exhibitor_category])\n\n respond_to do |format|\n if @exhibitor_category.save\n format.html { redirect_to @exhibitor_category, notice: 'Exhibitor category was successfully created.' }\n format.json { render json: @exhibitor_category, status: :created, location: @exhibitor_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exhibitor_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(opts = {})\n instance = new(opts)\n instance.save\n instance\n end",
"def create\n @discipline = Discipline.new(discipline_params)\n\n respond_to do |format|\n if @discipline.save\n format.html { redirect_to @discipline, notice: 'Discipline was successfully created.' }\n format.json { render :show, status: :created, location: @discipline }\n else\n format.html { render :new }\n format.json { render json: @discipline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @internal_category = InternalCategory.new\n end",
"def create\n @project_catagory = ProjectCatagory.new(project_catagory_params)\n\n respond_to do |format|\n if @project_catagory.save\n format.html { redirect_to @project_catagory, notice: 'Project catagory was successfully created.' }\n format.json { render :show, status: :created, location: @project_catagory }\n else\n format.html { render :new }\n format.json { render json: @project_catagory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @prosumer_category = ProsumerCategory.new(prosumer_category_params)\n\n respond_to do |format|\n if @prosumer_category.save\n format.html { redirect_to @prosumer_category, notice: 'Prosumer category was successfully created.' }\n format.json { render :show, status: :created, location: @prosumer_category }\n else\n format.html { render :new }\n format.json { render json: @prosumer_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ciclo = Ciclo.new(ciclo_params)\n\n respond_to do |format|\n if @ciclo.save\n format.html { redirect_to @ciclo, notice: 'Ciclo was successfully created.' }\n format.json { render :show, status: :created, location: @ciclo }\n else\n format.html { render :new }\n format.json { render json: @ciclo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ciclo = Ciclo.new(ciclo_params)\n\n respond_to do |format|\n if @ciclo.save\n format.html { redirect_to @ciclo, notice: 'Ciclo was successfully created.' }\n format.json { render :show, status: :created, location: @ciclo }\n else\n format.html { render :new }\n format.json { render json: @ciclo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ciclo = Ciclo.new(ciclo_params)\n\n respond_to do |format|\n if @ciclo.save\n format.html { redirect_to @ciclo, notice: 'Ciclo was successfully created.' }\n format.json { render :show, status: :created, location: @ciclo }\n else\n format.html { render :new }\n format.json { render json: @ciclo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(attrs)\n if attrs.has_key? :description\n warn \"Fogbugz Case does not handle description\"\n end\n\n options = translate attrs,\n :title => :sTitle,\n :priority => :ixPriority,\n :assignee => :ixPersonAssignedTo,\n :project_id => :ixProject\n\n new_case = api.command(:new, options)\n\n options.merge!(:ixBug => new_case[\"case\"][\"ixBug\"])\n\n self.new options\n end",
"def create\n @confrence = Confrence.new(params[:confrence])\n\n respond_to do |format|\n if @confrence.save\n format.html { redirect_to @confrence, notice: 'Confrence was successfully created.' }\n format.json { render json: @confrence, status: :created, location: @confrence }\n else\n format.html { render action: \"new\" }\n format.json { render json: @confrence.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @congresso = Congresso.new(congresso_params)\n\n respond_to do |format|\n if @congresso.save\n format.html { redirect_to @congresso, notice: 'Congresso was successfully created.' }\n format.json { render :show, status: :created, location: @congresso }\n else\n format.html { render :new }\n format.json { render json: @congresso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @biocuration_classification = BiocurationClassification.new(biocuration_classification_params)\n\n respond_to do |format|\n if @biocuration_classification.save\n format.html { redirect_to :back, notice: 'Biocuration classification was successfully created.' }\n format.json { render json: @biocuration_classification, status: :created, location: @biocuration_classification }\n else\n format.html { redirect_to :back, notice: 'Biocuration classification was NOT successfully created.' }\n format.json { render json: @biocuration_classification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @performance = Performance.new\n end",
"def create\n @cdist_type = CdistType.new(params[:cdist_type])\n\n respond_to do |format|\n if @cdist_type.save\n format.html { redirect_to @cdist_type, notice: 'Cdist type was successfully created.' }\n format.json { render json: @cdist_type, status: :created, location: @cdist_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cdist_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@category = Category.new(category_params)\n\t\t@category.user = current_user\n\t\tif(category_params[:titulo] == \"Geral\")\n\t\t\t@category.titulo = \"Geral (nova)\"\n\t\tend\n\t\trespond_to do |format|\n\t\t\tif @category.save\n\t\t\t\tformat.html { redirect_to @category, notice: 'Category criada com sucesso!' }\n\t\t\t\tformat.json { render :show, status: :created, location: @category }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @category.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @conductormobibus = Conductormobibus.new(conductormobibus_params)\n\n respond_to do |format|\n if @conductormobibus.save\n format.html { redirect_to @conductormobibus, notice: 'Conductor was successfully created.' }\n format.json { render :show, status: :created, location: @conductormobibus }\n else\n format.html { render :new }\n format.json { render json: @conductormobibus.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @categor = Categor.new(categor_params)\n\n respond_to do |format|\n if @categor.save\n format.html { redirect_to @categor, notice: 'Categor was successfully created.' }\n format.json { render :show, status: :created, location: @categor }\n else\n format.html { render :new }\n format.json { render json: @categor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cfg = Cfg.new(cfg_params)\n\n respond_to do |format|\n if @cfg.save\n format.html { redirect_to @cfg, notice: 'Cfg was successfully created.' }\n format.json { render :show, status: :created, location: @cfg }\n else\n format.html { render :new }\n format.json { render json: @cfg.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cfct = Cfct.new(cfct_params)\n\n respond_to do |format|\n if @cfct.save\n format.html { redirect_to @cfct, notice: 'Cfct was successfully created.' }\n format.json { render :show, status: :created, location: @cfct }\n else\n format.html { render :new }\n format.json { render json: @cfct.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @civilization = Civilization.new(params[:civilization])\n\n respond_to do |format|\n if @civilization.save\n format.html { redirect_to @civilization, notice: 'Civilization was successfully created.' }\n format.json { render json: @civilization, status: :created, location: @civilization }\n else\n format.html { render action: \"new\" }\n format.json { render json: @civilization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @cat = Category.new\n end",
"def create\n @categorie_competence = CategorieCompetence.new(categorie_competence_params)\n\n respond_to do |format|\n if @categorie_competence.save\n format.html { redirect_to @categorie_competence, notice: 'Categorie competence was successfully created.' }\n format.json { render :show, status: :created, location: @categorie_competence }\n else\n format.html { render :new }\n format.json { render json: @categorie_competence.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @resource = Integral::Category.new(resource_params)\n\n if @resource.save\n flash[:notice] = notification_message('creation_success')\n render json: { redirect_url: request.referrer }, status: :created\n else\n render json: { message: notification_message('creation_failure') }, status: :unprocessable_entity\n end\n end",
"def create\n @coverage_type = CoverageType.new(coverage_type_params)\n\n respond_to do |format|\n if @coverage_type.save\n format.html { redirect_to @coverage_type, notice: 'Coverage type was successfully created.' }\n format.json { render :show, status: :created, location: @coverage_type }\n else\n format.html { render :new }\n format.json { render json: @coverage_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cuisine = Cuisine.new(cuisine_params)\n\n\n end",
"def create\n @attack_charm_type = AttackCharmType.new(attack_charm_type_params)\n\n respond_to do |format|\n if @attack_charm_type.save\n format.html { redirect_to @attack_charm_type, notice: 'Attack charm type was successfully created.' }\n format.json { render :show, status: :created, location: @attack_charm_type }\n else\n format.html { render :new }\n format.json { render json: @attack_charm_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @category = Category.new\n end",
"def new\n @category = Category.new\n end",
"def new\n @category = Category.new\n end",
"def new\n @category = Category.new\n end",
"def new\n @category = Category.new\n end",
"def new\n @category = Category.new\n end",
"def new\n @category = Category.new\n end"
] | [
"0.59830225",
"0.5656284",
"0.5633999",
"0.5610203",
"0.55165726",
"0.54901475",
"0.537554",
"0.53699523",
"0.5369757",
"0.5313778",
"0.53126025",
"0.5297251",
"0.5281441",
"0.5280221",
"0.5263218",
"0.5260842",
"0.5231351",
"0.522741",
"0.5179663",
"0.5179619",
"0.5173434",
"0.5173406",
"0.5173406",
"0.51712966",
"0.5165301",
"0.51612437",
"0.5159345",
"0.51528347",
"0.5098511",
"0.5090398",
"0.50787306",
"0.5076651",
"0.50585604",
"0.5056151",
"0.50498897",
"0.5045475",
"0.50429755",
"0.50398904",
"0.50365347",
"0.5033476",
"0.50283206",
"0.50221884",
"0.5021429",
"0.5015874",
"0.50051385",
"0.5004508",
"0.50038636",
"0.50032693",
"0.50032693",
"0.50015384",
"0.4995998",
"0.499132",
"0.498941",
"0.49888715",
"0.49876988",
"0.49836752",
"0.49766633",
"0.49766633",
"0.49764365",
"0.49708033",
"0.49691275",
"0.49540696",
"0.4951166",
"0.4946212",
"0.4930142",
"0.49301127",
"0.49167836",
"0.49003285",
"0.48931292",
"0.48914504",
"0.4889996",
"0.48867467",
"0.48803648",
"0.48751464",
"0.48751464",
"0.48751464",
"0.4872309",
"0.4871369",
"0.48688105",
"0.48653805",
"0.48648176",
"0.48645037",
"0.48583493",
"0.48582414",
"0.48528117",
"0.48475203",
"0.48450717",
"0.48434347",
"0.48422813",
"0.48412642",
"0.48397976",
"0.48392826",
"0.4838011",
"0.48379514",
"0.48341718",
"0.48341718",
"0.48341718",
"0.48341718",
"0.48341718",
"0.48341718",
"0.48341718"
] | 0.0 | -1 |
Retrieve a curation by id. | def get_curation(engine_name, id)
get("engines/#{engine_name}/curations/#{id}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_category id\n\t\traw_output = @fred.category( nil, category_id: id.to_s )\n\n\t\traw_output.categories.category\n\tend",
"def get_category id\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.get CATEGORIES, id )\n\t\t\t\tend",
"def get(id)\n Basuco::Resource.get(id)\n end",
"def GetCategory id\n\n APICall(path: \"categories/#{id}.json\")\n\n end",
"def category(id)\n categories.select do |category|\n category.id == id\n end.first\n end",
"def get_cave(id)\n @caves.each { |cave| return cave if(cave.id.to_i == id.to_i) }\n end",
"def get(id)\n collection.find_one({\n Crocoduck::Store.id_field => id.to_i\n })\n end",
"def retrieve_analysis_by_id(id)\n @analysis = Dencity::Analysis.new(nil, @connection)\n @analysis.retrieve_by_id(id)\n end",
"def get(id)\n @service.get(id)\n end",
"def resource(id)\n CODES.select{|hash| hash.has_key?(id.to_s)}[0]\n end",
"def read(id)\n perform(:get, \"#{@resource_type}/#{id}\")\n end",
"def get(id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id);\n\t\t\tclient.queue_service_action_call('category', 'get', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend",
"def category(id = nil)\n res = Connection.get('categories', id)\n id.nil? ? Category.all(res) : Category.new(res)\n end",
"def get(id)\n new(dataset.get(id))\n end",
"def get(id)\n dataset.get(id)\n end",
"def schedule_colors_id_get_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ScheduleColorsApi.schedule_colors_id_get ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling ScheduleColorsApi.schedule_colors_id_get\"\n end\n # resource path\n local_var_path = \"/schedule/colors/{id}\".sub('{' + 'id' + '}', id.to_s)\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 = ['BasicAuth']\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 => 'ScheduleColor')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ScheduleColorsApi#schedule_colors_id_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def schedule_colors_id_get(id, opts = {})\n data, _status_code, _headers = schedule_colors_id_get_with_http_info(id, opts)\n return data\n end",
"def get(id)\n client.read(dstu2_model, id)\n end",
"def get_by_id(id, cats_only = false)\n raise \"Cannot do a look-up with a blank id!\" if id.blank?\n object = self.categories.select { |category| category.type_identifier == id }\n object = self.entities.select { |entity| entity.id == id } if !cats_only && object.empty?\n object.first\n end",
"def config_get(id)\n Configuration.get(id)\n end",
"def get(id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id)\n\t\t\tclient.queue_service_action_call('configurations', 'get', 'KalturaConfigurations', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"def retrieve(id)\n Charge.new(attrs: { 'id' => id }, client: client).refresh\n end",
"def retrieve(id)\n @client.make_request(:get, \"insurances/#{id}\", MODEL_CLASS)\n end",
"def category(id=nil)\n @category = Plaid::Category.new\n res = self.get('categories',id)\n id.nil? ? @category.instantiate_all_categories(res) : @category.instantiate_one_category(res)\n end",
"def get(id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id)\n\t\t\tclient.queue_service_action_call('ottcategory', 'get', 'KalturaOTTCategory', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"def get(id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id)\n\t\t\tclient.queue_service_action_call('configurationgroup', 'get', 'KalturaConfigurationGroup', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"def get(\n id,\n deadline: nil\n )\n return @resources.get(\n id,\n deadline: deadline,\n )\n end",
"def find(id)\n request(:get, \"/connections/#{id}\")\n end",
"def find_category_from_id\n @category = GlossaryCategory.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n render_404\n end",
"def get(id, db = database)\n begin\n get!(id, db)\n rescue\n nil\n end\n end",
"def get(id)\n return unless id\n with_redis { |redis| redis.get(redis_key_for(id)).try { |data| load(data) } }\n end",
"def retrieve(id)\n raise NotFound.new(\"id '#{id}'\") unless ids.include?(id)\n\n storage[id]\n end",
"def get!(id)\n klass.find(:all, params: { id: wrap_key(id) })\n end",
"def get_ci(id)\n xml = RestClient.get \"#{@base_url}/ci/#{id}\", {:accept => :xml, :content_type => :xml}\n return XmlSimple.xml_in(xml)\n end",
"def get(id:)\n response = client.get(path(id)).parsed_body\n new(response)\n end",
"def find(id)\n return nil unless redis.exists key(id)\n\n new redis.hgetall(key(id)).to_options\n end",
"def category(id)\n response = establish_connection(\"categories/#{id}.xml\")\n parse_single_category_xml(response.at(:category))\n end",
"def find(id)\n return nil if id.blank?\n path = build_association_path -> { \"#{@parent.request_path(@params)}#{@opts[:path]}/#{id}\" }\n @klass.get_resource(path, @params)\n end",
"def city_id(id, options = {})\n new(options.merge(id: id)).retrieve\n end",
"def fetch(id)\n fetch_by_id(id) or raise(ActiveRecord::RecordNotFound, \"Couldn't find #{self.class.name} with ID=#{id}\")\n end",
"def lookup(id)\n id_num = id\n settings.data[id_num]\n end",
"def get(id)\n klass.find(:first, params: { klass.primary_key => wrap_key(id) })\n end",
"def find_one(id)\n response = request(:get, \"/#{resource_name}/#{id}\")\n #puts response\n construct_record_from_singular(response)\n end",
"def find(id)\n resource_hash = PrestaShop.get :resource => self.resource,\n :id => id\n\n resource_hash.nil? ? nil : self.new(resource_hash)\n end",
"def get(id)\n request do\n response =\n connection.get id\n\n parse(response.body)\n end\n end",
"def get(id)\n Hawkular::Metrics::MetricDefinition::new(@client.http_get(\"/#{@resource}/#{id}\"))\n end",
"def find(id)\n where({'id' => \"#{id}\"}).first\n end",
"def find(id)\n response = client.get(\"discount_coupons/#{id}\")\n if response.success?\n DiscountCoupon.new(response.body, client: client)\n end\n end",
"def get_by_id(id)\n self.class.get(\"/aldebaran-instances/instances/#{id}\", :basic_auth => @auth)\n end",
"def fetch(id)\n fetch_by_id(id) or raise(ActiveRecord::RecordNotFound, \"Couldn't find #{self.name} with ID=#{id}\")\n end",
"def disc(id)\n get(\"/catalog/titles/discs/#{id.to_s}\")\n end",
"def find_by_id(id)\n find(id)\n end",
"def get_category(id, opts = {})\n data, _status_code, _headers = get_category_with_http_info(id, opts)\n return data\n end",
"def find(id)\n end",
"def retrieve\n self.class.get( id )\n end",
"def find(id)\n klass.find(id)\n end",
"def find_by_id(client, id, options: {})\n\n self.new(parse(client.get(\"/stories/#{id}\", options: options)).first, client: client)\n end",
"def getCategory( category_id)\n params = Hash.new\n params['category_id'] = category_id\n return doCurl(\"get\",\"/category\",params)\n end",
"def get(project_id, id, options)\n @_client.get(\"#{resource_root(project_id)}/#{id}\", options)\n end",
"def category(id)\n db = connect()\n return db.execute('SELECT Id,Title FROM discussions WHERE CatId=?', id), db.execute('SELECT * FROM categories WHERE Id=?', id)\n end",
"def get_campaign(campaign_id)\n request(:get, \"api/1/campaigns/#{campaign_id}\").campaign\n end",
"def find(id)\n @collection[id.to_s]\n end",
"def get_category(category_id, options = {})\n root = get_root\n object_from_response(GogoKit::Category,\n GogoKit::CategoryRepresenter,\n :get,\n \"#{root.links['self'].href}/categories/\" \\\n \"#{category_id}\",\n options)\n end",
"def find(id)\n @crystals.find { |crystal| crystal.id == id }\n end",
"def buscar(id)\n @client.get(Route.new([ROTA_CONFERENCIA, id.to_s]))\n end",
"def show(id:)\n id_check('id', id)\n\n cf_get(path: \"/zones/#{zone_id}/rate_limits/#{id}\")\n end",
"def get_institution(id)\r\n # Prepare query url.\r\n _path_url = '/institutions/{id}'\r\n _path_url = APIHelper.append_url_with_template_parameters(\r\n _path_url,\r\n 'id' => id\r\n )\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n Institution.from_hash(decoded)\r\n end",
"def fetch_by_id(id)\n if IdentityCache.should_cache?\n\n require_if_necessary do\n object = IdentityCache.fetch(rails_cache_key(id)){ resolve_cache_miss(id) }\n IdentityCache.logger.error \"[IDC id mismatch] fetch_by_id_requested=#{id} fetch_by_id_got=#{object.id} for #{object.inspect[(0..100)]} \" if object && object.id != id.to_i\n object\n end\n\n else\n self.find_by_id(id)\n end\n end",
"def get_by_id(id)\n if @data == nil\n url = make_url(:fq => \"id:#{id}\")\n\n begin\n @data = Net::HTTP.get(URI.parse(url))\n rescue Exception => e\n @error = \"Unable to connect to #{url}\"\n end\n end\n \n return @data\n end",
"def category_search(id)\n cached_request('category',{:id => id})\n end",
"def get_by_id(id)\n raise(ArgumentError, \"Argument 'id' must be a Fixnum\") unless id.is_a?(Fixnum)\n @data.find{ |entry| entry[:id] == id }\n end",
"def find(id)\n return nil if id.blank?\n path = build_association_path lambda { \"#{@owner.request_path(@params)}#{@opts[:path]}/#{id}\" }\n @klass.get(path, @params)\n end",
"def find(id)\n repository.find(self, id)\n end",
"def get(id)\n server.get(\"#{name}/#{CGI.escape(id)}\")\n end",
"def fetch(id)\n build_resource(raw.fetch(id))\n end",
"def find\n Campaign.find(:first, :id => @id)\n end",
"def find_by_path_or_id!(path, id)\n category = find_by_path_or_id(path, id)\n\n raise ActiveRecord::RecordNotFound unless category\n\n category\n end",
"def find_by_path_or_id!(path, id)\n category = find_by_path_or_id(path, id)\n\n raise ActiveRecord::RecordNotFound unless category\n\n category\n end",
"def get(id)\n Conversation.from_id(@client, id)\n end",
"def find_category(cate_id)\n category = Category.find_by(id: cate_id).name\n end",
"def get(id)\n Ribs.with_handle(self.database) do |h|\n h.get(self.metadata.persistent_class.entity_name, id)\n end\n end",
"def for_connection(id)\n id.require!(as: :id)\n api(:get, \"/connections/#{id}/challenges\")\n .fetch('challenges')\n .cast(Challenge)\n end",
"def find(id)\n @client.get_game(id).attributes\n end",
"def find_by_id(client, id, options: {})\n\n self.new(parse(client.get(\"/project_statuses/#{id}\", options: options)).first, client: client)\n end",
"def find(id)\n new(GeoIQ.get(\"/datasets/#{id}.json\"))\n end",
"def [](id)\n @by_id[id]\n end",
"def find_by_id(id)\n configs.each do |config|\n if config.config_name.eql?(id)\n return config.new\n end\n end\n nil\n end",
"def read(id)\n begin\n find(id).read\n rescue\n nil\n end\n end",
"def find(id)\n @api.get(\"api/#{id.to_s}.json\")\n end",
"def pull_id(id)\n return Dish(@catchpoint.get(\"tests/#{id}\"))\n end",
"def find_by_id(id)\n find_by_attributes(:id => id).first\n end",
"def connections_id_get(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: ConnectionApi#connections_id_get ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling connections_id_get\" if id.nil?\n \n # resource path\n path = \"/connections/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_6')\n if Configuration.debugging\n Configuration.logger.debug \"API called: ConnectionApi#connections_id_get. Result: #{result.inspect}\"\n end\n return result\n end",
"def get_by_db4o_id(id)\n obj = database.get_by_id(id.to_i)\n # NOTE: Activate depth should be configurable\n database.connection.activate(obj, 5)\n obj.load_attributes!\n end",
"def retrieve(id)\n instance = self.new(id)\n url = instance.url\n requestor = Requestor.new\n response = requestor.request(:get, url)\n instance.load_from(response)\n instance\n end",
"def show(id) \n response = request(:get, \"/recipes/#{id}.json\")\n response.first[1]\n end",
"def find_resource(id)\n query_service.find_by(id: Valkyrie::ID.new(id.to_s))\n end",
"def get(id)\n raise NotSupportedError\n end",
"def show(id:)\n raise 'must provide the id of the railgun' if id.nil?\n cf_get(path: \"/railguns/#{id}\")\n end",
"def fetch(id)\n search(id: id)[:records].first\n end",
"def find(id)\n # Used where so no exception will be raised if the instance\n # does not exist.\n @model.unscoped.where(@model_data['mappings']['id'].to_sym => id).first\n end"
] | [
"0.65896475",
"0.65619564",
"0.64255977",
"0.6415461",
"0.6401644",
"0.63266253",
"0.61798376",
"0.61611754",
"0.60807693",
"0.60594165",
"0.605915",
"0.60541224",
"0.60415584",
"0.5925954",
"0.5925802",
"0.5916899",
"0.5915727",
"0.59109634",
"0.59063435",
"0.5904463",
"0.5896137",
"0.58702546",
"0.5835707",
"0.57972485",
"0.5795594",
"0.57884383",
"0.57861435",
"0.57697403",
"0.57547873",
"0.5750993",
"0.5749695",
"0.5748516",
"0.57445323",
"0.5739728",
"0.5723365",
"0.57226723",
"0.5719449",
"0.56823343",
"0.5678593",
"0.56657094",
"0.56612647",
"0.5657803",
"0.5651234",
"0.5648437",
"0.5630312",
"0.5625994",
"0.5620413",
"0.5608182",
"0.5581921",
"0.5567349",
"0.5566753",
"0.5552131",
"0.55463094",
"0.5541168",
"0.55259556",
"0.55244017",
"0.5518752",
"0.5515776",
"0.5512936",
"0.5508069",
"0.55020154",
"0.5489823",
"0.548556",
"0.5461225",
"0.5459122",
"0.5458994",
"0.5436068",
"0.5435671",
"0.5435558",
"0.5430043",
"0.54283756",
"0.54197645",
"0.54102683",
"0.54086936",
"0.54081166",
"0.5405144",
"0.5396514",
"0.5396514",
"0.53944254",
"0.5390978",
"0.53833956",
"0.5381841",
"0.5379778",
"0.53600633",
"0.53541535",
"0.53529453",
"0.5350208",
"0.5341554",
"0.5340446",
"0.5337572",
"0.53348863",
"0.53273785",
"0.5326219",
"0.5320999",
"0.5319113",
"0.5318953",
"0.53135777",
"0.5313342",
"0.5312249",
"0.53121054"
] | 0.5528094 | 54 |
Update an existing curation. | def update_curation(engine_name, id, options)
put("engines/#{engine_name}/curations/#{id}", options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @creative_configuration.update(creative_configuration_params)\n format.html { redirect_to @creative_configuration, notice: 'Creative configuration was successfully updated.' }\n format.json { render :show, status: :ok, location: @creative_configuration }\n else\n format.html { render :edit }\n format.json { render json: @creative_configuration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cover_cat = CoverCat.find(params[:id])\n\n respond_to do |format|\n if @cover_cat.update_attributes(params[:cover_cat])\n format.html { redirect_to @cover_cat, notice: 'Cover cat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cover_cat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @category.update(category_params)\n end",
"def update\n @color_saturation = ColorSaturation.find(params[:id])\n\n respond_to do |format|\n if @color_saturation.update_attributes(params[:color_saturation])\n format.html { redirect_to @color_saturation, notice: 'Color saturation was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @color_saturation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @circulation = Circulation.find(params[:id])\n\n respond_to do |format|\n if @circulation.update_attributes(params[:circulation])\n format.html { redirect_to @circulation, notice: 'Circulation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @circulation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @disc_color = DiscColor.find(params[:id])\n\n respond_to do |format|\n if @disc_color.update_attributes(params[:disc_color])\n format.html { redirect_to @disc_color, notice: 'Disc color was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @disc_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @exhibitor_category = ExhibitorCategory.find(params[:id])\n\n respond_to do |format|\n if @exhibitor_category.update_attributes(params[:exhibitor_category])\n format.html { redirect_to @exhibitor_category, notice: 'Exhibitor category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exhibitor_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @category_id = args[:category_id] if args.key?(:category_id)\n @confidence = args[:confidence] if args.key?(:confidence)\n end",
"def update\n @exhibitior_category = ExhibitiorCategory.find(params[:id])\n\n respond_to do |format|\n if @exhibitior_category.update_attributes(params[:exhibitior_category])\n format.html { redirect_to @exhibitior_category, notice: 'Exhibitior category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exhibitior_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category_option.update(category_option_params)\n format.html { redirect_to @category_option, notice: 'Category option was successfully updated.' }\n format.json { render :show, status: :ok, location: @category_option }\n else\n format.html { render :edit }\n format.json { render json: @category_option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n category= Category.find(params[:id])\n category.update(category_params)\n \n end",
"def update\n @foursquare_category = FoursquareCategory.find(params[:id])\n\n respond_to do |format|\n if @foursquare_category.update_attributes(params[:foursquare_category])\n format.html { redirect_to([:scaffold, @foursquare_category], :notice => 'Foursquare category was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @foursquare_category.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @constitution = Constitution.find(params[:id])\n\n respond_to do |format|\n if @constitution.update_attributes(params[:constitution])\n format.html { redirect_to @constitution, notice: 'Constitution was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @constitution.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @conclusion = Conclusion.find(params[:id])\n\n respond_to do |format|\n if @conclusion.update_attributes(params[:conclusion])\n format.html { redirect_to @conclusion, notice: 'Conclusion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @conclusion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\tif @category.update(category_params)\n\t\t\tredirect_to categories_url\n\n\t\telse\n\t\t\tformat.html { render action: 'edit' }\n\t\t\tformat.json { render json: @category.errors, status: :unprocessable_entity }\n\t\tend\n\tend",
"def update\n @category = @section.dish_categories.find(params[:id])\n if @category.update_attributes(params[:dish_category])\n redirect_to (params[:commit] == \"Сохранить\" ? [:admin, @section, :dish_categories] : [:edit, :admin, @section, @category]), notice: 'Категория успешно обновлена.'\n else\n render action: \"edit\"\n\n end\n\n end",
"def update\n @consumer_category = ConsumerCategory.find(params[:id])\n\n respond_to do |format|\n if @consumer_category.update_attributes(params[:consumer_category])\n format.html { redirect_to @consumer_category, notice: 'Consumer category was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @consumer_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @quality_category = QualityCategory.find(params[:id])\n\n respond_to do |format|\n if @quality_category.update_attributes(params[:quality_category])\n format.html { redirect_to @quality_category, notice: 'Quality category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quality_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to categories_url, notice: 'Category was successfully updated.' }\n end\n end\n end",
"def update\n @connection_category_class = ConnectionCategoryClass.find(params[:id])\n\n respond_to do |format|\n if @connection_category_class.update_attributes(params[:connection_category_class])\n format.html { redirect_to @connection_category_class, notice: 'Connection category class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @connection_category_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t @category = Category.find(params[:id])\n\n\t respond_to do |format|\n\t\tif @category.update_attributes(params[:category])\n\t\t format.html { redirect_to [:admin, @category], notice: 'Categoria actualizada exitosamente.' }\n\t\telse\n\t\t format.html { render action: \"edit\" }\n\t\tend\n\t end\n\tend",
"def update\n respond_to do |format|\n if @dish_category.update(dish_category_params)\n format.html { redirect_to @dish_category, notice: 'Категория блюда обновлена.' }\n format.json { render :show, status: :ok, location: @dish_category }\n else\n format.html { render :edit }\n format.json { render json: @dish_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @chiropractic_compliance = ChiropracticCompliance.find(params[:id])\n\n respond_to do |format|\n if @chiropractic_compliance.update_attributes(params[:chiropractic_compliance])\n format.html { redirect_to @chiropractic_compliance, notice: 'Chiropractic compliance was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chiropractic_compliance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\tif (@category.titulo != \"Geral\")\n\t\t\trespond_to do |format|\n\t\t\t\tif @category.update(category_params)\n\t\t\t\t\tformat.html { redirect_to @category, notice: 'Categoria atualizada com sucesso.' }\n\t\t\t\t\tformat.json { head :no_content }\n\t\t\t\telse\n\t\t\t\t\tformat.html { render action: 'edit' }\n\t\t\t\t\tformat.json { render json: @category.errors, status: :unprocessable_entity }\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def update\n @expenditure_category = ExpenditureCategory.find(params[:id])\n\n respond_to do |format|\n if @expenditure_category.update_attributes(params[:expenditure_category])\n format.any { head :ok }\n else\n format.any { render :text => @expenditure_account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @category = args[:category] if args.key?(:category)\n @confidence = args[:confidence] if args.key?(:confidence)\n end",
"def update\n @convention_category = ConventionCategory.find(params[:id])\n\n @convention_category.assign_attributes(params[:convention_category])\n\n add_missing_translation_content(@convention_category.convention_category_translations)\n\n respond_to do |format|\n if @convention_category.save\n format.html { redirect_to admin_convention_categories_path, notice: t('app.msgs.success_updated', :obj => t('activerecord.models.convention_category')) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @convention_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @channel_category = ChannelCategory.find(params[:id])\n\n respond_to do |format|\n if @channel_category.update_attributes(params[:channel_category])\n format.html { redirect_to marketing_channel_category_path(@channel_category), notice: 'Channel category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @channel_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to api_v1_category_path(@category), notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @category.assign_attributes(category_params)\n respond_to do |format|\n if @category.save\n format.html { redirect_to edit_category_url(@category), notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @categoria = Categoria.find(params[:id])\n\n @categoria.update_attributes(params[:categoria])\n render :layout => false\n end",
"def update\n @colegiatura = Colegiatura.find(params[:id])\n\n respond_to do |format|\n if @colegiatura.update_attributes(params[:colegiatura])\n format.html { redirect_to @colegiatura, notice: 'Colegiatura was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @colegiatura.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #locates the category to be updated\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @climate = Climate.find(params[:id])\n\n respond_to do |format|\n if @climate.update_attributes(params[:climate])\n format.html { redirect_to climates_path, notice: 'Climate was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @climate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to api_v1_categories_path, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @recipe_category = RecipeCategory.find(params[:id])\n\n respond_to do |format|\n if @recipe_category.update_attributes(params[:recipe_category])\n format.html { redirect_to @recipe_category, notice: 'Recipe category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cdn_config = CdnConfig.find(params[:id])\n\n respond_to do |format|\n if @cdn_config.update_attributes(params[:cdn_config])\n format.html { redirect_to @cdn_config, notice: 'Cdn config was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cdn_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @ccategory = Ccategory.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @ccategory.update_attributes(params[:ccategory])\r\n format.html { redirect_to(pcategories_path, :notice => 'Ccategory was successfully updated.') }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @ccategory.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @pcategory = Pcategory.find(params[:id])\n\n respond_to do |format|\n if @pcategory.update_attributes(params[:pcategory])\n format.html { redirect_to @pcategory, notice: 'La categoria se modifico satisfactoriamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pcategory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @exercise_category = ExerciseCategory.find(params[:id])\n \n respond_to do |format|\n if @exercise_category.update_attributes(params[:exercise_category])\n format.html { redirect_to exercise_categories_path }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @hive_category.update(hive_category_params)\n format.html { redirect_to @hive_category, notice: 'Hive category was successfully updated.' }\n format.json { render :show, status: :ok, location: @hive_category }\n else\n format.html { render :edit }\n format.json { render json: @hive_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @catebg = Catebg.find(params[:id])\n\n respond_to do |format|\n if @catebg.update_attributes(params[:catebg])\n format.html { redirect_to @catebg, notice: 'Catebg was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @catebg.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @abuse_category = AbuseCategory.find(params[:id])\n\n respond_to do |format|\n if @abuse_category.update_attributes(params[:abuse_category])\n format.html { redirect_to @abuse_category, notice: 'Abuse category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @abuse_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @incidentcategory.update(incidentcategory_params)\n format.html { redirect_to @incidentcategory, notice: 'Incidentcategory was successfully updated.' }\n format.json { render :show, status: :ok, location: @incidentcategory }\n else\n format.html { render :edit }\n format.json { render json: @incidentcategory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @charity_category = CharityCategory.find(params[:id])\n\n respond_to do |format|\n if @charity_category.update_attributes(params[:charity_category])\n format.html { redirect_to admins_charity_categories_url, notice: 'Charity Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @charity_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @categoria = Categoria.find(params[:id])\n\n respond_to do |format|\n if @categoria.update_attributes(params[:categoria])\n format.html { redirect_to action: 'index', notice: 'Categoria was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @categoria.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @exercise_category = ExerciseCategory.find(params[:id])\n\n respond_to do |format|\n if @exercise_category.update_attributes(params[:exercise_category])\n format.html { redirect_to @exercise_category, notice: 'Exercise category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @categorization = Categorization.find(params[:id])\n @categories = category_list\n respond_to do |format|\n if @categorization.update_attributes(params[:categorization])\n format.html { redirect_to(admin_categorization_path(@categorization), :notice => 'Categorization was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @categorization.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ilance_category.update(ilance_category_params)\n format.html { redirect_to @ilance_category, notice: 'Ilance category was successfully updated.' }\n format.json { render :show, status: :ok, location: @ilance_category }\n else\n format.html { render :edit }\n format.json { render json: @ilance_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @congressional_district = CongressionalDistrict.find(params[:id])\n\n respond_to do |format|\n if @congressional_district.update_attributes(params[:congressional_district])\n format.html { redirect_to @congressional_district, notice: 'Congressional district was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @congressional_district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @golf_cource = GolfCource.find(params[:id])\n\n respond_to do |format|\n if @golf_cource.update_attributes(params[:golf_cource])\n format.html { redirect_to scaffold_golf_cource_url(@golf_cource), notice: 'Golf cource was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @golf_cource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to category_index_path, notice: 'Categorie was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cdg_configuration.update(cdg_configuration_params)\n format.html { redirect_to @cdg_configuration, notice: 'Cdg configuration was successfully updated.' }\n format.json { render :show, status: :ok, location: @cdg_configuration }\n else\n format.html { render :edit }\n format.json { render json: @cdg_configuration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n begin\n if @auction_category.update_category!(auction_category_params, params[:auction_category][:attribute_ids])\n flash_msg('success', '修改分类成功!', 'index')\n end\n rescue Exception => e\n flash['danger'] = '修改分类失败!#{error_msg(@auction_category)}'\n return redict_to action: 'edit', id: @auction_category.id\n end\n end",
"def update\n @benefit_category = BenefitCategory.find(params[:id])\n\n respond_to do |format|\n if @benefit_category.update_attributes(params[:benefit_category])\n format.html { redirect_to @benefit_category, notice: 'Benefit category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @benefit_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params[:flag_category][:existing_asset_attributes] ||= {}\n @flag_category = current_district.flag_categories.find(params[:id])\n\n respond_to do |format|\n if @flag_category.update_attributes(params[:flag_category])\n flash[:notice] = 'FlagCategory was successfully updated.'\n format.html { redirect_to(flag_categories_url) }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end",
"def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cp_category.update(cp_category_params)\n format.html { redirect_to @cp_category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @cp_category }\n else\n format.html { render :edit }\n format.json { render json: @cp_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @course_category = CourseCategory.find(params[:id])\n\n respond_to do |format|\n if @course_category.update_attributes(params[:course_category])\n format.html { redirect_to @course_category, notice: 'Course category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @activo_categoria_ci = Activo::CategoriaCi.find(params[:id])\n\n respond_to do |format|\n if @activo_categoria_ci.update_attributes(params[:activo_categoria_ci])\n format.html { redirect_to edit_activo_categoria_ci_path(@activo_categoria_ci), notice: 'Actualizado Correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activo_categoria_ci.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @alien_category.update(alien_category_params)\n format.html { redirect_to @alien_category, notice: 'Alien category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @alien_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n flash[:notice] = 'Category was successfully updated.'\n format.html { redirect_to(@category) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @category.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @incidentcategory.update(incidentcategory_params)\n json_response(@incidentcategory)\n else\n render json: @incidentcategory.errors, status: :unprocessable_entity\n end\n end\n end",
"def update\n @category = Category.find(params[:id])\n\n if @category.update_attributes(params[:category])\n flash[:notice] = 'Sucesso - update'\n else\n flash[:notice] = 'Falha ao atualizar a categoria'\n end\n\n # respond_to do |format|\n # if @category.update_attributes(params[:category])\n # format.html { redirect_to categories_path}\n # format.json { head :no_content }\n # else\n # format.html { render action: \"edit\" }\n # format.json { render json: @category.errors, status: :unprocessable_entity }\n \n # end\n # end\n end",
"def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: t(:category_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @census_count = CensusCount.find(params[:id])\n\n respond_to do |format|\n if @census_count.update_attributes(params[:census_count])\n format.html { redirect_to @census_count, notice: 'Census count was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @census_count.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html {\n redirect_to @category, notice: 'Category was successfully updated.'\n }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json {\n render json: @category.errors, status: :unprocessable_entity\n }\n end\n end\n end",
"def update\n @category.update_attributes(params[:category])\n respond_with(@category)\n end",
"def update\n # update attribute\n if @category.update_attributes(category_params)\n # flash message\n flash.now[:success] = \"更新完了しました。\"\n # get category data\n all_categories\n else\n render 'edit'\n end\n end",
"def update\n @categoria_comida = CategoriaComida.find(params[:id])\n\n respond_to do |format|\n if @categoria_comida.update_attributes(params[:categoria_comida])\n format.html { redirect_to(@categoria_comida, :notice => 'Categoria comida was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @categoria_comida.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @discipline = Discipline.find(params[:id])\n\n respond_to do |format|\n if @discipline.update_attributes(params[:discipline])\n format.html { redirect_to @discipline, notice: t(:discipline_successfully_updated) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @discipline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n flash[:notice] = 'Category was successfully updated.'\n format.html { redirect_to(admin_categories_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @category.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to management_categories_path }\n format.json { render json: @category, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @constituency = Constituency.find(params[:id])\n\n respond_to do |format|\n if @constituency.update_attributes(params[:constituency])\n flash[:notice] = 'Constituency was successfully updated.'\n format.html { redirect_to(@constituency) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @constituency.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @achievement_category = AchievementCategory.find(params[:id])\n\n respond_to do |format|\n if @achievement_category.update_attributes(params[:achievement_category])\n format.html { redirect_to @achievement_category, notice: 'Achievement category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @achievement_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to categories_path, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @category = Category.find(params[:id])\n @category.update_attributes(params[:category])\n respond_with(@category, location: categories_url)\n end",
"def update\n @categorie_analytique = CategorieAnalytique.find(params[:id])\n\n respond_to do |format|\n if @categorie_analytique.update_attributes(params[:categorie_analytique])\n format.html { redirect_to @categorie_analytique, notice: 'Categorie analytique was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @categorie_analytique.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @recipe_category = RecipeCategory.find(params[:id])\n\n respond_to do |format|\n if @recipe_category.update_attributes(params[:recipe_category])\n flash[:notice] = l(:flash_notice_recipe_category_updated)\n format.html { redirect_to RecipeCategory.new }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @recipe_category.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @conf = Conf.find(params[:id])\n\n respond_to do |format|\n if @conf.update_attributes(params[:conf])\n format.html { redirect_to @conf, notice: 'Conf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @conf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to admin_good_categories_url, notice: 'GoodCategory was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @effort_category.update(effort_category_params)\n format.html { redirect_to @effort_category, notice: 'Effort category was successfully updated.' }\n format.json { render :show, status: :ok, location: @effort_category }\n else\n format.html { render :edit }\n format.json { render json: @effort_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @category.update(category_params)\n render json: @category, status: :ok\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end",
"def update\n @asset_category = AssetCategory.find(params[:id])\n\n respond_to do |format|\n if @asset_category.update_attributes(params[:asset_category])\n flash[:success] = 'Asset category was successfully updated.'\n format.html { redirect_to(admin_asset_categories_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @asset_category.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event_category.update(event_category_params)\n format.html { redirect_to convention_setup_event_event_categories_path(@event_category.event), notice: 'Event Category was successfully updated.' }\n else\n format.html { render action: \"edit\" }\n end\n end\n end",
"def update\n @o_single = Category.find(params[:id])\n if @o_single.update_attributes(params[:category])\n flash[:notice] = t(\"general.successfully_updated\")\n redirect_to categories_path\n else\n render :action => 'edit'\n end\n end",
"def update\n respond_to do |format|\n if @categorium.update(categorium_params)\n format.html { redirect_to @categorium, notice: 'Categoría fue actualizada exitosamente.' }\n format.json { render :show, status: :ok, location: @categorium }\n else\n format.html { render :edit }\n format.json { render json: @categorium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @headline = t(:update_category)\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: t(:updated_category_success) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to edit_dashboard_category_path(@category), notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to categories_path, notice: \"Category was successfully updated.\" }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6198535",
"0.6106345",
"0.5916987",
"0.5887394",
"0.587999",
"0.5870782",
"0.5862843",
"0.5859483",
"0.5840661",
"0.5826392",
"0.58237153",
"0.5813764",
"0.5779657",
"0.5775433",
"0.57652825",
"0.575386",
"0.5753351",
"0.5749788",
"0.5748321",
"0.5747623",
"0.57404166",
"0.5725797",
"0.57212865",
"0.57211953",
"0.5706689",
"0.56945103",
"0.56825405",
"0.56766367",
"0.56637996",
"0.56599593",
"0.5657716",
"0.56518847",
"0.5647126",
"0.56408095",
"0.56343085",
"0.5632397",
"0.5630953",
"0.5628592",
"0.5626606",
"0.56237805",
"0.56215376",
"0.56181103",
"0.5617651",
"0.5614788",
"0.56140274",
"0.5612812",
"0.56127274",
"0.561159",
"0.56113285",
"0.56110966",
"0.56093705",
"0.5606376",
"0.56019366",
"0.5599304",
"0.5598211",
"0.5594801",
"0.5592905",
"0.5583932",
"0.55826354",
"0.5579268",
"0.55754435",
"0.55751806",
"0.55698514",
"0.5569045",
"0.5569045",
"0.5569045",
"0.5569045",
"0.5569045",
"0.5569045",
"0.5569045",
"0.5568894",
"0.5564116",
"0.55577636",
"0.5552606",
"0.55505383",
"0.55498475",
"0.55497974",
"0.55471504",
"0.5538284",
"0.5536175",
"0.55360425",
"0.55334544",
"0.55271024",
"0.5522609",
"0.5522355",
"0.55192006",
"0.5517798",
"0.5515338",
"0.5514861",
"0.5514001",
"0.55138934",
"0.5512305",
"0.5511607",
"0.5506292",
"0.5506076",
"0.5503053",
"0.5501945",
"0.5498127",
"0.5496313",
"0.5494225",
"0.5494225"
] | 0.0 | -1 |
Delete a curation by id. | def destroy_curation(engine_name, id)
delete("engines/#{engine_name}/curations/#{id}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(id)\n call(:delete, path(id))\n end",
"def DeleteCategory id\n \n APICall(path: \"categories/#{id}.json\",method: 'DELETE')\n \n end",
"def delete(id)\n self.find(id).delete_\n end",
"def delete_category id\n\t\t\t\t\tFreshdesk::Api::Client.delete_status_wrapper do\n\t\t\t\t\t\t( @connection.delete CATEGORIES, id ).code\n\t\t\t\t\tend\n\t\t\t\tend",
"def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end",
"def delete(id)\n path(id).delete\n clean(id) if clean?\n end",
"def delete(id)\n @conn.execute(*@builder.delete(id))\n end",
"def delete(id)\n read_or_die(id)\n\n sql, vals = sql_delete(id_fld => id)\n execute sql_subst(sql, *vals.map{|v| quote v})\n\n self\n\n rescue => e\n handle_error(e)\n end",
"def delete(id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id)\n\t\t\tclient.queue_service_action_call('configurationgroup', 'delete', 'bool', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"def delete(id)\n file = get_file(id)\n delete_file(file) unless file.nil?\n end",
"def delete(id)\n path = path(id)\n path.delete\n clean(path) if clean?\n rescue Errno::ENOENT\n end",
"def delete(id)\n collection.remove(id)\n end",
"def delete(project_id, id)\n @_client.delete(\"#{resource_root(project_id)}/#{id}\")\n end",
"def delete(id)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\"\n return HTTParty.delete(url, :timeout => 4)\n end\n end",
"def delete_calendar(id)\n @client.raw('delete', \"/config/calendars/#{id}\")\n end",
"def delete(id:)\n path = file_path(id)\n storage_object_id, file_category = id_from_path(path)\n\n delete_from_moab(storage_object_id, path, file_category)\n end",
"def delete(id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id)\n\t\t\tclient.queue_service_action_call('configurations', 'delete', 'bool', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"def delete(id)\n @service.delete(id)\n end",
"def delete(id)\n collection.remove({ _id: id })\n end",
"def delete(id)\n # TODO: Implement this for Stripe webhooks\n end",
"def destroy(id)\n Ribs.with_handle(self.database) do |h|\n h.delete(get(id))\n end\n end",
"def delete_calendar(id)\n return @client.raw(\"delete\", \"/config/calendars/#{id}\")\n end",
"def delete(id:)\n id_check('id', id)\n\n cf_delete(path: \"/zones/#{zone_id}/rate_limits/#{id}\")\n end",
"def delete(id)\n FileUtils.rm_r File.join(DOTDIR, id)\n end",
"def delete(id:)\n id_check('id', id)\n cf_delete(path: \"/zones/#{zone_id}/custom_certificates/#{id}\")\n end",
"def time_accruals_id_delete(id, opts = {})\n time_accruals_id_delete_with_http_info(id, opts)\n return nil\n end",
"def delete( id )\n lib.tcidbout( @db, id ) || raise_error\n end",
"def delete(id)\n wf_event_id?(id)\n api.delete(id)\n end",
"def delete_layer(id)\n if layer = layers.find {|layer| layer.id == id}\n layer.destroy\n end\n end",
"def delete(id)\n request(:delete, \"/recipes/#{id}.json\")\n end",
"def delete_heartbeat(id)\n Record.with(collection: \"#{self.class.name.demodulize.downcase}_heartbeat\") do |m|\n m.where(id: id).delete\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete_id(id)\n redis.srem(key, id)\n end",
"def destroy(id)\n http.delete(\"/nfse/#{id}\") do |response|\n response.code == 204\n end\n end",
"def delete(id)\r\n connection.delete(\"/#{@doctype}[@ino:id=#{id}]\")\r\n end",
"def connections_id_delete(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: ConnectionApi#connections_id_delete ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling connections_id_delete\" if id.nil?\n \n # resource path\n path = \"/connections/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:DELETE, 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 => 'inline_response_200_2')\n if Configuration.debugging\n Configuration.logger.debug \"API called: ConnectionApi#connections_id_delete. Result: #{result.inspect}\"\n end\n return result\n end",
"def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"#{uri_prefix}/virtual_dns/#{id}\")\n end",
"def remove(id, options={})\n id = self.get_id(id)\n self.perform_delete(\"/#{id}\", options)\n end",
"def delete(id)\n return true unless id\n with_redis { |redis| redis.del(redis_key_for(id)) }\n true\n end",
"def destroy\n #REQUIRES: existence of contest with :id\n #MODIFIES: the database\n #EFFECTS: deletes the information in the database of the contest with :id\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to(contests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n fail \"No id; can't delete #{self.inspect}!\" unless id\n Connection.delete(create_route(:delete))\n end",
"def delete_task(id)\n @store.transaction do\n @store[id].categories[\"deleted\"] = true\n end\n end",
"def destroy(id = nil)\n new(__record_id: id).destroy\n end",
"def delete_story(id)\n @client.raw('delete', \"/content/stories/#{id}\")\n end",
"def destroy\n Seances::UseCases::Delete.new.call(id: params[:id])\n end",
"def delete_coupon(id)\n url = \"#{api_resource}/#{id}/coupons\"\n request.delete(url).parse\n end",
"def delete(id)\n request(:delete, \"/network_zones/#{id}.json\")\n end",
"def delete(id)\n record = find(id)\n return unless record\n\n delete_from_file(@file, record)\n @records = read_file(@file)\n end",
"def destroy\n self.class.delete(id)\n end",
"def remove_by_id(clazz, id)\n client.remove(:class => clazz, :id => id)\n end",
"def destroy\n @color_saturation = ColorSaturation.find(params[:id])\n @color_saturation.destroy\n\n respond_to do |format|\n format.html { redirect_to color_saturations_url }\n format.json { head :ok }\n end\n end",
"def delete_deal(id)\n delete(\"deals/#{id}\")\n end",
"def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end",
"def destroy\n @conclusion = Conclusion.find(params[:id])\n @conclusion.destroy\n\n respond_to do |format|\n format.html { redirect_to conclusions_url }\n format.json { head :no_content }\n end\n end",
"def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def delete(id)\n @storage.delete(id)\n purge(id)\n end",
"def delete_by_id id, opts = {}\n update opts.merge(:data => xml.delete_by_id(id))\n end",
"def delete(id)\n lock.synchronize do\n @deleted_ids << id.to_s\n end\n end",
"def destroy\n @criterion = Criterion.find(params[:id])\n @criterion.destroy\n\n head :no_content\n end",
"def destroy\n IndicatorCategory.delete_hack(params[:id])\n\n respond_to do |format|\n format.html { redirect_to indicator_categories_url }\n format.json { head :ok }\n end\n end",
"def delete_design_doc(id)\n doc = get_design_doc(id)\n rev = doc[\"_rev\"] if doc && doc[\"_rev\"]\n\n @conn.query({url_path: \"#{database}/_design/#{id}?rev=#{rev}\", opts: doc, method: :delete})\n end",
"def destroy\n @constitution = Constitution.find(params[:id])\n @constitution.destroy\n\n respond_to do |format|\n format.html { redirect_to constitutions_url }\n format.json { head :no_content }\n end\n end",
"def delete(id)\n @hashes.delete(id)\n end",
"def remove_content(id)\n delete(\"/#{id}\")\n end",
"def delete(category_id)\n response, status = BeyondApi::Request.delete(@session, \"/categories/#{category_id}\")\n\n handle_response(response, status, respond_with_true: true)\n end",
"def destroy\n self.class.delete(id)\n end",
"def remove(curation_concern, id)\n member = ActiveFedora::Base.find(id)\n curation_concern.ordered_members.delete(member)\n curation_concern.members.delete(member)\n end",
"def delete_campaign(campaign_id)\n request :delete, \"api/1/campaigns/#{campaign_id}\"\n nil\n end",
"def destroy(klass, id)\n options = { resource: klass, id: id, format: nil }\n reply = delete resource_url(options), fhir_headers(options)\n reply.resource_class = klass\n reply\n end",
"def delete(id)\n emsg = \"The %s argument cannot be nil, empty, or a zero length string\"\n raise(ArgumentError, emsg % ['id']) if !id.kind_of?(Integer)\n\n # remove the account\n @accounts.delete_if{|a| a.id == id}\n end",
"def destroy\n @contacter = Contacter.find(params[:id])\n @contacter.destroy\n\n respond_to do |format|\n format.html { redirect_to contacters_url }\n format.json { head :no_content }\n end\n end",
"def delete_relationship(id)\n return @client.raw(\"delete\", \"/config/relationships/#{id}\")\n end",
"def delete\n ExcerciseType.find(params[:id]).destroy\n flash[:success] = \"Type ćwiczeń został usunięty\"\n redirect_to excercise_types_path\n end",
"def destroy\n @activo_categoria_ci = Activo::CategoriaCi.find(params[:id])\n if @activo_categoria_ci.destroy\n flash[:notice] = 'Eliminado Correctamente'\n end\n\n respond_to do |format|\n format.html { redirect_to activo_categoria_cis_url }\n format.json { head :no_content }\n end\n end",
"def delete(type, id)\n http_delete @target, \"#{type_info(type, :path)}/#{Addressable::URI.encode(id)}\", @auth_header, @zone\n end",
"def delete()\n sql = \"DELETE FROM albums\n WHERE id = $1;\"\n values = [@id]\n SqlRunner.run( sql, values )\n end",
"def time_accruals_id_delete_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TimeAccrualsApi.time_accruals_id_delete ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling TimeAccrualsApi.time_accruals_id_delete\"\n end\n # resource path\n local_var_path = \"/time/accruals/{id}\".sub('{' + 'id' + '}', id.to_s)\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 = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, 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: TimeAccrualsApi#time_accruals_id_delete\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def delete(id)\n connection.delete do |req|\n req.url \"job/#{id}\"\n end\n end",
"def destroy\n identifier = @analysis_configuration.identifier\n @analysis_configuration.destroy\n respond_to do |format|\n format.html { redirect_to analysis_configurations_url, notice: \"'#{identifier}' was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url, :notice => 'Contest was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def delete(id)\n raise RuntimeError, \"File datastore does not support document deletion\"\n end",
"def destroy\n @criterion = Criterion.find(params[:id])\n @criterion.destroy\n redirect_to criterions_path, :notice => 'Criterion deleted'\n end",
"def delete_authorization(id)\n boolean_request :delete, \"/authorizations/#{id}\"\n end",
"def destroy\n @congestion = Congestion.find(params[:id])\n @congestion.destroy\n\n respond_to do |format|\n format.html { redirect_to congestions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @disc_color = DiscColor.find(params[:id])\n @disc_color.destroy\n\n respond_to do |format|\n format.html { redirect_to disc_colors_url }\n format.json { head :no_content }\n end\n end",
"def delete id\n\t\t@tickets.delete ['id', id]\n\tend",
"def delete_field_option(id)\n delete(\"fieldOptions/#{id}\")\n end",
"def delete\n sql = \"DELETE FROM tickets WHERE id = $1\"\n values = [id]\n SqlRunner.run(sql, values)\n end",
"def delete(\n id,\n deadline: nil\n )\n req = V1::ResourceDeleteRequest.new()\n\n req.id = (id)\n tries = 0\n plumbing_response = nil\n loop do\n begin\n plumbing_response = @stub.delete(req, metadata: @parent.get_metadata(\"Resources.Delete\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + +@parent.jitterSleep(tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n break\n end\n\n resp = ResourceDeleteResponse.new()\n resp.meta = Plumbing::convert_delete_response_metadata_to_porcelain(plumbing_response.meta)\n resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)\n resp\n end",
"def delete_topic id\n\t\t\t\t\tFreshdesk::Api::Client.delete_status_wrapper do\n\t\t\t\t\t\t( @connection.delete TOPICS, id ).code\n\t\t\t\t\tend\n\t\t\t\tend",
"def destroy\n @capd = Capd.find(params[:id])\n @capd.destroy\n\n respond_to do |format|\n format.html { redirect_to(capds_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy(id)\n store.write do |data|\n data[:columns][column].delete(id)\n end\n\n true\n end",
"def destroy\n @catebg = Catebg.find(params[:id])\n @catebg.destroy\n\n respond_to do |format|\n format.html { redirect_to catebgs_url }\n format.json { head :no_content }\n end\n end",
"def delete(id)\n request(:delete, \"/settings/hypervisor_zones/#{id}.json\")\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :ok }\n end\n end",
"def delete_event(id)\n @event_svc.delete(id)\n end",
"def destroy\n @condclima = Condclima.find(params[:id])\n @condclima.destroy\n\n respond_to do |format|\n format.html { redirect_to condclimas_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.6870713",
"0.6780861",
"0.6739258",
"0.67305934",
"0.66910684",
"0.6630953",
"0.6616764",
"0.64736503",
"0.63640785",
"0.6355412",
"0.63428944",
"0.63265175",
"0.6326052",
"0.6304313",
"0.62988424",
"0.62863296",
"0.62769693",
"0.62695193",
"0.6247521",
"0.62436956",
"0.623873",
"0.6207256",
"0.620187",
"0.6193941",
"0.617274",
"0.61607397",
"0.6150713",
"0.6110574",
"0.61069304",
"0.6087461",
"0.6070635",
"0.6036159",
"0.6021014",
"0.6020339",
"0.5991136",
"0.59908926",
"0.5957704",
"0.5956744",
"0.59478706",
"0.59320015",
"0.5916382",
"0.5911208",
"0.59087485",
"0.5896398",
"0.5894605",
"0.58939224",
"0.58926606",
"0.5889051",
"0.5880835",
"0.58746016",
"0.5871054",
"0.5864028",
"0.58510345",
"0.58494693",
"0.5844386",
"0.58277816",
"0.5823251",
"0.5819963",
"0.58122057",
"0.58059067",
"0.58044606",
"0.5797133",
"0.5783202",
"0.5781652",
"0.5780679",
"0.57751197",
"0.5763956",
"0.5760439",
"0.5744567",
"0.57426447",
"0.5742127",
"0.57325596",
"0.5729888",
"0.57231665",
"0.5722559",
"0.5721929",
"0.57150424",
"0.5714768",
"0.5707249",
"0.5701403",
"0.57001257",
"0.56960154",
"0.56942844",
"0.56923187",
"0.5683026",
"0.5671066",
"0.5662954",
"0.56500214",
"0.56465065",
"0.5645398",
"0.5641832",
"0.56390333",
"0.56390333",
"0.56390333",
"0.56390333",
"0.56350106",
"0.56335086",
"0.5627007",
"0.5626732",
"0.56231093",
"0.56224465"
] | 0.0 | -1 |
Creates the a connection with middleware for mapping errors, parsing json, and adding breakers functionality. | def connection
Faraday.new(base_path, headers: base_request_headers, request: request_options) do |faraday|
faraday.use :breakers
faraday.request :json
faraday.response :raise_error, error_prefix: service_name
faraday.response :betamocks if mock_enabled?
faraday.response :json
faraday.adapter Faraday.default_adapter
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def middleware\n connection.builder\n end",
"def middleware\n connection.builder\n end",
"def build_connection(options = FmRest.default_connection_settings, &block)\n base_connection(options) do |conn|\n conn.use RaiseErrors\n conn.use TokenSession, options\n\n # The EncodeJson and Multipart middlewares only encode the request\n # when the content type matches, so we can have them both here and\n # still play nice with each other, we just need to set the content\n # type to multipart/form-data when we want to submit a container\n # field\n conn.request :multipart\n conn.request :json\n\n if options[:log]\n conn.response :logger, nil, bodies: true, headers: true\n end\n\n # Allow overriding the default response middleware\n if block_given?\n yield conn\n else\n conn.response :json\n end\n\n conn.adapter Faraday.default_adapter\n end\n end",
"def build_connection(settings = FmRest.default_connection_settings, &block)\n settings = ConnectionSettings.wrap(settings)\n\n base_connection(settings, headers: DEFAULT_HEADERS) do |conn|\n conn.use RaiseErrors\n conn.use TokenSession, settings\n\n # The EncodeJson and Multipart middlewares only encode the request\n # when the content type matches, so we can have them both here and\n # still play nice with each other, we just need to set the content\n # type to multipart/form-data when we want to submit a container\n # field\n conn.request :multipart\n conn.request :json\n\n # Allow overriding the default response middleware\n if block_given?\n yield conn, settings\n else\n conn.use TypeCoercer, settings\n conn.response :json, content_type: /\\bjson$/\n end\n\n if settings.log\n conn.response :logger, FmRest.logger, bodies: true, headers: true, log_level: settings.log_level\n end\n\n conn.adapter Faraday.default_adapter\n end\n end",
"def setup_connection\n Faraday.new(:url => @api_url) do |connection|\n #connection.request :url_encoded\n connection.request :json\n #connection.request :retry\n\n connection.response :logger if debug?\n connection.response :raise_error\n connection.response :json, :content_type => /\\bjson$/\n\n connection.use :instrumentation\n connection.adapter Faraday.default_adapter\n end\n end",
"def connection\n Faraday.new(api_url) do |conn|\n conn.use :breakers\n conn.response :snakecase\n conn.response :json, content_type: /\\bjson$/\n conn.adapter Faraday.default_adapter\n end\n end",
"def connection\n Faraday.new(api_url) do |conn|\n conn.use :breakers\n conn.response :snakecase\n conn.response :json, content_type: /\\bjson$/\n conn.adapter Faraday.default_adapter\n end\n end",
"def middleware\n @middleware ||= proc do |builder|\n builder.request(:desk_encode_dates)\n builder.request(:desk_encode_json)\n builder.request(*authorize_request)\n builder.request(:desk_retry)\n\n builder.response(:desk_parse_dates)\n builder.response(:desk_follow_redirects)\n builder.response(:desk_raise_error, DeskApi::Error::ClientError)\n builder.response(:desk_raise_error, DeskApi::Error::ServerError)\n builder.response(:desk_parse_json)\n\n builder.adapter(Faraday.default_adapter)\n end\n end",
"def connection\n options = { url: api_url, ssl: { verify: false } }\n\n connection = Faraday.new(options) do |conn|\n conn.response :readmill_errors\n conn.response :mashify\n conn.response :json\n\n conn.adapter adapter\n end\n\n connection\n end",
"def rescue_middleware\n @rescue_middleware ||= GraphQL::Schema::RescueMiddleware.new.tap { |m| middleware.insert(0, m) }\n end",
"def rescue_middleware\n @rescue_middleware ||= GraphQL::Schema::RescueMiddleware.new.tap { |m| middleware.insert(0, m) }\n end",
"def json_connection\n @json_connection ||= Faraday.new(@json_endpoint, @connection_options.merge(:builder => @middleware))\n end",
"def initialize(opts = {})\n @server_url = opts[:server_url] || ENV[\"PARSE_SERVER_URL\"] || Parse::Protocol::SERVER_URL\n @application_id = opts[:application_id] || opts[:app_id] || ENV[\"PARSE_APP_ID\"] || ENV['PARSE_SERVER_APPLICATION_ID']\n @api_key = opts[:api_key] || opts[:rest_api_key] || ENV[\"PARSE_API_KEY\"] || ENV[\"PARSE_REST_API_KEY\"]\n @master_key = opts[:master_key] || ENV[\"PARSE_MASTER_KEY\"] || ENV['PARSE_SERVER_MASTER_KEY']\n opts[:adapter] ||= Faraday.default_adapter\n opts[:expires] ||= 3\n if @application_id.nil? || ( @api_key.nil? && @master_key.nil? )\n raise \"Please call Parse.setup(application_id:, api_key:) to setup a session\"\n end\n @server_url += '/' unless @server_url.ends_with?('/')\n #Configure Faraday\n opts[:faraday] ||= {}\n opts[:faraday].merge!(:url => @server_url)\n @conn = Faraday.new(opts[:faraday]) do |conn|\n #conn.request :json\n\n conn.response :logger if opts[:logging]\n\n # This middleware handles sending the proper authentication headers to Parse\n # on each request.\n\n # this is the required authentication middleware. Should be the first thing\n # so that other middlewares have access to the env that is being set by\n # this middleware. First added is first to brocess.\n conn.use Parse::Middleware::Authentication,\n application_id: @application_id,\n master_key: @master_key,\n api_key: @api_key\n # This middleware turns the result from Parse into a Parse::Response object\n # and making sure request that are going out, follow the proper MIME format.\n # We place it after the Authentication middleware in case we need to use then\n # authentication information when building request and responses.\n conn.use Parse::Middleware::BodyBuilder\n if opts[:logging].present? && opts[:logging] == :debug\n Parse::Middleware::BodyBuilder.logging = true\n end\n\n if opts[:cache].present? && opts[:expires].to_i > 0\n unless opts[:cache].is_a?(Moneta::Transformer)\n raise ArgumentError, \"Parse::Client option :cache needs to be a type of Moneta::Transformer store.\"\n end\n self.cache = opts[:cache]\n conn.use Parse::Middleware::Caching, self.cache, {expires: opts[:expires].to_i }\n end\n\n yield(conn) if block_given?\n\n conn.adapter opts[:adapter]\n\n end\n Parse::Client.clients[:default] ||= self\n self\n end",
"def initialize(hash={})\n super(\"#{hash[:base_url] || \"http://127.0.0.1:5984\" }/#{hash[:database] || \"huboard\"}\") do |builder|\n yield builder if block_given?\n builder.use FaradayMiddleware::EncodeJson\n builder.use FaradayMiddleware::Mashify\n builder.use FaradayMiddleware::ParseJson\n builder.request :retry, max: 4,\n exceptions: [\n Errno::ETIMEDOUT,\n 'Timeout::Error',\n Faraday::TimeoutError,\n Faraday::ConnectionFailed,\n ]\n builder.use Timeout\n # builder.use Ghee::Middleware::UriEscape\n builder.use Faraday::HttpCache, store: Rails.cache, logger: Logger.new(STDOUT), serializer: Marshal\n builder.adapter Faraday.default_adapter\n\n builder.request :url_encoded\n end\n end",
"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",
"def initialize(params = {})\n @pid = Process.pid\n @data = Excon.defaults.dup\n # merge does not deep-dup, so make sure headers is not the original\n @data[:headers] = @data[:headers].dup\n\n # the same goes for :middlewares\n @data[:middlewares] = @data[:middlewares].dup\n\n @data.merge!(params)\n validate_params(:connection, @data, @data[:middlewares])\n\n if @data.key?(:host) && !@data.key?(:hostname)\n Excon.display_warning('hostname is missing! For IPv6 support, provide both host and hostname: Excon::Connection#new(:host => uri.host, :hostname => uri.hostname, ...).')\n @data[:hostname] = @data[:host]\n end\n\n setup_proxy\n\n if ENV.has_key?('EXCON_STANDARD_INSTRUMENTOR')\n @data[:instrumentor] = Excon::StandardInstrumentor\n end\n\n if @data[:debug] || ENV.has_key?('EXCON_DEBUG')\n @data[:debug_request] = @data[:debug_response] = true\n @data[:instrumentor] = Excon::StandardInstrumentor\n end\n\n if @data[:scheme] == UNIX\n # 'uri' >= v0.12.0 returns an empty string instead of nil for no host.\n # So treat the parameter as present if and only if it is both non-nill and non-empty.\n if @data[:host] && !@data[:host].empty?\n raise ArgumentError, \"The `:host` parameter should not be set for `unix://` connections.\\n\" +\n \"When supplying a `unix://` URI, it should start with `unix:/` or `unix:///`.\"\n elsif !@data[:socket]\n raise ArgumentError, 'You must provide a `:socket` for `unix://` connections'\n else\n @socket_key = \"#{@data[:scheme]}://#{@data[:socket]}\"\n end\n else\n @socket_key = \"#{@data[:scheme]}://#{@data[:host]}#{port_string(@data)}\"\n end\n reset\n end",
"def connection_wrapper(&block)\n begin\n response = block.call\n raise ClientError.new(response.body['error']) if response.body.has_key?('error')\n rescue Faraday::ParsingError => e\n # Has gotten a response, but it is not formatted with JSON\n raise ClientError.new(e.message)\n rescue Faraday::ClientError => e\n # Failed to build a connection\n raise ConnectionError.new(e.message)\n end\n\n response\n end",
"def middleware; end",
"def connection\n Faraday.new(url:, headers:) do |conn|\n conn.request :json\n conn.use :breakers\n conn.use Faraday::Response::RaiseError\n conn.response :raise_error, error_prefix: service_name\n conn.response :json\n conn.response :betamocks if mock_enabled?\n conn.adapter Faraday.default_adapter\n end\n end",
"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",
"def create_connection\n\t\t@connection = Faraday.new(:url => @base_url) do |faraday|\n\t\t\tfaraday.headers['Accept'] = 'application/json'\n\t\t\tfaraday.adapter Faraday.default_adapter\n\t\tend\n\tend",
"def connection(env); end",
"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",
"def jump_connection\n logger = Logger.new(@config[:log])\n logger.level = Logger.const_get(@log_level)\n Faraday.new(url: 'https://' + @api_hosts_list[@api_host_index]) do |conn|\n conn.headers['Content-Type'] = 'application/json;charset=UTF-8'\n conn.headers['Accept'] = 'application/json'\n conn.headers['x-sessionToken'] = @session_token ? @session_token : ''\n conn.headers['x-authenticationToken'] = @auth_token ? @auth_token : ''\n conn.headers['User-Agent'] = @config[:user_agent]\n conn.request :url_encoded\n conn.use :eds_exception_middleware\n conn.response :json, content_type: /\\bjson$/\n conn.response :detailed_logger, logger if @debug\n conn.options[:open_timeout] = @config[:open_timeout]\n conn.options[:timeout] = @config[:timeout]\n conn.adapter :net_http_persistent\n end\n end",
"def connection\n Faraday.new(url: url) do |conn|\n conn.use :breakers\n conn.response :check_in_errors\n conn.use :check_in_logging\n conn.response :raise_error, error_prefix: service_name\n conn.adapter Faraday.default_adapter\n end\n end",
"def new_connection; end",
"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",
"def create\n @connection = Connection.new(params[:connection])\n @connection.user = current_user\n @connection.database_type = 'mysql'\n\n if @connection.port.nil?\n @connection.port = '3306'\n end\n\n respond_to do |format|\n if @connection.save\n redirect_path = param(:redirect, connections_path)\n\n format.html { redirect_to redirect_path, notice: 'Connection was successfully created.' }\n format.json { render json: @connection, status: :created, location: @connection }\n else\n format.html { render action: \"new\" }\n format.json { render json: @connection.errors, status: :unprocessable_entity }\n end\n end\n end",
"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",
"def initialize(connection)\n super(connection)\n\n @has_request_body = false\n\n @backend = Tresor::Backend::Backend.new(connection)\n end",
"def middleware(&block); end",
"def connection\n @connection ||= Faraday.new(api_endpoint) do |http|\n http.headers[:accept] = \"application/json, */*\"\n http.headers[:user_agent] = user_agent\n\n http.request :authorization, :Bearer, -> { token_store.get_token }\n http.request :json\n\n http.use Keap::REST::Response::RaiseError\n\n http.response :dates\n http.response :json, content_type: \"application/json\"\n # http.response :logger do |logger|\n # logger.filter(/(Bearer) (\\w+)/, '\\1 [FILTERED]')\n # end\n\n http.adapter adapter, @stubs\n end\n end",
"def parser_wrapper\n yield\n rescue ::Occi::Core::Errors::ParsingError => ex\n logger.error \"Request parsing failed: #{ex.class} #{ex.message}\"\n raise Errors::ParsingError, ex.message\n end",
"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",
"def new_connection(handler)\n return unless Config.metrics\n unless handler.application.nil?\n # Get peer's IP and port\n peer = handler.peer_ip_port()\n # Update record\n work_data.update(\n {app_id: handler.application.app_id},\n {'$addToSet' => {connections: {slanger_id: Cluster.node_id, peer: peer}}, '$set' => {timestamp: Time.now.to_i}},\n {upsert: true}\n )\n end\n end",
"def connect(*) end",
"def initialize(connection, meta)\n @connection, @meta = connection, meta\n end",
"def connection\n @connection ||= Faraday.new @url do |c|\n c.headers[\"X-Api-Token\"] = @token\n c.use FaradayMiddleware::ParseJson, content_type: \"application/json\"\n #c.use Faraday::Response::Logger, Logger.new(\"tmp/faraday.log\")\n c.use FaradayMiddleware::FollowRedirects, limit: 3\n c.use Faraday::Response::RaiseError # raise exceptions on 40x, 50x responses\n c.use Faraday::Adapter::NetHttp\n end\n end",
"def initialize(config)\n super\n @connection = Faraday.new(url: (config['rest']).to_s) do |builder|\n builder.response :json\n builder.response :logger if config['debug']\n builder.adapter(@adapter)\n unless config['verify_ssl'].nil?\n builder.ssl[:verify] = config['verify_ssl']\n end\n end\n @ping_set = false\n @rest = (config['rest']).to_s\n @ws_url = (config['websocket']).to_s\n end",
"def connect\n @connection.create\n end",
"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",
"def connection; end",
"def connection; end",
"def connection; end",
"def connection; end",
"def connection; end",
"def connection; end",
"def connection; end",
"def connection; end",
"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",
"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",
"def connection\n @connection ||= build_connection\n end",
"def new\n @rapper = Rapper.new\nend",
"def initialize(connection)\n @connection = connection\n end",
"def connection\n @connection ||= make_connection\n end",
"def connection\n @connection ||= Faraday.new(@endpoint, @connection_options.merge(:builder => @middleware))\n end",
"def connection\n @connection ||= Faraday.new(@endpoint, @connection_options.merge(:builder => @middleware))\n end",
"def connection\n @connection ||= Faraday.new(@endpoint, @connection_options.merge(:builder => @middleware))\n end",
"def connection\n @connection ||= Faraday.new(@endpoint, @connection_options.merge(:builder => @middleware))\n end",
"def connection(&blk)\n @connection ||= Connection.build endpoint.secret, &blk\n end",
"def connection\n @connection ||= Faraday.new(url: Leo.route_base) do |faraday|\n faraday.options.timeout = Leo.read_timeout\n faraday.options.open_timeout = Leo.open_timeout\n faraday.use Faraday::Response::RaiseError\n faraday.request :url_encoded\n faraday.adapter Faraday.default_adapter\n end\n end",
"def initialize(opts = \"\", &block)\n raise \"Block required for changes!\" unless block_given?\n\n @schemas = {}\n @handlers = []\n @source = CouchRest.database(opts)\n info = @source.info\n @http = HTTPClient.new\n\n logger.info \"Connected to CouchDB: #{info['db_name']}\"\n\n # Prepare the definitions\n instance_eval(&block)\n end",
"def configure_connection(conn)\n conn.headers['Accept'] = [JSON_TYPE]\n\n conn.response :json, content_type: JSON_TYPE\n end",
"def connection_handlers\n @connection_handlers ||= [\n proc do |conn|\n conn.request :json\n if @oauth2\n conn.request :oauth2, @oauth2.token, :token_type => @oauth2.token_type\n end\n end,\n proc do |conn|\n if @logging\n conn.response :logger, nil, :bodies => (@logging.casecmp('DEBUG') == 0)\n end\n conn.response :json, :content_type => /\\bjson$/\n end,\n proc{|conn| conn.adapter Faraday.default_adapter }\n ]\n end",
"def connection_handlers\n @connection_handlers ||= [\n proc do |conn|\n conn.request :json\n if @oauth2\n conn.request :oauth2, @oauth2.token, :token_type => @oauth2.token_type\n end\n end,\n proc do |conn|\n if @logging\n conn.response :logger, nil, :bodies => (@logging.casecmp('DEBUG') == 0)\n end\n conn.response :json, :content_type => /\\bjson$/\n end,\n proc{|conn| conn.adapter Faraday.default_adapter }\n ]\n end",
"def initialize_connection(env)\n end",
"def initialize(connection)\n super connection\n self.header = Header.new\n self.message = Message.new\n self.body = \"\"\n end",
"def configure(con)\n con.use :instrumentation\n\n # The definition order is execution order\n con.request :ph_data_sanitization\n con.request :ph_default_headers\n con.request :json\n con.request :multipart\n con.request :url_encoded\n\n # The definition order is reverse to the execution order\n con.response :ph_recursive_open_struct\n con.response :ph_data_sanitization\n con.response :dates\n con.response :json, content_type: /\\bjson$/\n con.response :follow_redirects\n\n con.adapter Faraday.default_adapter\n end",
"def initialize(params = {})\n params = Hashie::Mash.new(params)\n required_params params\n params.f ||= :json\n params.options ||= nil\n @params = params\n @connection = get_connection params.options\n end",
"def connect!; end",
"def connect!; end",
"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",
"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",
"def connection\n options = {\n :headers => {'Accept' => \"application/#{SponsorPay.format}; charset=utf-8\", \n 'User-Agent' => SponsorPay.user_agent, \n 'Connection' => 'Keep-Alive'}, \n #'Accept-Encoding' => 'gzip ...' # => automatically added by net::http\n :ssl => {:verify => false},\n :url => SponsorPay.endpoint,\n }\n Faraday::Connection.new(options) do |connection|\n connection.use FaradayMiddleware::Mashify\n connection.use Faraday::Response::ParseJson if SponsorPay.format.to_s.downcase == 'json'\n connection.adapter SponsorPay.adapter\n end\n end",
"def with_connection(&block)\n connect unless connected?\n yield\n rescue => e\n log_error(e)\n close(flush: false)\n raise\n end",
"def connection\n @connection ||= Faraday.new(base_url) do |builder|\n build_middleware(builder)\n builder.adapter Faraday.default_adapter\n end\n end",
"def make_conn(conn)\n conn.h_conn = @dbm.make_conn(conn.spec)\n end",
"def initialize\n @router = Router.new\n add_head_not_allowed_methods_and_options_methods\n self.class.endpoints.each do |endpoint|\n endpoint.mount_in(@router)\n end\n\n @router.compile!\n @router.freeze\n end",
"def initialize(options={})\n config = options.fetch(:config) { Wrapped::PoolConfig.new }\n host = options.fetch(:host, Wrapped::Protocol::DEFAULT_HOST)\n port = options.fetch(:post, Wrapped::Protocol::DEFAULT_PORT)\n connection_timeout = options.fetch(:connection_timeout, Wrapped::Protocol::DEFAULT_TIMEOUT)\n password = options.fetch(:password, nil)\n database = options.fetch(:database, Wrapped::Protocol::DEFAULT_DATABASE)\n client_name = options.fetch(:client_name, nil)\n\n @convert_objects = options.fetch(:convert_objects, false)\n\n @connection_pool = Wrapped::Pool.new(\n config,\n host,\n port,\n connection_timeout,\n password,\n database,\n client_name\n )\n end",
"def initialize(config)\n @indent = config[:indent].to_i || 0\n @pre_path = config[:path_prefix] || '/v1'\n @path_pos = @pre_path.split('/').length - 1\n @tql_path = config[:tql_path] || '/tql'\n base = config[:base] || '.'\n @model = Model.new((config['store.dir'] || File.join(base, 'data')).gsub('$BASE', base), indent)\n @type_key = config[:type_key] || 'kind'\n @logger = config[:logger]\n @logger.level = config[:verbosity] unless @logger.nil?\n @http_dir = (config['http.dir'] || File.join(base, 'pages')).gsub('$BASE', base)\n @http_port = (config['http.port'] || 6363).to_i\n @export_proxy = config[:export_proxy]\n @export_proxy = true if @export_proxy.nil? # The default is true if not present.\n @controllers = {}\n @mounts = config[:handler] || []\n\t@server = config['http.server'].to_s.downcase\n requires = config[:require]\n case requires\n when Array\n requires.each { |r| require r.strip }\n when String\n requires.split(',').each { |r| require r.strip }\n end\n end",
"def configure\n yield self\n\n pool_size = 5\n host = @host.nil? ? 'minfraud.maxmind.com' : @host\n @connection_pool = ConnectionPool.new(size: pool_size) do\n make_http_client.persistent(\"https://#{host}\")\n end\n end",
"def connection\n Connection.new(conn_spec)\n end",
"def configure_connection\n end",
"def connect\n Connection.new\n end",
"def middleware\n @middleware ||= ExceptionalMiddleware::MiddlewareStack.new\n end",
"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",
"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",
"def connection\n Connection.new(conn_spec)\n end",
"def initialize(options={})\n @connection = Connection.new(options)\n end",
"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",
"def process_connection(model, body)\n ActiveSocket.log.debug \"in process connection\"\n found = Protocol.unpack(body)\n attempted = found[:attempted]\n args = found[:args]\n block = found[:block]\n trying = model.classify.constantize.connection.send attempted, *args\n return Protocol.pack(trying)\n end",
"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",
"def initialize(opts = OPTS)\n @opts ||= opts\n @opts = connection_pool_default_options.merge(@opts)\n @loggers = Array(@opts[:logger]) + Array(@opts[:loggers])\n @opts[:servers] = {} if @opts[:servers].is_a?(String)\n @sharded = !!@opts[:servers]\n @opts[:adapter_class] = self.class\n @opts[:single_threaded] = @single_threaded = typecast_value_boolean(@opts.fetch(:single_threaded, Sequel.single_threaded))\n @default_string_column_size = @opts[:default_string_column_size] || DEFAULT_STRING_COLUMN_SIZE\n\n @schemas = {}\n @prepared_statements = {}\n @transactions = {}\n @symbol_literal_cache = {}\n\n @timezone = nil\n\n @dataset_class = dataset_class_default\n @cache_schema = typecast_value_boolean(@opts.fetch(:cache_schema, true))\n @dataset_modules = []\n @loaded_extensions = []\n @schema_type_classes = SCHEMA_TYPE_CLASSES.dup\n\n self.sql_log_level = @opts[:sql_log_level] ? @opts[:sql_log_level].to_sym : :info\n self.log_warn_duration = @opts[:log_warn_duration]\n self.log_connection_info = typecast_value_boolean(@opts[:log_connection_info])\n\n @pool = ConnectionPool.get_pool(self, @opts)\n\n reset_default_dataset\n adapter_initialize\n if typecast_value_boolean(@opts.fetch(:identifier_mangling, true))\n # SEQUEL5: Remove\n extension(:_deprecated_identifier_mangling)\n end\n\n unless typecast_value_boolean(@opts[:keep_reference]) == false\n Sequel.synchronize{::Sequel::DATABASES.push(self)}\n end\n Sequel::Database.run_after_initialize(self)\n if typecast_value_boolean(@opts[:preconnect]) && @pool.respond_to?(:preconnect, true)\n concurrent = typecast_value_string(@opts[:preconnect]) == \"concurrently\"\n @pool.send(:preconnect, concurrent)\n end\n end",
"def connection\n @connection ||= Faraday.new(url: 'http://api.unloq.co', headers: default_headers) do |conn|\n conn.request :json\n conn.adapter Faraday.default_adapter\n conn.response :json, :content_type => /\\bjson$/\n end\n end",
"def connection(headers: {}, parse_json: true)\n super do |faraday|\n faraday.adapter(:test, stubs)\n end\n end",
"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",
"def initialize reactor, incoming, outgoing, debug = false\n incoming = Address.from_string incoming if incoming.kind_of? String\n outgoing = Address.from_string outgoing if outgoing.kind_of? String\n\n # setup the handlers for processing messages\n @handler_in = Handler.new reactor, incoming, debug, :in\n @handler_out = Handler.new reactor, outgoing, debug, :out\n\n # create each socket and pass in the appropriate handler\n @incoming = reactor.xrep_socket @handler_in\n @outgoing = reactor.xreq_socket @handler_out\n\n # set each handler's outgoing socket\n @handler_in.socket_out = @outgoing\n @handler_out.socket_out = @incoming\n end",
"def connect; end",
"def conn\n @conn ||= Faraday.new(:url => uri.to_s) do |builder|\n builder.adapter self.class.adapter\n end\n end",
"def connect_through_proxy; end"
] | [
"0.6619057",
"0.6469058",
"0.6367527",
"0.61972255",
"0.541318",
"0.5399482",
"0.5399482",
"0.53215",
"0.5307481",
"0.52957994",
"0.52957994",
"0.5252612",
"0.52207494",
"0.51829106",
"0.51818836",
"0.5158717",
"0.5148091",
"0.5134475",
"0.51307386",
"0.507203",
"0.506408",
"0.5001335",
"0.49857047",
"0.4983679",
"0.4955532",
"0.4950146",
"0.49353883",
"0.49318898",
"0.49275178",
"0.4920541",
"0.4894083",
"0.48901704",
"0.48838797",
"0.48648155",
"0.48603714",
"0.48554093",
"0.48486868",
"0.48299447",
"0.48148975",
"0.47947133",
"0.4788719",
"0.4785605",
"0.4785605",
"0.4785605",
"0.4785605",
"0.4785605",
"0.4785605",
"0.4785605",
"0.4785605",
"0.47817093",
"0.47817093",
"0.4779468",
"0.47647327",
"0.4764155",
"0.4751485",
"0.4740228",
"0.4740228",
"0.4740228",
"0.4740228",
"0.47399828",
"0.47393093",
"0.47220162",
"0.47136396",
"0.47070977",
"0.47061735",
"0.4703942",
"0.47012925",
"0.47001383",
"0.46979535",
"0.4685618",
"0.4685618",
"0.46789876",
"0.4678163",
"0.46780512",
"0.46639448",
"0.46590105",
"0.4648007",
"0.46464017",
"0.46395218",
"0.46393803",
"0.46345347",
"0.46324188",
"0.46316248",
"0.46295145",
"0.4625339",
"0.46207792",
"0.46199802",
"0.46169642",
"0.46123928",
"0.4611636",
"0.4611021",
"0.46106485",
"0.46095082",
"0.46038333",
"0.4593072",
"0.4588485",
"0.45883685",
"0.45862883",
"0.45824987",
"0.45822486"
] | 0.49185988 | 30 |
Exists the value with key | def key?(key, options = {})
load(key, options) != nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exist?(key)\n\n end",
"def has_key?(key); end",
"def has_key?(key); end",
"def contains?(key)\n @key_data.has_key?(key)\n end",
"def has_key? k\n @values.has_key?(k)\n end",
"def has_value? val\n self.keys.each do |k|\n return true if self[k].include? val\n end\n return false\n end",
"def is_pair_exist(key, value)\r\n ((@redis.get key).eql? value) ? true : false \r\n end",
"def key?(key)\n values.key?(key)\n end",
"def has?(key)\n [cache, values].any? { |store| store.keys.include?(key.to_sym) }\n end",
"def include?(key)\n value.include?(key)\n end",
"def has_key?(p0) end",
"def has_hash_value?(key)\n self.each do |entity|\n entity.each_pair{|hash_key, value| return true if value == key}\n end\n return false\n end",
"def has_key? key; key? key; end",
"def exist?(key)\n instrument :exist, key: key do |payload|\n id = map_key_to_id(key)\n answer = id.present?\n\n payload[:exist] = answer\n answer\n end\n end",
"def contains?(key)\n not get(key).nil?\n end",
"def in?(key)\n return true if get(key)\n false\n end",
"def has_key?(key)\n keys.include?(key)\n end",
"def contains? value\n return false if value.nil?\n\n @map.has_key?(value)\n end",
"def has_key?(key)\n return to_h().has_key?(key)\n end",
"def exists?(key)\n unimplemented\n end",
"def exist?(key)\n !@store.select { |i| i[:key] == build_key(key) }.empty?\n end",
"def has_key?(key)\n @db.each_key do\n\t|k|\n\treturn true if k == key\n end\n end",
"def has_key?(key)\n !get(key).nil?\n end",
"def has_key?(key)\n !get(key).nil?\n end",
"def exists(key)\n mon_synchronize do\n perform [\"exists\", key], :proc => T_BOOL\n end\n end",
"def has_key?(key)\n @hash.has_key?(key)\n end",
"def has_key?(key)\n @stored[key] && !@stored[key].empty? ? true : false\n end",
"def exists(key)\n mon_synchronize do\n perform [\"exists\", key], proc: T_BOOL\n end\n end",
"def has_key(hash, key)\n\thash.has_key? key\nend",
"def exist?(key)\n !find(key).nil?\n end",
"def member_of?(key, value)\n val = get(key)\n val and val.include?(value)\n end",
"def exist?(key)\n store.key?(key)\n end",
"def exists(key)\n call(key, [:exists, key], transform: Redis::Boolify, read: true)\n end",
"def has_key?(key)\n return self.fetch(key) ? true : false\n end",
"def exists?\n values.exists?\n end",
"def has?(key)\n value = self[key]\n boolean_typecast(key, value)\n end",
"def include?(key)\n @hash.has_key?(key.to_s)\n end",
"def exists?(key)\n @data.has_key?(key) && @data[key].valid?(self)\n end",
"def exists?(key)\n key.present? && manager.key?(key)\n end",
"def include?(key)\n # Ensure a Ruby true is returned\n item_exists(key) == true\n end",
"def exists?(key)\n raise \"Method not implemented. Called abstract class.\"\n end",
"def has_value?(value)\n self.each do |k, v|\n return true if v == value\n end\n return false\n end",
"def is_key_exist(key)\r\n (@redis.exists key) ? true : false \r\n end",
"def includes? hash\n hash.each_pair do |key, value|\n return false unless send(\"#{key}\") == value\n end\n true\n end",
"def defined?(value_key)\n true\n end",
"def exists?\n retrieve\n true\n rescue Error::NoSuchKey\n false\n end",
"def has_key?(key)\n @table.get(key) != nil\n end",
"def exists?(key)\n @redis.exists(prefix(key))\n end",
"def has_key?(key)\n @map.has_key?(key.to_sym)\n end",
"def include?(v)\n\t\t\t\t@lookup.has_key?(v)\n\t\t\tend",
"def exist?(key)\n raise NotImplementedError\n end",
"def has_key?(key)\n @h.has_key?(key.to_sym)\n end",
"def has_key?(key)\n dummy = Pair.new(key,nil)\n return @tree.get(dummy)\n end",
"def contains?(key)\n @semaphore.synchronize {\n @key_data.has_key?(key)\n }\n end",
"def include?(key); end",
"def include?(key); end",
"def exist?(key)\n with_client do |client|\n !client.exists(build_key(key)).zero?\n end\n end",
"def value?(key)\n !!value(key) || @object.value?(key)\n end",
"def has_value?(value)\n each do | k, v |\n return true if v == value\n end\n return false\n end",
"def value_set? key\n @values.key? @schema.resolve_key! key\n end",
"def key?(key); end",
"def key?(key); end",
"def key?(key); end",
"def key?(key); end",
"def key?(key); end",
"def key?(key); end",
"def exists?\n @values.any { |v| v.exists? }\n end",
"def has_key?( key )\n key = UniMap.str_to_key( key ) unless key.is_a?( Key )\n key && contains_key( key )\n end",
"def exists?(*keys); end",
"def contains?(key)\n position = search(key)\n (key <=> @keys[position]) == 0\n end",
"def exists(key)\n\n # FIXME: insert code that connects to the backend and affects the exists\n # operation\n #\n # - Convert any exceptions into a failed status result with a meaningful\n # error message.\n #\n\n { :result => nil, :err_msg => 'FIXME: not implemented' }\n end",
"def item_has_value?(item)\n return false if item.group?\n @values.has_value?(item.key)\n end",
"def has_key?(value)\n ensure_loaded\n value = lookup_key(value)\n (@info.has_key?(value) || @new_info.has_key?(value)) && !!(self[value])\n end",
"def has?(key)\n @properties.has_key?(key)\n end",
"def include?(key)\n has_key?(key)\n end",
"def include?(key)\n @item.key?(key)\n end",
"def include?(key)\n @item.key?(key)\n end",
"def exist? _key\n store.transaction(:read_only) do |s|\n s.roots.any? { |r| r.to_sym == _key.to_sym }\n end\n end",
"def exists? value\n !self[index_of(value)].nil?\n end",
"def exists? value\n !self[index_of(value)].nil?\n end",
"def key?(key)\n keys.include?(key) || keys.map(&:to_s).include?(key)\n end",
"def key?(key)\n keys.include?(key) || keys.map(&:to_s).include?(key)\n end",
"def key?(key)\n @items.key?(key)\n end",
"def include?(key)\n key = key.to_sym\n cache.keys.include?(key) || values.keys.include?(key)\n end",
"def include?(key)\n key = key.to_sym\n cache.keys.include?(key) || values.keys.include?(key)\n end",
"def has_key? field\n return self.containsKey(field)\n end",
"def registered?(key)\n data.key?(key)\n end",
"def exist?(key)\n jiak.client.exist?(jiak.bucket,key)\n end",
"def key?(key)\n\t\t\t\tif key\n\t\t\t\t\t@keyed.key?(key)\n\t\t\t\tend\n\t\t\tend",
"def include?(o)\n @hash.has_value?(o)\n end",
"def has_key?(key)\n params.keys.include?(key)\n end",
"def has?(key)\n respond_to? key\n end",
"def include?(hash)\n self.key.each_pair do |key, value|\n unless value === hash[key]\n return false\n end\n end\n true\n end",
"def has_key?(key)\n any? {|mod| mod.name == key}\n end",
"def include_key?(key)\n\t\t\ttrue\n\t\tend",
"def has_key? key\n @lock.read_sync{ @data.has_key? key }\n end",
"def key?(key)\n lookup_map.key?(key.to_sym)\n end",
"def has?(key) ; @docs.member?(key) end",
"def key? key\n each_pair.find {|k, _| key == k } && true\n end",
"def exist(key)\n check_return_code(\n Lib.memcached_exist(@struct, key),\n key\n )\n end",
"def has_key?(name)\n hashed.has_key? name\n end"
] | [
"0.80646807",
"0.80363166",
"0.80363166",
"0.7857577",
"0.77786726",
"0.77577376",
"0.77553254",
"0.77261853",
"0.77232826",
"0.7650804",
"0.7647588",
"0.76156193",
"0.760623",
"0.75676227",
"0.756402",
"0.7547501",
"0.7494249",
"0.7471254",
"0.7462277",
"0.7452714",
"0.7444506",
"0.7440735",
"0.7436288",
"0.7436288",
"0.7435597",
"0.7433428",
"0.74323535",
"0.74262476",
"0.7402197",
"0.7401288",
"0.7400484",
"0.7400293",
"0.73984855",
"0.7380575",
"0.73203284",
"0.7313422",
"0.7306817",
"0.7274716",
"0.7256108",
"0.7250463",
"0.7249976",
"0.724512",
"0.7242684",
"0.7240137",
"0.723467",
"0.72252226",
"0.7212551",
"0.71982473",
"0.7196122",
"0.71904486",
"0.7186862",
"0.71773756",
"0.7175639",
"0.7172551",
"0.7163292",
"0.7163292",
"0.7162104",
"0.710314",
"0.710202",
"0.7091924",
"0.7083419",
"0.7083419",
"0.7083419",
"0.7083419",
"0.7083419",
"0.7083419",
"0.70755124",
"0.70731145",
"0.70679253",
"0.7067509",
"0.70674026",
"0.7052196",
"0.7026252",
"0.70239836",
"0.7020289",
"0.70033365",
"0.70033365",
"0.6996734",
"0.69948214",
"0.69948214",
"0.6993547",
"0.6993547",
"0.69907314",
"0.6967971",
"0.69523877",
"0.6931065",
"0.69261724",
"0.6922425",
"0.6922261",
"0.69125575",
"0.69068354",
"0.69057846",
"0.6901003",
"0.6889071",
"0.6885353",
"0.688342",
"0.68650365",
"0.68508404",
"0.6850839",
"0.68455845",
"0.6845376"
] | 0.0 | -1 |
Atomically decrement integer value with key This is just syntactic sugar for calling increment with a negative value. This method also accepts negative amounts. | def decrement(key, amount = 1, options = {})
increment(key, -amount, options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decr(key, value = 1)\n mon_synchronize do\n perform [\"decr\", key, value], proc: T_INT\n end\n end",
"def decr(key, value = 1)\n mon_synchronize do\n perform [\"decr\", key, value], :proc => T_INT\n end\n end",
"def decrby(key, decrement); end",
"def decrby(key, decrement); end",
"def decrease key, amount=1\n @lock.write_sync do\n return unless @data[key].nil? || Numeric === @data[key]\n @data[key] ||= 0\n @data[key] -= amount\n end\n end",
"def decrement(key)\n msg = 'Trying to reduce count below zero.'\n raise RangeError, msg if @counter[key] == 0\n @counter[key] -= 1\n end",
"def decrement(key, amount = 1, options = {})\n invoke(:decrement, key) do |store|\n alter(store, key, -amount, options)\n end\n end",
"def _dec(key,value)\n _set(key, (_get(key) || 0) - value)\n end",
"def decrement(k, amount = 1, ignored_options = nil)\n increment k, -amount\n end",
"def decrement\n @value -= 1\n end",
"def decrement!\n @value -= @increment\n \n self\n end",
"def decrby(key, decrement)\n send_command([:decrby, key, Integer(decrement)])\n end",
"def decrement(by=1, &block)\n allow_expiration do\n val = redis.decrby(key, by).to_i\n block_given? ? rewindable_block(:increment, by, val, &block) : val\n end\n end",
"def decrement(name, amount = 1, options = nil)\n key = expand_key(name)\n\n begin\n amount.times do |v|\n @gibson.dec key\n end\n rescue\n\n end\n end",
"def decrby(key, decrement)\n node_for(key).decrby(key, decrement)\n end",
"def decrement\n @counter = @counter - 1\n end",
"def decrement(key, offset=1)\n ret, value = Lib.memcached_decrement(@struct, key, offset)\n check_return_code(ret, key)\n value\n rescue => e\n tries ||= 0\n raise unless tries < options[:exception_retry_limit] && should_retry(e)\n tries += 1\n retry\n end",
"def decrease(counter)\r\n counter - 1\r\nend",
"def decrease(counter)\n counter - 1\nend",
"def decrease(counter)\n counter - 1\nend",
"def decrease(counter)\n counter - 1\nend",
"def decrease(counter)\n counter - 1\nend",
"def decrease(counter)\n counter - 1\nend",
"def decrease(counter)\n counter -= 1\nend",
"def decrement(field, amount = 1)\n increment(field, -amount)\n end",
"def decrement(name, amount = 1, expires_in: nil, initial: nil, **_options)\n instrument :decrement, name, amount: amount do\n failsafe :decrement do\n key = normalize_key(name, options)\n res = collection.binary.decrement(\n key, ::Couchbase::Options::Decrement(delta: amount, expiry: expires_in, initial: initial)\n )\n @last_mutation_token = res.mutation_token\n res.content\n end\n end\n end",
"def decrement!(name,amount=1)\n raise ArgumentError, \"Only integer fields can be decremented.\" unless self.class.fields.include?({:name => name.to_s, :type => :integer})\n redis.decr(field_key(name), amount)\n end",
"def decrement(key, value = 1, expires_in = nil, initial = nil)\n puts \"Rails.cache.decrement(#{key}, #{value}, {expires_in: #{get_ttl(expires_in)}, initial: #{initial}, raw: false})\"\n return Rails.cache.decrement(key, value, {expires_in: get_ttl(expires_in), initial: initial, raw: false})\n rescue => exc\n Rails.logger.error { \"MEMCACHE-ERROR: decrement: K: #{key}. M: #{exc.message}, I: #{exc.inspect}\" }\n return nil\n end",
"def decr(key); end",
"def decr(key); end",
"def -(key)\n\t\t\tif key.is_a?(Integer) && key > 0\n\t\t\t\treturn key.times { undial! }\n\t\t\telse\n\t\t\t\treturn undial!(*key)\n\t\t\tend\n\t\tend",
"def decrement_counter(counter_name, id)\n update_all \"#{counter_name} = #{counter_name} - 1\", \"#{primary_key} = #{id}\"\n end",
"def decr(key, increment=nil)\n timeout_retry(3, 3){\n if increment\n write \"DECRBY #{key} #{increment}\\r\\n\"\n else\n write \"DECR #{key}\\r\\n\"\n end \n integer_reply\n }\n end",
"def decrement(name, amount = 1, options = nil)\n options ||= {}\n name = expanded_key name\n\n if ttl = options.delete(:expires_in)\n options[:ttl] ||= ttl\n end\n options[:create] = true\n instrument(:decrement, name, options) do |payload|\n payload[:amount] = amount if payload\n @data.decr(name, amount, options)\n end\n rescue ::Couchbase::Error::Base => e\n logger.error(\"#{e.class}: #{e.message}\") if logger\n raise if @raise_errors\n false\n end",
"def dec(v = 1)\n sync { @v -= v }\n end",
"def decrement(node)\n change_by node, -1\n end",
"def decrement(amount = 1, time: Time.now)\n increment(-amount, time: time)\n end",
"def decrement(name, amount = 1, options = nil)\n options = merged_options(options)\n instrument(:decrement, name, amount: amount) do\n rescue_error_with nil do\n @data.with { |c| c.decr(normalize_key(name, options), amount, options[:expires_in], 0) }\n end\n end\n end",
"def decrement(name, amount = 1, options = {})\n instrument :decrement, name, amount: amount do\n failsafe :decrement do\n options = merged_options(options)\n key = normalize_key(name, options)\n\n with do |c|\n c.decrby(key, amount).tap do\n write_key_expiry(c, key, options)\n end\n end\n end\n end\n end",
"def decrement_counter(counter_name, id)\n update_counters(id, counter_name.to_sym => -1)\n end",
"def decrement(name, amount = T.unsafe(nil), options = T.unsafe(nil)); end",
"def decrement(name, amount = 1, options = nil) # :nodoc:\n options = merged_options(options)\n response = instrument(:decrement, name, :amount => amount) do\n @data.decrby(namespaced_key(name, options), amount)\n end\n rescue => e\n logger.error(\"Error decrementing cache entry in redis: #{e}\") if logger\n nil\n end",
"def decrement\n with_update { with_progressables(:decrement) }\n end",
"def decrease(counter)\n counter[0] -= 1\nend",
"def decr(key, amt = 1, ttl = nil, default = nil)\n check_positive!(amt)\n\n perform(:decr, key, amt.to_i, ttl_or_default(ttl), default)\n end",
"def decrement(by: 1)\n return increment(by: -by.to_i)\n end",
"def decrement!(name,amount=1)\n raise ArgumentError, \"Only integer fields can be decremented.\" unless self.class.fields.include?({:name => name.to_s, :type => :integer})\n store.update_count(field_key(name), -amount)\n end",
"def decr(key)\n node_for(key).decr(key)\n end",
"def decrement(name, amount = 1, options = nil)\n options = merged_options(options)\n\n instrument(:decrement, name, :amount => amount) do\n @client.decr(name, amount)\n end\n rescue Spymemcached::Error => e\n logger.error(\"Spymemcached::Error (#{e}): #{e.message}\") if logger\n nil\n end",
"def decr_counter!(name, decr = 1)\n counter = self.send(name.to_sym)\n counter.decr(val)\n save\n counter.reconcile!\n end",
"def decrement(name, amount = 1, options=nil)\n options ||= {}\n name = namespaced_key(name, options)\n initial = options.has_key?(:initial) ? options[:initial] : 0\n expires_in = options[:expires_in]\n instrument_with_log(:decrement, name, :amount => amount) do\n with { |c| c.decr(name, amount, expires_in, initial) }\n end\n rescue Dalli::DalliError => e\n log_dalli_error(e)\n instrument_error(e) if instrument_errors?\n raise if raise_errors?\n nil\n end",
"def decrement_counter(counter_name, id, by: 1, touch: nil)\n update_counters(id, counter_name => -by, touch: touch)\n end",
"def decrement_count(current_count)\n current_count.to_i - 1\n end",
"def decrement(name, amount = 1, options = nil)\n raise NotImplementedError.new(\"#{self.class.name} does not support decrement\")\n end",
"def decrement(name, amount = 1, options = nil)\n raise NotImplementedError.new(\"#{self.class.name} does not support decrement\")\n end",
"def decrement!(attribute, by = 1)\n increment!(attribute, -by)\n end",
"def decrement!(attribute, by = 1, touch: nil)\n increment!(attribute, -by, touch: touch)\n end",
"def decrement_counter(counter_name, id)\n rec = collection.findOne({:_id => id})\n rec[counter_name] -= 1\n collection.save(rec)\n end",
"def decrement(attribute, by = 1)\n increment(attribute, -by)\n end",
"def decr_by major, minor, value\n def_zero major, minor\n @stats[major][minor] -= value\n end",
"def Subtract(val)\n self.value -= val\n end",
"def decrement(attribute, by = 1)\n increment(attribute, -by)\n end",
"def subtract(key, value)\n update_array(key, value, :subtract)\n end",
"def decrement(att, count = 1)\n increment(att, -count)\n end",
"def decrement(records)\n records.update_all(['position = position - 1'])\n end",
"def decr(att)\n raise ArgumentError unless counters.include?(att)\n write_local(att, db.decr(key(att)))\n end",
"def dec(key)\n \n end",
"def -(value)\n check_pre((\n (value.int?)\n ))\n\n from_index(normalize_index(to_index - value))\n end",
"def zdecr(key, member, score = 1)\n mon_synchronize do\n perform [\"zdecr\", key, member, score], proc: T_INT\n end\n end",
"def delete(key)\n @succ.delete key\n end",
"def zdecr(key, member, score = 1)\n mon_synchronize do\n perform [\"zdecr\", key, member, score], :proc => T_INT\n end\n end",
"def decrement element\n element.perform :decrement\n end",
"def decrease(rectangle, player, decrement=1)\n # Decrement counter\n increase(rectangle, player, -decrement)\n end",
"def decrement\n @mutex.synchronize {\n raise 'Counter already at 0' if @cnt == 0\n @cnt -= 1\n @cond_var.broadcast if @cnt == 0\n }\n end",
"def decrement(stats, sample_rate = 1)\n update_counter stats, -1, sample_rate\n end",
"def decrement(stats, sample_rate = 1)\n update_counter stats, -1, sample_rate\n end",
"def decrement(labels = {}, by = 1)\n label_set = label_set_for(labels)\n synchronize do\n @values[label_set] ||= 0\n @values[label_set] -= by\n end\n end",
"def decrement_position\n return unless in_list?\n update_attribute :position, self.send(:position).to_i - 1\n end",
"def down\n self.x = (x+1)%10\n end",
"def decrement\n cache_updated_successfully =\n with_cache_store do |store|\n begin\n store.decr(cache_key) ||\n store.add(cache_key, value_in_db - 1) ||\n raise(ConcurrentCacheWriteError, \"Failing not to enter a race condition while writing a value for the key #{cache_key}\")\n rescue store.error_class => e\n false\n end\n end\n\n begin\n if cache_updated_successfully\n on_error_rollback_by(:increment_in_cache)\n\n decrement_in_db_later\n else\n decrement_in_db\n end\n rescue => e\n raise e\n end\n end",
"def deduct(num)\n @balance -= num\n end",
"def lrem(key, count, value)\n send_command([:lrem, key, Integer(count), value])\n end",
"def decrement_by(node, weight)\n raise ArgumentError.new('please use #increment_by') if weight < 0\n change_by node, -weight\n end",
"def decrement(id, options = DecrementOptions.new)\n resp = @backend.document_decrement(@collection.bucket_name, \"#{@collection.scope_name}.#{@collection.name}\", id,\n options.timeout,\n {\n delta: options.delta,\n initial_value: options.initial,\n expiry: options.expiry,\n durability_level: options.durability_level,\n })\n CounterResult.new do |res|\n res.cas = resp[:cas]\n res.content = resp[:content]\n res.mutation_token = @collection.send(:extract_mutation_token, resp)\n end\n end",
"def -(num)\n self + (-num)\n end",
"def incr(key); end",
"def incr(key); end",
"def decrement_or_destroy\n @coll_card_instances.decrement_qty_or_destroy(params[:card_id])\n end",
"def -(n)\n self.+(-n)\n end",
"def decrement_position\n return unless in_list?\n\n # in_collection.where(:pos => my_position).\n adjust!(position_key => -1)\n save!\n end",
"def incr(key, value = 1)\n mon_synchronize do\n perform [\"incr\", key, value], proc: T_INT\n end\n end",
"def subtract( key, reader_writer_accessor )\n \n # figure out actual subtraction value\n existing_status = self[ key ]\n \n result_value = status_minus_other_status( existing_status, reader_writer_accessor )\n\n if actual_status = status_minus_other_status( reader_writer_accessor, result_value )\n \n # if we have an actual value we are subtracting, do so directly (no hooks)\n if new_status = status_minus_other_status( existing_status, actual_status )\n store_without_hooks( key, new_status )\n elsif existing_status\n delete( key )\n end\n \n # update corresponding structures for subtraction (pass actually-subtracted value)\n unless @without_hooks\n update_for_subtraction( key, actual_status )\n end\n \n end\n \n return result_value\n \n end",
"def incr(key, value = 1)\n mon_synchronize do\n perform [\"incr\", key, value], :proc => T_INT\n end\n end",
"def get(key)\n ret = @values[key]\n return -1 unless ret\n\n @values.delete(key)\n @values[key] = ret\n ret\n end",
"def incrby(key, increment); end",
"def incrby(key, increment); end",
"def -(n) self + -n end",
"def -(n) self + -n end",
"def lrem(key, count, value)\n node_for(key).lrem(key, count, value)\n end",
"def -(other)\n self + -other.to_i\n end"
] | [
"0.7871098",
"0.786161",
"0.78296614",
"0.78296614",
"0.7819166",
"0.7782856",
"0.77813274",
"0.77317894",
"0.7664426",
"0.7406838",
"0.73124725",
"0.72700393",
"0.71659833",
"0.71587723",
"0.712504",
"0.7062982",
"0.70442504",
"0.70044357",
"0.69277936",
"0.69277936",
"0.69277936",
"0.69277936",
"0.69277936",
"0.6918726",
"0.688279",
"0.68791205",
"0.68668836",
"0.6827295",
"0.68230385",
"0.68230385",
"0.67956346",
"0.6790953",
"0.6744028",
"0.67169756",
"0.6696403",
"0.66827774",
"0.66687435",
"0.6663478",
"0.66252995",
"0.6622849",
"0.65861154",
"0.6583664",
"0.6579317",
"0.65573937",
"0.6486969",
"0.6476228",
"0.6475997",
"0.6438656",
"0.64318645",
"0.6410346",
"0.6400046",
"0.6391948",
"0.6329926",
"0.63108283",
"0.63108283",
"0.6300159",
"0.62918776",
"0.6268147",
"0.6253473",
"0.6227826",
"0.6196061",
"0.619551",
"0.61868954",
"0.61435485",
"0.61019003",
"0.6074855",
"0.60632795",
"0.60411763",
"0.5986581",
"0.598029",
"0.59792453",
"0.59730154",
"0.59334654",
"0.58796775",
"0.5857601",
"0.5857601",
"0.5852214",
"0.58450836",
"0.58274096",
"0.5819056",
"0.58180755",
"0.58165056",
"0.5811668",
"0.57980454",
"0.5788607",
"0.5732061",
"0.5732061",
"0.5702948",
"0.5681362",
"0.56754386",
"0.56739175",
"0.56730443",
"0.5668684",
"0.5655613",
"0.5654359",
"0.5654359",
"0.5626808",
"0.5626808",
"0.5624801",
"0.5622414"
] | 0.8487073 | 0 |
Explicitly close the store | def close
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close\n persist\n end",
"def close\n save\n end",
"def close\n @mutex.synchronize do\n @thread.kill\n @store.each_value do |value|\n sess, _ = value\n sess.close(@context)\n end\n end\n end",
"def close\n persistent.close\n @_persistent = nil\n end",
"def close()\n #This is a stub, used for indexing\n end",
"def close!\n storages.each_value(&:close) and @storages = {}\n nil\n end",
"def close\n\n # nothing to do here.\n end",
"def close\n # NOOP\n end",
"def close\n # NOOP\n end",
"def close() end",
"def close() end",
"def close() end",
"def close() end",
"def close() end",
"def close()\n @db.close()\n end",
"def close!\n safe_close\n end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close\n commit\n end",
"def close\n # no-op\n end",
"def close\n @db.close\n end",
"def closing; end",
"def closing; end",
"def close\n # don't need to close\n end",
"def close\n # this method may be left unimplemented if that is applicable\n end",
"def close\n close!\n end",
"def close; true; end",
"def close; true; end",
"def close\n close_cert_store\n remove_finalizer\n end",
"def close\n # ..\n end",
"def _close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close!\n # Not implemented\n end",
"def close\n @@active_state.destroy unless @@active_state.nil?\n super\n self.close!\n end",
"def closed?; end",
"def closed?; end",
"def closed?; end",
"def closed?; end",
"def close\n end",
"def close\n end",
"def close\n @closed = true\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n self\n end",
"def close\n @database.close if @database\n end",
"def close\n @database.close if @database\n end",
"def close!\n end",
"def close\n # this method may be left unimplemented if that is applicable\n end",
"def closing?; end",
"def close\n @closed = true\n end",
"def do_close; end",
"def close\n db.close\n end",
"def close()\n @closed = true\n end",
"def close\n\t\t@manager.close\n\tend",
"def Close\n end",
"def close\n @data.close\n @index.close\n end",
"def delete_store\n @lock.synchronize do\n @db.delete_database\n @db = @class_map = @in_memory_objects = @stats = @cache =\n @root_objects = nil\n end\n end",
"def close!\n close(true)\n end",
"def close\n raise NotImplementedError\n end"
] | [
"0.7390946",
"0.7045272",
"0.7006187",
"0.6908627",
"0.68650204",
"0.67675227",
"0.67595404",
"0.67539",
"0.67539",
"0.6706045",
"0.6706045",
"0.6706045",
"0.6706045",
"0.67027557",
"0.6678797",
"0.6666337",
"0.66630256",
"0.66630256",
"0.66630256",
"0.66630256",
"0.66630256",
"0.66630256",
"0.66630256",
"0.66630256",
"0.66630256",
"0.66630256",
"0.66630256",
"0.66630256",
"0.66630256",
"0.66630256",
"0.66630256",
"0.66630256",
"0.66630256",
"0.66630256",
"0.66630256",
"0.66630256",
"0.66630256",
"0.66630256",
"0.66630256",
"0.66630256",
"0.66630256",
"0.66630256",
"0.66446936",
"0.6636245",
"0.65916663",
"0.65763104",
"0.65763104",
"0.65544647",
"0.6548591",
"0.6513769",
"0.64980865",
"0.64980865",
"0.6485159",
"0.64784884",
"0.6470188",
"0.6468725",
"0.6468725",
"0.6468725",
"0.6468725",
"0.6468725",
"0.6468725",
"0.6468725",
"0.6468725",
"0.6468725",
"0.6452762",
"0.6451186",
"0.6446944",
"0.6446944",
"0.6446944",
"0.6446944",
"0.6445564",
"0.6445564",
"0.6439841",
"0.6423043",
"0.6423043",
"0.6423043",
"0.6422954",
"0.64229286",
"0.64229286",
"0.64147127",
"0.6414419",
"0.6400679",
"0.6375086",
"0.63489896",
"0.63487226",
"0.6343878",
"0.631863",
"0.6310913",
"0.62851477",
"0.6265471",
"0.6254369",
"0.6242809"
] | 0.6488989 | 60 |
Fetch value with key. Return nil if the key doesn't exist | def [](key)
load(key)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch(key)\n result.fetch(key)\n end",
"def get(key)\n position = find(key)\n if position != nil\n @values[position]\n else\n nil\n end\n end",
"def fetch_value( oid, key )\n\t\toid = normalize_oid( oid )\n\t\tkey = normalize_key( key )\n\t\tdata = @storage[ oid ] or return nil\n\n\t\treturn data[ key ]\n\tend",
"def fetch(key)\n if key.empty?\n return @value\n end\n child = @children[key.shift]\n if child\n child.fetch(key)\n else\n return nil\n end\n end",
"def fetch(key, value = nil)\n if read = self[key]\n return read\n end\n block_given? ? yield(key) : value\n end",
"def fetch(key, optional = {} )\n\n # self[key]\n if self.has_key?(key)\n self[key]\n else\n if optional.empty?\n raise KeyError\n else\n optional\n end\n end\n end",
"def fetch(key); end",
"def find(key)\n # TODO(himanshujaju) - possible improvement by not checking for contains.\n if contains?(key)\n return @key_data[key].value\n end\n\n return nil\n end",
"def fetch(key)\n return nil unless (val = get(key.to_s))\n\n JSON.parse(val, symbolize_names: true)\n rescue JSON::ParserError\n nil\n end",
"def get(key)\n position = search(key)\n return nil if (key <=> @keys[position]) != 0\n @values[position]\n end",
"def get_result(key)\n r = results\n if r != nil\n return r.fetch(key, nil)\n end\n nil\n end",
"def fetch( key )\n key = key.to_s.strip unless key.nil?\n raise \"Invalid key\" if key.nil? or key == ''\n\n id,value,hits = @db.get_first_row(\n \"SELECT id,value,hits \"+\n \"FROM #{TABLE_NAME} \"+\n \"WHERE key=?\",\n key.to_s.strip\n )\n\n # Return nil if there is cache MISS.\n return nil if value.nil?\n \n # Increment the number of hits\n if @count_hits\n @db.execute(\n \"UPDATE #{TABLE_NAME} SET hits=?, updated_at=? WHERE id=?\",\n hits.to_i+1, Time.now.to_i, id\n )\n end\n\n # Otherwise if there is a HIT, parse the YAML into an object\n return YAML::load(value)\n end",
"def get(key)\r\n\t\treturn nil if !key\r\n\t\t# Get the hash of our key\r\n\t\tindex = key.hash % @size\r\n\t\t# If location in array is empty then return nil otherwise find the \r\n\t\t# key and return associated value from the list\r\n\t\treturn nil if !@arr[index]\r\n\t\treturn @arr[index].find(key)\r\n\tend",
"def fetch(*key); end",
"def obtain!(key)\n raise \"Missing key #{key}\" unless @hash.key?(key)\n @hash[key]\n end",
"def get(key)\n self.map_var.each do |pair|\n return pair[1] if pair[0] == key\n end\n nil\n end",
"def fetch_value(key)\n val = fetch_nested(key)\n return val if self[:no_pruning].include?(key)\n Prunable::VALUES.include?(val) ? Prunable::Value : val\n end",
"def [](key)\n result = default(key)\n result ? result.value : nil\n end",
"def [](key)\n entry = find_entry(key)\n return(entry.nil? ? nil : entry[1])\n end",
"def get(key)\n get_all(key).first\n end",
"def get(key)\n index = key_index(key)\n if( index )\n self.values.get(index)\n else\n nil\n end\n end",
"def get(key)\n return do_get(key, false)\n end",
"def get(key, ignore: nil)\n if option = find(key)\n option.first\n else\n nil\n end\n end",
"def [](key)\n fetch(key)\n end",
"def read(key)\n exists?(key) ? @data[key] : nil\n end",
"def get(key, default=nil)\n find = KeyValue.find_by_key(key)\n find ? find.value : default\n end",
"def find(key)\n node = find_node(key)\n (node == nil ? nil : node.value)\n end",
"def get_key_value_\n @redis.hget @url, 'key'\n end",
"def fetch key, deft=nil\n @map.fetch(key, deft)\n end",
"def get(key)\n @hash.get(key)\n end",
"def fetch(key)\n @monitor.synchronize do\n found, value = get(key)\n found ? value : store(key, yield)\n end\n end",
"def fetch(key, *default)\n result =\n if key?(key)\n self[key]\n elsif block_given?\n yield(self)\n end\n unless result\n raise KeyError, \"key not found \\\"#{key}\\\"\" if default.empty?\n result = default.first\n end\n result\n end",
"def get(key)\n @first.get(key)\n end",
"def lookup(key)\n @map.each { |k, v| return v if key == k }\n nil\n end",
"def get(key)\n if @data.has_key?(key)\n return @data[key]\n else\n return false\n end\n end",
"def fetch(key, *args, &block)\n value = self[key]\n return value unless value.nil?\n\n @parameters.fetch(key, *args, &block)\n end",
"def value\n v = connection.get(key)\n rescue Memcached::NotFound\n if block\n value = block.call\n value\n end\n end",
"def get(key); end",
"def get(key); end",
"def get(key); end",
"def get(key); end",
"def find(key)\n if !contains?(key)\n return nil\n end\n\n @semaphore.synchronize {\n @internal_clock += 1\n previous_data = @key_data[key]\n update_access_time_locked(key, @internal_clock, previous_data.access_time)\n\n return previous_data.value\n }\n end",
"def [](key)\n begin\n rv = self.fetch(key)\n rescue IndexError\n rv = nil\n end\n if (rv == nil)\n begin\n rv = self.dcase_hash[key.downcase]\n rescue IndexError\n rv = nil\n end\n end\n\n return rv\n end",
"def lookup(key)\n if key_pair = pair(key, hash(key))\n key_pair[1]\n end\n end",
"def get_by_key(key)\n @store_[key] || YakvdConstants.key_not_found\n end",
"def get(key)\n @ivar.each_with_index do |ele, i|\n if ele[0] == key \n return ele[1]\n end\n end\n end",
"def try_get(namespace, key)\n begin\n return get(namespace, key)\n rescue ItemNotFoundError\n return nil\n end\n end",
"def get(key)\n self.data[key] && self.data[key][:value]\n end",
"def get_value (key)\r\n @redis.get key\r\n end",
"def lookup(key)\n @map.each { |pair| return pair[1] if pair[0] == key }\n nil\n end",
"def fetch(key)\n mon_synchronize do\n node = @hash[key]\n break unless node\n\n touch(node)\n node.value\n end\n end",
"def get(key)\n node = get_rec(@root, key, 0)\n return nil if node.nil?\n return node.value\n end",
"def get(key)\n index = key_index(key)\n if( index )\n @i_values.get(index)\n else\n nil\n end\n end",
"def cache_fetch(key, default = nil)\n value = @store[key]\n value.nil? ? default : value\n rescue ::MemCache::MemCacheError => e\n Log.error(e)\n nil\n end",
"def get_key(key)\n return self.has_key?(key) ? self[key] : nil\n end",
"def fetch(key)\n now = Time.now.public_send(_kind)\n value = get(key, now)\n\n if value.nil?\n clear_all(key)\n value = set(key, now, set_nil(yield))\n end\n\n unset_nil(value)\n end",
"def get(key)\n _get_from_params(key) || _get_from_values(key)\n end",
"def get_hash_val(name)\n\t\tfetch(name) if has_key?(name)\n\tend",
"def fetch_entry(dict, key)\n if dict.has_key?(key) == true\n print dict[key], \"\\n\"\n else\n print \"Value not found.\\n\"\n end\n end",
"def get(key)\n @hash[key]\n end",
"def get_value(key)\n self[key]\n end",
"def get(key)\n node = @cache[key]\n return -1 if node.nil?\n move_to_head(node)\n node.value\n end",
"def get(key)\n i = key.hash % @table.size\n node = @table[i]\n while node\n return node.value if key == node.key\n node = node.next\n end\n nil\n end",
"def [](key)\n data.fetch(key) do\n _values.find {|data| !data[key].nil? }\n end\n end",
"def cache_fetch(key, default = nil)\n # Retrieve the data and return it\n record = @store[:key => namespaced(key)]\n record.value rescue default\n end",
"def get(key)\n\n\t\t#we will set the initial value of the variable as nil\n\t\tvalue = nil\n\t\t\n\t\t#iterate through the array\n\t\ti = 0\n\t\twhile i < @size\n\n\t\t\t#if we find the key inside the array\n\t\t\tif @array[i] == key\n\t\t\t\t#we will grab the next element (the value)\n\t\t\t\tvalue = @array[i+1]\n\t\t\t\t#and return it\n\t\t\t\treturn value\n\t\t\tend\n\n\t\t\t#go to all the even indexes\n\t\t\ti += 2\n\t\t\t\n\t\tend\n\n\t\t#if we don't find the key, return value as nil\n\t\treturn value\n\n\tend",
"def get(row_key, col_key)\n get!(row_key, col_key)\n rescue KeyError\n nil\n end",
"def get!(key)\n get(key) || raise(Cooler::KeyNotFound)\n end",
"def get(key)\n return @data[key.to_s]\n end",
"def getValue(key)\r\n \r\n return @aHash[key]\r\n end",
"def fetch(key)\n return @body.fetch(key.upcase, nil)\n end",
"def get(key)\n key = normalize(key) or return\n table[key]\n end",
"def fetch( key, &block )\n fail NotImplementedError\n end",
"def get(key)\n map_array.each { |pair| return pair[1] if pair[0] == key }\n nil\n end",
"def get( key )\n key = UniMap.str_to_key( key ) unless key.is_a?( Key )\n key && get_k( key )\n end",
"def get(key)\n run_hook(:before_get, key)\n value = db[key]\n run_hook(:after_get, key, value)\n value\n end",
"def _fetch(key, options = {})\n value = params.key?(key) ? params[key] : options[:default]\n options[:required] ? _ensure(value, options) : value\n end",
"def generic_get(key)\n data[key]\n end",
"def [](key)\n entry = @data.find { |d| d[:key] == key && d[:operation] != :remove }\n return entry[:value] if entry\n\n nil\n end",
"def [](key)\n find_value(key)\n end",
"def get(key)\n node = _get(@root, key)\n return nil unless node\n node.value\n end",
"def lookup(key)\n\t\t\t\treturn(@keys[key])\n\t\t\tend",
"def lookup(key)\n\t\t\t\treturn(@keys[key])\n\t\t\tend",
"def get(key)\n response = request(:get, uri(key))\n if response.status == 200\n data = MultiJson.load(response.body)\n if data.is_a?(Array)\n data.each_with_object({}) do |e, acc|\n acc[e[S_KEY]] = e[S_VALUE]\n end\n else\n data[S_VALUE]\n end\n else\n nil\n end\n end",
"def get(key)\n end",
"def [](key)\n result = (db_data ? db_data[key.to_s] : nil)\n result ||= raw_data.has_key?(key.to_s) ? raw_data[key.to_s] : self.send(key.to_s, nil); nil\n result\n end",
"def get_value(item, key, default: nil, **)\n return if key.blank?\n if key.is_a?(Array)\n key.find { |k| (v = get_value(item, k)) and break v }\n elsif item.respond_to?(key)\n item.send(key)\n elsif item.respond_to?(:emma_metadata) # Upload, etc.\n item.emma_metadata&.dig(key.to_sym)\n elsif item.is_a?(Hash)\n item[key.to_sym] || item[key.to_s]\n end.presence || default\n end",
"def value_for_data(key, item, value_key = :value)\n if item and item[:data] and item[:data][key]\n return item[:data][key][value_key]\n end\n return nil\n end",
"def get!(key)\n record = object(key)\n return nil unless record\n record.rewrite_cache\n record.value\n end",
"def fetch(key)\r\n obj = for_context(self) { |c| c }\r\n if obj != self\r\n return obj.fetch(key)\r\n end\r\n return super(key)\r\n end",
"def fetch(key, &block)\n store.compute_if_absent(key, &block)\n end",
"def fetch(key, default = nil)\n return default unless entry = @cache[\"#{@cache_name}:#{key}\"]\n return entry[:value] if entry[:expires].nil? || entry[:expires] > Time.now\n @cache.delete(\"#{@cache_name}:#{key}\")\n default\n end",
"def getvalue(key)\r\n return @@params[key] if (key != nil)\r\n return nil\r\n end",
"def get_key_value(key)\n if v = storage.get(key.object_id)\n return key.object_id, v\n end\n storage.get_candidates(key.hash).find do |k,v|\n candidate_key = get_object(k) or next\n candidate_key.eql? key\n end\n end",
"def get(key)\n row = key >> 10\n column = @a[row].index{|(i,v)| i == key}\n if column\n return @a[row][column][1] \n else\n return -1\n end\n end",
"def [](key)\n key = key.to_s unless key.is_a? String\n puts \"SEARCHING for key '#{key}' in doc '#{@id}'\"\n cursor = @collection.find_one( { plgid: @id } )\n if cursor\n return cursor[key]\n end\n nil\n end",
"def find(key)\n if @root.nil?\n return nil\n elsif @root.key == key\n return @root.value\n else\n find_helper(@root, key)\n end\n end",
"def read(key, default=nil)\n document = @dao.collection.find_one(selector(key))\n if !document.nil?\n document['v']\n else\n default\n end\n end",
"def [](key)\n dummy = Pair.new(key,nil)\n pair = @tree.get(dummy)\n return nil unless pair\n return pair.value\n end",
"def get(key)\n return nil unless prefixed?(key)\n key = dot_to_slash(key)\n response = http_get path_to(key)\n case response\n when String\n response = json_parse(response)\n item = response.first\n item['Value'] && value = json_parse(Base64.decode64(item['Value']))\n validate!(key, value)\n when 404\n nil\n else\n raise CMDB::Error.new(\"Unexpected consul response #{response.inspect}\")\n end\n end",
"def get(key)\n a_hash[key] || -1 \n end"
] | [
"0.79272324",
"0.7913871",
"0.7818767",
"0.773995",
"0.76901126",
"0.76591283",
"0.76042455",
"0.75959903",
"0.7472178",
"0.7423738",
"0.73812675",
"0.7339555",
"0.7295559",
"0.72106206",
"0.72048056",
"0.71889734",
"0.718323",
"0.7164405",
"0.713149",
"0.71247166",
"0.71179724",
"0.7078457",
"0.7070647",
"0.70699257",
"0.7064035",
"0.70621496",
"0.70620704",
"0.70559055",
"0.70287687",
"0.70270973",
"0.70016986",
"0.6993297",
"0.6980372",
"0.69674426",
"0.69256055",
"0.69209474",
"0.69126505",
"0.6908371",
"0.6908371",
"0.6908371",
"0.6908371",
"0.6903791",
"0.6898247",
"0.6884818",
"0.6882445",
"0.6875328",
"0.68714017",
"0.68694633",
"0.6868452",
"0.68472147",
"0.6838048",
"0.68285376",
"0.68118054",
"0.6802244",
"0.68017817",
"0.6800918",
"0.6797312",
"0.67959124",
"0.67888176",
"0.67872715",
"0.6785901",
"0.6780842",
"0.6773518",
"0.6763973",
"0.6761657",
"0.67572826",
"0.67552304",
"0.6747688",
"0.6743993",
"0.67419475",
"0.6737916",
"0.67298925",
"0.67140126",
"0.6703277",
"0.6702566",
"0.6701456",
"0.6680889",
"0.6678822",
"0.6667786",
"0.6651991",
"0.66435987",
"0.6642977",
"0.6642977",
"0.6641538",
"0.66369057",
"0.66335404",
"0.6630484",
"0.66241634",
"0.66240567",
"0.6614276",
"0.66075337",
"0.66011184",
"0.6599008",
"0.65913975",
"0.6581851",
"0.65653944",
"0.65640414",
"0.65560335",
"0.65546614",
"0.6545663",
"0.6532816"
] | 0.0 | -1 |
Store value with key | def []=(key, value)
store(key, value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put(key, value)\n \n end",
"def put(key, value); end",
"def save(key, value)\n storage.transaction {storage[key] = value}\n end",
"def store(calling_node, key, value)\n @router.touch(calling_node)\n return false unless key.class == DataKey\n @values[key.to_bin] = value\n return true\n end",
"def store_value(timestamp, key, value)\n # Prepend the timestamp so we always have unique values\n @redis.zadd(key, timestamp, \"#{timestamp}:#{value}\")\n end",
"def store_value_simply key, value\n @@key_value_storage[key] ||= value if key\n end",
"def set(key, value)\n self.data ||= {}\n self.data[key.to_s] = value\n self.save!\n end",
"def key=(value); end",
"def set(key, value)\n @store[key] = value\n end",
"def set(key, value)\n @manager.store(key, value)\n { key => value }\n end",
"def store(key, value, label=nil)\n super(key, value)\n \n if label\n @label_map[label] = key\n @key_map[key] = label\n end\n end",
"def set_value(key, value)\n @store_[key] = value\n YakvdConstants.success\n end",
"def store_data key, value\n init_data\n\n Bot::DB[my_name][key] = value\n end",
"def store_data key, value\n init_data\n\n Bot::DB[my_name][key] = value\n end",
"def store(key, value)\n mon_synchronize do\n node = (@hash[key] ||= Node.new(key))\n node.value = value\n touch(node)\n compact!\n node.value\n end\n end",
"def put(key, value)\n @first.put(key, value)\n end",
"def set(key, value); end",
"def set(key, value); end",
"def store(keyname, value)\n @keystore.store(key: keyname, value: value)\n end",
"def setnx(key, value); end",
"def setnx(key, value); end",
"def store(value, *key)\n @cache[key] = value\n end",
"def store(key, value)\n #open!(key)\n super(key, value)\n end",
"def set(key, value)\n end",
"def put(key, value)\n obj = KeyValue.find_by_key(key)\n if obj\n KeyValue.update(obj.id, :value=>value)\n else\n KeyValue.create(:key=>key, :value=>value)\n end\n end",
"def []= key, value\n @store.transaction { @store[key] = value }\n end",
"def store(key, value)\n value = apply_store_hook(key, value)\n key = aliases[key] || key\n super(key, value) unless @frozen_keys.include?(key)\n end",
"def []=(key, value)\n @store[key] = value\n end",
"def set(key , value)\n index = key_index(key)\n if( index )\n self.keys.set(index , value)\n else\n self.keys.push(key)\n self.values.push(value)\n end\n value\n end",
"def put(key,value)\n open\n db[key] = value\n close \n end",
"def set(key, value)\n self.data[key] = { value: value, timestamp: Time.now.to_i }\n self.data[key][:value]\n end",
"def stored_key(key)\n h(key)\n end",
"def set(key, value, timestamp)\n \n end",
"def store(key, value)\r\n obj = for_context(self) { |c| c.store(key, value); c }\r\n return if obj != self \r\n super(key, value)\r\n end",
"def write(key, value)\n perform_update(:write, key, value.to_s)\n end",
"def put(key, value)\n node = node_for_key(key)\n node.write(value)\n end",
"def store(key = nil, value = nil)\n return @store if key.nil?\n raise \"Cannot store key '#{key}' since it is not a stored need of #{self.class}.\" unless stores?(key)\n\n @store[key] = value\n\n ivar = \"@#{key}\"\n instance_variable_set(ivar, value)\n @root.instance_variable_set(ivar, value) if !root? && @root.stores?(key)\n\n update\n end",
"def set(key , value)\n index = key_index(key)\n if( index )\n @i_values.set(index , value)\n else\n @i_keys.push(key)\n @i_values.push(value)\n end\n value\n end",
"def get_and_set(key, value); end",
"def persist(key); end",
"def persist(key); end",
"def set(key, value)\n response = db.put_item(@table_name, {'id' => {'S' => key}, 'value' => {'S' => value}})\n true\n end",
"def set(key, value, timestamp)\n if @store[key].nil?\n @store[key] = [{ 'value' => value, 'timestamp' => timestamp }]\n else\n @store[key] << { 'value' => value, 'timestamp' => timestamp }\n end\n nil\n end",
"def key=(key); end",
"def newkey(key, value, schoolvar)\n\tschoolvar[key] = value \nend",
"def write_key(*key); end",
"def put(key, value)\n # logger.debug \"put #{key} data\"\n db.put(key, value)\n end",
"def write(key, value)\n @dao.collection.save({ '_id' => key, 'v' => value })\n end",
"def set(key, value)\n arr_pos = to_hash(key)\n list = @array[array_pos]\n node = list.find_by_key(key)\n if node\n node.data = value\n else\n self.put(key, value)\n end\n end",
"def write_attribute(key, value)\n @hash[key.to_s] = value\n end",
"def []=(key, value)\n @storage[key] = value\n end",
"def put(key, value)\n @root = put_rec(@root, key, value, 0)\n end",
"def put(key, value)\n position = search(key)\n if (key <=> @keys[position]) == 0\n @values[position] = value\n else\n @keys.insert(position, key)\n @values.insert(position, value)\n end\n end",
"def store( key, value )\n key = key.to_s.strip unless key.nil?\n raise \"Invalid key\" if key.nil? or key == ''\n \n @db.execute( %Q{\n INSERT INTO #{TABLE_NAME}\n (key,value,created_at)\n VALUES (?,?,?)\n },\n key,\n value.to_yaml,\n Time.now.to_i\n )\n \n return value\n end",
"def put(key, value)\n row = key >> 10\n puts \"Insert: #{key},#{value} => row = #{row}\" if @d\n column = @a[row].index{|(i,v)| i == key}\n\n if column\n @a[row][column][1] = value\n else\n @a[row].push([key, value])\n end\n end",
"def []=(key, value)\n @lock.synchronize { @store[key] = value }\n end",
"def set(key, value=nil)\n @data[key.to_s] = value\n end",
"def set(key, value)\n @namehash[key.to_sym][0] = value\n end",
"def store(key, value)\n filename = File.join(dir, key)\n File.write(filename, value)\n filename\n end",
"def write(key, value)\n key.freeze if key.is_a? String\n\n @memory_store[key] = value\n @file_store.transaction do\n @file_store[key] = value\n end\n end",
"def put(key, value)\n idx, bucket = find_bucket_and_index(key)\n if idx\n bucket[idx] = [key, value]\n else\n bucket << [key, value]\n end\n end",
"def key=(value)\n @key = value.to_s\n end",
"def add(key, value)\n end",
"def write(key, value)\n @cache[key] = value\n end",
"def set(key, value, expires_in = 0)\n remove(key)\n expires = nil\n if expires_in > 0\n expires = Time.now.utc + expires_in\n end\n @store.push({ key: build_key(key), value: value, expires: expires})\n end",
"def add_key_value?(key, val)\n @store.transaction do\n return false if @store.to_h.key? key\n @store[key]=val\n end\n true\n end",
"def key=(value)\n @key = value\n end",
"def key=(value)\n @key = value\n end",
"def set(key, value)\n @value[key.to_sym] = value if key\n end",
"def write(key, value, options = {})\n entry = ::Elephas::Entry.ensure(value, key, options)\n entry.refresh\n @data[key] = entry\n entry\n end",
"def set(key, value)\n\t\t\t\t# TODO This could be a bit more efficient:\n\t\t\t\tself.delete(key)\n\t\t\t\tself.add(key, value)\n\t\t\tend",
"def []=(key, value)\n store(key, value)\n end",
"def add(key, value); end",
"def addkey(key, value, school)\n school[key] = value\nend",
"def add(key, value)\n\t\t\t\tself[key] = value\n\t\t\tend",
"def add_key(key, value, school)\t\t\t\t\t\t\t\t\t\t\t\t\t#di. create method to add keys & values\n\tschool[key] = value\nend",
"def []= key, value\n @internal_hash[key].push value\n value\n end",
"def write_value_using_hash_strategy(writer, key)\n writer.push_value(@object[key], key.to_s)\n end",
"def []=(key, value)\n key, val = key.to_s, encode_value(value)\n record = find_or_create_by_hkey(key)\n record.update_attribute(\"hvalue\", val)\n save_cache(key, value)\n end",
"def set_value(key, value)\n database[key] = value\n removed_keys.delete(key)\n end",
"def []=( key, value )\n context.store(key.to_s, value)\n end",
"def []= key, value\n @data[key] = value\n end",
"def []= key, value\n @data[key] = value\n end",
"def []=(key, value)\n values[key] = value\n values.save\n end",
"def put(key, value)\n return if @cap <= 0\n fav = @c[key]\n if fav\n return\n end\n \n end",
"def put(key, value)\n has_key = get(key)\n\n if has_key != -1\n @store[key].val = value\n elsif has_key == -1 && length < capacity\n n = @store[key] = LNode.new(value, key)\n append_to_tail(n)\n @length += 1\n else #if has_key == -1 && length >= capacity\n lru = @store[:head].nxt\n remove_node_from_store_links(lru)\n @store.delete(lru.key)\n n = @store[key] = LNode.new(value, key)\n append_to_tail(n)\n end\n nil\n end",
"def set key, value, expiration\n backend.set key.to_s, serialize(value), expiration rescue nil\n end",
"def put(key, value)\n @root = put_node(@root, key, value, 0)\n end",
"def store(key, value)\n\t\t\tused_key = key \n\t\t\twhile File.exists?(key_to_path(used_key))\n\t\t\t\tif fetch(used_key) == value\n\t\t\t\t\tFileUtils.touch(key_to_path(used_key))\n\t\t\t\t\treturn used_key # Already exists. Do not store again.\n\t\t\t\tend\n\t\t\t\tused_key = Soil.digest_class.digest(key)\n\t\t\tend\n\t\t\tfile_path = key_to_path(used_key)\n\n\t\t\tFileUtils.mkpath(file_path.dirname)\n\t\t\tFile.open(file_path, 'w') do |f|\n\t\t\t\tf.write(Zlib::Deflate.deflate value)\n\t\t\tend\n\t\t\treturn used_key\n\t\tend",
"def add_data(key, value)\n @data[key] = value\n end",
"def set key, data\n\t\t@data_base[ key ] = data\n\t\tupdate_database\n\tend",
"def []=(key, value)\n @data[key.to_s]=value\n end",
"def add_pair(key, value)\r\n @redis.set(key, value)\r\n end",
"def store(key, value)\n @threshold_key ||= key\n\n if has_key?key\n fetch(key) << value\n else\n if size >= @maxkeys\n return value if compare_to_threshold(key)\n delete(@threshold_key)\n adjust_threshold\n end\n super_store(key, [ value ])\n @threshold_key = key if compare_to_threshold(key)\n end\n\n value\n end",
"def write_key(key, value)\n raise RuntimeError.new(\"write_key not implemented!\")\n end",
"def []= key, value\n @hash[key.to_s] = value\n end",
"def set(key, value, timestamp)\n @hsh[key] ||= [] \n @hsh[key].push([timestamp,@hsh[key].size,value])\n end",
"def save_value(key, value)\n raise NotImplementedError,\n \"The :save_value method should be overwritten by a subclass.\"\n end"
] | [
"0.793792",
"0.7670004",
"0.762042",
"0.7580393",
"0.7576812",
"0.7569778",
"0.7558423",
"0.75272936",
"0.74716073",
"0.74465036",
"0.7438644",
"0.74326175",
"0.7432324",
"0.7432324",
"0.7399075",
"0.7397068",
"0.73658323",
"0.73658323",
"0.7349419",
"0.73077714",
"0.73077714",
"0.72982323",
"0.728561",
"0.7255348",
"0.7241423",
"0.72225815",
"0.717306",
"0.71673656",
"0.71656984",
"0.7149072",
"0.71364486",
"0.7126193",
"0.71194917",
"0.71170276",
"0.71098536",
"0.7096406",
"0.7090059",
"0.70882106",
"0.7084474",
"0.70824915",
"0.70824915",
"0.70813364",
"0.70663655",
"0.70654804",
"0.70544684",
"0.7053819",
"0.70488226",
"0.70486546",
"0.7041807",
"0.703626",
"0.7034033",
"0.7016596",
"0.7010631",
"0.7005865",
"0.6989841",
"0.69771564",
"0.6976316",
"0.6962284",
"0.6958412",
"0.69534075",
"0.6951339",
"0.69488215",
"0.69444686",
"0.6938012",
"0.689921",
"0.68919647",
"0.6885359",
"0.6885359",
"0.6873256",
"0.6868394",
"0.68655497",
"0.68641895",
"0.68631035",
"0.6862488",
"0.6853738",
"0.68492335",
"0.6846337",
"0.683827",
"0.6838163",
"0.6831241",
"0.6819983",
"0.6819624",
"0.6819624",
"0.6817192",
"0.681246",
"0.68105525",
"0.67991346",
"0.67979103",
"0.67904985",
"0.6789141",
"0.6779457",
"0.6775692",
"0.676517",
"0.6753836",
"0.67467076",
"0.67408675",
"0.6738798",
"0.67310804"
] | 0.6945244 | 63 |
instance variables defined here can be used in corresponding view file contact_email.html | def contact_email(name, email, body)
@name = name
@email = email
@body = body
mail(from: email, subject: 'Contact Form Message')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def emailform\n end",
"def emailform\n end",
"def email; end",
"def email; end",
"def email; end",
"def email; end",
"def process_contact\n # inside of all controller actions you have access a `request` object that represents the request being made\n \n # In rails all the information from the url and body are in a hash called `params`\n\n # storing values inside of instance variables will give you access to them inside of your views\n\n # byebug: if you add `byebug` anywhere within your application it will stop the execution of code at that point and allow you to dig around to debug stuff.\n get_name\n @email = params[:email]\n @message = params[:message]\n\n # if you explicitly tell rails to render a file then it will expect a file in views called `views/welcome/thank_you.html.erb`\n render :thank_you\n end",
"def contactus\r\n end",
"def input_email(f)\n\t\trender :partial => \"shared/forms/panel/email\", :locals => { :f => f }\n\tend",
"def email; @email; end",
"def contactus\n end",
"def get_mail\n \n end",
"def contact_us_template\n 'contact_us'\n end",
"def show\n session[:applicant_token] = params[:id] unless current_user\n @email = ERB.new(Settings.email_template).result(get_binding)\n p EMAIL: @email\n end",
"def contact_email\n self.contact[:contact_email]\n end",
"def email\n end",
"def email\n @email \n end",
"def contact_form(email)\n\n @sender = email[0]\n @website = email[1]\n @email = email[2]\n @message = email[3]\n\n @greeting = @sender+ \"sent a message\"\n\n mail :to => \"rice9650@gmail.com\",:subject=>@greeting\n end",
"def mail_box; end",
"def email_link\n \"<a href='mailto:#{contact_email}'>Contact</a>\"\n end",
"def contact_email=(value)\n @contact_email = value\n end",
"def article_email\n UserMailer.article_email\n end",
"def contact_email\n return @contact_email\n end",
"def contact_email\n @contact = params[:contact]\n mail(:to => \"coyitest@gmail.com\", :subject => \"You have received a question from #{@contact[:name]} @ #{@contact[:email]}\", :body => \"#{@contact[:body]}\")\n end",
"def process_contact\n # In Rails, all of Express' req.params, req.query\n # and req.body are comined into the `params` object.\n\n # Use `render json: <object>` to inspect the object\n # as json in the browser much like we did with \n # `res.send()` in Express.\n # render json: params\n # vs. JavaScript\n # res.send({ ...req.body, ...req.query, ...req.params })\n \n # In Rails, instance variables in the controller are\n # accessible in the rendered view as well.\n # Use them to pass value to your templates.\n @full_name = params[:full_name]\n @message = params[:message]\n @email = params[:email]\n \n render :thank_you\n end",
"def contact_email\n UserMailer.contact_email\n end",
"def advertise_contact_form(name,email,phone,company,city)\n @name = name\n @email = email\n @phone = phone\n @company = company\n @city = city\n mail(:to => \"info@venuedog.com\", :subject => \"#{name} @ #{company} filled out a new 'Advertise With Us' Form!\")\n end",
"def contact_info(name, company, email, telephone, message)\n\t\t@name = name\n\t\t@company = company\n \t@email = email\n \t@telephone = telephone\n \t@message = message\n mail(:to => \"cwmct79@gmail.com\",\n :subject => \"Oasis Books Contact Form Message\")\n end",
"def contact_form(contact)\n @contact = contact\n\n mail to: contact.email, subject: \"Thanks for getting in touch\"\n end",
"def render_edit_email(form)\n @errors = form.errors.messages\n render :edit_email\n end",
"def new_contact_intro_email(user, contact)\n if user.name.present?\n @name = user.name.titlecase\n else\n @name = user.email\n end\n\n @signature = user.signature\n @email = user.email\n\n mail to: contact.email, reply_to: @email, from: \"\\\"#{@name}\\\" <#{@email}>\", subject: \"#{@name} wants to stay in touch with you!\"\n Email.create(:user_id => user.id, :sent_to => contact.id, :title => \"new_contact_intro_email\", :contacts => contact.id)\n end",
"def compose_email\n @title = t 'conclusion_draft_review.send_by_email'\n end",
"def inquiry_created_email(inquiry)\n @inquiry = inquiry\n mail(to: 'tushiesandtantrums@gmail.com',\n subject: 'New Message from your Website',\n reply_to: @inquiry.email) do |format|\n format.html { render layout: 'email' }\n end\n end",
"def contact_information(contact)\n @contact = contact\n\n mail to: \"chaitanyamalineni488@gmail.com\", subject: \"Contact Form\"\n end",
"def contact_confirmation(first_name,second_name,email,phone,camp,inquire_type,message)\n @first_name=first_name \n @second_name=second_name\n @email=email\n @phone=phone\n @camp=camp\n @inquire_type=inquire_type\n @message=message\n\n mail to: \"fjqz50@gmail.com\", subject: \"Contact \"\n end",
"def email\n\t\t@email\n\tend",
"def email\n\t\t@email\n\tend",
"def contact\n\n end",
"def contact\n\n end",
"def display_one_contact\n contact = retrieve_contact_by_email\n end",
"def set_contact_email email\n contact_email_tb.type_text email\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def inquiry(contact_message)\n @contact_message = contact_message\n mail to: \"newsletterstar@gmail.com\",\n from: contact_message.email,\n subject: \"Neue Kontaktanfrage\"\n end",
"def contact_us\n # below was for google map rendering via paloma:\n # js current_agency_primary_address: @current_agency.primary_address\n # js show_contact_map: @current_agency.show_contact_map\n # could explicitly set function for Paloma to use like so:\n # js \"Pwb/Sections#contact_us\"\n # @enquiry = Message.new\n @page_title = I18n.t(\"contactUs\")\n\n @map_markers = []\n if @current_agency.show_contact_map\n @map_markers.push(\n {\n id: @current_agency.id,\n title: @current_agency.display_name,\n show_url: \"#\",\n image_url: @current_website.logo_url,\n # display_price: @current_agency.contextual_price_with_currency(@operation_type),\n position: {\n lat: @current_agency.primary_address.latitude,\n lng: @current_agency.primary_address.longitude\n }\n }\n )\n end\n\n render \"/pwb/sections/contact_us\"\n end",
"def contact_info\n puts \" Address: #{@address}\"\n puts \" Phone No: #{@phone}\"\n puts \" Email: #{@email}\"\n end",
"def contact(name, email, content)\n @name = name\n @email = email\n @content = content\n mail to: 'contact@coursavenue.com', subject: 'Suite de votre message sur CoursAvenue', reply_to: email\n end",
"def email_contact(params)\n @first_name = params['firstname']\n @last_name = params['lastname']\n @email = params['email']\n @drop_down = params['selection']\n @message = params['message']\n mail to: \"deborahaanderson@gmail.com\", subject: \"You've been sent a new message!\"\n end",
"def contact_message(contact_email)\n @contact_email=contact_email\n \n\n mail to: \"amfsg@aol.com\", subject: \"Message Sent From raisebusinessomeony.com: #{contact_email.subject}\", from: contact_email.email, reply_to: contact_email.email\n end",
"def additional_info\n @contact=Contact.find_by_id(params[:id])\n @contact.attributes = {:name=>params[:name],:comment=>params[:comments],:phone_number =>params[:phone] }\n if @contact.save && ( simple_captcha_valid? || params[:field] == \"skip\" )\n UserMailer.delay.contact_us(@contact)\n render :update do |page|\n page.replace_html \"get_started2\", :partial => \"thanks_page\"\n page.call \"load_completer\"\n end\n else\n render :update do |page|\n page.replace_html \"error_msg\",\"Image and text were different\"\n page.replace_html \"name_error_msg\", \"Provide a valid name\" if !@contact.errors[:name].blank?\n page.replace_html \"phone_error_msg\", \"Provide a valid Phone Number\" if !@contact.errors[:phone_number].blank?\n page.call \"load_completer\"\n end\n end\n end",
"def contact_info\n [phone_number, email].compact.map { |e| exhibit(e, @context) }.join('<br />').html_safe\n end",
"def contact_email\n contact['email_address']\n end",
"def mailer; end",
"def contact \n\n end",
"def contact()\n\t\t\"Please contact #{full_name()} via #{email}\"\n\tend",
"def show_notfication\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def email_signup\n email = params[:Email] || params[:email] || \"\"\n @src = \"#{website.email_signup_url}#{email}\"\n @page_title = \"Newsletter Sign Up\"\n render_template\n end",
"def contact_email\n @contact = Contact.last\n mail to: \"lauren@scholarhood.ca, kurtis.elliott@ratehub.ca\"\n end",
"def contactUs(name, email, phone, question, contact_pref)\n @contact_pref = contact_pref\n @name = name\n @email = email\n @phone = phone\n @question = question\n @greeting = @name + \" \" + \"Has a question!\"\n @subject = \"User Question\"\n\n mail to: \"bubba99207@gmail.com\", subject: @subject\n end",
"def inbound_email; end",
"def inbound_email; end",
"def contact\n @title = \"contact\"\n end",
"def view(review, recipient)\n @review = review\n\n mail(to: recipient.email, subject: \"#{@review.review_type == \"cto\" ? @review.booking.user.first_name : @review.booking.offer.user.first_name} vous a laissé un commentaire\")\n end",
"def feedback\n NotebookMailer.feedback\n end",
"def email\n @delivery = Delivery.find(params[:id])\n @company = @delivery.company\n \n end",
"def contactus(name, email, phone, message, newsletter, subscribe, contact_method, product)\n @name = name\n @email = email\n @phone = phone\n @message = message\n @newsletter = newsletter\n @subscribe = subscribe\n @contact_method = contact_method\n @product = product\n\n mail(to: \"sglover42@gmail.com\", subject: \"Customer Contact\", bcc: 'dljones@scc.spokane.edu')\n\n end",
"def edit_email\n @errors = {}\n end",
"def feedback\n NewsletterMailer.feedback\n end",
"def new(contact)\n @contact = contact\n mail :subject => \"Contact Form Completed (#{SITE_SETTINGS[\"Name\"]})\"\n end",
"def app_contact\n end",
"def contact_us\r\n\t@title = \"Contact Us\"\r\n end",
"def show_thank_you\n mail to: @guest.email, subject: \"We hope you enjoyed the show\"\n end",
"def inquiry(member)\n @member = member\n mail to: @member.email\n end",
"def demo_request(email, name, company)\n @email = email\n @name = name\n @company = company\n mail(to: \"casimodo.be@gmail.com\", subject: \"new demo demand\")\n end",
"def contact(text, user)\n @text = text\n @user = user\n @person, @company, = @user.person, @user.company\n mail(:subject => \"Contact Form\", :to => AppConfig[:support_email], :from => @user.email)\n end",
"def passenger_feedback(name, phone, email, message)\n @name = name\n @phone = phone\n @email = email\n @message = message\n\n mail to: \"glassbead@gmail.com\"\n end",
"def display_contact\r\n\t\tputs \"ID: #{@id}\"\r\n\t\tputs \"First Name: #{@firstname}\" \r\n\t\tputs \"Last Name: #{@lastname}\"\r\n\t\tputs \"Email Address: #{@email}\"\r\n\t\tputs \"Notes on User: #{@notes}\" \r\n\tend",
"def product_email\n UserMailer.product_email\n end",
"def basic(customer,template)\n @body = Liquid::Template.parse(template.body)\n .render(\"person\" => customer.attributes)\n mail to: customer.email, subject: template.title\n end",
"def contact_details\n puts \"Contact name: #{self.contact_name}\"\n puts \"Phone number: #{self.phone}\"\n puts \"Email: #{self.email}\"\n end",
"def feedback_email(visitor)\n @name=visitor[:name]\n mail(to: visitor[:email], subject: \"Contato\")\n end",
"def inquiry(info)\n @name = info[:name]\n @email = info[:email]\n @content = info[:content]\n mail(to: 'kazpetrulyte@outlook.com', subject: \"Message from #{@name} via flowersbykaz.com\")\n end",
"def contact_me(contact_form)\n @from = contact_form.email\n @message = contact_form.message\n @name = contact_form.name\n if contact_form.name.presence\n subject = \"Portfolio: A message from #{contact_form.name}\" \n else\n subject = \"Portfolio: A message from an unnamed visitor to your site.\"\n end\n mail from: contact_form.email,subject: subject\n end",
"def newsletter_email\n UserMailer.newsletter_email\n end",
"def contact_email(contact)\n @contact = contact\n mail(to: ENV['GMAIL_ADDRESS'], \n subject: 'Contact Form Inquiry',\n message: @contact.message)\n end",
"def contact\n Notifierrails.contact\n end",
"def new(contact)\r\n @contact = contact\r\n case @contact.form_type\r\n when 'course_instance_enquiry'\r\n mail to: SITE_SETTINGS['Course Instance Enquiry'], cc: SITE_SETTINGS['Email'], subject: @contact.subject\r\n else\r\n mail to: SITE_SETTINGS['Email'], subject: \"Contact form completed - #{SITE_SETTINGS['Name']}\"\r\n end\r\n end",
"def site_page_form\n @greeting = \"Hi\"\n\n mail :to => \"sale@putivetra.ru\"\n end"
] | [
"0.71770656",
"0.71770656",
"0.66224897",
"0.66224897",
"0.66224897",
"0.66224897",
"0.66215",
"0.6583589",
"0.6550911",
"0.65375525",
"0.64942867",
"0.6479006",
"0.6461117",
"0.6394578",
"0.6363429",
"0.6353733",
"0.630635",
"0.63044226",
"0.6297851",
"0.62754214",
"0.62733275",
"0.62697095",
"0.62601894",
"0.625962",
"0.62521136",
"0.62306607",
"0.6228489",
"0.6214801",
"0.62126225",
"0.6201746",
"0.6179644",
"0.616922",
"0.6166291",
"0.6165903",
"0.6165651",
"0.6150456",
"0.6150456",
"0.614733",
"0.614733",
"0.6142659",
"0.6135708",
"0.61275774",
"0.61275774",
"0.61275774",
"0.61275774",
"0.61275774",
"0.61275774",
"0.61275774",
"0.61275774",
"0.61275774",
"0.61275774",
"0.61275774",
"0.61275774",
"0.61275774",
"0.61275774",
"0.6127269",
"0.6117929",
"0.61159116",
"0.6095377",
"0.60818946",
"0.6080797",
"0.6076622",
"0.60762835",
"0.6057327",
"0.60546744",
"0.6050369",
"0.60465634",
"0.60451114",
"0.603794",
"0.60246",
"0.60175544",
"0.6014056",
"0.6014056",
"0.60098284",
"0.6007201",
"0.6002259",
"0.60013604",
"0.59873915",
"0.59793264",
"0.59755677",
"0.59662116",
"0.5963465",
"0.59511936",
"0.5945949",
"0.5945663",
"0.5945618",
"0.5941852",
"0.594017",
"0.59322184",
"0.5931208",
"0.5904518",
"0.59044915",
"0.58971393",
"0.5896919",
"0.58967495",
"0.58964634",
"0.58916444",
"0.58895236",
"0.5885143",
"0.58829325"
] | 0.59560525 | 82 |
String representation of the SID | def to_s
['S', revision, nt_authority, nt_non_unique, uuids].join('-')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sid_to_name(value)\n if Puppet::Util::Windows::SID.respond_to?(:sid_to_name)\n Puppet::Util::Windows::SID.sid_to_name(value)\n else\n Puppet::Util::Windows::Security.sid_to_name(value)\n end\n end",
"def cmd_getsid(*args)\n print_line(\"Server SID: #{client.sys.config.getsid}\")\n end",
"def name2id(value)\n Puppet::Util::Windows::Security.name_to_sid(value)\n end",
"def sid\n data['sid']\n end",
"def to_s\n unique_name.to_s\n end",
"def id2name(id)\n if Puppet::Util::Windows::Security.valid_sid?(id)\n Puppet::Util::Windows::Security.sid_to_name(id)\n else\n id\n end\n end",
"def to_s\n @identifier.to_s.upcase\n end",
"def to_s\n uid\n end",
"def to_s\n uid\n end",
"def stringify_rid(record)\n record.getIdentity.toString\n end",
"def name_to_sid(name)\n if Puppet::Util::Windows::SID.respond_to?(:name_to_sid)\n Puppet::Util::Windows::SID.name_to_sid(name)\n else\n Puppet::Util::Windows::Security.name_to_sid(name)\n end\n end",
"def to_s\n iid\n end",
"def generate_sid\n \"%0#{@default_options[:sidbits] / 4}x\" %\n rand(2**@default_options[:sidbits] - 1)\n end",
"def ssn\n safe_attr('va_eauth_pnid')&.delete('-') if safe_attr('va_eauth_pnidtype') == 'SSN'\n end",
"def to_s\n str = \"#{@user}\\@#{@host}:#{@name}\"\n return str\n end",
"def to_s\n id.to_s\n end",
"def name\n\t\treturn sname || sid\n\tend",
"def name\n\t\treturn sname || sid\n\tend",
"def sid_algorithm; SecureRandom.hex(@options[:sid_len]); end",
"def to_s\n \"#{identifier} in #{organization_id}\"\n end",
"def to_s\n \"_:%s\" % @id.to_s\n end",
"def format_identifier\n self.identifier.to_s\n end",
"def res_id_to_s(res_id)\n return \"0x#{res_id.to_s(16)}\"\n end",
"def to_s\n id_for(sha1)\n end",
"def to_s\n \"#{@id} - #{@name}\"\n end",
"def to_s\n \"EC2 SecurityGroup: #{@sg_id}\"\n end",
"def to_s\n \"EC2 SecurityGroup: #{@sg_id}\"\n end",
"def sid\n open['sid']\n end",
"def generate_sid(secure = @sid_secure)\n if secure\n SecureRandom.hex(@sid_length)\n else\n \"%0#{@sid_length}x\" % Kernel.rand(1 << @sidbits)\n end\n rescue NotImplementedError\n generate_sid(false)\n end",
"def to_s\n @pid_path.to_s\n end",
"def to_s\n %w( name uuid ).collect { |k| \"#{k}=#{ self.send(k) }\" }.join(' | ') \n end",
"def to_s_id(obj)\n \"0x%x\" % [obj.object_id*2]\n end",
"def to_s\n\t\t\"#{@name} [#{@id}]\"\n\tend",
"def to_s(tab)\r\n\t\t\r\n\t\treturn (\" \"*tab) + \"ident: \" + @id.to_s() + \"\\n\"\t\t\t\t\r\n\tend",
"def to_s(tab)\r\n\t\t\r\n\t\treturn (\" \"*tab) + \"ident: \" + @id.to_s() + \"\\n\"\r\n\t\t\r\n\t\t\r\n\tend",
"def to_s\n send( self.class.unique_string_field )\n end",
"def to_s\n \"#{type}:#{flags.join}:#{principle}@#{domain}:#{permissions.join}\"\n end",
"def to_s\n @username.to_s\n end",
"def to_s\n \"#{@name} - #{@sign}\"\n end",
"def identifier\n sid_value || super\n end",
"def name\n \"#{self[:interface]} #{self[:sid]}\"\n end",
"def to_s\r\n @id + \"|\" + @paired\r\n end",
"def user_sid\n return @user_sid\n end",
"def sid\n oratab = OraUtils::OraTab.new\n self[:sid].empty? ? oratab.default_asm_sid : self[:sid]\nend",
"def to_s\n # no need to print tcp/udp ANY in Cisco ACL\n ''\n end",
"def getSocialStreamUserSid\n #XMPP DOMAIN\n domain = SocialStream::Presence.domain\n #SS Username\n ss_name = SocialStream::Presence.social_stream_presence_username\n return ss_name + \"@\" + domain\n end",
"def to_s\n screen_name\n end",
"def to_s\n\t\treturn \"%s:%d (%s, %s, %s)\" % [\n\t\t\tself.host,\n\t\t\tself.port,\n\t\t\tself.base_dn,\n\t\t\tself.connect_type,\n\t\t\tself.bound? ? @bound_user : 'anonymous'\n\t\t ]\n\tend",
"def ssn\n legacy_ssn\n end",
"def sfa_id()\n self.uuid.to_s\n end",
"def pid_to_s\n \"#{Setting.organization_icao}#{pid}\"\n end",
"def to_str\n @passwd.name\n end",
"def inspect\n begin\n return \"#{self.class.to_s}[#{self.nickname.inspect}]\"\n rescue\n return \"#{self.class.to_s}[#{self.rs_id}]\"\n end\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n %w( name display_name uuid ).collect { |k| \"#{k}=#{ self.send(k) }\" }.join(' | ') \n end",
"def to_s\n s = id, name\n end",
"def msg_SID(source, args)\n # :uplinkSID SID name hops SID :desc\n Server.new(args[2], args[0], args[3])\n\n return nil\n end",
"def node_id_s\n node_bytes = [ @node_id >> 32, @node_id & 0xFFFF_FFFF].pack(\"NN\")\n elements = node_bytes.unpack(\"CCa6\")\n node = elements[-1].unpack('C*')\n elements[-1] = '%02x%02x%02x%02x%02x%02x' % node\n \"%02x%02x-%s\" % elements\n end",
"def to_s\n @id\n end",
"def plain_text_student_id\n @student_id.to_s + \"|\" + utc_date_time;\n end",
"def sid\n close['sid']\n end",
"def to_s\n name.to_s\n end",
"def to_s\n name.to_s\n end",
"def to_s()\n return \"id: \" + @id.to_s() + \"\\nFirst Name: \" + @first_name + \\\n \"\\nLast Name: \" + @last_name + \"\\nGender: \" + @gender + \"\\nAge: \" + @age + \"\\nBirthdate: \" + @birthdate\n end",
"def generate_sid(secure = @sid_secure)\n sid = super(secure)\n sid = \"#{generate_hmac(sid, @config.secret_key)}--\" + sid\n end",
"def to_s\n values = @params.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Routes.V2.SipDomainInstance #{values}>\"\n end",
"def to_s\n @passwd.name\n end",
"def to_s join_string = ''\n sprintf((['%02x'] * szUidLen).join(join_string), * uid).upcase\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n id\n end",
"def to_s\n \"#<#{self.class.name}:0x#{object_id.to_s(16).rjust(14, \"0\")} host='#{client.host}'>\"\n end",
"def to_s\n to_hex\n end",
"def guid_to_string(guid)\n\t\taguid = guid.unpack(\"H*\")[0]\n\t\tsguid = \"{\" + aguid[6,2] + aguid[4,2] + aguid[2,2] + aguid[0,2]\n\t\tsguid << \"-\" + aguid[10,2] + aguid[8,2] + \"-\" + aguid[14,2] + aguid[12,2] + \"-\" + aguid[16,4]\n\t\tsguid << \"-\" + aguid[20,12] + \"}\"\n\t\treturn sguid\n\tend",
"def guid_to_string(guid)\n\t\taguid = guid.unpack(\"H*\")[0]\n\t\tsguid = \"{\" + aguid[6,2] + aguid[4,2] + aguid[2,2] + aguid[0,2]\n\t\tsguid << \"-\" + aguid[10,2] + aguid[8,2] + \"-\" + aguid[14,2] + aguid[12,2] + \"-\" + aguid[16,4]\n\t\tsguid << \"-\" + aguid[20,12] + \"}\"\n\t\treturn sguid\n\tend",
"def to_s\n to_symbol.to_s\n end",
"def to_s\n \"#{user}@#{host}\"\n end",
"def to_s\n square_name.to_s\n end",
"def to_s\n \"#{user}:#{digest}\"\n end",
"def to_s\n\t\t\t@string\n\t\tend",
"def format_protocol_id_column(protocol)\n protocol.subsidies.any? ? protocol.sparc_id.to_s + 's' : protocol.sparc_id\n end",
"def to_s\n name.to_s\n end",
"def to_s\n \"RDS DBInstance: #{@dbi_name}\"\n end",
"def to_s\n \"RDS DBInstance: #{@dbi_name}\"\n end",
"def to_s\n to_sym.to_s\n end",
"def uuid\n safe_attr('va_eauth_uid')\n end",
"def to_s\n jid.to_s\n end",
"def to_sym\n @id.to_s.to_sym\n end",
"def to_s\n @str\n end",
"def to_s\n @str\n end",
"def to_s\n @name.to_s\n end",
"def to_s\n \"<Twilio.Api.V2010.SipInstance>\"\n end",
"def to_s\n @real_key\n end",
"def id_to_s\n self._id.to_s\n end",
"def to_s\n \"<#{ self.class }##{ format('0x00%x', (object_id << 1)) } id:#{ id.inspect }>\"\n end"
] | [
"0.6864902",
"0.68457276",
"0.6707173",
"0.66621685",
"0.6638018",
"0.6576314",
"0.6562179",
"0.65184605",
"0.65184605",
"0.64885587",
"0.6400933",
"0.6390441",
"0.63712615",
"0.6358722",
"0.63379276",
"0.6317314",
"0.6294879",
"0.6294879",
"0.6277553",
"0.625368",
"0.6235853",
"0.61556125",
"0.6143828",
"0.61210406",
"0.6114455",
"0.6108928",
"0.6108928",
"0.6106298",
"0.60766023",
"0.6065203",
"0.6062267",
"0.60468376",
"0.6039558",
"0.6037032",
"0.6036538",
"0.60212344",
"0.599554",
"0.5938051",
"0.5920427",
"0.5920308",
"0.59054697",
"0.5902373",
"0.5901805",
"0.5899224",
"0.5896766",
"0.58911455",
"0.58869904",
"0.58844745",
"0.58815825",
"0.5880406",
"0.5875644",
"0.587491",
"0.58736974",
"0.58511245",
"0.58511245",
"0.58511245",
"0.58511245",
"0.5848928",
"0.58396953",
"0.58395094",
"0.5836563",
"0.58323556",
"0.5823644",
"0.5821459",
"0.58197594",
"0.58197594",
"0.5809568",
"0.58053166",
"0.580212",
"0.57951915",
"0.57943505",
"0.57888854",
"0.57888854",
"0.57888854",
"0.57888854",
"0.57847875",
"0.5781319",
"0.5781",
"0.5774982",
"0.5774982",
"0.5773609",
"0.5773502",
"0.57730496",
"0.57661724",
"0.5761819",
"0.5760696",
"0.5759703",
"0.57550544",
"0.57550544",
"0.57492745",
"0.5748884",
"0.57448655",
"0.5741203",
"0.5734725",
"0.5734725",
"0.5733976",
"0.573328",
"0.57331526",
"0.5730264",
"0.5718067"
] | 0.6638813 | 4 |
Given a hash with numeric values, return the key for the smallest value | def key_for_min_value(name_hash)
return nil if name_hash.empty?
min = 1000000000000
key = ""
name_hash.each do |name, number|
if number < min
min = number
key = name
end
end
key
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |key, value|\n if value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |k, v|\n if v < lowest_value\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n smallest_value = nil\n smallest_key = nil\n hash.each do |name, num|\n if smallest_value == nil || num < smallest_value\n smallest_value = num\n smallest_key = name\n end\n end\n smallest_key\nend",
"def key_for_min_value(hash)\n min_val = Float::INFINITY\n min_key = nil\n hash.each do |key, value|\n if value < min_val\n min_val = value\n min_key = key\n end\n end\n min_key\nend",
"def key_for_min_value(hash)\n \n min_val = Float::INFINITY\n min_key = nil\n hash.each do |k, v|\n if min_val > v\n min_val = v\n min_key = k\n end\n end\n return min_key\nend",
"def key_for_min_value(hash)\n smallest_key = nil\n tiny_value = nil\n hash.each do |key, value|\n if tiny_value == nil || value < tiny_value\n tiny_value = value\n smallest_key = key\n end\n end\n smallest_key\nend",
"def key_for_min_value(hash)\n smallest = nil\n key = nil\n hash.collect do |name, val|\n if smallest == nil || val < smallest\n smallest = val\n key = name\n end\n end\n key\nend",
"def key_for_min_value(hash)\n int_hash = hash.select { |key, val| val.class == Fixnum }\n smallest = int_hash[int_hash.keys.sample]\n # debugger\n int_hash.each do |key, val|\n if val < smallest\n smallest = val \n end\n end\n int_hash.key(smallest)\nend",
"def key_for_min_value(hash)\r\n smallest_key = nil\r\n tiniest_value = nil\r\n hash.each do |key, value|\r\n if tiniest_value == nil || value < tiniest_value\r\n tiniest_value = value\r\n smallest_key = key\r\n end\r\n end\r\n smallest_key\r\nend",
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = 0\n\n\n hash.each do |key,value|\n if lowest_value == 0 || value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n min = nil\n hash.each_pair do |key, value|\n min ||= value\n min = value if value < min\n end\n hash.key(min)\nend",
"def key_for_min_value(hash)\n smallest = nil\n hash.each do |key, value|\n if smallest == nil\n smallest = key\n end\n if hash[key] < hash[smallest]\n smallest = key\n end\n end\n smallest\nend",
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil\n hash.each do |k, v|\n if lowest_value == nil || v < lowest_value\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil\n hash.each do |k, v|\n if lowest_value == nil || v < lowest_value\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n smallest_key = nil\n tiniest_value = nil\n hash.each do |key, value|\n if tiniest_value == nil || value < tiniest_value\n \n # this way, the smallest value in the hash so far always overwrites the existing tiniest value\n \n tiniest_value = value\n smallest_key = key\n end\n end\n smallest_key\nend",
"def key_for_min_value(hash)\n hash_key = nil\n hash_value = nil\n hash.each do |key, value|\n if hash_value == nil || value < hash_value\n hash_value = value\n hash_key = key\n end\n end\n hash_key\nend",
"def key_for_min_value(hash)\n min_key = nil\n hash.each do |key, value|\n if min_key.nil?\n min_key = key\n elsif value < hash[min_key]\n min_key = key\n else\n next\n end\n end\n min_key\nend",
"def key_for_min_value(hash)\n min_key = nil\n hash.each do |key, value|\n if min_key.nil?\n min_key = key\n elsif value < hash[min_key]\n min_key = key\n else\n next\n end\n end\n min_key\nend",
"def key_for_min_value(hash)\n min = 99999999\n min_key = nil\n hash.select do |key, value|\n if value < min\n min = value\n min_key = key\n end\n end\n min_key\nend",
"def key_for_min_value(hash)\n if hash.empty?\n return nil\n end\n ans = [hash.first[0],hash.first[1]]\n hash.each do |k,v|\n if v < ans[1]\n ans[1] = v\n ans[0] = k\n end\n end\n return ans[0]\nend",
"def key_for_min_value(hash)\n key = nil\n lowest_value = nil\n hash.each do |name, value|\n if lowest_value == nil || value < lowest_value\n lowest_value = value\n key = name\n end\nend\nkey\nend",
"def key_for_min_value(hash)\n hash_key = nil\n hash_value = nil\n hash.each do |a, b|\n if hash_value == nil || b < hash_value\n hash_value = b\n hash_key = a\n end\n end\n hash_key\nend",
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil \n hash.each do |key, value|\n if lowest_value == nil || value < lowest_value \n lowest_value = value \n lowest_key = key \n end\n end\n lowest_key\nend",
"def key_for_min_value(name_hash)\n lowestnum = 1000\n name_hash.each_value do |hashvalue|\n if hashvalue < lowestnum\n lowestnum = hashvalue\n end\n end\n name_hash.index(lowestnum)\nend",
"def key_for_min_value(name_hash)\n lowest_key = nil\n lowest_number = nil\n name_hash.each do |name, number|\n if lowest_number == nil || number < lowest_number\n lowest_number = number\n lowest_key = name\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil\n hash.each do |k,v|\n # first iteration\n ## this creates a starting point for comparison\n if lowest_value == nil || lowest_value > v\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\nend",
"def key_for_min_value(name_hash)\n low = Float::INFINITY\n name_hash.each do |k,v|\n if v < low\n low = v\n end\n end\n name_hash.key(low)\nend",
"def key_for_min_value(hash)\n small_key = nil\n small_value = nil\n \n hash.each do |key, value|\n if small_value == nil || value < small_value\n small_value = value\n small_key = key\n end\nend\nsmall_key\nend",
"def key_for_min_value(hash)\n low_min = 1000\n min_key = nil\n hash.each do |key, value|\n if(low_min > value)\n low_min = value\n min_key = key\n end\nend\n min_key\nend",
"def key_for_min_value(name_hash)\n lowest = nil\n key = nil\n if name_hash.length == 0\n return \n end\n \n name_hash.each do |name, number|\n if lowest == nil\n lowest = number\n end\n if key == nil\n key = name\n end\n if number < lowest\n lowest = number\n key = name\n end\n end\n key\nend",
"def key_for_min_value(hash)\n least_value = nil \n least_key = nil\n hash.each do |a, b|\n if least_value == nil || b < least_value\n least_value = b\n least_key = a\n end\n end\n least_key\nend",
"def key_for_min_value(name_hash)\n\tif name_hash == {}\n\t\tnil\n\tend\n\n\tsmallest_key = nil\n\tsmallest_value = nil\n\tname_hash.each do |key, value|\n\t\tif !smallest_value || value < smallest_value\n\t\t\tsmallest_key = key\n\t\t\tsmallest_value = value\n\t\tend\n\tend\n\tsmallest_key\nend",
"def key_for_min_value(hash)\n i = 0\n lowest1 = :key\n lowest = 0\n if hash.empty? == true \n return nil\n end\n hash.each do |name, value|\n if i == 0\n lowest1 = name\n lowest = value\n i =+ 1\n end\n if value < lowest\n lowest1 = name\n lowest = value\n end\n if hash.empty? == true \n lowest1 = nil\n end\n end\n lowest1\nend",
"def key_for_min_value(name_hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n name_hash.each do |name, amount|\n if amount < lowest_value\n lowest_value = amount\n lowest_key = name\n end\n end\n lowest_key\n end",
"def key_for_min_value(hash)\n lo_key = nil \n lo_value = nil \n hash.each do |k,v| \n if lo_key == nil || v < lo_value\n lo_key = k \n lo_value = v \n end \n end \n lo_key\n end",
"def key_for_min_value(hash)\n\n lowest_key = nil \n lowest_value = nil \n \n hash.each do |key,value|\n if lowest_value == nil || lowest_value > value\n\n lowest_key = key\n lowest_value = value \n end \n \n end \n lowest_key\nend",
"def key_for_min_value(name_hash)\n small_num = Float::INFINITY\n smallest_key = \"\"\n if name_hash.length == 0\n return nil\n end\n name_hash.each do |key, value|\n if value < small_num\n small_num = value\n smallest_key = key\n end\n end\nsmallest_key\nend",
"def key_for_min_value(hash)\n value_only_array = []\n hash.each_pair do |key, value|\n value_only_array << value\n end\n value_only_array.sort!\n hash.key(value_only_array[0])\nend",
"def key_for_min_value(hash)\n return nil if hash.empty?\n arr = hash.collect {|key, value| value}.sort\n hash.each {|key, value| return key if value == arr[0]}\nend",
"def key_for_min_value(hash)\n array = []\n hash.each do |key, value|\n array << value\n end\n array.sort!\n hash.key(array[0])\nend",
"def key_for_min_value(name_hash)\n lowest_key=nil\n lowest_value=Float::INFINITY\n name_hash.each{|key, value| \n if value<lowest_value\n lowest_value=value\n lowest_key=key\n end\n }\n lowest_key\nend",
"def key_for_min_value(name_hash)\n empty_hash = nil\n lowest_value = 10000000000000000000000\n name_hash.collect do |name, value|\n if value < lowest_value\n lowest_value = value\n empty_hash = name\n end\n end\n empty_hash\nend",
"def key_for_min_value(name_hash)\n lowest = \"\"\n lowest = nil if name_hash.empty?\n high_num = 100000000000000000\n name_hash.each do | key, value |\n lowest = key if value < high_num\n high_num = value if value < high_num\n end\n lowest\nend",
"def key_for_min_value(name_hash)\n lowest_key = nil\n lowest_value = nil\n name_hash.each do |name, num|\n if lowest_key == nil || num < lowest_value\n lowest_key = name\n lowest_value = num\n elsif name_hash == nil\n nil\n end\n end\n lowest_key\nend",
"def key_for_min_value(name_hash)\n num = nil\n name_hash.collect do |key, value|\n if value < num\n num = value\n end\n end \n name_hash.key(num)\nend",
"def key_for_min_value(name_hash)\n smallest_val = 0\n smallest_key = nil\n name_hash.each do|key, val|\n if smallest_val == 0 || val < smallest_val\n smallest_val = val\n smallest_key = key\n end\n end\n smallest_key\n\nend",
"def key_for_min_value(name_hash)\n smallest_hash_key = nil\n name_hash.each do |key, val|\n if smallest_hash_key == nil\n smallest_hash_key = key\n next\n elsif val < name_hash[smallest_hash_key]\n smallest_hash_key = key\n end\n end\n smallest_hash_key\nend",
"def key_for_min_value(hash)\n if hash.count < 2\n return hash[0]\n else \n num = 42\n hash.each do |key, value|\n if value <= num\n num = value\n end\n end\n hash.invert[num] \n end\nend",
"def key_for_min_value(name_hash)\n return nil if name_hash.empty?\n lowest_number = name_hash.first[1];\n key_value = \"\"\n name_hash.each do |key, value|\n if value <= lowest_number\n lowest_number = value\n key_value = key\n end\n end\n key_value\nend",
"def key_for_min_value(name_hash)\n current = 0\n lowest = 0\n lowest_key = nil\n name_hash.collect do |key, value|\n current = value\n if current < lowest || lowest == 0\n lowest = current\n lowest_key = key\n end\n\n end\n lowest_key\nend",
"def key_for_min_value(name_hash)\n lowest_key = nil\n lowestvalue = 1000\n name_hash.each do |name, value|\n if value < lowestvalue\n lowest_key = name\n lowestvalue = value\n end\n end\n lowest_key\nend",
"def key_for_min_value(name_hash)\n small_value = 10000000000\n small_key = nil\n name_hash.each do |k,v|\n if v < small_value\n small_value = v\n small_key = k\n end\n end\n small_key\nend",
"def key_for_min_value(name_hash)\n low_key = nil\n low_value = nil\n name_hash.each do |k, v|\n if low_value == nil || v < low_value\n low_value = v\n low_key = k\n end\n end\n low_key\n end",
"def key_for_min_value(hash)\n lowest_value = nil\n lowest_key = nil\n\n hash.each do |key, value|\n if lowest_value == nil # tell me if this makes sense\n lowest_value = value\n lowest_key = key\n elsif lowest_value > value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key #you want to return the key for min\nend",
"def key_for_min_value(hash)\n \n if hash.empty?\n return nil\n end\n min_value=500\n min_key=:symbol\n \n hash.each do |key, value|\n if value<min_value\n min_value=value\n min_key=key\n end\n end\n return min_key\nend",
"def key_for_min_value(name_hash)\n lowestKey = nil\n lowestValue = Float::INFINITY\n name_hash.each do |k, v|\n if v < lowestValue\n lowestValue = v\n lowestKey = k\n end\n end\n lowestKey\n\nend",
"def key_for_min_value(name_hash)\n smallest_val = 0\n smallest_key = 0\n comp = nil\n name_hash.each do |key,val|\n comp = val\n if smallest_key == 0\n smallest_key = key\n smallest_val = val\n end \n if comp < smallest_val\n smallest_val = comp\n smallest_key = key\n end\n end\n if smallest_key == 0 \n return nil \n else\n return smallest_key\n end\nend",
"def key_for_min_value(name_hash)\n lowest_key=nil\n lowest_val=0\n name_hash.collect do |key,value|\n if value<lowest_val or lowest_val==0\n lowest_key=key\n lowest_val=value\n end\n end\n lowest_key\nend",
"def key_for_min_value(name_hash)\n smallest = nil\n this_num = 0\n previous_num = 1000000\n name_hash.collect { |item, qty|\n this_num = qty\n if this_num < previous_num\n smallest = item\n previous_num = this_num\n end\n }\n smallest\nend",
"def key_for_min_value(name_hash)\n rkey = nil\n rvalue = 10000000000000000\n name_hash.each do |key, value|\n if value < rvalue\n rkey = key\n rvalue = value\n end\n end\n rkey\nend",
"def key_for_min_value(name_hash)\n\tsmallest_value = nil\n\tassociated_key = nil \n\tname_hash.collect do |key, value|\n\t\tif smallest_value == nil || value < smallest_value\n\t\t\tsmallest_value = value \n\t\t\tassociated_key = key\n\t \tend\n\tend\n\tassociated_key\nend",
"def key_for_min_value(hash)\n # binding.pry\n lowest_key = nil\n lowest_value = 0\n # binding.pry\n hash.each do |key, value|\n if lowest_key == nil || value < lowest_value\n # binding.pry\n lowest_value = value\n lowest_key = key\n # binding.pry\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n hash.key(hash.values.min)\nend",
"def key_for_min_value(hash)\n hash.key(hash.values.min)\nend",
"def key_for_min_value(name_hash)\n smallest_value = 100\n name_hash.each do |key, value| \n if value < smallest_value\n smallest_value = value \n end \n end\n name_hash.key(smallest_value)\nend",
"def key_for_min_value(name_hash)\n lowest=\"\"\n lowest=nil if name_hash.empty?\n tracker=100000000\n name_hash.each do |key,value|\n lowest=key if value<tracker\n tracker=value if value<tracker\n # if value<tracker\n end\n lowest\nend",
"def key_for_min_value(name_hash)\n if name_hash.length == 0 \n nil\n else\n smallest_num = nil\n smallest_num_key = nil\n name_hash.collect do |key, value|\n if smallest_num == nil\n smallest_num = value\n smallest_num_key = key\n elsif smallest_num > value\n smallest_num = value\n smallest_num_key = key\n end\n end\n smallest_num_key\n end\n\nend",
"def key_for_min_value(name_hash)\n low_key = nil\n low_value = nil\n name_hash.each do |n, s|\n if low_value == nil\n low_value = s\n low_key = n\n elsif low_value > s\n low_value = s\n low_key = n\n end\n end\n low_key\nend",
"def key_for_min_value(name_hash)\n return nil if name_hash == nil || name_hash == {}\n number_array = name_hash.collect do |name, number|\n number\n end\n number_array.sort!\n name_hash.key(number_array[0])\nend",
"def key_for_min_value(name_hash)\n lowestId = nil\n lowestNum = 0\n name_hash.each{ |id, val|\n if lowestNum == 0 \n lowestNum = val\n end\n if val <= lowestNum\n lowestNum = val\n lowestId = id\n end\n }\n return lowestId\nend",
"def key_for_min_value(name_hash)\n lowest_v = nil\n lowest_k = nil\n name_hash.each do |name, value|\n if lowest_v == nil\n lowest_v = value\n lowest_k = name\n elsif value < lowest_v\n lowest_v = value\n lowest_k = name\n end\n end\n lowest_k\n end",
"def key_for_min_value(name_hash)\n smallest_key = nil\n smallest_value = nil\n name_hash.each do |j, r|\n if smallest_value == nil || r < smallest_value\n smallest_value = r\n smallest_key = j\n end\n end\n smallest_key\nend",
"def key_for_min_value(name_hash)\nlowest = 1000000\n low_key = nil\n name_hash.each {|key, value|\n if value < lowest\n lowest = value\n low_key = key\n end\n }\n low_key\nend",
"def key_for_min_value(name_hash)\n lowest_key = nil\n name_hash.each_key do |key|\n if lowest_key == nil\n lowest_key = key\n elsif name_hash[key] < name_hash[lowest_key]\n lowest_key = key\n end\n end\n lowest_key\nend",
"def key_for_min_value(name_hash)\n\n if name_hash.empty?\n return nil\n end\n lowest = Float::INFINITY\n name_hash.each_pair do |k, v|\n if v < lowest\n lowest = v\n end\n end\n name_hash.each_pair do |k, v|\n if v == lowest\n return k\n end\n end\nend",
"def key_for_min_value(name_hash)\n output = 0\n smallest = nil\n name_hash.map do |key, value|\n if value < output || output == 0\n output = value\n smallest = key\n end\n end\n\n smallest\nend",
"def key_for_min_value(my_hash)\n #what is my value?\n lowest_value = 500\n lowest_key = nil\n\n my_hash.collect do |key, value|\n # what is my value?\n if value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend",
"def key_for_min_value(name_hash)\n lowest_num = 1000000000\n lowest_num_key = \" \"\n if name_hash == {}\n return nil\n else\n name_hash.each do |name, num|\n if num < lowest_num\n lowest_num = num\n lowest_num_key = name\n end\n end\n return lowest_num_key\n end\nend",
"def key_for_min_value(name_hash)\n nums = name_hash.collect do |item, num|\n num\n end\n nums.sort!\n nums[0]\n \n min_key = nil\n name_hash.map do |item, num|\n if num == nums[0]\n min_key = item\n end\n end\n min_key\nend",
"def key_for_min_value(name_hash)\n vals = name_hash.collect { |key, value| value }\n keys = name_hash.collect { |key, value| key }\n low = vals[0]\n lowkey = keys[0]\n if name_hash.empty?\n nil\n else\n name_hash.collect do |key, value|\n if value < low\n low = value\n lowkey = key\n end\n end\n lowkey\n end\nend",
"def key_for_min_value(name_hash)\n value1 = 0\n lowestKey = nil\n name_hash.each do |key, value|\n if(value1 == 0)\n value1 = value\n lowestKey = key\n end\n if(value1 > value)\n value1 = value\n lowestKey = key\n elsif (value1 < value)\n lowestKey = lowestKey\n value1 = value1\n end\n end\n return lowestKey\nend",
"def key_for_min_value(hash)\n return nil if hash.empty?\n arr = hash.collect { |k, v| v }.sort\n hash.each { |k, v| return k if v == arr[0] }\nend",
"def key_for_min_value(name_hash)\n # saves the smaller value in memo, and takes the first elem of memo at the end (the key)\n smallest = name_hash.inject do|memo, (k, v)|\n memo = v < memo[1] ? [k,v] : memo\n end\n #handle the empty hash case...\n smallest ? smallest[0] : nil\nend",
"def key_for_min_value(name_hash)\n key = \"\"\n low_value = nil\n if name_hash.empty? == true\n return nil\n end\n name_hash.each do |name, number|\n if low_value == nil || number < low_value\n low_value = number\n key = name\n end\n end\n key\nend",
"def key_for_min_value(name_hash)\n answer = nil\n smallest = nil\n name_hash.each {|key, value|\n if smallest.nil?\n smallest = value\n end\n if value <= smallest\n smallest = value\n answer = key\n end\n }\n answer\nend",
"def smallest_key(q, hash)\n\t\ttemp = {}\n\t\tq.each do |v|\n\t\t\ttemp[v] = hash[v]\n\t\tend\n\t\treturn temp.key(temp.each_value.min)\n\tend",
"def key_for_min_value(name_hash)\n lowest_value = 0\n lowest_key = \"\"\n if name_hash.empty? == true\n nil\n else\n name_hash.each_with_index do |(key, value), i|\n if i == 0\n lowest_value = value\n lowest_key = key\n elsif value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\n end\nend",
"def key_for_min_value(name_hash)\n low=10000000000000000000\n return_key=nil\n name_hash.each do |key, value|\n if value<low\n low=value\n return_key=key\n end\n end\n return_key\nend",
"def key_for_min_value(hash)\n if hash.length == 0\n return nil\n else\n smallest = 1000\n printme = \"\"\n hash.each do |thing, number|\n if number < smallest\n smallest = number\n printme = thing\n end\n end\n printme\n end\nend",
"def key_for_min_value(name_hash)\n \n lowest_key = nil\n lowest_value = nil\n name_hash.each do |name_key, name_value|\n if lowest_value == nil || name_value < lowest_value\n lowest_value = name_value\n lowest_key = name_key\n end\n end\n lowest_key\n \n end",
"def key_for_min_value(name_hash)\n the_key = nil \n the_value = 1/0.0\n # Infinity...can also be expressed as FLOAT::Infinity\n name_hash.each do |id, num|\n if num <= the_value\n the_value = num\n the_key = id\n end\n end\n the_key\nend",
"def key_for_min_value(hash)\n array = []\n hash.each {|key,value| \n if array.empty? || value < array[1] \n array[0] = key \n array[1] = value \n end }\n if !array.empty? \n array.first \n else \n nil \n end\nend",
"def key_for_min_value(name_hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n name_hash.each do |k,v|\n if v < lowest_value\n lowest_value = v\n lowest_key = k\n end \nend\nlowest_key\nend",
"def key_for_min_value(name_hash)\n return nil if name_hash == {}\n smallest_key = name_hash.first[0]\n smallest_val = name_hash.first[1]\n\n name_hash.each do |pair|\n if pair[1] < smallest_val\n smallest_key = pair[0]\n end\n end\n smallest_key\nend",
"def key_for_min_value(name_hash)\n key_of_smallest_value = \"\"\n smallest_value = 99999\n name_hash.each do |key, value|\n if smallest_value > value\n smallest_value = value\n key_of_smallest_value = key\n end\n end\n if name_hash.size == 0\n key_of_smallest_value = nil\n end\n key_of_smallest_value\nend",
"def key_for_min_value(name_hash)\n smallest_value = Float::INFINITY\n key_for_smallest_val = nil\n name_hash.each do |key, value|\n if smallest_value > value\n smallest_value = value\n key_for_smallest_val = key\n end \n end \n key_for_smallest_val\nend",
"def key_for_min_value(name_hash)\n minKey = nil\n minVal = 2 ** (64 - 2) - 1\n name_hash.each {|key, value|\n if value < minVal\n minVal = value\n minKey = key\n end}\n minKey\nend",
"def key_for_min_value(name_hash)\n if name_hash == {}\n return nil\n end\n lowest_number = nil\n name_hash.collect do |name, value|\n if lowest_number == nil\n lowest_number = value\n elsif lowest_number > value\n lowest_number = value\n end\n end\n \n name_hash.each do |name, value|\n if lowest_number == value\n return name\n end\n end\nend",
"def key_for_min_value(hash)\n min_value = hash.values.min\n keys = hash.collect do |key, num|\n \tkey if num == min_value\n end\n keys\nend",
"def key_for_min_value(name_hash)\n lowest_value = nil\n key_value = nil\n name_hash.collect do |name, number|\n if lowest_value == nil || number < lowest_value\n lowest_value = number\n key_value = name\n end\n end\n key_value\nend",
"def key_for_min_value(name_hash)\n smallest_value = 1/0.0\n key_of_smallest_value = nil\n name_hash.each do |key, value|\n if smallest_value > value\n key_of_smallest_value = key\n smallest_value = value\n end\n end\n return key_of_smallest_value\nend"
] | [
"0.8821222",
"0.8777674",
"0.87769854",
"0.8745862",
"0.8689437",
"0.86553806",
"0.865241",
"0.86165065",
"0.8587693",
"0.8572328",
"0.85674095",
"0.8550907",
"0.8529734",
"0.8529734",
"0.85182345",
"0.84936565",
"0.8475531",
"0.8475531",
"0.8466132",
"0.8449126",
"0.84490585",
"0.84359556",
"0.84328413",
"0.8430745",
"0.8428166",
"0.84090126",
"0.8388222",
"0.83684903",
"0.83568215",
"0.83524764",
"0.8345625",
"0.8343887",
"0.8328773",
"0.83284044",
"0.83269894",
"0.83253354",
"0.83201903",
"0.83164364",
"0.8312503",
"0.8312319",
"0.8304851",
"0.83014053",
"0.83008987",
"0.82917446",
"0.8288315",
"0.82870966",
"0.8274123",
"0.82674986",
"0.8267187",
"0.82527804",
"0.8250538",
"0.82443976",
"0.82439804",
"0.8243696",
"0.82416916",
"0.8240566",
"0.823854",
"0.82375354",
"0.82283455",
"0.82274485",
"0.82205135",
"0.82190055",
"0.82136935",
"0.82136935",
"0.82102376",
"0.82101446",
"0.82060164",
"0.8200657",
"0.81985617",
"0.81966525",
"0.81958514",
"0.81932545",
"0.81874573",
"0.8186549",
"0.8185174",
"0.8183619",
"0.8183068",
"0.8182941",
"0.8179895",
"0.8173536",
"0.81732464",
"0.8172825",
"0.81721044",
"0.8171692",
"0.81681263",
"0.8165602",
"0.81609225",
"0.8160289",
"0.81587887",
"0.815757",
"0.8154019",
"0.81534094",
"0.8152752",
"0.81524456",
"0.8151455",
"0.81511825",
"0.8151019",
"0.8146792",
"0.814368",
"0.8142542",
"0.81412685"
] | 0.0 | -1 |
Intend to be called by UI to display stdout. The stdout is stored in MiqTasktask_results or message if error Since the task_results may contain a large block of data, it is desired to remove the task upon receiving the data | def raw_stdout_via_worker(userid, format = 'txt')
unless MiqRegion.my_region.role_active?("embedded_ansible")
msg = "Cannot get standard output of this playbook because the embedded Ansible role is not enabled"
return MiqTask.create(
:name => 'ansible_stdout',
:userid => userid || 'system',
:state => MiqTask::STATE_FINISHED,
:status => MiqTask::STATUS_ERROR,
:message => msg
).id
end
options = {:userid => userid || 'system', :action => 'ansible_stdout'}
queue_options = {
:class_name => self.class,
:method_name => 'raw_stdout',
:instance_id => id,
:args => [format],
:priority => MiqQueue::HIGH_PRIORITY,
:role => nil
}
MiqTask.generic_action_with_callback(options, queue_options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def console_after_task\n miq_task = MiqTask.find(params[:task_id])\n unless miq_task.results_ready?\n add_flash(_(\"Console access failed: %{message}\") % {:message => miq_task.message}, :error)\n javascript_flash(:spinner_off => true)\n return\n end\n\n resource_type = miq_task.task_results.type\n\n if resource_type == :url\n url = miq_task.task_results.resource\n javascript_open_window(url)\n elsif resource_type == :java_jnlp_file\n render :update do |page|\n page << javascript_prologue\n page << set_spinner_off\n page.redirect_to(:controller => \"physical_server\",\n :action => \"console_file\",\n :task_id => params[:task_id],\n :org_controller => \"physical_server\",\n :escape => false)\n end\n else\n add_flash(_(\"Console access failed: Unexpected remote console resource type [%{type}]\") %\n {:type => resource_type}, :error)\n javascript_flash(:spinner_off => true)\n end\n end",
"def clean_exit\n\ttasks_passed = all_by_exit_status(@task_data['test_exit_status_passed'])\n\ttasks_failed = all_by_exit_status(@task_data['test_exit_status_failed'])\n\ttasks_skipped = all_by_exit_status(@task_data['test_exit_status_skipped'])\n @task_data.merge!({'execution_time' => @chain.execution_time, 'tasks_passed' => tasks_passed, 'tasks_failed' => tasks_failed, 'tasks_skipped' => tasks_skipped})\n \n\tPublisher.new(@task_data).publish_reports\t \n\t\n if tasks_failed.length == 0\n\t\tputs \"[TCRESULT]=SUCCESSFUL\\n\"\n\telse\n\t\tputs \"[TCRESULT]=UNSUCCESSUL\\n\"\n\tend\n\t\n\tputs(\"\\n==> DONE\\n\\n\")\n puts(\"[ :: [SESSION]\\n\")\n puts(\"[TC] -- tests passed : #{tasks_passed.length.to_s}\\n\")\n puts(\"[TC] -- tests failed : #{tasks_failed.length.to_s}\\n\")\n puts(\"[TC] -- tests executed : #{@chain.executed_tasks.to_s}\\n\")\n puts(\"[TC] -- tests skipped : #{tasks_skipped.length.to_s}\\n\") \n puts(\"[TC] -- execution time : #{@chain.execution_time.to_s} secs\\n\")\t\n\tputs(\" -- reports prepared: #{@reports_dir}\\n\")\n puts(\" -- logs prepared : #{@logs_dir}\\n\")\n\t\n\tputs(\"[TC] The test run contained the following tasks :\\n\")\n\t@chain.get_tasknames.each do |taskname|\n\t\tputs(\"[TC] -> #{taskname}\\n\")\t\n\tend\n\t\t\n\tif @task_data['test_retry']\n\t\tputs(\" -- tests re-tried : #{@tests_retried_counter.to_s}\\n\")\n\tend\n\tif tasks_failed.length > 0\n\t\tputs(\"\\n\\n==> STATUS: [ some tests failed - execution failed ]\\n\")\n\t\texit(1)\n\tend\n\texit(0)\nend",
"def summarytext\n File.open(\"/tmp/tmp.#{$$}\", 'w') {|f| f.write(printmailq(mailq)) }\n\n out = %x[/bin/cat /tmp/tmp.#{$$} | /usr/sbin/exiqsumm]\n\n File.unlink(\"/tmp/tmp.#{$$}\")\n\n out\n end",
"def end_of_task (var)\n #this clears the console\n puts \"\\e[H\\e[2J\"\n #advance steps by 1, for logging \\ sanity\n return (var+1)\nend",
"def output(non_block=false)\n @outputQueue.pop(non_block) \n end",
"def enqueue_pending_output; end",
"def clean_exit\n\ttasks_passed = all_by_exit_status(@task_data['test_exit_status_passed'])\n\ttasks_failed = all_by_exit_status(@task_data['test_exit_status_failed'])\n\ttasks_skipped = all_by_exit_status(@task_data['test_exit_status_skipped'])\n\ttasks_error \t = all_by_exit_status(@task_data['test_exit_status_error'])\n\tnoelement_error\t = all_by_exit_status(@task_data['test_exit_status_noelement'])\n @task_data.merge!({'execution_time' => @taskchain.execution_time, 'tasks_passed' => tasks_passed, 'tasks_failed' => tasks_failed, 'tasks_skipped' => tasks_skipped, 'tasks_error' => tasks_error, 'test_exit_status_noelement' => noelement_error })\n \n\tPublisher.new(@task_data).publish_reports\t \n\t\n\tputs(\"\\n==> DONE\\n\\n\")\n puts(\"[ ::\\n\")\n puts(\"[ :: [SESSION]\\n\")\n\tputs(\"[ ::\\n\")\n\t# Team City Result\n @teamcity_result = tasks_failed.length == 0 && tasks_error.length == 0 && noelement_error.length == 0 ? \"[TCRESULT]=SUCCESSFUL\\n\" : \"[TCRESULT]=UNSUCCESSFUL\\n\"\n\tputs @teamcity_result\n\tputs(\"[ ::\\n\")\n\t\n\tputs(\"[TC] Target BIZ File : [#{@neo_bizfile}]\")\n printf(\"%-27s %s\\n\",\"[TC] -- tests passed:\", tasks_passed.length.to_s)\n printf(\"%-27s %s\\n\",\"[TC] -- tests failed:\", tasks_failed.length.to_s)\n printf(\"%-27s %s\\n\",\"[TC] -- tests executed:\",@taskchain.executed_tasks.to_s)\n printf(\"%-27s %s\\n\",\"[TC] -- tests skipped:\", tasks_skipped.length.to_s)\n printf(\"%-27s %s\\n\",\"[TC] -- tests error:\", tasks_error.length.to_s)\n printf(\"%-27s %s\\n\",\"[TC] -- tests no element:\", noelement_error.length.to_s)\n printf(\"%-27s %.2f %s\\n\",\"[TC] -- execution time:\", @taskchain.execution_time, \"secs\")\n\tprintf(\" -- reports prepared \\t: #{ENV[\"reports\"]}\\n\")\n printf(\" -- logs prepared \\t: #{ENV[\"LOGS\"]}\\n\")\n\t\n\tputs(\"[TC] Tasklist :\\n\")\t\t\n\t@taskchain.taskchain_array.each do |task|\n\t\tputs(\"[TC] \\t{#{task.taskname}}\\n\")\t\t\t\n\t\ttask.examples.each do |ex|\n\t\t\tputs(\"[TC] \\t\\t[#{ex} ]\\n\")\n\t\tend\n\tend\n\n\tif tasks_error.length > 0\n\t\tputs(\"\\n\\n==> STATUS: [ some tests failed - execution failed ]\\n\")\n\t\texit(1)\n\telse\n\t\texit(0)\n\tend\nend",
"def raw_stdout_via_worker(userid, format = 'txt', role = nil)\n options = {:userid => userid || 'system', :action => 'ansible_stdout'}\n queue_options = {\n :class_name => self.class,\n :method_name => 'raw_stdout',\n :instance_id => id,\n :args => [format],\n :priority => MiqQueue::HIGH_PRIORITY,\n :role => role\n }\n\n MiqTask.generic_action_with_callback(options, queue_options)\n end",
"def clear()\n @result = \"\"\n @queue.clear\n @pipeline.pause\n end",
"def runCmd\n puts \" Deployed and running #{@request.data['command']} #{@request.data['arguments']}\".light_green\n print ' STDOUT'.light_cyan + ' and' + ' STDERR'.light_magenta + \":\\n\"\n\n # offset (place saving) variables\n @stdoutOffset = 0\n @stderrOffset = 0\n begin\n # get most recent task state\n # need to wait for \"task_running\" before we can ask for STDOUT/STDERR\n @taskState = JSON.parse(RestClient.get \"#{@uri}/api/history/task/#{@thisTask['taskId']['id']}\")\n @taskState[\"taskUpdates\"].each do |update|\n @taskState = update['taskState']\n end\n if @taskState == \"TASK_FAILED\"\n return 1 # failure\n end\n if @taskState == \"TASK_RUNNING\"\n sleep 1\n # print stdout\n @stdout = JSON.parse(RestClient.get \"#{@uri}/api/sandbox/#{@thisTask['taskId']['id']}/read\", {params: {path: \"stdout\", length: 30000, offset: @stdoutOffset}})['data']\n outLength = @stdout.bytes.to_a.size\n if @stdout.length > 0\n print @stdout.light_cyan\n @stdoutOffset += outLength\n end\n # print stderr\n @stderr = JSON.parse(RestClient.get \"#{@uri}/api/sandbox/#{@thisTask['taskId']['id']}/read\", {params: {path: \"stderr\", length: 30000, offset: @stderrOffset}})['data']\n errLength = @stderr.bytes.to_a.size\n if @stderr.length > 0\n print @stderr.light_magenta\n @stderrOffset += errLength\n end\n end\n end until @taskState == \"TASK_FINISHED\"\n\n return 0 # success\n end",
"def process_result(msg, success)\n @results_string += \"%-70s\" % msg \n @results_string += \": \" + (success ? \"Success\" : \"Failed\") + \"\\n\"\n @results.push(success)\nend",
"def remove_in_progress_task\n $redis.del(\"#{studio.studio_id}:#{ip}\")\n end",
"def clear()\n \t\t@result = \"\"\n \t\t@queue.clear\n \t\t#@pipeline.pause\n \tend",
"def print_task_summary(taskid, names, callers, completed, running, task_not_known, wrapper_failure, success, fails, runtime, rpcstats)\n if callers.size > 1 || names.size > 1\n out.puts\n out.puts(\"%s received more than 1 task name or caller name for this task, this should not happen\" % Util.colorize(:red, \"WARNING\"))\n out.puts(\"happen in normal operations and might indicate forged requests were made or cache corruption.\")\n out.puts\n end\n\n out.puts(\"Summary for task %s\" % [Util.colorize(:bold, taskid)])\n out.puts\n out.puts(\" Task Name: %s\" % names.join(\",\"))\n out.puts(\" Caller: %s\" % callers.join(\",\"))\n out.puts(\" Completed: %s\" % (completed > 0 ? Util.colorize(:green, completed) : Util.colorize(:yellow, completed)))\n out.puts(\" Running: %s\" % (running > 0 ? Util.colorize(:yellow, running) : Util.colorize(:green, running)))\n out.puts(\" Unknown Task: %s\" % Util.colorize(:red, task_not_known)) if task_not_known > 0\n out.puts(\" Wrapper Failure: %s\" % Util.colorize(:red, wrapper_failure)) if wrapper_failure > 0\n out.puts\n out.puts(\" Successful: %s\" % (success > 0 ? Util.colorize(:green, success) : Util.colorize(:red, success)))\n out.puts(\" Failed: %s\" % (fails > 0 ? Util.colorize(:red, fails) : fails))\n out.puts\n out.puts(\" Average Run Time: %.2fs\" % [runtime / (running + completed)])\n\n if rpcstats.noresponsefrom.empty?\n out.puts\n out.puts rpcstats.no_response_report\n end\n\n if running > 0\n out.puts\n out.puts(\"%s nodes are still running, use 'mco tasks status %s' to check on them later\" % [Util.colorize(:bold, running), taskid])\n end\n end",
"def clear_progress\n return unless show_progress\n print_no_newline(\"\\e[?25h\\e[2K\")\n @progress_msg = nil\n end",
"def flush_output\n if @pending_output != \"\"\n add_prompt\n connection.send_data @pending_output\n clear_output\n end\n end",
"def done\n @out.puts \"\\n#{@terminal_message}\"\n end",
"def clean_exit\n\ttasks_passed\n tests_passed = all_by_exit_status(@task_config['test_exit_status_passed'])\n tests_failed = all_by_exit_status(@task_config['test_exit_status_failed'])\n tests_skipped = all_by_exit_status(@task_config['test_exit_status_skipped'])\n testcases_total = all_testcase_in_tests\n testcases_passed = all_passing_testcase_in_tests\n verifications = all_verifications_in_tests\n verifications_passed = all_passed_verifications_in_tests\n \n @task_config.merge!({'execution_time' => @execution_time, 'tests_passed' => tests_passed, 'tests_failed' => tests_failed, 'tests_skipped' => tests_skipped, 'testcases_total' => testcases_total, 'testcases_passed' => testcases_passed, 'verifications' => verifications, 'verifications_passed' => verifications_passed})\n \n\t \n\t #Publisher.new(@task_config).publish_reports\n \n\t \n\t \n\t puts(\"\\n==> DONE\\n\\n\")\n puts(\":: [SESSION]\\n\")\n puts(\" -- reports prepared: #{@task_config['reports_dir']}\\n\")\n puts(\" -- execution time : #{@execution_time.to_s} secs\\n\")\n puts(\" -- tests executed : #{@executed_tests.to_s}\\n\")\n puts(\" -- tests passed : #{tests_passed.length.to_s}\\n\")\n puts(\" -- tests failed : #{tests_failed.length.to_s}\\n\")\n puts(\" -- tests skipped : #{tests_skipped.length.to_s}\\n\")\n puts(\" -- cases total : #{testcases_total.to_s}\\n\")\n puts(\" -- cases passed : #{testcases_passed.to_s}\\n\")\n puts(\" -- verifications : #{verifications.to_s}\\n\")\n puts(\" -- verify passed : #{verifications_passed.to_s}\\n\")\n \n if @task_config['test_retry']\n puts(\" -- tests re-tried : #{@tests_retried_counter.to_s}\\n\")\n end\n if tests_failed.length > 0 || verifications_passed != verifications\n puts(\"\\n\\n==> STATUS: [ some tests failed - execution failed ]\\n\")\n exit(1)\n end\n exit(0)\nend",
"def clear_stdout\n $stdout.string = '' if $stdout.is_a?(StringIO)\n end",
"def finish\n @test_output = @test_output.join.split(\"\\n\")\n @test_description = @test_output.shift\n end",
"def task_observer(time, output, thread_error)\n result = output.is_a?(GoodJob::ExecutionResult) ? output : nil\n\n unhandled_error = thread_error || result&.unhandled_error\n GoodJob._on_thread_error(unhandled_error) if unhandled_error\n\n if unhandled_error || result&.handled_error\n @metrics.increment_errored_executions\n elsif result&.unexecutable\n @metrics.increment_unexecutable_executions\n elsif result\n @metrics.increment_succeeded_executions\n else\n @metrics.increment_empty_executions\n end\n\n instrument(\"finished_job_task\", { result: output, error: thread_error, time: time })\n return unless output\n\n @cleanup_tracker.increment\n if @cleanup_tracker.cleanup?\n cleanup\n else\n create_task\n end\n end",
"def done\n @out.puts @terminal_message\n end",
"def done!(msg=\"\")\n out \"#{msg} (#{self.end!}s)\\n\"\n end",
"def rake_output_message(message)\n $stderr.puts(message)\n end",
"def fatal(task)\n printf('%-30s %20s', \"#{label(task)} \", \"\\e[31mFAILURE\\e[0m\\n\\n\")\n puts task.error_message + \"\\n\"\n end",
"def strip\n result.stdout.strip unless result.stdout.nil?\n end",
"def reset\n logger.debug \"Resetting executer state\"\n @stdout = ''\n @stderr = ''\n @success = nil\n @pid = nil\n end",
"def complete(message, output)\n end",
"def fetch_done(task)\n @fetch_worker_queue.remove_from_input(task)\n @current_connections.delete(task.ip)\n if task.failure\n @node_manager.log_error task.failure, task.http_url.to_s.inspect\n else\n @node_manager.log :success, task.http_url.to_s.inspect\n end\n end",
"def output_result(text)\n email_results ? (result_output << text) : RAILS_ENV!=\"test\"&&puts(text)\n end",
"def stdout\n @cmd_result.stdout\n end",
"def success(delayed_job)\n # Delete the file which has been parsed?\n STDOUT.putc '.'\n STDOUT.flush\n end",
"def output(str)\n str = str.to_s.strip\n str = nil if str && str.length == 0\n str ||= \"Completed (no output)\"\n output = Time.now.strftime(\"%H:%M:%S\") + \" [#{self}] \"\n output << str\n print output + \"\\n\"\n output\n end",
"def clear_stdout\n $stdout.string = ''\n end",
"def taskTerminated(notification)\n # Log that we're ending\n puts(\"taskTerminated: #{@task.processIdentifier}\")\n \n # Release the task\n @task.release\n @task = nil\n \n # Output to UI the time summary\n @time_end = Time.now\n @results.textStorage.mutableString.appendString \"End time: #{@time_end.strftime(\"%H:%M:%S\")}\\n\"\n @results.textStorage.mutableString.appendString \"Duration: #{@time_end - @time_start} seconds\\n\"\n @results.textStorage.mutableString.appendString \"Duration: #{(@time_end - @time_start)/60} minutes\\n\"\n\tend",
"def print_results\n UI.puts results_message\n end",
"def stdout_received(data); end",
"def print_out_line\n #p ['id', id, 'ctd', ctd]\n #p rcp.results.zip(rcp.results.map{|r| send(r)})\n name = @run_name\n name += \" (res: #@restart_id)\" if @restart_id\n name += \" real_id: #@real_id\" if @real_id\n beginning = sprintf(\"%2d:%d %-60s %1s:%2.1f(%s) %3s%1s\", @id, @job_no, name, @status.to_s[0,1], @run_time.to_f / 60.0, @nprocs.to_s, percent_complete, \"%\")\n if ctd and fusionQ\n beginning += sprintf(\"Q:%f, Pfusion:%f MW, Ti0:%f keV, Te0:%f keV, n0:%f x10^20\", fusionQ, pfus, ti0, te0, ne0)\n end\n beginning += \" ---#{@comment}\" if @comment\n beginning\n end",
"def show\n @tasks.each do |project_name, project_tasks|\n @output.puts project_name\n project_tasks.each do |task|\n @output.printf(\" [%c] %d: %s : %s \\n\", (task.done? ? 'x' : ' '), task.id, task.description, task.deadline)\n end\n @output.puts\n end\n end",
"def no_more_jobs\n @output.puts\"</table>\"\n @output.puts\"</body>\"\n @output.puts\"</html>\"\n @output.close\n end",
"def message\n case @remove\n when 'one'\n puts \"There are no emails #{@search_direction} #{@email} found in the queue\"\n when 'all'\n puts \"There are no emails #{@search_direction} #{@domain} found in the queue\"\n end\n end",
"def after_resolution\n output.puts\n end",
"def print_result_metadata(status)\n result = status.results\n\n if [0, 1].include?(result[:statuscode])\n if result[:data][:exitcode] == 0\n out.puts(\" %-40s %s\" % [result[:sender], Util.colorize(:green, result[:data][:exitcode])])\n else\n out.puts(\" %-40s %s\" % [result[:sender], Util.colorize(:red, result[:data][:exitcode])])\n end\n\n out.puts(\" %s by %s at %s\" % [\n Util.colorize(:bold, result[:data][:task]),\n result[:data][:callerid],\n Time.at(result[:data][:start_time]).utc.strftime(\"%F %T\")\n ])\n\n out.puts(\" completed: %s runtime: %s stdout: %s stderr: %s\" % [\n result[:data][:completed] ? Util.colorize(:bold, \"yes\") : Util.colorize(:yellow, \"no\"),\n Util.colorize(:bold, \"%.2f\" % result[:data][:runtime]),\n result[:data][:stdout].empty? ? Util.colorize(:yellow, \"no\") : Util.colorize(:bold, \"yes\"),\n result[:data][:stderr].empty? ? Util.colorize(:bold, \"no\") : Util.colorize(:red, \"yes\")\n ])\n elsif result[:statuscode] == 3\n out.puts(\" %-40s %s\" % [result[:sender], Util.colorize(:yellow, \"Unknown Task\")])\n else\n out.puts(\" %-40s %s\" % [result[:sender], Util.colorize(:yellow, result[:statusmsg])])\n end\n\n out.puts\n end",
"def clear!\n @output = ''\n @verbose = false\n end",
"def clear_progress; end",
"def run_errored_task(broker, targets, task, files, input: {}, metadata: nil)\n run_task(broker, targets, task, files, input: input, metadata: metadata,\n blocking_request: true,\n expected_response_type: \"http://puppetlabs.com/rpc_error_message\") do |response_dataset|\n response_dataset.each { |data| yield data['description'] } if block_given?\n end\nend",
"def external_task\n output[:task]\n end",
"def stdout\n run unless ran?\n\n @stdout\n end",
"def task_out\n if running_task?\n puts \"Stop task: \" + get_last_task_name + \", #{(Time.now.to_i - get_last_task_stime.to_i).duration}\"\n open(TRACK_FILE, \"a\"){|f|\n f.print \"\\t#{Time.now.to_i}\\n\"\n }\n return true\n else\n puts \"There is no task running\"\n return false\n end\n end",
"def print_all_tasks\n tasks = retrieve_tasks\n @values[:result] = Array.new()\n tasks.each_key { |key|\n print_tasks_to_key(tasks[key]) if (tasks[key].size > 0)\n }\n end",
"def print_output(up_result)\n puts \"################# STDOUT #####################\"\n puts up_result.stdout\n puts \"################# STDERR #####################\"\n puts up_result.stderr\n puts \"################# END #####################\"\n end",
"def process\n # start with the original as if it was the last destination\n tasks.each do |t|\n process_task(t)\n end\n close_files\n\n result_details\n end",
"def progress_info\n\n color=\"#AAAAAA\"\n progress=0\n message=\"Log not available.\"\n\n if self.cluster_stdout\n\n color=\"blue\"\n progress=0\n message=\"Execution not started.\"\n\n self.cluster_stdout.each_line do |line| \n if /\\([0-9]* run \\/ [0-9]* fail \\/ [0-9]* done \\/ [0-9]* left\\)/.match(line)\n run = /[0-9]* run/.match(line)[0].to_s.split[0].to_f \n done = /\\/ [0-9]* done/.match(line)[0].to_s.split[1].to_f\n failed = /\\/ [0-9]* fail/.match(line)[0].to_s.split[1].to_f\n left = /\\/ [0-9]* left/.match(line)[0].to_s.split[1].to_f\n progress=100*(run+done+failed)/(run+done+failed+left)\n # set toolbar color \n red=255*(failed)/(failed+done+run)\n blue=255*(run).to_f/(failed+done+run).to_f\n green=128*(done).to_f/(failed+done+run).to_f\n color=\"rgb(#{red.to_i},#{green.to_i},#{blue.to_i})\"\n if progress!= 100 && (\n\t CbrainTask::COMPLETED_STATUS.include?(self.status) ||\n\t CbrainTask::FAILED_STATUS.include?(self.status) ||\n\t self.status == \"Post Processing\" ||\n\t self.status == \"Data Ready\")\n color=\"red\"\n end\n if progress==100\n\t color=\"green\"\n end\n message=\"PSOM tasks: #{run.to_i} run / #{failed.to_i} fail / #{done.to_i} done / #{left.to_i} left\"\n end\n end\n end \n return {:color => color,:percentage => progress, :message => message, :show_percentage => true}\n end",
"def dump_failures(*args)\n lock_output do\n super\n end\n @output.flush\n end",
"def run_exit_tasks!; end",
"def reset_output\n $stdout = StringIO.new\nend",
"def teardown\n reset_stdout\n end",
"def print_out_line\n\t\t\t#p ['id', id, 'ctd', ctd]\n\t\t\t#p rcp.results.zip(rcp.results.map{|r| send(r)})\n\t\t\tname = @run_name\n\t\t\tname += \" (res: #@restart_id)\" if @restart_id\n\t\t\tname += \" real_id: #@real_id\" if @real_id\n\t\t\tbeginning = sprintf(\"%2d:%d %-60s %1s:%2.1f(%s)\", @id, @job_no, name, @status.to_s[0,1], @run_time.to_f / 60.0, @nprocs.to_s)\n\t\t\tif @status == :Incomplete and @completed_timesteps\n\t\t\t\tbeginning += sprintf(\" %d steps \", @completed_timesteps)\n\t\t\telsif @percent_complete\n \t\t\t\tbeginning+=sprintf(\" %3s%1s \", percent_complete, \"%\")\n\t\t\tend\n\t\t\tif ctd\n\t\t\t\t#beginning += sprintf(\"Q:%f, Pfusion:%f MW, Ti0:%f keV, Te0:%f keV, n0:%f x10^20\", fusionQ, pfus, ti0, te0, ne0)\n\t\t\tend\n\t\t\tbeginning += \" ---#{@comment}\" if @comment\n\t\t\tbeginning\n\t\tend",
"def work_received(results)\n # write results to disk\n @@output_file.puts results\n end",
"def progress(msg, nontty_log = T.unsafe(nil)); end",
"def remove(task)\n @complete = true\n end",
"def commandResult\n\t\t\t%x(#{@cmd} 2> /dev/null)\n\t\tend",
"def undisplay\n @queue << \"undisplay\"\n end",
"def cleanup()\n if @task\n LVGL::Hacks::LVTask.delete_task(@task)\n end\n @terminal_widget.cleanup()\n end",
"def clear_output\n @out_notes.clear\n self\n end",
"def clear_stdout!\n @stdout_handler.clear!\n end",
"def file_finished(file_result)\n if file_result.error_count > 0 \n out.print 'x'\n elsif file_result.warning_count > 0\n out.print '*'\n else\n out.print '.'\n end\n end",
"def cancel ; @finished = true ; @buff = '' ; end",
"def exec_block_results(id)\n return nil if @blocks[id][:results].empty?\n \n removes = []\n @blocks[id][:mutex].synchronize do\n results = @blocks[id][:results]\n @blocks[id][:results] = []\n \n results.each do |res|\n removes << res\n @blocks[id][:block].call(res)\n end\n end\n end",
"def display_result(cmd_result)\n result = \"Process: #{cmd_result[\"pid\"]}\\nSTDOUT:\\n#{cmd_result[\"stdout\"]}\\n\"\n result = \"STDERR:\\n #{cmd_result[\"stderr\"]}\\n#{result}\" if cmd_result[\"stderr\"].length > 2\n result += \"#{EXIT_CODE_FAILURE} Command returned: #{cmd_result[\"status\"]}\" if cmd_result[\"status\"] != 0\n result\n end",
"def unrun\n log \"Nothing to do.\"\n end",
"def text_when_done(num, cmd, cntcs) #third argument may be unecessary. not familiar with ruby scope\n\n\tcontacts = cntcs #probably...maybe uneccesary?\n\tsent = false\n\n\trun = `#{cmd}` #really dangerous! I need to find a better way!\n\n\twhile(!sent)\n\t\tsleep 60\n\t\tif (`ps cax | pgrep -i #{cmd}`.nil?)\n\t\t\tip = `dig +short myip.opendns.com @resolver1.opendns.com`.strip()\n\t\t\thost = `hostname`.strip()\n\t\t\tdate = `date +\"%d-%m-%Y %H:%M %Z\"`.strip()\n\t\t\tuser = `echo $USER`.strip()\n\t\t\tphone_index = contacts['phone_numbers'].values.index(num)\n\t\t\tphone = contacts['phone_numbers'].values[contacts[phone_index]]\n\t\t\treceiver = contacts['phone_numbers'].key(phone) \n\t\t\tmessage = \"Hey #{receiver}, the process #{cmd} has finished running on #{host} at #{date}.\\nThis process was run by #{user} from IP address #{ip}.\"\n\n\t\t\t#commence sending message\n\t\t\tsend_req = `curl -X POST http://textbelt.com/text -d number=#{num} -d \"message=#{message}`\n \t\tbody = JSON.parse(send_req.body)\n \t\tbody['success'.freeze]\n\t\tend\n\tend\nend",
"def clear_result; end",
"def finish(_result)\n end",
"def execute_cmd\t\n\t\t#rake_output = toolpath(\"webrobot\") + \"./results/#{@uuid}_stdout.tmp\"\n\t\t@keepstdout = false\n\t\tENV['FILE'] = File.join(File.dirname(__FILE__), \"/home/tasks/\"+@pattern)\n\t\tENV['WR_DEBUG'] = 'on'\n\t\t\n\t\tputs \"BREAK IT OFF\"\n\t\tapp = Rake.application\n\t\tapp.init\n\t\tapp.add_import toolpath(\"webrobot\", @task_data['toolbox_tools'], @task_data['tool_path_lookup'])+\"/webrobot.rake\"\n\t\tapp.load_imports\n\n\t\tputs \"executing WRTask command:: \" + @raketask\n\t\t\n\t\tif @keepstdout \n\t\t\tputs \"Executing rake (STDOUT)\"\n\t\t\tRake.application['for:real'].invoke()\n\t\t\t@output = \"1 example, 0 failures\"\n\t\t\t#@output = \"4 examples, 0 failures\"\n\t\telse \n\t\t\tputs \"Executing rake (STDOUT REDIR)\"\t\t\n\t\t\t\n\t\t\tbegin\n\t\t\t\tredirect_webrobot_stdout{Rake.application[@raketask].invoke() }\n\t\t\trescue\n\t\t\t\tputs \"SHIT BROKE\"\n\t\t\tensure\n\t\t\t\t@output = retrieve_webrobot_log\n\t\t\t\t@exit_status = case @output\n\t\t\t\t\twhen /0 failures/ then @task_data['test_exit_status_passed']\n\t\t\t\t\telse @task_data['test_exit_status_failed']\n\t\t\t\tend\t\n\t\t\t\t@matrix = {}\n\t\t\tend\n\t\tend\t\t\n\t\t\n\tend",
"def hide\n real_stdout = $stdout\n $stdout = StringIO.new\n yield\nensure\n $stdout = real_stdout\nend",
"def task_report\n print \"task #{@name} is #{@state}\"\n case @state\n when 'waiting' ; puts \"\"\n when 'running'\n puts \" and \"+VT100.RED(\"has not completed\")+\" because\"\n @emits.each { |event_name|\n event = @joblist.find(event_name)\n event.report_consumers(@joblist)\n }\n end\n end",
"def last_stdout\n strip_duration(@last_stdout)\n end",
"def print_result( exec, prior = nil )\n line = \"\"\n orig_result_start( exec, line )\n super( exec, prior, line )\n @out << line\n end",
"def end_ievms_task(quiet=true)\n run_command('schtasks.exe /End /TN ievms', quiet)\n end",
"def done\n @task.destroy\n render :text => \"Task Removed!\", :status => 200\n end",
"def build_run_msg(task)\n date = Time.now.strftime(\"%b %d %H:%M:%S\")\n hostname = Socket.gethostname\n username = Etc.getpwuid(Process.uid).name\n \"#{date} #{hostname} #{$$} (#{username}) JOB (#{task})\"\n end",
"def done(command)\n end",
"def print_out_line\n name = @run_name\n name += \" (res: #@restart_id)\" if @restart_id\n name += \" real_id: #@real_id\" if @real_id\n beginning = sprintf(\"%2d:%d %-60s %1s:%2.1f(%s) %3s%1s\", @id, @job_no, name, @status.to_s[0,1], @run_time.to_f / 60.0, @nprocs.to_s, percent_complete, \"%\")\n if ctd\n #beginning += sprintf(\"Q:%f, Pfusion:%f MW, Ti0:%f keV, Te0:%f keV, n0:%f x10^20\", fusionQ, pfus, ti0, te0, ne0)\n end\n beginning += \" ---#{@comment}\" if @comment\n beginning\n end",
"def teardown\n $stdout = @old_stdout\n end",
"def teardown\n $stdout = @old_stdout\n end",
"def teardown\n $stdout = @old_stdout\n end",
"def concat_description\n id = Readline.readline(\"ID of task to concatenate to: \").to_i\n str = Readline.readline(\"Information to concatenate: \").chomp\n ok = ConcatDescription.new(id, str).execute\n puts \"No such issue\" if !ok\n end",
"def print_internal_stats(final=false)\n #\n # Find and print any incompleted jobs\n #\n if final\n task_groups = Message.job_stats.incomplete_jobs.group_by { |jt| jt.message.task.name }\n task_groups.reject! { |k, v| config.lookup_task(k).producer? } # We don't track producers\n avg_defer_times = { }\n task_groups.each_pair do |k,v|\n logger.raw \"#{k}: incompleted jobs (#{v.length}):\"\n v.each do |jt|\n body = jt.message.opaque_obj.dereference\n str = format(\"[%1d:%5d] Sent -- Recevied %s - %s Eval Started -- Completed %s -- %s Thread: %s Msg Body: %s\\n\",\n proc_id, jt.id, jt.fmt(:sent_at), jt.fmt(:received_at), jt.fmt(:eval_started_at), jt.fmt(:eval_completed_at), jt.last_thread, body.to_s)\n logger.raw(str)\n end\n end\n end\n #\n # Compute Average Defer Time by Task\n #\n logger.raw(\"Average defer times by task\\n\\n\")\n avg_defer_times = Message.job_stats.average_defer_times\n lines = avg_defer_times.map { |k,v| format(\"%24s: %3.2f\", k, v) }\n logger.raw(lines.join(\"\\n\"))\n #\n # General global stats\n #\n sent = Message.sent_messages\n recv = Message.received_messages\n line = format(\"Messages sent:recv %5d:%5d Jobs:Queued:Results %5d:%5d:%5d\\n\",\n sent, recv, jobq.size, thpool.job_count, thpool.result_count)\n logger.raw(line)\n #\n # Thread Pool\n #\n logger.raw(\"Thead Stats\\n\")\n logger.raw(\" Thread Pool\\n\")\n lines = thpool.members.map { |th| \" #{th[:name]}: \\t #{th.status}\" }\n logger.raw(lines.join(\"\\n\"))\n #\n # Consumer threads\n #\n logger.raw(\" Consumer Threads\\n\")\n lines = consumers.map { |c| th = c.thread; \" #{th[:name]}: \\t #{th.status}\" }\n logger.raw(lines.join(\"\\n\"))\n #\n # Test for activity\n #\n activity = activity?(jobq.size, thpool.job_count, thpool.result_count)\n logger.raw(\"\\nactivity? reports #{activity ? 'SOME' : 'NO'} activity\\n\")\n end",
"def clean_exit\n passed = all_by_exit_status(@test_data['test_exit_message_passed'])\n failed = all_by_exit_status(@test_data['test_exit_message_failed'])\n skipped = all_by_exit_status(@test_data['test_exit_message_skipped'])\n @test_data.merge!({'execution_time' => @execution_time, 'passed' => passed, 'failed' => failed, 'skipped' => skipped})\n Publisher.new(@test_data).publish_reports\n puts(\"\\n==> DONE\\n\\n\")\n puts(\" -- execution time : #{@execution_time.to_s} secs\\n\")\n puts(\" -- tests executed : #{@executed_tests.to_s}\\n\")\n puts(\" -- reports prepared: #{@test_data['reports_dir']}\\n\")\n puts(\" -- tests passed : #{passed.length.to_s}\\n\")\n puts(\" -- tests failed : #{failed.length.to_s}\\n\")\n puts(\" -- tests skipped : #{skipped.length.to_s}\\n\")\n if (@test_data['test_retry'] > 0)\n puts(\" -- tests re-tried : #{@tests_retried_counter.to_s}\\n\")\n end\n if failed.length > 0\n puts(\"\\n\\n==> STATUS: [ some tests failed - execution failed ]\\n\")\n exit(1)\n end\n exit(0)\nend",
"def clear_output(wait=false)\n Display.clear_output(wait)\n end",
"def q\r\n @_done = true\r\n puts\r\n \"Bye bye for now!\"\r\n end",
"def stdout; end",
"def stdout; end",
"def stdout; end",
"def stdout; end",
"def stdout; end",
"def stdout; end",
"def do_run\n\n @unit.logger.log_run_start(self)\n\n counter_next('runs')\n\n t0 = Time.now\n\n (@unit.conf['exe_max_messages'] || 77).times do |i|\n\n break if @shutdown\n\n m = @messages.shift\n break unless m\n\n m = (@messages << m).shift \\\n if m['point'] == 'terminated' && @messages.any?\n #\n # handle 'terminated' messages last\n\n ms = process(m)\n\n @consumed << m\n\n ims, oms = ms.partition { |mm| mm['exid'] == @exid }\n # qui est \"in\", qui est \"out\"?\n\n counter_add('omsgs', oms.size)\n # keep track of \"out\" messages, messages to other executions\n\n @messages.concat(ims)\n @unit.storage.put_messages(oms)\n end\n\n @alive = false\n\n @execution.merge!(\n closing_messages: @consumed.select { |m|\n CLOSING_POINTS.include?(m['point']) })\n\n @unit.storage.put_execution(@execution)\n @unit.storage.consume(@consumed)\n\n @unit.storage.put_messages(@messages)\n\n du = Time.now - t0\n t0 = Flor.tstamp(t0)\n\n @unit.logger.log_run_end(self, t0, du)\n @unit.hooker.notify(self, make_end_message(t0, du, @execution['size']))\n\n @consumed.clear\n\n rescue Exception => exc\n\n# TODO eventually, have a dump dir\n\n fn =\n [ 'flor', @unit.conf['env'], @unit.identifier, @exid,\n 'r' + counter('runs').to_s ].collect(&:to_s).join('_') + '.dump'\n\n @unit.logger.error(\n \"#{self.class}#do_run()\", exc, \"(dumping to #{fn} ...)\")\n\n File.open(fn, 'wb') do |f|\n f.puts(Flor.to_pretty_s({\n execution: @execution,\n messages: @messages,\n consumed: @consumed,\n traps: @traps.collect(&:to_h),\n exid: @exid,\n alive: @alive,\n shutdown: @shutdown,\n thread: [ @thread.object_id, @thread.to_s ]\n }))\n f.puts('-' * 80)\n f.puts(on_do_run_exc(exc))\n end\n\n @unit.logger.error(\n \"#{self.class}#do_run()\", exc, \"(dumped to #{fn})\")\n\n #puts on_do_run_exc(exc)\n # dump notification above\n end",
"def wait_final_result()\n @queue.pop\n @pipeline.stop\n return @result\n end"
] | [
"0.58596545",
"0.5707752",
"0.56536406",
"0.5635468",
"0.56230193",
"0.56183344",
"0.55817926",
"0.55460674",
"0.5534544",
"0.55055016",
"0.54950047",
"0.54717636",
"0.5460454",
"0.541473",
"0.5402201",
"0.53577036",
"0.5350234",
"0.5346105",
"0.5342154",
"0.5336531",
"0.532555",
"0.5287276",
"0.5260932",
"0.5243983",
"0.5232629",
"0.523178",
"0.5225647",
"0.52126384",
"0.5209319",
"0.5194232",
"0.5174374",
"0.5166118",
"0.5159845",
"0.5131786",
"0.5127172",
"0.5118358",
"0.5117803",
"0.51172036",
"0.5114486",
"0.5106412",
"0.51018184",
"0.5091983",
"0.50865227",
"0.5085422",
"0.5072149",
"0.50720334",
"0.5070977",
"0.5062354",
"0.5050917",
"0.5043586",
"0.50403255",
"0.50384074",
"0.5038014",
"0.50359976",
"0.50353897",
"0.5032871",
"0.5028389",
"0.5021012",
"0.5011959",
"0.5007617",
"0.5003108",
"0.50025666",
"0.50005275",
"0.50000143",
"0.4989105",
"0.49779558",
"0.49742207",
"0.49688512",
"0.49584657",
"0.4956575",
"0.49558672",
"0.494974",
"0.4948956",
"0.49467036",
"0.49436355",
"0.49376416",
"0.49340418",
"0.4930424",
"0.4928356",
"0.49255526",
"0.49197447",
"0.49093747",
"0.4908829",
"0.49075514",
"0.49031037",
"0.49031037",
"0.49031037",
"0.48948377",
"0.48896486",
"0.4881915",
"0.4880011",
"0.48789528",
"0.48770207",
"0.48770207",
"0.48770207",
"0.48770207",
"0.48770207",
"0.48770207",
"0.48721814",
"0.48701805"
] | 0.56261 | 4 |
display ingredients created or updated after the specified date. | def updated_after
update_selector { @ingredients = policy_scope(Ingredient.updated_after(@date)).order(:name) }
render :index
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @recipe = Recipe.all.order(\"created_at DESC\")\nend",
"def index\n @recipe = Recipe.all.order(\"created_at DESC\")\n end",
"def list_date(date)\n if date\n date = date.beginning_of_day\n if @list_date != date\n return content_tag(:h2, date.strftime(\"%m/%d/%Y\"))\n end\n end\n nil\n ensure\n @list_date = date\n end",
"def get_recipes_by_date(date, count)\n return count == nil ?\n Recipe.where(\"created_at LIKE \"+date).all :\n Recipe.where(\"created_at LIKE \"+date).limit(count).all\n end",
"def index\n @things = current_user.things.where('the_date >= ?', Date.today ).order('the_date ASC')\n @thing_day = @things.group_by { |t| t.the_date }\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @things }\n end\n end",
"def show\n @fooddrinks = Fooddrink.all\n Fooddrink.update_avg_qty(@fooddrink)\n @recommends = Fooddrink.where(user_id: @fooddrink.user_id).where.not(id: @fooddrink.id).order(created_at: :desc)\n end",
"def show\n @ingredients = Ingredient.all\n end",
"def view\n\n#READ a specific attribute from all entries (so, the attribute will be the argument)\n\n\n#method to show the day and date. Could this be the name that the user sees onscreen?\n\n #FINAL END\nend",
"def index\n if params[:user_id] then\n @recipes=User.find(params[:user_id]).created_recipes\n respond_with do |format|\n format.html { @recipes=RecipeDecorator.decorate @recipes }\n format.json { render json: RecipeJsonDecorator.decorate(@recipes) }\n end\n else\n @featured ||= RecipeDecorator.decorate Recipe.recent.limit(2) unless params[:search]\n index! do |format|\n format.html { @recipes=RecipeDecorator.decorate @recipes }\n format.json { render json: RecipeJsonDecorator.decorate(@recipes) }\n end\n end\n end",
"def show\n @recipes = @ingredient.recipes.reorder(ingredient_order_by(\"recipes\")).paginate(page: params[:page], per_page: 2)\n @title = \"Recipes using: \" + @ingredient.name\n # goto render /views/ingredients/show.html.erb using /shared/_show_recipes using @recipes, @title\n end",
"def list_reading_dates\n system \"clear\"\n user_choice = \"\"\n # while user_choice != \"❌ EXIT ❌\" && user_choice != \"🗑 DELETE READING 🗑\" do\n user_choice = prompt.select(\"🔮 #{self.user.name}, Select a date to view your past reading.\") do |menu|\n self.user.reading_dates.map do |date|\n menu.choice \"#{date}\", -> {self.handle_previous_reading_by_date(date)}\n end\n menu.choice \"⬅️ Back ⬅️\", -> {self.main_menu}\n end\n # end \n end",
"def show_by_date\n @city = City.find(params[:city_id])\n @events = @city.events.show_by_date(params[:date])\n d = Date.parse(params[:date])\n @started_at = d\n @date = d\n\n add_breadcrumb @city.name, city_path( @city )\n add_breadcrumb d.strftime(\"%b. %e, %Y\"), \"/show-by-date/\" + d.strftime(\"%Y-%m-%d\")\n end",
"def show\n @begin_date = Date.today - 5\n @end_date = Date.today + 5\n end",
"def index\n @reminders = Reminder.where(user_id: current_user.id).order(:remind_date)\n end",
"def show\n @meal = @meal_recipe.meal\n @meal_plan = @meal.day.meal_plan\n @leftover = Leftover.meal_recipe(@meal_recipe).first\n @meal_ingredient = MealIngredient.new\n end",
"def show\n @ingredient_recettes = @ingredient.recettes\n end",
"def show\n @recipes = @diet.recipes.reorder(diet_order_by(\"recipes\")).paginate(page: params[:page], per_page: 2)\n @title = \"Recipes using: \" + @ingredient.name\n # goto render /views/diets/show.html.erb using /shared/_show_recipes using @recipes, @title\n end",
"def by_date\n @page_title = \"Expenses [by Date]\"\n @expenses = @current_user.expenses.find(:all)\n\n # attempt to find expenses by a date range\n if !(params[:start].nil? and params[:finish].nil?)\n begin\n @expenses = @current_user.expenses.find(:all, :conditions => {\n :created_at => params[:start].to_date .. params[:finish].to_date\n })\n # capture invalid or nil date ranges\n rescue\n flash[:error] = \"Invalid dates in date range.\"\n @expenses = nil\n end\n end\n\n respond_to do |format|\n format.html # by_date.html.erb\n format.xml { render :xml => @expenses }\n format.iphone do # by_date.iphone.erb\n @panel_title = @page_title\n render :layout => false\n end\n end\n end",
"def index\n @client_infos = ClientInfo.all\n @clientbirthdate = ClientInfo.birthday_reminder\n end",
"def show\n @orders = @client.orders.order(date: :desc).page(params[:orders_page]).per_page(10)\n @recipes = @client.recipes.order(date: :desc).page(params[:recipes_page]).per_page(10)\n # binding.pry\n end",
"def index\n @ingredientes = Ingrediente.all\n end",
"def index\n @ingredientes = Ingrediente.all\n end",
"def show\n @recruitements = @recruiter.recruitments.where(:end_date => nil)\n respond_with @recruiter\n end",
"def by_date\n @sightings = Sighting.all\n render('sighting/date.html.erb')\n end",
"def show\n @update = Update.new\n @updates = Update.where(expedient_id: @expedient.id).order(\"updated_at DESC\")\n end",
"def reservations(date)\n reservation_list.each do |index, date|\n if reservation_list[index].include?(date)\n print reservation_list[index]\n end \n end\n end",
"def show\n \n rec_id = params[:id].to_i\n recipe = Recipe.find(rec_id)\n # find user name for recipe\n \n username = recipe.user.username;\n\n # get all ingredients from step ingredients ?\n ingredients = []\n\n recipe_steps = recipe.recipe_steps\n # one to one step ingredients to ingredients when coming from recipe-steps\n \n # recipe ingredients\n \n \n \n step_ingredients = recipe_steps.map{ |rs| \n { \n step_num: rs.step_num,\n step_image: rs.image,\n instruction: rs.instruction,\n step_ingredients: rs.step_ingredients.map{ |si| \n {amount: si.amount, ingredient: {name: si.ingredient.name} }\n } \n \n }\n \n }\n\n \n step_ingredients.each do |si|\n # byebug \n ings = si[:step_ingredients]\n ings.each do |ing|\n if ing[:amount] \n ing_total = ing[:amount] + \" \" + ing[:ingredient][:name] \n if !ingredients.include?(ing_total)\n ingredients.push(ing_total) \n end\n else\n ing_total = ing[:ingredient][:name] \n if !ingredients.include?(ing_total)\n ingredients.push(ing_total) \n end\n end\n end\n end\n \n # fix time to string\n \n render json: {username: username, recipe: recipe, ingredients: ingredients, recipe_steps: step_ingredients }, status: :accepted\n end",
"def show\n\t\tload_recipe\n\t\t\t\n\t\tload_recipes_set(@recipe.user)\n\t\t\n\t\t@recipe_index = @recipes_set.index(@recipe)\n\t\t\n\t\trecipe = [@recipe]\n\t\t@other_recipes_set = @recipes_set - recipe\n\t\trecipes_conditions = recipe_conditions(recipe_photo_required_cond, recipe_status_cond, recipe_privacy_cond, recipe_is_draft_cond)\n\n same_title_recipes_conditions_list = [ \"recipes.title = '#{@recipe.title}'\", \"recipes.common_title = '#{@recipe.title}'\" ]\n\t\tif (common_title = @recipe.common_title) && !common_title.blank?\n\t\t\tsame_title_recipes_conditions_list += [ \"recipes.common_title = '#{common_title}'\", \"recipes.title = '#{common_title}'\" ]\n\t\tend\n\t\tsame_title_recipes_conditions = \"#{recipes_conditions} AND (#{same_title_recipes_conditions_list.join(' OR ')})\"\n\t\t@same_title_recipes_set = recipes_for(nil, same_title_recipes_conditions, nil, 'RAND()') - recipe\n\t\t@same_title_recipes_set_count = @same_title_recipes_set.size\n\n related_recipes_conditions = recipes_conditions\n\t\t@related_recipes_set = taggables_for(nil, 'Recipe', @recipe.tag_list, related_recipes_conditions, nil, nil, nil, 'RAND()') - recipe - @same_title_recipes_set\n\t\t\n\t\t@favorite_users_set = favorite_users(@recipe.favorites.find(:all, :limit => 12, :order => 'RAND()'))\n\t\t@favorite_users_set_count = @favorite_users_set.size\n\t\t@entried_matches_set = entried_matches(@recipe.entries.find(:all, :limit => 12, :order => 'RAND()'))\n\t\t\n\t\tcurrent = Time.now\n\t\tif @recipe.match_id && (@match = Match.find_by_id_and_entriable_type(@recipe.match_id, 'Recipe')) && @match.doing?(current)\n\t\t\t@entry = @match.find_entry(@recipe)\n\t\tend\t\t\t\t\t\t\t\t\t\t\t\n\t\t\n\t\tshow_sidebar\n\t\t\n\t\trecipe_title = item_title(@recipe)\n\t\trecipe_common_title = @recipe.common_title.strip if !@recipe.common_title.blank?\n\t\trecipe_username = user_username(@recipe.user, true, true)\n\t\trecipe_link_url = item_first_link(@recipe)\n\t\t\n\t\tinfo = \"#{RECIPE_CN} - #{recipe_title}\"\n\t\tset_page_title(info)\n\t\tset_block_title(info)\n\t\t@meta_description = \"这是#{recipe_title}#{add_brackets(recipe_common_title, '(', ')')}的#{RECIPE_CN}信息, 来自#{recipe_username}. \"\n\t\t@meta_keywords = []\n @meta_keywords << @recipe.tag_list if !@recipe.tag_list.blank?\n @meta_keywords += [ recipe_title, recipe_username, recipe_link_url ]\n @meta_keywords << recipe_common_title if !recipe_common_title.blank?\n @meta_keywords += default_meta_keywords('Recipe')\n#\t\t@meta_keywords = [recipe_common_title] + @meta_keywords if !recipe_common_title.blank?\n\n respond_to do |format|\n format.html do\n \tlog_count(@recipe)\n end\n # format.xml { render :xml => @recipe }\n end\n end",
"def calories_on_date(date)\n get_call(\"1/user/#{user_id}/activities/calories/date/#{format_date(date)}/1d.json\")\n end",
"def invoice_date_display\n\n end",
"def customer_list_date\n @reservations = Reservation.where(\"customer_id = ? and DATE(start_datetime) = ?\", params[:customer_id], params[:date]).order(\"start_datetime ASC\")\n render :json => @reservations, status: :ok\n end",
"def index\n @metar_raports = MetarRaport.all\n @days = @metar_raports.order(\"created_at desc\").pluck(:created_at).uniq.collect { |d| d = d ? d.strftime(\"%Y-%m-%d\") : DateTime.now.strftime(\"%Y-%m-%d\") }.uniq\n @date = params[:date] ? Date.parse(params[:date]) : Date.today\n end",
"def index\n @recipes = Recipe.where(:original => true).order(\"created_at DESC\").page(params[:page])\n end",
"def display_date(date = nil)\n case date\n when :published\n date_obj = history[:published]\n when :archived\n date_obj = history[:archived]\n else\n date_obj = created_at\n end\n date_obj&.strftime('%B %-d, %Y')\n end",
"def show(date)\n if @log.has_key? date\n @log[date].each do |item|\n puts item.name\n end\n end\n end",
"def index\n @informations = Information.order('created_at desc')\n @information_sort_date = @informations.group_by{|info|info.created_at }\n end",
"def update\n @rentals = current_user.rentals.order(:start_date, :end_date)\n super\n end",
"def most_recent_recipe\n self.find_recipe_card_by_user.sort_by {|v| v.date}.last.recipe.name\n end",
"def index\n @atendimentos = Atendimento.order(:created_at)\n end",
"def index \n recipes = Recipe.all\n #render will return the object back in json format so that it can be used by the frontend\n render json: recipes, except: [:created_at, :updated_at]\n end",
"def display_recipe_time_and_link(recipe)\n puts \"\\nThis meal can be ready in \" + recipe.time.to_s + \" minutes.\\nFor detailed instructions go to: \" + recipe.url\n end",
"def showDate(date)\n puts \"#{date}\"\n items = @logHash[date]\n items.each do |item|\n puts \" #{item.name}\"\n end\n end",
"def diaries\n\t\t@diaries = current_user.diaries.desc(:date).limit(7)\n\n\t\trender 'clients/diary/diaries' \n\tend",
"def index\n past_histories = PastHistory.where(user_id: params[:user_id])\n render json: past_histories.as_json(include: :recipe, only: :created_at)\n end",
"def details\n format_description(@description) + \"event dates: \" + format_date(start_date:@start_date, end_date: @end_date)\n end",
"def show\n # accept the params\n # go to the db and get the correct recipe for that param\n p params[:id]\n @recipe = Recipe.find_by(id: params[:id])\n @ingredients = @recipe.ingredients.split(\", \").map {|ingredient| ingredient.capitalize}\n # send this to the view\n # show that data to the user\n render 'show.json.jb'\n end",
"def index\n @ingredients_nutrients = IngredientsNutrient.all\n end",
"def for(date)\n where(actual_date: date)\n end",
"def index\n @date_infecteds = DateInfected.all\n end",
"def effective_date\n created_at\n end",
"def get_reminders(date)\r\n d = date_checker(date)\r\n new_date = normalize_date(d)\r\n get = <<-SQL\r\n SELECT * FROM reminders WHERE date = ?\r\n SQL\r\n $DB.execute(get, [new_date])\r\n #puts selected_reminders\r\nend",
"def most_recent_recipe\n date = \"0000-01-01\"\n binding.pry\n recipe = nil\n self.find_recipe_cards.each do |recipe_card|\n if Date.parse(recipe_card.date) > date\n Date.parse(date) = Date.parse(recipe_card.date)\n recipe = recipe_card\n end\n end\n recipe\n date\n end",
"def show\n fresh_when(:last_modified => @article.updated_at, :public => true, :etag => @article) if Rails.env.production?\n end",
"def show\n @ingredient = Ingredient.find_by_url_slug(params[:id])\n @ingredient = Ingredient.find(params[:id]) if @ingredient.nil?\n @recipes = @ingredient.recipes.order('created_at DESC')\n logger.debug @recipes.inspect\n respond_to do |format|\n format.html {render :layout => 'wall'}\n format.json { render json: @ingredient }\n end\n end",
"def index()\n @ingredients = Ingredient.reorder(ingredient_order_by(\"ingredients\")).paginate(page: params[:page], per_page: 4)\n @title = \"All Ingredients\" \n @type = \"Ingredient\"\n\n end",
"def listing_date() self.created_at.strftime('%a %b %d, %Y') end",
"def show_not_completed_by_date_first\n @not_done_date = not_complete_by_date\n @not_done = show_not_completed_items\n return @not_done_date + @not_done\n end",
"def handle_previous_reading\n puts \"finding your fortune...🔮 🔮 🔮 please stand by...🔮 🔮 🔮\"\n self.list_reading_dates\n end",
"def index\n @important_dates = ImportantDate.all\n end",
"def list_ingredients\n rid = params[:id]\n items = Aws.get_ingredients_from_db(rid)\n render :json => items\n end",
"def most_recent_recipe\n recipes.sort_by do |i| \n i.date\n end.last\n end",
"def index\n @recipeingredients = Recipeingredient.all\n end",
"def show\n @recipe_ingredient_group = RecipeIngredientGroup.new\n @recipe_ingredients = @recipe.recipe_ingredients\n @recipe_ingredient_groups = @recipe.recipe_ingredient_groups\n \n @recipe_ingredient = RecipeIngredient.new\n @ingredient = Ingredient.new\n \n end",
"def index\n @page_title = \"All Ingredeients\"\n @ingredients = Ingredient.all\n end",
"def show_due_today\n task = Task.where(due_date: Date.today).all\nend",
"def list_reservations(date)\n res_on_date = @reservations.select do |reservation|\n date >= reservation.start_date && date < reservation.end_date\n end\n \n return res_on_date\n end",
"def details\n format_description(@description, 25) + \"event dates: \" + format_date(@start_date,@end_date)\n end",
"def index\n @infomsgs = Infomsg.all.order('effective_date DESC')\n end",
"def show\n @descriptions = @recipe.descriptions\n @rating = @recipe.ratings.average(:rating)\n unless current_user.nil?\n @favorites = current_user.favorites.pluck(:recipe_id)\n @favorite = @recipe.favorites.where(user: current_user)[0]\n end\n @parts = @recipe.parts\n @notes = @recipe.notes\n @comments = @recipe.comments.order(\"created_at DESC\")\n end",
"def show\n @products = Product.order(\"updated_at DESC\")\n end",
"def show\n @recipe = Recipe.find(params[:id])\n @nutrition_info = NutritionInfo.where( \"recipe_id = ?\", @recipe.id ).first\n @inventory_items = []\n @recipe.inventory_items.each do |inventory_item|\n @inventory_items << inventory_item\n end\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe }\n end\n end",
"def show\n recipe_ingredients = RecipeIngredient.where(recipe_id: @recipe[:id])\n recipe_ingredient_ids = recipe_ingredients.pluck(:ingredient_id)\n @recipe_ingredients = recipe_ingredients.group_by(&:ingredient_id)\n @ingredients_like_ids = []\n fridge_items = FridgeItem.all\n fridge_items.each do |fi|\n @ingredients_like_ids << find_ingredients_like(fi.ingredient_id)\n end\n @ingredients_like_ids.flatten!\n @ingredients = Ingredient.find(recipe_ingredient_ids)\n @fridge_item_ids = []\n @ingredients.each do |ingredient|\n if @ingredients_like_ids.include?(ingredient.id)\n @fridge_item_ids << ingredient.id\n end\n end\n @fridge_item = FridgeItem.new\n end",
"def recipe_ingredients(recipe_id)\n recipe_status_helper(recipe_id)\n @recipe_ingredient_arr = recipe_ingredient.split(\", \")\n puts \" \"\n p user.recipes.where(id: recipe_id)[0].ingredient\n prompt.select(\"Options\") do |menu|\n puts \" \"\n menu.choice \"Choose New Protein\", -> {choose_protein}\n menu.choice \"Update Recipe Rating\", -> {update_recipe_rating(recipe_id)}\n menu.choice \"Add Ingredient\", -> {ingredient_add_helper(recipe_id)}\n menu.choice \"Remove Ingredient\", -> {ingredient_remove_helper(recipe_id)}\n menu.choice \"Exit\", -> {exit_helper}\n end\n end",
"def show_events_on_date(date)\n return nil unless events_at?(date)\n\n events = @calendar_events[date]\n puts 'You have following events on this date:'\n print_events(events)\n events\n end",
"def index\n @verbindung = Verbindung.find(params[:verbindung_id])\n @events = Event.where(:verbindung_id => @verbindung.id).where(\"date >= ?\", Date.today).order(\"date\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @tenders = Tender.all.order(:updated_at)\n end",
"def index\n @ingredient_recipes = IngredientRecipe.all\n end",
"def display_days_ago(date)\n days_ago = (Date.current - date.to_date).to_i\n case days_ago\n when 0\n 'Today'\n when 1\n 'Yesterday'\n else\n days_ago.to_s + ' days ago'\n end\n end",
"def show;\n @date_opened_string = \"N/A\"\n @date_closed_string = \"N/A\"\n\n if (@item.date_opened != nil)\n @date_opened_string = format('%04d', @item[:date_opened].year) + \"-\" + format('%02d', @item[:date_opened].month) + \"-\" + format('%02d', @item[:date_opened].day)\n end\n if (@item.date_closed != nil)\n @date_closed_string = format('%04d', @item[:date_closed].year) + \"-\" + format('%02d', @item[:date_closed].month) + \"-\" + format('%02d', @item[:date_closed].day)\n end\n end",
"def memberships_to_notify(date)\n treatment_group_memberships\n .status_enrolled\n .joins(treatment_group: :reminder_templates)\n .where(\"date_trunc('day', experiment_inclusion_date) + make_interval(days := reminder_templates.remind_on_in_days) = ?\", date)\n end",
"def command_show(date = Date.today)\n entries = @log.get_entries(date)\n if entries != nil\n entries.each { |i|\n puts i.to_s\n }\n end\n end",
"def recently_updated(min_date, args = {})\r\n args['min_date'] = min_date.to_i\r\n PhotoList.new('flickr.photos.recentlyUpdated', args)\r\n end",
"def index\n @tents = Tent.all.order(updated_at: :desc)\n end",
"def index\n @ireceipts = Ireceipt.all.order(\"rdate DESC\")\n end",
"def show\n @ingredients = @recipe.ingredients\n @owner = @recipe.owner\n @owner_user = User.find(@recipe.owner)\n @potluck = Potluck.new\n end",
"def display_past_history(current_user, date)\n puts `clear`\n puts \"************ \".blue + \"Your Drinks From\" + \" ************\".blue\n puts \"************ \".blue + \"#{date.strftime(\"%a, %d %b %Y\")} - 8:00 AM\" + \" ************\".blue\n puts \"************ \".blue + \"until\" + \" ************\".blue\n puts \"************ \".blue + \"#{(date+1).strftime(\"%a, %d %b %Y\")} - 7:59 AM\" + \" ************\".blue\n puts \"\"\n display_drinks_on_date(current_user, date)\n puts \"\"\n puts \"*****************************************************\".blue\nend",
"def preview_text(_maxlength = nil)\n return \"\" unless value\n\n ::I18n.l(value, format: :\"alchemy.ingredient_date\")\n end",
"def index\n if params[\"start_date\"].nil? || params[\"start_date\"].empty? \n @start_date = current_user.created_at\n else\n @start_date = params[\"start_date\"].to_date \n end\n if params[\"end_date\"].nil? || params[\"end_date\"].empty?\n @end_date = Time.now.to_date.end_of_day\n else\n @end_date = params[\"end_date\"].to_date.end_of_day \n end\n @food_expenditures = current_user.food_expenditures.where(:created_at=>@start_date..@end_date).paginate(:page => params[:page], :per_page => 13)\n end",
"def view_all_date(db)\n db.execute(\"SELECT * FROM lifts ORDER BY date DESC\")\nend",
"def objection_name_date\n o = objection ? 'Objection' : 'No Objection'\n o + ' from ' + librarian.short + ' on ' + created_at.strftime('%b-%-d')\n end",
"def index\n @recipe_ingredients = RecipeIngredient.all\n end",
"def index\n @upcoming_moments = current_user.moments.order('date ASC').where('date > ?', DateTime.now)\n @past_moments = current_user.moments.order('date DESC').where('date < ?', DateTime.now)\n end",
"def index\n @recipes = Recipe.where(user_id: current_user.id)\n end",
"def index\n @ingredients = Ingredient.all\n end",
"def index\n @ingredients = Ingredient.all\n end",
"def index\n @exemptions = Exemption.where(\"exempt_day > ?\", Date.today)\n end",
"def date_filter_for(field)\n res = \"\"\n res += content_tag(:li) do\n name = \"f[created_after]\"\n id = \"f_created_after\"\n res = label_tag(id, \"After\", :class => \"date\")\n res += text_field_tag(name, filter_params[:created_after], \n :class => \"datePopup\")\n end\n res += content_tag(:li) do\n name = \"f[created_before]\"\n id = \"f_created_before\"\n res = label_tag(id, \"Before\", :class => \"date\")\n res += text_field_tag(name, filter_params[:created_before], \n :class => \"datePopup\")\n end\n\n return res.html_safe\n end",
"def index\n @activities = @user.activities.where(\"date = ?\", requested_date(params[:date]))\n end",
"def show\n @notices = Notice.order(created_at: :desc).where(finalised: false)\n end",
"def fat_on_date(date)\n get_call(\"/1/user/#{@user_id}/body/log/fat/date/#{format_date(date)}.json\")\n end"
] | [
"0.5571825",
"0.5557989",
"0.548803",
"0.5378808",
"0.53154016",
"0.53023547",
"0.528683",
"0.5278025",
"0.52607936",
"0.5249847",
"0.52494836",
"0.52359885",
"0.52355886",
"0.5233625",
"0.5232739",
"0.5232502",
"0.522944",
"0.5224436",
"0.5214373",
"0.52037644",
"0.51993275",
"0.51993275",
"0.51701367",
"0.51593953",
"0.5154929",
"0.5152358",
"0.5141292",
"0.5136073",
"0.5135302",
"0.5123686",
"0.51105326",
"0.5110267",
"0.5102612",
"0.50957936",
"0.509239",
"0.509023",
"0.50732666",
"0.507252",
"0.5072253",
"0.5071068",
"0.5070815",
"0.5068875",
"0.50524044",
"0.5044697",
"0.5039569",
"0.50347507",
"0.50337523",
"0.5017607",
"0.5010336",
"0.50101775",
"0.50095725",
"0.50083673",
"0.5006973",
"0.50002456",
"0.49981818",
"0.49976325",
"0.49958804",
"0.4993817",
"0.49867892",
"0.4964988",
"0.49645573",
"0.49634215",
"0.49624646",
"0.49570143",
"0.4955995",
"0.49523336",
"0.4952168",
"0.49511158",
"0.49499586",
"0.49483994",
"0.49468476",
"0.49450818",
"0.49414203",
"0.4940445",
"0.49392223",
"0.49387157",
"0.4937632",
"0.49374348",
"0.49336028",
"0.49318486",
"0.49309",
"0.49274954",
"0.49148136",
"0.49091274",
"0.4898734",
"0.48978886",
"0.48945242",
"0.48907283",
"0.48878834",
"0.48877877",
"0.48817724",
"0.48800042",
"0.4878352",
"0.4878053",
"0.4878053",
"0.48754716",
"0.4875465",
"0.48754153",
"0.48753977",
"0.48724818"
] | 0.66590506 | 0 |
display a specific ingredient. | def show
@ingredient = Ingredient.find_by(id: params[:id])
authorize @ingredient
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @ingredient = Ingredient.find(params[:id])\n @page_title = \"#{@ingredeint.name}\"\n end",
"def show\n @ingredient = Ingredient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ingredient }\n end\n end",
"def show\n @ingredient = Ingredient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ingredient }\n end\n end",
"def show\n @recipe_ingredient = Recipe_ingredient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe_ingredient }\n end\n end",
"def show\n if ingredient\n render json: ingredient\n else \n render json: {message: 'Ingredient not found'}\n end\n end",
"def show\n @recipe_ingredient = RecipeIngredient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe_ingredient }\n end\n end",
"def show\n @ingredients = Ingredient.all\n end",
"def show\n if params[:edit_ingredient]\n @ingredient = Ingredient.find(params[:edit_ingredient])\n else\n @ingredient = Ingredient.new\n end\n @country_consumption_name = @recipe.country_consumption.name\n respond_to_format\n end",
"def show\n @ingredient_recettes = @ingredient.recettes\n end",
"def show\n @ingredient = Ingredient.find(params[:id])\n\n respond_to do |format|\n format.xml { render :xml => @ingredient }\n end\n end",
"def show\n if recipeIngredient\n render json: recipeIngredient\n else \n render json: {message: 'Recipe Ingredient not found'}\n end\n end",
"def show\n @ingredient = Ingredient.find(params[:id])\n @alternate_ingredient = @ingredient.to_unit(@ingredient.conversions_to_display) unless @ingredient.conversions_to_display.nil?\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @ingredient.to_xml }\n end\n end",
"def show\n @recipe_ingredient_group = RecipeIngredientGroup.new\n @recipe_ingredients = @recipe.recipe_ingredients\n @recipe_ingredient_groups = @recipe.recipe_ingredient_groups\n \n @recipe_ingredient = RecipeIngredient.new\n @ingredient = Ingredient.new\n \n end",
"def current_ingredient\n ingredient = Ingredient.find(params[:id])\n end",
"def ingredient_name\n return ingredient.name\n end",
"def show\n @ingredients_name = IngredientsName.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ingredients_name }\n end\n end",
"def ingredient(name)\n content = content_by_name(name)\n return nil if content.blank?\n content.ingredient\n end",
"def ingredient(name)\n content = content_by_name(name)\n return nil if content.blank?\n content.ingredient\n end",
"def show\n # accept the params\n # go to the db and get the correct recipe for that param\n p params[:id]\n @recipe = Recipe.find_by(id: params[:id])\n @ingredients = @recipe.ingredients.split(\", \").map {|ingredient| ingredient.capitalize}\n # send this to the view\n # show that data to the user\n render 'show.json.jb'\n end",
"def show\n @cooking_ingredient = CookingIngredient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cooking_ingredient }\n end\n end",
"def show\n @recipe = Recipe.find(params[:id])\n @ingredients = @recipe.ingredients\n @instructions_domain = @recipe.instruction_url_split\n @nutrition_info = @recipe.nutrition_informations\n @health_labels = @recipe.health_labels\n end",
"def show\n @step_ingredient = StepIngredient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @step_ingredient }\n end\n end",
"def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end",
"def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end",
"def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end",
"def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end",
"def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end",
"def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end",
"def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end",
"def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end",
"def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end",
"def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end",
"def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end",
"def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end",
"def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end",
"def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end",
"def show\n @recipes = @ingredient.recipes.reorder(ingredient_order_by(\"recipes\")).paginate(page: params[:page], per_page: 2)\n @title = \"Recipes using: \" + @ingredient.name\n # goto render /views/ingredients/show.html.erb using /shared/_show_recipes using @recipes, @title\n end",
"def display_resource(recipe)\n \"Recipe ##{recipe.id} - #{recipe.name}\"\n end",
"def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end",
"def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end",
"def show\n @meal = @meal_recipe.meal\n @meal_plan = @meal.day.meal_plan\n @leftover = Leftover.meal_recipe(@meal_recipe).first\n @meal_ingredient = MealIngredient.new\n end",
"def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end",
"def ingredient\n return nil if essence.nil?\n essence.ingredient\n end",
"def research (ingredient)\n puts \"You look through your spellbooks to see how adding #{ingredient} might make your #{@name} spell more powerful.\"\n end",
"def edit\n @page_title = \"Edit Ingredeient\"\n @ingredient = Ingredient.find(params[:id])\n @btnText = \"Update Ingredient\"\n @obj = @ingredient\n render 'shared/form'\n end",
"def show\n @ingredients = @recipe.ingredients\n @masterpieces = @recipe.masterpieces\n end",
"def find_ingredient(ingredient_name)\n ingredients[ingredient_name]\n end",
"def ingredient\n if self.respond_to?(ingredient_column)\n self.send(ingredient_column)\n end\n end",
"def show\n recipe_id = params[:id].to_i\n @recipe = Recipe.find(recipe_id)\n end",
"def show\n @recipes = @diet.recipes.reorder(diet_order_by(\"recipes\")).paginate(page: params[:page], per_page: 2)\n @title = \"Recipes using: \" + @ingredient.name\n # goto render /views/diets/show.html.erb using /shared/_show_recipes using @recipes, @title\n end",
"def show\n\t\t@recipe = Recipe.find(params[:id])\n\tend",
"def show\n params.require(%i[id])\n render json: Ingredient.find_by!(id: params[:id])\n end",
"def show\n @recipe = Recipe.find(params[:id])\n @recipeIngredients = RecipeIngredient.where(:recipeId => params[:id])\n @ingredients = Ingredient.where(:id => @recipeIngredients.select(:ingredientId))\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe }\n end\n end",
"def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n @ingredient_item = Item.find(@ingredient.item_id)\n end",
"def show\n @recipe = Recipe.find(params[:id])\n end",
"def current_recipeIngredient\n recipeIngredient = RecipeIngredient.find(params[:id])\n end",
"def show\n recipe_ingredients = RecipeIngredient.where(recipe_id: @recipe[:id])\n recipe_ingredient_ids = recipe_ingredients.pluck(:ingredient_id)\n @recipe_ingredients = recipe_ingredients.group_by(&:ingredient_id)\n @ingredients_like_ids = []\n fridge_items = FridgeItem.all\n fridge_items.each do |fi|\n @ingredients_like_ids << find_ingredients_like(fi.ingredient_id)\n end\n @ingredients_like_ids.flatten!\n @ingredients = Ingredient.find(recipe_ingredient_ids)\n @fridge_item_ids = []\n @ingredients.each do |ingredient|\n if @ingredients_like_ids.include?(ingredient.id)\n @fridge_item_ids << ingredient.id\n end\n end\n @fridge_item = FridgeItem.new\n end",
"def show\n @ingredient = Ingredient.find_by_url_slug(params[:id])\n @ingredient = Ingredient.find(params[:id]) if @ingredient.nil?\n @recipes = @ingredient.recipes.order('created_at DESC')\n logger.debug @recipes.inspect\n respond_to do |format|\n format.html {render :layout => 'wall'}\n format.json { render json: @ingredient }\n end\n end",
"def show\n @ingredient_assignment = IngredientAssignment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ingredient_assignment }\n end\n end",
"def show\n # instance variable @recipe - Recipe(table) .find method using \n # params hash by id and passing to show view\n @recipe = Recipe.find(params[:id])\n end",
"def preview_ingredient\n @_preview_ingredient ||= ingredients.detect(&:preview_ingredient?) || first_ingredient_by_definition\n end",
"def show\n @recipe = current_user.recipes.find(params[:id])\n @instructions = @recipe.instructions\n @ingredients = @recipe.ingredients\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe }\n end\n end",
"def show\n @recipe = Recipe.find(params[:id])\n @nutrition_info = NutritionInfo.where( \"recipe_id = ?\", @recipe.id ).first\n @inventory_items = []\n @recipe.inventory_items.each do |inventory_item|\n @inventory_items << inventory_item\n end\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe }\n end\n end",
"def set_recipe_ingredient\n @recipe_ingredient = RecipeIngredient.find(params[:id])\n end",
"def show\n @recipe = Recipe.find(params[:id])\n @ingrediences = Ingredience.find(:all, :order => 'title')\n @units = Unit.find(:all, :conditions => ['foods = ?', true], :order => 'name')\n @meals = Meal.find(:all, :conditions => ['recipe_id = ?', @recipe.id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @recipe }\n end\n end",
"def visualize_ingredients(opts = {})\n data, _status_code, _headers = visualize_ingredients_with_http_info(opts)\n data\n end",
"def ingredient(ingredient_name, units)\n RecipeIngredient.new(ingredient_name, units)\n end",
"def show\n \n @receipe = Receipe.find(params[:receipe_id])\n @receipe_category = ReceipeCategory.find_by(id: @receipe.receipe_category_id)\n @ingredients = @receipe.ingredients\n @cooking_steps = @receipe.cooking_steps\n end",
"def display_resource(recipe)\n recipe.name\n end",
"def display_resource(recipe)\n recipe.name\n end",
"def ingredient_instance(ingredient_name) \n Ingredient.find_by name: ingredient_name\n end",
"def index\n @ingredientes = Ingrediente.all\n end",
"def index\n @ingredientes = Ingrediente.all\n end",
"def show\n\t\t@recipe = Recipe.find(params[:id])\n\t\tif @recipe \n\t\t\trender json: @recipe.to_json(:include => [:inventories])\n\t\telse\n\t\t\trender status: 400, nothing: true\n\t\tend\n\tend",
"def show\n @ingredients = @recipe.ingredients\n @owner = @recipe.owner\n @owner_user = User.find(@recipe.owner)\n @potluck = Potluck.new\n end",
"def set_ingredient_recipe\n @ingredient_recipe = IngredientRecipe.find(params[:id])\n end",
"def show(id) \n response = request(:get, \"/recipes/#{id}.json\")\n response.first[1]\n end",
"def set_recipeingredient\n @recipeingredient = Recipeingredient.find(params[:id])\n end",
"def show\n recipe = EdamamApiWrapper.show_recipe(params[:id])\n if recipe == nil\n flash[:error] = \"Recipe does not exist. Please do a new recipes search.\"\n redirect_to root_path\n else\n @recipe = recipe\n end\n end",
"def recipe_ingredients(recipe_id)\n recipe_status_helper(recipe_id)\n @recipe_ingredient_arr = recipe_ingredient.split(\", \")\n puts \" \"\n p user.recipes.where(id: recipe_id)[0].ingredient\n prompt.select(\"Options\") do |menu|\n puts \" \"\n menu.choice \"Choose New Protein\", -> {choose_protein}\n menu.choice \"Update Recipe Rating\", -> {update_recipe_rating(recipe_id)}\n menu.choice \"Add Ingredient\", -> {ingredient_add_helper(recipe_id)}\n menu.choice \"Remove Ingredient\", -> {ingredient_remove_helper(recipe_id)}\n menu.choice \"Exit\", -> {exit_helper}\n end\n end",
"def recipePrintHelper(name)\n myrecipe = @RecipeHash[name]\n puts \"#{myrecipe.name} #{myrecipe.calories}\"\n # Loop through each ingredient and print out the required ingredient name and\n # and the associated calories.\n myrecipe.ingredients.each do |ingredient|\n puts \" #{@BasicHash[ingredient].name} #{@BasicHash[ingredient].calories}\\n\"\n end\n end",
"def show\n respond_with Recipe.find(params[\"id\"])\n end",
"def show\n if recipe\n render json: recipe\n else \n render json: {message: 'Recipe not found'}\n end\n end",
"def ask_for_ingredient\n puts \"What ingredient do you want to search for?\"\n print \"> \"\n gets.chomp\n end",
"def show\n @food_recipe = FoodRecipe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @food_recipe }\n end\n end",
"def print_needed_ingredients\n puts \"\\n\\n\\s\\e[4m#{self.name} Recipe\\e[0m\"\n self.ingredients.each { |ingredient| puts \"\\s- #{ingredient.name}: #{RecipeIngredient.find_by(recipe_id: self.id, ingredient_id: ingredient.id).amount} cl\" }\n if self.recipe_specials.collect{|x| x.special if x.special}.uniq != [nil]\n self.recipe_specials.collect{|x| x.special if x.special}.uniq.each{|y| puts \"\\s- Special: #{y}\"}\n elsif self.recipe_specials.collect{|x| x.garnish if x.garnish}.uniq != [nil]\n puts \"\\s- Garnish: #{self.recipe_specials.collect{|x| x.garnish if x.garnish}.uniq[0]}\"\n end\n puts \"\\s- Preparation: #{self.preparation}\"\n end",
"def print_recipe\n index = 0\n @recipe.recipe_name.each do|item|\n puts \"- [#{index}] #{item}\".colorize(:yellow)\n index = index + 1\n end\n user_input = gets.chomp.to_i\n @recipe.select_recipe(user_input)\n #self.start_main_menu\n end",
"def show \n\n # @recipe.ingredients.build\n @new_ingredient = Ingredient.new\n @new_ingredient.recipe = @recipe\n\n # @flag = @recipe.flags.create\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe }\n end\n end",
"def show\n @recipe = Recipe.new\n end",
"def by_ingredient\n # If ingredient exists, find recipes that use it\n if Ingredient.exists?(params[:id])\n ingredient = Ingredient.find(params[:id])\n recipes = Recipe.recipes_of_ingredient(params[:id])\n else\n recipes = Recipe.all\n end\n\n # Render json\n render json: {recipes: recipes}, status: 200 \n end",
"def set_dis_ingredient\n @dis_ingredient = DisIngredient.find(params[:id])\n end",
"def ingredient=(value)\n raise EssenceMissingError if essence.nil?\n essence.ingredient = value\n end",
"def show\n @meal = Meal.find(params[:meal_id]) if params[:meal_id]\n @recipe = @meal.recipes.find(params[:id]) if @meal\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe }\n end\n end",
"def edit_ingredients\n @prompt.select(\"Do you want to add or delete ingredients?\") do |menu|\n menu.choice \"Add ingredient(s)\", -> {add_ingredients}\n menu.choice \"Delete ingredient(s)\", -> {delete_ingredients}\n menu.choice \"Back to menu\", -> {nav_menu}\n end\n end",
"def disp\n\t\tputs \"#{@aname} belongs to #{@cuisine} and has #{@ingredients} you can make it by #{@procedure}\"\n\t\t\n\tend",
"def show\n @directions = @recipe.directions\n @ingredients = @recipe.ingredients\n @direction = Direction.new\n @ingredient = Ingredient.new\n @primaries = set_loadout('Primary')\n @secondaries = set_loadout('Secondary')\n @sights = set_loadout('Sight')\n @grips = set_loadout('Grip')\n @attachments = set_loadout('Attachment')\n @utilities = set_loadout('Utility')\n loadouts = @recipe.ingredients.where(piece_type: 'Loadout')\n\n @parents = loadouts.select do |ingredient|\n ingredient.piece.kind == 'Secondary' || ingredient.piece.kind == 'Primary'\n end\n end",
"def update\n @ingredient = Ingredient.find(params[:id])\n\n respond_to do |format|\n if @ingredient.update_attributes(params[:ingredient])\n format.html { redirect_to @ingredient, notice: 'Ingredient was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @gift = Gift.find(params[:id])\n end",
"def show\n @recipe = Recipe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe }\n end\n end",
"def index\n @ingredients = Ingredient.all\n end"
] | [
"0.77055633",
"0.7366918",
"0.7366918",
"0.73456264",
"0.7301745",
"0.7284073",
"0.7259103",
"0.7221823",
"0.7219814",
"0.7066479",
"0.7025839",
"0.6958041",
"0.68944234",
"0.6882323",
"0.6879223",
"0.6866469",
"0.6860951",
"0.6860951",
"0.68559027",
"0.6851901",
"0.67937565",
"0.6788264",
"0.6788252",
"0.6788252",
"0.6788252",
"0.6788252",
"0.6788252",
"0.6788252",
"0.6788252",
"0.6788252",
"0.6788252",
"0.6788252",
"0.6788252",
"0.6788252",
"0.6788252",
"0.6788252",
"0.67692554",
"0.67565244",
"0.6699901",
"0.6699901",
"0.66766053",
"0.66657823",
"0.66563606",
"0.66400677",
"0.6636014",
"0.66316617",
"0.6603434",
"0.658815",
"0.65735376",
"0.6569172",
"0.65269965",
"0.65235156",
"0.65203965",
"0.6506016",
"0.6503399",
"0.6462218",
"0.641057",
"0.638486",
"0.63778675",
"0.6372671",
"0.63161707",
"0.6314715",
"0.6296741",
"0.62890303",
"0.6286826",
"0.6286095",
"0.62821275",
"0.62806964",
"0.62643665",
"0.62643665",
"0.62463194",
"0.62349725",
"0.62349725",
"0.6216083",
"0.620202",
"0.6194947",
"0.61927485",
"0.6185376",
"0.6180414",
"0.6153464",
"0.6137938",
"0.61282057",
"0.61072165",
"0.6064364",
"0.606397",
"0.60561776",
"0.605513",
"0.60207665",
"0.6013808",
"0.6012034",
"0.6011339",
"0.600952",
"0.60019916",
"0.59901434",
"0.59722596",
"0.5937906",
"0.593649",
"0.59362876",
"0.59282213",
"0.592814"
] | 0.65009886 | 55 |
Creates a new label. | def create_label(project, name, color, options = {})
post("/projects/#{url_encode project}/labels", body: options.merge(name: name, color: color))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_label(node)\n if node.attributes['id'] and @labels[node.attributes['id']]\n label = @labels[node.attributes['id']]\n else\n label = @factory.new_label\n @labels[node.attributes['id']] = label\n end\n \n # Read all defined data fields\n label.id = node.attributes['id']\n if node.attributes['type']\n label.type = Utils.add_namespace(node.attributes['type'])\n end\n \n label.name = node.elements['name'].text if node.elements['name']\n label.sort_name = node.elements['sort-name'].text if node.elements['sort-name']\n label.code = node.elements['label-code'].text if node.elements['label-code']\n label.disambiguation = node.elements['disambiguation'].text if node.elements['disambiguation']\n label.country = node.elements['country'].text if node.elements['country']\n \n if life_span = node.elements['life-span']\n label.begin_date = read_date_attribute(life_span, 'begin')\n label.end_date = read_date_attribute(life_span, 'end')\n end\n \n # Read the alias list\n read_alias_list(node.elements['alias-list'], label.aliases)\n \n # Read the release list\n read_release_list(node.elements['release-list'], label.releases)\n \n # Read the relation list\n if node.elements['relation-list']\n node.elements.each('relation-list') {|relation_node|\n read_relation_list(relation_node) {|relation|\n label.add_relation relation\n }\n }\n end\n \n # Read the tag list\n read_tag_list(node.elements['tag-list'], label.tags)\n \n return label \n end",
"def createLabel\n @labelField = NSTextField.alloc.initWithFrame(LABEL_FRAME).tap do |obj|\n obj.autoresizingMask = NSViewWidthSizable | NSViewMinYMargin\n obj.bordered = false\n obj.drawsBackground = false\n obj.font = NSFont.boldSystemFontOfSize(12) # systemFontOfSize 13\n obj.editable = false\n obj.selectable = true\n obj.alignment = NSNaturalTextAlignment\n end\n end",
"def create_label(name, description, types, color) \n data = {\n 'name' => name,\n 'description' => description,\n 'types' => types,\n 'color' => color\n }\n\n result = @access_token.post(\n \"#{SITE}/api/v2/labels\", \n data.to_json, \n {'Accept'=>'application/json', 'Content-Type' => 'application/json'}\n )\n\n JSON.parse(result.body)\n end",
"def createLabel(content)\n\t\tlabel = Gtk::Label.new\n\t\tlabel.set_markup(content)\n\t\treturn label\n\tend",
"def create_labels(labels)\n initialize\n labels.each do |l|\n @client.add_label(@targetRepo, l.name, l.color)\n end\n end",
"def put_label name\n if @labels.key? name\n raise Errors::LabelAlreadyDefined, \"Label `#{name}` is already defined\"\n end\n @labels[name] = nil\n @instructions << Label.new(name)\n self\n end",
"def label(name)\n @labels << Label.new( [now, name, nil, {}] )\n end",
"def international_create(label_options)\n create_label File.join(LABEL_URL, 'international', label_options)\n end",
"def create(label_options)\n create_label File.join(LABEL_URL, 'domestic'), label_options\n end",
"def createlabel\n if !params[:labelname].nil? and !params[:labelname].empty? and !params[:labelcolor].nil? and !params[:labelcolor].empty?\n label = Label.new\n label.labelname = params[:labelname]\n label.labelcolor = params[:labelcolor]\n label.project = get_project\n label.status = \"Active\"\n label.created_by=session[:username]\n if label.save\n @manage_label =false\n @notice = \"Label created Successfully\"\n else\n @notice = \"Error creating label\"\n end\n redirect_to bugs_url\n else\n redirect_to bugs_url\n end\n end",
"def create\n @label = Label.new(params[:label])\n\n respond_to do |format|\n if @label.save\n format.html { redirect_to(@label, :notice => 'Label was successfully created.') }\n format.xml { render :xml => @label, :status => :created, :location => @label }\n else\n handle_error( format, @label, 'new' )\n end\n end\n end",
"def new_dummy_label\n @dummy_label_index ||= 0\n @dummy_labels ||= (\"a\"..\"aaaaaa\").to_a\n dummy_label = @dummy_labels[@dummy_label_index]\n @dummy_label_index += 1\n dummy_label\n end",
"def add_label(label)\n d = [label, AS::LabelObject.new]\n @table << d\n d[1]\n end",
"def add_label label\n @labels[label] = true\n\n label\nend",
"def label name\n UnknownLabel.new(name)\n end",
"def create_group_label(group, name, color, options = {})\n post(\"/groups/#{url_encode group}/labels\", body: options.merge(name: name, color: color))\n end",
"def add_label!( n, primary=:false )\n save if add_label( n, primary )\n end",
"def label(text, options = {})\n Label.new(text, {parent: self}.merge!(options))\n end",
"def label\n @label ||= self.new.class.to_s.underscore.gsub('/', '.')\n end",
"def add_a_label\n @label = UILabel.alloc.initWithFrame(CGRectZero)\n @label.text = \"Find the weather in:\"\n @label.color = BW.rgb_color(255, 255, 255)\n @label.sizeToFit\n @label.center = CGPointMake(@view_width / 2, 50)\n self.view.addSubview(@label)\n end",
"def add_new_tag_with_label(tag_label)\n \traise \"error\" unless tag_label.is_a?(String)\n tag = Dtag.create(:label => DomainEnumerated.standardize_tag(tag_label), :domain_id => id)\n tag_ids << tag.id\n update_attribute(:descriptor, descriptor)\n tag\n end",
"def label_as label\n @label = label\n end",
"def create\n\n @label = @app_session.labels.new(label_params)\n\n respond_to do |format|\n if @label.save\n format.html { redirect_to session_labels_url(@app_session), notice: 'Label added' }\n format.json { render :show, status: :created, location: @label }\n else\n # POST usually excludes labels\n get_all_labels\n format.html { render :new }\n format.json { render json: @label.errors, status: :unprocessable_entity }\n end\n end\n end",
"def label\n label = \"#{number}: #{name}\"\n end",
"def add_label(label, number)\n label 'add', label, number\n end",
"def create_label\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n if params[:thetisBoxEdit].empty?\n render(:partial => 'ajax_label', :layout => false)\n return\n end\n\n @toy = Toy.new\n\n @toy.xtype = Toy::XTYPE_LABEL\n @toy.message = params[:thetisBoxEdit]\n if @login_user.nil?\n t = Time.now\n @toy.id = (t.hour.to_s + t.min.to_s + t.sec.to_s).to_i\n @toy.x, @toy.y = DesktopsHelper.find_empty_block(@login_user)\n else\n @toy.user_id = @login_user.id\n @toy.x, @toy.y = DesktopsHelper.find_empty_block(@login_user)\n @toy.save!\n end\n\n render(:partial => 'ajax_label', :layout => false)\n end",
"def label(rule, label, &block)\n ext(Label.new(label, rule), block)\n end",
"def create_item(index)\n item = @data[index]\n rect = item_rect(index)\n \n cLabel = CLabel.new(self, rect, item.name)\n \n return cLabel\n end",
"def label(label_name)\n @labels ||= []\n @labels << label_name.to_sym\n self\n end",
"def label=(value)\n @label = value\n end",
"def add_label(repo, label, color=\"ffffff\", options = {})\n post \"#{Repository.path repo}/labels\", options.merge({:name => label, :color => color})\n end",
"def label=(val)\n @label << val\n end",
"def create\n @task_label = TaskLabel.new(task_label_params)\n\n respond_to do |format|\n if @task_label.save\n format.html { redirect_to @task_label, notice: 'Task label was successfully created.' }\n format.json { render :show, status: :created, location: @task_label }\n else\n format.html { render :new }\n format.json { render json: @task_label.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_label(name, label_text, options = {})\n add_widget Tk::Tile::Label, name, label_text, options\n end",
"def label_tag(name = T.unsafe(nil), content_or_options = T.unsafe(nil), options = T.unsafe(nil), &block); end",
"def add_label(label)\n @api.do_request(\"PUT\", label.get_base_api_path() + \"/messages/\" + get('id'));\n @label_ids_set[label.id] = true\n end",
"def add_label(label)\n @api.do_request(\"PUT\", label.get_base_api_path() + \"/messages/\" + get('id'));\n @label_ids_set[label.id] = true\n end",
"def label(label = nil)\n @label = label if label\n @label\n end",
"def label(lname)\n $labels[lname] = $iptr\nend",
"def set_label label\n # added case for user just using a string\n case label\n when String\n # what if no form at this point\n @label_unattached = true unless @form\n label = Label.new @form, {:text => label}\n end\n @label = label\n # in the case of app it won't be set yet FIXME\n # So app sets label to 0 and t his won't trigger\n # can this be delayed to when paint happens XXX\n if @row\n position_label\n else\n @label_unplaced = true\n end\n label\n end",
"def generate_label\n self.label||= SecureRandom.urlsafe_base64(nil, false)\n end",
"def <<( n )\n n.add_label!( self )\n end",
"def OPRLabel(text:)\n {\n type: \"label\",\n text: text\n }\nend",
"def set_label(l); end",
"def label=(label)\n write_attr :label, label\n end",
"def create\n @group_label = GroupLabel.new(params[:group_label])\n\n respond_to do |format|\n if @group_label.save\n format.html { redirect_to @group_label, notice: 'Group label was successfully created.' }\n format.json { render json: @group_label, status: :created, location: @group_label }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group_label.errors, status: :unprocessable_entity }\n end\n end\n end",
"def label label = nil\n @label = label if label\n @label\n end",
"def label=(label)\n write_attr :label, label\n end",
"def add_label(label, color = 'ffffff')\n @repo ||= pr_json.base.repo.full_name\n @number ||= pr_json.number\n api.update_label(@repo, label, color: color)\n api.add_labels_to_an_issue(@repo, @number, Array(label))\n end",
"def create\n @question_label = QuestionLabel.new(question_label_params)\n\n respond_to do |format|\n if @question_label.save\n format.html { redirect_to @question_label, notice: 'Question label was successfully created.' }\n format.json { render :show, status: :created, location: @question_label }\n else\n format.html { render :new }\n format.json { render json: @question_label.errors, status: :unprocessable_entity }\n end\n end\n end",
"def l(text=\"\", name=\"\")\n JLabel.new(text) #.tap{|jl| jl.name = name }\n end",
"def add_label(card_id, color, options = {})\n create_card_resource(card_id, \"labels\", options.merge(color: color))\n end",
"def titleLabel(unLabel)\n label = Gtk::Label.new()\n label.set_markup(\"<span size='25000' >\" + unLabel.to_s + \"</span>\")\n return label\n end",
"def titleLabel(unLabel)\n label = Gtk::Label.new()\n label.set_markup(\"<span size='25000' >\" + unLabel.to_s + \"</span>\")\n return label\n end",
"def titleLabel(unLabel)\n label = Gtk::Label.new()\n label.set_markup(\"<span size='25000' >\" + unLabel.to_s + \"</span>\")\n return label\n end",
"def label(x, y, text, attributes = nil)\n %[<text font-size=\"#{FONT_SIZE}\" font-family=\"Verdana\" fill=\"#333333\" text-anchor=\"middle\" x=\"#{x}\" y=\"#{y + FONT_SIZE / 2}\"#{' ' + attributes if attributes}>#{text}</text>\\n]\n end",
"def create\n @post_label = PostLabel.new(params[:post_label])\n\n respond_to do |format|\n if @post_label.save\n format.html { redirect_to @post_label, notice: 'Post label was successfully created.' }\n format.json { render json: @post_label, status: :created, location: @post_label }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post_label.errors, status: :unprocessable_entity }\n end\n end\n end",
"def label\n <<-HTML\n\n <label id=\"#{label_id}\" class=\"string #{label_classes}\">#{attribute_name.to_s.titleize}</label>\n HTML\n end",
"def label; end",
"def label; end",
"def new_password_label()\n\t\t# unit_test_no_generate: new_password_label, label.className(create_ats_regex_string(\"ats-newpwdlbl\"))\n\t\t$tracer.trace(__method__)\n\t\treturn ToolTag.new(label.className(create_ats_regex_string(\"ats-newpwdlbl\")), __method__)\n\tend",
"def name label\n label(label)\n end",
"def add_label(coords)\n add_post_command(coords)\n end",
"def label_name\n \n \"#{nombre_etiqueta}\"\n \n end",
"def create\n @glossary_label = GlossaryLabel.new(glossary_label_params)\n\n respond_to do |format|\n if @glossary_label.save\n format.html { redirect_to @glossary_label, notice: 'Glossary label was successfully created.' }\n format.json { render :show, status: :created, location: @glossary_label }\n else\n format.html { render :new }\n format.json { render json: @glossary_label.errors, status: :unprocessable_entity }\n end\n end\n end",
"def addr(address, type = 1)\n Label.new address, type\n end",
"def label\n @label || \"unknown\"\n end",
"def create_cue_label \n @create_cue_label = UILabel.alloc.initWithFrame(CGRectNull).tap do |label|\n label.textColor = UIColor.whiteColor\n label.font = UIFont.boldSystemFontOfSize(32.0)\n label.backgroundColor = UIColor.clearColor\n end\n end",
"def label=(new_label)\n super(new_label)\n super(self.label[0, 255])\n end",
"def build_label(text)\n shading = false\n\n label = Magick::Image.new(@options[:width], @options[:height])\n image = Magick::Draw.new\n image.gravity = Magick::CenterGravity\n image.pointsize = @options[:width] / 4\n image.font = 'Helvetica'\n image.font_weight = Magick::NormalWeight\n image.stroke = 'none'\n image.annotate(label, 0, 0, 0, 0, text)\n label = label.shade(shading, 310, 30)\n\n return label\n end",
"def to_s; \"<Label: #{@name}>\"; end",
"def create\n @labelling = Labelling.new(params[:labelling])\n\n respond_to do |format|\n if @labelling.save\n format.html { redirect_to @labelling, notice: 'Labelling was successfully created.' }\n format.json { render json: @labelling, status: :created, location: @labelling }\n else\n format.html { render action: \"new\" }\n format.json { render json: @labelling.errors, status: :unprocessable_entity }\n end\n end\n end",
"def label(content = nil, **attributes)\n pagebuilder_basic_element('label', content, attributes)\n end",
"def create\n @label = @project.labels.build(params[:label])\n @label.save\n\n respond_with(@label) do |format|\n format.pjax { render @label, :locals => { :issue => nil } }\n end\n end",
"def initialize(name)\n raise LabelError, 'Label name must be a symbol' unless name.instance_of? Symbol\n\n @name = name\n end",
"def update_label(payload)\n return unless payload[:label]\n label = Hubstats::Label.first_or_create(payload[:label])\n if payload[:github_action] == 'labeled'\n labels << label\n elsif payload[:github_action] == 'unlabeled'\n labels.delete(label)\n end\n labels\n end",
"def initialize_or_create_labels(labels)\n @post.labels = []\n labels.split(\",\").map { |i| i.strip }.uniq.each do |name|\n label = Label.find_or_initialize_by(name: name.strip)\n label.save!\n @post.labels << label\n end\n end",
"def label(rule, label, &block)\n rule = ext(rule, block)\n rule.label = label\n rule\n end",
"def set_label\n @label = Label.find(params[:id])\n end",
"def set_label\n @label = Label.find(params[:id])\n end",
"def label=(label)\n @label = label.to_sym\n end",
"def label=(label)\n @label = label.to_sym\n end",
"def new_vertex(label)\n\t\ttmp=MyVertex.new\n\t\ttmp.label=label\n\n\t\t# We should add some descriptive hash here\n\t\t@Hash[label] = @Vertices.length\n\t\treturn tmp\n\tend",
"def handle_label(label, lineno_column)\n Literal.new label[0..-2].to_sym\n end",
"def label\n end",
"def add_label( n, primary=:false )\n raise InvalidNodeError.new('given node is not a node') unless n.class.respond_to?(:acts_as_node)\n return false if !can_write? and !new_record?\n return false if n.id == id\n return false if n.ancestors.map{ |a| a.id }.include?(id)\n label_arr = get_label_arr\n label_arr.delete(n_field(n))\n if primary == :primary\n label_arr = [n_field(n)]+label_arr\n else\n label_arr << n_field(n)\n end\n self.label_node_ids = label_arr.join(',')\n n.acl.each_pair{ |k,ace| share( ace.user, ace.privileges ) }\n true\n end",
"def change_label_text_to(name)\n @label.text = name\n end",
"def new_vertex(label, value)# - Insert a new isolated vertex into graph G\n $label << \"#{value}\";\n end",
"def to_label\n \"#{label}\"\n end",
"def label(name)\n @labels[name.to_sym]\n end",
"def add_label(project_name, repository_name, reference, label, opts = {})\n add_label_with_http_info(project_name, repository_name, reference, label, opts)\n nil\n end",
"def label_name=(label_name)\n @label_name = label_name.to_sym\n end",
"def create\n @post = Post.new(post_params)\n if @post.save\n new_label(@post)\n else\n render :new\n end\n end",
"def initialize(label, values)\n @label = label\n @name = label.name\n @values = values\n @formats = Formats.new\n @drawings = Drawings.new\n\n add_commands(values)\n end",
"def initialize(name)\n @instr_type = LABEL_HOME\n @label_name = name \n @label_addr = UNINITIALIZED\n end",
"def label(attribute_name, *args); end",
"def create\n @applied_label = AppliedLabel.new(applied_label_params)\n\n respond_to do |format|\n if @applied_label.save\n format.html { redirect_to @applied_label, notice: 'Applied label was successfully created.' }\n format.json { render :show, status: :created, location: @applied_label }\n else\n format.html { render :new }\n format.json { render json: @applied_label.errors, status: :unprocessable_entity }\n end\n end\n end",
"def quick_label(how, what)\n QuickLabel.new(self, how, what, parent_widget, window_id, :label)\n end",
"def create_texts\n self.title = I18n.t(:tictactoe)\n @new_btn.label = I18n.t(:new_game)\n @quit_btn.label = I18n.t(:quit)\n @default_size_btn.label = I18n.t(:default_size)\n end",
"def name\n label\n end"
] | [
"0.75013953",
"0.71534044",
"0.7140698",
"0.7057874",
"0.7035276",
"0.6994237",
"0.69415545",
"0.6875589",
"0.68751764",
"0.68545467",
"0.6725328",
"0.672352",
"0.6695129",
"0.66658825",
"0.6658846",
"0.66065925",
"0.6557896",
"0.65385735",
"0.64709044",
"0.6469384",
"0.64668244",
"0.6462614",
"0.6447241",
"0.6438581",
"0.64240354",
"0.64058536",
"0.63706344",
"0.6354726",
"0.63525915",
"0.63475657",
"0.6326832",
"0.6320218",
"0.63050705",
"0.624168",
"0.62304205",
"0.6211673",
"0.6211673",
"0.6188286",
"0.616684",
"0.61529464",
"0.6144699",
"0.61119944",
"0.61081636",
"0.6107656",
"0.61064345",
"0.61018646",
"0.60905445",
"0.60837036",
"0.60748416",
"0.6061558",
"0.6058508",
"0.60530144",
"0.6020378",
"0.6020378",
"0.6020378",
"0.6009073",
"0.6003063",
"0.59980416",
"0.5996069",
"0.5996069",
"0.59869814",
"0.5977296",
"0.5975807",
"0.5973636",
"0.59692466",
"0.5960595",
"0.5945596",
"0.5925901",
"0.59215033",
"0.5918784",
"0.59159744",
"0.59133446",
"0.589294",
"0.58674264",
"0.5866305",
"0.58509445",
"0.5837843",
"0.5835915",
"0.5833185",
"0.5833185",
"0.5832649",
"0.5832649",
"0.5825772",
"0.58108056",
"0.58078766",
"0.5805044",
"0.5794599",
"0.57937115",
"0.57934743",
"0.5789583",
"0.5774672",
"0.5767189",
"0.57666653",
"0.57648253",
"0.576011",
"0.57597256",
"0.57583493",
"0.57525986",
"0.575211",
"0.57498986"
] | 0.7503175 | 0 |
Subscribes the user to a label to receive notifications | def subscribe_to_label(project, name)
post("/projects/#{url_encode project}/labels/#{url_encode name}/subscribe")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subscribe!\n # TODO: Implement\n end",
"def subscribe_to_group_label(group, name)\n post(\"/groups/#{url_encode group}/labels/#{url_encode name}/subscribe\")\n end",
"def subscribe\n \nend",
"def subscribe\n @bot.get_updates(fail_silently: true) do |message|\n parser = InputParser.new(message.text)\n subject = parser.parse_subject\n if subject != nil\n response = \"Hello #{subject}, I'm dad.\"\n message.reply do |reply|\n reply.text = response\n reply.send_with(@bot)\n end\n end\n end\n end",
"def do_subscribe\n subscribe_to(@nodename)\n get_subscriptions\n end",
"def subscribed; end",
"def subscribed # :doc:\n # Override in subclasses\n end",
"def add_label(label)\n @api.do_request(\"PUT\", label.get_base_api_path() + \"/messages/\" + get('id'));\n @label_ids_set[label.id] = true\n end",
"def add_label(label)\n @api.do_request(\"PUT\", label.get_base_api_path() + \"/messages/\" + get('id'));\n @label_ids_set[label.id] = true\n end",
"def subscribe_to_channel; end",
"def subscribe_notifications\n @subscribe_notifications ||= true\n end",
"def subscribe\n CampaignMonitorWrapper.subscribe(id: user.id, email: user.email, name: user.name, beta: user.beta?.to_s, billable: user.billable?.to_s)\n end",
"def subscribe\n self.subscribed = true\n end",
"def prompt_subscribe\n @proceed = true\n @previous_command = '/subscribe'\n handle\n end",
"def handle_subscribe\n\n @user = User.find(params[:user_id])\n current_user.follow(@user)\n\n #update the subscribe button using AJAX\n respond_to do |format|\n format.js { render :file => 'users/handle_sub_unsub.js.erb' }\n end\n\n #notify the user when someone subscribes to them\n @user.notifications.create(description:\"has subscribed to your memes!\", from_user_id: current_user.id)\n\n end",
"def o_ucount_notify\n User.bot.lobby_speak(\"#{linked_name}さんが本日#{today_total_o_ucount}問解きました\")\n end",
"def notify activity\n\n # people who are subscribed to the tags of the question\n t_subscribers = target.subscribers.all\n\n (t_subscribers).each do |subscriber|\n Notification.create :user => subscriber, :activity => activity\n end\n end",
"def on_subscription_success\n end",
"def subscribe(prefix = EVERYTHING)\n ffi_delegate.set_subscribe(prefix)\n end",
"def fire(event)\n\t\tevent.add_labels(self.labels) unless self.labels.empty?\n\t\t# send any notifications\n\tend",
"def subscribe(args = {})\n :no_response\n end",
"def display_subscribed(event, subscription)\n \"subscribe(#{event}) by #{subscription_location(subscription)}\"\n end",
"def subscribe(&blk)\n pres = connection.presence_stanza('to'=>jid.bare, 'type' => 'subscribe')\n connection.send_stanza pres, &blk\n end",
"def subscribe\n @conn.send_data :opcode => SUBSCRIBE, :channel => @name\n @subscribe_sent = true\n end",
"def notify_receiver\n conversation = ConversationBlueprint.render_as_json(self, view: :normal)\n ActionCable.server.broadcast \"user_#{ self.user_two_id }_notification_channel\", conversation\n end",
"def create_notification\n subject = \"#{student_request.name} \"\n body = \"#{student_request.name} (#{student_request.email}) needs tutorial.\"\n tutor_request.notify(subject, body, self)\n end",
"def subscribe\n \n @conversation.subscriptions << @user unless @conversation.subscriptions.exists?(@user.id)\n @notice = \"You will now receive email notifications about new replies in this conversation.\"\n \n respond_to do |format|\n format.html {\n redirect_to(@conversation, notice: @notice) and return\n return \n }\n format.js\n end\n\n end",
"def receive_subject\n subjects = @subjects.keys.\n map { |subject| button(subject) }.\n join(\"\\n\")\n subject = ask(\"Что сдавал?\\n#{subjects}\")\n check_exist_subject(subject)\n end",
"def subscribe\n debug [self.name, \"incoming\"]\n subscribe_request\n end",
"def register_callback(label)\n @callbacks << label unless @callbacks.include?(label) || label == 'application'\n end",
"def after_subscribe(subscribed)\n # not required\n end",
"def new_subscription(user, subscribable)\n @user = user \n @subscribable = subscribable \n\n mail to: user.email, subject: \"Subscribed to #{subscribable.name} Updates\"\n end",
"def send_notification(message, title = nil, url = nil, label = nil)\n response = JSON.parse(User.notifo.send_notification(self.username, message, title, url, label))\n if response[\"response_code\"] == Pachube::NOTIFO_OK\n # increment global counters\n db.transaction do\n db[:statistics].filter(:id => 1).update(:monthly_count => :monthly_count + 1, :total_count => :total_count + 1)\n # increment count on user record\n db[:users].filter(:username => self.username).update(:message_count => :message_count + 1, :monthly_message_count => :monthly_message_count + 1)\n end\n end\n response\n end",
"def request!\n self.type = :subscribe\n reply_if_needed!\n end",
"def subscribe_to_newsletter\n SubscribeToNewsletterService.new(self).call\n end",
"def push_subscription(object)\n local_server.subscribe(object)\n synchro_point\n end",
"def subscribeTo (event)\r\n @subscribedEvents.add(event)\r\n end",
"def pubsub; end",
"def notify_user user_id, message\n\n\t\tmsg = \"Hello PubNub, love the Ruby SDK\"\n\t\tchannel = \"demo\"\n\n\t \tpubnub.publish(:message => msg, :channel => channel) do |envelope|\n\t\t\tputs envelope.message\n\t\t\tputs envelope.channel\n\t\t\tputs envelope.status_code\n\t\t\tputs envelope.timetoken\n\t\tend\n\n\t\tputs \"#{channel_prefix + user_id}\"\n\tend",
"def label\n raise \"Label provider key :label must be set to produce the text of the message!\" unless @data[:label]\n @data[:label]\n end",
"def subscribe_owner\n\t subscription = owner.subscribe_to(activity_feed)\n\t subscription.save\n\t end",
"def IsSubscribed=(arg0)",
"def IsSubscribed=(arg0)",
"def subscribed\n \t#stream_from 'demo_chan'\n end",
"def notify activity\n\n # people who are subscribed directly to the question\n q_subscribers = self.subscribers.all\n\n # people who are subscribed to the tags of the question\n t_subscribers = self.tag_subscribers.all\n\n (q_subscribers + t_subscribers).each do |subscriber|\n Notification.create :user => subscriber, :activity => activity\n end\n end",
"def notification\n user = User.first\n comic = Comic.first\n SubscriptionMailer.notification(work: comic, user: user)\n end",
"def after_registration\n send_pending_messages\n end",
"def subscribe(&onMessage) # block\n end",
"def send_notifications\n end",
"def notifications\n end",
"def subscribe_link(tag)\n whether_hidden = current_user.subscribed?(tag) ? \" hidden\" : \"\";\n link_to_remote t(\"winnow.tags.main.subscribe\"),\n :url => subscribe_tag_path(tag),\n :method => 'put',\n :html => {\n :title => t(\"winnow.tags.main.subscribe_tooltip\", :tag => tag.name),\n :class => \"subscribe\" + whether_hidden,\n :id => dom_id(tag, 'subscribe')\n }\n end",
"def old_notify_user (listing, sender, receiver)\n send_as :notification\n from sender.facebook_session.user \n recipients receiver.facebook_session.user\n #fbml \"<a href='#{FB_APP_HOME_URL}/listings/#{listing.id}'><b>#{listing.title}</b></a> has been approved.\"\n fbml \"Your listing: <a href='#{listings_path(listing.id)}}'><b>#{listing.title}</b></a> has been approved.\"\n end",
"def subscribe\n @subscription.subscribe(with_email_subscription: params[:with_email_subscription].to_s.to_boolean(ActivityNotification.config.subscribe_to_email_as_default),\n with_optional_targets: params[:with_optional_targets].to_s.to_boolean(ActivityNotification.config.subscribe_to_optional_targets_as_default))\n return_back_or_ajax\n end",
"def name\n\t\t\t\t\"notify\"\n\t\t\tend",
"def name\n\t\t\t\t\"notify\"\n\t\t\tend",
"def send_notification\n\n\n end",
"def subscribe(*args, &blk)\n (@client ||= connect).subscribe(*args, &blk)\n end",
"def unsubscribe_from_label(project, name)\n post(\"/projects/#{url_encode project}/labels/#{url_encode name}/unsubscribe\")\n end",
"def subscribe(subscription)\n @pipe.send_strings [\"subscribe\", subscription]\n end",
"def subscribe(_topic, **)\n raise 'not implemented'\n end",
"def name\n\t\t\t\"notify\"\n\t\tend",
"def name\n\t\t\t\"notify\"\n\t\tend",
"def get_subscription_button(f)\n\t\tif !current_teacher.subscribed_to?(@teacher.id)\n\t\t\t#return \"Subscribe to #{@teacher.full_name}\"\n\t\t\tf.submit \"Subscribe to #{@teacher.full_name}\", :confirm => 'Are you sure?'\n\t\telse\n\t\t\t#return \"Unsubscribe from #{@teacher.full_name}\"\n\t\t\tf.submit \"Unsubscribe from #{@teacher.full_name}\", :confirm => 'Are you sure?'\n\t\tend\n\tend",
"def subscribe(data)\n # @channels (local tracker)\n # push channel name into subscribe list, if and only if not already in subscribe list\n end",
"def signup_notification(user)\n setup_email(user)\n @subject += I18n.t 'mailer.signup.subject'\n \n @body[:url] = \"http://www.dripplet.com/#{user.locale}/activate/#{user.activation_code}\"\n \n end",
"def subscribe\n if params[:signup][:email_address].present?\n email = params[:signup][:email_address].gsub(/\\s/, '').downcase\n list_id = params[:signup][:list_id]\n\n begin\n Klaviyo.subscribe(email, list_id, request.referer)\n @message = I18n.translate('form.success.subscribe')\n @success = true\n rescue Error => e\n @message = e.detail.to_s\n @success = false\n end\n else\n @message = I18n.translate('form.missing.email')\n @success = false\n end\n end",
"def listen_on(channel)\n sns.subscribe(\n topic_arn: channel.arn,\n protocol: 'application',\n endpoint: channel.endpoint\n )\n end",
"def subscribe_to_channel\n run_callbacks :subscribe do\n subscribed\n end\n\n reject_subscription if subscription_rejected?\n ensure_confirmation_sent\n end",
"def notify_subscriber\n @greeting = \"Hi\"\n mail to: \"thanhquang1988@gmail.com\"\n end",
"def subscribe(url)\n subscribed_feed = UrlSubscriber.subscribe url, self\n end",
"def new_signup_notification\n user = User.first\n UserMailer.new_signup_notification(user, \"x.x.x.x (aprox y)\")\n end",
"def subscribed\n super\n increase_current_users\n stream_from channel\n end",
"def notify_subscribers\n NotificationSubscription.notify(self)\n end",
"def update_label(payload)\n return unless payload[:label]\n label = Hubstats::Label.first_or_create(payload[:label])\n if payload[:github_action] == 'labeled'\n labels << label\n elsif payload[:github_action] == 'unlabeled'\n labels.delete(label)\n end\n labels\n end",
"def label_status_inscription(participant)\n if participant.pending?\n '<span class=\"label label-warning\">Inscrição enviada para aprovação</span>'.html_safe\n elsif participant.failed?\n '<span class=\"label label-danger\">Sua inscrição foi recusada</span>'.html_safe\n elsif participant.approved?\n '<span class=\"label label-success\">Inscrição aprovada</span>'.html_safe\n end\n end",
"def notify!\n\n Alert.alert!(target, self, \"create\")\n\n # alert = Alert.create!(\n # user: target,\n # target: self,\n # text: \"Feedback received from #{self.user.name}\",\n # read_link: \"/app/main/feedbacks/show/#{id}\"\n # )\n\n # # Create notifications for the sender and receiver -> will appear in timeline\n # Notification.create!(\n # user_id: user.id, target: self,\n # notify: false,\n # unread: false\n # )\n # Notification.create!(\n # user_id: target.id, target: self,\n # notify: true,\n # unread: true\n # )\n\n end",
"def subscribe(name, params, &blk)\n id = self.next_id()\n self.send({msg: 'sub', id: id, name: name, params: params})\n\n @subs[name] = id\n @callbacks[id] = blk\n end",
"def send_ready_notification\n\n end",
"def notify_subscription_created(email)\n @email = email\n mail to: email, subject: 'Your subscription confirmation'\n end",
"def subscribe\n\t\t@subject = Subject.find_by_name(params[:name])\n\t\t@customer = current_user.customer\n\t\t@customer.subjects << @subject\n\t\tflash[:success] = \"You have subscribed to #{@subject.name}.\"\n\t\tredirect_to root_url\n\tend",
"def subscribe(course)\n subscribeds << course\n end",
"def call(message)\n ids = @course.enrols.select(:user_id) .pluck(:user_id)\n ids.each do |id|\n ::Notification.create(user_id: 1, target_id: id, message: message)\n end\n true\n end",
"def notify(msg, subject)\n end",
"def growl(title,text='',url='')\n if text == ''\n text = title\n title = ''\n end\n\n #{Script_path}/growlnotify -t \"#{title}\" -m \"#{text}\"`\n\n growlapp = Appscript.app('Growl')\n growlapp.register({:as_application=>'Researchr', :all_notifications=>['Note'], :default_notifications=>['Note']})\n growlapp.notify({:with_name=>'Note',:title=>title,:description=>text,:application_name=>'Researchr', :callback_URL=>url})\nend",
"def subscriber( name )\n raise NotImplementedError, \"please implement 'subscriber'\"\n end",
"def subscribed\n stream_from channel_name\n end",
"def subscribe_to_channel(*)\n synchronize_entrypoint! { super }\n end",
"def subscribe\n @player.subscribe(self)\n end",
"def notify(type,subject,target=nil)\n self.notices.create :type => type, :subject => subject, :target => target\n end",
"def subscribe(*addresses, &block)\n reactive.subscribe(*addresses, &block)\n end",
"def message\n \"You have a new notification!\"\n end",
"def subscribe(prefix)\n setsockopt :subscribe, prefix\n end",
"def notify_user(ad)\n #create notification for the user\n notification = self.notifications.unviewed.event(:new_relevant_ad).new\n notification.user = self.user\n notification.ad = ad\n notification.save!\n end",
"def click_on_label_for(label)\n find(:xpath, \"//label[@for='#{label}']\").click\n end",
"def update_newsletter_subscription!\n return unless self.user.present?\n\n if self.receives_newsletter?\n NewsletterSubscriptionsWorker.perform_async(:subscribe, self.user.email)\n else\n NewsletterSubscriptionsWorker.perform_async(:unsubscribe, self.user.email)\n end\n end",
"def set_Notify(value)\n set_input(\"Notify\", value)\n end",
"def label=(value)\n @label = value\n end",
"def subscribe_to_newsletter\n # SubscribeUserToMailingListJob.perform_now(params[:email]);\n\n gb = Gibbon::Request.new\n\n list_id = ENV[\"MAILCHIMP_LIST_ID\"]\n\n gb.lists(list_id)\n .members\n .create(body: { email_address: params[:email], status: \"subscribed\"})\n\n render_success(\"Successfully Subscribed\")\n end",
"def subscribe_to_podcast(url)\n @ole.SubscribeToPodcast(url)\n end",
"def labels= new_labels\n raise ArgumentError, \"Value must be a Hash\" if new_labels.nil?\n update_grpc = Google::Cloud::PubSub::V1::Topic.new name: name, labels: new_labels\n @grpc = service.update_topic update_grpc, :labels\n @resource_name = nil\n end"
] | [
"0.63506544",
"0.62950766",
"0.601759",
"0.60003644",
"0.5977762",
"0.59768397",
"0.5948324",
"0.5934377",
"0.5934377",
"0.5893909",
"0.58407027",
"0.5835649",
"0.57620066",
"0.574103",
"0.5732175",
"0.5712805",
"0.56882906",
"0.56356305",
"0.5599611",
"0.5559095",
"0.555835",
"0.5532387",
"0.5523728",
"0.5518127",
"0.55150795",
"0.54884857",
"0.54799247",
"0.5477839",
"0.5476993",
"0.5438328",
"0.54310757",
"0.53838575",
"0.53833646",
"0.5370665",
"0.5358436",
"0.535537",
"0.53524536",
"0.53490204",
"0.5341396",
"0.53413355",
"0.5327591",
"0.53218484",
"0.53218484",
"0.53210866",
"0.5318374",
"0.5316804",
"0.53139",
"0.5305975",
"0.529755",
"0.52960753",
"0.528499",
"0.52777743",
"0.52743757",
"0.52691656",
"0.52691656",
"0.5269082",
"0.5254456",
"0.5242187",
"0.5237374",
"0.5236336",
"0.5236055",
"0.5236055",
"0.5232586",
"0.5214548",
"0.52034277",
"0.52019984",
"0.51777536",
"0.5174888",
"0.51721555",
"0.51671237",
"0.516572",
"0.51562333",
"0.5155653",
"0.5149448",
"0.51462907",
"0.5141942",
"0.5138313",
"0.51371104",
"0.5133261",
"0.51322174",
"0.51313347",
"0.5131018",
"0.5129964",
"0.5129382",
"0.51256377",
"0.5125466",
"0.51203865",
"0.51192856",
"0.51105833",
"0.5100993",
"0.51008034",
"0.5096855",
"0.5074067",
"0.50733095",
"0.5073057",
"0.50705266",
"0.50691134",
"0.50672436",
"0.5060321",
"0.50574976"
] | 0.6934015 | 0 |
Unsubscribes the user from a label to not receive notifications from it | def unsubscribe_from_label(project, name)
post("/projects/#{url_encode project}/labels/#{url_encode name}/unsubscribe")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unsubscribed\n end",
"def unsubscribed\n end",
"def unsubscribed # :doc:\n # Override in subclasses\n end",
"def unsubscribe()\n end",
"def unsubscribed\n\tend",
"def unsubscribe; end",
"def unsubscribe()\n \n end",
"def unsubscribe\n end",
"def unsubscribed; end",
"def unsubscribed\n @attributes[:unsubscribed]\n end",
"def unsubscribed\n puts \"#{current_user.displayname} left!\"\n end",
"def unsubscribed\n # This will broadcast that user unsubscribed but the frontend will not receive the final broadcast\n p '**** ChatChannel unsubscribed'\n notification = {notification: 'User X has dropped off'}\n # ActionCable.server.broadcast(params[:room], notification)\n send_broadcast(params[:room], notification)\n end",
"def unsubscrible\n NewsletterMailer.unsubscrible\n end",
"def unsubscribe!\n self.type = :unsubscribe\n reply_if_needed!\n end",
"def unsubscribed\n if current_user.is_a?(User)\n\n # if @userType == \"known\"\n ActionCable.server.broadcast \"AppearanceChannel\", { user: current_user.email, user_id: current_user.id, online: :off }\n # else\n # reject\n end\n # stop_all_streams\n # Any cleanup needed when channel is unsubscribed\n end",
"def unsubscribe(source)\n #TODO\n end",
"def unsubscribe_from_channel; end",
"def unsubscribe_from_group_label(group, name)\n post(\"/groups/#{url_encode group}/labels/#{url_encode name}/unsubscribe\")\n end",
"def unsubscribe\n unregister\n end",
"def unsubscribeTo (event)\r\n @subscribedEvents.delete?(event)\r\n end",
"def mark_unsubscribed!\n return unless with_states?\n # todo: move to callback\n user.unsubscribe! if user.subscribed?\n end",
"def unsubscribe(name)\n id = @subs[name]\n\n self.send(msg: 'unsub', id: id)\n end",
"def unsubscribed\n User.find(current_user.id).update(online: false)\n ActionCable.server.broadcast(\n 'appearance_channel',\n user_id: current_user.id,\n is_online: false\n )\n end",
"def unsubscribe\n @entry.subscribers.delete(current_user)\n end",
"def unsubscribe\n @conn.send_data :opcode => UNSUBSCRIBE, :channel => @name\n end",
"def unsubscribe\n CampaignMonitorWrapper.unsubscribe(user.email)\n end",
"def remove_label(label)\n @api.do_request(\"DELETE\", label.get_base_api_path() + \"/messages/\" + get('id'))\n if @label_ids_set.has_key?(label.id)\n @label_ids_set.delete(label.id)\n end\n end",
"def remove_label(label)\n @api.do_request(\"DELETE\", label.get_base_api_path() + \"/messages/\" + get('id'))\n if @label_ids_set.has_key?(label.id)\n @label_ids_set.delete(label.id)\n end\n end",
"def unsubscribe\n raise UnsubscribedError\n end",
"def unsubscribed\n @room.remove_user(current_user)\n\n # Inform the other players that this player has left.\n broadcast_users_changed\n end",
"def cancel!\n self.type = :unsubscribed\n reply_if_needed!\n end",
"def unsubscribe(msg)\n false\n end",
"def unsubscribe(user, target)\n user.personal_subscriptions.where(target_id: target.id, target_type: target.class).destroy_all\n end",
"def unsubscribe_notifications\n authorize resource\n redirect_to user_path(current_user, anchor: 'unsubscribes')\n end",
"def unsubscribe(prefix)\n ffi_delegate.set_unsubscribe(prefix)\n end",
"def successful_unsubscribe\n end",
"def unsubscribe(cls)\n @subscribers.delete(name)\n end",
"def unsubscribe\n return if self.hub.nil?\n\n change_subscription(:unsubscribe)\n end",
"def unsubscribes(options={})\n Resources::Unsubscribes.new(self, options)\n end",
"def unsubscribe2\n if Spree::Chimpy::Subscriber.where(email:self.email).first\n self.unsubscribe\n end\n end",
"def unsubscribed\n super\n # TODO: abort any pending lookup requests\n end",
"def unsubscribe(&blk)\n pres = connection.presence_stanza('to'=>jid.bare, 'type' => 'unsubscribe')\n connection.send_stanza pres, &blk\n end",
"def unsubscribe_sms\n if current_user\n current_user.update_notification_preference(:push) \n render :text => \"ok\"\n else\n render :text => \"unknown user\"\n end\n end",
"def unsubscribed\n stop_all_streams\n end",
"def unsubscribe!\n self.unsubscribed = true\n save\n end",
"def unsubscribe\n \n @conversation.subscriptions.delete(@user) if @conversation.subscriptions.exists?(@user.id)\n @notice = \"You will now no longer receive email notifications about new replies in this conversation.\"\n \n respond_to do |format|\n format.html {\n redirect_to(@conversation, notice: @notice) and return\n return \n }\n format.js\n end\n \n end",
"def unsubscribe_all\n send_action('unsubscribe_all')\n end",
"def unsubscribe(event)\n has_subscriptions.find_by(subscribed_id: event.id).destroy\n end",
"def unsubscribed\n location_id = params[:location_id].to_i\n @@locations_with_subscribers.delete(location_id)\n end",
"def unsubscribe\n user = User.where(email: params[:md_email]).first\n user.unsubscribe!\n\n redirect_to root_path, notice: t(\"unsubscribed\")\n end",
"def unsubscribe(*args)\n (@client ||= connect).unsubscribe(*args)\n end",
"def unsubscribe(source)\n Log.debug(\"Unsubscribing from #{source}\")\n @connection.unsubscribe(source)\n @subscriptions.delete(source)\n end",
"def unsubscribe(ident)\n @subscribers.delete(ident)\n end",
"def unsubscribe(subscribable)\n subscribable.unsubscribe(self)\n end",
"def unsubscribed?\n self.type == :unsubscribed\n end",
"def unsubscribe!\n message_class = whoami\n\n debug_me{[ :message_class ]}\n\n broker.unsubscribe!(message_class) if broker_configured?\n end",
"def unsubscribe\n user = Subscriber.find_by_unique_identifier(params[:id])\n user.update_attribute(:is_subscribed, false)\n user.save!\n render\n end",
"def on_unsubscribed(event, total)\n client.debug({context: :monitor, action: :punsubscribe, event: event, total: total}.to_json)\n end",
"def unsubscribe(course)\n subscribeds.delete(course)\n end",
"def unsubscribe(object)\n subscriptions.delete(remote_object(object))\n end",
"def unsub\n\t\tSubscription.unsubscribe(reason_number: 1, subscriber_id:@subscriber.id, subscribed_id: @subscribed.id)\n\t\tflash[:success] = t('mailer.payment.subscription.stopped_backing') + @subscribed.preferred_name\n\t\tredirect_to(:back)\n\trescue\n\t\tflash[:error] = t('errors.messages.not_saved')\n\t\tredirect_to(:back)\t\t\n\tend",
"def unsubscribe!\n @consumer.try(:cancel)\n @consumer = nil\n end",
"def unsub(user, tag = nil)\n raise \"Missing user\" unless user\n args = [\"user=#{user}\", (tag ? \"tag=#{tag}\" : nil)]\n get('/api/inbox/unsub?' << args.compact.join('&'))\n nil\n end",
"def unsub(user, tag = nil)\n raise Error, \"Missing user\" unless user\n args = [\"user=#{user}\", (tag ? \"tag=#{tag}\" : nil)]\n get('inbox/unsub?' << args.compact.join('&'))\n nil\n end",
"def unsubscribe!(reason = nil)\n update!(unsubscribed_at: ::Caffeinate.config.time_now, unsubscribe_reason: reason)\n\n caffeinate_campaign.to_dripper.run_callbacks(:on_unsubscribe, self)\n end",
"def unsubscribed\n @chatroom = Chatroom.find(params[:id])\n @chatroom.unsubscribe()\n end",
"def do_unsubscribe(subid)\n unsubscribe(@nodename,subid)\n end",
"def unsubscribe\n @subscription_reference.unsubscribe\n end",
"def unsubscribe_to_optional_target\n @subscription.unsubscribe_to_optional_target(params[:optional_target_name])\n return_back_or_ajax\n end",
"def unsubscribe\n check_subscribed!\n subscription.unsubscribe_from_channel\n end",
"def unsubscribe_from_channel # :nodoc:\n run_callbacks :unsubscribe do\n unsubscribed\n end\n end",
"def unsubscribe(name)\n EM.schedule { @subs.delete name }\n end",
"def unsubscribe\n\t\t@subject = Subject.find(params[:id])\n\t\t@customer = current_user.customer\n\t\t@customer.subjects.delete(@subject)\n\t\tflash[:success] = \"You have unsubscribed from #{@subject.name}.\"\n\t\tredirect_to root_url\n\tend",
"def remove(address_or_id)\n delete(\"#{domain}/unsubscribes/#{address_or_id}\")\n end",
"def create(params)\n params[:tag] ||= '*'\n post(\"#{domain}/unsubscribes\", params)\n end",
"def unsubscribe request\r\n return unless @requests.find{|req| req==request }\r\n synchronize do\r\n request.num_subscribes-=1\r\n @requests.delete request\r\n end \r\n end",
"def unsubscribe(email)\n # Raise an error to warn it isn't implemented.\n raise NotImplementedError.new\n end",
"def unsubscribe_to_email\n @subscription.unsubscribe_to_email\n return_back_or_ajax\n end",
"def unsubscribe\n @subscription.unsubscribe\n return_back_or_ajax\n end",
"def unsubscribed\n # Any cleanup needed when channel is unsubscribed\n stop_all_streams\n end",
"def unsubscribed\n # Any cleanup needed when channel is unsubscribed\n stop_all_streams\n end",
"def unsubscribe\n\t\t\t@update_timer.cancel if @update_timer\n\t\t\t@update_timer = nil\n\t\tend",
"def user_cleaned_hook(hook_data)\n unsubscribe_hook(hook_data)\n end",
"def unsubscribe_from_list(user, list)\n delete(\"/#{user}/#{list}/subscribers.json\")\n end",
"def unsubscribe(aSubscriber)\n subscribers.delete_if { |entry| entry == aSubscriber }\n end",
"def unsubscribe(subscriber)\n @subscriber = subscriber\n mail to: subscriber.email, subject: \"Unsubscribed from ML@B\"\n end",
"def stop_typing(_user)\n PubSub::Publisher.new.publish_for(user_participants.online.where.not(id: _user.id), 'stop_typing', {source: {id: id}, user: {id: _user.id}}, {foreground: true})\n end",
"def on_remove\n @context.notifications.off(\"graph.start\", self)\n @context.notifications.off(\"graph.stop\", self)\n\n io.outputs.each { |k, o| @context.connections.delete(o.guid) }\n io.unregister_inputs\n var.unregister\n stop\n end",
"def unsubscribe\n subscriptions.values.each(&:unsubscribe)\n @on_unsubscribe.call(self) if @on_unsubscribe\n end",
"def unsubscribe_from_comments user\n subscription = find_or_build_comment_subscription user\n subscription.subscribed = false\n subscription.save!\n end",
"def unsubscribe(feed)\n SubscriptionsManager.remove_subscription feed, self\n end",
"def unsubscribe_from(id)\n post(ROOT_URI + '/a/unsubscribe', 'stream' => id)\n end",
"def unsubscribe_from(id)\n post(ROOT_URI + '/a/unsubscribe', 'stream' => id)\n end",
"def unsubscribe(opts = {})\n\t\t\t# Default consumer_tag from subscription if not passed in\n\t\t\tconsumer_tag = subscription ? subscription.consumer_tag : opts[:consumer_tag]\n\t\t\t\n\t\t\t# Must have consumer tag to tell server what to unsubscribe\n\t\t\traise Bunny::UnsubscribeError,\n\t\t\t\t\"No consumer tag received\" if !consumer_tag\n\t\t\t\n # Cancel consumer\n client.send_frame( Qrack::Protocol09::Basic::Cancel.new(:consumer_tag => consumer_tag,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t:nowait => false))\n\n\t\t\tmethod = client.next_method\n\n\t\t\tclient.check_response(method,\tQrack::Protocol09::Basic::CancelOk,\n\t\t\t\t\"Error unsubscribing from queue #{name}\")\n\n\t\t\t# Reset subscription\n\t\t\t@subscription = nil\n\t\t\t\t\n\t\t\t# Return confirmation\n\t\t\t:unsubscribe_ok\n\t\t\t\n end",
"def unsubscribe(name, &block)\n @driver.unsubscribe(name, &block)\n end",
"def unsubscribe_from_notifications(client, collection)\n mirror = client.discovered_api('mirror', 'v1')\n result = client.execute(\n :api_method => mirror.subscriptions.delete,\n :parameters => { 'id' => collection })\n if result.error?\n puts \"An error occurred: #{result.data['error']['message']}\"\n end\n end",
"def unsubscribe(opt_max=nil)\n @nc.send(:unsubscribe, self, opt_max)\n end",
"def unsubscribe_request_hook(name)\n EasyPost::Hooks.unsubscribe(:request, name)\n end",
"def unsubscribe(event, *args, &block)\n raise HandlerError.new \"Unable to unsubscribe, there is no event #{event}\" unless events[event.to_sym]\n events[event.to_sym].unsubscribe(*args, &block)\n end",
"def unsubscribe\n unless unsubscribe = pubsub.find_first('ns:unsubscribe', :ns => self.class.registered_ns)\n self.pubsub << (unsubscribe = XMPPNode.new('unsubscribe', self.document))\n unsubscribe.namespace = self.pubsub.namespace\n end\n unsubscribe\n end"
] | [
"0.74282473",
"0.74282473",
"0.73546463",
"0.7275932",
"0.7241318",
"0.7214702",
"0.719606",
"0.7108885",
"0.7099188",
"0.6964429",
"0.6943778",
"0.6935913",
"0.68873686",
"0.6840175",
"0.68380415",
"0.67700136",
"0.67439806",
"0.67418534",
"0.6721957",
"0.67192537",
"0.66821194",
"0.6673023",
"0.66502374",
"0.66481715",
"0.6626962",
"0.6615672",
"0.66080624",
"0.66080624",
"0.6602386",
"0.6595119",
"0.65843946",
"0.6553627",
"0.6530757",
"0.65111744",
"0.6469372",
"0.64570534",
"0.6425815",
"0.6403239",
"0.6401925",
"0.6386382",
"0.6378728",
"0.63619715",
"0.6332466",
"0.63299763",
"0.6313804",
"0.6299636",
"0.62427986",
"0.62416244",
"0.62246805",
"0.62241244",
"0.6207982",
"0.6165807",
"0.61525756",
"0.6151052",
"0.61314976",
"0.6126861",
"0.6121057",
"0.6115028",
"0.6113301",
"0.60919493",
"0.6083041",
"0.60821056",
"0.6075151",
"0.6042955",
"0.60269254",
"0.6017566",
"0.60032314",
"0.5999531",
"0.5993855",
"0.59679276",
"0.59676206",
"0.5957123",
"0.5951829",
"0.5950548",
"0.5947018",
"0.5929528",
"0.59179366",
"0.59169954",
"0.59164155",
"0.5914002",
"0.5914002",
"0.5913641",
"0.5901898",
"0.5890297",
"0.58813536",
"0.5875575",
"0.5873507",
"0.5865104",
"0.5861325",
"0.58602184",
"0.5859717",
"0.5856045",
"0.5856045",
"0.5836821",
"0.5832157",
"0.58254975",
"0.58215195",
"0.5811446",
"0.5784795",
"0.576156"
] | 0.7034383 | 9 |
GET /jobs GET /jobs.xml | def index
@jobs = Job.by_department.paginate(:page => params[:page], :per_page => current_user.preferred_items_per_page)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @jobs }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def jobs\n doc = Nokogiri::XML open(@url)\n\n doc.search('//job').map { |node|\n Job.new(attributes_from(node))\n }\n end",
"def index\n @jobs = Job.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jobs }\n end\n end",
"def getJobApi (options)\n uri = options[:job] + \"?depth=\" + options[:depth].to_s\n job_uri = URI.parse(uri)\n http = Net::HTTP.new(job_uri.host, job_uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(job_uri.request_uri)\n request.basic_auth @username, @password\n response = http.request(request)\n job_xml=XmlSimple.xml_in(response.body)\n return job_xml\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jobs }\n end\n end",
"def index\n @jobtimes = current_company.jobtimes.find_all_by_job_id(params[:job_id])\n respond_to do |format|\n format.xml {render :xml => @jobtimes }\n format.json { render :json => @jobtimes }\n end\n end",
"def index\n @jobs = Job.find(:all, :conditions => params_to_conditions(params), :order => \"id\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jobs }\n end\n end",
"def show\n @job = Job.find(params[:id])\n @tasks = @job.tasks\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def find_jobs(params:)\n response = HTTParty.get(\"#{@host}/api/jobs\", query: params)\n\n return response[\"jobs\"] \n end",
"def get_jobs_sample(client)\n response = client['jobs'].get\n\n p ''\n p 'Get jobs'\n p response\nend",
"def getCurrentJobs\n getJobs('0/')\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def index\n @nodes = @job.nodes.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nodes }\n format.json { render :json => @nodes }\n end\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @job.to_xml }\n end\n end",
"def index\n @jobs = Job.paginate :page => params[:page], :order => 'created_at DESC', :per_page =>10\n @job = Job.find(:last)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jobs }\n format.json { render :json => @jobs }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @jobs_queue }\n end\n end",
"def job\n fetch('games.final_fantasy_xiv.jobs')\n end",
"def index\n @jobs = Job.all\n end",
"def index\n @jobs = Job.all\n end",
"def index\n @jobs = Job.all\n end",
"def index\n @jobs = Job.all\n end",
"def index\n @jobs = Job.all\n end",
"def index\n @jobs = Job.all\n end",
"def index\n @jobs = Job.all\n end",
"def index\n @job_requests = JobRequest.all\n end",
"def show\n @job_status = JobStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job_status }\n end\n end",
"def index\n respond_to do |format|\n format.html { @jobs_queues = JobsQueue.get_jobs_queues(current_user, params) }\n format.xml { render :xml => JobsQueue.get_jobs_queues(current_user, params.merge({:show => 'all'})) }\n end\n end",
"def listjobs(project=self.project)\n get('listjobs.json', project: project).reject{|k,v| k=='status'}\n end",
"def index\n @job_items = @job.job_items.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @job_items }\n end\n end",
"def jobs\n\t\t# ...\n\tend",
"def show\n @job = Job.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job.to_xml(:include => { :job_parameters => { :include => :data_set } }) }\n end\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job }\n format.json { render :json => @job }\n end\n end",
"def index\n respond_to do |format|\n format.html \n format.js { render :partial => 'list', :locals => { :jobs => Job.get_jobs(current_user, params) } }\n format.xml { render :xml => Job.get_jobs(current_user, params.merge({:show => 'all'})) }\n end\n end",
"def index\n @jobs = Job.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.rss\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job_runner }\n end\n end",
"def list_jobs(json_payload={})\n conn = @client.get do |req|\n req.url '/api/v2/job/list?'\n req.headers[\"Authorization\"] = @token\n req.params = json_payload\n end\n conn.body\n end",
"def index\n @jobs = current_user.jobs\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobs }\n end\n end",
"def index\n @jobs = Job.page(params[:page])\n end",
"def index\n @job = Job.find(params[:jid]) if params[:jid] and Job.exists?(params[:jid])\n redirect_to jobs_path unless @job\n @job = Job.find(params[:jid]) if params[:jid] and Job.exists?(params[:jid])\n redirect_to jobs_path unless @job\n @job_scope_additions = JobScopeAddition.find_all_by_jobs_id(@job.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @job_scope_additions }\n end\n end",
"def index\n @jobs = Job.all\n\n render json: @jobs\n end",
"def build_jobs_url\n \"http://#{host_name}:#{port}/jobs\"\n end",
"def index\n @jobs = Job.all\n render json: @jobs\n end",
"def get_single_job_sample(client)\n response = client[\"jobs/#{$job_id}\"].get\n\n p ''\n p 'Get single job'\n p response\nend",
"def status(*job_id)\n #take default job_id if not specified\n if job_id.empty?\n job_id = @job_id\n else\n job_id = job_id[0]\n end\n\n \n url=\"#{@base_url}/#{@tool}/status/#{URI.encode(job_id)}\"\n uri = URI.parse(url)\n\n resp = Net::HTTP.get_response(uri)\n #puts resp.body\n\n #params = XmlSimple.xml_in(resp.body)\n\n return resp.body\n\n\n end",
"def jobs(opts = {})\n api(\n @client.list_jobs(\n @project_id,\n deep_symbolize_keys(opts)\n )\n )\n end",
"def index\n @inventories = current_company.inventories.find_all_by_job_id(params[:job_id])\n respond_to do |format|\n format.xml{ render :xml => @inventories }\n format.json{ render :json => @inventories }\n end\n end",
"def index\n\t@jobs = (@user.username == \"Admin\")? Job.all : @user.jobs\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jobs }\n end\n end",
"def get_job_info(page)\n job_api = \"#{BASE_URL}/v4/projects/#{PROJECT_ID}/jobs?page=#{page}&per_page=#{PER_PAGE}\"\n begin\n response = RestClient::Request.new(\n :method => :get,\n :url => job_api,\n :verify_ssl => false,\n :headers => {\"PRIVATE-TOKEN\" => API_TOKEN}\n ).execute\n\n response.headers\n\n rescue RestClient::ExceptionWithResponse => err\n puts \"jobs info error: #{err.response}\"\n return nil\n end\nend",
"def fetch_job\n JSON.parse(RestClient.get(url).body)\n end",
"def index\n @jobs = Job.paginate(page: params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobs }\n end\n end",
"def listJobsForProject(project_mame)\n uri = URI(RUNDECKSERVER + ':' + RUNDECKPORT + '/api/1/jobs')\n params = { 'project' => project_mame }\n headers = {\n 'Content-Type'=> 'application/json',\n 'X-RunDeck-Auth-Token'=> API_KEY \n}\n connection = Excon.new('http://build01:4440/api/1/jobs')\n return connection.get(:query => { 'project' => project_mame },:headers => {\n 'Content-Type'=> 'application/json',\n 'X-RunDeck-Auth-Token'=> API_KEY \n}).body.force_encoding(\"UTF-8\")\n\nend",
"def index\n per_page = params[:per_page] ||= PER_PAGE\n @jobs = Job.paginate :page => params[:page],\n :per_page => params[:per_page],\n :order=>'created_at DESC'\n respond_to do |format|\n format.html # index.html.erb\n format.xml {render :xml => @jobs} \n format.json {render :json => @jobs}\n end\n end",
"def get_jobs(url)\n result = JSON.parse(get_data(url))\n job_list = []\n result[\"jobs\"].each do |job|\n job = JenkinsJob.new job[\"name\"], job[\"color\"], job[\"url\"]\n job_list << job\n end\n job_list\nend",
"def job(id, options = {})\n objectify get(\"/job/#{id}\", options)['joblist']['job']\n end",
"def index\n @jobs = Job.all\n render :index\n end",
"def get_job(id)\n conn = @client.get do |req|\n req.url \"/api/v2/job/#{id}\"\n req.headers[\"Authorization\"] = @token\n end\n conn.body\n end",
"def list_jobs(username, password, uuid = nil)\n jobs = get_json('jobs.json', username, password)\n puts \"\"\n jobs[\"jobs\"].each do |job|\n next if uuid && job['uuid'] != uuid\n if job['jobURL']\n job.merge!(get_json(job['jobURL'], username, password, ''))\n end\n puts summarise_job(job, 2)\n puts \"\"\n end\n del = jobs['delivered']\n puts \"#{del['jobCount']} jobs, #{del['activityCount']} activities delivered since #{del['since']}\"\nend",
"def find_job(job_id)\n response = HTTParty.get(\"#{@host}/api/jobs/#{job_id}\")\n\n return response['job']\n end",
"def index\n @jobs = Job.all\n # @jobs = ScriptedClient::Job.all\n end",
"def job_results(jobid)\r\n wait_on_status(jobid)\r\n puts \"Retrieving results for job [#{jobid}]\"\r\n uri = URI(\"http://api.idolondemand.com/1/job/result/\" + jobid)\r\n uri.query = URI.encode_www_form(:apikey => $api_key)\r\n res = Net::HTTP.get_response(uri, p_addr = $proxy_host, p_port = $proxy_port)\r\n return JSON.parse(res.body)['actions']\r\nend",
"def index\n @jobs = Job.all\n @paginated_jobs = @jobs.paginate(:page => params[:page], :per_page => Settings.Pagination.NoOfEntriesPerPage)\n end",
"def index\n @jobs = Job.with_hires(nil).all\n end",
"def get_jobs_list(status = :all, page = 1, reload = false)\n Bitmovin::Job.list(status, page, reload)\n end",
"def index \n @jobs = Job.all.find_all{ |job| job.user_id == current_user.user_id }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobs }\n end\n end",
"def index\n @training_active_jobs = Training::ActiveJob.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @training_active_jobs }\n end\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end",
"def show\n @job = @user.jobs.find_by_id!(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end",
"def index\n @completed_jobs = DialJob.where(:status => 'completed').paginate(\n\t\t:page => params[:page], \n\t\t:order => 'id DESC',\n\t\t:per_page => 30\n\n\t)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @dial_results }\n end\n end",
"def getExecutionsForAJob(job_id)\n uri = URI(RUNDECKSERVER + ':' + RUNDECKPORT + '/api/1/job/' + job_id + '/executions')\n http = Net::HTTP.new(uri.host, uri.port)\n headers = {\n 'Content-Type'=> 'application/json',\n 'X-RunDeck-Auth-Token'=> API_KEY \n}\n r = http.get(uri.path, headers)\n return r.body.force_encoding(\"UTF-8\")\nend",
"def get(jid)\n results = @client.call('get', jid)\n Job.new(@client, JSON.parse(results)) unless results.nil?\n end",
"def show\n allow :get, :delete; vary_on :accept\n job = OAR::Job.expanded.includes(:job_types, :job_events, :gantt).find(\n params[:id]\n )\n job.links = links_for_item(job)\n\n render_opts = { methods: %i[resources_by_type assigned_nodes] }\n render_result(job, render_opts)\n end",
"def jobs(opts = {})\n api(api_method: @bq.jobs.list,\n parameters: opts)\n end",
"def getDeadJobs\n getJobs('1/')\n end",
"def list_jobs\n jobs = if unsafe_params[:editable]\n Job.editable_by(@context).accessible_by_private\n else\n Job.accessible_by(@context)\n end\n\n if unsafe_params[:scopes].present?\n check_scope!\n jobs = jobs.where(scope: unsafe_params[:scopes])\n end\n\n if unsafe_params[:space_uid].present?\n jobs = jobs.terminal\n end\n\n result = jobs.eager_load(user: :org).order(id: :desc).map do |job|\n describe_for_api(job, unsafe_params[:describe])\n end\n\n render json: result\n end",
"def show\n @items_print_job = ItemsPrintJob.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @items_print_job }\n end\n end",
"def show\n @job = @user.jobs.find_by_id!(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render_for_api :checkins_with_job, json: @job, root: :job }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @launched_job }\n end\n end",
"def show\n @job = Job.find(params[:id])\n @page_title = \"Print job for #{@job.user.full_name}\"\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def index\n \t@jobs = Job.all\n \t# if i wanted to find all of my jobs\n \t# @jobs = current_user.jobs.all\n end",
"def get_jobs(from, to)\n\n job_info = get_job_info(from)\n total_page = job_info[:x_total_pages].to_i\n new_to = (to == nil || to < total_page) ? to : total_page\n puts \">> total page : \" + total_page.to_s\n\n jobs = []\n (from..new_to).each do |page|\n job_api = \"#{BASE_URL}/v4/projects/#{PROJECT_ID}/jobs?page=#{page}&per_page=#{PER_PAGE}\"\n puts \">>start:page:\" + page.to_s\n\n begin\n response = RestClient::Request.new(\n :method => :get,\n :url => job_api,\n :verify_ssl => false,\n :headers => {\"PRIVATE-TOKEN\" => API_TOKEN}\n ).execute\n\n if response != nil && response.code == 200\n res = JSON.parse(response.to_str)\n jobs += res\n end\n\n rescue RestClient::ExceptionWithResponse => err\n puts \"jobs error: #{err.response}\"\n end\n end\n\n jobs\nend",
"def index\n\t\t@page = 'browse'\n if params[:search].blank?\n\t\t case params[:type]\n\t\t\t\twhen \"featured\"\n\t\t\t\t\t@jobs = Job.featured\n when \"latest\"\n @jobs = Job.recently_submited(9)\n\t\t\t\twhen \"closed\"\n\t\t\t\t\t@jobs = Job.closed\n\t\t\t\telse\n\t\t\t\t\t@jobs = Job.open\n end\n else\n\t\t\t@page = 'search'\n @jobs = Job.active.find(:all, :conditions => ['role LIKE ? OR company LIKE ?', \"%#{params[:search]}%\", \"%#{params[:search]}%\"])\n\t\t\tif @jobs.empty?\n @page_header_line = \"Your search by <strong>#{h(params[:search])}</strong> did not return any job. Try a different search or <a href='#{jobs_url}'>go browse</a>.\"\n else\n @page_header_line = \"Your search by <strong>#{h(params[:search])}</strong> returned the following results: \"\n end\n end\n\n @jobs = @jobs.paginate :per_page => 10, :page => params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jobs }\n end\n end",
"def index\n @jobs = Job.all\n\n # change layout for index\n #render layout: \"application\"\n end",
"def search\n data = Job.search(params)\n\n # Respond with :json, :txt (tab delimited Blast results), or GFF3.\n respond_with data.flatten!(1) do |format|\n format.json {\n render :json => Quorum::JobSerializer.as_json(data)\n }\n format.gff {\n render :text => Quorum::JobSerializer.as_gff(data)\n }\n format.txt {\n render :text => Quorum::JobSerializer.as_txt(data)\n }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def index\n self.limit\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobs }\n end\n end",
"def get_job name\n\t\t\tputs \"==> Pulling config.xml for job: '#{name}'\"\n\t\t\tret = {}\n\t\t\tbegin\n\t\t\t\tresponse = RestClient.get \"#{@jenkins_host}:#{@jenkins_port}/job/#{name}/config.xml\"\n\t\t\t\tif response.code == 200\n\t\t\t\t\tret[:success] = true\n\t\t\t\t\tret[:job] = response.body\n\t\t\t\telse\n\t\t\t\t\traise '==> Job does not exist'\n\t\t\t\tend\n\t\t\trescue Exception => e\n\t\t\t\tret[:success] = false\n\t\t\tend\n\t\t\treturn ret\n\t\tend",
"def index\n @jobs = PeriodicJob.list params[:page], current_user.row_limit\n end",
"def show\n @print_job_status = PrintJobStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @print_job_status }\n end\n end",
"def show\n @user = User.find(params[:id])\n @jobs = @user.jobs\n end",
"def index\n @job_results = JobResult.all\n end",
"def jobs\r\n end",
"def show\n\t@job = @user.jobs.find(params[:id])\n\t#if find fails, redirect to the controller\n\trescue\n\t\tflash[:error] = 'Record not found'\n\t\tredirect_to :controller => 'jobs'\n\t\treturn\n\t\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job }\n end\n end"
] | [
"0.73205507",
"0.72729135",
"0.71821696",
"0.7130482",
"0.7030642",
"0.7021925",
"0.6835374",
"0.68151474",
"0.68074626",
"0.673195",
"0.6662918",
"0.6662918",
"0.6662918",
"0.6662918",
"0.6662918",
"0.6662918",
"0.6662918",
"0.66599715",
"0.6652008",
"0.6643812",
"0.6624499",
"0.6596606",
"0.65712285",
"0.65649736",
"0.65649736",
"0.65649736",
"0.65649736",
"0.65649736",
"0.65649736",
"0.6543234",
"0.6521023",
"0.6516499",
"0.64999545",
"0.6498098",
"0.64915633",
"0.64886385",
"0.6486725",
"0.6479707",
"0.6472146",
"0.64497924",
"0.64366245",
"0.6417849",
"0.6385498",
"0.63833386",
"0.6376101",
"0.6364",
"0.63552165",
"0.63520086",
"0.6351964",
"0.6329086",
"0.63226926",
"0.63172597",
"0.63074785",
"0.63072234",
"0.6305683",
"0.63021815",
"0.62947106",
"0.6287044",
"0.62604654",
"0.6254771",
"0.6249901",
"0.6240829",
"0.6232124",
"0.6217892",
"0.6216404",
"0.6200019",
"0.6198023",
"0.6190957",
"0.6189438",
"0.6182502",
"0.61785096",
"0.61785096",
"0.61785096",
"0.61785096",
"0.61785096",
"0.617377",
"0.6166016",
"0.6165295",
"0.6144718",
"0.6123253",
"0.6122617",
"0.61206585",
"0.6114656",
"0.61031574",
"0.6096844",
"0.60870177",
"0.60804796",
"0.6077143",
"0.606705",
"0.6056486",
"0.6054569",
"0.6051018",
"0.60487735",
"0.60469127",
"0.6044782",
"0.60413784",
"0.6037798",
"0.60290736",
"0.6016896",
"0.6015269",
"0.6012932"
] | 0.0 | -1 |
GET /jobs/1 GET /jobs/1.xml | def show
@job = Job.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @job }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @jobs = Job.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jobs }\n end\n end",
"def getJobApi (options)\n uri = options[:job] + \"?depth=\" + options[:depth].to_s\n job_uri = URI.parse(uri)\n http = Net::HTTP.new(job_uri.host, job_uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(job_uri.request_uri)\n request.basic_auth @username, @password\n response = http.request(request)\n job_xml=XmlSimple.xml_in(response.body)\n return job_xml\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jobs }\n end\n end",
"def jobs\n doc = Nokogiri::XML open(@url)\n\n doc.search('//job').map { |node|\n Job.new(attributes_from(node))\n }\n end",
"def index\n @jobs = Job.find(:all, :conditions => params_to_conditions(params), :order => \"id\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jobs }\n end\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @job.to_xml }\n end\n end",
"def show\n @job = Job.find(params[:id])\n @tasks = @job.tasks\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def index\n @jobtimes = current_company.jobtimes.find_all_by_job_id(params[:job_id])\n respond_to do |format|\n format.xml {render :xml => @jobtimes }\n format.json { render :json => @jobtimes }\n end\n end",
"def get_single_job_sample(client)\n response = client[\"jobs/#{$job_id}\"].get\n\n p ''\n p 'Get single job'\n p response\nend",
"def get_jobs_sample(client)\n response = client['jobs'].get\n\n p ''\n p 'Get jobs'\n p response\nend",
"def show\n @job = Job.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job.to_xml(:include => { :job_parameters => { :include => :data_set } }) }\n end\n end",
"def show\n @job_status = JobStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job_status }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @jobs_queue }\n end\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job }\n format.json { render :json => @job }\n end\n end",
"def getCurrentJobs\n getJobs('0/')\n end",
"def index\n @nodes = @job.nodes.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nodes }\n format.json { render :json => @nodes }\n end\n end",
"def find_jobs(params:)\n response = HTTParty.get(\"#{@host}/api/jobs\", query: params)\n\n return response[\"jobs\"] \n end",
"def index\n @jobs = Job.paginate :page => params[:page], :order => 'created_at DESC', :per_page =>10\n @job = Job.find(:last)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jobs }\n format.json { render :json => @jobs }\n end\n end",
"def status(*job_id)\n #take default job_id if not specified\n if job_id.empty?\n job_id = @job_id\n else\n job_id = job_id[0]\n end\n\n \n url=\"#{@base_url}/#{@tool}/status/#{URI.encode(job_id)}\"\n uri = URI.parse(url)\n\n resp = Net::HTTP.get_response(uri)\n #puts resp.body\n\n #params = XmlSimple.xml_in(resp.body)\n\n return resp.body\n\n\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job_runner }\n end\n end",
"def find_job(job_id)\n response = HTTParty.get(\"#{@host}/api/jobs/#{job_id}\")\n\n return response['job']\n end",
"def index\n @job = Job.find(params[:jid]) if params[:jid] and Job.exists?(params[:jid])\n redirect_to jobs_path unless @job\n @job = Job.find(params[:jid]) if params[:jid] and Job.exists?(params[:jid])\n redirect_to jobs_path unless @job\n @job_scope_additions = JobScopeAddition.find_all_by_jobs_id(@job.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @job_scope_additions }\n end\n end",
"def jobs\n\t\t# ...\n\tend",
"def index\n @jobs = Job.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.rss\n end\n end",
"def job(id, options = {})\n objectify get(\"/job/#{id}\", options)['joblist']['job']\n end",
"def job\n fetch('games.final_fantasy_xiv.jobs')\n end",
"def get_job(id)\n conn = @client.get do |req|\n req.url \"/api/v2/job/#{id}\"\n req.headers[\"Authorization\"] = @token\n end\n conn.body\n end",
"def build_jobs_url\n \"http://#{host_name}:#{port}/jobs\"\n end",
"def index\n @job_requests = JobRequest.all\n end",
"def index\n @jobs = Job.all\n end",
"def index\n @jobs = Job.all\n end",
"def index\n @jobs = Job.all\n end",
"def index\n @jobs = Job.all\n end",
"def index\n @jobs = Job.all\n end",
"def index\n @jobs = Job.all\n end",
"def get_job_info(page)\n job_api = \"#{BASE_URL}/v4/projects/#{PROJECT_ID}/jobs?page=#{page}&per_page=#{PER_PAGE}\"\n begin\n response = RestClient::Request.new(\n :method => :get,\n :url => job_api,\n :verify_ssl => false,\n :headers => {\"PRIVATE-TOKEN\" => API_TOKEN}\n ).execute\n\n response.headers\n\n rescue RestClient::ExceptionWithResponse => err\n puts \"jobs info error: #{err.response}\"\n return nil\n end\nend",
"def index\n @jobs = Job.all\n end",
"def index\n @job_items = @job.job_items.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @job_items }\n end\n end",
"def index\n respond_to do |format|\n format.html \n format.js { render :partial => 'list', :locals => { :jobs => Job.get_jobs(current_user, params) } }\n format.xml { render :xml => Job.get_jobs(current_user, params.merge({:show => 'all'})) }\n end\n end",
"def show\n @job_title = JobTitle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job_title }\n end\n end",
"def index\n @jobs = Job.page(params[:page])\n end",
"def show\n @job = @user.jobs.find_by_id!(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end",
"def index\n respond_to do |format|\n format.html { @jobs_queues = JobsQueue.get_jobs_queues(current_user, params) }\n format.xml { render :xml => JobsQueue.get_jobs_queues(current_user, params.merge({:show => 'all'})) }\n end\n end",
"def show\n @job = Job.find(params[:id])\n @page_title = \"Print job for #{@job.user.full_name}\"\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def index\n per_page = params[:per_page] ||= PER_PAGE\n @jobs = Job.paginate :page => params[:page],\n :per_page => params[:per_page],\n :order=>'created_at DESC'\n respond_to do |format|\n format.html # index.html.erb\n format.xml {render :xml => @jobs} \n format.json {render :json => @jobs}\n end\n end",
"def listjobs(project=self.project)\n get('listjobs.json', project: project).reject{|k,v| k=='status'}\n end",
"def show\n @print_job_status = PrintJobStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @print_job_status }\n end\n end",
"def get(jid)\n results = @client.call('get', jid)\n Job.new(@client, JSON.parse(results)) unless results.nil?\n end",
"def show\n @items_print_job = ItemsPrintJob.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @items_print_job }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def start_job\n associate(Wesabe::Job.from_xml(Hpricot::XML(post(:url => \"/credentials/#{id}/jobs.xml\")) / :job))\n end",
"def job_results(jobid)\r\n wait_on_status(jobid)\r\n puts \"Retrieving results for job [#{jobid}]\"\r\n uri = URI(\"http://api.idolondemand.com/1/job/result/\" + jobid)\r\n uri.query = URI.encode_www_form(:apikey => $api_key)\r\n res = Net::HTTP.get_response(uri, p_addr = $proxy_host, p_port = $proxy_port)\r\n return JSON.parse(res.body)['actions']\r\nend",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end",
"def get_job name\n\t\t\tputs \"==> Pulling config.xml for job: '#{name}'\"\n\t\t\tret = {}\n\t\t\tbegin\n\t\t\t\tresponse = RestClient.get \"#{@jenkins_host}:#{@jenkins_port}/job/#{name}/config.xml\"\n\t\t\t\tif response.code == 200\n\t\t\t\t\tret[:success] = true\n\t\t\t\t\tret[:job] = response.body\n\t\t\t\telse\n\t\t\t\t\traise '==> Job does not exist'\n\t\t\t\tend\n\t\t\trescue Exception => e\n\t\t\t\tret[:success] = false\n\t\t\tend\n\t\t\treturn ret\n\t\tend",
"def fetch_job\n JSON.parse(RestClient.get(url).body)\n end",
"def show\n\t@job = @user.jobs.find(params[:id])\n\t#if find fails, redirect to the controller\n\trescue\n\t\tflash[:error] = 'Record not found'\n\t\tredirect_to :controller => 'jobs'\n\t\treturn\n\t\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def index\n @inventories = current_company.inventories.find_all_by_job_id(params[:job_id])\n respond_to do |format|\n format.xml{ render :xml => @inventories }\n format.json{ render :json => @inventories }\n end\n end",
"def get_jobs(url)\n result = JSON.parse(get_data(url))\n job_list = []\n result[\"jobs\"].each do |job|\n job = JenkinsJob.new job[\"name\"], job[\"color\"], job[\"url\"]\n job_list << job\n end\n job_list\nend",
"def show\n @job = @user.jobs.find_by_id!(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render_for_api :checkins_with_job, json: @job, root: :job }\n end\n end",
"def show\n @job = Job.find(params[:id])\n end",
"def show\n @job = Job.find(params[:id])\n end",
"def getExecutionsForAJob(job_id)\n uri = URI(RUNDECKSERVER + ':' + RUNDECKPORT + '/api/1/job/' + job_id + '/executions')\n http = Net::HTTP.new(uri.host, uri.port)\n headers = {\n 'Content-Type'=> 'application/json',\n 'X-RunDeck-Auth-Token'=> API_KEY \n}\n r = http.get(uri.path, headers)\n return r.body.force_encoding(\"UTF-8\")\nend",
"def jobstats path\n log_path = File.join(path, \"_logs\", \"history\")\n jobstats_page = fs.entries(log_path).reject{|path| path =~ /.*.xml/}.first\n fs.open(jobstats_page).read\n end",
"def index\n @jobs = Job.paginate(page: params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobs }\n end\n end",
"def index\n @jobs = Job.all\n render :index\n end",
"def list_jobs(json_payload={})\n conn = @client.get do |req|\n req.url '/api/v2/job/list?'\n req.headers[\"Authorization\"] = @token\n req.params = json_payload\n end\n conn.body\n end",
"def show\n @job = Job.find_by_permalink!(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def show\n allow :get, :delete; vary_on :accept\n job = OAR::Job.expanded.includes(:job_types, :job_events, :gantt).find(\n params[:id]\n )\n job.links = links_for_item(job)\n\n render_opts = { methods: %i[resources_by_type assigned_nodes] }\n render_result(job, render_opts)\n end",
"def index\n\t@jobs = (@user.username == \"Admin\")? Job.all : @user.jobs\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jobs }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def index\n @jobs = current_user.jobs\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobs }\n end\n end",
"def job(url)\n server(url).job(URI(url).path)\n end",
"def job_get(organization, jobid)\n uri = server_uri(\"/organizations/#{organization}/jobs/#{jobid}\")\n res_data = api_get(uri)\n @logger.debug res_data\n\n return res_data\n end",
"def index\n @completed_jobs = DialJob.where(:status => 'completed').paginate(\n\t\t:page => params[:page], \n\t\t:order => 'id DESC',\n\t\t:per_page => 30\n\n\t)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @dial_results }\n end\n end",
"def listJobsForProject(project_mame)\n uri = URI(RUNDECKSERVER + ':' + RUNDECKPORT + '/api/1/jobs')\n params = { 'project' => project_mame }\n headers = {\n 'Content-Type'=> 'application/json',\n 'X-RunDeck-Auth-Token'=> API_KEY \n}\n connection = Excon.new('http://build01:4440/api/1/jobs')\n return connection.get(:query => { 'project' => project_mame },:headers => {\n 'Content-Type'=> 'application/json',\n 'X-RunDeck-Auth-Token'=> API_KEY \n}).body.force_encoding(\"UTF-8\")\n\nend",
"def getDeadJobs\n getJobs('1/')\n end",
"def create_job xml, name\n\t\t\tputs \"==> Creating job for project: '#{name}'\"\n\t\t\tbegin\n\t\t\t\tcreate_response = RestClient.post \"#{@jenkins_host}:#{@jenkins_port}/createItem/?name=#{name}\", xml , {:content_type => :xml}\n\t\t\t\treturn create_response.code.to_s\n\t\t\trescue Exception => e\n\t\t\t\tputs \"==> Error creating job #{name}\"\n\t\t\t\treturn \"500\"\n\t\t\tend\n\t\tend",
"def show\n begin\n @job = Job.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n respond_to do |format|\n format.html { \n redirect_to(\"#{jobs_path}?page=1\")\n flash[:error] = \"Couldn't find the Job to show.\"\n }\n format.xml { head :not_found, :status => :missing }\n format.json { head :not_found, :status => :missing }\n end\n else\n @current_page = params[:page] ||= 1\n respond_to do |format|\n format.html # show.html.erb\n format.xml {render :xml => @job} \n format.json {render :json => @job}\n end\n end\n end",
"def index\n @jobs = Job.with_hires(nil).all\n end",
"def index\n @jobs = Job.all\n @paginated_jobs = @jobs.paginate(:page => params[:page], :per_page => Settings.Pagination.NoOfEntriesPerPage)\n end",
"def show\n respond_with Job.find(params[:id])\n end",
"def index\n @jobs = Job.all\n # @jobs = ScriptedClient::Job.all\n end"
] | [
"0.70364517",
"0.70221996",
"0.6980914",
"0.69193447",
"0.6905757",
"0.6723367",
"0.6706007",
"0.66702217",
"0.6625802",
"0.6585081",
"0.6570226",
"0.65692854",
"0.6521269",
"0.6514651",
"0.6487358",
"0.6487237",
"0.6476796",
"0.647277",
"0.645419",
"0.6435364",
"0.6434389",
"0.6399905",
"0.63932747",
"0.6363056",
"0.63326675",
"0.6332543",
"0.6303221",
"0.63017744",
"0.62936705",
"0.6269622",
"0.6269622",
"0.6269622",
"0.6269622",
"0.6269622",
"0.6269622",
"0.62209016",
"0.62156266",
"0.61914694",
"0.6172684",
"0.61711353",
"0.6171074",
"0.61683166",
"0.6167466",
"0.6141028",
"0.61384404",
"0.6138434",
"0.61337346",
"0.6117488",
"0.61160433",
"0.61126405",
"0.61092865",
"0.61065656",
"0.61048084",
"0.61048084",
"0.61048084",
"0.61048084",
"0.61048084",
"0.61003196",
"0.6095124",
"0.60771394",
"0.60715324",
"0.60642105",
"0.60641205",
"0.60638964",
"0.60638964",
"0.60618937",
"0.6037362",
"0.60334945",
"0.6031589",
"0.60313493",
"0.6028024",
"0.6024793",
"0.6022802",
"0.60216796",
"0.60216796",
"0.60216796",
"0.60216796",
"0.60216796",
"0.60216796",
"0.60216796",
"0.60216796",
"0.60216796",
"0.60209185",
"0.6009917",
"0.6001506",
"0.59987533",
"0.5981709",
"0.59684753",
"0.5963271",
"0.59624183",
"0.5960486",
"0.595427",
"0.5948701",
"0.59468085"
] | 0.67135555 | 11 |
GET /jobs/new GET /jobs/new.xml | def new
@job = Job.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @job }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n createJobWithDefaults\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @job = Job.new_default(params[:job])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n format.json { render :json => @job }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job_runner }\n end\n end",
"def new\n @job_status = JobStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job_status }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end",
"def new\n @job = @user.jobs.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end",
"def new\n @job = @user.jobs.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end",
"def new\n @job_title = JobTitle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job_title }\n end\n end",
"def new\n @account = Account.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @jobs_queue = JobsQueue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @jobs_queue }\n end\n end",
"def new\n @node = @job.nodes.build \n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n format.json { render :json => @node } \n end\n end",
"def new\n @job_application = JobApplication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job_application }\n end\n end",
"def new\n @print_job_status = PrintJobStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @print_job_status }\n end\n end",
"def new\n @items_print_job = ItemsPrintJob.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @items_print_job }\n end\n end",
"def new\n\t\t@job = Job.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render json: @job }\n\t\tend\n\tend",
"def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n flash[:notice] = 'Job was successfully created.'\n format.html { redirect_to job_url(@job) }\n format.xml { head :created, :location => job_url(@job) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors.to_xml }\n end\n end\n end",
"def new\n @filter_job = FilterJob.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @filter_job }\n end\n end",
"def new\n @job_application = JobApplication.new\n @users = User.find :all\n @job_postings = JobPosting.find :all\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job_application }\n end\n end",
"def new\n @saved_job = SavedJob.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @saved_job }\n end\n end",
"def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n flash[:notice] = 'Job was successfully created.'\n format.html { redirect_to(@job) }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n flash[:notice] = 'Job was successfully created.'\n format.html { redirect_to(@job) }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n flash[:notice] = 'Job was successfully created.'\n format.html { redirect_to(@job) }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n flash[:notice] = 'Job was successfully created.'\n format.html { redirect_to(@job) }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to(@job, :notice => 'Job was successfully created.') }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n flash[:notice] = 'Job was successfully created.'\n format.html { redirect_to verify_job_url(@job) }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @job_list = JobList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job_list }\n end\n end",
"def new\n @user = User.find(params[:user_id])\n @job = @user.jobs.new\n @job.paper_price = current_paper_price\n @job.ink_price = current_ink_price\n @job.quantity = 1\n\n @page_title = \"New print job for \" + @user.full_name \n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @construction_job = Construction::Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @construction_job }\n end\n end",
"def new\n @job_student = JobStudent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job_student }\n end\n end",
"def create_job xml, name\n\t\t\tputs \"==> Creating job for project: '#{name}'\"\n\t\t\tbegin\n\t\t\t\tcreate_response = RestClient.post \"#{@jenkins_host}:#{@jenkins_port}/createItem/?name=#{name}\", xml , {:content_type => :xml}\n\t\t\t\treturn create_response.code.to_s\n\t\t\trescue Exception => e\n\t\t\t\tputs \"==> Error creating job #{name}\"\n\t\t\t\treturn \"500\"\n\t\t\tend\n\t\tend",
"def new\n @dailyreport_job = DailyreportJob.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dailyreport_job }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jobs }\n end\n end",
"def new\n @job_folio = JobFolio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job_folio }\n end\n end",
"def new\n @job_title = JobTitle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job_title }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.js\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @sfjob = Sfjob.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sfjob }\n end\n end",
"def new\n @jobs = Job.new(params[:accepted_jobs])\n\n @jobs.user_id = current_user.id\n\n pp @jobs\n\n # respond_to do |format|\n # if @jobs.save\n # format.html { redirect_to home_path, notice: 'Request was successfully created.' }\n # format.json { render json: @jobs, status: :created, location: home_path }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @jobs.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def new\n @job = Job.new\n @job.job_id = params[:job_id]\n @job.supplier_id = params[:supplier_id]\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @jobsearch = Jobsearch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @jobsearch }\n end\n end",
"def index\n @jobs = Job.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jobs }\n end\n end",
"def new\n @device = Device.find(params[:device_id]) \n @job = @device.jobs.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end",
"def new\n @work = Work.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @work }\n end\n end",
"def create\n @job = Job.new(params[:job])\n @job.company_id = current_company.id\n\n if @job.save\n response_message = {:message => \"Job created successfully.\", :job => @job}\n else\n response_message = {:message => \"Job creation failed. Please try again!\"}\n end\n\n respond_to do |format|\n format.xml { render :xml => response_message}\n format.json { render :json => response_message }\n end\n end",
"def new\n @job_notification = JobNotification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job_notification }\n end\n end",
"def new\n @worker = Worker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @worker }\n end\n end",
"def new\n @job = Job.new\n @locations = Location.find(:all, :conditions=>['user_id=?',current_user.id])\n @job.locations.build # Creating task_location in Memory so that our Form has something to work with when dealing with Task Locations.\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @job_posting_detail = JobPostingDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job_posting_detail }\n end\n end",
"def new\n @emp_job = EmpJob.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @emp_job }\n end\n end",
"def new\n if params[:id].nil?\n redirect_to \"/\", :alert=>\"You need to apply through a job\"\n return\n end\n\n @job = Job.find(params[:id])\n @company = @job.company.name\n @title = @job.title\n\n @application = Application.new\n\n respond_to do |format|\n format.html# new.html.erb\n format.json { render json: @application }\n end\n end",
"def new\n @jobtype = Jobtype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render_json @jobtype }\n end\n end",
"def new\n @job_item = @job.job_items.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job_item }\n end\n end",
"def new\n @title = t('view.print_job_types.new_title')\n @print_job_type = PrintJobType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @print_job_type }\n end\n end",
"def new\n @job_compact = JobCompact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job_compact }\n end\n end",
"def new\n @job = Job.new\n\n session[:time_now] = Time.now\n\n 2.times do\n @job.references.build\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end",
"def new\n @quartz = Quartz.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @quartz }\n end\n end",
"def new\n @work = Work.new\n \n @title = \"New work\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @work }\n end\n end",
"def new\n @thing = Thing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing }\n end\n end",
"def new\n @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",
"def new\n @training_active_job = Training::ActiveJob.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @training_active_job }\n end\n end",
"def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to(edit_admin_job_path(@job), :notice => 'Job was successfully created. Now select the appropriate permissions.') }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @new_job = Job.new\n # Authorizes the correct user to access new job page\n authorize @new_job\n end",
"def new\n @job = Job.new\n if current_user and default_queue = current_user.preferences.find_by_kind('default_queue') then @job.jobs_queue_id = default_queue.value end\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @versioned_jnlp = MavenJnlp::VersionedJnlp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @versioned_jnlp }\n end\n end",
"def create\n\t\t@job = Job.new(params[:job])\n\n\t\trespond_to do |format|\n\t\t\tif @job.save\n\t\t\t\tformat.html { redirect_to @job, notice: 'Job was successfully created.' }\n\t\t\t\tformat.json { render json: @job, status: :created, location: @job }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @job.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def new\n @job = Job.new\n end",
"def new\n @job_application_status_type = JobApplicationStatusType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job_application_status_type }\n end\n end",
"def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\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 end",
"def create\n @job.user_id = current_user.id\n respond_to do |format|\n if @job.save\n format.html { redirect_to(@job, :notice => 'Job was successfully created.') }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n format.json { render :json => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n format.json { render :json => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @job = Vger::Resources::Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to company_job(:company_id => params[:company_id], :id => @job.id), notice: 'Job was successfully created.' }\n else\n format.html { render action: \"new\" }\n end\n end\n end",
"def new\n @job_category = JobCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job_category }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end",
"def new\n @job = current_user.jobs.new\n end",
"def new\n @job_application_attachment = JobApplicationAttachment.new\n @job_applications = JobApplication.find :all\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job_application_attachment }\n end\n end",
"def create(id, job)\n connection.post do |req|\n req.url \"job/#{id}\"\n req.body = job\n end\n end",
"def create\n @node = Node.new(params[:node])\n\n respond_to do |format|\n if (@job.nodes << @node)\n flash[:notice] = 'Node was successfully created.'\n format.html { redirect_to job_url(@job) }\n format.xml { render :xml => @node, :status => :created, :location => @node }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def create\n @job = Job.new(job_params)\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to root_path, notice: 'Job was successfully created.' }\n format.json { render action: 'show', 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 end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"def new\n @photo_job = PhotoJob.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @photo_job }\n end\n end",
"def new_job(job, username, password)\n puts \"Requesting quote for job:\"\n puts JSON.pretty_generate(job)\n puts \"\"\n res = post_json('jobs.json', job, username, password)\n if res['error'] || res['status'] == 'error'\n puts \"Job rejected (error #{res['status']}): #{res['error'] || res['reason']}\"\n return\n end\n\n puts \"Gnip's job desc:\"\n puts summarise_job(res)\nend"
] | [
"0.77074856",
"0.7576467",
"0.74736714",
"0.7434554",
"0.73134154",
"0.72839767",
"0.71261054",
"0.70906746",
"0.70906746",
"0.70574987",
"0.70574987",
"0.70574987",
"0.70574987",
"0.70119286",
"0.70008135",
"0.69807976",
"0.68773836",
"0.6870343",
"0.6854625",
"0.6851486",
"0.6798646",
"0.6793265",
"0.6786103",
"0.67170686",
"0.67050207",
"0.6704092",
"0.6704092",
"0.6704092",
"0.6704092",
"0.6701657",
"0.6624259",
"0.661383",
"0.660124",
"0.6580746",
"0.6577618",
"0.6559712",
"0.6546552",
"0.65156734",
"0.65102714",
"0.6507614",
"0.6496408",
"0.64954567",
"0.6487759",
"0.643142",
"0.6413441",
"0.6408797",
"0.63884",
"0.63818467",
"0.6376634",
"0.6352915",
"0.6347682",
"0.63389945",
"0.6324474",
"0.63181514",
"0.6312138",
"0.630099",
"0.6297751",
"0.6295239",
"0.62702966",
"0.62701",
"0.6254361",
"0.6229412",
"0.6223202",
"0.6222398",
"0.6215854",
"0.62091666",
"0.6195478",
"0.6192132",
"0.61708033",
"0.6154106",
"0.61527896",
"0.6150718",
"0.6145763",
"0.61399",
"0.61389816",
"0.6135737",
"0.6129915",
"0.61237276",
"0.61186355",
"0.6104581",
"0.6095793",
"0.6093945",
"0.6093945",
"0.6093945",
"0.6093945",
"0.6093945",
"0.6093945",
"0.6093945",
"0.6090272",
"0.6086298",
"0.6082626",
"0.6082069"
] | 0.7628772 | 9 |
POST /jobs POST /jobs.xml | def create
@job = Job.new(params[:job])
respond_to do |format|
if @job.save
format.html { redirect_to(edit_admin_job_path(@job), :notice => 'Job was successfully created. Now select the appropriate permissions.') }
format.xml { render :xml => @job, :status => :created, :location => @job }
else
format.html { render :action => "new" }
format.xml { render :xml => @job.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_job xml, name\n\t\t\tputs \"==> Creating job for project: '#{name}'\"\n\t\t\tbegin\n\t\t\t\tcreate_response = RestClient.post \"#{@jenkins_host}:#{@jenkins_port}/createItem/?name=#{name}\", xml , {:content_type => :xml}\n\t\t\t\treturn create_response.code.to_s\n\t\t\trescue Exception => e\n\t\t\t\tputs \"==> Error creating job #{name}\"\n\t\t\t\treturn \"500\"\n\t\t\tend\n\t\tend",
"def create_jenkins_job(name, xml_file)\n create_url = \"http://#{Pkg::Config.jenkins_build_host}/createItem?name=#{name}\"\n form_args = [\"-H\", '\"Content-Type: application/xml\"', \"--data-binary\", \"@#{xml_file}\"]\n curl_form_data(create_url, form_args)\n \"http://#{Pkg::Config.jenkins_build_host}/job/#{name}\"\nend",
"def start_job\n associate(Wesabe::Job.from_xml(Hpricot::XML(post(:url => \"/credentials/#{id}/jobs.xml\")) / :job))\n end",
"def create(id, job)\n connection.post do |req|\n req.url \"job/#{id}\"\n req.body = job\n end\n end",
"def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n flash[:notice] = 'Job was successfully created.'\n format.html { redirect_to job_url(@job) }\n format.xml { head :created, :location => job_url(@job) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors.to_xml }\n end\n end\n end",
"def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to(@job, :notice => 'Job was successfully created.') }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_job(job:, params: {})\n response = HTTParty.post(\"#{@host}/api/jobs\", body: {job: job, api_key: @api_key}.merge(params))\n \n return response\n end",
"def jobs\n doc = Nokogiri::XML open(@url)\n\n doc.search('//job').map { |node|\n Job.new(attributes_from(node))\n }\n end",
"def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n flash[:notice] = 'Job was successfully created.'\n format.html { redirect_to verify_job_url(@job) }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n flash[:notice] = 'Job was successfully created.'\n format.html { redirect_to(@job) }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n flash[:notice] = 'Job was successfully created.'\n format.html { redirect_to(@job) }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n flash[:notice] = 'Job was successfully created.'\n format.html { redirect_to(@job) }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n flash[:notice] = 'Job was successfully created.'\n format.html { redirect_to(@job) }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new_job(job, username, password)\n puts \"Requesting quote for job:\"\n puts JSON.pretty_generate(job)\n puts \"\"\n res = post_json('jobs.json', job, username, password)\n if res['error'] || res['status'] == 'error'\n puts \"Job rejected (error #{res['status']}): #{res['error'] || res['reason']}\"\n return\n end\n\n puts \"Gnip's job desc:\"\n puts summarise_job(res)\nend",
"def create\n @job = Job.new(params[:job])\n @job.company_id = current_company.id\n\n if @job.save\n response_message = {:message => \"Job created successfully.\", :job => @job}\n else\n response_message = {:message => \"Job creation failed. Please try again!\"}\n end\n\n respond_to do |format|\n format.xml { render :xml => response_message}\n format.json { render :json => response_message }\n end\n end",
"def post_job_content_sample(client)\n job_multipart = {\n :file => File.new($full_path),\n 'num copies' => 10\n }\n\n response = client['jobs'].post job_multipart\n\n p ''\n p 'Submit a new job'\n p response\nend",
"def create\n arg = params[:email]\n counter = Job.enqueue(arg)\n render :status => :accepted, :json => { jobId: counter }\n end",
"def jobs\n\t\t# ...\n\tend",
"def build_jobs_url\n \"http://#{host_name}:#{port}/jobs\"\n end",
"def create_batch_job(job_id)\n request = Net::HTTP::Put.new(\"/jobs/#{job_id}\")\n response = http.request(request)\n handle_response({ request_method: request.method, request_path: request.path }, response)\n end",
"def create\n ensure_authenticated!\n\n job = Grid5000::Job.new(job_params)\n Rails.logger.info \"Received job = #{job.inspect}\"\n raise BadRequest, \"The job you are trying to submit is not valid: #{job.errors.join('; ')}\" unless job.valid?\n\n job_to_send = job.to_hash(destination: 'oar-2.4-submission')\n Rails.logger.info \"Submitting #{job_to_send.inspect}\"\n\n result = @oarapi.create_job(job_to_send)\n\n job_uid = JSON.parse(result)['id']\n location_uri = uri_to(\n resource_path(job_uid),\n :in, :absolute\n )\n\n job = OAR::Job.expanded.includes(:job_types, :job_events, :gantt).find(job_uid)\n job.links = links_for_item(job)\n\n render_opts = {\n methods: %i[resources_by_type assigned_nodes],\n location: location_uri,\n status: 201\n }\n render_result(job, render_opts)\n end",
"def create\n @job = current_user.posted_jobs.build(job_params)\n if @job.save\n render json: @job\n else\n render json: @job.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def create\n @job = Job.new(params[:job])\n @job.status = 'listed'\n\n respond_to do |format|\n if @job.save\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 end",
"def create\n @job.user_id = current_user.id\n respond_to do |format|\n if @job.save\n format.html { redirect_to(@job, :notice => 'Job was successfully created.') }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n format.json { render :json => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n format.json { render :json => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @node = Node.new(params[:node])\n\n respond_to do |format|\n if (@job.nodes << @node)\n flash[:notice] = 'Node was successfully created.'\n format.html { redirect_to job_url(@job) }\n format.xml { render :xml => @node, :status => :created, :location => @node }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @myjob = Myjob.new(myjob_params)\n\n respond_to do |format|\n if @myjob.save\n format.html { redirect_to @myjob, notice: 'Myjob was successfully created.' }\n format.json { render :show, status: :created, location: @myjob }\n else\n format.html { render :new }\n format.json { render json: @myjob.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job = Job.new(job_params)\n\n respond_to do |format|\n if @job.save\n JobsWorker.perform_async(@job.id, @job.server.id)\n flash[:success] = 'Job was successfully created.'\n format.html { redirect_to jobs_path }\n format.json { render :show, status: :created, location: @job }\n else\n flash[:error] = 'Please fill all fields correctly !!'\n format.html { redirect_to root_url }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n createJobWithDefaults\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def create\n @job = Job.new(params[:job].reject{|key, value| key == 'jobs_queue_id'})\n @job.user = current_user\n\n respond_to do |format|\n if @job.save\n if @job.r_script.tags.collect{|tag| tag.name}.include?('install script')\n @job.pending \n elsif queue = JobsQueue.find_by_id(params[:job][:jobs_queue_id].to_i) \n @job.submit(queue) \n end\n create_log_entry(@job.r_script, @job, 'use')\n flash[:notice] = 'Job was successfully created.'\n format.html { redirect_to(jobs_url) }\n format.xml { render :xml => @job.to_xml(:include => { :job_parameters => { :include => :data_set } }), :status => :created, :location => @job }\n else\n @job.jobs_queue_id = params[:job][:jobs_queue_id]\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n ensure_authenticated!\n\n job = Grid5000::Job.new(payload)\n Rails.logger.info \"Received job = #{job.inspect}\"\n raise BadRequest, \"The job you are trying to submit is not valid: #{job.errors.join(\"; \")}\" unless job.valid?\n job_to_send = job.to_hash(:destination => \"oar-2.4-submission\")\n Rails.logger.info \"Submitting #{job_to_send.inspect}\"\n\n url = uri_to(\n site_path(params[:site_id])+\"/internal/oarapi/jobs.json\", :out\n )\n http = EM::HttpRequest.new(url).post(\n :timeout => 20,\n :body => job_to_send.to_json,\n :head => {\n 'X-Remote-Ident' => @credentials[:cn],\n 'Content-Type' => media_type(:json),\n 'Accept' => media_type(:json)\n }\n )\n continue_if!(http, :is => [201,202])\n\n job_uid = JSON.parse(http.response)['id']\n location_uri = uri_to(\n resource_path(job_uid),\n :in, :absolute\n )\n\n job = OAR::Job.expanded.find(\n job_uid,\n :include => [:job_types, :job_events, :gantt]\n )\n job.links = links_for_item(job)\n \n render_opts = {\n :methods => [:resources_by_type, :assigned_nodes],\n :location => location_uri,\n :status => 201\n }\n respond_to do |format|\n format.g5kitemjson { render render_opts.merge(:json => job) }\n format.json { render render_opts.merge(:json => job) }\n end\n end",
"def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\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 end",
"def create\n @items_print_job = ItemsPrintJob.new(params[:items_print_job])\n\n respond_to do |format|\n if @items_print_job.save\n format.html { redirect_to(@items_print_job, :notice => 'Items print job was successfully created.') }\n format.xml { render :xml => @items_print_job, :status => :created, :location => @items_print_job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @items_print_job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jobs }\n end\n end",
"def create\n @job = Job.new(job_params)\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job = Job.new(job_params)\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job = Job.new(job_params)\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job = current_member.jobs.new(job_params)\n @job.published_at = DateTime.now\n\n\n respond_to do |format|\n if @job.save\n\n format.html { redirect_to @job, notice: 'The stuff you want done 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 end",
"def create\n\t\tjob = Job.new\n\t\tjob.user_id = current_user.id\n\t\tjob.http_method \t= params[:http_method]\n\t\tjob.http_uri \t\t= params[:http_uri]\n\t\tjob.http_host \t\t= params[:http_host]\n\t\tjob.http_headers\t= params[:http_headers]\n\t\tjob.http_data\t\t= params[:http_data]\n\n\t\t# Set job type to bruteforce by default. This will change, but\n\t\t# for now we don't care about responses.\n\t\tjob.attack_type\t\t\t= \"repeat\"\n\n\t\t# Set status to pending by default -- this may change in future\n\t\tjob.status \t\t\t= \"pending\"\n\n\t\tjob.save\n\n\t\trender :json => job.to_json\n\tend",
"def create\n @job = @user.jobs.new(params[:job])\n\n respond_to do |format|\n if @job.save\n\t\t# send mail now or later...\n\t\tBackground.instance.delay.sendLater(@job)\n\t \n format.html { redirect_to(@job, :notice => 'Job was successfully created.') }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def submit_batch_job(job_id)\n request_path = \"/jobs/#{job_id}/queue\"\n request_body = \"submit\"\n response = http.request_post(request_path, request_body)\n handle_response({ request_method: 'POST', request_path: request_path, request_body: request_body }, response)\n end",
"def create\n @job = Job.new(params[:job])\n @locations = Location.find(:all, :conditions=>['user_id=?',current_user.id])\n\n @job.user_id = current_user.id\n @job.status = 0 #job is initially inactive untill payment is processed\n respond_to do |format|\n if @job.save\n flash[:notice] = 'Job was successfully created.'\n #format.html { redirect_to(user_jobs_list_by_status_url(current_user.id,\"open\")) }\n format.html {redirect_to invest_funds_job_path(@job)}\n format.xml { render :xml => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\n printer_ids = JSON.parse(job_params[:printer])\n\n printers = Printer.where(id: printer_ids)\n\n job_params_fixed = job_params\n\n job_params_fixed[:printer] = nil\n\n\n printers.each do |printer|\n\n @job = Job.new(job_params_fixed)\n\n @job.printer = printer\n\n @job.status = \"Unassigned\"\n @job.save\n end\n\n redirect_to root_path\n\n # respond_to do |format|\n # if @job.save\n # format.html { redirect_to @job, notice: 'Job was successfully created.' }\n # format.json { render :show, status: :created, location: @job }\n # else\n # format.html { render :new }\n # format.json { render json: @job.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def create\n @job = current_company.jobs.build(params[:job])\n respond_to do |format|\n if @job.save\n format.html { redirect_to root_path, notice: 'Vaga criada com sucesso' }\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 end",
"def create\n @job = @user.jobs.new(params[:job])\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to :dashboard, 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 end",
"def create\n @job = current_user.jobs.new(job_params)\n respond_to do |format|\n if @job.save\n \ttrack_activity @job\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@job = Job.new(params[:job])\n\n\t\trespond_to do |format|\n\t\t\tif @job.save\n\t\t\t\tformat.html { redirect_to @job, notice: 'Job was successfully created.' }\n\t\t\t\tformat.json { render json: @job, status: :created, location: @job }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @job.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @job = Job.new(job_params)\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to root_path, notice: 'Job was successfully created.' }\n format.json { render action: 'show', 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 end",
"def create\n @job = Job.new(job_params)\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render action: 'show', 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 end",
"def getJobApi (options)\n uri = options[:job] + \"?depth=\" + options[:depth].to_s\n job_uri = URI.parse(uri)\n http = Net::HTTP.new(job_uri.host, job_uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(job_uri.request_uri)\n request.basic_auth @username, @password\n response = http.request(request)\n job_xml=XmlSimple.xml_in(response.body)\n return job_xml\n end",
"def jobs\r\n end",
"def create\n @job = Job.new(params[:job])\n\t\t@job.person = current_user\n\n respond_to do |format|\n if @job.save\n flash[:notice] = 'Job Proposal successfully created.'\n format.html { redirect_to(@job) }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @jobs = Job.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jobs }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def request(name,job)\n rz_send(service_socket(name),[JSON.dump(job)])\n self\n end",
"def do_submit\n @job = Job.find(params[:id])\n @queue = JobsQueue.find_by_id(params[:job][:jobs_queue_id]) || JobsQueue.default_queue\n respond_to do |format|\n if @job.submit(@queue)\n flash[:notice] = 'Job was successfully submitted.'\n format.html { redirect_to(@job) }\n format.xml { head :ok }\n else\n format.html { render :action => \"show\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @job = Job.new(job_params)\n @job.user = current_user\n if @job.save\n render json: { redirect_url: job_url(@job), notice: \"Thanks for posting! Your job is now pending review.\" }\n else\n render json: @job.errors\n end\n end",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", {\"passed\" => success}.to_json, :content_type => :json\nend",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend",
"def create\n job = Job.create(job_params)\n render json: job\n end",
"def create\n @job = @user.jobs.new(job_params)\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to :dashboard, 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 end",
"def index\n @nodes = @job.nodes.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nodes }\n format.json { render :json => @nodes }\n end\n end",
"def create\n @job = Vger::Resources::Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to company_job(:company_id => params[:company_id], :id => @job.id), notice: 'Job was successfully created.' }\n else\n format.html { render action: \"new\" }\n end\n end\n end",
"def create(options = {})\n res = self.post \"/translate/jobs\", :body => options\n check_for_errors(res)\n res['response']\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job_runner }\n end\n end",
"def job_params\n params.require(:job).permit(:document, :copies, :configuration, :status, :printer, :description)\n end",
"def create\n @pending_job = PendingJob.new(pending_job_params)\n current_stage = 'E'\n @pending_job.time_queued = Time.now\n @pending_job.current_stage = current_stage\n @pending_job.current_stage_started = Time.now\n\n respond_to do |format|\n if @pending_job.save\n EFinishJob.perform_in(1.minutes, @pending_job.id, @pending_job.course, @pending_job.assignment, @pending_job.username)\n format.html { redirect_to @pending_job, notice: 'Pending job was successfully created.' }\n format.json { render :show, status: :created, location: @pending_job }\n else\n format.html { render :new }\n format.json { render json: @pending_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if @job_runner.save\n format.html { redirect_to(@job_runner, :notice => 'Job runner was successfully created.') }\n format.xml { render :xml => @job_runner, :status => :created, :location => @job_runner }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job_runner.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @postjob = Postjob.new(postjob_params)\n\n respond_to do |format|\n if @postjob.save\n format.html { redirect_to @postjob, notice: 'Postjob was successfully created.' }\n format.json { render :show, status: :created, location: @postjob }\n else\n format.html { render :new }\n format.json { render json: @postjob.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job = Job.new(job_params)\n @job.creator = current_user\n @job.tasks.each do |task|\n if @job.job_type.present?\n task.type = \"#{@job.job_type.to_s.singularize.capitalize}Task\"\n end\n task.creator = current_user\n task.worker ||= current_user\n task.payoff_amount_cents ||= 0\n end\n respond_to do |format|\n if @job.save\n @job.tasks.each{ |task| task.set_price }\n format.html {\n if params[:commit].to_s.match(/save.*new/i)\n redirect_to new_job_path(client_id: @job.client_id, job_type: @job.job_type), notice: 'Job was successfully created. Create another one below...' \n else\n redirect_to @job, notice: 'Job was successfully created.'\n end\n }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def send_job(job)\n begin\n response = RestClient::Request.execute(\n method: :post,\n url: build_jobs_url,\n payload: job.to_codem_json,\n timeout: EBU::NETWORK_TIMEOUT,\n open_timeout: EBU::NETWORK_TIMEOUT\n )\n if response.code == 202\n if (obj = JSON.parse(response.to_str))\n obj[\"job_id\"]\n else\n raise \"Job #{job.id} was created on transcoder #{self.id}, but no job ID was returned.\"\n end\n else\n nil\n end\n rescue Timeout::Error => e\n nil\n rescue => e\n nil\n end\n end",
"def job_params\n params.require(:job).permit(:name, :client_id, :description, :quantity, :datein, :duedate, :completeper, :expectedin, :completed, :status, :comment)\n end",
"def job_params\n params.require(:job).permit(:name, :target, :current, :status)\n end",
"def post_config(url_prefix, xml)\n url_prefix = URI.escape(\"#{@jenkins_path}#{url_prefix}\")\n http = Net::HTTP.start(@server_ip, @server_port)\n request = Net::HTTP::Post.new(\"#{url_prefix}\")\n puts \"[INFO] PUT #{url_prefix}\" if @debug\n request.basic_auth @username, @password\n request.body = xml\n request.content_type = 'application/xml'\n response = http.request(request)\n response.code\n end",
"def create\n http = Net::HTTP.new(\"#{@server_instance}.salesforce.com\", 443)\n http.use_ssl = true\n\n job_request = generate_create_request.lstrip\n logger.debug job_request\n response = http.post('/services/async/21.0/job',\n job_request,\n {\"Content-Type\" => \"application/xml;charset=UTF-8\", \"X-SFDC-Session\" => @session_id})\n\n return response.body if response.class != Net::HTTPCreated\n\n job_response = JobResponse.fromXML(response.body)\n @sf_job_id = job_response.job_id\n job_response\n end",
"def list_jobs(json_payload={})\n conn = @client.get do |req|\n req.url '/api/v2/job/list?'\n req.headers[\"Authorization\"] = @token\n req.params = json_payload\n end\n conn.body\n end",
"def get_jobs_sample(client)\n response = client['jobs'].get\n\n p ''\n p 'Get jobs'\n p response\nend",
"def job_params\n params.require(:job).permit(:title, :description, :name, :email, :category, :deadline)\n end",
"def jobs_post(body, opts = {})\n data, status_code, headers = jobs_post_with_http_info(body, opts)\n return data\n end",
"def print_job_sample(client)\n response = client[\"jobs/#{$job_id}/print\"].put nil\n\n p ''\n p 'Print a job'\n p response\nend",
"def create\n @create_job = CreateJob.new(create_job_params)\n\n respond_to do |format|\n if @create_job.save\n format.html { redirect_to @create_job, notice: 'Create job was successfully created.' }\n format.json { render :show, status: :created, location: @create_job }\n else\n format.html { render :new }\n format.json { render json: @create_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @act_job = ActJob.new(act_job_params)\n\n respond_to do |format|\n if @act_job.save\n format.html { redirect_to @act_job, notice: 'Act job was successfully created.' }\n format.json { render :show, status: :created, location: @act_job }\n else\n format.html { render :new }\n format.json { render json: @act_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @findjob = Findjob.new(findjob_params)\n\n respond_to do |format|\n if @findjob.save\n format.html { redirect_to @findjob, notice: 'Findjob was successfully created.' }\n format.json { render :show, status: :created, location: @findjob }\n else\n format.html { render :new }\n format.json { render json: @findjob.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job_status = JobStatus.new(params[:job_status])\n\n respond_to do |format|\n if @job_status.save\n flash[:notice] = 'JobStatus was successfully created.'\n format.html { redirect_to([:admin, @job_status]) }\n format.xml { render :xml => @job_status, :status => :created, :location => @job_status }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job_status.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @job = Job.new(job_params)\n\n if params[:job][:staff].present?\n params[:job][:staff].each do |s|\n @job.staff << Staff.where(id: s)\n end\n end\n if params[:job][:contractor].present?\n @job.contractor = Contractor.find(params[:job][:contractor])\n end\n if params[:job][:date_completed].present? and params[:job][:date_payment_recv].present? and params[:job][:date_completed] <= Time.now and params[:job][:date_payment_recv] <= Time.now\n @job.status = 0\n end\n puts @job.inspect\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n # after @job.save, initially the job is in a \"pending\" state.\n @job.initialize_job_parameters \n @job.nextstep! # pending - > launch_pending\n logger.debug( 'initiating background cluster launch...' ) \n # job state is now \"launching_instances\"... \n Delayed::Job.enqueue ClusterLaunchJob.new(@job) \n flash[:notice] = 'Job was successfully submitted.' \n\n format.html { redirect_to(jobs_url) }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n format.json { render :json => @job, :status => :created, :location => @job } \n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n format.json { render :json => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @node = @job.nodes.build \n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n format.json { render :json => @node } \n end\n end",
"def job_params\n params.require(:job).permit(:titolo, :sito_web, :email, :descrizione, :nome_azienda)\n end",
"def create\n flash[:notice] = 'Job Created' if @job_category.jobs.create params[:job]\n respond_with @job.job_category, @job\n end",
"def export_jobs(project, format = 'yaml', options = {})\n unless format =~ /yaml|xml/\n fail Error::InvalidAttributes, 'format must be yaml or xml'\n end\n options[:query] = {} if options[:query].nil?\n options[:query].merge!('project' => project, 'format' => format)\n options[:format] = format\n\n get('/jobs/export', options)\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end"
] | [
"0.6847216",
"0.6769806",
"0.6390787",
"0.6271662",
"0.62408996",
"0.623112",
"0.6220346",
"0.62202764",
"0.61930704",
"0.61842257",
"0.61842257",
"0.61842257",
"0.61842257",
"0.6176608",
"0.6159866",
"0.61387354",
"0.61259687",
"0.6044265",
"0.60097986",
"0.60044014",
"0.59848547",
"0.59519434",
"0.59239995",
"0.59173816",
"0.5905101",
"0.5882611",
"0.5865661",
"0.5843758",
"0.58378845",
"0.583621",
"0.58353215",
"0.58255166",
"0.5814983",
"0.5794246",
"0.5794246",
"0.5794246",
"0.5791247",
"0.5785707",
"0.57853353",
"0.5765309",
"0.5754335",
"0.5746185",
"0.5744035",
"0.57352364",
"0.5728426",
"0.57251984",
"0.57096505",
"0.5704218",
"0.56966263",
"0.5693658",
"0.5685915",
"0.5680155",
"0.56697845",
"0.56650007",
"0.56643057",
"0.56592685",
"0.5658721",
"0.5655188",
"0.5655188",
"0.5655188",
"0.5645878",
"0.5638946",
"0.5631514",
"0.5616732",
"0.5609388",
"0.5602307",
"0.5598845",
"0.5593225",
"0.5590093",
"0.5585342",
"0.55736697",
"0.55638516",
"0.55596143",
"0.5559342",
"0.55523545",
"0.55507267",
"0.5548993",
"0.554443",
"0.55398065",
"0.552393",
"0.55218905",
"0.5520184",
"0.55187184",
"0.55173033",
"0.551124",
"0.55108356",
"0.5509686",
"0.55077946",
"0.55057997",
"0.5500915",
"0.54998547",
"0.5495091",
"0.5495091",
"0.5495091",
"0.5495091",
"0.5495091",
"0.5495091",
"0.5495091",
"0.5495091",
"0.5495091"
] | 0.57868326 | 37 |
PUT /jobs/1 PUT /jobs/1.xml | def update
@job = Job.find(params[:id])
respond_to do |format|
if @job.update_attributes(params[:job])
format.html { redirect_to(edit_admin_job_path(@job), :notice => 'Job was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @job.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", {\"passed\" => success}.to_json, :content_type => :json\nend",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend",
"def update_job(job:)\n response = HTTParty.put(\"#{@host}/api/jobs/#{job[:id]}\", body: {job: job, api_key: @api_key})\n \n return response.success?\n end",
"def update\n @job = Job.find(params[:id])\n if @job.update_attributes(params[:job])\n response_message = {:message => \"Job updated successfully.\", :job => @job}\n else\n response_message = {:message => \"Job updation failed. Please try again!\"}\n end\n\n respond_to do |format|\n format.xml { render :xml => response_message }\n format.json { render :json => response_message }\n end\n end",
"def update(id, job)\n connection.put do |req|\n req.url \"job/#{id}\"\n req.body = job\n end\n end",
"def update\n @job = @user.jobs.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to(@job, :notice => 'Job was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update_attributes(params[:job])\n flash[:notice] = 'Job was successfully updated.'\n format.html { redirect_to(@job) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n # FIXME: this should use retry_it\n xml = render_template\n begin\n print \"Updating #{job_name}\\n\"\n xml_debug(xml) if @debug\n Jenkins.job.create_or_update(job_name, xml)\n rescue => e\n # FIXME: use retry_it to fail after a number of tries\n puts e\n retry\n end\n job_name\n end",
"def update\n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n flash[:notice] = 'Job was successfully updated.'\n format.html { redirect_to(@job) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n flash[:notice] = 'Job was successfully updated.'\n format.html { redirect_to(@job) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n flash[:notice] = 'Job was successfully updated.'\n format.html { redirect_to(@job) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n flash[:notice] = 'Job was successfully updated.'\n format.html { redirect_to job_url(@job) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job.errors.to_xml }\n end\n end\n end",
"def update\n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to(@job, :notice => 'Job was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to(@job, :notice => 'Job was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n job = Job.find(params[:id])\n job.update_attributes(job_params)\n render json: job\n end",
"def update\n @job = Job.find(params[:id])\n \n # todo:\n # add permission checking here\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n flash[:notice] = 'Job was successfully updated.'\n format.html { redirect_to(@job) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_job_config(job_name, xml)\n jobs.update(job_name, xml.to_s)\n end",
"def action_update\n if job_exists\n post_job(job_url)\n else\n post_job(new_job_url)\n end\nend",
"def update\n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n flash[:notice] = 'Job was successfully updated.'\n\n format.html { redirect_to(@job) }\n format.xml { head :ok }\n format.json { head :ok } \n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n format.json { render :json => @job.errors, :status => :unprocessable_entity } \n end\n end\n end",
"def update\n @job = @user.jobs.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n @job = current_member.jobs.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(job_params)\n format.html { redirect_to @job, notice: 'The stuff you want done was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @job = Job.find(params[:id])\n\n if @job.update_attributes(params[:job])\n flash[:success] = \"The job has been updated!\"\n redirect_to root_url\n end\n\n end",
"def update\n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update #:nodoc:\n job = Job.find(params[:id])\n job.enter(params[:status], params, request.headers)\n respond_with job, location: api_job_url(job)\n end",
"def update\n begin\n @job_request = job_requests.find( params[ :id ] )\n rescue ActiveRecord::RecordNotFound\n @job_request = nil\n end\n\n respond_to do |format|\n if @job_request && @job_request.update_attributes( params[ :job_request ] )\n format.html { redirect_to root_path, notice: \"Job Requests Updated Successfully\"}\n format.json { head :no_content }\n else\n format.html { redirect_to root_path, notice: \"Update Failed\" }\n format.json { render json: @job_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @job = Job.find(params[:id])\n @job.update({\n name: params[:job][:name],\n description: params[:job][:description],\n origin: params[:job][:origin],\n destination: params[:job][:destination],\n cost: params[:job][:cost],\n containers_needed: params[:job][:containers_needed]\n })\n\n if (@job)\n redirect_to url_for(:controller => :jobs, :action => :index)\n else\n redirect_to url_for(:controller => :jobs, :action => :edit)\n end\n end",
"def update\n @job = Mugen::Job.update(params[:id])\n \n redirect_to mygengo_jobs_path\n end",
"def update\n @job = Job.find_by_permalink!(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n flash[:notice] = 'Job was successfully updated.'\n format.html { redirect_to(@job) }\n format.xml { head :ok }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @job = current_user.jobs.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n flash[:notice] = t('jobs_controller.update.success')\n format.html { redirect_to @job}\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if UbiquoJobs.manager.update(params[:id], params[:job])\n flash[:notice] = t(\"ubiquo.jobs.job_edited\")\n format.html { redirect_to(ubiquo.jobs_path) }\n format.xml { head :ok }\n format.js\n else\n flash[:error] = t(\"ubiquo.jobs.cant_edit\")\n format.html { render :action => \"edit\" }\n format.xml { render :status => :unprocessable_entity }\n format.js\n end\n end\n end",
"def update\n #@job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @job = @user.jobs.find(params[:id])\n\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: \"Job was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to app_jobs_path, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n record_activity :update, @job\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def start_job\n associate(Wesabe::Job.from_xml(Hpricot::XML(post(:url => \"/credentials/#{id}/jobs.xml\")) / :job))\n end",
"def update\n byebug\n respond_to do |format|\n if @job.update(send(\"#{@job.type.underscore.to_sym}_params\"))\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @job = Job.find(params[:id])\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to @job, notice: 'Job was successfully accepted.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @job_status = JobStatus.find(params[:id])\n\n respond_to do |format|\n if @job_status.update_attributes(params[:job_status])\n flash[:notice] = 'JobStatus was successfully updated.'\n format.html { redirect_to([:admin, @job_status]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job_status.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, success: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_jenkins_job(name, xml_file)\n create_url = \"http://#{Pkg::Config.jenkins_build_host}/createItem?name=#{name}\"\n form_args = [\"-H\", '\"Content-Type: application/xml\"', \"--data-binary\", \"@#{xml_file}\"]\n curl_form_data(create_url, form_args)\n \"http://#{Pkg::Config.jenkins_build_host}/job/#{name}\"\nend",
"def create_batch_job(job_id)\n request = Net::HTTP::Put.new(\"/jobs/#{job_id}\")\n response = http.request(request)\n handle_response({ request_method: request.method, request_path: request.path }, response)\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to jobs_path, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @job = Job.find(params[:id])\n #@job.last_finish = nil\n @job.started_once = false\n respond_to do |format|\n if @job.update_attributes(params[:job])\n if @job.childs\n recursive_change_supplier(@job, @job.supplier)\n end\n format.html { redirect_to(@job.parent.present? ? supplier_job_path(params[:supplier_id], @job.parent.id) : supplier_jobs_path(params[:supplier_id]), :notice => 'Задача успешно обновлена') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: \"Job was successfully updated.\" }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @job_item = @job.job_items.find(params[:id])\n\n respond_to do |format|\n if @job_item.update_attributes(params[:job_item])\n format.html { redirect_to [@job, @job_item], notice: 'Job item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @job = Job.find(params[:id])\n case params[:status]\n when \"requested\"\n @job.status :requested\n when \"printed\"\n @job.status :printed\n when \"paid\"\n @job.status :paid\n end\n \n @job.save\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n flash[:notice] = 'Job was successfully updated.'\n format.html { redirect_to(@job) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @saved_job = SavedJob.find(params[:id])\n\n respond_to do |format|\n if @saved_job.update_attributes(params[:saved_job])\n format.html { redirect_to @saved_job, :notice => 'Saved job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @saved_job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to root_path, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @myjob.update(myjob_params)\n format.html { redirect_to @myjob, notice: 'Myjob was successfully updated.' }\n format.json { render :show, status: :ok, location: @myjob }\n else\n format.html { render :edit }\n format.json { render json: @myjob.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_job_content_sample(client)\n job_multipart = {\n :file => File.new($full_path),\n 'num copies' => 10\n }\n\n response = client['jobs'].post job_multipart\n\n p ''\n p 'Submit a new job'\n p response\nend",
"def update\n @job_title = JobTitle.find(params[:id])\n\n respond_to do |format|\n if @job_title.update_attributes(params[:job_title])\n flash[:notice] = 'JobTitle was successfully updated.'\n format.html { redirect_to(@job_title) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job_title.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @create_job.update(create_job_params)\n format.html { redirect_to @create_job, notice: 'job was successfully updated.' }\n format.json { render :show, status: :ok, location: @create_job }\n else\n format.html { render :edit }\n format.json { render json: @create_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @job_folio = JobFolio.find(params[:id])\n\n respond_to do |format|\n if @job_folio.update_attributes(params[:job_folio])\n format.html { redirect_to @job_folio, notice: 'Job folio was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job_folio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_job xml, name\n\t\t\tputs \"==> Creating job for project: '#{name}'\"\n\t\t\tbegin\n\t\t\t\tcreate_response = RestClient.post \"#{@jenkins_host}:#{@jenkins_port}/createItem/?name=#{name}\", xml , {:content_type => :xml}\n\t\t\t\treturn create_response.code.to_s\n\t\t\trescue Exception => e\n\t\t\t\tputs \"==> Error creating job #{name}\"\n\t\t\t\treturn \"500\"\n\t\t\tend\n\t\tend",
"def update\n @training_active_job = Training::ActiveJob.find(params[:id])\n\n respond_to do |format|\n if @training_active_job.update_attributes(params[:training_active_job])\n format.html { redirect_to @training_active_job, notice: 'Active job was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @training_active_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def update_process(job_id:, step:, status:, msg:)\n HTTParty.get(\"#{@host}/api/process/#{job_id}\", query: {\n process_code: @process_code,\n step: step,\n status: status,\n msg: msg,\n api_key: @api_key\n })\n end",
"def update\n if @job.update(job_params)\n @job.update(category: @category)\n @job.update(keywords: @keywords)\n render json: @job, status: :accepted\n else\n render json: @job.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @pending_job.update(pending_job_params)\n format.html { redirect_to @pending_job, notice: 'Pending job was successfully updated.' }\n format.json { render :show, status: :ok, location: @pending_job }\n else\n format.html { render :edit }\n format.json { render json: @pending_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @job = Job.find_by_job_number(params[:id])\n @job.client_id = params[:job][:client_id]\n\n # if any seeds file is uploaded, save the status to the job uploaded_seeds_file accessor\n @job.uploaded_seeds_file = true if params[:job][:seeds_definition_file].present?\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n if params[:job][:track_returns_type] == \"job\"\n @job.versions.each do |version|\n version.version_tracking_number = \"0000\"\n version.save\n end\n end\n\n if @job.errors.empty?\n if params[:job][:seeds_definition_file].present?\n flash[:notice] = 'Job was successfully updated. Please stand by as seeds are loaded and processed.'\n else\n flash[:notice] = 'Job was successfully updated'\n end\n else\n flash[:notice] = \"Job sucessfully updated with the following warnings: \" + @job.errors.full_messages[0,10].join(\"\\n\")\n end\n format.html { redirect_to job_url(@job) }\n format.xml { head :ok }\n else\n flash[:notice] = @job.errors.full_messages[0,10].join(\"\\n\")\n format.html { redirect_to edit_job_path(@job) }\n format.xml { render :xml => @job.errors.to_xml }\n end\n end\n end",
"def set_job\n @job = Job.find_by_id(params[:id])\n if @job == nil\n head :not_found\n end\n end",
"def update\n @sfjob = Sfjob.find(params[:id])\n\n respond_to do |format|\n if @sfjob.update_attributes(params[:sfjob])\n format.html { redirect_to @sfjob, notice: 'Sfjob was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sfjob.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @items_print_job = ItemsPrintJob.find(params[:id])\n\n respond_to do |format|\n if @items_print_job.update_attributes(params[:items_print_job])\n format.html { redirect_to(@items_print_job, :notice => 'Items print job was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @items_print_job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @locations = Location.find(:all, :conditions=>['user_id=?',current_user.id])\n params[:job][:existing_location_attributes] ||= {}\n\n @job = Job.find(params[:id])\n process_file_uploads(@job)\n respond_to do |format|\n if @job.update_attributes(params[:job])\n flash[:notice] = 'Job was successfully updated.'\n # format.html { redirect_to(show_job_path(@job.title.parameterize.downcase.wrapped_string,@job.id)) }\n format.html {redirect_to invest_funds_job_path(@job)}\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end",
"def update\n respond_to do |format|\n if @job_runner.update_attributes(params[:job_runner])\n format.html { redirect_to(@job_runner, :notice => 'Job runner was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job_runner.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n authorize!(@job)\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @act_job.update(act_job_params)\n format.html { redirect_to @act_job, notice: 'Act job was successfully updated.' }\n format.json { render :show, status: :ok, location: @act_job }\n else\n format.html { render :edit }\n format.json { render json: @act_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = current_user.tasks.find(params[:id])\n # Tasks may not change job, so no assigment like the Create action\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n flash[:notice] = 'Task was successfully updated.'\n format.html { redirect_to job_url(@task.job) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @task.errors.to_xml }\n end\n end\n end",
"def destroy\n node = @job.nodes.find(params[:id])\n @job.nodes.delete(node)\n\n respond_to do |format|\n format.html { redirect_to job_url(@job) }\n format.xml { head :ok }\n end\n end",
"def set_job\n @job = @company.jobs.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to mentor_job_path(@job), notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end"
] | [
"0.6630085",
"0.6558216",
"0.6558216",
"0.6558216",
"0.6536446",
"0.65334105",
"0.64888644",
"0.6390682",
"0.63784367",
"0.6359745",
"0.6359351",
"0.6359351",
"0.6359351",
"0.6358652",
"0.6320766",
"0.6320766",
"0.61899805",
"0.61413044",
"0.6108961",
"0.6103982",
"0.60902303",
"0.6081068",
"0.60757047",
"0.6027701",
"0.6000748",
"0.5999831",
"0.59859633",
"0.59776425",
"0.5977253",
"0.59755623",
"0.5940563",
"0.59291846",
"0.5916953",
"0.5913414",
"0.590513",
"0.58707815",
"0.58337367",
"0.58318675",
"0.5825015",
"0.58171827",
"0.5804178",
"0.5796651",
"0.5779494",
"0.57715976",
"0.57715976",
"0.57715976",
"0.57715976",
"0.57715976",
"0.57715976",
"0.57715976",
"0.57715976",
"0.57715976",
"0.57715976",
"0.57715976",
"0.57715976",
"0.57715976",
"0.57715976",
"0.5764777",
"0.5738368",
"0.5737354",
"0.5733814",
"0.573186",
"0.57306874",
"0.5730553",
"0.5726788",
"0.57233757",
"0.5720678",
"0.57201064",
"0.5705361",
"0.5704809",
"0.56801534",
"0.5672912",
"0.5664923",
"0.5651893",
"0.5630992",
"0.56263465",
"0.56254923",
"0.56064403",
"0.56064403",
"0.56064403",
"0.5605427",
"0.560169",
"0.5589662",
"0.55789685",
"0.5569024",
"0.5565119",
"0.556262",
"0.55557376",
"0.55517304",
"0.55370045",
"0.55333894",
"0.55299324",
"0.5524086",
"0.55220777",
"0.55202866",
"0.55105364",
"0.55099857",
"0.5500356",
"0.5500356",
"0.5500356"
] | 0.61285007 | 18 |
DELETE /jobs/1 DELETE /jobs/1.xml | def destroy
@job = Job.find(params[:id])
@job.deactivate!
flash[:notice] = "Job successfully deactivated."
respond_to do |format|
format.html { redirect_to(edit_admin_job_url(@job)) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n node = @job.nodes.find(params[:id])\n @job.nodes.delete(node)\n\n respond_to do |format|\n format.html { redirect_to job_url(@job) }\n format.xml { head :ok }\n end\n end",
"def delete(id)\n connection.delete do |req|\n req.url \"job/#{id}\"\n end\n end",
"def destroy\n @job = @user.jobs.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy \n @job = Mugen::Job.delete(params[:id])\n \n respond_to do |format|\n format.html { redirect_to(mygengo_jobs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n if UbiquoJobs.manager.delete(params[:id])\n flash[:notice] = t(\"ubiquo.jobs.job_removed\")\n else\n flash[:error] = t(\"ubiquo.jobs.cant_remove\")\n end\n\n respond_to do |format|\n format.html { redirect_to(ubiquo.jobs_path) }\n format.xml { head :ok }\n end\n end",
"def delete\n job_resource.delete\n end",
"def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.xml { head :ok }\n end\n end",
"def delete_job(sid)\n\t\t\tresponse = connection.delete(\"search/jobs/#{sid}\")\n\t\t\treturn_error_or_body(response, response.body)\n\t\tend",
"def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def remove_jobs(job_ids)\n\n job_ids.each do |id|\n api_url = \"#{BASE_URL}/v4/projects/#{PROJECT_ID}/jobs/#{id}/erase\"\n\n begin\n response = RestClient::Request.new(\n :method => :post,\n :url => api_url,\n :verify_ssl => false,\n :headers => {\"PRIVATE-TOKEN\" => API_TOKEN}\n ).execute\n\n if response != nil && response.code == 204\n puts \"delete job #{id} => success\"\n else\n puts \"delete job #{id} => failed\"\n end\n\n rescue RestClient::ExceptionWithResponse => err\n puts \"delete job artifacts #{id} => error\"\n end\n\n end\n\nend",
"def destroy\n @job_status = JobStatus.find(params[:id])\n @job_status.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_job_statuses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n Job.destroy(params[:id])\n end",
"def destroy\n @job_runner.destroy\n\n respond_to do |format|\n format.html { redirect_to(job_runners_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @job.destroy\n redirect_to root_url\n end",
"def destroy\n @job = current_member.jobs.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job = Job.destroy(params[:id])\n redirect_to jobs_path\n end",
"def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :ok }\n end\n end",
"def delete_job name\n\t\t\tputs \"==> Deleting job: '#{name}'\"\n\t\t\tRestClient.post(\"#{@jenkins_host}:#{@jenkins_port}/job/#{name}/doDelete\", {}){ |response, request, result, &block|\n\t\t\t\tif [301, 302, 307].include? response.code\n \t\t\t\t\tresponse.follow_redirection(request, result, &block)\n \t\t\t\telse\n \t\t\t\tresponse.return!(request, result, &block)\n \t\t\t\tend\n \t\t\t}\n \t\t\treturn true\n\t\tend",
"def delete\n (status,error) = execio \"sudo -u #{self.job_owner} qdel #{self.jobid}\", nil\n if status.class == String and status.match(/^.*job.*#{self.jobid}.*/)\n self.state = \"d\"\n return 0\n else\n raise RuntimeError, \"Deletion of job #{self.jobid} failed!\"\n return nil\n end\n end",
"def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job = Job.find(params[:id])\n @job.destroy\n redirect_to jobs_path\n end",
"def destroy\n @job = Job.find_by_job_number(params[:id])\n if admin?\n @job.destroy\n end\n respond_to do |format|\n format.html { redirect_to :back }\n format.xml { head :ok }\n end\n end",
"def destroy\n #@job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job_scope_addition = JobScopeAddition.find(params[:id])\n jid = @job_scope_addition.jobs_id\n jsa_id = params[:id]\n recs = AdditionTaskRecord.find_all_by_jobs_id(jsa_id)\n delete_records(recs)\n @job_scope_addition.destroy\n\n respond_to do |format|\n format.html { redirect_to(\"#{job_scope_additions_url}?jid=#{jid}\") }\n format.xml { head :ok }\n end\n end",
"def destroy\n @job.destroy # all support documents automatically get destroyed\n flash[:success] = \"Job has been successfully deleted\"\n redirect_to active_jobs_path\n end",
"def destroy\n respond_with Job.find(params[:id]).delete\n end",
"def destroy\n @job_title = JobTitle.find(params[:id])\n @job_title.destroy\n\n respond_to do |format|\n format.html { redirect_to(job_titles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @job = Job.find(params[:id])\n if @job.destroy\n response_message = {:message => \"Job deleted successfully.\", :job => @job}\n else\n response_message = {:message => \"Job deletion failed. Please try again!\"}\n end\n\n respond_to do |format|\n format.xml { render :xml => response_message }\n format.json { render :json => response_message }\n end\n end",
"def destroy\n @job = @user.jobs.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to :dashboard, notice: 'Job was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job = @user.jobs.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to :dashboard, notice: \"Job was successfully deleted.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n redirect_to jobs_path, notice:'Job deleted.'\n end",
"def destroy\n @task = current_user.tasks.find(params[:id])\n job = @task.job\n @task.destroy\n\n flash[:notice] = 'Task was deleted'\n\n respond_to do |format|\n format.html { redirect_to job_url(job) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @items_print_job = ItemsPrintJob.find(params[:id])\n @items_print_job.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_print_jobs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dailyreport_job = DailyreportJob.find(params[:id])\n @dailyreport_job.destroy\n\n respond_to do |format|\n format.html { redirect_to(dailyreport_jobs_url) }\n format.xml { head :ok }\n end\n end",
"def remove_artifacts(job_ids)\n\n job_ids.each do |id|\n api_url = \"#{BASE_URL}/v4/projects/#{PROJECT_ID}/jobs/#{id}/artifacts\"\n\n begin\n response = RestClient::Request.new(\n :method => :delete,\n :url => api_url,\n :verify_ssl => false,\n :headers => {\"PRIVATE-TOKEN\" => API_TOKEN}\n ).execute\n\n if response != nil && response.code == 204\n puts \"delete job artifacts #{id} => success\"\n else\n puts \"delete job artifacts #{id} => failed\"\n end\n\n rescue RestClient::ExceptionWithResponse => err\n puts \"delete job artifacts #{id} => error\"\n end\n end\n\nend",
"def destroy\n @print_job_status = PrintJobStatus.find(params[:id])\n @print_job_status.destroy\n\n respond_to do |format|\n format.html { redirect_to(print_job_statuses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @filter_job = FilterJob.find(params[:id])\n @filter_job.destroy\n\n respond_to do |format|\n format.html { redirect_to(filter_jobs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @launched_job.destroy\n respond_to do |format|\n format.html { redirect_to launched_jobs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @saved_job = SavedJob.find(params[:id])\n @saved_job.destroy\n\n respond_to do |format|\n format.html { redirect_to saved_jobs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def purge\n \n @job = DialJob.find(params[:id])\n\t@job.dial_results.each do |r|\n\t\tr.destroy\n\tend\n\t@job.destroy\n\t\n\tdir = nil\n\tjid = @job.id\n\tdfd = Dir.new(WarVOX::Config.data_path)\n\tdfd.entries.each do |ent|\n\t\tj,m = ent.split('-', 2)\n\t\tif (m and j == jid)\n\t\t\tdir = File.join(WarVOX::Config.data_path, ent)\n\t\tend\n\tend\n\t\n\tFileUtils.rm_rf(dir) if dir\n\n respond_to do |format|\n format.html { redirect_to :action => 'index' }\n format.xml { head :ok }\n end\n end",
"def destroy\n ensure_authenticated!\n job = OAR::Job.find(params[:id])\n authorize!(job.user)\n\n url = uri_to(\n site_path(\n params[:site_id]\n )+\"/internal/oarapi/jobs/#{params[:id]}.json\",\n :out\n )\n http = EM::HttpRequest.new(url).delete(\n :timeout => 5,\n :head => {\n 'X-Remote-Ident' => @credentials[:cn],\n 'Accept' => media_type(:json)\n }\n )\n\n continue_if!(http, :is => [200,202,204,404])\n\n if http.response_header.status == 404\n raise NotFound, \"Cannot find job##{params[:id]} on the OAR server\"\n else\n response.headers['X-Oar-Info'] = (\n JSON.parse(http.response)['oardel_output'] || \"\"\n ).split(\"\\n\").join(\" \") rescue \"-\"\n\n location_uri = uri_to(\n resource_path(params[:id]),\n :in, :absolute\n )\n\n render :text => \"\",\n :head => :ok,\n :location => location_uri,\n :status => 202\n end\n end",
"def destroy\n @job_item = @job.job_items.find(params[:id])\n @job_item.destroy\n\n respond_to do |format|\n format.html { redirect_to [@job] }\n format.json { head :ok }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to mentor_jobs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to app_jobs_path, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n respond_to do |format|\n if result = @job.destroy_job === true \n flash[:notice] = 'Job was deleted.'\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n else\n flash[:notice] = result\n format.html { redirect_to(jobs_url) }\n format.xml { render :xml => result, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @job_student = JobStudent.find(params[:id])\n @job_student.destroy\n\n respond_to do |format|\n format.html { redirect_to(job_students_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @sfjob = Sfjob.find(params[:id])\n @sfjob.destroy\n\n respond_to do |format|\n format.html { redirect_to sfjobs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job = Job.find(params[:id])\n @job.hidden = true\n\t\t@job.save\n\n\t\tif @job.save\n\t\t flash[:notice] = 'Job successfully removed.'\n\t\tend\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @myjob.destroy\n respond_to do |format|\n format.html { redirect_to myjobs_url, notice: 'Myjob was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @act_job.destroy\n respond_to do |format|\n format.html { redirect_to act_jobs_url, notice: 'Act job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @training_active_job = Training::ActiveJob.find(params[:id])\n @training_active_job.destroy\n\n respond_to do |format|\n format.html { redirect_to training_active_jobs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @saved_job.destroy\n respond_to do |format|\n format.html { redirect_to saved_jobs_url, notice: t('saved_jobs_controller.saved_jobs_delete_success') }\n format.json { head :no_content }\n end\n end",
"def delete\n ensure_service!\n service.delete_job job_id, location: location\n true\n end",
"def destroy\n @job_folio = JobFolio.find(params[:id])\n @job_folio.destroy\n\n respond_to do |format|\n format.html { redirect_to job_folios_url }\n format.json { head :ok }\n end\n end",
"def destroy\n authorize!(@job)\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @import_job.destroy\n respond_to do |format|\n format.html { redirect_to import_jobs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job = current_user.posted_jobs.find(params[:id])\n @job.try(:destroy)\n render json: {}\n end",
"def destroy\n @job = Job.find(params[:id])\n if current_user.is_an_admin? or @job.status != \"paid\"\n @job.destroy\n else\n flash[:error] = \"Paid jobs can only be modified by an administrator.\"\n end\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @quartz = Quartz.find(params[:id])\n @quartz.destroy\n\n respond_to do |format|\n format.html { redirect_to(quartzs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, success: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n flash[:success] = 'Job was successfully destroyed.' \n redirect_to jobs_url \n end",
"def destroy\n @db_job.destroy\n respond_to do |format|\n format.html { redirect_to db_jobs_url, notice: 'Db job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: \"Job was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to @job, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def jobs_del\r\n job_profile_id = params[:job_profile_id]\r\n job_profile = JobProfile.find(job_profile_id, :select => \"id, account_id\")\r\n \r\n return jump_to(\"/errors/forbidden\") unless job_profile.account_id == session[:account_id]\r\n \r\n JobProfile.delete(job_profile_id)\r\n @job_profile_entry_id = \"job_profile_#{job_profile_id}\"\r\n end",
"def destroy\n @job_application = JobApplication.find(params[:id])\n @job_application.destroy\n\n respond_to do |format|\n format.html { redirect_to(job_applications_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @job_application = JobApplication.find(params[:id])\n @job_application.destroy\n\n respond_to do |format|\n format.html { redirect_to(job_applications_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @job_progress.destroy\n respond_to do |format|\n format.html { redirect_to job_progresses_url, notice: 'Job progress was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job_compact = JobCompact.find(params[:id])\n @job_compact.destroy\n\n respond_to do |format|\n format.html { redirect_to job_compacts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n job = Job.find(params[:id])\n job.destroy\n respond_with job do |format|\n format.html { redirect_to jobs_path }\n end\n end",
"def destroy\n @job_assignment = @group.jobs.find(params[:id])\n @job_assignment.destroy\n\n respond_to do |format|\n format.html { redirect_to group_jobs_path(@group) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n flash[:success] = \"Job successfully destroyed\"\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @emp_job = EmpJob.find(params[:id])\n @emp_job.destroy\n\n respond_to do |format|\n format.html { redirect_to emp_jobs_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.7452083",
"0.7420717",
"0.7242453",
"0.7199983",
"0.7196661",
"0.713859",
"0.713859",
"0.713859",
"0.713859",
"0.713859",
"0.713859",
"0.713859",
"0.713859",
"0.7123496",
"0.7076762",
"0.70646775",
"0.6948848",
"0.6923701",
"0.6807619",
"0.6783894",
"0.67765754",
"0.6679366",
"0.667895",
"0.6672719",
"0.66723925",
"0.6628",
"0.6619514",
"0.6618515",
"0.6589343",
"0.65819144",
"0.6571346",
"0.65655184",
"0.65481824",
"0.65481824",
"0.65481824",
"0.65481824",
"0.65477407",
"0.6531519",
"0.652498",
"0.6509625",
"0.6508569",
"0.6501143",
"0.6493961",
"0.64930606",
"0.64875454",
"0.6481368",
"0.6479714",
"0.6472136",
"0.64224035",
"0.6412689",
"0.6410668",
"0.64101285",
"0.6408054",
"0.64051354",
"0.6401312",
"0.63945246",
"0.6390528",
"0.63903886",
"0.6376026",
"0.6363942",
"0.634197",
"0.63383013",
"0.6298955",
"0.62956405",
"0.62741333",
"0.6266137",
"0.6264937",
"0.6264937",
"0.6264937",
"0.6264937",
"0.6264937",
"0.6264937",
"0.6264937",
"0.6264937",
"0.6264937",
"0.6264937",
"0.6264937",
"0.6264937",
"0.6264937",
"0.62597626",
"0.62436396",
"0.62402564",
"0.623676",
"0.6235655",
"0.62282157",
"0.6225004",
"0.6223596",
"0.62189275",
"0.62021977",
"0.61980873",
"0.6197858",
"0.6191461",
"0.61866045",
"0.61840886",
"0.61840886",
"0.6168616",
"0.6166817",
"0.61580795",
"0.6156759",
"0.61555237",
"0.6148248"
] | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_office
@office = Office.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def setup_handler\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def setup\n #implement in subclass;\n end",
"def after_set_callback; end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def around_hooks; end",
"def save_action; end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def duas1(action)\n action.call\n action.call\nend"
] | [
"0.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.53314966",
"0.53114754",
"0.52984965",
"0.52977055",
"0.5296272",
"0.5260649",
"0.5245076",
"0.52388334",
"0.52388334",
"0.52388334",
"0.52388334",
"0.52388334",
"0.5235081",
"0.52321917",
"0.5228592",
"0.5220735",
"0.52198535",
"0.52139324",
"0.5208539",
"0.5206585",
"0.5178542",
"0.5175199",
"0.5173538",
"0.5167041",
"0.51614195",
"0.51577675",
"0.5153909",
"0.51528823",
"0.5152225",
"0.51429904",
"0.5141399",
"0.51345575",
"0.51145",
"0.5114052",
"0.5114052",
"0.5110216",
"0.5108656",
"0.50935394",
"0.5089196",
"0.5081936",
"0.5079627",
"0.50675833",
"0.5056105",
"0.5053687",
"0.5050475",
"0.5050475",
"0.503471",
"0.5028311",
"0.501982",
"0.50157547",
"0.5013552",
"0.50014806",
"0.50011593",
"0.49976763",
"0.4990292",
"0.4990292",
"0.49882022",
"0.4981269",
"0.49792367",
"0.49766538",
"0.4967978",
"0.49667212",
"0.4958987",
"0.49572337",
"0.49550423",
"0.4954479",
"0.4952353",
"0.494726",
"0.4944055",
"0.4935437",
"0.4931248",
"0.49283475",
"0.49281213",
"0.49268973",
"0.4921738",
"0.49204507",
"0.4918924",
"0.49182287",
"0.4916538",
"0.49158585",
"0.49156788"
] | 0.0 | -1 |
Only allow a list of trusted parameters through. | def office_params
params.require(:office).permit(:author, :quote)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def allow_params_authentication!; end",
"def whitelisted_args\n args.select &:allowed\n end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def filtered_parameters; end",
"def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def expected_permitted_parameter_names; end",
"def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def check_params; true; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def allowed?(*_)\n true\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end",
"def valid_params?; end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def url_allowlist=(_arg0); end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def list_params\n params.permit(:list_name)\n end",
"def valid_params_request?; end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end",
"def safelists; end",
"def authorize_own_lists\n authorize_lists current_user.lists\n end",
"def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end",
"def lists_params\n params.require(:list).permit(:name)\n\n end",
"def list_params\n params.require(:list).permit(:name, :user_id)\n end",
"def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end",
"def check_params\n true\n end",
"def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end",
"def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend",
"def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def whitelist; end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.permit(:name)\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end",
"def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end",
"def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end",
"def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def permitted_params\n []\n end",
"def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end",
"def params(list)\n @declared_params = list\n end",
"def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end",
"def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end",
"def allow(ids); end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end",
"def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end",
"def safelist; end",
"def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def valid_for_params_auth?; end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def shopping_list_params\n params.require(:shopping_list).permit!\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def permitters\n @_parametrizr_permitters || {}\n end",
"def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end",
"def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end",
"def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end",
"def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end",
"def url_allowlist; end",
"def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end",
"def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end",
"def quote_params\n params.permit!\n end"
] | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.6326454",
"0.63140553",
"0.6299814",
"0.62642586",
"0.626006",
"0.62578833",
"0.6236823",
"0.6227561",
"0.6221758",
"0.62200165",
"0.620879",
"0.61983657",
"0.6195055",
"0.6172993",
"0.6156856",
"0.61558664",
"0.61521494",
"0.6135789",
"0.6121145",
"0.61118174",
"0.60736513",
"0.6071645",
"0.60632104",
"0.60549796",
"0.6043906",
"0.6034662",
"0.60207325",
"0.6018568",
"0.6016575",
"0.60103434",
"0.60084206",
"0.600763",
"0.6007443",
"0.6003619",
"0.6003619",
"0.5995791",
"0.5993301",
"0.5993231",
"0.5984926",
"0.597122",
"0.5968121",
"0.5965808",
"0.59640145",
"0.59632224",
"0.59602356",
"0.59332967",
"0.5927556",
"0.5922805",
"0.5909745",
"0.5905083",
"0.5904304",
"0.5893434",
"0.58888215",
"0.58823985",
"0.58823985",
"0.58823985",
"0.5873434",
"0.58619875",
"0.58533794",
"0.5845531",
"0.58426666",
"0.58360124",
"0.583218",
"0.5828041",
"0.5827927",
"0.5816121",
"0.5814705",
"0.5812719",
"0.581121",
"0.5803423",
"0.5803423",
"0.57995003",
"0.5794207",
"0.5784923",
"0.5781365",
"0.5776385",
"0.5774859",
"0.57671493",
"0.5766998",
"0.57618684",
"0.5758038"
] | 0.0 | -1 |
args 1. Symbol type return Proc | def get_validator(type)
return Validators[type] if Validators.key?(type)
method_name = type.to_s << '?'
return self.method(method_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def args(*) end",
"def to_proc() end",
"def to_proc() end",
"def call(*args); end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args() return @args end",
"def signature(*args); end",
"def to_proc\n ->(*args) {call(*args)}\n end",
"def %(*args); end",
"def %(*args); end",
"def to_proc() self ; end",
"def &(arg0)\n end",
"def &(arg0)\n end",
"def &(arg0)\n end",
"def func_defun(args)\n p1 = car(args)\n p2 = car(cdr(args))\n p3 = cdr(cdr(args))\n\n lexpr = @o_man.new_object(LObject::OBJ_CONS)\n lexpr.value.c.car = @o_man.new_object(LObject::OBJ_IDENTIFIER)\n lexpr.value.c.car.value.id = \"lambda\"\n lexpr.value.c.cdr = @o_man.new_object(LObject::OBJ_CONS)\n lexpr.value.c.cdr.value.c.car = p2\n lexpr.value.c.cdr.value.c.cdr = p3\n @o_man.set_object(p1, lexpr)\n return lexpr\n end",
"def meth(*args)\n\n\n\nend",
"def meth(\n\n\n\n *args)\n\nend",
"def probers=(_arg0); end",
"def postproc=(_arg0); end",
"def args\n @args \n end",
"def fred(param)\n proc {}\nend",
"def go\n a = Proc.new do \n puts 'Proc'\n\n return\n end\n\n methods(&a)\n\n puts 'end go'\nend",
"def to_proc()\n #This is a stub, used for indexing\n end",
"def args=(_arg0); end",
"def args=(_arg0); end",
"def args=(_arg0); end",
"def args=(_arg0); end",
"def args=(_arg0); end",
"def *(arg0)\n end",
"def *(arg0)\n end",
"def type _args\n \"type _args;\" \n end",
"def returns=(_arg0); end",
"def method_call_args(args_sexp)\n return [] if args_sexp[1].nil?\n args_sexp = args_sexp.last[1]\n args_sexp.map(&method(:parse_one))\n end",
"def args\n @function.args\n end",
"def func_one\n proc_new = Proc.new {return \"123\"}\n proc_new.call(1,2)#proc dont care how many argument added\n return \"456\"\nend",
"def meth(\n **\n ); end",
"def type(*args); end",
"def to_proc\n ->(*args, &blk) do\n receiver = args.first\n if (blk)\n receiver.send(self, &blk)\n else\n args[0] = self\n receiver.send(*args)\n end\n end\n end",
"def deco_args; end",
"def args()\n #This is a stub, used for indexing\n end",
"def perform(*args); end",
"def processor=(_arg0); end",
"def preproc=(_arg0); end",
"def formation _args\n \"formation _args;\" \n end",
"def process(*)\n end",
"def process(*)\n end",
"def procasaurus( &block )\n\tputs \"I am a procasaurus.\"\n\tputs block.class\n\t# note the proc must be the last parameter and must start with ampersand\nend",
"def arguments; end",
"def arguments; end",
"def arguments; end",
"def talk_about(name, &myproc) #so ruby (and us) know we are adding a proc prefix it with a ambersand &\n puts \"Let me tell you about #{name}\"\n myproc.call(name) #in the body it doesnt need a ambersand & only in the definition\nend",
"def call(*) end",
"def call(*) end",
"def arg; end",
"def application=(_arg0); end",
"def application=(_arg0); end",
"def run(*args); end",
"def run(*args); end",
"def run(*args); end",
"def run(*args); end",
"def run(*args); end",
"def run(*args); end",
"def run(*args); end",
"def run(*args); end",
"def pass(*args, &block)\n end",
"def process(args)\n args\n end",
"def create_proc_with_params\n proc = Proc.new { |a| puts a * 2 }\n #on check on numbers of paramaters\n proc.call(4,6)\n proc.call(5)\nend",
"def takes_a_proc( p )\n p.call\nend",
"def test procArg1, procArg2\n\tProc.new do |arg|\n\t\tprocArg2.call(procArg1.call(arg))\n\tend\nend",
"def proc\n return $PROC\n end",
"def handle_proc(pr, *a)\n case pr\n when Proc, Method\n pr.call(*a)\n else\n pr\n end\n end",
"def local(*args); end",
"def meth(arg, *args)\n [arg, args]\nend",
"def process(*_arg0, **_arg1, &_arg2); end",
"def accept=(_arg0); end",
"def meth2\n put yield(8)\nend\n\nsquare = proc {|i| i*i}\n\nmeth2 {|i| i + i}\nmeth2 &square # the last actual argument in a method invocation is a Proc object, precede it with & to convert it into a block. The method may then use yield to call it\n# class\nclass Cla\t# class names always begin with a captial letter\n include MIXIN\n prepend MODULE\n\n attr_reader :name # read only\n attr_accessor :content, :time, :mood # read/write\n attr_writer :age\n\n def initialize(mood, content=\"\")\t# called when new object is created\n\t@time = Time.now\n\t@content = content[0..39]\n\t@mood = mood\n end\n\n def <=> (other) # spaceship operator\n\ttime <=> other.time\n end\n\n def set=(val) # methods with = append must be called with an explicit receiver\n @content = val\n puts @content\n end\nend\ninstance = Cla.new :confused, \"a new message\"\ninstance = Cla.new (:confused, \"a new message\"",
"def call(*args)\n `return self.apply(null, [self.$S, null].concat(args));`\n end",
"def return_proc\n Proc.new do |name|\n puts \"The length of your name is #{name.length}\"\n end\nend",
"def process(*_arg0, **_arg1); end",
"def mco_args\n raise RuntimeError, \"Not implemented\"\n end",
"def to_proc\n to_sym.to_proc\n end",
"def get_args\n <<-CODE\n stack_push(I2N(c->args));\n CODE\n end"
] | [
"0.734637",
"0.67650247",
"0.67650247",
"0.6733311",
"0.6729541",
"0.6729541",
"0.6729541",
"0.6729541",
"0.6729541",
"0.6729541",
"0.6729541",
"0.6729541",
"0.6729541",
"0.6729541",
"0.6729541",
"0.6729541",
"0.6729541",
"0.6729541",
"0.6729541",
"0.6729541",
"0.6729541",
"0.6729541",
"0.6729541",
"0.6729541",
"0.6606019",
"0.6552802",
"0.65517706",
"0.6511646",
"0.6511646",
"0.6442471",
"0.64172834",
"0.64172834",
"0.64172834",
"0.6388321",
"0.63592196",
"0.6350003",
"0.63482046",
"0.6342185",
"0.63095903",
"0.6263571",
"0.6245593",
"0.6244358",
"0.62328625",
"0.62328625",
"0.62328625",
"0.62328625",
"0.62328625",
"0.6216649",
"0.6216649",
"0.61056507",
"0.6080962",
"0.6077946",
"0.60623205",
"0.6037772",
"0.602525",
"0.6017996",
"0.601724",
"0.6001097",
"0.6000287",
"0.5996925",
"0.5990242",
"0.5988215",
"0.59821177",
"0.5969231",
"0.5969231",
"0.5968531",
"0.5960792",
"0.5960792",
"0.5960792",
"0.5958996",
"0.59559673",
"0.59559673",
"0.595373",
"0.5948235",
"0.5948235",
"0.5945943",
"0.5945943",
"0.5945943",
"0.5945943",
"0.5945943",
"0.5945943",
"0.5945943",
"0.5945943",
"0.594455",
"0.59396464",
"0.59387785",
"0.5936929",
"0.59298056",
"0.5916945",
"0.5908378",
"0.59055066",
"0.5901657",
"0.5887678",
"0.5884907",
"0.58785385",
"0.5877032",
"0.58749336",
"0.58729625",
"0.5868969",
"0.5863794",
"0.58605754"
] | 0.0 | -1 |
args 1. Integer a 2. Integer b 3. Boolean include return Boolean | def gt(a, b, include)
include = true if include.nil?
if include
return a <= b
else
return a < b
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def and_b\n end",
"def and_a\n end",
"def any a,b=:true\n a.prove { b.prove { yield; return } }\n end",
"def one a,b=:true\n stands = false\n a.prove { \n b.prove {\n return if stands\n stands = true\n } \n }\n yield if stands\n end",
"def exercise_1111 (bool_values)\n end",
"def void_true(*args)\n return true\n end",
"def and_ a, b\n self.and a, b\n end",
"def and_(a)\n raise NotImplementedError\n end",
"def match_maker(a, *b)\n\tarray = (0...b.count).to_a\n\tnew_array = []\n\tanswer = []\n\tarray.each_slice(2){ |i| new_array << i }\n\t\nif a == false\n\tnew_array.each { |i| \n\t\tb[i[0]], b[i[1]] = !!b[i[0]], !!b[i[1]]\n\t\tb[i[0]] == b[i[1]] ? answer << true : answer << false }\n\nelsif a == true\n\tnew_array.each { |i|\t\t\n\t\tb[i[0]], b[i[1]] = !!b[i[0]], !!b[i[1]]\n\t\tb[i[0]] != b[i[1]] ? answer << true : answer << false }\nelse\nend\nanswer\nend",
"def iff a,b\n all(a,b) { all(b,a) { yield } }\n end",
"def OF_CHECKING(a,b,sum) \n\tAND(XOR(sum,a),NOT(XOR(a,b)))\nend",
"def true(_argvs)\n return nil\n end",
"def exclusive_or(num1, num2)\r\n\t# your code here\r\nend",
"def Boolean(operation, val1, val2)\n puts operation\n case operation\n when \"AND\"\n return val1 && val2\n when \"OR\"\n return val1 || val2\n else\n puts \"WHAT?\"\n end\n return false\n end",
"def And(a, b)\n return a && b\nend",
"def vampire_test(a,b)\n if a <= 0 and b <= 0\n false\n elsif \n \n else\n arr = (a*b).to_s.chars.map(&:to_i)\n [arr.include?(a), arr.include?(b), (arr.last != 0)].include?(false)\n end\nend",
"def foo(a,b)\n\tif a % 2 == 0 and b % 2 == 0\n\t\tputs \"hooray\"\n\telse\n\t\tputs \"boo\"\n\tend\nend",
"def inp(x, *a)\n a.each {|v| return true if x === v}\n return false\nend",
"def test_two_ints\n args = Arguments.new\n assert_equal false, args.check_args([1, 2])\n end",
"def xor?(first_arg, second_arg)\n return true if first_arg == false && second_arg == true\n return true if first_arg == true && second_arg == false\nend",
"def func1 val #missing the symbols for arguments\r\n if val = 1 #missing 1 equal symbol.\r\n return true\r\n else\r\n return false\r\n end\r\nend",
"def all a,b\n a.prove {\n stands = false; \n b.prove { stands = true; break } \n return if not stands\n }\n yield\n end",
"def AND(x,y); \tif x==1 && y==1 \tthen 1 else 0 end; end",
"def match_maker setter, *args\n pairs = []\n args.to_a.each_slice(2) do |a,b|\n a = !!a#this will set show if the value is true or false. Nil is false.\n b = !!b\n if a == b\n pairs << true\n else\n pairs << false\n end\n end\n if setter == true#reverse the result if true\n pairs.map! do |i|\n i = !i\n end\n end\n p pairs\nend",
"def and_d\n end",
"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",
"def arguments_valid?\n return false if @arguments.length != 2\n @number = @arguments[0].to_i\n @value = @arguments[1].to_i\n true if (@number > 0 && @value > (@number-1) && @value < (@number*6+1)) \n end",
"def xor?(parameter1, parameter2)\r\n return true if parameter1 == true && parameter2 == false\r\n return true if parameter1 == false && parameter2 == true\r\n return false if parameter1 == false && parameter2 == false\r\n return false if parameter1 == true && parameter2 == true\r\nend",
"def do_pigs_fly?\n return true,false\nend",
"def xor?(arg1, arg2)\r\n\r\nend",
"def boolean(boolI)\n if boolI==1 then\n return true\n end\n return false\nend",
"def test_TrueClass_InstanceMethods_or\n\t\tassert_equal(true, false | true)\n\t\tassert_equal(true, true | false)\n\t\tassert_equal(true, true | true)\n\t\tassert_equal(false, false | false)\n\tend",
"def write_bool(*b); end",
"def match_maker(opposites_attract, *elements) #method takes a boolean, and any number of booleans\n to_return = [] #creating an empty array\n elements.each_slice 2 do |first, last| #splits the array into an array of pairs\n first = !!first #conversion to boolean\n last = !! last\n result = if opposites_attract\n first != last #first does not equal last\n else\n first ==last #or they equal\n end\n to_return << result #append result \nend \nto_return\nend",
"def a\n return true\nend",
"def xor?(argument_1, argument_2)\n if argument_1\n if argument_2 == false\n return true\n else\n return false\n end\n elsif argument_2\n if argument_1 == false\n return true\n else \n return false\n end\n else\n return false\n end\nend",
"def xor?(arg_1, arg_2)\n if (arg_1 && arg_2) \n return false\n elsif (arg_1 || arg_2)\n return true\n else\n return false\n end\nend",
"def lovefunc(flower1, flower2)\n (flower1.even? || flower2.even?) && (flower1.odd? || flower2.odd?)\nend",
"def test_one_ints\n args = Arguments.new\n assert_equal false, args.check_args([1])\n end",
"def check_nums(num1, num2)\r\n\r\nend",
"def _reduce_46(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend",
"def _reduce_46(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend",
"def _reduce_46(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend",
"def void_false(*args)\n return false\n end",
"def method(a==3)\r\nend",
"def test\n\t\t@a+@b > @c && @a+@c > @b && @b+@c > @a\n\tend",
"def xor(a,b)\n if (a == true && b == true) || (a == false && b == false)\n return false\n else\n return true\n end\nend",
"def & other\n call_enum \"boolean\", other, :and\n end",
"def _reduce_46(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n\n result\nend",
"def _reduce_54(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend",
"def _reduce_49(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend",
"def _reduce_49(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend",
"def _reduce_49(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend",
"def _reduce_49(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend",
"def _reduce_47(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend",
"def _reduce_47(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend",
"def sumOfTwo(a, b, v)\n a.each do |s_int|\n b.each do |b_int|\n return true if s_int + b_int == v\n end\n end\n false\nend",
"def lovefunc(flower1, flower2)\n flower1Odd = flower1.odd?\n flower2Odd = flower2.odd?\n flower1Even = flower1.even?\n flower2Even = flower2.even?\n \n firstOddSecondEven = flower1Odd && flower2Even\n firstEvenSecondOdd = flower1Even && flower2Odd\n\n inLove = firstOddSecondEven || firstEvenSecondOdd\n \n return inLove\nend",
"def _reduce_48(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend",
"def _reduce_48(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend",
"def | other\n call_enum \"boolean\", other, :or\n end",
"def _reduce_58(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend",
"def xor?(arg1, arg2)\r\n (arg1 || arg2) == true && (arg1 && arg2) == false\r\nend",
"def _reduce_41(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend",
"def _reduce_41(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend",
"def _reduce_49(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n\n result\nend",
"def xor?(arg1, arg2)\n if arg1 && arg2\n false\n elsif !arg1 && !arg2\n false\n else \n true\n end\nend",
"def sum_double (a,b)\n\t\n\tif a != b \n\t\treturn a + b \n\tend \n\n\tif a = b \n\t\treturn 2 * (a + b)\n\tend\n\nend",
"def xor?(arg1, arg2)\n return true if arg1 && !arg2\n return true if arg2 && !arg1\n false # necessary because previous line returns nil (not false) if condition falsey\nend",
"def and_c\n end",
"def multiple?; end",
"def xor?(arg1, arg2)\n if arg1 && !arg2\n true\n elsif !arg1 && arg2\n true\n else \n false\n end\nend",
"def xor?(arg1, arg2)\n if !!arg1 == !!arg2\n false\n else\n true\n end \nend",
"def complex_condition?(condition); end",
"def xor?(arg1, arg2)\n if arg1\n if arg2\n false\n else\n true\n end\n else\nif arg2\n true\n else\n false\n end\n end\nend",
"def none a,b=:true\n a.prove {\n b.prove { return } \n }\n yield\n end",
"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",
"def _reduce_41(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n\n result\nend",
"def okay_two_sum?(arr, target)\n \n\nend",
"def bitSetAnd (a,b)\n\t\tresult = Array.new\n\t\tfor i in 0...(a.size)\n\t\t\tresult[i] = a[i] && b[i]\n\t\tend\n\t\treturn result\n\tend",
"def all_same?(first_operand, arglist)\n if arglist.empty?\n boolean(true)\n else\n first_value = first_operand.value\n all_equal = arglist.all? { |elem| first_value == elem.value }\n boolean(all_equal)\n end\n end",
"def typecast_value_boolean(opts={});true;end",
"def may?(*args)\n true\n end",
"def acceptable? *args\n true\n end",
"def method_args_test(a,b)\n a + b + yield\n end",
"def match_maker(*el)\n\nnewEl = []\nel.each do |x|\n x == true ? x : x == false ? x : x.nil? == true ? x = false : x = true\n newEl << x\nend\n\ndefiningBool = newEl.shift\n\nresult = []\nnewEl.each_slice(2) { |a,b| result << [a,b]}\n\nif definingBool == false\n\nresult.each_with_index do |arr, index|\nresult[index] = (arr[0] == arr[1] )\nend\n\nelse\n result.each_with_index do |arr, index|\n result[index] = !(arr[0] == arr[1])\nend\n\nend\nresult\n\nend",
"def to_bool() true end",
"def _reduce_34(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend",
"def boolify(val)\n\nend",
"def xor?(arg1, arg2)\n if arg1 && !arg2 ||\n !arg1 && arg2\n return true\n else\n return false\n end\nend",
"def func1 val \n # should be == not =\n if val = 1\n return true\n else\n return false\n end\n end",
"def xor?(arg1, arg2)\n (arg1 && !arg2) || (arg2 && !arg1) ? true : false\nend",
"def xor?(arg1, arg2)\r\n (arg1 && !arg2) || (arg2 && !arg1)\r\nend",
"def in_range(a, b)\n return ((a >= 20 && a <= 30) || (b >= 20 && b <= 30));\t\nend",
"def or_b\n end",
"def should_we_sail?(number)\n if number == 1 || number == 2 || number == 3\n true\n else\n false\n end\nend",
"def _reduce_34(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n\n result\nend",
"def and_l\n end",
"def parameter_matches a, b\n return false if String === b\n\n if a.register? && b.register? then\n return a.bits == b.bits && (b.id.nil? || a.id == b.id)\n end\n\n if a.address? && b.address? then\n return ! b.offset? || a.offset?\n end\n\n if a.special_register? && b.special_register? then\n return a.class == b.class && (b.id.nil? || a.id == b.id)\n end\n\n return false unless b.immediate?\n\n if a.immediate_value? then\n return (b.value && b.value == a) || b.bits.nil? || a < (2 ** b.bits)\n end\n\n if a.label? then\n return a.future_label? ? b.bits == a.machine.bits :\n a.bits <= (b.bits || a.machine.bits)\n end\n\n false\n end",
"def xor?(arg1, arg2)\n if arg1 && !arg2 || !arg1 && arg2\n true\n else\n false\n end\nend",
"def binary?\n BINARY_OPERATORS.include?(selector) && arguments.length == 1 && arguments.first.type != :splat\n end"
] | [
"0.6934407",
"0.67799205",
"0.6504718",
"0.64774984",
"0.64434856",
"0.64136",
"0.63797396",
"0.636456",
"0.6342704",
"0.6258398",
"0.62329227",
"0.6175189",
"0.6153777",
"0.61389214",
"0.61050546",
"0.60527074",
"0.6052375",
"0.60486716",
"0.6040725",
"0.6030278",
"0.5989392",
"0.59765744",
"0.5952877",
"0.59392226",
"0.59333897",
"0.592973",
"0.5928337",
"0.5912436",
"0.59101635",
"0.58991015",
"0.58915097",
"0.5879657",
"0.5872223",
"0.5868948",
"0.5863323",
"0.58632684",
"0.5852197",
"0.5851633",
"0.58410263",
"0.58339334",
"0.5827046",
"0.5827046",
"0.5827046",
"0.58187014",
"0.58119774",
"0.5810547",
"0.58069676",
"0.5801766",
"0.5801021",
"0.57916975",
"0.5779946",
"0.5779946",
"0.5779946",
"0.5779946",
"0.57790273",
"0.57790273",
"0.5762583",
"0.5761794",
"0.5758512",
"0.5758512",
"0.5750607",
"0.574984",
"0.5744188",
"0.574306",
"0.574306",
"0.57422996",
"0.5739093",
"0.5737323",
"0.5737119",
"0.57316047",
"0.5731096",
"0.5716463",
"0.5716134",
"0.571316",
"0.5710954",
"0.5706409",
"0.5705997",
"0.5704672",
"0.5703148",
"0.57018995",
"0.56984043",
"0.56966937",
"0.5691343",
"0.568568",
"0.56735045",
"0.5670213",
"0.567014",
"0.5669346",
"0.56558204",
"0.5646939",
"0.5645739",
"0.56363344",
"0.5634467",
"0.56339544",
"0.56329566",
"0.5624013",
"0.5623136",
"0.56223375",
"0.562147",
"0.5619167",
"0.56179875"
] | 0.0 | -1 |
args 1. Hash options return Boolean | def required(options)
default = true
return default unless options.is_a?(Hash)
return default unless options.key?(:required)
return options[:required]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def options_ok?\n end",
"def options?(*args)\r\n val = false\r\n options.each do |key, value|\r\n next unless args.include?(key.to_sym)\r\n val = options[key].nil? ? true : options[key]\r\n break\r\n end\r\n val\r\n end",
"def options?\n options.is_a?(Hash)\n end",
"def arguments_valid?\n # check the parameters have values\n return false unless @options.has_key?(:hcdFile)\n return false unless @options.has_key?(:etdFile) \n return false if @options[:mzArray].empty?\n return false unless (@options[:mzTolerance] > 0.0 || @options[:ppmTolerance] > 0.0 )\n # check the file exists\n return false unless File.file?(@options[:hcdFile])\n return false unless File.file?(@options[:etdFile])\n true\n end",
"def validate_opts\n if @options[:file].nil?\n puts \"Pass me some filename (-f FILE)\"\n return false\n elsif !File.exists?(@options[:file])\n puts \"File: #{@options[:file]} does not exist\"\n return false\n elsif !File.readable?(@options[:file])\n puts \"File: #{@options[:file]} is not readable\"\n return false\n elsif File.directory?(@options[:file])\n puts \"#{@options[:file]} is a directory!\"\n return false\n elsif File.zero?(@options[:file])\n puts \"File: #{@options[:file]} is empty\"\n return false\n end\n\n if @options[:mode].nil?\n puts \"Pass me indexing mode (-m index|noindex )\"\n return false\n end\n return true\n end",
"def accepts?(op)\n return @options.has_key? op\n end",
"def actual_options?(options)\n return false if options.nil?\n\n if (options.is_a?(String) || options.is_a?(Hash)) && !options.size.zero?\n true\n else\n false\n end\n end",
"def supports_options?\n return true\n end",
"def valid_opts\n true\n end",
"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",
"def method_missing(sym, *args)\n if sym.to_s =~ /\\A(.*)\\?\\z/ && options.include?($1.to_sym) && (options[$1.to_sym].is_a?(TrueClass) || options[$1.to_sym].is_a?(FalseClass))\n options[$1.to_sym]\n elsif sym.to_s =~ /\\A(.*)\\z/ && options.include?($1.to_sym) \n options[$1.to_sym]\n else\n false\n end\n end",
"def options?\n\t\t\tif parameters = self.parameters\n\t\t\t\ttype, name = parameters.last\n\t\t\t\t\n\t\t\t\treturn type == :keyrest || type == :keyreq || type == :key\n\t\t\tend\n\t\tend",
"def arguments_valid?\n ret = false\n ret = true unless (@options.action == nil)\n end",
"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",
"def options?\n false\n end",
"def options?\n false\n end",
"def vash_valid_key?(x); self.class.option_name?(x); end",
"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",
"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",
"def hash_in_argument_hash\n argument_hash = {} if argument_hash.nil?\n return true\n end",
"def arguments_valid?\n valid_args = true\n valid_args = false if @options.min > @options.max\n valid_args = false if @options.user && !@options.password\n valid_args = false if @options.password && !@options.user\n valid_args\n end",
"def valid?\n errors, options = {}, {}\n @results = {:errors => errors, :options => options}\n \n remaining_args = args.dup\n valid_options.each do |long_name, details|\n short_name, default = *details\n key = long_name.gsub(/^--/, '').gsub('-', '_').to_sym\n index = remaining_args.index(long_name) ||\n remaining_args.index(short_name)\n if index\n remaining_args.delete_at index\n if self.class.option?(remaining_args[index])\n options[key] = true\n else\n options[key] = remaining_args.delete_at(index)\n end\n else\n options[key] = default\n end\n end\n remaining_args.each do |arg|\n arg_type = self.class.option?(arg) ? 'option' : 'argument'\n errors[arg] = \"is not a valid #{arg_type}\"\n end\n \n errors.empty?\n end",
"def arguments_valid?\n begin\n @validoptions = BoilermakerOptions.new(options)\n @validoptions.validate\n # pp @validoptions.args\n return @validoptions.args\n rescue => error\n # pp x.args\n puts error.message + \"\\n\"\n exit\n end\n end",
"def options_parsed?\n opts = OptionParser.new() do |o|\n o.on('-v','--version') { output_version($stdout); exit(0) }\n o.on('-h','--help') { output_help($stdout); exit(0) }\n o.on('-V', '--verbose') { @options.verbose = true }\n o.on('-D', '--debug') { @options.debug = true }\n o.on('-l', '--local') { @options.run_local = true }\n\n o.on(\"-d\",\"--delay\", \"=REQUIRED\") do |amount|\n @options.delay = amount.to_i\n end\n\n o.on(\"-c\",\"--config\", \"=REQUIRED\") do |conf_file|\n @options.config_file = conf_file\n end\n\n o.on(\"-o\",\"--output\", \"=REQUIRED\") do |output_destination|\n @options.output_base = output_destination\n end\n\n o.on(\"-s\",\"--scheduler\", \"=REQUIRED\") do |qopts|\n @options.scheduler_opts = qopts\n end\n\n o.on(\"-t\",\"--tmp\", \"=REQUIRED\") do |topts|\n @options.tmp_dir_base = topts\n end\n end\n\n opts.parse!(@args) rescue return false\n @options.samples = @args\n return true\nend",
"def arguments_valid?\n num = 0\n num += 1 if @options.stats\n num += 1 if @options.attach\n num += 1 if @options.detach\n return false if num > 1\n return true\n end",
"def true(_argvs)\n return nil\n end",
"def match?(options)\n options.all? { |key, value| self[key] == value }\n end",
"def validate_arguments\n if(!@options.parse || !@@sections.include?(@options.parse))\n @log.error \"select one of the following to parse: #{@@sections.join(\"|\")}\"\n exit!\n end\n \n if(!@options.download && !@options.file)\n @log.error \"Select either to download the file remotely or supply the given file\"\n exit!\n end\n \n if(!@options.output)\n @log.error \"supply an output directory with -o\"\n exit!\n end\n \n return true\n end",
"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",
"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",
"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",
"def arguments?\n @config.arguments == Cliqr::Config::ENABLE_CONFIG\n end",
"def has_options?(opts = {})\n opts.each do |key, value|\n this_value = self[key.to_sym]\n return false if (this_value != value)\n end\n return true\n end",
"def args?\n\t\treturn !@form.empty?\n\tend",
"def has_options?\n properties.include?(\"has_options\")\n end",
"def use?(opts)\n !(opts.keys & @takes).empty?\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def check_options\n unless @options[:stub]\n STDERR.puts \"Please specify a host to connect to using --host\" unless @options[:host]\n STDERR.puts \"Please specify a model to check using --model\" unless @options[:model]\n return false unless @options[:host] && @options[:model]\n end\n\n true\n end",
"def early_option?(args)\n if @options[:version]\n puts(\"boson #{Boson::VERSION}\")\n true\n elsif args.empty? || (@command.nil? && !@options[:execute])\n print_usage\n true\n else\n false\n end\n end",
"def same_options?(opts)\n opts.length == 0 || opts.hash == options.hash\n end",
"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",
"def args?\n\t\treturn !self.fields.empty?\n\tend",
"def set_options(options, args)\n set = false\n options.each do |x,y|\n if x == args[1]\n if y[\"file\"] == \"no\"\n y[\"value\"] = args[2]\n set = true\n elsif y[\"file\"] == \"yes\" and test_file(args[2])\n y[\"value\"] = args[2]\n y[\"is_file\"] = \"yes\"\n set = true\n elsif y[\"file\"] == \"maybe\"\n if not test_file(args[2])\n puts \"!! if the argument provided is a path, the file doesn't exist !!\"\n else\n y[\"is_file\"] = \"yes\"\n end\n y[\"value\"] = args[2]\n set = true\n end\n end\n end\n if not set \n puts \"Wrong option or the file specified doesn't exist \"\n end\n return options\nend",
"def parse(args)\n true\n end",
"def include?(arg_)\n _get_objdata(arg_) ? true : false\n end",
"def valid?(options)\n (@required_options - options.keys).size == 0\n end",
"def arguments_valid?\n true if ['install','list','uninstall'].include?(@arguments[0])\n end",
"def options?\n @method == OPTIONS\n end",
"def setup?\n @options\n end",
"def setup?\n @options\n end",
"def process_arguments\n opts_parse = OptionParser.new do |opts|\n opts.on('-f','--file FILE') {|f|@options.file = File.expand_path(f)}\n opts.on('-o','--output FILE'){|f|@options.output = File.expand_path(f)}\n end\n \n opts_parse.parse!(@arguments) rescue return false\n \n return true\n end",
"def match?(*args)\n props = Hash === args.last ? args.pop : {}\n\n if target = args.shift\n props[:command] = target.to_s\n props[:feature] = target.to_s\n end\n\n if props[:profile]\n props[:profile] = (props[:profile] || :default).to_s\n end\n\n props.each do |k,v|\n pv = property(k)\n return false unless (pv.nil? || pv == v)\n end\n\n return true\n end",
"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",
"def tell_the_truth(options={})\n if options[:profession] == :lawyer\n 'i cant'\n else\n true\n end\nend",
"def options(opt); end",
"def options(opt); end",
"def ab_options_valid?(ab_options = {})\n return false if ab_options.empty?\n\n unless ab_options_is_complete?(ab_options)\n logger.info \"**********************************************************************************************************\"\n logger.info \"[Bachanalytics] You need to specify the :a, b: and :goal options for your WebSiteOptimizer tests, aborting\"\n logger.info \"**********************************************************************************************************\"\n return false\n end\n\n unless uniq_goals?(ab_options)\n logger.info \"**************************************************************************************************\"\n logger.info \"[Bachanalytics] You can't specify a :goal as part of the your WebSiteOptimizer tests, not applying\"\n logger.info \"**************************************************************************************************\"\n return false\n end\n\n true\n end",
"def arguments_valid?\n return false if (@options[:partition_class] and @options[:rmcls])\n\n if @options[:rmcls]\n return false unless (@options[:cls_file] and @options[:lrn_file])\n elsif @options[:partition_class]\n return false unless (@options[:cls_file] and @options[:name_file] and @options[:fasta_file])\n end\n true\n end",
"def options?\n @supports_options\n end",
"def arguments_valid?\n\t\tcase @arguments.length\n\t\twhen 0\n\t\t\traise(\"File does not exist or is not readable\") unless File.exist?(@dict_path) and File.readable?(@dict_path)\n\t\t\treturn true\n\t\twhen 1\n\t\t\treturn process_arguments\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend",
"def options?\n non_empty?(@config.options)\n end",
"def allows?(hash={})\n apply(hash)[0]\n end",
"def vash_valid_value?(x); self.class.option_value?(x); end",
"def called_options?()\n @@called_options\n end",
"def show_help?\n args_def.show_help?\n end",
"def arguments_valid?\n # TO DO - implement your real logic here\n valid = false\n case @arguments[0]\n when 'ls' then\n #one argument or none but if one, ais url one!\n bucketName = @arguments[@arguments.length-1]\n valid = true if (bucketName == 'ls' || bucketName[0,6] == @storePrefix )\n when 'cp' then\n #source and dest must be their and one local and not the other! if directory need -L options\n if (@arguments.length >= 3) then\n source = @arguments[@arguments.length-2]\n dest = @arguments[@arguments.length-1]\n valid =true if(source[0,6] == @storePrefix && dest[0,6] != @storePrefix)\n valid =true if(source[0,6] != @storePrefix && dest[0,6] == @storePrefix && (( @options.local && File.directory?(source)) || (File.file? source )))\n end\n when 'mb' then\n #bucket url without object so just ais://bucket and not ais://bucket/object\n bucketName = @arguments[@arguments.length-1]\n valid = true if (bucketName[0,6] == @storePrefix && !bucketName[6..-1].include?('/'))\n when 'rm' then\n #work for bucket or object\n objectName = @arguments[@arguments.length-1]\n valid = true if (objectName[0,6] == @storePrefix)\n when 'metadata','protocol','md' then\n #same constraint, must be an object url\n objectName = @arguments[@arguments.length-1]\n valid = true if (objectName[0,6] == @storePrefix && objectName[6..-1].include?('/'))\n end\n valid\n end",
"def options() end",
"def option?(param)\n param[0] == \"-\"\n end",
"def show_usage?\n args_def.show_usage?\n end",
"def arguments?\n arguments.any?\n end",
"def acceptable? *args\n true\n end",
"def hash_or_parameter?(args)\n args.is_a?(Hash) || args.respond_to?(:to_unsafe_h)\n end",
"def args?(args, min=1, max=nil)\n\t\t\tif not max then max = min end\n\t\t\tif (args.length < min or args.length > max or args[0] == \"-h\")\n\t\t\t\treturn false\n\t\t\tend\n\n\t\t\treturn true\n\t\tend",
"def validate_options\n true\n end",
"def verify_options_hook; end",
"def process_arguments\n opts_parse = OptionParser.new do |opts|\n opts.on('-f','--file FILE') {|f|@options.file = File.expand_path(f)}\n opts.on('-o','--output FILE'){|f|@options.output = File.expand_path(f)}\n end\n \n opts_parse.parse!(@arguments) rescue return false\n \n return true\n end",
"def process_arguments\n opts_parse = OptionParser.new do |opts|\n opts.on('-f','--file FILE') {|f|@options.file = File.expand_path(f)}\n opts.on('-o','--output FILE'){|f|@options.output = File.expand_path(f)}\n end\n \n opts_parse.parse!(@arguments) rescue return false\n \n return true\n end",
"def process_arguments\n opts_parse = OptionParser.new do |opts|\n opts.on('-f','--file FILE') {|f|@options.file = File.expand_path(f)}\n opts.on('-o','--output FILE'){|f|@options.output = File.expand_path(f)}\n end\n \n opts_parse.parse!(@arguments) rescue return false\n \n return true\n end",
"def options_set?(key)\n @options.key? key\n end",
"def valid_option? opt_sym\n @options_with_short_keys.key? opt_sym\n end",
"def has_argument?(key)\n self.arguments.set?(key)\n end",
"def has_argument?(key)\n self.arguments.set?(key)\n end",
"def option_assigned?(option=nil)\n if option.class == Hash && !block_given?\n return @j_del.java_method(:isOptionAssigned, [Java::IoVertxCoreCli::Option.java_class]).call(Java::IoVertxCoreCli::Option.new(::Vertx::Util::Utils.to_json_object(option)))\n end\n raise ArgumentError, \"Invalid arguments when calling option_assigned?(option)\"\n end",
"def straight_delegate_args?\n @name.include?(\"state\") # IE: \"state list\", \"state pull\", \"state show\"\n end",
"def arguments_valid?\n # TO DO - implement your real logic here\n true if @arguments.length == 1 \n end",
"def has_options?\n bounty_expiration.present? || upon_expiration.present? || promotion.present?\n end",
"def convert_options?\n !@convert_options.nil? && !@convert_options.empty?\n end",
"def check_for_missing_enabled_option(hash); end",
"def arguments_valid?\n # TODO - implement your real logic here\n true # if @arguments.length == 1\n end",
"def recognizes?(args)\n false\n end",
"def sh_opts_equal?( o1, o2 )\n SH_OPT_KEYS.each do |k|\n return false if o1[k] != o2[k]\n end\n true\n end",
"def arguments_valid?\n\t\t # TO DO - implement your real logic here\n\t\t true if @arguments.length == 1\n\t\tend"
] | [
"0.7505308",
"0.747793",
"0.70112765",
"0.68758386",
"0.68532956",
"0.6824349",
"0.6808158",
"0.67836195",
"0.6748212",
"0.6745087",
"0.6730508",
"0.667533",
"0.6674993",
"0.6663398",
"0.6655912",
"0.6655912",
"0.6620455",
"0.6614967",
"0.6586616",
"0.65816814",
"0.65701663",
"0.6552743",
"0.65457314",
"0.6530199",
"0.65245694",
"0.65167075",
"0.65147054",
"0.65048516",
"0.64902973",
"0.64902973",
"0.64902973",
"0.64858085",
"0.648095",
"0.6461469",
"0.6455255",
"0.64436114",
"0.6418039",
"0.6418039",
"0.6418039",
"0.6418039",
"0.6418039",
"0.6418039",
"0.6418039",
"0.6418039",
"0.6418039",
"0.6418039",
"0.6405673",
"0.6402767",
"0.639562",
"0.6373886",
"0.63641477",
"0.63564414",
"0.63454694",
"0.6345335",
"0.63403463",
"0.6311013",
"0.6304769",
"0.6277977",
"0.6277977",
"0.626801",
"0.62600064",
"0.625695",
"0.62263936",
"0.6224005",
"0.6223589",
"0.6221553",
"0.6214473",
"0.620576",
"0.6188585",
"0.6183945",
"0.61752975",
"0.6160875",
"0.6157409",
"0.61348677",
"0.6128344",
"0.6115146",
"0.60992813",
"0.6098988",
"0.60866815",
"0.6085489",
"0.6083618",
"0.6078954",
"0.60764796",
"0.607262",
"0.6068714",
"0.6068714",
"0.6068714",
"0.6064804",
"0.6061102",
"0.605725",
"0.605725",
"0.6053179",
"0.60531557",
"0.6045403",
"0.6040671",
"0.6037529",
"0.6037365",
"0.6035206",
"0.60336965",
"0.60333943",
"0.60272825"
] | 0.0 | -1 |
args 1. Object value 2. Hash options return Boolean | def int?(value, options = nil)
return true if value.nil? and not required(options)
return false unless value.is_a?(Integer)
return true unless options.is_a?(Hash)
if options.key?(:min)
return false unless gt(options[:min], value, options[:include])
end
if options.key?(:max)
return false unless gt(value, options[:max], options[:include])
end
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vash_valid_value?(x); self.class.option_value?(x); end",
"def options?(*args)\r\n val = false\r\n options.each do |key, value|\r\n next unless args.include?(key.to_sym)\r\n val = options[key].nil? ? true : options[key]\r\n break\r\n end\r\n val\r\n end",
"def value?(value) true end",
"def include?(arg_)\n _get_objdata(arg_) ? true : false\n end",
"def vash_valid_key?(x); self.class.option_name?(x); end",
"def method_missing(sym, *args)\n if sym.to_s =~ /\\A(.*)\\?\\z/ && options.include?($1.to_sym) && (options[$1.to_sym].is_a?(TrueClass) || options[$1.to_sym].is_a?(FalseClass))\n options[$1.to_sym]\n elsif sym.to_s =~ /\\A(.*)\\z/ && options.include?($1.to_sym) \n options[$1.to_sym]\n else\n false\n end\n end",
"def typecast_value_boolean(opts={});true;end",
"def options_ok?\n end",
"def value?(value); end",
"def value?(value); end",
"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",
"def hash_in_argument_hash\n argument_hash = {} if argument_hash.nil?\n return true\n end",
"def accepts?(op)\n return @options.has_key? op\n end",
"def hash_or_parameter?(args)\n args.is_a?(Hash) || args.respond_to?(:to_unsafe_h)\n end",
"def has_value?(value); end",
"def options?\n options.is_a?(Hash)\n end",
"def true(_argvs)\n return nil\n end",
"def match?(options)\n options.all? { |key, value| self[key] == value }\n end",
"def has_value? value; value? value; end",
"def compare(object, options)\n options.keys.each do |key|\n return false unless object[key] == options[key]\n end\n\n true\n end",
"def match?(*args)\n props = Hash === args.last ? args.pop : {}\n\n if target = args.shift\n props[:command] = target.to_s\n props[:feature] = target.to_s\n end\n\n if props[:profile]\n props[:profile] = (props[:profile] || :default).to_s\n end\n\n props.each do |k,v|\n pv = property(k)\n return false unless (pv.nil? || pv == v)\n end\n\n return true\n end",
"def valid_opts\n true\n end",
"def set_options(options, args)\n set = false\n options.each do |x,y|\n if x == args[1]\n if y[\"file\"] == \"no\"\n y[\"value\"] = args[2]\n set = true\n elsif y[\"file\"] == \"yes\" and test_file(args[2])\n y[\"value\"] = args[2]\n y[\"is_file\"] = \"yes\"\n set = true\n elsif y[\"file\"] == \"maybe\"\n if not test_file(args[2])\n puts \"!! if the argument provided is a path, the file doesn't exist !!\"\n else\n y[\"is_file\"] = \"yes\"\n end\n y[\"value\"] = args[2]\n set = true\n end\n end\n end\n if not set \n puts \"Wrong option or the file specified doesn't exist \"\n end\n return options\nend",
"def has_value?(p0) end",
"def actual_options?(options)\n return false if options.nil?\n\n if (options.is_a?(String) || options.is_a?(Hash)) && !options.size.zero?\n true\n else\n false\n end\n end",
"def arguments_valid?\n valid_args = true\n valid_args = false if @options.min > @options.max\n valid_args = false if @options.user && !@options.password\n valid_args = false if @options.password && !@options.user\n valid_args\n end",
"def options_has_value_and_display?\n options.values.all? { |option|\n option.is_a?(Hash) && option.has_key?(\"value\")\n } && options.values.all? { |option|\n option.is_a?(Hash) && option.has_key?(\"display\")\n }\n end",
"def arguments_valid?\n # check the parameters have values\n return false unless @options.has_key?(:hcdFile)\n return false unless @options.has_key?(:etdFile) \n return false if @options[:mzArray].empty?\n return false unless (@options[:mzTolerance] > 0.0 || @options[:ppmTolerance] > 0.0 )\n # check the file exists\n return false unless File.file?(@options[:hcdFile])\n return false unless File.file?(@options[:etdFile])\n true\n end",
"def value?(p0) end",
"def supports_options?\n return true\n end",
"def method_missing(name, *args, &block)\n if name.to_s =~ /\\?$/ && args.empty?\n if @field_variants.any? { |variant| \"#{variant.attribute}?\" == name.to_s }\n 'true'\n else\n 'false'\n end\n else\n super(name.to_sym, *args, &block)\n end\n end",
"def allows?(hash={})\n apply(hash)[0]\n end",
"def args?\n\t\treturn !self.fields.empty?\n\tend",
"def acceptable? *args\n true\n end",
"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",
"def valid?\n errors, options = {}, {}\n @results = {:errors => errors, :options => options}\n \n remaining_args = args.dup\n valid_options.each do |long_name, details|\n short_name, default = *details\n key = long_name.gsub(/^--/, '').gsub('-', '_').to_sym\n index = remaining_args.index(long_name) ||\n remaining_args.index(short_name)\n if index\n remaining_args.delete_at index\n if self.class.option?(remaining_args[index])\n options[key] = true\n else\n options[key] = remaining_args.delete_at(index)\n end\n else\n options[key] = default\n end\n end\n remaining_args.each do |arg|\n arg_type = self.class.option?(arg) ? 'option' : 'argument'\n errors[arg] = \"is not a valid #{arg_type}\"\n end\n \n errors.empty?\n end",
"def true?(obj)\n booleans = { \"true\"=>true, \"1\"=>true, true=>true, 1=>true,\n \"false\"=>false, \"0\"=>false, false=>false, 0=>false}\n booleans.has_key?(obj) ? booleans[obj] : true\nend",
"def has_argument?(key)\n self.arguments.set?(key)\n end",
"def has_argument?(key)\n self.arguments.set?(key)\n end",
"def option?(key)\n key = key&.to_sym\n @value.key?(key) || option_method(key).present?\n end",
"def prepared_arg?(k)\n true\n end",
"def tell_the_truth(options={})\n if options[:profession] == :lawyer\n 'i cant'\n else\n true\n end\nend",
"def options?\n\t\t\tif parameters = self.parameters\n\t\t\t\ttype, name = parameters.last\n\t\t\t\t\n\t\t\t\treturn type == :keyrest || type == :keyreq || type == :key\n\t\t\tend\n\t\tend",
"def value\n true\n end",
"def is_value?\n true\n end",
"def in_kwarg; end",
"def member?(value, option)\n if option.is_a?(Array)\n options = {:items => option}\n else\n options = option\n end \n return true if value.nil? and not required(options) \n return options[:items].member?(value)\n end",
"def has_options?(opts = {})\n opts.each do |key, value|\n this_value = self[key.to_sym]\n return false if (this_value != value)\n end\n return true\n end",
"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",
"def boolean(key, options = {})\n before_all(key, options)\n match?(key, /(true)|(false)/) ? store(key, ->(item){to_boolean(item)}, options) : raise_type_error(key, \"Numeric\")\n end",
"def single_value?\n return false\n end",
"def param_present?(obj)\n @config_params.value?(obj)\n end",
"def process(key, options = {})\n before_all(key, options)\n match?(key, /(true)|(false)/) ? store(key, ->(item){to_boolean(item)}, options) : raise_type_error(key, \"Numeric\")\n end",
"def acceptable_values?\n options_s_keys = options.keys.map(&:to_s)\n\n if @attributes[:multiple] && resolver.params[name].respond_to?(:map)\n (resolver.params[name].map(&:to_s) - options_s_keys).empty?\n else\n options_s_keys.include?(resolver.params[name].to_s)\n end\n end",
"def has_value(name, options={})\n Valuable::Utils.check_options_validity(self.class.name, name, options)\n\n options[:extend] = [options[:extend]].flatten.compact\n options[:allow_blank] = options.has_key?(:allow_blank) ? options[:allow_blank] : true\n\n name = name.to_sym\n _attributes[name] = options \n \n create_accessor_for(name, options[:extend])\n\n create_question_for(name) if options[:klass] == :boolean\n create_negative_question_for(name, options[:negative]) if options[:klass] == :boolean && options[:negative]\n \n create_setter_for(name, allow_blank: options[:allow_blank] )\n\n sudo_alias options[:alias], name if options[:alias]\n sudo_alias \"#{options[:alias]}=\", \"#{name}=\" if options[:alias]\n end",
"def value? value\n include? value\n end",
"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",
"def prepared_arg?(k)\n true\n end",
"def parse_equal(obj, opt, argv)\n if md = /^[-]*(.*?)=(.*?)$/.match(opt)\n x, v = md[1], md[2]\n else\n raise ArgumentError, \"#{x}\"\n end\n # TODO: to_b if 'true' or 'false' ?\n #if obj.respond_to?(\"#{x}=\")\n obj.send(\"#{x}=\", v)\n #else\n # obj.option_missing(x, v)\n #end\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def arguments_valid?\n ret = false\n ret = true unless (@options.action == nil)\n end",
"def args?\n\t\treturn !@form.empty?\n\tend",
"def true?(obj)\n [\"true\",\"1\"].include? obj.to_s.downcase\n end",
"def is_bool(value) #method\n if value == 'verdadero' || value == 'falso'\n true\n else\n false\n end\n end",
"def hasArg?(arg); argSet.member?(arg) end",
"def can_have_value?()\n return true\n end",
"def can_have_value?\n return true\n end",
"def option(*args, &block)\n #p [:option, args, :optional, optional?]\n key_values, args = args.partition{ |x| x.kind_of?(Hash)}\n key_values = key_values.inject({ }){ |hash, kv| hash.merge(kv)}\n\n errors = []\n\n # handle optional/required flipflop\n if optional?\n required = { :default => nil }\n if key_values.delete(:required)\n if key_values.key?(:optional)\n errors << \"Can't specify both :required and :optional\"\n end\n if key_values.key?(:default)\n errors << \"Can't specify both :required and :default\"\n end\n required = { }\n elsif key_values.delete(:optional) && !key_values.key?(:default)\n required = { :default => nil }\n end\n else\n key_values.delete(:required)\n required = { }\n end\n args = [{ :using => Option }.merge(required).merge(key_values), *args]\n da = has(*args, &block)\n if errors.size > 0\n raise ArgumentError, \"#{da.name}: #{errors.join(', ')}\", [caller[-1]]\n end\n da.instance_eval do\n #p [:checking_values, values, values.class]\n if da.values.kind_of?(Range)\n must \"be in range #{da.values}\" do |s|\n da.values.include?(s)\n end\n elsif da.values.respond_to?(:size) && da.values.size > 0\n must \"be one of #{da.values.join(', ')}\" do |s|\n da.values.include?(s)\n end\n end\n if da.match\n must \"match pattern #{da.match.inspect}\" do |s|\n #p [:matching, s, da.match.inspect]\n s.to_s =~ da.match\n end\n end\n end\n da\n end",
"def options?\n false\n end",
"def options?\n false\n end",
"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",
"def matches?(value, context); end",
"def func1 val #missing the symbols for arguments\r\n if val = 1 #missing 1 equal symbol.\r\n return true\r\n else\r\n return false\r\n end\r\nend",
"def has_options?\n properties.include?(\"has_options\")\n end",
"def method_missing(*_args)\n true\n end",
"def value?(key)\n !!value(key) || @object.value?(key)\n end",
"def aws_obj_exists?(opts)\n opts[:obj].exists?\n end",
"def arguments_valid?\n true \n # to do\n end",
"def accept_more_values?(option=nil)\n if option.class == Hash && !block_given?\n return @j_del.java_method(:acceptMoreValues, [Java::IoVertxCoreCli::Option.java_class]).call(Java::IoVertxCoreCli::Option.new(::Vertx::Util::Utils.to_json_object(option)))\n end\n raise ArgumentError, \"Invalid arguments when calling accept_more_values?(option)\"\n end",
"def capable?(key); end",
"def use?(opts)\n !(opts.keys & @takes).empty?\n end",
"def boolean?\n !@arg[:boolValue].nil?\n end",
"def arguments_valid?\n # TO DO - implement your real logic here\n valid = false\n case @arguments[0]\n when 'ls' then\n #one argument or none but if one, ais url one!\n bucketName = @arguments[@arguments.length-1]\n valid = true if (bucketName == 'ls' || bucketName[0,6] == @storePrefix )\n when 'cp' then\n #source and dest must be their and one local and not the other! if directory need -L options\n if (@arguments.length >= 3) then\n source = @arguments[@arguments.length-2]\n dest = @arguments[@arguments.length-1]\n valid =true if(source[0,6] == @storePrefix && dest[0,6] != @storePrefix)\n valid =true if(source[0,6] != @storePrefix && dest[0,6] == @storePrefix && (( @options.local && File.directory?(source)) || (File.file? source )))\n end\n when 'mb' then\n #bucket url without object so just ais://bucket and not ais://bucket/object\n bucketName = @arguments[@arguments.length-1]\n valid = true if (bucketName[0,6] == @storePrefix && !bucketName[6..-1].include?('/'))\n when 'rm' then\n #work for bucket or object\n objectName = @arguments[@arguments.length-1]\n valid = true if (objectName[0,6] == @storePrefix)\n when 'metadata','protocol','md' then\n #same constraint, must be an object url\n objectName = @arguments[@arguments.length-1]\n valid = true if (objectName[0,6] == @storePrefix && objectName[6..-1].include?('/'))\n end\n valid\n end",
"def test_Hash_InstanceMethods_has_value?\n\t\th = {'a'=>100, 'b'=>200}\n\t\tassert_equal(true, h.has_value?(100))\n\t\tassert_equal(false, h.has_value?(999))\n\tend",
"def allow?(*args)\n true\n end",
"def has_value?\n true\n end",
"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",
"def specified?\n !options[:model].blank?\n end",
"def check(value)\n # We have to invert the values.\n if value == :true\n false\n else\n true\n end\n end",
"def validate_opts\n if @options[:file].nil?\n puts \"Pass me some filename (-f FILE)\"\n return false\n elsif !File.exists?(@options[:file])\n puts \"File: #{@options[:file]} does not exist\"\n return false\n elsif !File.readable?(@options[:file])\n puts \"File: #{@options[:file]} is not readable\"\n return false\n elsif File.directory?(@options[:file])\n puts \"#{@options[:file]} is a directory!\"\n return false\n elsif File.zero?(@options[:file])\n puts \"File: #{@options[:file]} is empty\"\n return false\n end\n\n if @options[:mode].nil?\n puts \"Pass me indexing mode (-m index|noindex )\"\n return false\n end\n return true\n end",
"def run(value)\n null_validator = NullValidator.new\n\n # NOTE: OpenActive is more strict than plain json-ld, so no coercion into arrays\n\n # Check if value is an array\n return true if item_validator.run(value) == true\n\n return false if ArrayValidator.new.run(value) == false\n\n value.each do |item|\n # If any of the provided items is not null nor an instance of the provided class name\n return false if null_validator.run(item) == false && item_validator.run(item) == false\n end\n true\n end",
"def prepared_arg?(k)\n true\n end"
] | [
"0.695029",
"0.6807112",
"0.67430145",
"0.6662309",
"0.66561747",
"0.6573999",
"0.6568521",
"0.6553517",
"0.6527092",
"0.6527092",
"0.638072",
"0.63655126",
"0.6269438",
"0.6244268",
"0.624202",
"0.6206484",
"0.61767805",
"0.61739814",
"0.60956895",
"0.60851175",
"0.60708857",
"0.60621554",
"0.6015562",
"0.6013806",
"0.6010339",
"0.60097253",
"0.6009424",
"0.5989822",
"0.5989529",
"0.598805",
"0.5971476",
"0.59699917",
"0.59630954",
"0.59598005",
"0.5958274",
"0.59209526",
"0.5913922",
"0.59068453",
"0.59068453",
"0.5896773",
"0.5889378",
"0.5882371",
"0.5877156",
"0.58758765",
"0.58617455",
"0.58606577",
"0.58575374",
"0.5854155",
"0.5853823",
"0.58513093",
"0.5846696",
"0.584579",
"0.58289915",
"0.58285517",
"0.582126",
"0.5809826",
"0.5794943",
"0.5775082",
"0.57700175",
"0.5769331",
"0.5769331",
"0.5769331",
"0.5769331",
"0.5769331",
"0.5769331",
"0.5769331",
"0.5769331",
"0.5769331",
"0.5769331",
"0.576736",
"0.5767249",
"0.5758276",
"0.5757408",
"0.57545835",
"0.5752479",
"0.5750998",
"0.5738254",
"0.5729918",
"0.5729918",
"0.5729296",
"0.57197285",
"0.57174885",
"0.5711995",
"0.5707031",
"0.570452",
"0.5697018",
"0.56894976",
"0.5689355",
"0.56875247",
"0.5686026",
"0.56784564",
"0.56784284",
"0.5676242",
"0.5674007",
"0.56676465",
"0.56640965",
"0.5663461",
"0.56592774",
"0.5655362",
"0.5655008",
"0.5653882"
] | 0.0 | -1 |
args 1. Object value 2. Hash options return Boolean | def numeric?(value, options = nil)
return true if value.nil? and not required(options)
return false unless value.is_a?(String)
return false unless value.to_i.to_s == value
return int?(value.to_i, options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vash_valid_value?(x); self.class.option_value?(x); end",
"def options?(*args)\r\n val = false\r\n options.each do |key, value|\r\n next unless args.include?(key.to_sym)\r\n val = options[key].nil? ? true : options[key]\r\n break\r\n end\r\n val\r\n end",
"def value?(value) true end",
"def include?(arg_)\n _get_objdata(arg_) ? true : false\n end",
"def vash_valid_key?(x); self.class.option_name?(x); end",
"def method_missing(sym, *args)\n if sym.to_s =~ /\\A(.*)\\?\\z/ && options.include?($1.to_sym) && (options[$1.to_sym].is_a?(TrueClass) || options[$1.to_sym].is_a?(FalseClass))\n options[$1.to_sym]\n elsif sym.to_s =~ /\\A(.*)\\z/ && options.include?($1.to_sym) \n options[$1.to_sym]\n else\n false\n end\n end",
"def typecast_value_boolean(opts={});true;end",
"def options_ok?\n end",
"def value?(value); end",
"def value?(value); end",
"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",
"def hash_in_argument_hash\n argument_hash = {} if argument_hash.nil?\n return true\n end",
"def accepts?(op)\n return @options.has_key? op\n end",
"def hash_or_parameter?(args)\n args.is_a?(Hash) || args.respond_to?(:to_unsafe_h)\n end",
"def has_value?(value); end",
"def options?\n options.is_a?(Hash)\n end",
"def true(_argvs)\n return nil\n end",
"def match?(options)\n options.all? { |key, value| self[key] == value }\n end",
"def has_value? value; value? value; end",
"def compare(object, options)\n options.keys.each do |key|\n return false unless object[key] == options[key]\n end\n\n true\n end",
"def match?(*args)\n props = Hash === args.last ? args.pop : {}\n\n if target = args.shift\n props[:command] = target.to_s\n props[:feature] = target.to_s\n end\n\n if props[:profile]\n props[:profile] = (props[:profile] || :default).to_s\n end\n\n props.each do |k,v|\n pv = property(k)\n return false unless (pv.nil? || pv == v)\n end\n\n return true\n end",
"def valid_opts\n true\n end",
"def set_options(options, args)\n set = false\n options.each do |x,y|\n if x == args[1]\n if y[\"file\"] == \"no\"\n y[\"value\"] = args[2]\n set = true\n elsif y[\"file\"] == \"yes\" and test_file(args[2])\n y[\"value\"] = args[2]\n y[\"is_file\"] = \"yes\"\n set = true\n elsif y[\"file\"] == \"maybe\"\n if not test_file(args[2])\n puts \"!! if the argument provided is a path, the file doesn't exist !!\"\n else\n y[\"is_file\"] = \"yes\"\n end\n y[\"value\"] = args[2]\n set = true\n end\n end\n end\n if not set \n puts \"Wrong option or the file specified doesn't exist \"\n end\n return options\nend",
"def has_value?(p0) end",
"def actual_options?(options)\n return false if options.nil?\n\n if (options.is_a?(String) || options.is_a?(Hash)) && !options.size.zero?\n true\n else\n false\n end\n end",
"def arguments_valid?\n valid_args = true\n valid_args = false if @options.min > @options.max\n valid_args = false if @options.user && !@options.password\n valid_args = false if @options.password && !@options.user\n valid_args\n end",
"def options_has_value_and_display?\n options.values.all? { |option|\n option.is_a?(Hash) && option.has_key?(\"value\")\n } && options.values.all? { |option|\n option.is_a?(Hash) && option.has_key?(\"display\")\n }\n end",
"def arguments_valid?\n # check the parameters have values\n return false unless @options.has_key?(:hcdFile)\n return false unless @options.has_key?(:etdFile) \n return false if @options[:mzArray].empty?\n return false unless (@options[:mzTolerance] > 0.0 || @options[:ppmTolerance] > 0.0 )\n # check the file exists\n return false unless File.file?(@options[:hcdFile])\n return false unless File.file?(@options[:etdFile])\n true\n end",
"def value?(p0) end",
"def supports_options?\n return true\n end",
"def method_missing(name, *args, &block)\n if name.to_s =~ /\\?$/ && args.empty?\n if @field_variants.any? { |variant| \"#{variant.attribute}?\" == name.to_s }\n 'true'\n else\n 'false'\n end\n else\n super(name.to_sym, *args, &block)\n end\n end",
"def allows?(hash={})\n apply(hash)[0]\n end",
"def args?\n\t\treturn !self.fields.empty?\n\tend",
"def acceptable? *args\n true\n end",
"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",
"def valid?\n errors, options = {}, {}\n @results = {:errors => errors, :options => options}\n \n remaining_args = args.dup\n valid_options.each do |long_name, details|\n short_name, default = *details\n key = long_name.gsub(/^--/, '').gsub('-', '_').to_sym\n index = remaining_args.index(long_name) ||\n remaining_args.index(short_name)\n if index\n remaining_args.delete_at index\n if self.class.option?(remaining_args[index])\n options[key] = true\n else\n options[key] = remaining_args.delete_at(index)\n end\n else\n options[key] = default\n end\n end\n remaining_args.each do |arg|\n arg_type = self.class.option?(arg) ? 'option' : 'argument'\n errors[arg] = \"is not a valid #{arg_type}\"\n end\n \n errors.empty?\n end",
"def true?(obj)\n booleans = { \"true\"=>true, \"1\"=>true, true=>true, 1=>true,\n \"false\"=>false, \"0\"=>false, false=>false, 0=>false}\n booleans.has_key?(obj) ? booleans[obj] : true\nend",
"def has_argument?(key)\n self.arguments.set?(key)\n end",
"def has_argument?(key)\n self.arguments.set?(key)\n end",
"def option?(key)\n key = key&.to_sym\n @value.key?(key) || option_method(key).present?\n end",
"def prepared_arg?(k)\n true\n end",
"def tell_the_truth(options={})\n if options[:profession] == :lawyer\n 'i cant'\n else\n true\n end\nend",
"def options?\n\t\t\tif parameters = self.parameters\n\t\t\t\ttype, name = parameters.last\n\t\t\t\t\n\t\t\t\treturn type == :keyrest || type == :keyreq || type == :key\n\t\t\tend\n\t\tend",
"def value\n true\n end",
"def is_value?\n true\n end",
"def in_kwarg; end",
"def member?(value, option)\n if option.is_a?(Array)\n options = {:items => option}\n else\n options = option\n end \n return true if value.nil? and not required(options) \n return options[:items].member?(value)\n end",
"def has_options?(opts = {})\n opts.each do |key, value|\n this_value = self[key.to_sym]\n return false if (this_value != value)\n end\n return true\n end",
"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",
"def boolean(key, options = {})\n before_all(key, options)\n match?(key, /(true)|(false)/) ? store(key, ->(item){to_boolean(item)}, options) : raise_type_error(key, \"Numeric\")\n end",
"def single_value?\n return false\n end",
"def param_present?(obj)\n @config_params.value?(obj)\n end",
"def process(key, options = {})\n before_all(key, options)\n match?(key, /(true)|(false)/) ? store(key, ->(item){to_boolean(item)}, options) : raise_type_error(key, \"Numeric\")\n end",
"def acceptable_values?\n options_s_keys = options.keys.map(&:to_s)\n\n if @attributes[:multiple] && resolver.params[name].respond_to?(:map)\n (resolver.params[name].map(&:to_s) - options_s_keys).empty?\n else\n options_s_keys.include?(resolver.params[name].to_s)\n end\n end",
"def has_value(name, options={})\n Valuable::Utils.check_options_validity(self.class.name, name, options)\n\n options[:extend] = [options[:extend]].flatten.compact\n options[:allow_blank] = options.has_key?(:allow_blank) ? options[:allow_blank] : true\n\n name = name.to_sym\n _attributes[name] = options \n \n create_accessor_for(name, options[:extend])\n\n create_question_for(name) if options[:klass] == :boolean\n create_negative_question_for(name, options[:negative]) if options[:klass] == :boolean && options[:negative]\n \n create_setter_for(name, allow_blank: options[:allow_blank] )\n\n sudo_alias options[:alias], name if options[:alias]\n sudo_alias \"#{options[:alias]}=\", \"#{name}=\" if options[:alias]\n end",
"def value? value\n include? value\n end",
"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",
"def prepared_arg?(k)\n true\n end",
"def parse_equal(obj, opt, argv)\n if md = /^[-]*(.*?)=(.*?)$/.match(opt)\n x, v = md[1], md[2]\n else\n raise ArgumentError, \"#{x}\"\n end\n # TODO: to_b if 'true' or 'false' ?\n #if obj.respond_to?(\"#{x}=\")\n obj.send(\"#{x}=\", v)\n #else\n # obj.option_missing(x, v)\n #end\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def arguments_valid?\n ret = false\n ret = true unless (@options.action == nil)\n end",
"def args?\n\t\treturn !@form.empty?\n\tend",
"def true?(obj)\n [\"true\",\"1\"].include? obj.to_s.downcase\n end",
"def is_bool(value) #method\n if value == 'verdadero' || value == 'falso'\n true\n else\n false\n end\n end",
"def hasArg?(arg); argSet.member?(arg) end",
"def can_have_value?()\n return true\n end",
"def can_have_value?\n return true\n end",
"def option(*args, &block)\n #p [:option, args, :optional, optional?]\n key_values, args = args.partition{ |x| x.kind_of?(Hash)}\n key_values = key_values.inject({ }){ |hash, kv| hash.merge(kv)}\n\n errors = []\n\n # handle optional/required flipflop\n if optional?\n required = { :default => nil }\n if key_values.delete(:required)\n if key_values.key?(:optional)\n errors << \"Can't specify both :required and :optional\"\n end\n if key_values.key?(:default)\n errors << \"Can't specify both :required and :default\"\n end\n required = { }\n elsif key_values.delete(:optional) && !key_values.key?(:default)\n required = { :default => nil }\n end\n else\n key_values.delete(:required)\n required = { }\n end\n args = [{ :using => Option }.merge(required).merge(key_values), *args]\n da = has(*args, &block)\n if errors.size > 0\n raise ArgumentError, \"#{da.name}: #{errors.join(', ')}\", [caller[-1]]\n end\n da.instance_eval do\n #p [:checking_values, values, values.class]\n if da.values.kind_of?(Range)\n must \"be in range #{da.values}\" do |s|\n da.values.include?(s)\n end\n elsif da.values.respond_to?(:size) && da.values.size > 0\n must \"be one of #{da.values.join(', ')}\" do |s|\n da.values.include?(s)\n end\n end\n if da.match\n must \"match pattern #{da.match.inspect}\" do |s|\n #p [:matching, s, da.match.inspect]\n s.to_s =~ da.match\n end\n end\n end\n da\n end",
"def options?\n false\n end",
"def options?\n false\n end",
"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",
"def matches?(value, context); end",
"def func1 val #missing the symbols for arguments\r\n if val = 1 #missing 1 equal symbol.\r\n return true\r\n else\r\n return false\r\n end\r\nend",
"def has_options?\n properties.include?(\"has_options\")\n end",
"def method_missing(*_args)\n true\n end",
"def value?(key)\n !!value(key) || @object.value?(key)\n end",
"def aws_obj_exists?(opts)\n opts[:obj].exists?\n end",
"def arguments_valid?\n true \n # to do\n end",
"def accept_more_values?(option=nil)\n if option.class == Hash && !block_given?\n return @j_del.java_method(:acceptMoreValues, [Java::IoVertxCoreCli::Option.java_class]).call(Java::IoVertxCoreCli::Option.new(::Vertx::Util::Utils.to_json_object(option)))\n end\n raise ArgumentError, \"Invalid arguments when calling accept_more_values?(option)\"\n end",
"def capable?(key); end",
"def use?(opts)\n !(opts.keys & @takes).empty?\n end",
"def boolean?\n !@arg[:boolValue].nil?\n end",
"def arguments_valid?\n # TO DO - implement your real logic here\n valid = false\n case @arguments[0]\n when 'ls' then\n #one argument or none but if one, ais url one!\n bucketName = @arguments[@arguments.length-1]\n valid = true if (bucketName == 'ls' || bucketName[0,6] == @storePrefix )\n when 'cp' then\n #source and dest must be their and one local and not the other! if directory need -L options\n if (@arguments.length >= 3) then\n source = @arguments[@arguments.length-2]\n dest = @arguments[@arguments.length-1]\n valid =true if(source[0,6] == @storePrefix && dest[0,6] != @storePrefix)\n valid =true if(source[0,6] != @storePrefix && dest[0,6] == @storePrefix && (( @options.local && File.directory?(source)) || (File.file? source )))\n end\n when 'mb' then\n #bucket url without object so just ais://bucket and not ais://bucket/object\n bucketName = @arguments[@arguments.length-1]\n valid = true if (bucketName[0,6] == @storePrefix && !bucketName[6..-1].include?('/'))\n when 'rm' then\n #work for bucket or object\n objectName = @arguments[@arguments.length-1]\n valid = true if (objectName[0,6] == @storePrefix)\n when 'metadata','protocol','md' then\n #same constraint, must be an object url\n objectName = @arguments[@arguments.length-1]\n valid = true if (objectName[0,6] == @storePrefix && objectName[6..-1].include?('/'))\n end\n valid\n end",
"def test_Hash_InstanceMethods_has_value?\n\t\th = {'a'=>100, 'b'=>200}\n\t\tassert_equal(true, h.has_value?(100))\n\t\tassert_equal(false, h.has_value?(999))\n\tend",
"def allow?(*args)\n true\n end",
"def has_value?\n true\n end",
"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",
"def specified?\n !options[:model].blank?\n end",
"def check(value)\n # We have to invert the values.\n if value == :true\n false\n else\n true\n end\n end",
"def validate_opts\n if @options[:file].nil?\n puts \"Pass me some filename (-f FILE)\"\n return false\n elsif !File.exists?(@options[:file])\n puts \"File: #{@options[:file]} does not exist\"\n return false\n elsif !File.readable?(@options[:file])\n puts \"File: #{@options[:file]} is not readable\"\n return false\n elsif File.directory?(@options[:file])\n puts \"#{@options[:file]} is a directory!\"\n return false\n elsif File.zero?(@options[:file])\n puts \"File: #{@options[:file]} is empty\"\n return false\n end\n\n if @options[:mode].nil?\n puts \"Pass me indexing mode (-m index|noindex )\"\n return false\n end\n return true\n end",
"def run(value)\n null_validator = NullValidator.new\n\n # NOTE: OpenActive is more strict than plain json-ld, so no coercion into arrays\n\n # Check if value is an array\n return true if item_validator.run(value) == true\n\n return false if ArrayValidator.new.run(value) == false\n\n value.each do |item|\n # If any of the provided items is not null nor an instance of the provided class name\n return false if null_validator.run(item) == false && item_validator.run(item) == false\n end\n true\n end",
"def prepared_arg?(k)\n true\n end"
] | [
"0.695029",
"0.6807112",
"0.67430145",
"0.6662309",
"0.66561747",
"0.6573999",
"0.6568521",
"0.6553517",
"0.6527092",
"0.6527092",
"0.638072",
"0.63655126",
"0.6269438",
"0.6244268",
"0.624202",
"0.6206484",
"0.61767805",
"0.61739814",
"0.60956895",
"0.60851175",
"0.60708857",
"0.60621554",
"0.6015562",
"0.6013806",
"0.6010339",
"0.60097253",
"0.6009424",
"0.5989822",
"0.5989529",
"0.598805",
"0.5971476",
"0.59699917",
"0.59630954",
"0.59598005",
"0.5958274",
"0.59209526",
"0.5913922",
"0.59068453",
"0.59068453",
"0.5896773",
"0.5889378",
"0.5882371",
"0.5877156",
"0.58758765",
"0.58617455",
"0.58606577",
"0.58575374",
"0.5854155",
"0.5853823",
"0.58513093",
"0.5846696",
"0.584579",
"0.58289915",
"0.58285517",
"0.582126",
"0.5809826",
"0.5794943",
"0.5775082",
"0.57700175",
"0.5769331",
"0.5769331",
"0.5769331",
"0.5769331",
"0.5769331",
"0.5769331",
"0.5769331",
"0.5769331",
"0.5769331",
"0.5769331",
"0.576736",
"0.5767249",
"0.5758276",
"0.5757408",
"0.57545835",
"0.5752479",
"0.5750998",
"0.5738254",
"0.5729918",
"0.5729918",
"0.5729296",
"0.57197285",
"0.57174885",
"0.5711995",
"0.5707031",
"0.570452",
"0.5697018",
"0.56894976",
"0.5689355",
"0.56875247",
"0.5686026",
"0.56784564",
"0.56784284",
"0.5676242",
"0.5674007",
"0.56676465",
"0.56640965",
"0.5663461",
"0.56592774",
"0.5655362",
"0.5655008",
"0.5653882"
] | 0.0 | -1 |
args 1. Object value 2. Hash options return Boolean | def string?(value, options = nil)
return true if value.nil? and not required(options)
return false unless value.is_a?(String)
return true unless options.is_a?(Hash)
if options.key?(:min)
return false unless gt(options[:min], value.split("").size, options[:include])
end
if options.key?(:max)
return false unless gt(value.split("").size, options[:max], options[:include])
end
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vash_valid_value?(x); self.class.option_value?(x); end",
"def options?(*args)\r\n val = false\r\n options.each do |key, value|\r\n next unless args.include?(key.to_sym)\r\n val = options[key].nil? ? true : options[key]\r\n break\r\n end\r\n val\r\n end",
"def value?(value) true end",
"def include?(arg_)\n _get_objdata(arg_) ? true : false\n end",
"def vash_valid_key?(x); self.class.option_name?(x); end",
"def method_missing(sym, *args)\n if sym.to_s =~ /\\A(.*)\\?\\z/ && options.include?($1.to_sym) && (options[$1.to_sym].is_a?(TrueClass) || options[$1.to_sym].is_a?(FalseClass))\n options[$1.to_sym]\n elsif sym.to_s =~ /\\A(.*)\\z/ && options.include?($1.to_sym) \n options[$1.to_sym]\n else\n false\n end\n end",
"def typecast_value_boolean(opts={});true;end",
"def options_ok?\n end",
"def value?(value); end",
"def value?(value); end",
"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",
"def hash_in_argument_hash\n argument_hash = {} if argument_hash.nil?\n return true\n end",
"def accepts?(op)\n return @options.has_key? op\n end",
"def hash_or_parameter?(args)\n args.is_a?(Hash) || args.respond_to?(:to_unsafe_h)\n end",
"def has_value?(value); end",
"def options?\n options.is_a?(Hash)\n end",
"def true(_argvs)\n return nil\n end",
"def match?(options)\n options.all? { |key, value| self[key] == value }\n end",
"def has_value? value; value? value; end",
"def compare(object, options)\n options.keys.each do |key|\n return false unless object[key] == options[key]\n end\n\n true\n end",
"def match?(*args)\n props = Hash === args.last ? args.pop : {}\n\n if target = args.shift\n props[:command] = target.to_s\n props[:feature] = target.to_s\n end\n\n if props[:profile]\n props[:profile] = (props[:profile] || :default).to_s\n end\n\n props.each do |k,v|\n pv = property(k)\n return false unless (pv.nil? || pv == v)\n end\n\n return true\n end",
"def valid_opts\n true\n end",
"def set_options(options, args)\n set = false\n options.each do |x,y|\n if x == args[1]\n if y[\"file\"] == \"no\"\n y[\"value\"] = args[2]\n set = true\n elsif y[\"file\"] == \"yes\" and test_file(args[2])\n y[\"value\"] = args[2]\n y[\"is_file\"] = \"yes\"\n set = true\n elsif y[\"file\"] == \"maybe\"\n if not test_file(args[2])\n puts \"!! if the argument provided is a path, the file doesn't exist !!\"\n else\n y[\"is_file\"] = \"yes\"\n end\n y[\"value\"] = args[2]\n set = true\n end\n end\n end\n if not set \n puts \"Wrong option or the file specified doesn't exist \"\n end\n return options\nend",
"def has_value?(p0) end",
"def actual_options?(options)\n return false if options.nil?\n\n if (options.is_a?(String) || options.is_a?(Hash)) && !options.size.zero?\n true\n else\n false\n end\n end",
"def arguments_valid?\n valid_args = true\n valid_args = false if @options.min > @options.max\n valid_args = false if @options.user && !@options.password\n valid_args = false if @options.password && !@options.user\n valid_args\n end",
"def options_has_value_and_display?\n options.values.all? { |option|\n option.is_a?(Hash) && option.has_key?(\"value\")\n } && options.values.all? { |option|\n option.is_a?(Hash) && option.has_key?(\"display\")\n }\n end",
"def arguments_valid?\n # check the parameters have values\n return false unless @options.has_key?(:hcdFile)\n return false unless @options.has_key?(:etdFile) \n return false if @options[:mzArray].empty?\n return false unless (@options[:mzTolerance] > 0.0 || @options[:ppmTolerance] > 0.0 )\n # check the file exists\n return false unless File.file?(@options[:hcdFile])\n return false unless File.file?(@options[:etdFile])\n true\n end",
"def value?(p0) end",
"def supports_options?\n return true\n end",
"def method_missing(name, *args, &block)\n if name.to_s =~ /\\?$/ && args.empty?\n if @field_variants.any? { |variant| \"#{variant.attribute}?\" == name.to_s }\n 'true'\n else\n 'false'\n end\n else\n super(name.to_sym, *args, &block)\n end\n end",
"def allows?(hash={})\n apply(hash)[0]\n end",
"def args?\n\t\treturn !self.fields.empty?\n\tend",
"def acceptable? *args\n true\n end",
"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",
"def valid?\n errors, options = {}, {}\n @results = {:errors => errors, :options => options}\n \n remaining_args = args.dup\n valid_options.each do |long_name, details|\n short_name, default = *details\n key = long_name.gsub(/^--/, '').gsub('-', '_').to_sym\n index = remaining_args.index(long_name) ||\n remaining_args.index(short_name)\n if index\n remaining_args.delete_at index\n if self.class.option?(remaining_args[index])\n options[key] = true\n else\n options[key] = remaining_args.delete_at(index)\n end\n else\n options[key] = default\n end\n end\n remaining_args.each do |arg|\n arg_type = self.class.option?(arg) ? 'option' : 'argument'\n errors[arg] = \"is not a valid #{arg_type}\"\n end\n \n errors.empty?\n end",
"def true?(obj)\n booleans = { \"true\"=>true, \"1\"=>true, true=>true, 1=>true,\n \"false\"=>false, \"0\"=>false, false=>false, 0=>false}\n booleans.has_key?(obj) ? booleans[obj] : true\nend",
"def has_argument?(key)\n self.arguments.set?(key)\n end",
"def has_argument?(key)\n self.arguments.set?(key)\n end",
"def option?(key)\n key = key&.to_sym\n @value.key?(key) || option_method(key).present?\n end",
"def prepared_arg?(k)\n true\n end",
"def tell_the_truth(options={})\n if options[:profession] == :lawyer\n 'i cant'\n else\n true\n end\nend",
"def options?\n\t\t\tif parameters = self.parameters\n\t\t\t\ttype, name = parameters.last\n\t\t\t\t\n\t\t\t\treturn type == :keyrest || type == :keyreq || type == :key\n\t\t\tend\n\t\tend",
"def value\n true\n end",
"def is_value?\n true\n end",
"def in_kwarg; end",
"def member?(value, option)\n if option.is_a?(Array)\n options = {:items => option}\n else\n options = option\n end \n return true if value.nil? and not required(options) \n return options[:items].member?(value)\n end",
"def has_options?(opts = {})\n opts.each do |key, value|\n this_value = self[key.to_sym]\n return false if (this_value != value)\n end\n return true\n end",
"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",
"def boolean(key, options = {})\n before_all(key, options)\n match?(key, /(true)|(false)/) ? store(key, ->(item){to_boolean(item)}, options) : raise_type_error(key, \"Numeric\")\n end",
"def single_value?\n return false\n end",
"def param_present?(obj)\n @config_params.value?(obj)\n end",
"def process(key, options = {})\n before_all(key, options)\n match?(key, /(true)|(false)/) ? store(key, ->(item){to_boolean(item)}, options) : raise_type_error(key, \"Numeric\")\n end",
"def acceptable_values?\n options_s_keys = options.keys.map(&:to_s)\n\n if @attributes[:multiple] && resolver.params[name].respond_to?(:map)\n (resolver.params[name].map(&:to_s) - options_s_keys).empty?\n else\n options_s_keys.include?(resolver.params[name].to_s)\n end\n end",
"def has_value(name, options={})\n Valuable::Utils.check_options_validity(self.class.name, name, options)\n\n options[:extend] = [options[:extend]].flatten.compact\n options[:allow_blank] = options.has_key?(:allow_blank) ? options[:allow_blank] : true\n\n name = name.to_sym\n _attributes[name] = options \n \n create_accessor_for(name, options[:extend])\n\n create_question_for(name) if options[:klass] == :boolean\n create_negative_question_for(name, options[:negative]) if options[:klass] == :boolean && options[:negative]\n \n create_setter_for(name, allow_blank: options[:allow_blank] )\n\n sudo_alias options[:alias], name if options[:alias]\n sudo_alias \"#{options[:alias]}=\", \"#{name}=\" if options[:alias]\n end",
"def value? value\n include? value\n end",
"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",
"def prepared_arg?(k)\n true\n end",
"def parse_equal(obj, opt, argv)\n if md = /^[-]*(.*?)=(.*?)$/.match(opt)\n x, v = md[1], md[2]\n else\n raise ArgumentError, \"#{x}\"\n end\n # TODO: to_b if 'true' or 'false' ?\n #if obj.respond_to?(\"#{x}=\")\n obj.send(\"#{x}=\", v)\n #else\n # obj.option_missing(x, v)\n #end\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def arguments_valid?\n ret = false\n ret = true unless (@options.action == nil)\n end",
"def args?\n\t\treturn !@form.empty?\n\tend",
"def true?(obj)\n [\"true\",\"1\"].include? obj.to_s.downcase\n end",
"def is_bool(value) #method\n if value == 'verdadero' || value == 'falso'\n true\n else\n false\n end\n end",
"def hasArg?(arg); argSet.member?(arg) end",
"def can_have_value?()\n return true\n end",
"def can_have_value?\n return true\n end",
"def option(*args, &block)\n #p [:option, args, :optional, optional?]\n key_values, args = args.partition{ |x| x.kind_of?(Hash)}\n key_values = key_values.inject({ }){ |hash, kv| hash.merge(kv)}\n\n errors = []\n\n # handle optional/required flipflop\n if optional?\n required = { :default => nil }\n if key_values.delete(:required)\n if key_values.key?(:optional)\n errors << \"Can't specify both :required and :optional\"\n end\n if key_values.key?(:default)\n errors << \"Can't specify both :required and :default\"\n end\n required = { }\n elsif key_values.delete(:optional) && !key_values.key?(:default)\n required = { :default => nil }\n end\n else\n key_values.delete(:required)\n required = { }\n end\n args = [{ :using => Option }.merge(required).merge(key_values), *args]\n da = has(*args, &block)\n if errors.size > 0\n raise ArgumentError, \"#{da.name}: #{errors.join(', ')}\", [caller[-1]]\n end\n da.instance_eval do\n #p [:checking_values, values, values.class]\n if da.values.kind_of?(Range)\n must \"be in range #{da.values}\" do |s|\n da.values.include?(s)\n end\n elsif da.values.respond_to?(:size) && da.values.size > 0\n must \"be one of #{da.values.join(', ')}\" do |s|\n da.values.include?(s)\n end\n end\n if da.match\n must \"match pattern #{da.match.inspect}\" do |s|\n #p [:matching, s, da.match.inspect]\n s.to_s =~ da.match\n end\n end\n end\n da\n end",
"def options?\n false\n end",
"def options?\n false\n end",
"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",
"def matches?(value, context); end",
"def func1 val #missing the symbols for arguments\r\n if val = 1 #missing 1 equal symbol.\r\n return true\r\n else\r\n return false\r\n end\r\nend",
"def has_options?\n properties.include?(\"has_options\")\n end",
"def method_missing(*_args)\n true\n end",
"def value?(key)\n !!value(key) || @object.value?(key)\n end",
"def aws_obj_exists?(opts)\n opts[:obj].exists?\n end",
"def arguments_valid?\n true \n # to do\n end",
"def accept_more_values?(option=nil)\n if option.class == Hash && !block_given?\n return @j_del.java_method(:acceptMoreValues, [Java::IoVertxCoreCli::Option.java_class]).call(Java::IoVertxCoreCli::Option.new(::Vertx::Util::Utils.to_json_object(option)))\n end\n raise ArgumentError, \"Invalid arguments when calling accept_more_values?(option)\"\n end",
"def capable?(key); end",
"def use?(opts)\n !(opts.keys & @takes).empty?\n end",
"def boolean?\n !@arg[:boolValue].nil?\n end",
"def arguments_valid?\n # TO DO - implement your real logic here\n valid = false\n case @arguments[0]\n when 'ls' then\n #one argument or none but if one, ais url one!\n bucketName = @arguments[@arguments.length-1]\n valid = true if (bucketName == 'ls' || bucketName[0,6] == @storePrefix )\n when 'cp' then\n #source and dest must be their and one local and not the other! if directory need -L options\n if (@arguments.length >= 3) then\n source = @arguments[@arguments.length-2]\n dest = @arguments[@arguments.length-1]\n valid =true if(source[0,6] == @storePrefix && dest[0,6] != @storePrefix)\n valid =true if(source[0,6] != @storePrefix && dest[0,6] == @storePrefix && (( @options.local && File.directory?(source)) || (File.file? source )))\n end\n when 'mb' then\n #bucket url without object so just ais://bucket and not ais://bucket/object\n bucketName = @arguments[@arguments.length-1]\n valid = true if (bucketName[0,6] == @storePrefix && !bucketName[6..-1].include?('/'))\n when 'rm' then\n #work for bucket or object\n objectName = @arguments[@arguments.length-1]\n valid = true if (objectName[0,6] == @storePrefix)\n when 'metadata','protocol','md' then\n #same constraint, must be an object url\n objectName = @arguments[@arguments.length-1]\n valid = true if (objectName[0,6] == @storePrefix && objectName[6..-1].include?('/'))\n end\n valid\n end",
"def test_Hash_InstanceMethods_has_value?\n\t\th = {'a'=>100, 'b'=>200}\n\t\tassert_equal(true, h.has_value?(100))\n\t\tassert_equal(false, h.has_value?(999))\n\tend",
"def allow?(*args)\n true\n end",
"def has_value?\n true\n end",
"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",
"def specified?\n !options[:model].blank?\n end",
"def check(value)\n # We have to invert the values.\n if value == :true\n false\n else\n true\n end\n end",
"def validate_opts\n if @options[:file].nil?\n puts \"Pass me some filename (-f FILE)\"\n return false\n elsif !File.exists?(@options[:file])\n puts \"File: #{@options[:file]} does not exist\"\n return false\n elsif !File.readable?(@options[:file])\n puts \"File: #{@options[:file]} is not readable\"\n return false\n elsif File.directory?(@options[:file])\n puts \"#{@options[:file]} is a directory!\"\n return false\n elsif File.zero?(@options[:file])\n puts \"File: #{@options[:file]} is empty\"\n return false\n end\n\n if @options[:mode].nil?\n puts \"Pass me indexing mode (-m index|noindex )\"\n return false\n end\n return true\n end",
"def run(value)\n null_validator = NullValidator.new\n\n # NOTE: OpenActive is more strict than plain json-ld, so no coercion into arrays\n\n # Check if value is an array\n return true if item_validator.run(value) == true\n\n return false if ArrayValidator.new.run(value) == false\n\n value.each do |item|\n # If any of the provided items is not null nor an instance of the provided class name\n return false if null_validator.run(item) == false && item_validator.run(item) == false\n end\n true\n end",
"def prepared_arg?(k)\n true\n end"
] | [
"0.695029",
"0.6807112",
"0.67430145",
"0.6662309",
"0.66561747",
"0.6573999",
"0.6568521",
"0.6553517",
"0.6527092",
"0.6527092",
"0.638072",
"0.63655126",
"0.6269438",
"0.6244268",
"0.624202",
"0.6206484",
"0.61767805",
"0.61739814",
"0.60956895",
"0.60851175",
"0.60708857",
"0.60621554",
"0.6015562",
"0.6013806",
"0.6010339",
"0.60097253",
"0.6009424",
"0.5989822",
"0.5989529",
"0.598805",
"0.5971476",
"0.59699917",
"0.59630954",
"0.59598005",
"0.5958274",
"0.59209526",
"0.5913922",
"0.59068453",
"0.59068453",
"0.5896773",
"0.5889378",
"0.5882371",
"0.5877156",
"0.58758765",
"0.58617455",
"0.58606577",
"0.58575374",
"0.5854155",
"0.5853823",
"0.58513093",
"0.5846696",
"0.584579",
"0.58289915",
"0.58285517",
"0.582126",
"0.5809826",
"0.5794943",
"0.5775082",
"0.57700175",
"0.5769331",
"0.5769331",
"0.5769331",
"0.5769331",
"0.5769331",
"0.5769331",
"0.5769331",
"0.5769331",
"0.5769331",
"0.5769331",
"0.576736",
"0.5767249",
"0.5758276",
"0.5757408",
"0.57545835",
"0.5752479",
"0.5750998",
"0.5738254",
"0.5729918",
"0.5729918",
"0.5729296",
"0.57197285",
"0.57174885",
"0.5711995",
"0.5707031",
"0.570452",
"0.5697018",
"0.56894976",
"0.5689355",
"0.56875247",
"0.5686026",
"0.56784564",
"0.56784284",
"0.5676242",
"0.5674007",
"0.56676465",
"0.56640965",
"0.5663461",
"0.56592774",
"0.5655362",
"0.5655008",
"0.5653882"
] | 0.0 | -1 |
args 1. Object value 2. Hash options return Boolean | def array?(value, options = nil)
return true if value.nil? and not required(options)
return false unless value.is_a?(Array)
return int?(value.size, options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vash_valid_value?(x); self.class.option_value?(x); end",
"def options?(*args)\r\n val = false\r\n options.each do |key, value|\r\n next unless args.include?(key.to_sym)\r\n val = options[key].nil? ? true : options[key]\r\n break\r\n end\r\n val\r\n end",
"def value?(value) true end",
"def include?(arg_)\n _get_objdata(arg_) ? true : false\n end",
"def vash_valid_key?(x); self.class.option_name?(x); end",
"def method_missing(sym, *args)\n if sym.to_s =~ /\\A(.*)\\?\\z/ && options.include?($1.to_sym) && (options[$1.to_sym].is_a?(TrueClass) || options[$1.to_sym].is_a?(FalseClass))\n options[$1.to_sym]\n elsif sym.to_s =~ /\\A(.*)\\z/ && options.include?($1.to_sym) \n options[$1.to_sym]\n else\n false\n end\n end",
"def typecast_value_boolean(opts={});true;end",
"def options_ok?\n end",
"def value?(value); end",
"def value?(value); end",
"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",
"def hash_in_argument_hash\n argument_hash = {} if argument_hash.nil?\n return true\n end",
"def accepts?(op)\n return @options.has_key? op\n end",
"def has_value?(value); end",
"def hash_or_parameter?(args)\n args.is_a?(Hash) || args.respond_to?(:to_unsafe_h)\n end",
"def options?\n options.is_a?(Hash)\n end",
"def true(_argvs)\n return nil\n end",
"def match?(options)\n options.all? { |key, value| self[key] == value }\n end",
"def has_value? value; value? value; end",
"def compare(object, options)\n options.keys.each do |key|\n return false unless object[key] == options[key]\n end\n\n true\n end",
"def match?(*args)\n props = Hash === args.last ? args.pop : {}\n\n if target = args.shift\n props[:command] = target.to_s\n props[:feature] = target.to_s\n end\n\n if props[:profile]\n props[:profile] = (props[:profile] || :default).to_s\n end\n\n props.each do |k,v|\n pv = property(k)\n return false unless (pv.nil? || pv == v)\n end\n\n return true\n end",
"def valid_opts\n true\n end",
"def set_options(options, args)\n set = false\n options.each do |x,y|\n if x == args[1]\n if y[\"file\"] == \"no\"\n y[\"value\"] = args[2]\n set = true\n elsif y[\"file\"] == \"yes\" and test_file(args[2])\n y[\"value\"] = args[2]\n y[\"is_file\"] = \"yes\"\n set = true\n elsif y[\"file\"] == \"maybe\"\n if not test_file(args[2])\n puts \"!! if the argument provided is a path, the file doesn't exist !!\"\n else\n y[\"is_file\"] = \"yes\"\n end\n y[\"value\"] = args[2]\n set = true\n end\n end\n end\n if not set \n puts \"Wrong option or the file specified doesn't exist \"\n end\n return options\nend",
"def has_value?(p0) end",
"def actual_options?(options)\n return false if options.nil?\n\n if (options.is_a?(String) || options.is_a?(Hash)) && !options.size.zero?\n true\n else\n false\n end\n end",
"def arguments_valid?\n valid_args = true\n valid_args = false if @options.min > @options.max\n valid_args = false if @options.user && !@options.password\n valid_args = false if @options.password && !@options.user\n valid_args\n end",
"def options_has_value_and_display?\n options.values.all? { |option|\n option.is_a?(Hash) && option.has_key?(\"value\")\n } && options.values.all? { |option|\n option.is_a?(Hash) && option.has_key?(\"display\")\n }\n end",
"def value?(p0) end",
"def arguments_valid?\n # check the parameters have values\n return false unless @options.has_key?(:hcdFile)\n return false unless @options.has_key?(:etdFile) \n return false if @options[:mzArray].empty?\n return false unless (@options[:mzTolerance] > 0.0 || @options[:ppmTolerance] > 0.0 )\n # check the file exists\n return false unless File.file?(@options[:hcdFile])\n return false unless File.file?(@options[:etdFile])\n true\n end",
"def supports_options?\n return true\n end",
"def method_missing(name, *args, &block)\n if name.to_s =~ /\\?$/ && args.empty?\n if @field_variants.any? { |variant| \"#{variant.attribute}?\" == name.to_s }\n 'true'\n else\n 'false'\n end\n else\n super(name.to_sym, *args, &block)\n end\n end",
"def allows?(hash={})\n apply(hash)[0]\n end",
"def args?\n\t\treturn !self.fields.empty?\n\tend",
"def acceptable? *args\n true\n end",
"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",
"def valid?\n errors, options = {}, {}\n @results = {:errors => errors, :options => options}\n \n remaining_args = args.dup\n valid_options.each do |long_name, details|\n short_name, default = *details\n key = long_name.gsub(/^--/, '').gsub('-', '_').to_sym\n index = remaining_args.index(long_name) ||\n remaining_args.index(short_name)\n if index\n remaining_args.delete_at index\n if self.class.option?(remaining_args[index])\n options[key] = true\n else\n options[key] = remaining_args.delete_at(index)\n end\n else\n options[key] = default\n end\n end\n remaining_args.each do |arg|\n arg_type = self.class.option?(arg) ? 'option' : 'argument'\n errors[arg] = \"is not a valid #{arg_type}\"\n end\n \n errors.empty?\n end",
"def true?(obj)\n booleans = { \"true\"=>true, \"1\"=>true, true=>true, 1=>true,\n \"false\"=>false, \"0\"=>false, false=>false, 0=>false}\n booleans.has_key?(obj) ? booleans[obj] : true\nend",
"def has_argument?(key)\n self.arguments.set?(key)\n end",
"def has_argument?(key)\n self.arguments.set?(key)\n end",
"def option?(key)\n key = key&.to_sym\n @value.key?(key) || option_method(key).present?\n end",
"def prepared_arg?(k)\n true\n end",
"def tell_the_truth(options={})\n if options[:profession] == :lawyer\n 'i cant'\n else\n true\n end\nend",
"def value\n true\n end",
"def options?\n\t\t\tif parameters = self.parameters\n\t\t\t\ttype, name = parameters.last\n\t\t\t\t\n\t\t\t\treturn type == :keyrest || type == :keyreq || type == :key\n\t\t\tend\n\t\tend",
"def is_value?\n true\n end",
"def in_kwarg; end",
"def member?(value, option)\n if option.is_a?(Array)\n options = {:items => option}\n else\n options = option\n end \n return true if value.nil? and not required(options) \n return options[:items].member?(value)\n end",
"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",
"def boolean(key, options = {})\n before_all(key, options)\n match?(key, /(true)|(false)/) ? store(key, ->(item){to_boolean(item)}, options) : raise_type_error(key, \"Numeric\")\n end",
"def has_options?(opts = {})\n opts.each do |key, value|\n this_value = self[key.to_sym]\n return false if (this_value != value)\n end\n return true\n end",
"def single_value?\n return false\n end",
"def param_present?(obj)\n @config_params.value?(obj)\n end",
"def process(key, options = {})\n before_all(key, options)\n match?(key, /(true)|(false)/) ? store(key, ->(item){to_boolean(item)}, options) : raise_type_error(key, \"Numeric\")\n end",
"def acceptable_values?\n options_s_keys = options.keys.map(&:to_s)\n\n if @attributes[:multiple] && resolver.params[name].respond_to?(:map)\n (resolver.params[name].map(&:to_s) - options_s_keys).empty?\n else\n options_s_keys.include?(resolver.params[name].to_s)\n end\n end",
"def has_value(name, options={})\n Valuable::Utils.check_options_validity(self.class.name, name, options)\n\n options[:extend] = [options[:extend]].flatten.compact\n options[:allow_blank] = options.has_key?(:allow_blank) ? options[:allow_blank] : true\n\n name = name.to_sym\n _attributes[name] = options \n \n create_accessor_for(name, options[:extend])\n\n create_question_for(name) if options[:klass] == :boolean\n create_negative_question_for(name, options[:negative]) if options[:klass] == :boolean && options[:negative]\n \n create_setter_for(name, allow_blank: options[:allow_blank] )\n\n sudo_alias options[:alias], name if options[:alias]\n sudo_alias \"#{options[:alias]}=\", \"#{name}=\" if options[:alias]\n end",
"def value? value\n include? value\n end",
"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",
"def prepared_arg?(k)\n true\n end",
"def parse_equal(obj, opt, argv)\n if md = /^[-]*(.*?)=(.*?)$/.match(opt)\n x, v = md[1], md[2]\n else\n raise ArgumentError, \"#{x}\"\n end\n # TODO: to_b if 'true' or 'false' ?\n #if obj.respond_to?(\"#{x}=\")\n obj.send(\"#{x}=\", v)\n #else\n # obj.option_missing(x, v)\n #end\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def same_options?(opts)\n opts.hash == options.hash\n end",
"def arguments_valid?\n ret = false\n ret = true unless (@options.action == nil)\n end",
"def args?\n\t\treturn !@form.empty?\n\tend",
"def is_bool(value) #method\n if value == 'verdadero' || value == 'falso'\n true\n else\n false\n end\n end",
"def true?(obj)\n [\"true\",\"1\"].include? obj.to_s.downcase\n end",
"def hasArg?(arg); argSet.member?(arg) end",
"def can_have_value?()\n return true\n end",
"def can_have_value?\n return true\n end",
"def option(*args, &block)\n #p [:option, args, :optional, optional?]\n key_values, args = args.partition{ |x| x.kind_of?(Hash)}\n key_values = key_values.inject({ }){ |hash, kv| hash.merge(kv)}\n\n errors = []\n\n # handle optional/required flipflop\n if optional?\n required = { :default => nil }\n if key_values.delete(:required)\n if key_values.key?(:optional)\n errors << \"Can't specify both :required and :optional\"\n end\n if key_values.key?(:default)\n errors << \"Can't specify both :required and :default\"\n end\n required = { }\n elsif key_values.delete(:optional) && !key_values.key?(:default)\n required = { :default => nil }\n end\n else\n key_values.delete(:required)\n required = { }\n end\n args = [{ :using => Option }.merge(required).merge(key_values), *args]\n da = has(*args, &block)\n if errors.size > 0\n raise ArgumentError, \"#{da.name}: #{errors.join(', ')}\", [caller[-1]]\n end\n da.instance_eval do\n #p [:checking_values, values, values.class]\n if da.values.kind_of?(Range)\n must \"be in range #{da.values}\" do |s|\n da.values.include?(s)\n end\n elsif da.values.respond_to?(:size) && da.values.size > 0\n must \"be one of #{da.values.join(', ')}\" do |s|\n da.values.include?(s)\n end\n end\n if da.match\n must \"match pattern #{da.match.inspect}\" do |s|\n #p [:matching, s, da.match.inspect]\n s.to_s =~ da.match\n end\n end\n end\n da\n end",
"def options?\n false\n end",
"def options?\n false\n end",
"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",
"def matches?(value, context); end",
"def func1 val #missing the symbols for arguments\r\n if val = 1 #missing 1 equal symbol.\r\n return true\r\n else\r\n return false\r\n end\r\nend",
"def has_options?\n properties.include?(\"has_options\")\n end",
"def method_missing(*_args)\n true\n end",
"def value?(key)\n !!value(key) || @object.value?(key)\n end",
"def aws_obj_exists?(opts)\n opts[:obj].exists?\n end",
"def accept_more_values?(option=nil)\n if option.class == Hash && !block_given?\n return @j_del.java_method(:acceptMoreValues, [Java::IoVertxCoreCli::Option.java_class]).call(Java::IoVertxCoreCli::Option.new(::Vertx::Util::Utils.to_json_object(option)))\n end\n raise ArgumentError, \"Invalid arguments when calling accept_more_values?(option)\"\n end",
"def arguments_valid?\n true \n # to do\n end",
"def capable?(key); end",
"def use?(opts)\n !(opts.keys & @takes).empty?\n end",
"def boolean?\n !@arg[:boolValue].nil?\n end",
"def arguments_valid?\n # TO DO - implement your real logic here\n valid = false\n case @arguments[0]\n when 'ls' then\n #one argument or none but if one, ais url one!\n bucketName = @arguments[@arguments.length-1]\n valid = true if (bucketName == 'ls' || bucketName[0,6] == @storePrefix )\n when 'cp' then\n #source and dest must be their and one local and not the other! if directory need -L options\n if (@arguments.length >= 3) then\n source = @arguments[@arguments.length-2]\n dest = @arguments[@arguments.length-1]\n valid =true if(source[0,6] == @storePrefix && dest[0,6] != @storePrefix)\n valid =true if(source[0,6] != @storePrefix && dest[0,6] == @storePrefix && (( @options.local && File.directory?(source)) || (File.file? source )))\n end\n when 'mb' then\n #bucket url without object so just ais://bucket and not ais://bucket/object\n bucketName = @arguments[@arguments.length-1]\n valid = true if (bucketName[0,6] == @storePrefix && !bucketName[6..-1].include?('/'))\n when 'rm' then\n #work for bucket or object\n objectName = @arguments[@arguments.length-1]\n valid = true if (objectName[0,6] == @storePrefix)\n when 'metadata','protocol','md' then\n #same constraint, must be an object url\n objectName = @arguments[@arguments.length-1]\n valid = true if (objectName[0,6] == @storePrefix && objectName[6..-1].include?('/'))\n end\n valid\n end",
"def test_Hash_InstanceMethods_has_value?\n\t\th = {'a'=>100, 'b'=>200}\n\t\tassert_equal(true, h.has_value?(100))\n\t\tassert_equal(false, h.has_value?(999))\n\tend",
"def allow?(*args)\n true\n end",
"def has_value?\n true\n end",
"def specified?\n !options[:model].blank?\n end",
"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",
"def check(value)\n # We have to invert the values.\n if value == :true\n false\n else\n true\n end\n end",
"def validate_opts\n if @options[:file].nil?\n puts \"Pass me some filename (-f FILE)\"\n return false\n elsif !File.exists?(@options[:file])\n puts \"File: #{@options[:file]} does not exist\"\n return false\n elsif !File.readable?(@options[:file])\n puts \"File: #{@options[:file]} is not readable\"\n return false\n elsif File.directory?(@options[:file])\n puts \"#{@options[:file]} is a directory!\"\n return false\n elsif File.zero?(@options[:file])\n puts \"File: #{@options[:file]} is empty\"\n return false\n end\n\n if @options[:mode].nil?\n puts \"Pass me indexing mode (-m index|noindex )\"\n return false\n end\n return true\n end",
"def run(value)\n null_validator = NullValidator.new\n\n # NOTE: OpenActive is more strict than plain json-ld, so no coercion into arrays\n\n # Check if value is an array\n return true if item_validator.run(value) == true\n\n return false if ArrayValidator.new.run(value) == false\n\n value.each do |item|\n # If any of the provided items is not null nor an instance of the provided class name\n return false if null_validator.run(item) == false && item_validator.run(item) == false\n end\n true\n end",
"def passes?(obj)\n method_key = valid_criteria[attribute_name][\"operators\"] rescue nil\n if method_key.nil?\n return false unless DEFAULT_EVAL_METHODS.include?(eval_method)\n t_eval_method = (eval_method == \"match\" || eval_method == \"include?\") ? \".#{eval_method}\" : \" #{eval_method}\"\n eval_string = \"obj.instance_eval(\\\"#{attribute_name}\\\")#{t_eval_method} \\\"#{value.to_s}\\\"\"\n # puts eval_string\n eval eval_string, binding\n else\n eval_string = method_key[eval_method]\n eval_string.gsub!(\"$1\", \"obj\")\n eval_string.gsub!(\"$2\", (values == \"boolean\" ? value : \"\\\"#{value}\\\"\"))\n # puts eval_string\n eval eval_string, binding\n end\n end"
] | [
"0.6952393",
"0.68071306",
"0.6744828",
"0.66615355",
"0.6656824",
"0.6573961",
"0.6570582",
"0.6554166",
"0.65291166",
"0.65291166",
"0.63818747",
"0.6361414",
"0.62702626",
"0.62435734",
"0.6240289",
"0.6206032",
"0.6175554",
"0.6175176",
"0.60971296",
"0.60859525",
"0.60708356",
"0.60619",
"0.60165524",
"0.60143983",
"0.6010666",
"0.6009536",
"0.6008811",
"0.59904027",
"0.5989824",
"0.5989344",
"0.5971795",
"0.59687275",
"0.5960954",
"0.5959481",
"0.5958058",
"0.59201384",
"0.5914322",
"0.5906019",
"0.5906019",
"0.58977693",
"0.58881044",
"0.5884601",
"0.58773196",
"0.5876925",
"0.5862411",
"0.5858927",
"0.58585566",
"0.5854337",
"0.5854272",
"0.5853483",
"0.5847305",
"0.5844546",
"0.583153",
"0.5828234",
"0.5824115",
"0.58115524",
"0.5796272",
"0.5773759",
"0.5771383",
"0.57679504",
"0.57679504",
"0.57679504",
"0.57679504",
"0.57679504",
"0.57679504",
"0.57679504",
"0.57679504",
"0.57679504",
"0.57679504",
"0.576686",
"0.5765676",
"0.5759159",
"0.5759097",
"0.5753665",
"0.57534385",
"0.5752008",
"0.57381266",
"0.57313603",
"0.57313603",
"0.5729701",
"0.5721367",
"0.57164097",
"0.57125455",
"0.570621",
"0.5705393",
"0.5696006",
"0.56895703",
"0.56883323",
"0.56879914",
"0.5684703",
"0.56794715",
"0.56781965",
"0.5675528",
"0.56735647",
"0.5668681",
"0.56651044",
"0.56628525",
"0.5661404",
"0.56559885",
"0.5654887",
"0.5653381"
] | 0.0 | -1 |
args 1. Object value 2. Hash option return Boolean | def member?(value, option)
if option.is_a?(Array)
options = {:items => option}
else
options = option
end
return true if value.nil? and not required(options)
return options[:items].member?(value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash_in_argument_hash\n argument_hash = {} if argument_hash.nil?\n return true\n end",
"def hash_or_parameter?(args)\n args.is_a?(Hash) || args.respond_to?(:to_unsafe_h)\n end",
"def include?(arg_)\n _get_objdata(arg_) ? true : false\n end",
"def value?(value) true end",
"def value?(value); end",
"def value?(value); end",
"def vash_valid_key?(x); self.class.option_name?(x); end",
"def test_Hash_InstanceMethods_has_value?\n\t\th = {'a'=>100, 'b'=>200}\n\t\tassert_equal(true, h.has_value?(100))\n\t\tassert_equal(false, h.has_value?(999))\n\tend",
"def eql?(arg)\n self.hash == arg.hash\n end",
"def vash_valid_value?(x); self.class.option_value?(x); end",
"def has_value?(value); end",
"def has_value?(p0) end",
"def test_Hash_InstanceMethods_value?\n\t\t# TODO, will be add some testcases\n\t\tassert_equal(true, true)\n\tend",
"def value?(p0) end",
"def true?(obj)\n booleans = { \"true\"=>true, \"1\"=>true, true=>true, 1=>true,\n \"false\"=>false, \"0\"=>false, false=>false, 0=>false}\n booleans.has_key?(obj) ? booleans[obj] : true\nend",
"def include?(o)\n @hash.has_value?(o)\n end",
"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",
"def allows?(hash={})\n apply(hash)[0]\n end",
"def has_value? value; value? value; end",
"def include?(o)\n @hash[o]\n end",
"def method_missing(sym, *args)\n if sym.to_s =~ /\\A(.*)\\?\\z/ && options.include?($1.to_sym) && (options[$1.to_sym].is_a?(TrueClass) || options[$1.to_sym].is_a?(FalseClass))\n options[$1.to_sym]\n elsif sym.to_s =~ /\\A(.*)\\z/ && options.include?($1.to_sym) \n options[$1.to_sym]\n else\n false\n end\n end",
"def match?(*args)\n props = Hash === args.last ? args.pop : {}\n\n if target = args.shift\n props[:command] = target.to_s\n props[:feature] = target.to_s\n end\n\n if props[:profile]\n props[:profile] = (props[:profile] || :default).to_s\n end\n\n props.each do |k,v|\n pv = property(k)\n return false unless (pv.nil? || pv == v)\n end\n\n return true\n end",
"def healthy?() raw && raw.is_a?(Hash) end",
"def capable?(key); end",
"def includes? hash\n hash.each_pair do |key, value|\n return false unless send(\"#{key}\") == value\n end\n true\n end",
"def options?(*args)\r\n val = false\r\n options.each do |key, value|\r\n next unless args.include?(key.to_sym)\r\n val = options[key].nil? ? true : options[key]\r\n break\r\n end\r\n val\r\n end",
"def passed?(object)\n ! @seen_values.include?(object)\n end",
"def hashlike?\n @target.respond_to?(:[]) && @target.respond_to?(:each) && !@target.is_a?(String) && !@target.is_a?(Symbol)\n end",
"def matches(hash)\n matched = true\n hash.each do |k, v|\n if matched #only continue loop if we continue to match properties\n case k.to_s\n when \"cpu\"\n @cpu == v ? matched = true : matched = false\n when \"display\"\n @display_size == v ? matched = true : matched = false\n when \"number_cores\"\n @number_cores == v ? matched = true : matched = false\n end #case\n end #if matched\n end #each\n matched\n end",
"def contains?(arg)\n case arg\n when Symbol\n !!lookup_name(arg.id2name)\n when String\n !!lookup_name(arg)\n when Integer\n !!lookup_id(arg)\n when self\n true\n else\n false\n end\n end",
"def my_all?(arg = nil)\n resp = true\n return true if to_a.nil? || (self.class.to_s == 'Hash' && !block_given?)\n\n if block_given?\n to_a.my_each { |val| resp = false unless yield(val) }\n elsif arg.nil?\n to_a.my_each { |val| resp = false unless val }\n else\n case arg.class.to_s\n when 'Regexp'\n to_a.my_each { |val| resp = false unless arg.match? val.to_s }\n when 'Class'\n to_a.my_each { |val| resp = false unless val.is_a? arg }\n else\n to_a.my_each { |val| return resp = false unless val == arg }\n end\n end\n resp\n end",
"def true(_argvs)\n return nil\n end",
"def func1 val #missing the symbols for arguments\r\n if val = 1 #missing 1 equal symbol.\r\n return true\r\n else\r\n return false\r\n end\r\nend",
"def has_key?(p0) end",
"def include?(arg)\n case arg\n when Symbol\n !lookup_name(arg.id2name).nil?\n when String\n !lookup_name(arg).nil?\n when Integer\n !lookup_id(arg).nil?\n when self\n possible_match = lookup_id(arg.id)\n !possible_match.nil? && possible_match == arg\n else\n false\n end\n end",
"def typecast_value_boolean(opts={});true;end",
"def single_value?\n return false\n end",
"def include?(obj)\n @data.key?(obj)\n end",
"def key?(key); end",
"def key?(key); end",
"def key?(key); end",
"def key?(key); end",
"def key?(key); end",
"def key?(key); end",
"def set?\n\t\t\tbegin\n\n\t\t\t\tvalue = @lookup.inject(@obj_with_keys) { |deep_obj, this_key|\n\t\t\t\t\t# Has to be an object that can have keys\n\t\t\t\t\treturn false unless deep_obj.respond_to?(:[])\n\n\t\t\t\t\tif deep_obj.respond_to?(:fetch)\n\t\t\t\t\t\t# Hash, Array and Struct all respond to fetch\n\t\t\t\t\t\t# We've monkeypatched fetch to Struct\n\t\t\t\t\t\tif deep_obj.is_a?(Array)\n\t\t\t\t\t\t\t# Check array separately as must fetch numeric key\n\t\t\t\t\t\t\treturn false unless Keys.index?(this_key)\n\t\t\t\t\t\tend\n\t\t\t\t\t\tnext_obj = deep_obj.fetch(this_key, Keys::MISSING)\n\t\t\t\t\telse\n\t\t\t\t\t\treturn false\n\t\t\t\t\tend\n\n\t\t\t\t\t# No need to go any further\n\t\t\t\t\treturn false if Keys::MISSING == next_obj\n\n\t\t\t\t\t# Reinject value to next loop\n\t\t\t\t\tnext_obj\n\t\t\t\t}\n\n\t\t\trescue\n\t\t\t\t# If fetch throws a wobbly at any point, fail gracefully\n\t\t\t\treturn false\n\t\t\tend\n\t\t\t# No errors - yield the value if desired\n\t\t\tif block_given?\n\t\t\t\tyield(value)\n\t\t\tend\n\t\t\t# Return true\n\t\t\treturn true\n\t\tend",
"def test_Hash_InstanceMethods_include?\n\t\th = {'a'=>100, 'b'=>200}\n\t\tassert_equal(true, h.include?('a'))\n\t\tassert_equal(true, h.include?('b'))\n\t\tassert_equal(false, h.include?('c'))\n\tend",
"def include?(o)\n @hash.include?(o)\n end",
"def prepared_arg?(k)\n true\n end",
"def check(hash)\n # not implemented\n end",
"def key?(*) end",
"def single_value?\n self[:value] ||= {}\n is_check_box_type?(/^single$/)\n end",
"def should_eval_to(pass_value)\n @bucket.all? == pass_value\n end",
"def value?(key)\n !!value(key) || @object.value?(key)\n end",
"def valid?(args)\n raise TypeError, \"#{self.class.name} must be initialised with a hash\" if not args.kind_of?(Hash)\n args.each { |k,v|\n case k\n when :date_start, :date_end\n raise TypeError, \"Expected Time type\" unless v.kind_of? Time\n when :category, :entity, :description\n raise TypeError, \"Expected a string\" unless v.kind_of? String\n when :quantity, :unit_cost, :sub_total, :gst, :total\n raise TypeError, \"Expected a number\" unless v.kind_of? Numeric\n end\n }\n return true\n end",
"def value? value\n include? value\n end",
"def invite_by_entry?\n invitation_params.is_a?(Hash)\n end",
"def can_have_value?()\n return true\n end",
"def params_has_key *args\n args.each do |key|\n unless params.has_key? key.to_s\n return false\n end\n end\n return true\nend",
"def msg_not_boolean(parent, key, value); end",
"def true?(obj)\n [\"true\",\"1\"].include? obj.to_s.downcase\n end",
"def in_kwarg; end",
"def value\n true\n end",
"def is_value?\n true\n end",
"def has_key?(key); end",
"def has_key?(key); end",
"def can_have_value?\n return true\n end",
"def check_call call\n args = process call[3]\n if args.length <= 1 #empty new()\n false\n elsif hash? args[1]\n #Still should probably check contents of hash\n false\n else\n true\n end\n end",
"def hasArg?(arg); argSet.member?(arg) end",
"def include?(obj)\n self.each{|*val|\n return true if val.__svalue == obj\n }\n false\n end",
"def populated_hash?(obj)\n obj.is_a?(Hash) && !obj.empty?\n end",
"def has_argument?(key)\n self.arguments.set?(key)\n end",
"def has_argument?(key)\n self.arguments.set?(key)\n end",
"def param_equals?(key, value)\n\t\tret = @myparams.include?(key) && @myparams[key] == value\n\t\t#puts \"#{controller_name}.#{__method__}:#{key}.#{value}=#{ret}\"\n\t\tret\n\tend",
"def param_equals?(key, value)\n\t\tret = @myparams.include?(key) && @myparams[key] == value\n\t\t#puts \"#{controller_name}.#{__method__}:#{key}.#{value}=#{ret}\"\n\t\tret\n\tend",
"def method_missing(name, *args, &block)\n if name.to_s =~ /\\?$/ && args.empty?\n if @field_variants.any? { |variant| \"#{variant.attribute}?\" == name.to_s }\n 'true'\n else\n 'false'\n end\n else\n super(name.to_sym, *args, &block)\n end\n end",
"def args?\n\t\treturn !self.fields.empty?\n\tend",
"def matches?(value, context); end",
"def has_key?(*args)\n @params.has_key?(*args)\n end",
"def has_key?(*args)\n @params.has_key?(*args)\n end",
"def valid_hash?(h)\n self.class.valid_hash?(h)\n end",
"def prepared_arg?(k)\n true\n end",
"def include?(arg)\n if arg.kind_of?(Hash)\n rdns.include?(arg)\n else\n super\n end\n end",
"def run(value)\n null_validator = NullValidator.new\n\n # NOTE: OpenActive is more strict than plain json-ld, so no coercion into arrays\n\n # Check if value is an array\n return true if item_validator.run(value) == true\n\n return false if ArrayValidator.new.run(value) == false\n\n value.each do |item|\n # If any of the provided items is not null nor an instance of the provided class name\n return false if null_validator.run(item) == false && item_validator.run(item) == false\n end\n true\n end",
"def is_key_entry(aliaz)\n\n end",
"def has_value?\n true\n end",
"def is_final?(v)\n@final[v]\nend",
"def param_present?(obj)\n @config_params.value?(obj)\n end",
"def void_true(*args)\n return true\n end",
"def test? value\n begin\n @pairs.all? { |k, v| v === value[k] }\n rescue\n false\n end\n end",
"def and_h\n end",
"def match?(options)\n options.all? { |key, value| self[key] == value }\n end",
"def key?(key, is: ANY)\n v = wrap(is)\n proc do |o|\n o.is_a? Hash and (o.key?(key) ? v.call(o[key]) : false)\n end\n end",
"def multi_value?\n self[:value] ||= {}\n is_check_box_type?(/^multi$/)\n end",
"def response?(params); end",
"def include?(o)\n return false unless valid_member?(o)\n @val[o] != 0\n end",
"def test?\n params['USER2'] == 'true'\n end",
"def passes?(obj)\n method_key = valid_criteria[attribute_name][\"operators\"] rescue nil\n if method_key.nil?\n return false unless DEFAULT_EVAL_METHODS.include?(eval_method)\n t_eval_method = (eval_method == \"match\" || eval_method == \"include?\") ? \".#{eval_method}\" : \" #{eval_method}\"\n eval_string = \"obj.instance_eval(\\\"#{attribute_name}\\\")#{t_eval_method} \\\"#{value.to_s}\\\"\"\n # puts eval_string\n eval eval_string, binding\n else\n eval_string = method_key[eval_method]\n eval_string.gsub!(\"$1\", \"obj\")\n eval_string.gsub!(\"$2\", (values == \"boolean\" ? value : \"\\\"#{value}\\\"\"))\n # puts eval_string\n eval eval_string, binding\n end\n end",
"def eql?(obj)\n build\n obj.build\n obj.all_info_matches?(@info)\n rescue StandardError\n false\n end",
"def options_has_value_and_display?\n options.values.all? { |option|\n option.is_a?(Hash) && option.has_key?(\"value\")\n } && options.values.all? { |option|\n option.is_a?(Hash) && option.has_key?(\"display\")\n }\n end",
"def test_Hash_InstanceMethods_hash_key?\n\t\th = {'a'=>100, 'b'=>200}\n\t\tassert_equal(true, h.has_key?('a'))\n\t\tassert_equal(false, h.has_key?('z'))\n\tend",
"def in?(key)\n return true if get(key)\n false\n end"
] | [
"0.68881786",
"0.66914606",
"0.66439974",
"0.66135806",
"0.64289385",
"0.64289385",
"0.64114344",
"0.63166",
"0.631603",
"0.62921715",
"0.6245153",
"0.6207265",
"0.6166599",
"0.61302173",
"0.6124946",
"0.6089859",
"0.60478973",
"0.60324436",
"0.60276306",
"0.60270244",
"0.6020875",
"0.6020418",
"0.6005087",
"0.60010636",
"0.59845513",
"0.5975443",
"0.5973524",
"0.5968157",
"0.59666276",
"0.5961385",
"0.59146327",
"0.59140754",
"0.5909084",
"0.59053016",
"0.59032923",
"0.58928275",
"0.58641285",
"0.5863777",
"0.5858279",
"0.5858279",
"0.5858279",
"0.5858279",
"0.5858279",
"0.5858279",
"0.5845516",
"0.5839637",
"0.5824182",
"0.5819146",
"0.58041424",
"0.5796512",
"0.5793672",
"0.57804334",
"0.57764596",
"0.5746708",
"0.57450813",
"0.5737369",
"0.5724565",
"0.57165504",
"0.57111645",
"0.57101464",
"0.5707943",
"0.5703982",
"0.56990564",
"0.5690741",
"0.5690741",
"0.5688599",
"0.5687653",
"0.56853366",
"0.568152",
"0.5680538",
"0.56781936",
"0.56781936",
"0.56780505",
"0.56780505",
"0.56756836",
"0.56624544",
"0.56555974",
"0.5655269",
"0.5655269",
"0.5649237",
"0.5647894",
"0.56443673",
"0.5640204",
"0.56349224",
"0.5610258",
"0.5605024",
"0.56026995",
"0.5592524",
"0.5578837",
"0.55727446",
"0.5566303",
"0.5563735",
"0.5553206",
"0.55501574",
"0.55441695",
"0.5544098",
"0.5543902",
"0.5536921",
"0.55356246",
"0.55346286",
"0.5534029"
] | 0.0 | -1 |
args 1. Object value 2. Hash option return Boolean | def regexp?(value, option = nil)
if option.is_a?(Regexp)
options = {:regexp => option}
else
options = option
end
return true if value.nil? and not required(options)
return false unless value.is_a?(String)
raise TypeError.new("option :regexp is not Regexp.") unless options[:regexp].is_a?(Regexp)
return options[:regexp].match(value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash_in_argument_hash\n argument_hash = {} if argument_hash.nil?\n return true\n end",
"def hash_or_parameter?(args)\n args.is_a?(Hash) || args.respond_to?(:to_unsafe_h)\n end",
"def include?(arg_)\n _get_objdata(arg_) ? true : false\n end",
"def value?(value) true end",
"def value?(value); end",
"def value?(value); end",
"def vash_valid_key?(x); self.class.option_name?(x); end",
"def test_Hash_InstanceMethods_has_value?\n\t\th = {'a'=>100, 'b'=>200}\n\t\tassert_equal(true, h.has_value?(100))\n\t\tassert_equal(false, h.has_value?(999))\n\tend",
"def eql?(arg)\n self.hash == arg.hash\n end",
"def vash_valid_value?(x); self.class.option_value?(x); end",
"def has_value?(value); end",
"def has_value?(p0) end",
"def test_Hash_InstanceMethods_value?\n\t\t# TODO, will be add some testcases\n\t\tassert_equal(true, true)\n\tend",
"def value?(p0) end",
"def true?(obj)\n booleans = { \"true\"=>true, \"1\"=>true, true=>true, 1=>true,\n \"false\"=>false, \"0\"=>false, false=>false, 0=>false}\n booleans.has_key?(obj) ? booleans[obj] : true\nend",
"def include?(o)\n @hash.has_value?(o)\n end",
"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",
"def allows?(hash={})\n apply(hash)[0]\n end",
"def has_value? value; value? value; end",
"def include?(o)\n @hash[o]\n end",
"def method_missing(sym, *args)\n if sym.to_s =~ /\\A(.*)\\?\\z/ && options.include?($1.to_sym) && (options[$1.to_sym].is_a?(TrueClass) || options[$1.to_sym].is_a?(FalseClass))\n options[$1.to_sym]\n elsif sym.to_s =~ /\\A(.*)\\z/ && options.include?($1.to_sym) \n options[$1.to_sym]\n else\n false\n end\n end",
"def match?(*args)\n props = Hash === args.last ? args.pop : {}\n\n if target = args.shift\n props[:command] = target.to_s\n props[:feature] = target.to_s\n end\n\n if props[:profile]\n props[:profile] = (props[:profile] || :default).to_s\n end\n\n props.each do |k,v|\n pv = property(k)\n return false unless (pv.nil? || pv == v)\n end\n\n return true\n end",
"def healthy?() raw && raw.is_a?(Hash) end",
"def capable?(key); end",
"def includes? hash\n hash.each_pair do |key, value|\n return false unless send(\"#{key}\") == value\n end\n true\n end",
"def options?(*args)\r\n val = false\r\n options.each do |key, value|\r\n next unless args.include?(key.to_sym)\r\n val = options[key].nil? ? true : options[key]\r\n break\r\n end\r\n val\r\n end",
"def passed?(object)\n ! @seen_values.include?(object)\n end",
"def hashlike?\n @target.respond_to?(:[]) && @target.respond_to?(:each) && !@target.is_a?(String) && !@target.is_a?(Symbol)\n end",
"def matches(hash)\n matched = true\n hash.each do |k, v|\n if matched #only continue loop if we continue to match properties\n case k.to_s\n when \"cpu\"\n @cpu == v ? matched = true : matched = false\n when \"display\"\n @display_size == v ? matched = true : matched = false\n when \"number_cores\"\n @number_cores == v ? matched = true : matched = false\n end #case\n end #if matched\n end #each\n matched\n end",
"def contains?(arg)\n case arg\n when Symbol\n !!lookup_name(arg.id2name)\n when String\n !!lookup_name(arg)\n when Integer\n !!lookup_id(arg)\n when self\n true\n else\n false\n end\n end",
"def my_all?(arg = nil)\n resp = true\n return true if to_a.nil? || (self.class.to_s == 'Hash' && !block_given?)\n\n if block_given?\n to_a.my_each { |val| resp = false unless yield(val) }\n elsif arg.nil?\n to_a.my_each { |val| resp = false unless val }\n else\n case arg.class.to_s\n when 'Regexp'\n to_a.my_each { |val| resp = false unless arg.match? val.to_s }\n when 'Class'\n to_a.my_each { |val| resp = false unless val.is_a? arg }\n else\n to_a.my_each { |val| return resp = false unless val == arg }\n end\n end\n resp\n end",
"def true(_argvs)\n return nil\n end",
"def func1 val #missing the symbols for arguments\r\n if val = 1 #missing 1 equal symbol.\r\n return true\r\n else\r\n return false\r\n end\r\nend",
"def has_key?(p0) end",
"def include?(arg)\n case arg\n when Symbol\n !lookup_name(arg.id2name).nil?\n when String\n !lookup_name(arg).nil?\n when Integer\n !lookup_id(arg).nil?\n when self\n possible_match = lookup_id(arg.id)\n !possible_match.nil? && possible_match == arg\n else\n false\n end\n end",
"def typecast_value_boolean(opts={});true;end",
"def single_value?\n return false\n end",
"def include?(obj)\n @data.key?(obj)\n end",
"def key?(key); end",
"def key?(key); end",
"def key?(key); end",
"def key?(key); end",
"def key?(key); end",
"def key?(key); end",
"def set?\n\t\t\tbegin\n\n\t\t\t\tvalue = @lookup.inject(@obj_with_keys) { |deep_obj, this_key|\n\t\t\t\t\t# Has to be an object that can have keys\n\t\t\t\t\treturn false unless deep_obj.respond_to?(:[])\n\n\t\t\t\t\tif deep_obj.respond_to?(:fetch)\n\t\t\t\t\t\t# Hash, Array and Struct all respond to fetch\n\t\t\t\t\t\t# We've monkeypatched fetch to Struct\n\t\t\t\t\t\tif deep_obj.is_a?(Array)\n\t\t\t\t\t\t\t# Check array separately as must fetch numeric key\n\t\t\t\t\t\t\treturn false unless Keys.index?(this_key)\n\t\t\t\t\t\tend\n\t\t\t\t\t\tnext_obj = deep_obj.fetch(this_key, Keys::MISSING)\n\t\t\t\t\telse\n\t\t\t\t\t\treturn false\n\t\t\t\t\tend\n\n\t\t\t\t\t# No need to go any further\n\t\t\t\t\treturn false if Keys::MISSING == next_obj\n\n\t\t\t\t\t# Reinject value to next loop\n\t\t\t\t\tnext_obj\n\t\t\t\t}\n\n\t\t\trescue\n\t\t\t\t# If fetch throws a wobbly at any point, fail gracefully\n\t\t\t\treturn false\n\t\t\tend\n\t\t\t# No errors - yield the value if desired\n\t\t\tif block_given?\n\t\t\t\tyield(value)\n\t\t\tend\n\t\t\t# Return true\n\t\t\treturn true\n\t\tend",
"def test_Hash_InstanceMethods_include?\n\t\th = {'a'=>100, 'b'=>200}\n\t\tassert_equal(true, h.include?('a'))\n\t\tassert_equal(true, h.include?('b'))\n\t\tassert_equal(false, h.include?('c'))\n\tend",
"def include?(o)\n @hash.include?(o)\n end",
"def prepared_arg?(k)\n true\n end",
"def check(hash)\n # not implemented\n end",
"def key?(*) end",
"def single_value?\n self[:value] ||= {}\n is_check_box_type?(/^single$/)\n end",
"def should_eval_to(pass_value)\n @bucket.all? == pass_value\n end",
"def value?(key)\n !!value(key) || @object.value?(key)\n end",
"def valid?(args)\n raise TypeError, \"#{self.class.name} must be initialised with a hash\" if not args.kind_of?(Hash)\n args.each { |k,v|\n case k\n when :date_start, :date_end\n raise TypeError, \"Expected Time type\" unless v.kind_of? Time\n when :category, :entity, :description\n raise TypeError, \"Expected a string\" unless v.kind_of? String\n when :quantity, :unit_cost, :sub_total, :gst, :total\n raise TypeError, \"Expected a number\" unless v.kind_of? Numeric\n end\n }\n return true\n end",
"def value? value\n include? value\n end",
"def invite_by_entry?\n invitation_params.is_a?(Hash)\n end",
"def can_have_value?()\n return true\n end",
"def params_has_key *args\n args.each do |key|\n unless params.has_key? key.to_s\n return false\n end\n end\n return true\nend",
"def msg_not_boolean(parent, key, value); end",
"def true?(obj)\n [\"true\",\"1\"].include? obj.to_s.downcase\n end",
"def in_kwarg; end",
"def value\n true\n end",
"def is_value?\n true\n end",
"def has_key?(key); end",
"def has_key?(key); end",
"def can_have_value?\n return true\n end",
"def check_call call\n args = process call[3]\n if args.length <= 1 #empty new()\n false\n elsif hash? args[1]\n #Still should probably check contents of hash\n false\n else\n true\n end\n end",
"def hasArg?(arg); argSet.member?(arg) end",
"def include?(obj)\n self.each{|*val|\n return true if val.__svalue == obj\n }\n false\n end",
"def populated_hash?(obj)\n obj.is_a?(Hash) && !obj.empty?\n end",
"def has_argument?(key)\n self.arguments.set?(key)\n end",
"def has_argument?(key)\n self.arguments.set?(key)\n end",
"def param_equals?(key, value)\n\t\tret = @myparams.include?(key) && @myparams[key] == value\n\t\t#puts \"#{controller_name}.#{__method__}:#{key}.#{value}=#{ret}\"\n\t\tret\n\tend",
"def param_equals?(key, value)\n\t\tret = @myparams.include?(key) && @myparams[key] == value\n\t\t#puts \"#{controller_name}.#{__method__}:#{key}.#{value}=#{ret}\"\n\t\tret\n\tend",
"def method_missing(name, *args, &block)\n if name.to_s =~ /\\?$/ && args.empty?\n if @field_variants.any? { |variant| \"#{variant.attribute}?\" == name.to_s }\n 'true'\n else\n 'false'\n end\n else\n super(name.to_sym, *args, &block)\n end\n end",
"def args?\n\t\treturn !self.fields.empty?\n\tend",
"def matches?(value, context); end",
"def has_key?(*args)\n @params.has_key?(*args)\n end",
"def has_key?(*args)\n @params.has_key?(*args)\n end",
"def valid_hash?(h)\n self.class.valid_hash?(h)\n end",
"def prepared_arg?(k)\n true\n end",
"def include?(arg)\n if arg.kind_of?(Hash)\n rdns.include?(arg)\n else\n super\n end\n end",
"def run(value)\n null_validator = NullValidator.new\n\n # NOTE: OpenActive is more strict than plain json-ld, so no coercion into arrays\n\n # Check if value is an array\n return true if item_validator.run(value) == true\n\n return false if ArrayValidator.new.run(value) == false\n\n value.each do |item|\n # If any of the provided items is not null nor an instance of the provided class name\n return false if null_validator.run(item) == false && item_validator.run(item) == false\n end\n true\n end",
"def is_key_entry(aliaz)\n\n end",
"def has_value?\n true\n end",
"def is_final?(v)\n@final[v]\nend",
"def param_present?(obj)\n @config_params.value?(obj)\n end",
"def void_true(*args)\n return true\n end",
"def test? value\n begin\n @pairs.all? { |k, v| v === value[k] }\n rescue\n false\n end\n end",
"def and_h\n end",
"def match?(options)\n options.all? { |key, value| self[key] == value }\n end",
"def key?(key, is: ANY)\n v = wrap(is)\n proc do |o|\n o.is_a? Hash and (o.key?(key) ? v.call(o[key]) : false)\n end\n end",
"def multi_value?\n self[:value] ||= {}\n is_check_box_type?(/^multi$/)\n end",
"def response?(params); end",
"def include?(o)\n return false unless valid_member?(o)\n @val[o] != 0\n end",
"def test?\n params['USER2'] == 'true'\n end",
"def passes?(obj)\n method_key = valid_criteria[attribute_name][\"operators\"] rescue nil\n if method_key.nil?\n return false unless DEFAULT_EVAL_METHODS.include?(eval_method)\n t_eval_method = (eval_method == \"match\" || eval_method == \"include?\") ? \".#{eval_method}\" : \" #{eval_method}\"\n eval_string = \"obj.instance_eval(\\\"#{attribute_name}\\\")#{t_eval_method} \\\"#{value.to_s}\\\"\"\n # puts eval_string\n eval eval_string, binding\n else\n eval_string = method_key[eval_method]\n eval_string.gsub!(\"$1\", \"obj\")\n eval_string.gsub!(\"$2\", (values == \"boolean\" ? value : \"\\\"#{value}\\\"\"))\n # puts eval_string\n eval eval_string, binding\n end\n end",
"def eql?(obj)\n build\n obj.build\n obj.all_info_matches?(@info)\n rescue StandardError\n false\n end",
"def options_has_value_and_display?\n options.values.all? { |option|\n option.is_a?(Hash) && option.has_key?(\"value\")\n } && options.values.all? { |option|\n option.is_a?(Hash) && option.has_key?(\"display\")\n }\n end",
"def test_Hash_InstanceMethods_hash_key?\n\t\th = {'a'=>100, 'b'=>200}\n\t\tassert_equal(true, h.has_key?('a'))\n\t\tassert_equal(false, h.has_key?('z'))\n\tend",
"def in?(key)\n return true if get(key)\n false\n end"
] | [
"0.68881786",
"0.66914606",
"0.66439974",
"0.66135806",
"0.64289385",
"0.64289385",
"0.64114344",
"0.63166",
"0.631603",
"0.62921715",
"0.6245153",
"0.6207265",
"0.6166599",
"0.61302173",
"0.6124946",
"0.6089859",
"0.60478973",
"0.60324436",
"0.60276306",
"0.60270244",
"0.6020875",
"0.6020418",
"0.6005087",
"0.60010636",
"0.59845513",
"0.5975443",
"0.5973524",
"0.5968157",
"0.59666276",
"0.5961385",
"0.59146327",
"0.59140754",
"0.5909084",
"0.59053016",
"0.59032923",
"0.58928275",
"0.58641285",
"0.5863777",
"0.5858279",
"0.5858279",
"0.5858279",
"0.5858279",
"0.5858279",
"0.5858279",
"0.5845516",
"0.5839637",
"0.5824182",
"0.5819146",
"0.58041424",
"0.5796512",
"0.5793672",
"0.57804334",
"0.57764596",
"0.5746708",
"0.57450813",
"0.5737369",
"0.5724565",
"0.57165504",
"0.57111645",
"0.57101464",
"0.5707943",
"0.5703982",
"0.56990564",
"0.5690741",
"0.5690741",
"0.5688599",
"0.5687653",
"0.56853366",
"0.568152",
"0.5680538",
"0.56781936",
"0.56781936",
"0.56780505",
"0.56780505",
"0.56756836",
"0.56624544",
"0.56555974",
"0.5655269",
"0.5655269",
"0.5649237",
"0.5647894",
"0.56443673",
"0.5640204",
"0.56349224",
"0.5610258",
"0.5605024",
"0.56026995",
"0.5592524",
"0.5578837",
"0.55727446",
"0.5566303",
"0.5563735",
"0.5553206",
"0.55501574",
"0.55441695",
"0.5544098",
"0.5543902",
"0.5536921",
"0.55356246",
"0.55346286",
"0.5534029"
] | 0.0 | -1 |
args 1. Object value 2. Hash option return Boolean | def alpha?(value, option = nil)
if option.is_a?(Symbol)
options = {:case => option}
else
options = option
end
return true if value.nil? and not required(options)
return false unless value.is_a?(String)
return value.match(/^[a-zA-Z]+$/) unless options.is_a?(Hash)
case
when options[:case] == :down
return value.match(/^[a-z]+$/)
when options[:case] == :up || options[:case] == :upper
return value.match(/^[A-Z]+$/)
else
raise ArgumentError.new("options must be :down or :up.")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash_in_argument_hash\n argument_hash = {} if argument_hash.nil?\n return true\n end",
"def hash_or_parameter?(args)\n args.is_a?(Hash) || args.respond_to?(:to_unsafe_h)\n end",
"def include?(arg_)\n _get_objdata(arg_) ? true : false\n end",
"def value?(value) true end",
"def value?(value); end",
"def value?(value); end",
"def vash_valid_key?(x); self.class.option_name?(x); end",
"def test_Hash_InstanceMethods_has_value?\n\t\th = {'a'=>100, 'b'=>200}\n\t\tassert_equal(true, h.has_value?(100))\n\t\tassert_equal(false, h.has_value?(999))\n\tend",
"def eql?(arg)\n self.hash == arg.hash\n end",
"def vash_valid_value?(x); self.class.option_value?(x); end",
"def has_value?(value); end",
"def has_value?(p0) end",
"def test_Hash_InstanceMethods_value?\n\t\t# TODO, will be add some testcases\n\t\tassert_equal(true, true)\n\tend",
"def value?(p0) end",
"def true?(obj)\n booleans = { \"true\"=>true, \"1\"=>true, true=>true, 1=>true,\n \"false\"=>false, \"0\"=>false, false=>false, 0=>false}\n booleans.has_key?(obj) ? booleans[obj] : true\nend",
"def include?(o)\n @hash.has_value?(o)\n end",
"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",
"def allows?(hash={})\n apply(hash)[0]\n end",
"def has_value? value; value? value; end",
"def include?(o)\n @hash[o]\n end",
"def method_missing(sym, *args)\n if sym.to_s =~ /\\A(.*)\\?\\z/ && options.include?($1.to_sym) && (options[$1.to_sym].is_a?(TrueClass) || options[$1.to_sym].is_a?(FalseClass))\n options[$1.to_sym]\n elsif sym.to_s =~ /\\A(.*)\\z/ && options.include?($1.to_sym) \n options[$1.to_sym]\n else\n false\n end\n end",
"def match?(*args)\n props = Hash === args.last ? args.pop : {}\n\n if target = args.shift\n props[:command] = target.to_s\n props[:feature] = target.to_s\n end\n\n if props[:profile]\n props[:profile] = (props[:profile] || :default).to_s\n end\n\n props.each do |k,v|\n pv = property(k)\n return false unless (pv.nil? || pv == v)\n end\n\n return true\n end",
"def healthy?() raw && raw.is_a?(Hash) end",
"def capable?(key); end",
"def includes? hash\n hash.each_pair do |key, value|\n return false unless send(\"#{key}\") == value\n end\n true\n end",
"def options?(*args)\r\n val = false\r\n options.each do |key, value|\r\n next unless args.include?(key.to_sym)\r\n val = options[key].nil? ? true : options[key]\r\n break\r\n end\r\n val\r\n end",
"def passed?(object)\n ! @seen_values.include?(object)\n end",
"def hashlike?\n @target.respond_to?(:[]) && @target.respond_to?(:each) && !@target.is_a?(String) && !@target.is_a?(Symbol)\n end",
"def matches(hash)\n matched = true\n hash.each do |k, v|\n if matched #only continue loop if we continue to match properties\n case k.to_s\n when \"cpu\"\n @cpu == v ? matched = true : matched = false\n when \"display\"\n @display_size == v ? matched = true : matched = false\n when \"number_cores\"\n @number_cores == v ? matched = true : matched = false\n end #case\n end #if matched\n end #each\n matched\n end",
"def contains?(arg)\n case arg\n when Symbol\n !!lookup_name(arg.id2name)\n when String\n !!lookup_name(arg)\n when Integer\n !!lookup_id(arg)\n when self\n true\n else\n false\n end\n end",
"def my_all?(arg = nil)\n resp = true\n return true if to_a.nil? || (self.class.to_s == 'Hash' && !block_given?)\n\n if block_given?\n to_a.my_each { |val| resp = false unless yield(val) }\n elsif arg.nil?\n to_a.my_each { |val| resp = false unless val }\n else\n case arg.class.to_s\n when 'Regexp'\n to_a.my_each { |val| resp = false unless arg.match? val.to_s }\n when 'Class'\n to_a.my_each { |val| resp = false unless val.is_a? arg }\n else\n to_a.my_each { |val| return resp = false unless val == arg }\n end\n end\n resp\n end",
"def true(_argvs)\n return nil\n end",
"def func1 val #missing the symbols for arguments\r\n if val = 1 #missing 1 equal symbol.\r\n return true\r\n else\r\n return false\r\n end\r\nend",
"def has_key?(p0) end",
"def include?(arg)\n case arg\n when Symbol\n !lookup_name(arg.id2name).nil?\n when String\n !lookup_name(arg).nil?\n when Integer\n !lookup_id(arg).nil?\n when self\n possible_match = lookup_id(arg.id)\n !possible_match.nil? && possible_match == arg\n else\n false\n end\n end",
"def typecast_value_boolean(opts={});true;end",
"def single_value?\n return false\n end",
"def include?(obj)\n @data.key?(obj)\n end",
"def key?(key); end",
"def key?(key); end",
"def key?(key); end",
"def key?(key); end",
"def key?(key); end",
"def key?(key); end",
"def set?\n\t\t\tbegin\n\n\t\t\t\tvalue = @lookup.inject(@obj_with_keys) { |deep_obj, this_key|\n\t\t\t\t\t# Has to be an object that can have keys\n\t\t\t\t\treturn false unless deep_obj.respond_to?(:[])\n\n\t\t\t\t\tif deep_obj.respond_to?(:fetch)\n\t\t\t\t\t\t# Hash, Array and Struct all respond to fetch\n\t\t\t\t\t\t# We've monkeypatched fetch to Struct\n\t\t\t\t\t\tif deep_obj.is_a?(Array)\n\t\t\t\t\t\t\t# Check array separately as must fetch numeric key\n\t\t\t\t\t\t\treturn false unless Keys.index?(this_key)\n\t\t\t\t\t\tend\n\t\t\t\t\t\tnext_obj = deep_obj.fetch(this_key, Keys::MISSING)\n\t\t\t\t\telse\n\t\t\t\t\t\treturn false\n\t\t\t\t\tend\n\n\t\t\t\t\t# No need to go any further\n\t\t\t\t\treturn false if Keys::MISSING == next_obj\n\n\t\t\t\t\t# Reinject value to next loop\n\t\t\t\t\tnext_obj\n\t\t\t\t}\n\n\t\t\trescue\n\t\t\t\t# If fetch throws a wobbly at any point, fail gracefully\n\t\t\t\treturn false\n\t\t\tend\n\t\t\t# No errors - yield the value if desired\n\t\t\tif block_given?\n\t\t\t\tyield(value)\n\t\t\tend\n\t\t\t# Return true\n\t\t\treturn true\n\t\tend",
"def test_Hash_InstanceMethods_include?\n\t\th = {'a'=>100, 'b'=>200}\n\t\tassert_equal(true, h.include?('a'))\n\t\tassert_equal(true, h.include?('b'))\n\t\tassert_equal(false, h.include?('c'))\n\tend",
"def include?(o)\n @hash.include?(o)\n end",
"def prepared_arg?(k)\n true\n end",
"def check(hash)\n # not implemented\n end",
"def key?(*) end",
"def single_value?\n self[:value] ||= {}\n is_check_box_type?(/^single$/)\n end",
"def should_eval_to(pass_value)\n @bucket.all? == pass_value\n end",
"def value?(key)\n !!value(key) || @object.value?(key)\n end",
"def valid?(args)\n raise TypeError, \"#{self.class.name} must be initialised with a hash\" if not args.kind_of?(Hash)\n args.each { |k,v|\n case k\n when :date_start, :date_end\n raise TypeError, \"Expected Time type\" unless v.kind_of? Time\n when :category, :entity, :description\n raise TypeError, \"Expected a string\" unless v.kind_of? String\n when :quantity, :unit_cost, :sub_total, :gst, :total\n raise TypeError, \"Expected a number\" unless v.kind_of? Numeric\n end\n }\n return true\n end",
"def value? value\n include? value\n end",
"def invite_by_entry?\n invitation_params.is_a?(Hash)\n end",
"def can_have_value?()\n return true\n end",
"def params_has_key *args\n args.each do |key|\n unless params.has_key? key.to_s\n return false\n end\n end\n return true\nend",
"def msg_not_boolean(parent, key, value); end",
"def true?(obj)\n [\"true\",\"1\"].include? obj.to_s.downcase\n end",
"def in_kwarg; end",
"def value\n true\n end",
"def is_value?\n true\n end",
"def has_key?(key); end",
"def has_key?(key); end",
"def can_have_value?\n return true\n end",
"def check_call call\n args = process call[3]\n if args.length <= 1 #empty new()\n false\n elsif hash? args[1]\n #Still should probably check contents of hash\n false\n else\n true\n end\n end",
"def hasArg?(arg); argSet.member?(arg) end",
"def include?(obj)\n self.each{|*val|\n return true if val.__svalue == obj\n }\n false\n end",
"def populated_hash?(obj)\n obj.is_a?(Hash) && !obj.empty?\n end",
"def has_argument?(key)\n self.arguments.set?(key)\n end",
"def has_argument?(key)\n self.arguments.set?(key)\n end",
"def param_equals?(key, value)\n\t\tret = @myparams.include?(key) && @myparams[key] == value\n\t\t#puts \"#{controller_name}.#{__method__}:#{key}.#{value}=#{ret}\"\n\t\tret\n\tend",
"def param_equals?(key, value)\n\t\tret = @myparams.include?(key) && @myparams[key] == value\n\t\t#puts \"#{controller_name}.#{__method__}:#{key}.#{value}=#{ret}\"\n\t\tret\n\tend",
"def method_missing(name, *args, &block)\n if name.to_s =~ /\\?$/ && args.empty?\n if @field_variants.any? { |variant| \"#{variant.attribute}?\" == name.to_s }\n 'true'\n else\n 'false'\n end\n else\n super(name.to_sym, *args, &block)\n end\n end",
"def args?\n\t\treturn !self.fields.empty?\n\tend",
"def matches?(value, context); end",
"def has_key?(*args)\n @params.has_key?(*args)\n end",
"def has_key?(*args)\n @params.has_key?(*args)\n end",
"def valid_hash?(h)\n self.class.valid_hash?(h)\n end",
"def prepared_arg?(k)\n true\n end",
"def include?(arg)\n if arg.kind_of?(Hash)\n rdns.include?(arg)\n else\n super\n end\n end",
"def run(value)\n null_validator = NullValidator.new\n\n # NOTE: OpenActive is more strict than plain json-ld, so no coercion into arrays\n\n # Check if value is an array\n return true if item_validator.run(value) == true\n\n return false if ArrayValidator.new.run(value) == false\n\n value.each do |item|\n # If any of the provided items is not null nor an instance of the provided class name\n return false if null_validator.run(item) == false && item_validator.run(item) == false\n end\n true\n end",
"def is_key_entry(aliaz)\n\n end",
"def has_value?\n true\n end",
"def is_final?(v)\n@final[v]\nend",
"def param_present?(obj)\n @config_params.value?(obj)\n end",
"def void_true(*args)\n return true\n end",
"def test? value\n begin\n @pairs.all? { |k, v| v === value[k] }\n rescue\n false\n end\n end",
"def and_h\n end",
"def match?(options)\n options.all? { |key, value| self[key] == value }\n end",
"def key?(key, is: ANY)\n v = wrap(is)\n proc do |o|\n o.is_a? Hash and (o.key?(key) ? v.call(o[key]) : false)\n end\n end",
"def multi_value?\n self[:value] ||= {}\n is_check_box_type?(/^multi$/)\n end",
"def response?(params); end",
"def include?(o)\n return false unless valid_member?(o)\n @val[o] != 0\n end",
"def test?\n params['USER2'] == 'true'\n end",
"def passes?(obj)\n method_key = valid_criteria[attribute_name][\"operators\"] rescue nil\n if method_key.nil?\n return false unless DEFAULT_EVAL_METHODS.include?(eval_method)\n t_eval_method = (eval_method == \"match\" || eval_method == \"include?\") ? \".#{eval_method}\" : \" #{eval_method}\"\n eval_string = \"obj.instance_eval(\\\"#{attribute_name}\\\")#{t_eval_method} \\\"#{value.to_s}\\\"\"\n # puts eval_string\n eval eval_string, binding\n else\n eval_string = method_key[eval_method]\n eval_string.gsub!(\"$1\", \"obj\")\n eval_string.gsub!(\"$2\", (values == \"boolean\" ? value : \"\\\"#{value}\\\"\"))\n # puts eval_string\n eval eval_string, binding\n end\n end",
"def eql?(obj)\n build\n obj.build\n obj.all_info_matches?(@info)\n rescue StandardError\n false\n end",
"def options_has_value_and_display?\n options.values.all? { |option|\n option.is_a?(Hash) && option.has_key?(\"value\")\n } && options.values.all? { |option|\n option.is_a?(Hash) && option.has_key?(\"display\")\n }\n end",
"def test_Hash_InstanceMethods_hash_key?\n\t\th = {'a'=>100, 'b'=>200}\n\t\tassert_equal(true, h.has_key?('a'))\n\t\tassert_equal(false, h.has_key?('z'))\n\tend",
"def in?(key)\n return true if get(key)\n false\n end"
] | [
"0.68881786",
"0.66914606",
"0.66439974",
"0.66135806",
"0.64289385",
"0.64289385",
"0.64114344",
"0.63166",
"0.631603",
"0.62921715",
"0.6245153",
"0.6207265",
"0.6166599",
"0.61302173",
"0.6124946",
"0.6089859",
"0.60478973",
"0.60324436",
"0.60276306",
"0.60270244",
"0.6020875",
"0.6020418",
"0.6005087",
"0.60010636",
"0.59845513",
"0.5975443",
"0.5973524",
"0.5968157",
"0.59666276",
"0.5961385",
"0.59146327",
"0.59140754",
"0.5909084",
"0.59053016",
"0.59032923",
"0.58928275",
"0.58641285",
"0.5863777",
"0.5858279",
"0.5858279",
"0.5858279",
"0.5858279",
"0.5858279",
"0.5858279",
"0.5845516",
"0.5839637",
"0.5824182",
"0.5819146",
"0.58041424",
"0.5796512",
"0.5793672",
"0.57804334",
"0.57764596",
"0.5746708",
"0.57450813",
"0.5737369",
"0.5724565",
"0.57165504",
"0.57111645",
"0.57101464",
"0.5707943",
"0.5703982",
"0.56990564",
"0.5690741",
"0.5690741",
"0.5688599",
"0.5687653",
"0.56853366",
"0.568152",
"0.5680538",
"0.56781936",
"0.56781936",
"0.56780505",
"0.56780505",
"0.56756836",
"0.56624544",
"0.56555974",
"0.5655269",
"0.5655269",
"0.5649237",
"0.5647894",
"0.56443673",
"0.5640204",
"0.56349224",
"0.5610258",
"0.5605024",
"0.56026995",
"0.5592524",
"0.5578837",
"0.55727446",
"0.5566303",
"0.5563735",
"0.5553206",
"0.55501574",
"0.55441695",
"0.5544098",
"0.5543902",
"0.5536921",
"0.55356246",
"0.55346286",
"0.5534029"
] | 0.0 | -1 |
GET /translated_lines GET /translated_lines.json | def index
@translated_lines = TranslatedLine.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_translated_line\n @translated_line = TranslatedLine.find(params[:id])\n end",
"def create\n @translated_line = TranslatedLine.new(translated_line_params)\n\n respond_to do |format|\n if @translated_line.save\n @translated_lines = TranslatedLine.where(translation_code: @translated_line.translation_code)\n format.html { redirect_to @translated_line, notice: 'Translated line was successfully created.' }\n format.js {}\n format.json { render :show, status: :created, location: @translated_line }\n else\n format.html { render :new }\n format.js {}\n format.json { render json: @translated_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @translated_line.update(translated_line_params)\n format.html { redirect_to @translated_line, notice: 'Translated line was successfully updated.' }\n format.json { render :show, status: :ok, location: @translated_line }\n else\n format.html { render :edit }\n format.json { render json: @translated_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @line_items = @order.line_items\n\n render json: @line_items\n end",
"def translated_line_params\n params.require(:translated_line).permit(:translation_code, :description)\n end",
"def destroy\n @translated_line.destroy\n respond_to do |format|\n format.html { redirect_to translated_lines_url, notice: 'Translated line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def get_lines_with_http_info(year, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BettingApi.get_lines ...'\n end\n # verify the required parameter 'year' is set\n if @api_client.config.client_side_validation && year.nil?\n fail ArgumentError, \"Missing the required parameter 'year' when calling BettingApi.get_lines\"\n end\n # resource path\n local_var_path = '/lines'\n\n # query parameters\n query_params = {}\n query_params[:'year'] = year\n query_params[:'week'] = opts[:'week'] if !opts[:'week'].nil?\n query_params[:'seasonType'] = opts[:'season_type'] if !opts[:'season_type'].nil?\n query_params[:'team'] = opts[:'team'] if !opts[:'team'].nil?\n query_params[:'home'] = opts[:'home'] if !opts[:'home'].nil?\n query_params[:'away'] = opts[:'away'] if !opts[:'away'].nil?\n query_params[:'conference'] = opts[:'conference'] if !opts[:'conference'].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 = []\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<GameLines>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BettingApi#get_lines\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def fetch_translated_law\n\n con = Faraday.new\n\n res = con.post do |req|\n req.url 'https://api.deepl.com/v2/translate?auth_key='+ ENV[\"DEEPL_API\"],\n req.body = {text: self.name,\n target_lang: 'EN',\n source_lang: 'FR'\n }\n end\n self.translatedtext = JSON.parse(res.body)[\"translations\"][1][\"text\"]\n end",
"def index\n @order_line_items = @order.order_line_items\n\n render json: @order_line_items\n end",
"def index\n @textlines = Textline.all\n end",
"def get_conversations_messaging_integrations_line_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ConversationsApi.get_conversations_messaging_integrations_line ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/conversations/messaging/integrations/line\".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\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 => 'LineIntegrationEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConversationsApi#get_conversations_messaging_integrations_line\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @lines = Line.all\n end",
"def index\n @lines = Line.all\n end",
"def getLines\n\t\t@lines\n\tend",
"def index\n @order_lines = OrderLine.all\n end",
"def lines\n @transcript_lines\n end",
"def lines\n @lines ||= Vedeu::Editor::Lines.coerce(data)\n end",
"def show\n @translated_word = TranslatedWord.find(params[:id])\n\n respond_to do |format|\n format.json do\n # render :json => @translated_word.to_json(:include => { :word => { :only => :text } })\n render :json => @translated_word.to_json(:include => :word )\n end\n end\n end",
"def show_by_original_word\n @translated_word = TranslatedWord.find_by_word_id(Word.find_by_text(params[:wordtext]))\n respond_to do |format|\n format.json do\n render :json => @translated_word.to_json(:include => :word )\n end\n end\n end",
"def index\n\n @metro_lines = MetroLine.all\n\n render json: @metro_lines\n\n end",
"def lines\n @lines ||= build_lines\n end",
"def get_lines(year, opts = {})\n data, _status_code, _headers = get_lines_with_http_info(year, opts)\n data\n end",
"def lines\n invoice_lines\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @line_items }\n end\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @line_items }\n end\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @line_items }\n end\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @line_items }\n end\n end",
"def list_lines\n RailLine.list_lines\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json {\n render json: @line_items \n }\n end\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @line_items }\n end\n end",
"def show\n @line = Line.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line }\n end\n end",
"def lines\n @lines\nend",
"def get_language_text_with_http_info(language_code, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: LanguagesApi#get_language_text ...\"\n end\n \n # verify the required parameter 'language_code' is set\n fail \"Missing the required parameter 'language_code' when calling get_language_text\" if language_code.nil?\n \n # resource path\n local_var_path = \"/languages/\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'languageCode'] = language_code\n query_params[:'key'] = opts[:'key'] if opts[:'key']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n 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 => 'LanguageDictionary')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LanguagesApi#get_language_text\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @line_item = @order.line_items.find(params[:id])\n\n render json: @line_item\n end",
"def show_by_translation\n @translated_word = TranslatedWord.find_by_translation(params[:translation])\n respond_to do |format|\n format.json do\n render :json => @translated_word.to_json(:include => :word )\n end\n end\n end",
"def index\n @time_lines = TimeLine.all\n end",
"def get_routing_languages_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RoutingApi.get_routing_languages ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n if opts[:'sort_order'] && !['ascending', 'descending'].include?(opts[:'sort_order'])\n fail ArgumentError, 'invalid value for \"sort_order\", must be one of ascending, descending'\n end\n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/routing/languages\".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[:'sortOrder'] = opts[:'sort_order'] if opts[:'sort_order']\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 => 'LanguageEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RoutingApi#get_routing_languages\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @courses = Course.all.includes(:translations)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end",
"def index\n @applied_lines = AppliedLine.all\n end",
"def show\n @line = Line.includes({:sublines => :transactions}).find(params[:id])\n @budget = @line.budget\n @subtitle = '%s %d' % [@line.category.capitalize, @line.line_number]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line }\n end\n end",
"def translations; end",
"def index\n\t\t@languages = Language.all\n\t\t@title = t(\"translate.title\")\n\t\trespond_with @languages\n\tend",
"def index\n @lines = Line.where(user_id: current_user.id, diagram_id:@diagram.id, node_id:@node.id)\n end",
"def translations(language = nil)\n Birdman::Requester.get(\"movies/#{id}/translations/#{language}\")\n end",
"def request_translations(texts, options = T.unsafe(nil), http_options = T.unsafe(nil)); end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def translate(lang_from = @lang_from, lang_to = @lang_to, words)\n return [] if words.size == 0\n all_translated = [] #array of all translated words\n words.each_slice(800) do |slice| #slice into 1000 words doing >1000 runs into problems\n words_string = slice.join(\"&text=\")\n uri = \"https://translate.yandex.net/api/v1.5/tr.json/translate?key=APIkey&lang=FROM-TO&text=WORD\"\n uri = uri.sub(\"WORD\",words_string).sub(\"FROM\", lang_from).sub(\"TO\", lang_to).sub(\"APIkey\", @key)\n uri = URI.escape(uri) #escape unsafe characters in uri\n begin\n #puts uri\n #puts '****************************'\n json = open(uri).read #open uri of yandex translation\n rescue => e\n puts e.message\n end\n translated = JSON.parse(json)[\"text\"]\n #should probably check to make sure translated != nil\n if translated.nil?\n puts \"PROBLEM TRANSLATING - returned nil (URI may be too long)\"\n else\n all_translated += translated\n end\n end\n all_translated #return array of all translations\n end",
"def klines(options)\n request :public, :get, :klines, options\n end",
"def show\n @order_line = OrderLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order_line }\n end\n end",
"def index\n set_service_lines\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { \n render :text => @service_lines.sort_by { |sl| sl.name }.map { |sl| { :id => sl[:id], :label => sl[:name], :value => sl[:id] } }.to_json\n }\n format.xml { render :xml => @service_lines }\n end\n end",
"def index\n @clothing_lines = ClothingLine.all\n end",
"def lines\n load_data unless @lines\n @lines\n end",
"def index\n @lineitems = Lineitem.all\n end",
"def index\n @trade_lines = TradeLine.all\n end",
"def get_routing_languages_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RoutingApi.get_routing_languages ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n if opts[:'sort_order'] && !['ascending', 'descending'].include?(opts[:'sort_order'])\n fail ArgumentError, 'invalid value for \"sort_order\", must be one of ascending, descending'\n end\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/routing/languages\".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[:'sortOrder'] = opts[:'sort_order'] if opts[:'sort_order']\n query_params[:'name'] = opts[:'name'] if opts[:'name']\n query_params[:'id'] = @api_client.build_collection_param(opts[:'id'], :multi) if opts[:'id']\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 => 'LanguageEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RoutingApi#get_routing_languages\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def languages(options={})\n res = self.get \"/translate/service/languages\", :query => options\n check_for_errors(res)\n res['response']\n end",
"def translate\n api = ENV['API']\n url = 'https://translation.googleapis.com/language/translate/v2?key='\n target_language = self.phrasebook.language.abbr\n input = self.phrase.input\n # byebug\n\n request = HTTParty.get(url + api + '&q=' + input + '&source=en' + '&target=' + target_language)\n response = JSON.parse(request.body)\n translation = response['data']['translations'][0]['translatedText']\n end",
"def lines\n @document.lines @line_numbers\n end",
"def fetch_translations(locale)\n self.translations ||= {}\n return if self.translations[locale]\n\n # Tml.logger.debug(\"Fetching translations for #{label}\")\n\n results = self.application.api_client.get(\n \"translation_keys/#{self.key}/translations\",\n {:locale => locale, :per_page => 10000},\n {:cache_key => Tml::TranslationKey.cache_key(locale, self.key)}\n ) || []\n\n update_translations(locale, results)\n\n self\n rescue Tml::Exception => ex\n self.translations = {}\n self\n end",
"def index\n @line_items = LineItem.all\nend",
"def index\n @line_items = LineItem.all\nend",
"def new\n @order_line = OrderLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order_line }\n end\n end",
"def orders_get_discount_lines_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DiscountsApi.orders_get_discount_lines ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling DiscountsApi.orders_get_discount_lines\"\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling DiscountsApi.orders_get_discount_lines, must be smaller than or equal to 250.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling DiscountsApi.orders_get_discount_lines, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/orders/{id}/discount_lines'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?\n query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil?\n query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].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/vnd.conekta-v2.1.0+json'])\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].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] || 'GetOrderDiscountLinesResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"DiscountsApi.orders_get_discount_lines\",\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: DiscountsApi#orders_get_discount_lines\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def strings_to_lines_textualed\n strings = File.read(file_name)\n strings.extend Textual\n new = strings.to_textual\n end",
"def index\n @lineamientos = Lineamiento.all\n end",
"def get_untranslated_keys\n ret = []\n begin\n raw_response = `curl -s 'https://localise.biz/api/assets' -u #{@api_key}: --silent` \n response = JSON.parse(raw_response)\n response.each { |key|\n if key['progress']['untranslated'] > 0\n ret.push(key)\n end\n }\n return ret\n rescue => error\n puts 'Error: Cannot connect or parse response from loco api while trying to validate translations'\n puts \"Error message: #{error.message}\"\n exit\n end\n end",
"def index\n @translated_files = TranslatedFile.all\n end",
"def get_document_poly_line_annotations_with_http_info(name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.get_document_poly_line_annotations ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.get_document_poly_line_annotations\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/annotations/polyline\".sub('{' + 'name' + '}', name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(: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 => 'PolyLineAnnotationsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#get_document_poly_line_annotations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @verbs = Verb.active.to_a \n @lines = @lines.where(:verb_id => params[:verb_id]) unless params[:verb_id].nil? \n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lines }\n end\n end",
"def get_order_lines\n current_order = @order_lines.get_order_lines_by_order_id(@order_status)\n return current_order\n end",
"def index\n @phone_lines = PhoneLine.all\n end",
"def index\n @example_translations = ExampleTranslation.all\n end",
"def show\n @order = Order.find(params[:id])\n @line_bundles = @order.line_bundles\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def new\n @line = Line.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line }\n end\n end",
"def translated\n find_all do |entry|\n entry.translated?\n end\n end",
"def translation_for(locale)\n success = true\n tries ||= 3\n translation = self.translations.detect{ |t| t.locale == locale }\n return translation if translation\n return nil if self.new_record\n request = Net::HTTP::Get.new(\"/api/projects/#{Connection.api_key}/terms/#{self.id}/locales/#{locale}/translations.yaml\")\n WebTranslateIt::Util.add_fields(request)\n begin\n response = Util.handle_response(Connection.http_connection.request(request), true, true)\n array = YAML.load(response)\n return nil if array.empty?\n translations = []\n array.each do |translation|\n term_translation = WebTranslateIt::TermTranslation.new(translation)\n translations.push(term_translation)\n end\n return translations\n \n rescue Timeout::Error\n puts \"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 end\n success\n end",
"def index\n @lineas = Linea.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lineas }\n end\n end",
"def map_processed_lines(response)\n end",
"def orders_get_discount_line_with_http_info(id, discount_lines_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DiscountsApi.orders_get_discount_line ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling DiscountsApi.orders_get_discount_line\"\n end\n # verify the required parameter 'discount_lines_id' is set\n if @api_client.config.client_side_validation && discount_lines_id.nil?\n fail ArgumentError, \"Missing the required parameter 'discount_lines_id' when calling DiscountsApi.orders_get_discount_line\"\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/orders/{id}/discount_lines/{discount_lines_id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'discount_lines_id' + '}', CGI.escape(discount_lines_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/vnd.conekta-v2.1.0+json'])\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].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] || 'DiscountLinesResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"DiscountsApi.orders_get_discount_line\",\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: DiscountsApi#orders_get_discount_line\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @textline = Textline.new(textline_params)\n\n respond_to do |format|\n if @textline.save\n format.html { redirect_to @textline, notice: 'Textline was successfully created.' }\n format.json { render :show, status: :created, location: @textline }\n else\n format.html { render :new }\n format.json { render json: @textline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @contract_service_lines = ContractServiceLine.all\n end",
"def translations\n OneclickRefernet::Translation.where(key: self.code)\n end",
"def lines\n @lines ||= line_codes.map {|l| Line.get(l)}\n end",
"def index\n @line_details = LineDetail.all\n end",
"def index\n @liners = Liner.all\n end",
"def editable_list \n @translations = Translation.paginate(:page => params[:page], :per_page=>25) \n #puts \"@translations: \" + @translations.first.dot_key_code\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @translations }\n end\n end",
"def index\n @translations = @locale.translations.all(:order => \"raw_key, pluralization_index\")\n end",
"def get_subject_by_curricular_line\n @subjects = Subject.get_by_career(params[:career_id],params[:cl_id])\n render :json => @subjects\n end",
"def show\n @line_items = @order.line_items\n end"
] | [
"0.6548335",
"0.6476807",
"0.63034403",
"0.60311884",
"0.60255754",
"0.59237367",
"0.589768",
"0.5782095",
"0.5773349",
"0.5766864",
"0.57553756",
"0.5752632",
"0.5752632",
"0.56929684",
"0.561968",
"0.5565931",
"0.55541885",
"0.5552106",
"0.55155766",
"0.5509043",
"0.5501729",
"0.5490658",
"0.5481495",
"0.54781765",
"0.54781765",
"0.54781765",
"0.54781765",
"0.5471498",
"0.54676634",
"0.5453743",
"0.5413487",
"0.54126054",
"0.5399171",
"0.5393358",
"0.53811014",
"0.5371408",
"0.5349689",
"0.53338575",
"0.532995",
"0.53240144",
"0.5321939",
"0.53042096",
"0.5302427",
"0.53019404",
"0.53017175",
"0.5291846",
"0.5288239",
"0.5288239",
"0.5288239",
"0.5288239",
"0.5288239",
"0.5288239",
"0.5288239",
"0.5288239",
"0.5288239",
"0.5288239",
"0.5288239",
"0.5274446",
"0.52742714",
"0.5261594",
"0.5256547",
"0.5250248",
"0.52325237",
"0.5231538",
"0.5221039",
"0.5220985",
"0.5203722",
"0.5203674",
"0.5183273",
"0.5169086",
"0.51580435",
"0.51580435",
"0.51552963",
"0.515428",
"0.5146524",
"0.51412255",
"0.5141002",
"0.5116672",
"0.5116534",
"0.51153785",
"0.5112638",
"0.50825894",
"0.50795746",
"0.5074822",
"0.50693524",
"0.50660896",
"0.50647926",
"0.5062058",
"0.50571275",
"0.5055037",
"0.50546676",
"0.5052537",
"0.50402665",
"0.50394624",
"0.5031136",
"0.49967086",
"0.4996041",
"0.49812603",
"0.49788225",
"0.49767274"
] | 0.79125476 | 0 |
GET /translated_lines/1 GET /translated_lines/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @translated_lines = TranslatedLine.all\n end",
"def set_translated_line\n @translated_line = TranslatedLine.find(params[:id])\n end",
"def create\n @translated_line = TranslatedLine.new(translated_line_params)\n\n respond_to do |format|\n if @translated_line.save\n @translated_lines = TranslatedLine.where(translation_code: @translated_line.translation_code)\n format.html { redirect_to @translated_line, notice: 'Translated line was successfully created.' }\n format.js {}\n format.json { render :show, status: :created, location: @translated_line }\n else\n format.html { render :new }\n format.js {}\n format.json { render json: @translated_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @translated_line.update(translated_line_params)\n format.html { redirect_to @translated_line, notice: 'Translated line was successfully updated.' }\n format.json { render :show, status: :ok, location: @translated_line }\n else\n format.html { render :edit }\n format.json { render json: @translated_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @line_items = @order.line_items\n\n render json: @line_items\n end",
"def destroy\n @translated_line.destroy\n respond_to do |format|\n format.html { redirect_to translated_lines_url, notice: 'Translated line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def show\n @line = Line.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line }\n end\n end",
"def translated_line_params\n params.require(:translated_line).permit(:translation_code, :description)\n end",
"def show\n @line = Line.includes({:sublines => :transactions}).find(params[:id])\n @budget = @line.budget\n @subtitle = '%s %d' % [@line.category.capitalize, @line.line_number]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line }\n end\n end",
"def show\n @line_item = @order.line_items.find(params[:id])\n\n render json: @line_item\n end",
"def show\n @translated_word = TranslatedWord.find(params[:id])\n\n respond_to do |format|\n format.json do\n # render :json => @translated_word.to_json(:include => { :word => { :only => :text } })\n render :json => @translated_word.to_json(:include => :word )\n end\n end\n end",
"def show_by_original_word\n @translated_word = TranslatedWord.find_by_word_id(Word.find_by_text(params[:wordtext]))\n respond_to do |format|\n format.json do\n render :json => @translated_word.to_json(:include => :word )\n end\n end\n end",
"def index\n @order_line_items = @order.order_line_items\n\n render json: @order_line_items\n end",
"def index\n @lines = Line.all\n end",
"def index\n @lines = Line.all\n end",
"def fetch_translated_law\n\n con = Faraday.new\n\n res = con.post do |req|\n req.url 'https://api.deepl.com/v2/translate?auth_key='+ ENV[\"DEEPL_API\"],\n req.body = {text: self.name,\n target_lang: 'EN',\n source_lang: 'FR'\n }\n end\n self.translatedtext = JSON.parse(res.body)[\"translations\"][1][\"text\"]\n end",
"def get_conversations_messaging_integrations_line_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ConversationsApi.get_conversations_messaging_integrations_line ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/conversations/messaging/integrations/line\".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\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 => 'LineIntegrationEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConversationsApi#get_conversations_messaging_integrations_line\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @order_line = OrderLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order_line }\n end\n end",
"def get_lines_with_http_info(year, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BettingApi.get_lines ...'\n end\n # verify the required parameter 'year' is set\n if @api_client.config.client_side_validation && year.nil?\n fail ArgumentError, \"Missing the required parameter 'year' when calling BettingApi.get_lines\"\n end\n # resource path\n local_var_path = '/lines'\n\n # query parameters\n query_params = {}\n query_params[:'year'] = year\n query_params[:'week'] = opts[:'week'] if !opts[:'week'].nil?\n query_params[:'seasonType'] = opts[:'season_type'] if !opts[:'season_type'].nil?\n query_params[:'team'] = opts[:'team'] if !opts[:'team'].nil?\n query_params[:'home'] = opts[:'home'] if !opts[:'home'].nil?\n query_params[:'away'] = opts[:'away'] if !opts[:'away'].nil?\n query_params[:'conference'] = opts[:'conference'] if !opts[:'conference'].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 = []\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<GameLines>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BettingApi#get_lines\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @line_items }\n end\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @line_items }\n end\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @line_items }\n end\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @line_items }\n end\n end",
"def index\n @textlines = Textline.all\n end",
"def show_by_translation\n @translated_word = TranslatedWord.find_by_translation(params[:translation])\n respond_to do |format|\n format.json do\n render :json => @translated_word.to_json(:include => :word )\n end\n end\n end",
"def new\n @order_line = OrderLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order_line }\n end\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @line_items }\n end\n end",
"def index\n @order_lines = OrderLine.all\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json {\n render json: @line_items \n }\n end\n end",
"def new\n @line = Line.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line }\n end\n end",
"def index\n\n @metro_lines = MetroLine.all\n\n render json: @metro_lines\n\n end",
"def show\n @line_item1 = LineItem1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @line_item1 }\n end\n end",
"def show\n @line = ReportingForms::Tanimoto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line }\n end\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end",
"def get_subject_by_curricular_line\n @subjects = Subject.get_by_career(params[:career_id],params[:cl_id])\n render :json => @subjects\n end",
"def show\n @line = Line.find_by_no(params[:id]) || not_found\n authorize! :index, @line\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line }\n end\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @line_item }\n end\n end",
"def show\n @payment = Payment.find(params[:payment_id])\n @payment_line = @payment.payment_lines.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @payment_line }\n end\n end",
"def index\n set_service_lines\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { \n render :text => @service_lines.sort_by { |sl| sl.name }.map { |sl| { :id => sl[:id], :label => sl[:name], :value => sl[:id] } }.to_json\n }\n format.xml { render :xml => @service_lines }\n end\n end",
"def show\n @customer_quote = CustomerQuote.find(params[:customer_quote_id])\n @customer_quote_line = @customer_quote.customer_quote_lines.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @customer_quote_line }\n end\n end",
"def show\n @order = Order.find(params[:id])\n @line_bundles = @order.line_bundles\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @sample_line = SampleLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sample_line }\n end\n end",
"def get_document_poly_line_annotations_with_http_info(name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.get_document_poly_line_annotations ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.get_document_poly_line_annotations\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/annotations/polyline\".sub('{' + 'name' + '}', name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(: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 => 'PolyLineAnnotationsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#get_document_poly_line_annotations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_language_text_with_http_info(language_code, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: LanguagesApi#get_language_text ...\"\n end\n \n # verify the required parameter 'language_code' is set\n fail \"Missing the required parameter 'language_code' when calling get_language_text\" if language_code.nil?\n \n # resource path\n local_var_path = \"/languages/\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'languageCode'] = language_code\n query_params[:'key'] = opts[:'key'] if opts[:'key']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n 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 => 'LanguageDictionary')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LanguagesApi#get_language_text\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @line_items = LineItem.all\n end",
"def show\n @lineitem = Lineitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lineitem }\n end\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def getLines\n\t\t@lines\n\tend",
"def GetLocale id\n\n APICall(path: \"locales/#{id}.json\")\n\n end",
"def index\n @clothing_lines = ClothingLine.all\n end",
"def index\n @applied_lines = AppliedLine.all\n end",
"def new\n @line_item1 = LineItem1.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @line_item1 }\n end\n end",
"def show\n puts params.inspect.green\n\n @line_item = LineItem.find(params[:id])\n\n puts @line_items.inspect.magenta\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end",
"def index\n @time_lines = TimeLine.all\n end",
"def index\n @lineitems = Lineitem.all\n end",
"def index\n @line_items = LineItem.all\nend",
"def index\n @line_items = LineItem.all\nend",
"def show\n @item_line = ItemLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_line }\n end\n end",
"def index\n @verbs = Verb.active.to_a \n @lines = @lines.where(:verb_id => params[:verb_id]) unless params[:verb_id].nil? \n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lines }\n end\n end",
"def translate\n api = ENV['API']\n url = 'https://translation.googleapis.com/language/translate/v2?key='\n target_language = self.phrasebook.language.abbr\n input = self.phrase.input\n # byebug\n\n request = HTTParty.get(url + api + '&q=' + input + '&source=en' + '&target=' + target_language)\n response = JSON.parse(request.body)\n translation = response['data']['translations'][0]['translatedText']\n end",
"def show\n @sentence = Sentence.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sentence }\n end\n end",
"def index\n @line_details = LineDetail.all\n end",
"def lines\n invoice_lines\n end",
"def lines\n @lines\nend",
"def get_page_poly_line_annotations_with_http_info(name, page_number, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.get_page_poly_line_annotations ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.get_page_poly_line_annotations\"\n end\n # verify the required parameter 'page_number' is set\n if @api_client.config.client_side_validation && page_number.nil?\n fail ArgumentError, \"Missing the required parameter 'page_number' when calling PdfApi.get_page_poly_line_annotations\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/pages/{pageNumber}/annotations/polyline\".sub('{' + 'name' + '}', name.to_s).sub('{' + 'pageNumber' + '}', page_number.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(: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 => 'PolyLineAnnotationsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#get_page_poly_line_annotations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def orders_get_discount_line_with_http_info(id, discount_lines_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DiscountsApi.orders_get_discount_line ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling DiscountsApi.orders_get_discount_line\"\n end\n # verify the required parameter 'discount_lines_id' is set\n if @api_client.config.client_side_validation && discount_lines_id.nil?\n fail ArgumentError, \"Missing the required parameter 'discount_lines_id' when calling DiscountsApi.orders_get_discount_line\"\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/orders/{id}/discount_lines/{discount_lines_id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'discount_lines_id' + '}', CGI.escape(discount_lines_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/vnd.conekta-v2.1.0+json'])\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].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] || 'DiscountLinesResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"DiscountsApi.orders_get_discount_line\",\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: DiscountsApi#orders_get_discount_line\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def list_lines\n RailLine.list_lines\n end",
"def set_textline\n @textline = Textline.find(params[:id])\n end",
"def index\n @courses = Course.all.includes(:translations)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end",
"def get_routing_languages_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RoutingApi.get_routing_languages ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n if opts[:'sort_order'] && !['ascending', 'descending'].include?(opts[:'sort_order'])\n fail ArgumentError, 'invalid value for \"sort_order\", must be one of ascending, descending'\n end\n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/routing/languages\".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[:'sortOrder'] = opts[:'sort_order'] if opts[:'sort_order']\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 => 'LanguageEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RoutingApi#get_routing_languages\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @line_item }\n end\n end",
"def show\n\t\t@admin_translatee = Admin::Translatee.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render :json => @admin_translatee }\n\t\tend\n\tend",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end",
"def index\n @phone_lines = PhoneLine.all\n end",
"def index\n @lines = Line.where(user_id: current_user.id, diagram_id:@diagram.id, node_id:@node.id)\n end"
] | [
"0.76951754",
"0.68859345",
"0.65854",
"0.6497042",
"0.60961044",
"0.60878867",
"0.597386",
"0.59718657",
"0.5930492",
"0.5879088",
"0.5869152",
"0.5867966",
"0.5824931",
"0.58065444",
"0.58065444",
"0.5800783",
"0.5798388",
"0.5790964",
"0.5737335",
"0.56394184",
"0.56394184",
"0.56394184",
"0.56394184",
"0.5635445",
"0.56331813",
"0.56203896",
"0.5617472",
"0.5609067",
"0.55881345",
"0.5585848",
"0.55809444",
"0.5567214",
"0.55465734",
"0.55061096",
"0.5505493",
"0.5505493",
"0.5505493",
"0.5505493",
"0.5505493",
"0.5505493",
"0.5505493",
"0.55036795",
"0.54783106",
"0.5476952",
"0.54670215",
"0.5436261",
"0.5431483",
"0.54280823",
"0.541906",
"0.5417683",
"0.54146606",
"0.5401908",
"0.5398592",
"0.5398325",
"0.5398325",
"0.5398325",
"0.5398325",
"0.5398325",
"0.5398325",
"0.5398325",
"0.5398325",
"0.5398325",
"0.5398325",
"0.5398325",
"0.53845197",
"0.5372682",
"0.5363741",
"0.5342651",
"0.53359956",
"0.5335945",
"0.53330284",
"0.53295505",
"0.5311586",
"0.5311586",
"0.5303238",
"0.5301565",
"0.52987826",
"0.5284943",
"0.52844244",
"0.5276086",
"0.52707595",
"0.52595836",
"0.5257037",
"0.52495706",
"0.5246325",
"0.5243023",
"0.52396274",
"0.52389914",
"0.52345043",
"0.5233002",
"0.5233002",
"0.5233002",
"0.5233002",
"0.5233002",
"0.5233002",
"0.5233002",
"0.5233002",
"0.5233002",
"0.5233002",
"0.52247185",
"0.5223374"
] | 0.0 | -1 |
POST /translated_lines POST /translated_lines.json | def create
@translated_line = TranslatedLine.new(translated_line_params)
respond_to do |format|
if @translated_line.save
@translated_lines = TranslatedLine.where(translation_code: @translated_line.translation_code)
format.html { redirect_to @translated_line, notice: 'Translated line was successfully created.' }
format.js {}
format.json { render :show, status: :created, location: @translated_line }
else
format.html { render :new }
format.js {}
format.json { render json: @translated_line.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def translated_line_params\n params.require(:translated_line).permit(:translation_code, :description)\n end",
"def index\n @translated_lines = TranslatedLine.all\n end",
"def create\n @textline = Textline.new(textline_params)\n\n respond_to do |format|\n if @textline.save\n format.html { redirect_to @textline, notice: 'Textline was successfully created.' }\n format.json { render :show, status: :created, location: @textline }\n else\n format.html { render :new }\n format.json { render json: @textline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_translated_line\n @translated_line = TranslatedLine.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @translated_line.update(translated_line_params)\n format.html { redirect_to @translated_line, notice: 'Translated line was successfully updated.' }\n format.json { render :show, status: :ok, location: @translated_line }\n else\n format.html { render :edit }\n format.json { render json: @translated_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @line_item = @order.line_items.new(line_item_params)\n\n if @line_item.save\n render json: @line_item, status: :created, location: [@order, @line_item]\n else\n render json: @line_item.errors, status: :unprocessable_entity\n end\n end",
"def destroy\n @translated_line.destroy\n respond_to do |format|\n format.html { redirect_to translated_lines_url, notice: 'Translated line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @line = Line.new(line_params)\n\n respond_to do |format|\n if @line.save\n format.html { redirect_to @line, notice: \"Line was successfully created.\" }\n format.json { render :show, status: :created, location: @line }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @line = Line.new(line_params)\n\n respond_to do |format|\n if @line.save\n format.html { redirect_to new_line_path, notice: 'Line was successfully created. 5 points are awarded to your score.' }\n format.json { render json: @line, status: :created, location: @line }\n else\n format.html { render action: \"new\" }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order_line = OrderLine.new(params[:order_line])\n\n respond_to do |format|\n if @order_line.save\n format.html { redirect_to @order_line, notice: 'Order line was successfully created.' }\n format.json { render json: @order_line, status: :created, location: @order_line }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @payment = Payment.find(params[:payment_id])\n @payment_line = @payment.payment_lines.build(params[:payment_line])\n\n respond_to do |format|\n if @payment_line.save\n format.html { redirect_to([@payment_line.payment, @payment_line], :notice => 'Payment line was successfully created.') }\n format.json { render :json => @payment_line, :status => :created, :location => [@payment_line.payment, @payment_line] }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @payment_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @time_line = TimeLine.new(time_line_params)\n\n respond_to do |format|\n if @time_line.save\n format.html { redirect_to @time_line, notice: 'Time line was successfully created.' }\n format.json { render :show, status: :created, location: @time_line }\n else\n format.html { render :new }\n format.json { render json: @time_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_translation(key, lang, source, new_value)\n return true unless $REAL\n\n new_value_json = {\n 'target_language' => lang,\n 'type' => 'key',\n 'key' => key,\n 'source' => source,\n 'target' => new_value\n }.to_json\n # NOTE: This popen invocation does NOT go through the shell,\n # so we do not use shell escapes.\n # POST https://translation.io/api/v1/segments(.json)\n IO.popen(\n [\n 'curl', '-i',\n '-H', \"x-api-key: #{$API_KEY}\",\n '-H', 'content-type: application/json',\n '--request', 'POST',\n 'https://translation.io/api/v1/segments.json',\n '--data', new_value_json\n ]\n ) do |io|\n curl_output = io.read\n puts curl_output # Very useful for debugging!\n io.close\n $CHILD_STATUS.success? # Return whether or not we succeeded\n end\nend",
"def create\n @lineamiento = Lineamiento.new(lineamiento_params)\n\n respond_to do |format|\n if @lineamiento.save\n format.html { redirect_to @lineamiento, notice: 'Lineamiento was successfully created.' }\n format.json { render :show, status: :created, location: @lineamiento }\n else\n format.html { render :new }\n format.json { render json: @lineamiento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @line = Line.new(line_params)\n @line.user = current_user\n @line.diagram = @diagram\n @line.node = @node\n\n respond_to do |format|\n if @result = @line.valid?\n begin\n Line.transaction do\n @line.save!\n end\n format.html { redirect_to @line, notice: 'Line was successfully created.' }\n format.json { render :show, status: :created, location: @line }\n format.js\n rescue => e\n render :text => e.message\n end\n else\n format.html { render :new }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def fetch_translated_law\n\n con = Faraday.new\n\n res = con.post do |req|\n req.url 'https://api.deepl.com/v2/translate?auth_key='+ ENV[\"DEEPL_API\"],\n req.body = {text: self.name,\n target_lang: 'EN',\n source_lang: 'FR'\n }\n end\n self.translatedtext = JSON.parse(res.body)[\"translations\"][1][\"text\"]\n end",
"def create\n @applied_line = AppliedLine.new(applied_line_params)\n\n respond_to do |format|\n if @applied_line.save\n format.html { redirect_to @applied_line, notice: 'Applied line was successfully created.' }\n format.json { render :show, status: :created, location: @applied_line }\n else\n format.html { render :new }\n format.json { render json: @applied_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @line_item = LineItem.new(params[:line_item])\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to @line_item, notice: 'Line item was successfully created.' }\n format.json { render json: @line_item, status: :created, location: @line_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @linea = Linea.new(params[:linea])\n\n respond_to do |format|\n if @linea.save\n format.html { redirect_to(@linea, :notice => 'Linea creada correctamente.') }\n format.xml { render :xml => @linea, :status => :created, :location => @linea }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @linea.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create \n @line_item = LineItem.new(line_item_params)\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to '/line_items', notice: \"Line item was successfully created.\" }\n format.json { render :show, status: :created, location: @line_item }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_translations\n end",
"def create\n @item_line = ItemLine.new(params[:item_line])\n\n respond_to do |format|\n if @item_line.save\n format.html { redirect_to @item_line, notice: 'Item line was successfully created.' }\n format.json { render json: @item_line, status: :created, location: @item_line }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @phone_line = PhoneLine.new(phone_line_params)\n\n respond_to do |format|\n if @phone_line.save\n format.html { redirect_to phone_lines_url, notice: 'Phone line was successfully created.' }\n format.json { render :show, status: :created, location: @phone_line }\n else\n format.html { render :new }\n format.json { render json: @phone_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @code_line = CodeLine.new(code_line_params)\n\n respond_to do |format|\n if @code_line.save\n format.html { redirect_to @code_line, notice: 'Code line was successfully created.' }\n format.json { render :show, status: :created, location: @code_line }\n else\n format.html { render :new }\n format.json { render json: @code_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sample_line = SampleLine.new(params[:sample_line])\n\n respond_to do |format|\n if @sample_line.save\n format.html { redirect_to @sample_line, notice: 'Sample line was successfully created.' }\n format.json { render json: @sample_line, status: :created, location: @sample_line }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sample_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @purchase_order_item_line = PurchaseOrderItemLine.new(params[:purchase_order_item_line])\n\n respond_to do |format|\n if @purchase_order_item_line.save\n format.html { redirect_to @purchase_order_item_line, notice: 'Purchase order item line was successfully created.' }\n format.json { render json: @purchase_order_item_line, status: :created, location: @purchase_order_item_line }\n else\n format.html { render action: \"new\" }\n format.json { render json: @purchase_order_item_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def cow_order\n @order = Order.new\n @order.lines.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def create\n @liquidation_form_line = LiquidationFormLine.new(liquidation_form_line_params)\n\n respond_to do |format|\n if @liquidation_form_line.save\n format.html { redirect_to @liquidation_form_line, notice: 'Liquidation form line was successfully created.' }\n format.json { render :show, status: :created, location: @liquidation_form_line }\n else\n format.html { render :new }\n format.json { render json: @liquidation_form_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n parent_line_item = get_parent_line_item\n if parent_line_item\n @line_item = parent_line_item.dup\n @line_item.line_item = parent_line_item\n @line_item.searchable = false\n @line_item.admin_verified = false\n @line_item.section_id = line_item_params[\"section_id\"]\n else\n @line_item = LineItem.new(line_item_params);\n end\n\n if @line_item.save\n render json: @line_item, status: :created, location: @line_item\n else\n render nothing: true, status: :bad_request\n end\n end",
"def create\n @order_line = OrderLine.new(order_line_params)\n \n if @order_line.order_id.nil?\n @order_line.order_id = current_order.id\n @order_line.value = @order_line.product.price*@order_line.quantity\n @order_line.status = OrderLine.status_requested\n end\n respond_to do |format|\n if @order_line.save\n # inform client\n WebsocketRails['order_lines_'+@order_line.order.id.to_s].trigger 'new', {:order => @order_line.order, :order_line => @order_line, :product => @order_line.product}\n format.html { redirect_to @order_line, notice: 'Order line was successfully created.' }\n format.json { render :show, status: :created, location: @order_line }\n else\n format.html { render :new }\n format.json { render json: @order_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_conversations_messaging_integrations_line_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ConversationsApi.post_conversations_messaging_integrations_line ...\"\n end\n \n \n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling ConversationsApi.post_conversations_messaging_integrations_line\" if body.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/conversations/messaging/integrations/line\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'LineIntegration')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConversationsApi#post_conversations_messaging_integrations_line\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n #@line = Line.new(params[:line])\n\n @line = current_user.lines.build(params[:line])\n respond_to do |format|\n if @line.save\n\n\nif @line.parent_id\n\nuser_id = Line.find(@line.parent_id).user_id\n@user_parent = User.find(user_id)\n@user_parent.messages.create!(:line_id => @line.id)\nend\n format.html {\n\n redirect_to lines_path, :flash => { :success => \"line created!\" } }\n format.xml { render :xml => @line, :status => :created, :location => @line }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @translator = Translator.new(translator_params)\n\n respond_to do |format|\n if @translator.save\n format.html { redirect_to @translator, notice: 'Translator was successfully created' }\n format.json { render :show, status: :created, location: @translator }\n else\n format.html { render :new }\n format.json { render json: @translator.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @storyline = Storyline.new(params[:storyline])\n @start_id = params[:start_id]\n rand_prev = params[:randomize].blank? ? nil : @storyline.prev\n @first_line, @storyline, lines, ids = insert_lines @storyline\n respond_to do |format|\n if @storyline.save\n format.js\n format.html { redirect_to storyline_path(@first_line, :prev_end => rand_prev), notice: 'Storyline was successfully created.' }\n format.json { render json: [@first_line], status: :created, location: @first_line }\n else\n format.js\n format.html { render action: \"new\" }\n format.json { render json: @storyline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @example_translation = ExampleTranslation.new(example_translation_params)\n\n respond_to do |format|\n if @example_translation.save\n format.html { redirect_to @example_translation, notice: 'Example translation was successfully created.' }\n format.json { render :show, status: :created, location: @example_translation }\n else\n format.html { render :new }\n format.json { render json: @example_translation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invent_journal_line = InventJournalLine.new(params[:invent_journal_line])\n\n respond_to do |format|\n if @invent_journal_line.save\n format.html { redirect_to @invent_journal_line, notice: 'Invent journal line was successfully created.' }\n format.json { render json: @invent_journal_line, status: :created, location: @invent_journal_line }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invent_journal_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trade_line = TradeLine.new(trade_line_params)\n\n respond_to do |format|\n if @trade_line.save\n format.html { redirect_to @trade_line, notice: 'Trade line was successfully created.' }\n format.json { render action: 'show', status: :created, location: @trade_line }\n else\n format.html { render action: 'new' }\n format.json { render json: @trade_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def line_detail_params\n params.require(:line_detail).permit(:title, :description, :line_id, :country_id)\n end",
"def create\n @quote_line = QuoteLine.new(quote_line_params)\n\n respond_to do |format|\n if @quote_line.save\n format.html { redirect_to @quote_line, notice: 'Quote line was successfully created.' }\n format.json { render action: 'show', status: :created, location: @quote_line }\n else\n format.html { render action: 'new' }\n format.json { render json: @quote_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @search_line = SearchLine.new(search_line_params)\n\n respond_to do |format|\n if @search_line.save\n format.html { redirect_to @search_line, notice: 'Search line was successfully created.' }\n format.json { render :show, status: :created, location: @search_line }\n else\n format.html { render :new }\n format.json { render json: @search_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @line_liver = LineLiver.new(line_liver_params)\n\n respond_to do |format|\n if @line_liver.save\n format.html { redirect_to @line_liver, notice: 'Line liver was successfully created.' }\n format.json { render :show, status: :created, location: @line_liver }\n else\n format.html { render :new }\n format.json { render json: @line_liver.errors, status: :unprocessable_entity }\n end\n end\n end",
"def line_params\n params.require(:line).permit(:next_node_id, :description)\n end",
"def update\n respond_to do |format|\n if @textline.update(textline_params)\n format.html { redirect_to @textline, notice: 'Textline was successfully updated.' }\n format.json { render :show, status: :ok, location: @textline }\n else\n format.html { render :edit }\n format.json { render json: @textline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @translation_key = Multilang::TranslationKey.new translation_key_params\n @translation_key.tap(&:save).create_translations\n respond_to do |format|\n format.html { redirect_to translations_path }\n format.js\n end\n end",
"def create\n @clothing_line = ClothingLine.new(clothing_line_params)\n\n respond_to do |format|\n if @clothing_line.save\n format.html { redirect_to @clothing_line, notice: 'Clothing line was successfully created.' }\n format.json { render :show, status: :created, location: @clothing_line }\n else\n format.html { render :new }\n format.json { render json: @clothing_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product_line = ProductLine.new(params[:product_line])\n\n respond_to do |format|\n if @product_line.save\n format.html { redirect_to @product_line, notice: 'Product line was successfully created.' }\n format.json { render json: @product_line, status: :created, location: @product_line }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @line = Line.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line }\n end\n end",
"def new\r\n template=params[:survey_template_id]\r\n @survey_template=SurveyTemplate.find(template)\r\n @survey_response = SurveyResponse.new(:survey_template_id => @survey_template.id, :user_id=>current_user.id, :azienda=>current_user.username)\r\n @survey_template.survey_template_lines.roots.each do |r|\r\n @survey_response.survey_response_lines.build(:survey_template_line_id=>r.id)\r\n r.children.each do |l|\r\n @survey_response.survey_response_lines.build(:survey_template_line_id=>l.id)\r\n end\r\n\r\n end\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @survey_response }\r\n end\r\n end",
"def create\n @route_line = RouteLine.new(params[:route_line])\n\n respond_to do |format|\n if @route_line.save\n format.html { redirect_to(@route_line, :notice => t('record_created')) }\n format.xml { render :xml => @route_line, :status => :created, :location => @route_line }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @route_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @tagline = Tagline.new(params[:tagline])\n\n respond_to do |format|\n if @tagline.save\n flash[:notice] = 'Tagline was successfully created.'\n format.html { redirect_to(@tagline) }\n format.xml { render :xml => @tagline, :status => :created, :location => @tagline }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tagline.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @line.attributes = line_params\n respond_to do |format|\n if @result = @line.valid?\n begin\n Line.transaction do\n @line.save!\n end\n format.html { redirect_to @line, notice: 'Line was successfully updated.' }\n format.json { render :show, status: :ok, location: @line }\n format.js\n rescue => e\n render :text => e.message\n end\n else\n format.html { render :edit }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def create\n @customer_quote = CustomerQuote.find(params[:customer_quote_id])\n params[:customer_quote_line][:item_name_sub] = params[:alt_name_id]\n @customer_quote_line = @customer_quote.customer_quote_lines.build(customer_quote_line_params)\n @attachable = @customer_quote\n\n respond_to do |format|\n if @customer_quote_line.save\n format.html { redirect_to new_customer_quote_customer_quote_line_path(@customer_quote), :notice => 'Customer quote line was successfully created.' }\n format.json { render :json => @customer_quote_line, :status => :created, :location => [@customer_quote_line.customer_quote, @customer_quote_line] }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @customer_quote_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @payment = Payment.find(params[:payment_id])\n @payment_line = @payment.payment_lines.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @payment_line }\n end\n end",
"def line_params\r\n params.require(:line).permit(:name)\r\n end",
"def create\n @linea_uv = LineaUv.new(linea_uv_params)\n\n respond_to do |format|\n if @linea_uv.save\n format.html { redirect_to @linea_uv, notice: 'Linea uv was successfully created.' }\n format.json { render :show, status: :created, location: @linea_uv }\n else\n format.html { render :new }\n format.json { render json: @linea_uv.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @line_detail = LineDetail.new(line_detail_params)\n generate_id\n respond_to do |format|\n if @line_detail.save\n format.html { redirect_to @line_detail, notice: 'Line detail was successfully created.' }\n format.json { render action: 'show', status: :created, location: @line_detail }\n else\n format.html { render action: 'new' }\n format.json { render json: @line_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @linehaul = Linehaul.new(linehaul_params)\n\n respond_to do |format|\n if @linehaul.save\n format.html { redirect_to linehauls_path, notice: 'Linehaul was successfully created.' }\n format.json { render :show, status: :created, location: @linehaul }\n else\n format.html { render :new }\n format.json { render json: @linehaul.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @line = Line.new(params[:line])\n @line.budget_id = params[:budget_id]\n @budget = @line.budget\n\n respond_to do |format|\n if @line.save\n format.html { redirect_to budget_path(@budget), notice: 'Line was successfully created.' }\n format.json { render json: @line, status: :created, location: @line }\n else\n format.html { render action: \"new\" }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @line_up = LineUp.new(line_up_params)\n\n respond_to do |format|\n if @line_up.save\n format.html { redirect_to @line_up, notice: 'Line up was successfully created.' }\n format.json { render :show, status: :created, location: @line_up }\n else\n format.html { render :new }\n format.json { render json: @line_up.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page_translation = PageTranslation.new(page_translation_params)\n\n respond_to do |format|\n if @page_translation.save\n format.html { redirect_to @page_translation, notice: 'Page translation was successfully created.' }\n format.json { render :show, status: :created, location: @page_translation }\n else\n format.html { render :new }\n format.json { render json: @page_translation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@admin_translatee = Admin::Translatee.new(params[:admin_translatee])\n\n\t\trespond_to do |format|\n\t\t\tif @admin_translatee.save\n\t\t\t\tformat.html { redirect_to @admin_translatee, :notice => 'Translatee was successfully created.' }\n\t\t\t\tformat.json { render :json => @admin_translatee, :status => :created, :location => @admin_translatee }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.json { render :json => @admin_translatee.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @lineup = Lineup.new(params[:lineup])\n\n respond_to do |format|\n if @lineup.save\n format.html { redirect_to @lineup, notice: 'Lineup was successfully created.' }\n format.json { render json: @lineup, status: :created, location: @lineup }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lineup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_textline\n @textline = Textline.find(params[:id])\n end",
"def create\n @weekline = Weekline.new(params[:weekline])\n\n respond_to do |format|\n if @weekline.save\n format.html { redirect_to @weekline, notice: 'Weekline was successfully created.' }\n format.json { render json: @weekline, status: :created, location: @weekline }\n else\n format.html { render action: \"new\" }\n format.json { render json: @weekline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def textline_params\n params.require(:textline).permit(:element_id, :string)\n end",
"def create\n @translation = Translation.new(params[:translation])\n\n respond_to do |format|\n if @translation.save\n format.html { redirect_to @translation, notice: 'Translation was successfully created.' }\n format.json { render json: @translation, status: :created, location: @translation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @translation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @order_line = OrderLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order_line }\n end\n end",
"def test_send_string_in_form_with_new_line1()\n # Parameters for the API call\n body = TestNstringEncoding.from_hash(APIHelper.json_deserialize(\n '{\"name\":\"farhan\",\"field\":\"QA\"}'\n ))\n\n # Perform the API call through the SDK function\n result = @controller.send_string_in_form_with_new_line(body)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end",
"def post_page_poly_line_annotations_with_http_info(name, page_number, annotations, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.post_page_poly_line_annotations ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.post_page_poly_line_annotations\"\n end\n # verify the required parameter 'page_number' is set\n if @api_client.config.client_side_validation && page_number.nil?\n fail ArgumentError, \"Missing the required parameter 'page_number' when calling PdfApi.post_page_poly_line_annotations\"\n end\n # verify the required parameter 'annotations' is set\n if @api_client.config.client_side_validation && annotations.nil?\n fail ArgumentError, \"Missing the required parameter 'annotations' when calling PdfApi.post_page_poly_line_annotations\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/pages/{pageNumber}/annotations/polyline\".sub('{' + 'name' + '}', name.to_s).sub('{' + 'pageNumber' + '}', page_number.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n\n # http body (model)\n post_body = @api_client.object_to_http_body(annotations)\n auth_names = ['JWT']\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 => 'AsposeResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#post_page_poly_line_annotations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def ms_translate(text)\n https = Net::HTTP.new(@uri.host, @uri.port)\n https.use_ssl = true\n begin\n req = Net::HTTP::Post.new(@uri.request_uri, @headers)\n req.body = [{ 'Text' => text }].to_json\n response = https.request(req)\n return response_body(response)\n rescue StandardError => ex\n puts \"ERROR: #{ex.message}\"\n end\n end",
"def index\n @line_items = @order.line_items\n\n render json: @line_items\n end",
"def create\n @invoice_adjustment_line = InvoiceAdjustmentLine.new(params[:invoice_adjustment_line])\n\n respond_to do |format|\n if @invoice_adjustment_line.save\n flash[:notice] = 'InvoiceAdjustmentLine was successfully created.'\n format.html { redirect_to(@invoice_adjustment_line) }\n format.xml { render :xml => @invoice_adjustment_line, :status => :created, :location => @invoice_adjustment_line }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @invoice_adjustment_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def line_params\n params.require(:line).permit(:name, :description, :user_id, :board_id)\n end",
"def create\n @sentence = Sentence.new(sentence_params)\n\n respond_to do |format|\n if @sentence.save\n format.html { redirect_to @sentence, notice: 'Sentence was successfully created.' }\n format.json { render json: @sentence, status: :created, location: @sentence }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sentence.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sub1_line_item = Sub1LineItem.new(sub1_line_item_params)\n\n respond_to do |format|\n if @sub1_line_item.save\n format.html { redirect_to @sub1_line_item, notice: 'Sub1 line item was successfully created.' }\n format.json { render :show, status: :created, location: @sub1_line_item }\n else\n format.html { render :new }\n format.json { render json: @sub1_line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sentence = Sentence.new(sentence_params)\n\n respond_to do |format|\n if @sentence.save\n format.html { redirect_to @sentence, notice: 'Sentence was successfully created.' }\n format.json { render :show, status: :created, location: @sentence }\n else\n format.html { render :new }\n format.json { render json: @sentence.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cruise_line = CruiseLine.new(cruise_line_params)\n\n respond_to do |format|\n if @cruise_line.save\n format.html { redirect_to @cruise_line, notice: 'Cruise line was successfully created.' }\n format.json { render :show, status: :created, location: @cruise_line }\n else\n format.html { render :new }\n format.json { render json: @cruise_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invoice_addon_line_item = InvoiceAddonLineItem.new(invoice_addon_line_item_params)\n\n respond_to do |format|\n if @invoice_addon_line_item.save\n format.html { redirect_to @invoice_addon_line_item.invoice, notice: 'Invoice addon line item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @invoice_addon_line_item }\n else\n format.html { render action: 'new' }\n format.json { render json: @invoice_addon_line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @service_translation = ServiceTranslation.new(service_translation_params)\r\n\r\n respond_to do |format|\r\n if @service_translation.save\r\n format.html { redirect_to @service_translation, notice: 'Serviço de traduções criado com sucesso.' }\r\n format.json { render action: 'show', status: :created, location: @service_translation }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @service_translation.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def save_lines\n detail_lines.save_line \n end",
"def create\n company_name = params[:liner][:company_name]\n company = Company.find_or_create_by name: company_name\n @liner = company.liners.new(liner_params)\n\n respond_to do |format|\n if @liner.save\n format.html { redirect_to @liner, notice: 'Liner was successfully created.' }\n format.json { render :show, status: :created, location: @liner }\n else\n format.html { render :new }\n format.json { render json: @liner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @transport_line = TransportLine.new(params[:transport_line])\n\n respond_to do |format|\n if @transport_line.save\n flash[:notice] = 'TransportLine was successfully created.'\n format.html { redirect_to(@transport_line) }\n format.xml { render :xml => @transport_line, :status => :created, :location => @transport_line }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @transport_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @contract_service_line = ContractServiceLine.new(contract_service_line_params)\n\n respond_to do |format|\n if @contract_service_line.save\n format.html { redirect_to @contract_service_line, notice: 'Contract service line was successfully created.' }\n format.json { render :show, status: :created, location: @contract_service_line }\n else\n format.html { render :new }\n format.json { render json: @contract_service_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line.update(line_params)\n format.html { redirect_to @line, notice: \"Line was successfully updated.\" }\n format.json { render :show, status: :ok, location: @line }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def line_params\n params.require(:line).permit(:user_id, :verb_id, :start_time, \n :note, :object, :people, :photo, :place, :price, :url)\n end",
"def create\n @promotion = current_shop_owner.promotions.new(promotion_params.merge(customer_ids: customer_ids))\n\n # @promotion.translate(@promotion.body)\n\n# make notes that belong to the current shop owner\n respond_to do |format|\n if @promotion.save\n format.html { redirect_to shop_owner_promotion_path(current_shop_owner,@promotion), notice: 'Promotion was successfully created.' }\n # send_text.promotion\n format.json { render :show, status: :created, location: @promotion }\n else\n format.html { render :new }\n format.json { render json: @promotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n set_assoc_work_param()\n @transcription = Transcription.new(params[:transcription])\n\n respond_to do |format|\n if @transcription.save\n int_rebuild_value = \"0\"\n if (params[:rebuild])\n int_rebuild_value = params[:rebuild]\n end\n if int_rebuild_value.to_i > 0\n int_tei_ret = doeditiontei(@transcription.digital_edition_id)\n end\n arr_prev_page_data = get_prev_page_last_line_data(@transcription.page_id)\n do_page_lines(arr_prev_page_data[0], arr_prev_page_data[1], @transcription.page_id)\n dopagetei(@transcription.page_id)\n str_redirect_link = \"/pages/\"+@transcription.page_id.to_s+\"/edit?notice=New%20Transcription%20Saved%20With%20ID%20\"+@transcription.id.to_s\n format.html { redirect_to str_redirect_link }\n format.json { render json: @transcription, status: :created, location: @transcription }\n else\n format.html { render action: \"new\" }\n format.json { render json: @transcription.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @journal_line = JournalLine.new(params[:journal_line])\n\n respond_to do |format|\n if @journal_line.save\n flash[:notice] = 'JournalLine was successfully created.'\n format.html { redirect_to(@journal_line) }\n format.xml { render :xml => @journal_line, :status => :created, :location => @journal_line }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @journal_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @line_item = LineItem.new(params[:line_item])\n @line_item.price = @line_item.catalog_item.unit_price\n \n respond_to do |format|\n if @line_item.save\n \n flash[:notice] = 'LineItem was successfully created.'\n format.html { redirect_to(@line_item) }\n format.xml { render :xml => @line_item, :status => :created, :location => @line_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @line_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @newsline = Newsline.new(newsline_params)\n\n respond_to do |format|\n if @newsline.save\n format.html { redirect_to @newsline, notice: 'Newsline was successfully created.' }\n format.json { render :show, status: :created, location: @newsline }\n else\n format.html { render :new }\n format.json { render json: @newsline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def request_translations(texts, options = T.unsafe(nil), http_options = T.unsafe(nil)); end",
"def cont_trans_sentence_english_params\n params.require(:cont_trans_sentence_english).permit(:name, :lesson_id, :sentence, :translation, :answer)\n end",
"def orders_create_discount_line_with_http_info(id, order_discount_lines_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DiscountsApi.orders_create_discount_line ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling DiscountsApi.orders_create_discount_line\"\n end\n # verify the required parameter 'order_discount_lines_request' is set\n if @api_client.config.client_side_validation && order_discount_lines_request.nil?\n fail ArgumentError, \"Missing the required parameter 'order_discount_lines_request' when calling DiscountsApi.orders_create_discount_line\"\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/orders/{id}/discount_lines'.sub('{' + 'id' + '}', CGI.escape(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/vnd.conekta-v2.1.0+json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(order_discount_lines_request)\n\n # return_type\n return_type = opts[:debug_return_type] || 'DiscountLinesResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"DiscountsApi.orders_create_discount_line\",\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: DiscountsApi#orders_create_discount_line\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @content_translation = ContentTranslation.new(params[:content_translation])\n\n respond_to do |format|\n if @content_translation.save\n format.html { redirect_to @content_translation, notice: 'Content translation was successfully created.' }\n format.json { render json: @content_translation, status: :created, location: @content_translation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @content_translation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shipping_line = ShippingLine.new(params[:shipping_line])\n\n respond_to do |format|\n if @shipping_line.save\n format.html { redirect_to @shipping_line, :notice => 'Shipping line was successfully created.' }\n format.json { render :json => @shipping_line, :status => :created, :location => @shipping_line }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @shipping_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @invoice_line_item = InvoiceLineItem.new(params.require(:invoice_line_item).permit(:amount, :description, :invoice_id, :line_item_purpose_id, :service_visit_id, :vehicle_id))\n\n respond_to do |format|\n if @invoice_line_item.save\n format.html { redirect_to invoice_line_items_url,\n notice: 'InvoiceLineItem was successfully created.' }\n format.json { render json: @invoice_line_item, status: :created, location: @invoice_line_item }\n else\n prepFormVariables\n format.html { render action: \"new\" }\n format.json { render json: @invoice_line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def collect_order_line(shop_id, order_id, order_line)\n request(:post, \"shops/#{shop_id}/orders/#{order_id}/order_lines\", body: order_line).tap do |response|\n raise InvalidResponse, response.body unless response.status == 201\n end\n end",
"def createdtranslation_params\n params.require(:createdtranslation).permit(:totranslate, :translated, :language1, :language2, :title, :creator_id_id)\n end",
"def create\n @texi_route = TexiRoute.new(texi_route_params)\n\n respond_to do |format|\n if @texi_route.save\n format.html { redirect_to @texi_route, notice: 'Texi route was successfully created.' }\n format.json { render :show, status: :created, location: @texi_route }\n else\n format.html { render :new }\n format.json { render json: @texi_route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @translated_file = TranslatedFile.new(translated_file_params)\n\n respond_to do |format|\n if @translated_file.save\n format.html { redirect_to @translated_file, notice: 'Translated file was successfully created.' }\n format.json { render :show, status: :created, location: @translated_file }\n else\n format.html { render :new }\n format.json { render json: @translated_file.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6830107",
"0.6629822",
"0.6466715",
"0.6433577",
"0.64027274",
"0.6105049",
"0.6046207",
"0.603598",
"0.59943044",
"0.5929162",
"0.5917073",
"0.5837867",
"0.5811325",
"0.57427025",
"0.5715672",
"0.5670065",
"0.5664622",
"0.561393",
"0.5608419",
"0.55941063",
"0.5585981",
"0.5556742",
"0.555548",
"0.5510244",
"0.55072516",
"0.55045676",
"0.5489262",
"0.5471463",
"0.54551053",
"0.5447671",
"0.5447118",
"0.54283917",
"0.542569",
"0.54077494",
"0.5383661",
"0.53740597",
"0.53682935",
"0.5357551",
"0.53455275",
"0.53383905",
"0.5333032",
"0.53319854",
"0.53304857",
"0.5311586",
"0.53103715",
"0.53035796",
"0.52976364",
"0.52953684",
"0.52900475",
"0.52876246",
"0.5249335",
"0.5244092",
"0.52371144",
"0.5214927",
"0.52114975",
"0.51924175",
"0.5191223",
"0.5187648",
"0.51843023",
"0.51812345",
"0.5180844",
"0.5175064",
"0.51692486",
"0.51678693",
"0.51678693",
"0.51504433",
"0.5132256",
"0.51206374",
"0.51203644",
"0.51186717",
"0.51073045",
"0.5107186",
"0.5102919",
"0.50943625",
"0.50936425",
"0.50921863",
"0.507982",
"0.5074711",
"0.50745946",
"0.50724196",
"0.5070398",
"0.50658107",
"0.506355",
"0.5061795",
"0.5059351",
"0.50588906",
"0.5047827",
"0.50464916",
"0.5041142",
"0.5020426",
"0.5018993",
"0.5015095",
"0.50141484",
"0.50101817",
"0.5007564",
"0.5001152",
"0.49980152",
"0.4993128",
"0.4982975",
"0.49828425"
] | 0.73388076 | 0 |
PATCH/PUT /translated_lines/1 PATCH/PUT /translated_lines/1.json | def update
respond_to do |format|
if @translated_line.update(translated_line_params)
format.html { redirect_to @translated_line, notice: 'Translated line was successfully updated.' }
format.json { render :show, status: :ok, location: @translated_line }
else
format.html { render :edit }
format.json { render json: @translated_line.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @line = Line.find(params[:id])\n\n respond_to do |format|\n if @line.update_attributes(line_params)\n format.html { redirect_to new_line_path, notice: 'Line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render verb: \"edit\" }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @textline.update(textline_params)\n format.html { redirect_to @textline, notice: 'Textline was successfully updated.' }\n format.json { render :show, status: :ok, location: @textline }\n else\n format.html { render :edit }\n format.json { render json: @textline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line.update(line_params)\n format.html { redirect_to @line, notice: \"Line was successfully updated.\" }\n format.json { render :show, status: :ok, location: @line }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order_line = OrderLine.find(params[:id])\n\n respond_to do |format|\n if @order_line.update_attributes(params[:order_line])\n format.html { redirect_to @order_line, notice: 'Order line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @line = Line.find_by_no(params[:id])\n\n respond_to do |format|\n if @line.update_attributes(params[:line])\n format.html { redirect_to @line, notice: 'Line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_translated_line\n @translated_line = TranslatedLine.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @order_line.update(order_line_params)\n format.html { redirect_to @order_line, notice: 'Order line was successfully updated.' }\n format.json { render :show, status: :ok, location: @order_line }\n else\n format.html { render :edit }\n format.json { render json: @order_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @line = Line.find(params[:id])\n\n respond_to do |format|\n if @line.update_attributes(params[:line])\n format.html { redirect_to(@line, :notice => 'Line was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item1 = LineItem1.find(params[:id])\n\n respond_to do |format|\n if @line_item1.update_attributes(params[:line_item1])\n format.html { redirect_to @line_item1, :notice => 'Line item1 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @line_item1.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @applied_line.update(applied_line_params)\n format.html { redirect_to @applied_line, notice: 'Applied line was successfully updated.' }\n format.json { render :show, status: :ok, location: @applied_line }\n else\n format.html { render :edit }\n format.json { render json: @applied_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\told_lyric = LyricLine.find params[:id]\n\t\ttext = params[:lyric_line][:text]\n\t\tp text\n\t\tif text.length < 1 || text == old_lyric.text || !/\\w/.match(text)\n\t\t\t# don't save, add line back\n\t\t\t@placeholder = 'please enter a line'\n\t\t\tdump_line old_lyric\t\n\t\telse\n\t\t\tlyric_line = LyricLine.new params[:lyric_line]\n\t\t\tlyric_line.version_number = get_next_version( lyric_line )\n\t\t\tlyric_line.save\n\t\t\t@first = params[:first]\n\t\t\tdump_line lyric_line\n\t\tend\n\tend",
"def update\n @line.attributes = line_params\n respond_to do |format|\n if @result = @line.valid?\n begin\n Line.transaction do\n @line.save!\n end\n format.html { redirect_to @line, notice: 'Line was successfully updated.' }\n format.json { render :show, status: :ok, location: @line }\n format.js\n rescue => e\n render :text => e.message\n end\n else\n format.html { render :edit }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_liver.update(line_liver_params)\n format.html { redirect_to @line_liver, notice: 'Line liver was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_liver }\n else\n format.html { render :edit }\n format.json { render json: @line_liver.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item = @order.line_items.find(params[:id])\n\n if @line_item.update(line_item_params)\n head :no_content\n else\n render json: @line_item.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @line_detail.update(line_detail_params)\n format.html { redirect_to @line_detail, notice: 'Line detail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @line_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @item_line = ItemLine.find(params[:id])\n\n respond_to do |format|\n if @item_line.update_attributes(params[:item_line])\n format.html { redirect_to @item_line, notice: 'Item line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to @line_item, :notice => 'Line item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @line_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @payment = Payment.find(params[:payment_id])\n @payment_line = @payment.payment_lines.find(params[:id])\n\n respond_to do |format|\n if @payment_line.update_attributes(params[:payment_line])\n format.html { redirect_to([@payment_line.payment, @payment_line], :notice => 'Payment line was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @payment_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @sample_line = SampleLine.find(params[:id])\n\n respond_to do |format|\n if @sample_line.update_attributes(params[:sample_line])\n format.html { redirect_to @sample_line, notice: 'Sample line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sample_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @time_line.update(time_line_params)\n format.html { redirect_to @time_line, notice: 'Time line was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_line }\n else\n format.html { render :edit }\n format.json { render json: @time_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @linea = Linea.find(params[:id])\n\n respond_to do |format|\n if @linea.update_attributes(params[:linea])\n format.html { redirect_to(@linea, :notice => 'Linea actualizada correctamente.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @linea.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line.update(line_params)\n format.html { redirect_to attachment_line_list_path(@line.attachment), notice: 'Line was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n @translated_word = TranslatedWord.find(params[:id])\n\n respond_to do |format|\n if @translated_word.update_attributes(params[:translation])\n format.json { head :no_content }\n else\n format.json { render :json => @translated_word.errors,\n :status => :unprocessable_entity }\n end\n\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_items.update(line_item_params)\n format.html { redirect_to @line_items, notice: 'Line item was successfully updated.' }\n format.json { render json: :show, status: :ok, location: @line_item }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line_items.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @clothing_line.update(clothing_line_params)\n format.html { redirect_to @clothing_line, notice: 'Clothing line was successfully updated.' }\n format.json { render :show, status: :ok, location: @clothing_line }\n else\n format.html { render :edit }\n format.json { render json: @clothing_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @so_header = SoHeader.find(params[:so_header_id])\n @so_line = @so_header.so_lines.find(params[:id])\n\n respond_to do |format|\n if @so_line.update_attributes(params[:so_line])\n format.html { redirect_to(new_so_header_so_line_path(@so_header), :notice => 'So line was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @so_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @phone_line.update(phone_line_params)\n format.html { redirect_to @phone_line, notice: 'Phone line was successfully updated.' }\n format.json { render :show, status: :ok, location: @phone_line }\n else\n format.html { render :edit }\n format.json { render json: @phone_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @chatline = Chatline.find(params[:id])\n\n respond_to do |format|\n if @chatline.update_attributes(params[:chatline])\n format.html { redirect_to @chatline, notice: 'Chatline was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chatline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @route_line = RouteLine.find(params[:id])\n\n respond_to do |format|\n if @route_line.update_attributes(params[:route_line])\n format.html { redirect_to(@route_line, :notice => t('record_updated')) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @route_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @line = Line.find(params[:id])\n @budget = @line.budget\n\n respond_to do |format|\n if @line.update_attributes(params[:line])\n format.html { redirect_to budget_path(@budget), notice: 'Line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n\r\n data = params.except(:action, :controller, :options)\r\n options = params[:options]\r\n translations = GetPomo::PoFile.parse(File.read(\"#{Rails.root}/po/#{options[\"locale\"]}/#{APP_SID}.po\"))\r\n\r\n # Find translation\r\n\r\n @locale = translations.find { |t| t.comment == data[\"comment\"] }\r\n index = translations.find_index(@locale)\r\n\r\n # Edit translation\r\n\r\n @locale.msgid = data[\"msgid\"]\r\n @locale.msgstr = data[\"msgstr\"]\r\n @locale.comment = data[\"comment\"]\r\n if data.has_key?(\"fuzzy\") and data[\"fuzzy\"] == \"on\"\r\n @locale.comment += \", fuzzy\\n\" if @locale.fuzzy?.nil?\r\n else\r\n @locale.comment.slice! \", fuzzy\\n\" unless @locale.fuzzy?.nil?\r\n end\r\n\r\n # Replace translation\r\n\r\n translations[index] = @locale\r\n\r\n # Create delayed job to rewrite the PO file asynchronously\r\n\r\n Delayed::Job.enqueue WritePo.new(options[\"locale\"], GetPomo::PoFile.to_text(translations))\r\n render :json => @locale\r\n end",
"def update\n @purchase_order_item_line = PurchaseOrderItemLine.find(params[:id])\n\n respond_to do |format|\n if @purchase_order_item_line.update_attributes(params[:purchase_order_item_line])\n format.html { redirect_to @purchase_order_item_line, notice: 'Purchase order item line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @purchase_order_item_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @invent_journal_line = InventJournalLine.find(params[:id])\n\n respond_to do |format|\n if @invent_journal_line.update_attributes(params[:invent_journal_line])\n format.html { redirect_to @invent_journal_line, notice: 'Invent journal line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invent_journal_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\nend",
"def update\n @lineitem = Lineitem.find(params[:id])\n\n respond_to do |format|\n if @lineitem.update_attributes(params[:lineitem])\n format.html { redirect_to @lineitem, notice: 'Lineitem was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lineitem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sub1_line_item.update(sub1_line_item_params)\n format.html { redirect_to @sub1_line_item, notice: 'Sub1 line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @sub1_line_item }\n else\n format.html { render :edit }\n format.json { render json: @sub1_line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit } \n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def change_translation(id, new_value)\n # puts(\"#{id} : #{new_value}\")\n # Add the following line to prevent ACTUAL changing of the translation:\n # return true\n new_value_json = { 'target' => new_value }.to_json\n # Note: This popen invocation does NOT go through the shell,\n # so we do not use shell escapes.\n IO.popen(\n [\n 'curl', '-i',\n '-H', \"x-api-key: #{API_KEY}\",\n '-H', 'content-type: application/json',\n '--request', 'PATCH',\n \"https://translation.io/api/v1/segments/#{id}.json\",\n '--data', new_value_json\n ]\n ) do |io|\n curl_output = io.read\n puts curl_output # Very useful for debugging!\n io.close\n $CHILD_STATUS.success? # Return whether or not we succeeded\n end\nend",
"def update\n respond_to do |format|\n if @lineamiento.update(lineamiento_params)\n format.html { redirect_to @lineamiento, notice: 'Lineamiento was successfully updated.' }\n format.json { render :show, status: :ok, location: @lineamiento }\n else\n format.html { render :edit }\n format.json { render json: @lineamiento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: \"Line item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: \"Line item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contract_service_line.update(contract_service_line_params)\n format.html { redirect_to @contract_service_line, notice: 'Contract service line was successfully updated.' }\n format.json { render :show, status: :ok, location: @contract_service_line }\n else\n format.html { render :edit }\n format.json { render json: @contract_service_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: \"Line item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\nend",
"def update\n respond_to do |format|\n if @quote_line.update(quote_line_params)\n format.html { redirect_to @quote_line, notice: 'Quote line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @quote_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @code_line.update(code_line_params)\n format.html { redirect_to @code_line, notice: 'Code line was successfully updated.' }\n format.json { render :show, status: :ok, location: @code_line }\n else\n format.html { render :edit }\n format.json { render json: @code_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to(@line_item, :notice => 'Line item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @line_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product_line = ProductLine.find(params[:id])\n\n respond_to do |format|\n if @product_line.update_attributes(params[:product_line])\n format.html { redirect_to @product_line, notice: 'Product line was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item = @line_items.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to @cart.shop, notice: t(\"line_items.update.notice_success\") }\n else\n format.html { render action: \"edit\" }\n end\n end\n end",
"def translated_line_params\n params.require(:translated_line).permit(:translation_code, :description)\n end",
"def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to(@line_item, :notice => 'Line item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @line_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trade_line.update(trade_line_params)\n format.html { redirect_to @trade_line, notice: 'Trade line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trade_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @extension_line = ExtensionLine.find(params[:id])\n\n respond_to do |format|\n if @extension_line.update_attributes(params[:extension_line])\n format.html { redirect_to @extension_line, notice: 'Extension was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @extension_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_case.update(line_case_params)\n format.html { redirect_to @line_case, notice: 'Line case was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_case }\n else\n format.html { render :edit }\n format.json { render json: @line_case.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @liquidation_form_line.update(liquidation_form_line_params)\n format.html { redirect_to @liquidation_form_line, notice: 'Liquidation form line was successfully updated.' }\n format.json { render :show, status: :ok, location: @liquidation_form_line }\n else\n format.html { render :edit }\n format.json { render json: @liquidation_form_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @translated_file.update(translated_file_params)\n format.html { redirect_to @translated_file, notice: 'Translated file was successfully updated.' }\n format.json { render :show, status: :ok, location: @translated_file }\n else\n format.html { render :edit }\n format.json { render json: @translated_file.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n puts ('entro al update')\n @credit_line = CreditLine.find(params[:id])\n\n respond_to do |format|\n if @credit_line.update_attributes(params[:credit_line])\n format.html { redirect_to @credit_line, notice: 'Credit line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @credit_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_property.update(line_property_params)\n format.html { redirect_to @line_property, notice: 'Line property was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_property }\n else\n format.html { render :edit }\n format.json { render json: @line_property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @transport_line = TransportLine.find(params[:id])\n\n respond_to do |format|\n if @transport_line.update_attributes(params[:transport_line])\n flash[:notice] = 'TransportLine was successfully updated.'\n format.html { redirect_to(@transport_line) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @transport_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n @participants = Participant.all\n @users = User.all\n if @lineitem.update(lineitem_params)\n format.html { redirect_to @lineitem, notice: 'Lineitem was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @lineitem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cruise_line.update(cruise_line_params)\n format.html { redirect_to @cruise_line, notice: 'Cruise line was successfully updated.' }\n format.json { render :show, status: :ok, location: @cruise_line }\n else\n format.html { render :edit }\n format.json { render json: @cruise_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @invoice_adjustment_line = InvoiceAdjustmentLine.find(params[:id])\n\n respond_to do |format|\n if @invoice_adjustment_line.update_attributes(params[:invoice_adjustment_line])\n flash[:notice] = 'InvoiceAdjustmentLine was successfully updated.'\n format.html { redirect_to(@invoice_adjustment_line) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoice_adjustment_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @shipping_line = ShippingLine.find(params[:id])\n\n respond_to do |format|\n if @shipping_line.update_attributes(params[:shipping_line])\n format.html { redirect_to @shipping_line, :notice => 'Shipping line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @shipping_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def change_translation(id, new_value)\n # puts(\"#{id} : #{new_value}\")\n return true unless $REAL\n\n new_value_json = { 'target' => new_value }.to_json\n # NOTE: This popen invocation does NOT go through the shell,\n # so we do not use shell escapes.\n IO.popen(\n [\n 'curl', '-i',\n '-H', \"x-api-key: #{$API_KEY}\",\n '-H', 'content-type: application/json',\n '--request', 'PATCH',\n \"https://translation.io/api/v1/segments/#{id}.json\",\n '--data', new_value_json\n ]\n ) do |io|\n curl_output = io.read\n puts curl_output # Very useful for debugging!\n io.close\n $CHILD_STATUS.success? # Return whether or not we succeeded\n end\nend",
"def update\n @lineas_asignado = LineasAsignado.find(params[:id])\n\n respond_to do |format|\n if @lineas_asignado.update_attributes(params[:lineas_asignado])\n format.html { redirect_to(@lineas_asignado, :notice => 'LineasAsignado was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lineas_asignado.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @batting_line = BattingLine.find(params[:id])\n\n respond_to do |format|\n if @batting_line.update_attributes(params[:batting_line])\n format.html { redirect_to @batting_line, notice: 'Batting line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @batting_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_rest\n @question_localized = QuestionLocalized.find(params[:id])\n\n respond_to do |format|\n if @question_localized.update_attributes(params[:question_localized])\n flash[:notice] = 'QuestionLocalized was successfully updated.'\n format.html { redirect_to(@question_localized) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question_localized.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @receipt = Receipt.find(params[:id])\n params[:receipt][:receipt_lines_attributes] = @receipt.process_removed_lines(params[:receipt][:receipt_lines_attributes])\n\n respond_to do |format|\n if @receipt.update_attributes(receipt_params)\n deposit_check = DepositCheck.find_by_receipt_id(@receipt.id)\n @receipt.update_attributes(:deposit_check_id => deposit_check.id) if deposit_check\n format.html { redirect_to @receipt, notice: 'Receipt was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n env[\"HTTP_REFERER\"] += '#' + item.id.to_s\n format.html { redirect_to :back, notice: \"Aggiornato con successo.\" }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @journal_line = JournalLine.find(params[:id])\n\n respond_to do |format|\n if @journal_line.update_attributes(params[:journal_line])\n flash[:notice] = 'JournalLine was successfully updated.'\n format.html { redirect_to(@journal_line) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @journal_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @translation = Translation.find(params[:id])\n @translation.update_attributes(params[:translation])\n respond_with @translation\n end",
"def update\n respond_to do |format|\n if @example_translation.update(example_translation_params)\n format.html { redirect_to @example_translation, notice: 'Example translation was successfully updated.' }\n format.json { render :show, status: :ok, location: @example_translation }\n else\n format.html { render :edit }\n format.json { render json: @example_translation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def conversation_update\n if params[:message][:conversation_line_id]\n #if message_id set then edit the message\n message = Message.find(params[:message][:conversation_line_id])\n\n message.update(\n message_params.merge(updated_at: Time.at(params[:message][:timestamp].to_i))\n )\n\n # Update expiry date of messages on conversations lines\n message.conversation_line_messages.update(\n message_params.merge(updated_at: Time.at(params[:message][:timestamp].to_i))\n )\n\n message.current_user = current_user\n render json: {\n success: true\n }\n else\n render json: {\n success: false\n }\n end\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @line_item.update(line_item_params)\n\t\t\t\tformat.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @line_item }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @line_item.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n @storyline = Storyline.find(params[:id])\n @rest_ids = @storyline.id.to_s\n @start_id = params[:start_id]\n prev_id = params[:storyline][:prev]\n next_id = params[:storyline][:next]\n \n puts prev_id\n puts next_id\n puts params.inspect\n \n # Decide if user can edit the current line - only happens if no user owns the line or belongs to the current user\n # Else, one can only create new lines\n user_can_edit = (@storyline.user == nil || @storyline.user == @current_user)\n \n lines = TactfulTokenizer::Model.new.tokenize_text(params[:storyline][:line])\n \n # Perform a simple update if still only 1 sentence, and edit distance is small\n if lines.size == 1 and user_can_edit and Amatch::PairDistance.new(@storyline.line).match(lines[0]) > 0.8\n @storyline.update_attributes(params[:storyline])\n else\n @rest_ids = \"\"\n prev_line = Storyline.exists?(prev_id) ? Storyline.find(prev_id) : nil\n next_line = Storyline.exists?(next_id) ? Storyline.find(next_id) : nil\n # If first line matches, update it, then insert new path after that\n # Elif last line matches, update it, then insert new path before that\n ol = Amatch::PairDistance.new(@storyline.line)\n if user_can_edit\n if ol.match(lines[0]) > 0.8\n @storyline.update_attribute :line, lines.shift\n prev_line = @storyline\n @rest_ids = @storyline.id.to_s + \",\"\n elsif ol.match(lines[-1]) > 0.8\n @storyline.update_attribute :line, lines.pop\n next_line = @storyline\n end\n end\n \n if lines.size >= 1\n ## @storyline.update_attribute :line, lines.shift\n @storyline = Storyline.new(:line => lines.shift)\n @storyline.user = @current_user if @current_user\n @storyline.save\n @storyline.insert_between(prev_line, next_line, true)\n prev_line = @storyline\n @rest_ids += @storyline.id.to_s\n lines.each do |line|\n @storyline = Storyline.new(:line => line)\n @storyline.user = @current_user if @current_user\n @storyline.save\n @storyline.insert_between(prev_line, next_line)\n prev_line = @storyline\n end \n end\n end\n \n respond_to do |format|\n format.html { redirect_to @storyline, notice: 'Storyline was successfully updated.' }\n format.json { head :no_content }\n format.js\n end\n # respond_to do |format|\n # if @storyline.update_attributes(params[:storyline])\n # format.html { redirect_to @storyline, notice: 'Storyline was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render action: \"edit\" }\n # format.json { render json: @storyline.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def update\n @lineup = Lineup.find(params[:id])\n\n respond_to do |format|\n if @lineup.update_attributes(params[:lineup])\n format.html { redirect_to @lineup, notice: 'Lineup was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lineup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tagline = Tagline.find(params[:id])\n\n respond_to do |format|\n if @tagline.update_attributes(params[:tagline])\n flash[:notice] = 'Tagline was successfully updated.'\n format.html { redirect_to(@tagline) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tagline.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @service_line = ServiceLine.find(params[:id])\n\n respond_to do |format|\n if @service_line.update_attributes(params[:service_line])\n flash[:notice] = 'Service Line was successfully updated.'\n format.html { redirect_to(service_lines_url(:search => { :meta_sort => \"descend_by_created_at\" })) }\n format.xml { head :ok }\n else\n @user_organizational_units = determine_org_units_for_user\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @service_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @budget_line.update(budget_line_params)\n format.html { redirect_to @budget_line, notice: 'Budget line was successfully updated.' }\n format.json { render :show, status: :ok, location: @budget_line }\n else\n format.html { render :edit }\n format.json { render json: @budget_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @linehaul.update(linehaul_params)\n format.html { redirect_to linehauls_path, notice: 'Linehaul was successfully updated.' }\n format.json { render :show, status: :ok, location: @linehaul }\n else\n format.html { render :edit }\n format.json { render json: @linehaul.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @search_line.update(search_line_params)\n format.html { redirect_to @search_line, notice: 'Search line was successfully updated.' }\n format.json { render :show, status: :ok, location: @search_line }\n else\n format.html { render :edit }\n format.json { render json: @search_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :edit, @questionnaire\n\n @questionnaire.load_JSON(params[:questionnaire], current_user)\n\n respond_to do |format|\n# if @questionnaire.update_attributes(params[:questionnaire])\n format.html { redirect_to @questionnaire, notice: 'Kysymyslomakkeen muokkaaminen onnistui.' }\n format.json { head :no_content }\n# else\n# format.html { render action: \"edit\" }\n# format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n# end\n\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n if @order.update(tl_params)\n head :no_content\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @linea_uv.update(linea_uv_params)\n format.html { redirect_to @linea_uv, notice: 'Linea uv was successfully updated.' }\n format.json { render :show, status: :ok, location: @linea_uv }\n else\n format.html { render :edit }\n format.json { render json: @linea_uv.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6875655",
"0.6616695",
"0.66020405",
"0.66011876",
"0.65923893",
"0.65765464",
"0.64645976",
"0.6454072",
"0.6415003",
"0.6323658",
"0.63188964",
"0.63166213",
"0.6307501",
"0.63050836",
"0.63040924",
"0.6275271",
"0.62743974",
"0.6273326",
"0.6273326",
"0.6273326",
"0.6273326",
"0.6273326",
"0.62683487",
"0.6264528",
"0.6240188",
"0.62297505",
"0.62261015",
"0.620204",
"0.6174771",
"0.6160764",
"0.6160764",
"0.6160764",
"0.61448467",
"0.61120707",
"0.610243",
"0.6090271",
"0.60890734",
"0.6086867",
"0.6083866",
"0.6041624",
"0.6040119",
"0.6039065",
"0.6035583",
"0.6030798",
"0.60291904",
"0.60283923",
"0.6015446",
"0.6015446",
"0.6015446",
"0.6015446",
"0.6015446",
"0.6015446",
"0.6015446",
"0.6014172",
"0.60040814",
"0.59817237",
"0.59817237",
"0.59783036",
"0.59648633",
"0.59611946",
"0.5941923",
"0.5940781",
"0.593849",
"0.5936959",
"0.5932327",
"0.59313107",
"0.5929753",
"0.592489",
"0.590174",
"0.5873688",
"0.5868947",
"0.58682984",
"0.586139",
"0.58592355",
"0.5829041",
"0.58227915",
"0.58222157",
"0.58217776",
"0.5818783",
"0.5818092",
"0.58090436",
"0.58087546",
"0.5801731",
"0.5799342",
"0.57973033",
"0.57950234",
"0.5791252",
"0.57863736",
"0.5784924",
"0.5774959",
"0.5770497",
"0.5764596",
"0.57547164",
"0.5746913",
"0.57422024",
"0.5731087",
"0.5723036",
"0.5698462",
"0.56957036",
"0.5692529"
] | 0.76529455 | 0 |
DELETE /translated_lines/1 DELETE /translated_lines/1.json | def destroy
@translated_line.destroy
respond_to do |format|
format.html { redirect_to translated_lines_url, notice: 'Translated line was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @line = Line.find(params[:id])\n @line.destroy\n\n respond_to do |format|\n format.html { redirect_to new_line_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line = Line.find_by_no(params[:id])\n @line.destroy\n\n respond_to do |format|\n format.html { redirect_to lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @textline.destroy\n respond_to do |format|\n format.html { redirect_to textlines_url, notice: 'Textline was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line.destroy\n respond_to do |format|\n format.html { redirect_to lines_url, notice: \"Line was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item1 = LineItem1.find(params[:id])\n @line_item1.destroy\n\n respond_to do |format|\n format.html { redirect_to line_item1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample_line = SampleLine.find(params[:id])\n @sample_line.destroy\n\n respond_to do |format|\n format.html { redirect_to sample_lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_detail.destroy\n respond_to do |format|\n format.html { redirect_to line_details_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item_line = ItemLine.find(params[:id])\n @item_line.destroy\n\n respond_to do |format|\n format.html { redirect_to item_lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sub1_line_item.destroy\n respond_to do |format|\n format.html { redirect_to sub1_line_items_url, notice: 'Sub1 line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_items.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = @order.line_items.find(params[:id])\n @line_item.destroy\n\n head :no_content\n end",
"def destroy\n #@line = Line.find(params[:id])\n #@line.destroy\n\n #respond_to do |format|\n #format.html { redirect_to(lines_url) }\n #format.xml { head :ok }\n #end\n @line.destroy\n redirect_to lines_path, :flash => { :success => \"Line deleted!\" }\n\n end",
"def destroy\n @order_line = OrderLine.find(params[:id])\n @order_line.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lineitem.destroy\n respond_to do |format|\n format.html { redirect_to lineitems_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n Line.transaction do\n @line.destroy!\n end\n respond_to do |format|\n format.html { redirect_to node_lines_url(@node), notice: 'Line was successfully destroyed.' }\n format.json { head :no_content }\n format.js\n end\n end",
"def destroy\n @order_line.destroy\n respond_to do |format|\n format.html { redirect_to order_lines_url, notice: 'Order line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @route_line = RouteLine.find(params[:id])\n @route_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(route_lines_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invent_journal_line = InventJournalLine.find(params[:id])\n @invent_journal_line.destroy\n\n respond_to do |format|\n format.html { redirect_to invent_journal_lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line = Line.find(params[:id])\n @line.destroy\n\n respond_to do |format|\n format.html { redirect_to budget_path(@line.budget) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @purchase_order_item_line = PurchaseOrderItemLine.find(params[:id])\n @purchase_order_item_line.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_order_item_lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @applied_line.destroy\n respond_to do |format|\n format.html { redirect_to applied_lines_url, notice: 'Applied line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_liver.destroy\n respond_to do |format|\n format.html { redirect_to line_livers_url, notice: 'Line liver was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_translations\n end",
"def destroy\n @time_line.destroy\n respond_to do |format|\n format.html { redirect_to time_lines_url, notice: 'Time line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quote_line.destroy\n respond_to do |format|\n format.html { redirect_to quote_lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to @line_item.cart, notice: t('line_items.destroy.lineDelete') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @storyline = Storyline.find(params[:id])\n @storyline.destroy\n\n respond_to do |format|\n format.html { redirect_to storylines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: \"Line item was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @payment = Payment.find(params[:payment_id])\n @payment_line = @payment.payment_lines.find(params[:id])\n @payment_line.destroy\n\n respond_to do |format|\n format.html { redirect_to payment_payment_lines_url(payment) }\n format.json { head :ok }\n end\n end",
"def destroy\n @so_header = SoHeader.find(params[:so_header_id])\n @so_line = @so_header.so_lines.find(params[:id])\n @so_line.destroy\n\n respond_to do |format|\n format.html { redirect_to so_header_so_lines_url(@so_header) }\n format.json { head :ok }\n end\n end",
"def destroy\n @cruise_line.destroy\n respond_to do |format|\n format.html { redirect_to cruise_lines_url, notice: 'Cruise line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lineitem = Lineitem.find(params[:id])\n @lineitem.destroy\n\n respond_to do |format|\n format.html { redirect_to lineitems_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @liner.destroy\n respond_to do |format|\n format.html { redirect_to liners_url, notice: 'Liner was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @linea = Linea.find(params[:id])\n @linea.destroy\n\n respond_to do |format|\n format.html { redirect_to(lineas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @line.destroy\n respond_to do |format|\n format.html { redirect_to attachment_line_list_path(@line.attachment), notice: 'Line was successfully destroyed.' }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\nend",
"def destroy\n @order.line_items.clear\n respond_to do |format| \n format.html { redirect_to(edit_object_url) } \n end\n end",
"def destroy\n @invoice_addon_line_item.destroy\n respond_to do |format|\n format.html { redirect_to invoice_addon_line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chatline = Chatline.find(params[:id])\n @chatline.destroy\n\n respond_to do |format|\n format.html { redirect_to chatlines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: \"Line item was successfully destroyed.\" }\n format.json { head :no_content }\n end\nend",
"def destroy\n @order_line.destroy\n respond_to do |format|\n format.html { redirect_to order_lines_url, notice: 'Order line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @journal_line = JournalLine.find(params[:id])\n @journal_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(journal_lines_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @line_item.destroy\n destroy_line_item_response\n end",
"def destroy\n @sentence = Sentence.find(params[:id])\n @sentence.destroy\n\n respond_to do |format|\n format.html { redirect_to sentences_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @clothing_line.destroy\n respond_to do |format|\n format.html { redirect_to clothing_lines_url, notice: 'Clothing line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n record = InvoiceLineItem.find(params[:id])\n record.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = line_items.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: \"カートから商品が削除されました\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trade_line.destroy\n respond_to do |format|\n format.html { redirect_to trade_lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @search_line.destroy\n respond_to do |format|\n format.html { redirect_to search_lines_url, notice: 'Search line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lineamiento.destroy\n respond_to do |format|\n format.html { redirect_to lineamientos_url, notice: 'Lineamiento was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @content_translation = ContentTranslation.find(params[:id])\n @content_translation.destroy\n\n respond_to do |format|\n format.html { redirect_to content_translations_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @line_case.destroy\n respond_to do |format|\n format.html { redirect_to line_cases_url, notice: 'Line case was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.js {}\n format.json { head :no_content }\n end\n end",
"def destroy\n @contract_service_line.destroy\n respond_to do |format|\n format.html { redirect_to contract_service_lines_url, notice: 'Contract service line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @example_translation.destroy\n respond_to do |format|\n format.html { redirect_to example_translations_url, notice: 'Example translation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @budget_line.destroy\n respond_to do |format|\n format.html { redirect_to budget_lines_url, notice: 'Budget line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @service_line = ServiceLine.find(params[:id])\n @service_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(service_lines_url) }\n format.xml { head :ok }\n end\n end",
"def DeleteLocale id\n \n APICall(path: \"locales/#{id}.json\",method: 'DELETE')\n \n end",
"def destroy\n delete_locale_file\n @o_single.destroy\n respond_to do |format|\n format.html { redirect_to admin_languages_url, notice: t(\"general.successfully_destroyed\") }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tagline = Tagline.find(params[:id])\n @tagline.destroy\n\n respond_to do |format|\n format.html { redirect_to(taglines_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @credit_line = CreditLine.find(params[:id])\n @credit_line.destroy\n\n respond_to do |format|\n format.html { redirect_to credit_lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact_line = ContactLine.find(params[:id])\n flash[:notice] = \"#{@contact_line.show_label} removed\"\n @contact_line.destroy\n respond_to do |format|\n format.html { render :layout => false }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n\r\n translations = GetPomo::PoFile.parse(File.read(\"#{Rails.root}/po/#{params[:locale]}/#{APP_SID}.po\"))\r\n locales = lambda do |translations|\r\n translations.reject!{|t| t.msgid == \"\"}\r\n if params.has_key?(:fuzzy) and (params[:fuzzy] =~ /(t|1|true|on)/i)\r\n fuzzy = (params[:fuzzy] =~ /(t|1|true|on)/i) ? true : false\r\n if fuzzy\r\n translations.reject{|t| t.fuzzy?.nil?}\r\n else\r\n translations.select{|t| t.fuzzy?.nil?}\r\n end\r\n else\r\n translations\r\n end\r\n end.call(translations)\r\n\r\n # Find and delete translation\r\n\r\n index = translations.find_index(locales[params[:id].to_i])\r\n @locale = translations.delete_at(index)\r\n\r\n # Create delayed job to rewrite the PO file asynchronously\r\n\r\n Delayed::Job.enqueue WritePo.new(params[:locale], GetPomo::PoFile.to_text(translations))\r\n render :json => @locale\r\n end",
"def destroy\n @phone_line.destroy\n respond_to do |format|\n format.html { redirect_to phone_lines_url, notice: 'Phone line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @timeline.destroy\n respond_to do |format|\n format.html { redirect_to timelines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mlines = @book.lines.multiple(params[:id])\n @mlines.each {|l| l.destroy}\n respond_to do |format|\n format.html { redirect_to book_multiple_lines_url(@book) }\n format.json { head :ok }\n end\n end",
"def destroy\n @batting_line = BattingLine.find(params[:id])\n @batting_line.destroy\n\n respond_to do |format|\n format.html { redirect_to batting_lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @extension_line = ExtensionLine.find(params[:id])\n @extension_line.destroy\n\n respond_to do |format|\n format.html { redirect_to extension_lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @service_translation.destroy\r\n respond_to do |format|\r\n format.html { redirect_to service_translations_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.js\n format.json { head :no_content }\n end\n end",
"def destroy\n @liquidation_form_line.destroy\n respond_to do |format|\n format.html { redirect_to liquidation_form_lines_url, notice: 'Liquidation form line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @translated_file.destroy\n respond_to do |format|\n format.html { redirect_to translated_files_url, notice: 'Translated file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_translations\n TranslationKey.find_by(name: description_translation_key).try(:destroy)\n end",
"def destroy\n @invoice_adjustment_line = InvoiceAdjustmentLine.find(params[:id])\n @invoice_adjustment_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoice_adjustment_lines_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @translations_versions_test.destroy\n respond_to do |format|\n format.html { redirect_to translations_versions_tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @translation = Translation.find(params[:id])\n @translation.destroy\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @lineup = Lineup.find(params[:id])\n @lineup.destroy\n\n respond_to do |format|\n format.html { redirect_to lineups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n logger.debug \"Deletion Transcription ID: \"+params[:id]\n @transcription = Transcription.find(params[:id])\n int_page_id = @transcription.page_id\n int_transcription_id = @transcriptionl.id\n @transcription.destroy\n\n arr_prev_page_data = get_prev_page_last_line_data(int_page_id)\n do_page_lines(arr_prev_page_data[0], arr_prev_page_data[1], int_page_id)\n\n str_redirect_link = \"/pages/\"+@transcription.int_page_id.to_s+\"/edit?notice=New%20Transcription%20With%20ID%20\"+int_transcription_id.to_s+\"%20Deleted\"\n\n respond_to do |format|\n format.html { redirect_to str_redirect_link }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice_line_item.destroy\n respond_to do |format|\n format.html { redirect_to invoice_line_items_url, notice: 'Invoice line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @donation_line = DonationLine.find(params[:id])\n @donation_line.destroy\n\n respond_to do |format|\n format.html { redirect_to donation_lines_url }\n format.json { head :ok }\n end\n end",
"def delete_from_entzumena\n headline = Headline.where({:source_item_type => params[:source_item_type], :source_item_id => params[:source_item_id]}).first\n if headline.destroy\n render :json => true, :status => 200\n else\n render :json => false, :status => :error\n end\n end",
"def delete\n DB.exec(\"DELETE FROM line WHERE id = #{self.id};\")\n end",
"def destroy\n\t\t@admin_translatee = Admin::Translatee.find(params[:id])\n\t\t@admin_translatee.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to admin_translatees_url }\n\t\t\tformat.json { head :ok }\n\t\tend\n\tend",
"def destroy\n @dialogue_line = DialogueLine.find(params[:id])\n @dialogue_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(section_room_dialogue_lines_path) }\n format.xml { head :ok }\n end\n end"
] | [
"0.70516783",
"0.70286965",
"0.70273167",
"0.6995233",
"0.69291437",
"0.68406737",
"0.67733943",
"0.67655706",
"0.6751633",
"0.67370576",
"0.67370576",
"0.67360646",
"0.67339957",
"0.67239946",
"0.6706351",
"0.66943514",
"0.66928524",
"0.6684665",
"0.6684665",
"0.6684665",
"0.6684665",
"0.66701573",
"0.66614544",
"0.66589665",
"0.6636939",
"0.66350627",
"0.66302234",
"0.66161567",
"0.6610122",
"0.6607691",
"0.660697",
"0.6606307",
"0.6600011",
"0.6596211",
"0.6595244",
"0.65875334",
"0.65875334",
"0.65875334",
"0.65875334",
"0.65875334",
"0.65875334",
"0.6581569",
"0.6573849",
"0.6550628",
"0.65372676",
"0.6531828",
"0.65243953",
"0.6511416",
"0.6495387",
"0.64916366",
"0.6489014",
"0.64844906",
"0.64807814",
"0.6475281",
"0.6474565",
"0.6473904",
"0.64670104",
"0.6463219",
"0.645963",
"0.64515173",
"0.64420384",
"0.6437949",
"0.6413841",
"0.641162",
"0.6410872",
"0.64072925",
"0.63980037",
"0.6396846",
"0.6391393",
"0.63892007",
"0.6385001",
"0.63816166",
"0.6370292",
"0.6355959",
"0.63402194",
"0.633926",
"0.63392544",
"0.6330063",
"0.6329595",
"0.6328901",
"0.63273984",
"0.6322804",
"0.63190085",
"0.6318779",
"0.6312156",
"0.63093686",
"0.6309046",
"0.63081473",
"0.63016737",
"0.6297133",
"0.6294588",
"0.6288785",
"0.62847286",
"0.62829953",
"0.6276439",
"0.6275483",
"0.627065",
"0.6264477",
"0.626379",
"0.62583005"
] | 0.7962743 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_translated_line
@translated_line = TranslatedLine.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def translated_line_params
params.require(:translated_line).permit(:translation_code, :description)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] | 0.0 | -1 |
================================================================== Instance methods ================================================================== GET /org_invites/1?token=HJuiofjpa45A73255a74F534FDfds | def show
@current_user = current_user
@org_invite = MnoEnterprise::OrgInvite.active.where(id: params[:id], token: params[:token]).first
redirect_path = mnoe_home_path
if @org_invite && !@org_invite.expired? && @org_invite.accept!(current_user)
redirect_path = add_param_to_fragment(redirect_path.to_s, 'dhbRefId', @org_invite.organization.id)
message = { notice: "You are now part of #{@org_invite.organization.name}" }
yield(:success, @org_invite) if block_given?
elsif @org_invite && @org_invite.expired?
message = { alert: "It looks like this invite has expired. Please ask your company administrator to resend the invite." }
else
message = { alert: "Unfortunately, this invite does not seem to be valid." }
end
# Add flash msg in url fragment for the new frontend
type, msg = message.first
type = (type == :alert ? :error : :success)
redirect_path = add_param_to_fragment(redirect_path.to_s, 'flash', [{msg: msg, type: type}.to_json])
redirect_to redirect_path, message
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def invitations\n\t\t@invits = current_user.receive_invites.order(\"id DESC\")\n\tend",
"def show\n @invites = Invite.all\n end",
"def index\n @invites = Invite.all\n end",
"def index\n @invites = Invite.all\n end",
"def index\n @invites = Invite.all\n end",
"def index\n @invites = Invite.all\n end",
"def index\n @invites = Invite.all\n end",
"def view_invitations\n @invitations = Invitation.all(:conditions => ['status = ?', 'pending'])\n end",
"def group_invites\n @invites = GroupsController.group_invites current_user\n end",
"def index\n @invitations = Invitation.where(organization_id: current_user.organization_id).all\n end",
"def index\n @invites = current_user.invites\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n session[:new_invite_error] = nil\n session[:new_invite_error_url] = nil\n end",
"def index\n\t\t@guild_invites = @guild.invites.order(\"id DESC\")\n\tend",
"def index\n @invites = Invite.find(:all, :conditions => \"to_user_id = #{current_user.id} or to_email = '#{current_user.email}'\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invites }\n end\n end",
"def invitations\n @invitations = Invitation.pending_by_user(current_user.id)\n\n respond_to do |format|\n format.html\n end\n end",
"def index\n @inviteds = Invited.all\n end",
"def index\n @invites = current_user.invites.where(is_declined: nil).all\n end",
"def index_invites\n puts \"user: #{@current_user.json_hash[:id]}\"\n dinners = []\n @dinners = @current_user.invited_dinners\n @dinners.each do |dinner|\n dinners << dinner.all_info\n end\n render json: dinners\n end",
"def invites\n raise 'Tried to request invites from a non-server channel' unless server\n\n invites = JSON.parse(API::Channel.invites(@bot.token, @id))\n invites.map { |invite_data| Invite.new(invite_data, @bot) }\n end",
"def invite_detail\n service_response = AdminManagement::AdminUser::GetInviteDetail.new(params).perform\n render_api_response(service_response)\n end",
"def new_invites\n self.invites.all(:hide => false)\n end",
"def index\n @team_invites = TeamInvite.where(team: current_team)\n end",
"def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end",
"def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end",
"def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end",
"def index\n if params[:story_id].present?\n @invitations = Story.find(params[:story_id]).invitations\n else\n @invitations = Invitation.find_by_email(@current_user.email)\n end\n render json: @invitations\n end",
"def organization_invite\n params['host'] = Ind.http_api\n params['api_key'] = Accounts.new.find_by_email(params['email']).api_key\n\n org_res = Organizations.new.list(params).orgs\n\n org_res[0][:related_orgs] << params['org_id']\n org_res[0][:api_key] = params['api_key']\n org_res[0][:email] = params['email']\n org_res[0][:host] = Ind.http_api\n\n res = Organizations.new.update(org_res[0])\n redirect_to root_url\n end",
"def get_unissued_invites()\n User.find(session[:user_id]).unissued_invites\n end",
"def index\n @pending_invitations = @organization.invitations.pending\n @declined_invitations = @organization.invitations.declined\n @contributors = @organization.contributors\n @invitation = Invitation.new(organization: @organization)\n\n authorize! @invitation\n end",
"def index\n @team = Team.find_by_id(params[:team_id])\n @invite_requests = @team.invite_requests\n end",
"def index\n @invites = current_user.recieved_team_requests\n @sent = current_user.sent_team_requests\n end",
"def invitations\n res = []\n\n tmp = GoodData.get @json['project']['links']['invitations']\n tmp['invitations'].each do |invitation|\n res << GoodData::Invitation.new(invitation)\n end\n\n res\n end",
"def index\n # @invitations = Invitation.all\n end",
"def dogwalker_invited\n #@invitations = Invitation.invited_clients_email(params[:email]).select(:email)\n @invitations = Invitation.invitees(params[:email]).select(:email)\n logger.debug(\"@invitations.to_json = \" + @invitations.to_json)\n render json: {:invitations => @invitations }, :layout => false\n end",
"def received_invitations\n user = User.find(params[:user_id])\n @invitations = user.invitations\n\n render json: @invitations\n end",
"def invites(auth, server_id)\n MijDiscord::Core::API.request(\n :guilds_sid_invites,\n server_id,\n :get,\n \"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/invites\",\n Authorization: auth\n )\n end",
"def index\n @invitations = Invitation.all\n end",
"def index\n @invitations = Invitation.all\n end",
"def index\n @invitations = Invitation.all\n end",
"def index\n @list_invites = ListInvite.all\n end",
"def index\n @invitations = Invitation.all\n respond_with(@invitations)\n end",
"def index\n @invitations = Invitation.where(receiver_id: current_user.id)\n end",
"def show\n @invite = @event.invites.find(params[:id])\n end",
"def index\n # LE TEMPS DE ...\n if self.admin?\n @invites = Invite.all\n elsif self.check_user && self.check_no_guild\n @invites = Invite.where(:user_id => session[:user_id])\n elsif self.check_user && self.check_is_guild_owner\n @invites = Invite.where(:guild_id => @guild[:id])\n end\n end",
"def show\n user = User.find_by(id: params[:id]) #should use session id\n if user\n invitations = user.invitations\n if invitations\n render json: invitations, status: :ok\n else\n head :no_content\n end\n else\n render json: {error: \"User not found\"}, status: :not_found\n end\n end",
"def pending_invites\n list = []\n pending_contacts.links(:class=>\"s3d-bold s3d-regular-light-links\", :title=>/View/).each { |link| list << link.text }\n return list\n end",
"def index\n @invitations = Invitation.all\n\n render json: @invitations, except: [:created_at, :updated_at], \n include: [:event => {include: [:host => {except: [:password_digest, :created_at, :updated_at]}]}]\n end",
"def index\n @invitees = Invitee.all\n end",
"def index\n @invitees = Invitee.all\n end",
"def index\n @os_groups_invites = OsGroupsInvite.all\n end",
"def find_invite\n @invite = Invite.find(params[:id])\n end",
"def get_mission_invites\n\t#get all missions of user with invitaion_status = pending\n user = User.exists? (params[:user_id])\n\tif user\n\t\tmissions = user.missions.references( :user_missions).select('missions.id, missions.title, user_missions.invitation_time').where( user_missions:{ invitation_status: PENDING_MESA_INVITATION})\n\t\trespond_to do |format|\n\t\t format.json {render :json=> {:mesa_invites=> missions, :status => true} }\n\t\tend\n else\n\t respond_to do |format|\n\t\t format.json {render :json=> {:error=>'No user exists with id' , :status => false} }\n\t end\n\tend\n end",
"def index\n @user = User.find(params[:user_id]) \n @invitations = @user.invitations\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @invitations.to_xml }\n end\nend",
"def show\n @invite_list = InviteList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invite_list }\n end\n end",
"def get_user_invitations(filter: {}, includes: nil, limit: nil, sort: nil)\n params = users_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)\n users_request_client.get(\"userInvitations\", params)\n end",
"def index\n @invitations = @event.invitations.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invitations }\n end\n end",
"def set_invited\n @invited = Invited.find(params[:id])\n end",
"def load_invitations\n @invitations ||= begin\n ids = resend_invitation_params\n ids ||= current_course.invitations.unconfirmed.select(:id)\n if ids.blank?\n []\n else\n current_course.invitations.unconfirmed.where('course_user_invitations.id IN (?)', ids)\n end\n end\n end",
"def load_invitations\n @invitations ||= begin\n ids = resend_invitation_params\n ids ||= current_course.invitations.unconfirmed.select(:id)\n if ids.blank?\n []\n else\n current_course.invitations.unconfirmed.where('course_user_invitations.id IN (?)', ids)\n end\n end\n end",
"def invitestatuslist\n @inviteStatus = InviteStatus.find :all\n render :layout => 'plain'\n end",
"def invite\n @obj['invite']\n end",
"def index\n @invs = Inv.all\n end",
"def index\n @invite_requests = InviteRequest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invite_requests }\n end\n end",
"def index\n @invts = Invt.all\n end",
"def index\n @invited_fiends = InvitedFiend.all\n end",
"def index\n @user_invitations = UserInvitation.all\n end",
"def index\n @events = Event.where({ user_id: current_user.id }).order(created_at: :desc)\n @invitations = EventUser.where({ number: current_user.phone }).map { |invite| invite.event }\n \n end",
"def index\n @invitations = Invitation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invitations }\n end\n end",
"def index\n @invstatuses = Invstatus.all\n end",
"def index\n\t\t@users = Invitation.pending_users(params[:page])\n\tend",
"def sent_invitations\n user = User.find(params[:user_id])\n @invitations = Invitation.created_by_user(user)\n\n render json: @invitations\n end",
"def index\n @teams = current_user.teams\n\n @team_invitations = current_user.team_invitations_as_receiver\n end",
"def index\n\n @emails = Email.all\n #redirect_to invites_path\n\n end",
"def show\n #@trips = Trip.find params[:user_id]\n @user = User.find(params[:id])\n @invitations = Invitation.where(email: session[:user_email])\n @num_of_invites = @invitations.length\n end",
"def show\n @invite_status = InviteStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invite_status }\n end\n end",
"def index\n @invitecodes = Invitecode.all\n end",
"def setup_invites_for_upcoming\n if( @upcoming_near_me.blank? )\n @upcoming_near_me = Invitation.search \"#{@current_city} #{@current_state} #{@current_country}\",:with => {:start_date => Time.now.utc..Time.now.utc.advance(:days => 1000),:is_public => 1,:deactivated => 0}, :without => {:purpose_id => 19}, :order => :id, :sort_mode => :desc\n #~ @upcoming_near_me = LookUp::meetings_for_upcoming_on_user_home(:city => @current_city, :state => @current_state, :country => @current_country) \n @invites_for_map = LookUp::invites_for_map_on_user_home(@upcoming_near_me.map(&:id))\n end\n end",
"def available_invites\n self.user_admin? ? 1 : self[:available_invites]\n end",
"def index\n @invitations = Invitation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invitations }\n end\n end",
"def invitable_users\n @title = \"Invitar usuario\"\n @invitable_users = GetInvitableUsers.call(@previa_group)\n end",
"def invitations()\n return MicrosoftGraph::Invitations::InvitationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def invite\n @data['invite']\n end",
"def url_after_invite(invite)\n invite.invitable\n end",
"def show\n @invite = Invite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invite }\n end\n end",
"def show\n @invite = Invite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invite }\n end\n end",
"def show\n @invite = Invite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invite }\n end\n end",
"def show\n @invite = Invite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invite }\n end\n end",
"def invited_users\n render json: @moot.list_users_can_vote\n end",
"def index\n if params[:admin] == \"1\"\n @invites = Invite.all\n else\n render file: \"#{Rails.root}/public/403.html\", status: 403, layout: false\n end\n end",
"def get_all_invitations_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InvitationsApi.get_all_invitations ...'\n end\n # resource path\n local_var_path = '/invitations'\n\n # query parameters\n query_params = {}\n query_params[:'courseId'] = opts[:'course_id'] if !opts[:'course_id'].nil?\n query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?\n query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?\n query_params[:'datetimeFilter'] = opts[:'datetime_filter'] if !opts[:'datetime_filter'].nil?\n query_params[:'tags'] = @api_client.build_collection_param(opts[:'tags'], :csv) if !opts[:'tags'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'filterBy'] = opts[:'filter_by'] if !opts[:'filter_by'].nil?\n query_params[:'orderBy'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'more'] = opts[:'more'] if !opts[:'more'].nil?\n query_params[:'includeTotalCount'] = opts[:'include_total_count'] if !opts[:'include_total_count'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['APP_NORMAL', '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 => 'InvitationSummaryList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InvitationsApi#get_all_invitations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def set_inv\n @inv = Inv.find(params[:id])\n end",
"def index\n @invitations = Invitation.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @invitations.to_xml }\n end\n end",
"def index\n # session[:user_id] = nil\n # binding.pry\n @user = User.new\n @invitations = Invitation.where(email: session[:user_email])\n @num_of_invites = @invitations.length\n end",
"def all_inviters(page = nil, per_page = nil)\n pipeline = [\n { '$project' =>\n { _id: 0,\n f_id: 1,\n invitable_id: 1,\n invitable_type: 1\n }\n },\n {\n '$match' => {\n 'invitable_id' => self.id,\n 'invitable_type' => self.class.name.split('::').last\n }\n }\n ]\n\n if page && per_page\n pipeline << { '$skip' => (page * per_page) }\n pipeline << { '$limit' => per_page }\n end\n\n pipeline << { '$project' => { f_id: 1 } }\n\n command = {\n aggregate: 'invits',\n pipeline: pipeline\n }\n\n if defined?(Mongoid)\n db = Mongoid.default_session\n elsif defined?(MongoMapper)\n db = MongoMapper.database\n end\n\n users_hash = db.command(command)['result']\n\n ids = users_hash.map {|e| e['f_id']}\n\n User.where(id: { '$in' => ids }).all.entries\n end",
"def invitestatuslist\n @inviteStatus = InviteStatus.all\n render :layout => 'plain'\n end",
"def show\n @user = User.find(session[:user_id])\n @user_invitees = Invitation.where(user: User.find(session[:user_id])).where(invited: true)\n @user_invitors = Invitation.where(invitee: User.find(current_user)).where(invited: true)\n @invitors = Invitation.where(invited: User.find(current_user)).where(invited: false)\n end",
"def show\n @invite_request = InviteRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @invite_request }\n end\n end",
"def index\n invitations = Invitation.where('email = ? AND status = ?', @current_user.email, 'pending')\n invitations_array = []\n\n invitations.each do |inv|\n user = User.find(inv.from_user)\n user_hash = { :id => @current_user.id, :email => user.email, :first_name => user.user_info.first_name, :last_name => user.user_info.last_name }\n\n project = Project.find(inv.project_id)\n project_hash = { :id => project.id , :project_title => project.title, :project_profile => inv.project_profile_id }\n\n invitations_array << { :id => inv.id, :user => user_hash, :project => project_hash, :date => \"#{l inv.created_at, format: :long}\" }\n end\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { render json: invitations_array }\n end\n end",
"def url_after_invite(invite)\n invite.invitable\n end",
"def get_triggered_incidents\n # use status of incident as a filter\n res = RestClient.get INCIDENT_QUERY_URL, :params => { :status => \"triggered\", :fields => \"incident_number\" }\n end",
"def get_public_invitations_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InvitationsApi.get_public_invitations ...'\n end\n # resource path\n local_var_path = '/invitations/public'\n\n # query parameters\n query_params = {}\n query_params[:'courseId'] = opts[:'course_id'] if !opts[:'course_id'].nil?\n query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?\n query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?\n query_params[:'datetimeFilter'] = opts[:'datetime_filter'] if !opts[:'datetime_filter'].nil?\n query_params[:'tags'] = @api_client.build_collection_param(opts[:'tags'], :csv) if !opts[:'tags'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'filterBy'] = opts[:'filter_by'] if !opts[:'filter_by'].nil?\n query_params[:'orderBy'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'more'] = opts[:'more'] if !opts[:'more'].nil?\n query_params[:'includeTotalCount'] = opts[:'include_total_count'] if !opts[:'include_total_count'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['APP_NORMAL', '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 => 'PublicInvitationList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InvitationsApi#get_public_invitations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end"
] | [
"0.72609353",
"0.7234914",
"0.71487516",
"0.71487516",
"0.71487516",
"0.71487516",
"0.71487516",
"0.71000665",
"0.70881003",
"0.7022737",
"0.69611216",
"0.6955616",
"0.6916794",
"0.68843436",
"0.6850335",
"0.6827456",
"0.67587966",
"0.675016",
"0.6744818",
"0.6741207",
"0.66833633",
"0.665123",
"0.665123",
"0.665123",
"0.66097975",
"0.66094446",
"0.66052836",
"0.6596731",
"0.6590167",
"0.6562396",
"0.656061",
"0.6560398",
"0.65217113",
"0.64978445",
"0.64902997",
"0.64564615",
"0.64564615",
"0.64564615",
"0.64525163",
"0.6412053",
"0.6407392",
"0.6391711",
"0.6324648",
"0.630569",
"0.6280542",
"0.62646276",
"0.62191164",
"0.62191164",
"0.6215445",
"0.6200445",
"0.6186866",
"0.61835253",
"0.6168993",
"0.61619055",
"0.61549383",
"0.6148134",
"0.6144752",
"0.6144752",
"0.6139709",
"0.6123854",
"0.6117127",
"0.6115755",
"0.61024326",
"0.6097526",
"0.6095594",
"0.6083446",
"0.60662013",
"0.60638934",
"0.60501397",
"0.60487705",
"0.60454756",
"0.6043195",
"0.6042872",
"0.6036226",
"0.602617",
"0.602421",
"0.60120904",
"0.6009446",
"0.5997853",
"0.5984864",
"0.5984212",
"0.5981408",
"0.5971193",
"0.5971193",
"0.5971193",
"0.5971193",
"0.5969278",
"0.595321",
"0.59508866",
"0.59458786",
"0.5934066",
"0.5916042",
"0.5910842",
"0.5909612",
"0.5897861",
"0.5892624",
"0.5885953",
"0.58840346",
"0.5877125",
"0.5877099"
] | 0.62722063 | 45 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.