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
Concats sequences from the emitter and yields the contained ORFs for every resulting frame (3..1, 1..3 ). Note that for the reverse frame, the resulting sequence is complemented! Translate these sequences in a forward frame only. First :head, then :mid parts get emitted, closed by the :tail part.
def emit_seq @em.emit_seq do | part, index, tag, seq | # p [part, seq] # case part do # when :head # when :mid # when :tail # end emit_forward(part, index, tag, seq) { |*x| yield(*x) } emit_reverse(part, index, tag, seq) { |*x| yield(*x) } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mix\n (0..@length-1).to_a.map { |index| mix_frame(index) }\n end", "def mixblocks2seq!\n # Recurse on the behaviors.\n self.each_behavior { |beh| beh.mixblocs2seq! }\n end", "def concat other_frames\n raise TypeError unless other_frames.kind_of?(Frames)\n @avi.process_movi do |this_indices, this_movi|\n this_size = this_movi.size\n this_movi.pos = this_size\n other_frames.avi.process_movi do |other_indices, other_movi|\n while d = other_movi.read(BUFFER_SIZE) do\n this_movi.print d\n end\n other_meta = other_indices.collect do |m|\n x = m.dup\n x[:offset] += this_size\n x\n end\n this_indices.concat other_meta\n [other_indices, other_movi]\n end\n [this_indices, this_movi]\n end\n\n self\n end", "def sequence(input)\n out5 RENDERER.sequence(input)\nend", "def combine_frames(frames)\n frames.first.zip(*frames[1..-1]).map do |pixels|\n combine_pixels pixels\n end\n end", "def circular_sequences\n to_return = []\n connections.each do |conn|\n if conn.probe1.sequence_index == conn.probe2.sequence_index and\n conn.probe1.side != conn.probe2.side and\n @graph.edges[conn.probe1.to_settable].length == 1 and\n @graph.edges[conn.probe2.to_settable].length == 1\n\n to_return.push conn.probe1.sequence_index\n end\n end\n return to_return\n end", "def mixblocks2seq!\n # Recurse on the scope.\n self.scope.mixblocks2seq!\n end", "def combinator(source)\n Enumerator.new do |y|\n source.each_with_index do |item, index|\n y << [item]\n combinator(source[(index+1)..-1]).each do |sub|\n y << sub.unshift(item)\n end\n end\n end\nend", "def each_transform_output\n return enum_for(:each_transform_output) if !block_given?\n if !(tr = model.transformer)\n return\n end\n\n model.each_transform_output do |port, from, to|\n from = selected_frames[from]\n to = selected_frames[to]\n yield(port.bind(self), from, to)\n end\n end", "def originchain\n Enumerator.new do |y|\n callchain.each do |cs|\n y.yield cs.origin if cs.origin\n end\n end\n end", "def each_transform_output\n if !(tr = model.transformer)\n return\n end\n\n model.each_output_port do |port|\n if associated_transform = tr.find_transform_of_port(port)\n from = selected_frames[associated_transform.from]\n to = selected_frames[associated_transform.to]\n yield(port, from, to)\n end\n end\n end", "def traverse_sequences(other, callbacks = nil, &block)\n traverse_sequences(self, other, callbacks ||\n Diff::LCS.YieldingCallbacks, &block)\n end", "def recompress( unprocessed )\n emitted, residue=recompress_with_remainder( unprocessed )\n # There are a few cases where the buffer in the recompress method\n # still holds data that can be compressed, so we have to recurse \n # on the residue.\n until residue.empty?\n extra, residue=recompress_with_remainder( residue )\n emitted.push *extra\n emitted.push residue.shift unless residue.empty?\n end\n emitted\n end", "def reverse_shift_out(&block)\n reverse_each(&block)\n end", "def emit_range\n emit_finish_mutations\n emit_start_mutations\n end", "def aggregate_by_chunks\n forward = []\n reverse = []\n chunks.each do |chunk|\n reads=get :chunks, chunk\n forward << (get :side, :left)\n reverse << (get :side, :right)\n end\n [forward,reverse]\n end", "def replace_each!\n emitters.each_with_index do |emitter, index|\n emitters[index] = yield(emitter)\n end\n\n self\n end", "def traverse_sequences(seq1, seq2, callbacks = Diff::LCS::SequenceCallbacks, &block) #:yields change events:\n callbacks ||= Diff::LCS::SequenceCallbacks\n matches = Diff::LCS::Internals.lcs(seq1, seq2)\n\n run_finished_a = run_finished_b = false\n string = seq1.kind_of?(String)\n\n a_size = seq1.size\n b_size = seq2.size\n ai = bj = 0\n\n (0..matches.size).each do |i|\n b_line = matches[i]\n\n ax = string ? seq1[i, 1] : seq1[i]\n bx = string ? seq2[bj, 1] : seq2[bj]\n\n if b_line.nil?\n unless ax.nil? or (string and ax.empty?)\n event = Diff::LCS::ContextChange.new('-', i, ax, bj, bx)\n event = yield event if block_given?\n callbacks.discard_a(event)\n end\n else\n loop do\n break unless bj < b_line\n bx = string ? seq2[bj, 1] : seq2[bj]\n event = Diff::LCS::ContextChange.new('+', i, ax, bj, bx)\n event = yield event if block_given?\n callbacks.discard_b(event)\n bj += 1\n end\n bx = string ? seq2[bj, 1] : seq2[bj]\n event = Diff::LCS::ContextChange.new('=', i, ax, bj, bx)\n event = yield event if block_given?\n callbacks.match(event)\n bj += 1\n end\n ai = i\n end\n ai += 1\n\n # The last entry (if any) processed was a match. +ai+ and +bj+ point\n # just past the last matching lines in their sequences.\n while (ai < a_size) or (bj < b_size)\n # last A?\n if ai == a_size and bj < b_size\n if callbacks.respond_to?(:finished_a) and not run_finished_a\n ax = string ? seq1[-1, 1] : seq1[-1]\n bx = string ? seq2[bj, 1] : seq2[bj]\n event = Diff::LCS::ContextChange.new('>', (a_size - 1), ax, bj, bx)\n event = yield event if block_given?\n callbacks.finished_a(event)\n run_finished_a = true\n else\n ax = string ? seq1[ai, 1] : seq1[ai]\n loop do\n bx = string ? seq2[bj, 1] : seq2[bj]\n event = Diff::LCS::ContextChange.new('+', ai, ax, bj, bx)\n event = yield event if block_given?\n callbacks.discard_b(event)\n bj += 1\n break unless bj < b_size\n end\n end\n end\n\n # last B?\n if bj == b_size and ai < a_size\n if callbacks.respond_to?(:finished_b) and not run_finished_b\n ax = string ? seq1[ai, 1] : seq1[ai]\n bx = string ? seq2[-1, 1] : seq2[-1]\n event = Diff::LCS::ContextChange.new('<', ai, ax, (b_size - 1), bx)\n event = yield event if block_given?\n callbacks.finished_b(event)\n run_finished_b = true\n else\n bx = string ? seq2[bj, 1] : seq2[bj]\n loop do\n ax = string ? seq1[ai, 1] : seq1[ai]\n event = Diff::LCS::ContextChange.new('-', ai, ax, bj, bx)\n event = yield event if block_given?\n callbacks.discard_a(event)\n ai += 1\n break unless bj < b_size\n end\n end\n end\n\n if ai < a_size\n ax = string ? seq1[ai, 1] : seq1[ai]\n bx = string ? seq2[bj, 1] : seq2[bj]\n event = Diff::LCS::ContextChange.new('-', ai, ax, bj, bx)\n event = yield event if block_given?\n callbacks.discard_a(event)\n ai += 1\n end\n\n if bj < b_size\n ax = string ? seq1[ai, 1] : seq1[ai]\n bx = string ? seq2[bj, 1] : seq2[bj]\n event = Diff::LCS::ContextChange.new('+', ai, ax, bj, bx)\n event = yield event if block_given?\n callbacks.discard_b(event)\n bj += 1\n end\n end\n end", "def frame_chain!\n @frame_chain\n end", "def pipeline\n parts = []\n @commands.each_with_index do |command, index|\n parts << %({ #{command} 2>&4 ; echo \"#{index}|$?:\" >&3 ; })\n end\n %({ #{parts.join(\" | \")} } 3>&1 1>&2 4>&2)\n end", "def mixblocks2seq!\n # Is the block mix?\n return unless block.mix?\n # Mixed, do convert.\n # Converts the block to seq.\n self.block.to_seq!\n end", "def iterate_frames(animations, previous)\n animations.each do |animation|\n animation.frames(previous).each do |frame|\n previous = frame\n yield frame\n end\n end\n previous\n end", "def liftchain(outfile)\n #Future: Add option to recycle old chainfile #\n processes = CONFIG[:processes]\n blat_opts = CONFIG[:blat_opts]\n \n cp CONFIG[:source_fa], \"#{RUNDIR}/source.fa\"\n cp CONFIG[:target_fa], \"#{RUNDIR}/target.fa\"\n\n to_2bit \"#{RUNDIR}/source.fa\"\n to_2bit \"#{RUNDIR}/target.fa\"\n\n to_sizes \"#{RUNDIR}/source.2bit\"\n to_sizes \"#{RUNDIR}/target.2bit\"\n\n # Partition target assembly.\n sh \"faSplit sequence #{RUNDIR}/target.fa #{processes} #{RUNDIR}/chunk_\"\n\n parallel Dir[\"#{RUNDIR}/chunk_*.fa\"],\n 'faSplit -oneFile size %{this} 5000 %{this}.5k -lift=%{this}.lft &&' \\\n 'mv %{this}.5k.fa %{this}'\n\n # BLAT each chunk of the target assembly to the source assembly.\n parallel Dir[\"#{RUNDIR}/chunk_*.fa\"],\n \"blat -noHead #{blat_opts} #{RUNDIR}/source.fa %{this} %{this}.psl\"\n\n parallel Dir[\"#{RUNDIR}/chunk_*.fa\"],\n \"liftUp -type=.psl -pslQ -nohead\" \\\n \" %{this}.psl.lifted %{this}.lft warn %{this}.psl\"\n\n # Derive a chain file each from BLAT's .psl output files.\n parallel Dir[\"#{RUNDIR}/chunk_*.psl.lifted\"],\n 'axtChain -psl -linearGap=medium' \\\n \" %{this} #{RUNDIR}/source.2bit #{RUNDIR}/target.2bit %{this}.chn\"\n\n # Sort the chain files.\n parallel Dir[\"#{RUNDIR}/chunk_*.chn\"],\n 'chainSort %{this} %{this}.sorted'\n\n # Combine sorted chain files into a single sorted chain file.\n sh \"chainMergeSort #{RUNDIR}/*.chn.sorted | chainSplit #{RUNDIR} stdin -lump=1\"\n mv \"#{RUNDIR}/000.chain\", \"#{RUNDIR}/combined.chn.sorted\"\n\n # Derive net file from combined, sorted chain file.\n sh 'chainNet' \\\n \" #{RUNDIR}/combined.chn.sorted #{RUNDIR}/source.sizes #{RUNDIR}/target.sizes\" \\\n \" #{RUNDIR}/combined.chn.sorted.net /dev/null\"\n\n # Subset combined, sorted chain file.\n sh 'netChainSubset' \\\n \" #{RUNDIR}/combined.chn.sorted.net #{RUNDIR}/combined.chn.sorted\" \\\n \" #{RUNDIR}/liftover.chn\"\nend", "def demux\n x = []\n y = []\n self.each { |inz| raise \"wrong size (!= 2) - #{inz.inspect}\" if inz.size != 2; x << inz[0] ; y << inz[1] }\n [x,y]\n end", "def compose(interactor)\n Interactors::Sequence.new.compose(self).compose(interactor)\n end", "def concat(*args)\n AnonymousObservable.new do |observer|\n disposed = false\n e = args.length == 1 && args[0].respond_to?(:next) ? args[0] : ThreadedEnumerator.new(args)\n subscription = SerialSubscription.new\n gate = AsyncLock.new\n\n cancelable = CurrentThreadScheduler.instance.schedule_recursive lambda {|this|\n gate.wait do\n current = nil\n has_next = false\n err = nil\n\n if disposed\n break\n else\n begin\n current = e.next\n has_next = true\n rescue StopIteration => _\n # Do nothing\n rescue => e\n err = e\n end\n end\n\n if err\n observer.on_error err\n break\n end\n\n unless has_next\n observer.on_completed\n break\n end\n\n new_obs = Observer.configure do |o|\n o.on_next(&observer.method(:on_next))\n o.on_error(&observer.method(:on_error))\n o.on_completed { this.call }\n end\n\n subscription.subscription = current.subscribe new_obs\n end\n }\n\n CompositeSubscription.new [subscription, cancelable, Subscription.create { gate.wait { disposed = true }}]\n end\n end", "def emit\n # emit LHS, RHS, opcode\n @first.emit << @second.emit << OPCODES[@op]\n end", "def emit_finish_mutations\n finish = node.finish\n #emit_self(negative_infinity, finish)\n emit_self(nan, finish)\n end", "def to *receivers\n @current.callback = lambda do |o, has|\n receivers.each &has.method.with(o, *has.args, &has.block); o\n end\n self\n end", "def generate_reverse_tcp(opts={})\n combined_asm = %Q^\n cld ; Clear the direction flag.\n call start ; Call start, this pushes the address of 'api_call' onto the stack.\n #{asm_block_api}\n start:\n pop ebp\n #{asm_reverse_tcp(opts)}\n #{asm_block_recv(opts)}\n ^\n Metasm::Shellcode.assemble(Metasm::X86.new, combined_asm).encode_string\n end", "def flush_next_out\n\t\t\t@out_pos = @output_buffer.length\n\t\t\t@finished = true\n\t\t\tret = @output_buffer.pack(\"c*\")\n\t\t\t@output_buffer = []\n\t\t\tret\n\t\tend", "def reverse_complement_rich_sequence(path_to_sequence, sequence_format = nil, output_sequence_format = nil)\n biosequence = biosequence_from_file(path_to_sequence, sequence_format)\n biosequence.reverse_complement!\n\n # now to reverse complement the features\n reverse_complemented_features = Array.new\n sequence_length = biosequence.to_s.length\n source_feature = nil\n\n biosequence.features.each do |feature|\n location = feature.locations.locations.first\n if feature.feature == \"source\"\n source_feature = feature\n else\n new_start = sequence_length - location.to + 1\n new_end = sequence_length - location.from + 1\n location.from = new_start\n location.to = new_end\n location.strand *= -1 # reverse the strand\n\n feature_locations = feature.locations\n feature_locations.locations = [location]\n feature.position = feature_locations.to_s # the location of a feature is based on it's position string, not a Bio:Locations object which is created on the fly (why I have no idea!)\n reverse_complemented_features.unshift(feature)\n end\n end\n reverse_complemented_features.unshift(source_feature)\n biosequence.features = reverse_complemented_features\n\n output_sequence_format ||= guess_sequence_format(path_to_sequence)\n case output_sequence_format\n when :genbank\n output_suffix = \"gbk\"\n when :embl\n output_suffix = \"embl\"\n end\n reverse_complemented_file = File.open(\"#{File.dirname(path_to_sequence)}/#{file_prefix_from_filepath(path_to_sequence)}_rc.#{output_suffix}\", \"w\")\n \n reverse_complemented_file.puts biosequence.output(output_sequence_format)\n reverse_complemented_file.close\nend", "def shift_out_right\n # This is functionally equivalent to shift_out, actually sends LSB first\n each { |bit| yield bit }\n end", "def flush_next_out\n\t\t@out_pos = @output_buffer.length\n\t\t@finished = true\n\t\tret = @output_buffer.pack(\"c*\")\n\t\t@output_buffer = []\n\t\tret\n\tend", "def split(max)\n return yield self if @length <= max\n first, *mid, last = @payload.chunk(max)\n yield Frame.craft(type_value: @type_value, stream_id: @stream_id, payload: first, flags_value: @flags_value & ~4)\n mid.each { |slice|\n yield Frame.craft(type: :continuation, stream_id: @stream_id, payload: slice, flags_value: 0)\n }\n yield Frame.craft(type: :continuation, stream_id: @stream_id, payload: last, flags_value: @flags_value & 4)\n end", "def chain(*elements)\n elements = elements.reverse\n elements[1..-1].inject(elements.first) do |c, elm|\n elm.pipe(c, environment)\n elm\n end\n end", "def subweave(seq1, seq2)\n return [seq2] if seq1.empty?\n return [seq1] if seq2.empty?\n\n seq1, seq2 = seq1.dup, seq2.dup\n return unless (init = merge_initial_ops(seq1, seq2))\n return unless (fin = merge_final_ops(seq1, seq2))\n\n # Make sure there's only one root selector in the output.\n root1 = has_root?(seq1.first) && seq1.shift\n root2 = has_root?(seq2.first) && seq2.shift\n if root1 && root2\n return unless (root = root1.unify(root2))\n seq1.unshift root\n seq2.unshift root\n elsif root1\n seq2.unshift root1\n elsif root2\n seq1.unshift root2\n end\n\n seq1 = group_selectors(seq1)\n seq2 = group_selectors(seq2)\n lcs = Sass::Util.lcs(seq2, seq1) do |s1, s2|\n next s1 if s1 == s2\n next unless s1.first.is_a?(SimpleSequence) && s2.first.is_a?(SimpleSequence)\n next s2 if parent_superselector?(s1, s2)\n next s1 if parent_superselector?(s2, s1)\n next unless must_unify?(s1, s2)\n next unless (unified = Sequence.new(s1).unify(Sequence.new(s2)))\n unified.members.first.members if unified.members.length == 1\n end\n\n diff = [[init]]\n\n until lcs.empty?\n diff << chunks(seq1, seq2) {|s| parent_superselector?(s.first, lcs.first)} << [lcs.shift]\n seq1.shift\n seq2.shift\n end\n diff << chunks(seq1, seq2) {|s| s.empty?}\n diff += fin.map {|sel| sel.is_a?(Array) ? sel : [sel]}\n diff.reject! {|c| c.empty?}\n\n Sass::Util.paths(diff).map {|p| p.flatten}.reject {|p| path_has_two_subjects?(p)}\n end", "def close_block\n unless @rr.empty? then @r = @rr.pop end # back with the register\n @pipe.pop; @opener.pop; @finisher.pop # pop the writing stack\n ( @head.pop + @tail.pop ).join # join head and tail\n end", "def pipe(&block)\n cmds = Commands.new(mode: :pipe)\n cmds.instance_eval(&block)\n self.!(cmds.to_a)\n end", "def each_transform_port\n return enum_for(:each_transform_port) if !block_given?\n model.each_transform_port do |port, transform|\n from = selected_frames[transform.from]\n to = selected_frames[transform.to]\n yield port.bind(self), Transform.new(from, to)\n end\n end", "def + other_frames\n r = self.to_avi\n r.frames.concat other_frames\n r.frames\n end", "def frames(previous)\n return [] if @animations.empty?\n return @animations.first.frames(previous) if @animations.size == 1\n\n # Lazily zip the next frames of each animation together. Ruby 1.9.3\n # doesn't have lazy enumerators or lazy zip, so do it by hand.\n Enumerator.new do |y|\n enums = @animations.map { |anim| anim.frames(previous).each }\n\n loop do\n begin\n frames = enums.map(&:next)\n y << combine_frames(frames)\n rescue StopIteration\n break\n end\n end\n end\n end", "def shift_out_left\n # This is functionally equivalent to reverse_shift_out\n reverse_each { |bit| yield bit }\n end", "def each\n self[0..-1].each { |o| yield o }\n end", "def flush_emit(step)\n time = Fluent::Engine.now\n flushed_counts, flushed_matches, @counts, @matches = @counts, @matches, {}, {}\n\n case @aggregate\n when 'all'\n count = flushed_counts[:all]\n matches = flushed_matches[:all]\n output = generate_output(count, matches)\n router.emit(@tag, time, output) if output\n when 'out_tag'\n flushed_counts.keys.each do |out_tag|\n count = flushed_counts[out_tag]\n matches = flushed_matches[out_tag]\n output = generate_output(count, matches)\n if output\n router.emit(out_tag, time, output)\n end\n end\n else # in_tag\n flushed_counts.keys.each do |tag|\n count = flushed_counts[tag]\n matches = flushed_matches[tag]\n output = generate_output(count, matches, tag)\n if output\n out_tag = @tag_proc.call(tag)\n router.emit(out_tag, time, output)\n end\n end\n end\n end", "def combine_tracks_from_origin\n begin\n tracks = \"\"\n offsets = []\n # This is disgusting, but I want to get this concept working\n # and my brain isn't cooperating. I'm trying to account for\n # any tracks that both have offsets by subtracting the lower offset\n # from the higher one, and reassigning the higher one with the new value\n # and setting the lower one to 0. That way there are no pauses before the track begins\n os = origins.sort_by(&:offset).reverse\n os.each {|o| offsets << o.offset}\n os.first.offset = offsets[0] - offsets[1]\n os.last.offset = 0\n os.each do |o|\n unless File.exist?(o.jingle.latest_path)\n sox_logger.info(\"#{o.jingle.latest_path} does not exist.\")\n raise Errno::ENOENT, \"#{o.jingle.latest_path} not processed yet\"\n end\n sox_logger.info(\"Added track: #{o.jingle.latest_path}\")\n if o.offset > 0\n tracks += (\" -v 0.8 \" + o.jingle.latest_path + \" -p pad \" + o.offset.to_s + \" 0 | sox - -m\")\n elsif o.offset == 0\n #tracks += (\" -v 1 \" + o.jingle.latest_path + \" pad \" + o.offset.to_s + \" 0 | sox - -m\")\n tracks += (\" -v 0.8 \" + o.jingle.latest_path)\n end\n end\n output = assets_path\n #tracks = tracks[0..-11] # Remove the trailing command\n puts \"sox #{tracks} #{output}original.mp3\"\n m = os.first.offset == 0 ? \"-m \" : \"\"\n result = `sox #{m}#{tracks} #{output}original.mp3`\n duration = `soxi -D #{output}original.mp3`\n stat_data = `soxi #{output}original.mp3`\n # TO FIX\n # Stat data with non-UTF-8 stuff won't save in the DB.\n #stat_data = `sox #{output}original.mp3 -n stat`\n update_attributes(\n track_duration: duration,\n state: \"complete\",\n track_file_name: \"origin.mp3\",\n track_content_type: \"audio/mpeg\",\n track_file_size: (File.size(\"#{output}original.mp3\") rescue 0),\n stat: stat_data #.encode(\"UTF-8\").force_encoding('UTF-8')\n )\n rescue => error\n sox_logger.debug(\"Encountered error:\\n\")\n sox_logger.debug($!.backtrace)\n return false\n end\n end", "def mappend\n result = []\n self.each { |a| b = yield(a); b.each { |c| result << c } if b }\n result\n end", "def make_sequence\n 4.times do\n self.sequence << COLORS.sample\n end\n end", "def set_combo_sequences(battler)\n sequence = []\n size = battler.combo_sequence.size\n for i in 0...size\n attack = battler.battler_combo[battler.combo_sequence[i]]\n combo = combo_check(battler, attack, i)\n sequence << (combo.nil? ? attack.first : combo)\n end\n sequence.flatten!\n return sequence\n end", "def * times\n result = self.slice 0, 0\n frames = self.slice 0..-1\n times.times do\n result.concat frames\n end\n result\n end", "def pipelined\n yield\n end", "def shift_out(&block)\n each(&block)\n end", "def << data\n\n # put the data into the buffer, as\n # we might be replaying\n if data\n @buffer << data\n end\n\n # Don't do work if we don't have to\n if @buffer.length < 2\n return\n end\n\n # decode the first 2 bytes, with\n # opcode, lengthgth, masking bit, and frag bit\n h1, h2 = @buffer.unpack(\"CC\")\n\n # check the fragmentation bit to see\n # if this is a message fragment\n fin = ((h1 & 0x80) == 0x80)\n\n # used to keep track of our position in the buffer\n offset = 2\n\n # see above for possible opcodes\n opcode = (h1 & 0x0F)\n\n # the leading length idicator\n length = (h2 & 0x7F)\n\n # masking bit, is the data masked with\n # a specified masking key?\n masked = ((h2 & 0x80) == 0x80)\n\n # Find errors and fail fast\n if h1 & 0b01110000 != 0\n return emit :error, 1002, \"RSV bits must be 0\"\n end\n\n if opcode > 7\n if !fin\n return emit :error, 1002, \"Control frame cannot be fragmented\"\n elsif length > 125\n return emit :error, 1002, \"Control frame is too large #{length}\"\n elsif opcode > 0xA\n return emit :error, 1002, \"Unexpected reserved opcode #{opcode}\"\n elsif opcode == CLOSE && length == 1\n return emit :error, 1002, \"Close control frame with payload of length 1\"\n end\n else\n if opcode != CONTINUATION && opcode != TEXT_FRAME && opcode != BINARY_FRAME\n return emit :error, 1002, \"Unexpected reserved opcode #{opcode}\"\n end\n end\n\n # Get the actual size of the payload\n if length > 125\n if length == 126\n length = @buffer.unpack(\"@#{offset}n\").first\n offset += 2\n else\n length = @buffer.unpack(\"@#{offset}L!>\").first\n offset += 8\n end\n end\n\n # unpack the masking key\n if masked\n key = @buffer.unpack(\"@#{offset}N\").first\n offset += 4\n end\n\n # replay on next frame\n if @buffer.size < (length + offset)\n return false\n end\n\n # Read the important bits\n payload = @buffer.unpack(\"@#{offset}C#{length}\")\n\n # Unmask the data if it\"s masked\n if masked\n payload.bytesize.times do |i|\n payload[i] = ((payload[i] ^ (key >> ((3 - (i % 4)) * 8))) & 0xFF)\n end\n end\n \n payload = payload.pack(\"C*\")\n\n case opcode\n when CONTINUATION\n\n # We shouldn't get a contination without\n # knowing whether or not it's binary or text\n unless @fragmented\n return emit :error, 1002, \"Unexepected continuation\"\n end\n\n if @fragmented == :text\n @chunks << payload.force_encoding(\"UTF-8\")\n else\n @chunks << payload\n end\n\n if fin\n if @fragmented == :text && !valid_utf8?(@chunks)\n return emit :error, 1007, \"Invalid UTF\"\n end\n\n emit :frame, @chunks, @fragmented == :binary\n @chunks = nil\n @fragmented = false\n end\n\n when TEXT_FRAME\n # We shouldn't get a text frame when we\n # are expecting a continuation\n if @fragmented\n return emit :error, 1002, \"Unexepected frame\"\n end\n\n # emit or buffer\n if fin\n unless valid_utf8?(payload)\n return emit :error, 1007, \"Invalid UTF Hmm\"\n end\n\n emit :frame, payload, false\n else\n @chunks = payload.force_encoding(\"UTF-8\")\n @fragmented = :text\n end\n\n when BINARY_FRAME\n # We shouldn't get a text frame when we\n # are expecting a continuation\n if @fragmented\n return emit :error, 1002, \"Unexepected frame\"\n end\n\n # emit or buffer\n if fin\n emit :frame, payload, true\n else\n @chunks = payload\n @fragmented = :binary\n end\n\n when CLOSE\n code, explain = payload.unpack(\"nA*\")\n if explain && !valid_utf8?(explain)\n emit :close, 1007\n else\n emit :close, response_close_code(code)\n end\n\n when PING\n emit :ping, payload\n\n when PONG\n emit :pong, payload\n\n end\n\n # Remove data we made use of and call back\n # TODO: remove recursion\n @buffer = @buffer[offset + length..-1] || \"\"\n if not @buffer.empty?\n self << nil\n end\n\n end", "def pattern_seq(patternActionCouples)\n\t\treturn ConditionalActionSequence.new(patternActionCouples)\n\tend", "def reverse_shift_out_with_index(&block)\n reverse_each.with_index(&block)\n end", "def each &block\n if block_given?\n Tempfile.open('temp', binmode: true) do |newmovi|\n @avi.process_movi do |indices, movi|\n newindices = indices.select do |m|\n movi.pos = m[:offset] + 8 # 8 for id and size\n frame = Frame.new(movi.read(m[:size]), m[:id], m[:flag])\n block.call frame\n unless frame.data.nil?\n m[:offset] = newmovi.pos\n m[:size] = frame.data.size\n m[:flag] = frame.flag\n m[:id] = frame.id\n newmovi.print m[:id]\n newmovi.print [frame.data.size].pack('V')\n newmovi.print frame.data\n newmovi.print \"\\0\" if frame.data.size % 2 == 1\n true\n else\n false\n end\n end\n [newindices, newmovi]\n end\n end\n else\n self.enum_for :each\n end\n end", "def each_transform_input\n return enum_for(:each_transform_input) if !block_given?\n if !(tr = model.transformer)\n return\n end\n\n model.each_transform_input do |port, from, to|\n from = selected_frames[from]\n to = selected_frames[to]\n yield(port.bind(self), from, to)\n end\n end", "def combine_video(presentation)\n term = presentation['term']\n args = []\n for slide in presentation['slides']\n args.push command_arg(slide['video'])\n end\n args = args.join(' ')\n combined_arg = command_arg(\"#{BUILD_DIR}/#{term}/#{term}-combined.mpg\")\n final = \"#{DIST_DIR}/#{term}/#{term}.avi\"\n final_arg = command_arg(final)\n `cat #{args} > #{combined_arg}`\n `ffmpeg -y -i #{combined_arg} -r 25 -qscale:v 1 #{final_arg}`\n presentation['video'] = final\nend", "def each\n\n rewind\n\n n,f,q,c=next_seq\n\n while (!n.nil?)\n yield(n,f,q,c)\n n,f,q,c=next_seq\n end\n\n rewind\n\n end", "def compose(*fns)\n pipe(*fns.reverse)\n end", "def cycle_deferrals\n reads.push reads.shift if reads.any?\n writes.push writes.shift if writes.any?\n end", "def parenthesize_current_pipeline\n @pipe[-1].prepend(\"( \") << \" )\"\n end", "def all(*args, &block)\n ext(Sequence.new(args), block)\n end", "def all(*args, &block)\n ext(Sequence.new(args), block)\n end", "def merge!\n\t\t\twhile handle = @queue.pop\n\t\t\t\tnext if handle.cancelled?\n\t\t\t\t\n\t\t\t\[email protected](handle)\n\t\t\tend\n\t\tend", "def process_block exp\n exp = exp.dup\n exp.shift\n if @inside_concat\n @inside_concat = false\n exp[0..-2].each do |e|\n process e\n end\n @inside_concat = true\n process exp.last\n else\n exp.map! do |e|\n res = process e\n if res.empty? or res == ignore\n nil\n elsif node_type?(res, :lvar) and res.value == :_erbout\n nil\n\n else\n res\n end\n end\n block = Sexp.new(:rlist).concat(exp).compact\n block.line(exp.line)\n block\n end\n end", "def pipet_master_mixes(compositions:, microtiter_plate:)\n compositions.each do |composition|\n pipet_master_mix(\n composition: composition,\n microtiter_plate: microtiter_plate\n )\n end\n end", "def on_pipe(ast_node, context)\n left, right = *ast_node\n\n return process(left, context) + process(right, context)\n end", "def alternating_sequence\n max = amount_of_rails - 1\n direction = 1\n current = 0\n\n result = [current]\n\n (message_length - 1).times do\n current += direction\n direction *= -1 if current.zero? || current == max\n result << current\n end\n\n result\n end", "def buffer\n swap if back?\n\n if front?\n [front.render]\n\n elsif previous?\n [previous.render]\n\n else\n []\n\n end\n end", "def each\n i = 0\n until i == @sequence.size\n yield(@sequence[i])\n i += 1\n end\n end", "def get_codon_orfs1 splitter_func,do_include_leftmost_orf,do_strip_leading_codon\n orfs = split(@codons,splitter_func)\n return [] if orfs.size == 0\n # Drop the first sequence, if there is no match on the first position\n orfs.shift if !do_include_leftmost_orf and !splitter_func.call(orfs.first[0])\n orfs = orfs.map { |codons| \n codons = codons.shift if do_strip_leading_codon and splitter_func.call(codons[0])\n codons\n }\n if @reversed == nil\n TrackSequenceTrait.update_sequence_pos(orfs,@ntseq_pos) # nail against parent\n else\n TrackSequenceTrait.update_reversed_sequence_pos(orfs,@ntseq_pos) # nail against parent\n end\n end", "def emit_when_branch_mutations\n when_branches.each_with_index do |branch, index|\n Mutator.each(branch) do |mutant|\n branches = dup_when_branches\n branches[index]=mutant\n emit_self(receiver, branches, else_branch)\n end\n end\n end", "def join(outs) ; nil ; end", "def filters\n fail Error, \"Nothing to roll...\" unless @reels\n fail Error, \"Supporting just full_screen for now, sorry.\" unless @reels.all?(&:full_screen?)\n return @filters if @filters\n\n idx = process.output_index(self)\n\n @filters = []\n\n # Concatting\n segments = []\n\n @reels.each_with_index do |curr_reel, i|\n\n lbl = nil\n\n if curr_reel.reel\n\n # NOTE mapping input to this lbl\n\n lbl = \"o#{idx}rl#{i}\"\n\n # NOTE Image-Padding to match the target resolution\n # TODO full screen only at the moment (see exception above)\n\n Ffmprb.logger.debug \"#{self} asking for filters of #{curr_reel.reel.io.inspect} video: #{channel(:video)}, audio: #{channel(:audio)}\"\n @filters.concat(\n curr_reel.reel.filters_for lbl, video: channel(:video), audio: channel(:audio)\n )\n end\n\n trim_prev_at = curr_reel.after || (curr_reel.transition && 0)\n transition_length = curr_reel.transition ? curr_reel.transition.length : 0\n\n if trim_prev_at\n\n # NOTE make sure previous reel rolls _long_ enough AND then _just_ enough\n\n prev_lbl = segments.pop\n\n lbl_pad = \"bl#{prev_lbl}#{i}\"\n # NOTE generously padding the previous segment to support for all the cases\n @filters.concat(\n Filter.blank_source trim_prev_at + transition_length,\n channel(:video).resolution, channel(:video).fps, \"#{lbl_pad}:v\"\n ) if channel?(:video)\n @filters.concat(\n Filter.silent_source trim_prev_at + transition_length, \"#{lbl_pad}:a\"\n ) if channel?(:audio)\n\n if prev_lbl\n lbl_aux = lbl_pad\n lbl_pad = \"pd#{prev_lbl}#{i}\"\n @filters.concat(\n Filter.concat_v [\"#{prev_lbl}:v\", \"#{lbl_aux}:v\"], \"#{lbl_pad}:v\"\n ) if channel?(:video)\n @filters.concat(\n Filter.concat_a [\"#{prev_lbl}:a\", \"#{lbl_aux}:a\"], \"#{lbl_pad}:a\"\n ) if channel?(:audio)\n end\n\n if curr_reel.transition\n\n # NOTE Split the previous segment for transition\n\n if trim_prev_at > 0\n @filters.concat(\n Filter.split \"#{lbl_pad}:v\", [\"#{lbl_pad}a:v\", \"#{lbl_pad}b:v\"]\n ) if channel?(:video)\n @filters.concat(\n Filter.asplit \"#{lbl_pad}:a\", [\"#{lbl_pad}a:a\", \"#{lbl_pad}b:a\"]\n ) if channel?(:audio)\n lbl_pad, lbl_pad_ = \"#{lbl_pad}a\", \"#{lbl_pad}b\"\n else\n lbl_pad, lbl_pad_ = nil, lbl_pad\n end\n end\n\n if lbl_pad\n\n # NOTE Trim the previous segment finally\n\n new_prev_lbl = \"tm#{prev_lbl}#{i}a\"\n\n @filters.concat(\n Filter.trim 0, trim_prev_at, \"#{lbl_pad}:v\", \"#{new_prev_lbl}:v\"\n ) if channel?(:video)\n @filters.concat(\n Filter.atrim 0, trim_prev_at, \"#{lbl_pad}:a\", \"#{new_prev_lbl}:a\"\n ) if channel?(:audio)\n\n segments << new_prev_lbl\n Ffmprb.logger.debug \"Concatting segments: #{new_prev_lbl} pushed\"\n end\n\n if curr_reel.transition\n\n # NOTE snip the end of the previous segment and combine with this reel\n\n lbl_end1 = \"o#{idx}tm#{i}b\"\n lbl_reel = \"o#{idx}tn#{i}\"\n\n if !lbl # no reel\n lbl_aux = \"o#{idx}bk#{i}\"\n @filters.concat(\n Filter.blank_source transition_length, channel(:video).resolution, channel(:video).fps, \"#{lbl_aux}:v\"\n ) if channel?(:video)\n @filters.concat(\n Filter.silent_source transition_length, \"#{lbl_aux}:a\"\n ) if channel?(:audio)\n end # NOTE else hope lbl is long enough for the transition\n\n @filters.concat(\n Filter.trim trim_prev_at, trim_prev_at + transition_length, \"#{lbl_pad_}:v\", \"#{lbl_end1}:v\"\n ) if channel?(:video)\n @filters.concat(\n Filter.atrim trim_prev_at, trim_prev_at + transition_length, \"#{lbl_pad_}:a\", \"#{lbl_end1}:a\"\n ) if channel?(:audio)\n\n # TODO the only supported transition, see #*lay\n @filters.concat(\n Filter.blend_v transition_length, channel(:video).resolution, channel(:video).fps, [\"#{lbl_end1}:v\", \"#{lbl || lbl_aux}:v\"], \"#{lbl_reel}:v\"\n ) if channel?(:video)\n @filters.concat(\n Filter.blend_a transition_length, [\"#{lbl_end1}:a\", \"#{lbl || lbl_aux}:a\"], \"#{lbl_reel}:a\"\n ) if channel?(:audio)\n\n lbl = lbl_reel\n end\n\n end\n\n segments << lbl # NOTE can be nil\n end\n\n segments.compact!\n\n lbl_out = segments[0]\n\n if segments.size > 1\n lbl_out = \"o#{idx}o\"\n\n @filters.concat(\n Filter.concat_v segments.map{|s| \"#{s}:v\"}, \"#{lbl_out}:v\"\n ) if channel?(:video)\n @filters.concat(\n Filter.concat_a segments.map{|s| \"#{s}:a\"}, \"#{lbl_out}:a\"\n ) if channel?(:audio)\n end\n\n # Overlays\n\n # NOTE in-process overlays first\n\n @overlays.to_a.each_with_index do |over_reel, i|\n next if over_reel.duck # NOTE this is currently a single case of multi-process... process\n\n fail Error, \"Video overlays are not implemented just yet, sorry...\" if over_reel.reel.channel?(:video)\n\n # Audio overlaying\n\n lbl_nxt = \"o#{idx}o#{i}\"\n\n lbl_over = \"o#{idx}l#{i}\"\n @filters.concat( # NOTE audio only, see above\n over_reel.reel.filters_for lbl_over, video: false, audio: channel(:audio)\n )\n @filters.concat(\n Filter.copy \"#{lbl_out}:v\", \"#{lbl_nxt}:v\"\n ) if channel?(:video)\n @filters.concat(\n Filter.amix_to_first_same_volume [\"#{lbl_out}:a\", \"#{lbl_over}:a\"], \"#{lbl_nxt}:a\"\n ) if channel?(:audio)\n\n lbl_out = lbl_nxt\n end\n\n # NOTE multi-process overlays last\n\n @channel_lbl_ios = {} # XXX this is a spaghetti machine\n @channel_lbl_ios[\"#{lbl_out}:v\"] = io if channel?(:video)\n @channel_lbl_ios[\"#{lbl_out}:a\"] = io if channel?(:audio)\n\n # TODO supporting just \"full\" overlays for now, see exception in #add_reel\n @overlays.to_a.each_with_index do |over_reel, i|\n\n # NOTE this is currently a single case of multi-process... process\n if over_reel.duck\n fail Error, \"Don't know how to duck video... yet\" if over_reel.duck != :audio\n\n Ffmprb.logger.info \"ATTENTION: ducking audio (due to the absence of a simple ffmpeg filter) does not support streaming main input. yet.\"\n\n # So ducking just audio here, ye?\n # XXX check if we're on audio channel\n\n main_av_o = @channel_lbl_ios[\"#{lbl_out}:a\"]\n fail Error, \"Main output does not contain audio to duck\" unless main_av_o\n\n intermediate_extname = Process.intermediate_channel_extname video: main_av_o.channel?(:video), audio: main_av_o.channel?(:audio)\n main_av_inter_i, main_av_inter_o = File.threaded_buffered_fifo(intermediate_extname, reader_open_on_writer_idle_limit: Util::ThreadedIoBuffer.timeout * 2, proc_vis: process)\n @channel_lbl_ios.each do |channel_lbl, io|\n @channel_lbl_ios[channel_lbl] = main_av_inter_i if io == main_av_o # XXX ~~~spaghetti\n end\n process.proc_vis_edge process, main_av_o, :remove\n process.proc_vis_edge process, main_av_inter_i\n Ffmprb.logger.debug \"Re-routed the main audio output (#{main_av_inter_i.path}->...->#{main_av_o.path}) through the process of audio ducking\"\n\n over_a_i, over_a_o = File.threaded_buffered_fifo(Process.intermediate_channel_extname(audio: true, video: false), proc_vis: process)\n lbl_over = \"o#{idx}l#{i}\"\n @filters.concat(\n over_reel.reel.filters_for lbl_over, video: false, audio: channel(:audio)\n )\n @channel_lbl_ios[\"#{lbl_over}:a\"] = over_a_i\n process.proc_vis_edge process, over_a_i\n Ffmprb.logger.debug \"Routed and buffering auxiliary output fifos (#{over_a_i.path}>#{over_a_o.path}) for overlay\"\n\n inter_i, inter_o = File.threaded_buffered_fifo(intermediate_extname, proc_vis: process)\n Ffmprb.logger.debug \"Allocated fifos to buffer media (#{inter_i.path}>#{inter_o.path}) while finding silence\"\n\n ignore_broken_pipes_was = process.ignore_broken_pipes # XXX maybe throw an exception instead?\n process.ignore_broken_pipes = true # NOTE audio ducking process may break the overlay pipe\n\n Util::Thread.new \"audio ducking\" do\n process.proc_vis_edge main_av_inter_o, inter_i # XXX mark it better\n silence = Ffmprb.find_silence(main_av_inter_o, inter_i)\n\n Ffmprb.logger.debug \"Audio ducking with silence: [#{silence.map{|s| \"#{s.start_at}-#{s.end_at}\"}.join ', '}]\"\n\n Process.duck_audio inter_o, over_a_o, silence, main_av_o,\n process_options: {parent: process, ignore_broken_pipes: ignore_broken_pipes_was, timeout: process.timeout},\n video: channel(:video), audio: channel(:audio)\n end\n end\n\n end\n\n @filters\n end", "def reverse_each_from_current_pos\n return to_enum(:reverse_each_from_current_pos) unless block_given?\n\n # read the rest of the current line, in case we started in the middle of a line\n start_pos = pos\n fragment = readline rescue \"\"\n seek(start_pos)\n\n while data = reverse_read(4096)\n lines = data.each_line.to_a\n lines.last << fragment unless lines.last[-1] == \"\\n\"\n\n fragment = lines.first\n\n lines[1..-1].reverse_each { |line| yield line }\n end\n\n yield fragment\n end", "def test_with_multiple_compositions\n pipeline = Class.new(Pipeline)\n pipeline.use @append_a, @append_b\n pipeline.use @append_c\n result = pipeline.process([])\n assert_equal(['a', 'b', 'c'], result)\n end", "def finish\n\t\toutput = \"\"\n\t\tinflate unless @output_buffer.length > 0\n\t\t@output_buffer.each {|c| output << c } \n\t\tsuper\n\t\toutput\n\tend", "def chain\n [self]\n end", "def shift_out_left_with_index\n # This is functionally equivalent to reverse_shift_out_with_index\n reverse_each.with_index { |bit, i| yield bit, i }\n end", "def pipe(*cmds)\n s = cmds.map { |x| x.join(\" \") }\n s = s.join(\" | \")\n STDERR.puts \"+ #{s}\"\n Open3.pipeline(*cmds).each do |status|\n unless status.success?\n error \"Piped command failed\"\n exit 1\n end\n end\n end", "def cycle()\n Enumerator.new do |out|\n values = self.touch{|x| out.yield x}.to_a\n unless values.empty?\n loop do\n values.each{|x| out.yield x}\n end\n end\n end\n end", "def seq()\n node1 = symbol()\n\n if @look.kind.eql?(Token::CHARACTER) then\n node2 = seq()\n node = Concat.new(node1, node2)\n\n return node\n else\n return node1\n end\n end", "def each_with_trailing\n (0 .. self.size - 1).each { |index| yield self[index], (index == 0 ? nil : self[index - 1] ) }\n end", "def change_origin_of_rich_sequence(path_to_sequence, new_origin, sequence_format = nil, output_sequence_format = nil)\n biosequence = biosequence_from_file(path_to_sequence, sequence_format)\n sequence_length = biosequence.to_s.length\n # shift the sequence\n first_sequence_part = biosequence.splice((1..new_origin-1).to_s)\n last_sequence_part = biosequence.splice((new_origin..sequence_length).to_s)\n biosequence.seq = last_sequence_part + first_sequence_part\n\n # now to shift those features\n five_prime_shifted_features = Array.new\n three_prime_shifted_features = Array.new\n source_feature = nil\n\n biosequence.features.each do |feature|\n location = feature.locations.locations.first\n if feature.feature == \"source\"\n source_feature = feature\n else\n if location.from >= new_origin\n offset = -new_origin + 1\n else\n offset = sequence_length - new_origin + 1\n end\n new_start = location.from + offset\n new_end = location.to + offset\n location.from = new_start\n location.to = new_end\n\n feature_locations = feature.locations\n feature_locations.locations = [location]\n feature.position = feature_locations.to_s # the location of a feature is based on it's position string, not a Bio:Locations object which is created on the fly (why I have no idea!)\n if offset < 0 # negative offset means that this feature needs to go into new 5_prime_shifted_features\n five_prime_shifted_features << feature\n else\n three_prime_shifted_features << feature\n end\n end\n end\n five_prime_shifted_features.unshift(source_feature)\n biosequence.features = five_prime_shifted_features + three_prime_shifted_features\n\n output_sequence_format ||= guess_sequence_format(path_to_sequence)\n case output_sequence_format\n when :genbank\n output_suffix = \"gbk\"\n when :embl\n output_suffix = \"embl\"\n end\n reoriented_file = File.open(\"#{File.dirname(path_to_sequence)}/#{file_prefix_from_filepath(path_to_sequence)}_reoriented.#{output_suffix}\", \"w\")\n \n puts biosequence.output(output_sequence_format)\n # reoriented_file.puts biosequence.output(output_sequence_format)\n reoriented_file.close\nend", "def reverse( albums )\n i = albums.count - 1\n while i >= 0\n yield albums[i]\n i -= 1\n end\nend", "def rot #@\n a = pop\n b = pop\n c = pop\n push a\n push c\n push b\n end", "def >>(parslet)\n Parslet::Atoms::Sequence.new(self, parslet)\n end", "def each_transform_port(&block)\n if !block\n return enum_for(:each_transform_port)\n end\n each_transform_input(&block)\n each_transform_output(&block)\n end", "def each(&block)\n return to_enum(__method__) unless block\n\n @receivers << block\n block.call io.string.dup unless io.string.empty?\n sync\n\n self\n end", "def aa_frames seq\n res = []\n # remove white space\n seq = seq.gsub(/\\s/,'')\n ajpseq = Biolib::Emboss.ajSeqNewNameC(seq,\"Test sequence\")\n [1,2,3,-1,-2,-3].each do | frame |\n ajpseqt = Biolib::Emboss.ajTrnSeqOrig(@trn_table,ajpseq,frame)\n aa = Biolib::Emboss.ajSeqGetSeqCopyC(ajpseqt)\n res.push({:frame => frame, :sequence => aa})\n end\n res\n end", "def assemble io\n @entry.assemble(io)\n @blocks.each do |block|\n block.assemble io\n end\n end", "def eternal_sequence\n Enumerator.new do |enum|\n i = 0\n while true\n enum.yield i # <- Notice that this is the yield method of the enumerator, not the yield keyword\n i +=1\n end\n end\nend", "def merge(fds)\n fds = fds.dup\n rel = fds.shift\n\n changed = true\n while changed\n changed = false\n fds.each_index do |i|\n if ...\n end\n end\n end\n end\nend", "def _reverse_each(&block)\n previous.reverse_each(&block) if previous\n end", "def reduce_pattern_sequence(_production, _range, _tokens, theChildren)\n return theChildren[0] if theChildren[1].empty?\n\n successors = theChildren[1].map { |pair| pair[1] }\n if successors[0].kind_of?(Regex::Lookaround) && successors[0].dir == :behind\n Regex::Concatenation.new(successors.shift, theChildren[0], *successors)\n else\n Regex::Concatenation.new(theChildren[0], *successors)\n end\n end", "def start_after(&blk)\n Enumerator.new do |out|\n s = self.ensure_enum\n loop do\n break if blk.call(s.next)\n end\n \n loop do\n out.yield s.next\n end\n end\n end", "def test_with_multiple_composites\n pipeline = Class.new(Pipeline)\n pipeline.use @append_a, @append_b\n result = pipeline.process([])\n assert_equal(['a', 'b'], result)\n end", "def compose\n create_log_folder\n in_tmp_dir do\n concats = {}\n\n Queue.run *@params[:components].each_with_index.map { |component, i|\n proc {\n concats.store i,\n case component[:type]\n when Parameters::VIDEO_COMPONENT\n compose_video *component.values_at(:video, :from, :to), i\n when Parameters::IMAGE_COMPONENT\n compose_image *component.values_at(:image, :duration), i\n when Parameters::TEXT_COMPONENT\n compose_text *component.values_at(:content, :duration, :text_color, :background_color), i\n else\n raise Error.new(\"wrong component type\", type: component[:type])\n end\n }\n }\n\n concats_sorted = concats.sort\n Queue.run *concats_sorted[0, concats_sorted.size-1].map { |i, concat|\n next_i = i+1\n next_concat = concats_sorted[next_i][1]\n proc {\n transition_i = (i+next_i)/2.0\n concats.store transition_i, Transition.new(concat, next_concat, tmp_path(transition_i.to_s), log_folder('transitions', transition_i.to_s)).run\n }\n }\n\n concat = tmp_path 'concat'\n outputs = Concat.new(concats.sort.map{ |_,c| c }, concat, log_folder('concat')).run\n\n if audio\n audios = Hash[ Media::Audio::FORMATS.map{ |f| [f, audio.media.path(f)] } ]\n outputs = ReplaceAudio.new(outputs, audios, tmp_path('replace_audio'), log_folder('replace_audio')).run\n end\n\n video.media = outputs.merge(filename: video.title)\n video.composing = nil\n video.metadata.old_fields = nil\n\n ActiveRecord::Base.transaction do\n video.save!\n video.enable_lessons_containing_me\n Notification.send_to(\n video.user_id,\n I18n.t(\"notifications.video.compose.#{notification_translation_key}.ok.title\"),\n I18n.t(\"notifications.video.compose.#{notification_translation_key}.ok.message\", :item => video.title),\n ''\n )\n video.user.video_editor_cache!\n end\n end\n end", "def imagepipeline\n # delete non-image files\n images = Dir.entries(@from_dir).delete_if do |file|\n (file =~ /\\w+\\.(jpg|jpeg)/) == nil\n end\n images.each do |file|\n yield File.join(@from_dir,file), File.join(@to_dir,file)\n end\n end" ]
[ "0.55786127", "0.55237335", "0.5514554", "0.5489264", "0.5185701", "0.51747787", "0.5120849", "0.5050066", "0.5002008", "0.49842793", "0.49427727", "0.49096182", "0.48974484", "0.48387903", "0.47656763", "0.47531092", "0.4722176", "0.47030795", "0.46691358", "0.46670598", "0.4665852", "0.4582143", "0.455656", "0.45041013", "0.44989315", "0.4485566", "0.44734302", "0.4461415", "0.4454141", "0.43986434", "0.43914795", "0.43876907", "0.43777215", "0.43772218", "0.4374136", "0.43711334", "0.43678728", "0.43670297", "0.4353271", "0.43508357", "0.43453968", "0.43414444", "0.43398735", "0.43206066", "0.4317061", "0.43161914", "0.43156525", "0.43151465", "0.43150002", "0.4306005", "0.43028864", "0.4295866", "0.42877024", "0.42671618", "0.42669454", "0.42512116", "0.42369387", "0.42366442", "0.42358798", "0.42260638", "0.42248896", "0.4223111", "0.42053562", "0.42053562", "0.42005464", "0.41965774", "0.41964266", "0.41927537", "0.41920432", "0.41903725", "0.41843998", "0.41796166", "0.41773334", "0.41689238", "0.41586167", "0.41490108", "0.4144054", "0.41401553", "0.4138845", "0.41367644", "0.41363192", "0.41346806", "0.4132307", "0.41312337", "0.41305172", "0.4129987", "0.4123931", "0.4122247", "0.410756", "0.41074982", "0.41000095", "0.4096452", "0.40946156", "0.40938842", "0.40920222", "0.4083864", "0.4081535", "0.40808213", "0.4079083", "0.4069406" ]
0.6173581
0
1 2 3 4 4 5 6 5 7 8 9 6 i cannot be less than 0 j cannot be less than 0 el= 1 if i = 0, j=0 , valid diags: [[1,1], [1, 1]] el= 2 if i =0, j= 1, valid diags: [[1, 2], [1, 0]] el = 3 if i=0, j=2, valid diags: [[1,3], [1, 1], [2, 0]]
def diagAve(arr, i, j) # (arr= input, i=0 , j = 0) nums = [arr[i][j]] # we iterate through matrix as long as we are inbound while (i+1 > 0 && j-1 >= 0) if (i+1 < arr.length && j-1 < arr[0].length) i+=1 j-=1 nums.push(arr[i][j]) else break end end length = nums.length (nums.reduce(:+))/length end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sudoku_clauses\n res = []\n\n #ensure each cell contains a digit\n (1..9).each do |i|\n (1..9).each do |j|\n #must contains at least one of 9 digits\n res << (1..9).map {|d| variable(i, j, d) }\n\n (1..9).each do |d|\n ((d+1)..9).each do |dp|\n #can not contain two digits at once\n res << [-variable(i, j, d), -variable(i, j, dp)]\n end\n end\n end\n end\n\n #ensure each rows and columns contain distinct values\n (1..9).each do |i|\n res += valid( (1..9).map{|j| [i, j]} )\n res += valid( (1..9).map{|j| [j, i]} )\n end\n\n #ensure 3x3 sub-grids regions have distinct values\n [1, 4, 7].each do |i|\n [1, 4, 7].each do |j|\n res += valid((0..8).map{|k| [i + k%3, j+k / 3]})\n end\n end\n\n res\n end", "def validate\n\n entireSet = Set.new([1, 2, 3, 4, 5, 6, 7, 8, 9])\n\n @rows = []\n 9.times { @rows.push(entireSet.dup) }\n\n @cols = []\n 9.times { @cols.push(entireSet.dup) }\n\n @box = []\n 3.times do\n subrow = []\n 3.times { subrow.push(entireSet.dup) }\n @box.push(subrow)\n end\n\n (0..8).each do |i|\n (0..8).each do |j|\n v = @grid[i,j]\n if v > 0\n raise \"dup number in row #{i} : #{v}\" unless @rows[i].delete?(v)\n raise \"dup number in column #{j} : #{v}\" unless @cols[j].delete?(v)\n raise \"dup number in box #{i/3}-#{j/3} : #{v}\" unless @box[i/3][j/3].delete?(v)\n end\n end\n end\n\n @poss = []\n @poss_grid = []\n (0..8).each do |i|\n poss_row = []\n (0..8).each do |j|\n if @grid[i,j] == 0 then\n p = Poss.new(i, j, @rows[i], @cols[j], @box[i/3][j/3])\n @poss.push(p)\n poss_row.push(p.to_a)\n else\n poss_row.push([])\n end\n end\n @poss_grid.push(poss_row)\n end\n @poss.sort! { |x, y| x.length <=> y.length }\n\n end", "def check_diag1(board)\n (0..2).to_a.each_with_object(Hash.new(0)) do |i, m|\n m[board[i][i]] += 1 if board[i][i]\n end\nend", "def identify_neighbours\n @x.times{ |r|\n @y.times{|c| \n #+1,+1 0,+1 +1,0\n @mat[r][c].add_neighbour @mat[r+1][c+1] unless @mat[r+1].nil? || @mat[r+1][c+1].nil?\n @mat[r][c].add_neighbour @mat[r][c+1] unless @mat[r].nil? || @mat[r][c+1].nil?\n @mat[r][c].add_neighbour @mat[r+1][c] unless @mat[r+1].nil? || @mat[r+1][c].nil?\n \n #-1,-1 0,-1 -1,0\n @mat[r][c].add_neighbour @mat[r-1][c-1] unless @mat[r-1].nil? || @mat[r-1][c-1].nil?\n @mat[r][c].add_neighbour @mat[r-1][c] unless @mat[r-1].nil? || @mat[r-1][c].nil?\n @mat[r][c].add_neighbour @mat[r][c-1] unless @mat[r].nil? || @mat[r][c-1].nil?\n \n #+1,-1 -1,+1\n @mat[r][c].add_neighbour @mat[r-1][c+1] unless @mat[r-1].nil? || @mat[r-1][c+1].nil?\n @mat[r][c].add_neighbour @mat[r+1][c-1] unless @mat[r+1].nil? || @mat[r+1][c-1].nil?\n \n }\n \n } \n end", "def check_diagonals\n 0.upto(2) do |i|\n 0.upto(3) do |j|\n if (@board[j][i].to_s + @board[j + 1][i + 1].to_s + @board[j + 2][i + 2].to_s + @board[j + 3][i + 3].to_s).match(/RRRR|BBBB/) != nil\n return true\n end\n end\n 3.upto(6) do |j|\n if (@board[j][i].to_s + @board[j - 1][i + 1].to_s + @board[j - 2][i + 2].to_s + @board[j - 3][i + 3].to_s).match(/RRRR|BBBB/) != nil\n return true\n end\n end\n end\n return false\n end", "def check_diagonals(piece)\n #create padding array e.g. [[],[nil],[nil,nil]] etc\n padding = [*0..(grid.length - 1)].map { |i| [nil] * i }\n\n #pad the grid on both sides to shift each row over i elements\n padded1 = padding.reverse.zip(grid).zip(padding).map(&:flatten)\n diagonals_up = padded1.transpose.map(&:compact)\n\n #pad the opposite direction to get diagonals the other way\n padded2 = padding.zip(grid).zip(padding.reverse).map(&:flatten)\n diagonals_down = padded2.transpose.map(&:compact)\n\n #combine all the diagonals\n diagonals = diagonals_up + diagonals_down\n\n #check diagonals for groups of four\n diagonals.each do |diag|\n diag.each_cons(4).each do |combination|\n return true if combination.all? { |a| a == piece }\n end\n end\n false\n end", "def validSolution(board)\n return false if board.flatten.size != 81\n return false if board.flatten.any? { |el| el.class != Fixnum }\n return false if board.size != 9\n board.each do |row|\n return false if row.any? { |el| el < 1 || el > 9 }\n return false if row.uniq.size != 9\n end\n (0..8).each do |col|\n this_col = []\n (0..8).each do |el|\n this_col << board[el][col]\n end\n return false if this_col.uniq.size != 9\n end\n [-1, 2, 5].each do |xoffset|\n [-1, 2, 5].each do |yoffset|\n this_square = []\n (1..3).each do |x|\n (1..3).each do |y|\n this_square << board[x + xoffset][y + yoffset]\n end\n end\n return false if this_square.uniq.size != 9\n end\n end\n true\nend", "def check_diag_ne\n 0.upto(@num_col - 4) do |col|\n consecutive = 0\n curr_tile = @board[0][col]\n @num_row.times do |row|\n break if col + row == @num_col\n next unless @board[row][col+row]\n if curr_tile == @board[row][col+row]\n consecutive += 1\n return true if consecutive == 4\n else\n curr_tile = @board[row][col+row]\n consecutive = 1\n end\n end\n end\n false\n end", "def validation(board, xblks, yblks)\n # row in valid\n\n \tfor x in 0..board.length-1\n \t\tcol = Array.new\n \t\trow = Array.new(board[x]) #need new array not modify board via reference\n\t\tblock = Array.new(board.length) {Array.new}\n \t\tfor y in 0..board.length-1\n if (board[y][x] != 0)\n\n \t\t\t\tcol.concat([board[y][x]])\n\t\t\tend\n\n\t\t\tputs [y, x]\n \t\t\tputs \"\"\n\t\t\tif (board[x][y] != 0)\n \t\t\t\tblk = (x/xblks).floor + yblks * (y/yblks).floor\n\t\t\t\tblock[blk-1].concat([board[x][y]])\n\t\t\tend\n \t \tend\n\t\trow.delete(0)\n\n \t\tif (col.uniq! != nil or row.uniq! != nil)\n\n\n\t\t\treturn false\n\t\tend\n\n\n \tend\n\n for each in block\n\t\tif each.uniq! != nil\n\t\t\treturn false\n\t\tend\n\tend\n\treturn true\n end", "def check_diaganol(x_target, y_target)\n\n x = coordinate_x\n y = coordinate_y\n \n\n #top to bottom and left to right\n if x < x_target and y > y_target\n while x < x_target do \n x = x + 1 \n y = y - 1\n\n return true if is_occupied?(x, y) == true\n end\n end\n\n #top to bottom and right to left\n if x > x_target and y > y_target\n while x > x_target do \n \n x = x - 1 \n y = y - 1\n return true if is_occupied?(x, y)\n \n end\n end\n\n #bottom to top and right to left\n if x > x_target and y < y_target\n while x > x_target do \n x = x - 1 \n y = y + 1\n \n return true if is_occupied?(x, y)\n end\n end\n\n #bottom to top and left to right\n if x < x_target and y < y_target\n while x < x_target do \n x = x + 1 \n y = y + 1\n return true if is_occupied?(x, y)\n end\n end\n\n return false\n end", "def validate_grid(array, element, row, column, array2)\n row = row - 1\n column = column - 1\n set_flag_row = validate_row(array, element, row)\n print \"\\n Row =>#{set_flag_row} \" #1 element found row\n set_flag_column = validate_column(array, element, column)\n print \"\\n Column => #{set_flag_column} \" #1 element found in column\n set_flag_grid = validate_matrix(array, element, row, column)\n print \"\\n Grid =>#{set_flag_grid} \"\n set_flag_state = validate_state(array, row, column, array2)\n print \"\\n state =>#{set_flag_state}\\n\"\nend", "def isSafe(i, j, visited, m)\n # row number is in range, column number\n # is in range and value is 1\n # and not yet visited\n # puts \"isSafe i:#{i}, j:#{j} visited:#{visited.inspect}\"\n return i >= 0 && i <= @row &&\n j >= 0 && j <= @column &&\n !visited[i][j] && m[i][j] == 1\nend", "def check_diagonal\n RulesContracts.classic_model(@game_state_model)\n # testing for bitboard errors\n # (0..7).each { |y|\n # (0..7).each { |x|\n # if @grid[y][x] == 1 and y <= 4 and x >= 3\n # puts \" #{x}/#{y} #{@grid[y][x]} || #{x-1}/#{y+1} #{@grid[y + 1][x - 1]} || #{x-2}/#{y+2} #{@grid[y + 2][x - 2]} || #{x-3}/#{y+3} #{@grid[y + 3][x - 3]}\"\n # puts \"#{@grid[y][x] == 1 and @grid[y + 1][x - 1] == 1 and @grid[y + 2][x - 2] == 1 and @grid[y + 3][x - 3] == 1}\"\n # end\n # }\n # }\n \n (0..7).each { |y|\n (0..7).each { |x|\n if y <= 4 and x <= 4\n if @grid[y][x] == 2 and @grid[y + 1][x + 1] == 2 and @grid[y + 2][x + 2] == 2 and @grid[y + 3][x + 3] == 2\n @winner = 1\n return true\n elsif @grid[y][x] == 1 and @grid[y + 1][x + 1] == 1 and @grid[y + 2][x + 2] == 1 and @grid[y + 3][x + 3] == 1\n @winner = 0\n return true\n end \n end\n if y <= 4 and x >= 3\n if @grid[y][x] == 2 and @grid[y + 1][x - 1] == 2 and @grid[y + 2][x - 2] == 2 and @grid[y + 3][x - 3] == 2\n @winner = 1\n return true\n elsif @grid[y][x] == 1 and @grid[y + 1][x - 1] == 1 and @grid[y + 2][x - 2] == 1 and @grid[y + 3][x - 3] == 1\n @winner = 0\n return true\n end\n end\n if y >= 3 and x <= 4\n if @grid[y][x] == 2 and @grid[y - 1][x + 1] == 2 and @grid[y - 2][x + 2] == 2 and @grid[y - 3][x + 3] == 2\n @winner = 1\n return true\n elsif @grid[y][x] == 1 and @grid[y - 1][x + 1] == 1 and @grid[y - 2][x + 2] == 1 and @grid[y - 3][x + 3] == 1\n @winner = 0\n return true\n end \n end\n if y >= 3 and x >= 3\n \n if @grid[y][x] == 2 and @grid[y - 1][x - 1] == 2 and @grid[y - 2][x - 2] == 2 and @grid[y - 3][x - 3] == 2\n @winner = 1\n return true\n elsif @grid[y][x] == 1 and @grid[y - 1][x - 1] == 1 and @grid[y - 2][x - 2] == 1 and @grid[y - 3][x - 3] == 1\n @winner = 0\n return true\n end \n \n end \n }\n }\n return false\n end", "def populate_unvisited_except(visited_row, visited_col, board_dimension)\n visited_board = []\n\n board_dimension.times do |row|\n visited_row = []\n board_dimension.times do |col|\n if (row == visited_row && col == visited_col)\n visited_row << true\n else\n visited_row << false\n end\n end\n visited_board << visited_row\n end\n\n visited_board\nend", "def sudoku(rows)\n # constrain the non-zero elements to keep their current values, and\n # constrain the zero elements (i.e. the blanks) to be between 1 and 9\n constrain_each_row(rows)\nend", "def is_outside_matrix(i, j, matrix)\n return true if i < 0 or j < 0 or i > matrix.size - 1 or j > matrix[0].size - 1\n return false \nend", "def all_valid\n # Check the vertical\n @size.times { |i|\n if !valid_column(i)\n return false\n end\n }\n\n # Check the diagonal\n @size.times { |i|\n if !valid_diagonal(true, true, i)\n return false\n end\n if !valid_diagonal(true, false, i)\n return false\n end\n if !valid_diagonal(false, true, i)\n return false\n end\n if !valid_diagonal(false, false, i)\n return false\n end\n }\n\n # Check the horizontal\n @size.times { |i|\n if !valid_row(i)\n return false\n end\n }\n\n return true\n end", "def check_diagonal2\n cell = @last_cell_played\n count = 1\n while cell.rd && cell.rd.color == cell.color\n cell = cell.rd\n end\n while cell.lu && cell.lu.color == cell.color\n cell = cell.lu\n count += 1\n end\n return true if count >= 4\n false\n end", "def diagonals_checker(square_object, board, counter_max)\n diag1 = []\n diag2 = []\n diag3 = []\n diag4 = []\n counter = 1\n while counter <= counter_max\n nil_checker1 = square_object.dup.add_row(counter)\n nil_checker2 = square_object.dup.add_row(-counter)\n\n diag1 << (square_object.dup.add_row(counter).add_column(counter)) if nil_checker1.row != nil\n diag2 << (square_object.dup.add_row(-counter).add_column(-counter)) if nil_checker2.row != nil\n diag3 << (square_object.dup.add_row(-counter).add_column(counter)) if nil_checker2.row != nil\n diag4 << (square_object.dup.add_row(counter).add_column(-counter)) if nil_checker1.row != nil\n\n counter += 1\n end\n diag1 = legal_moves_delete(diag1, board)\n diag2 = legal_moves_delete(diag2, board)\n diag3 = legal_moves_delete(diag3, board)\n diag4 = legal_moves_delete(diag4, board)\n\n diag1 + diag2 + diag3 + diag4\n end", "def diagonal_slide(row, col) # oh cool try the .downto here instead of the reverse always nice to try new things even though it doesn't make for the most sensical code as per https://stackoverflow.com/questions/2070574/is-there-a-reason-that-we-cannot-iterate-on-reverse-range-in-ruby love it the last time you did reverse just because you didn't think about it until later now knowing this you can do it this way love it ah nevermind no need but would have been great to write smaller.downto(0).map oh well lol remember that for some other time love Ruby what a great language\n (row <= col) ? (smaller, larger = row, col) : (smaller, larger = col, row) # establish which number is the smaller of the two and the larger love it you have some crazy short code lol. For the nw and se diagonals\n nw = check_blocking_pieces((1..smaller).map { |offset| [row-offset, col-offset] }) # go by smaller because that's which one will hit 0 first\n ne = check_blocking_pieces((1..(7-row)).map { |offset| [row+offset, col-offset] if ((col-offset) >= 0) }.compact) # Need to use .compact to remove all the nil elements that were returned by .map since can't quite use select or reject since you *do* want to return the evaluation of the array but ah well code smells http://ruby-doc.org/core-1.9.3/Array.html#method-i-compact if you don't get rid of these nils then in the check_blocking_pieces() you'll run into an error since it'll be trying to get an index of a nil value in moves lol amaizng that even the most misleading errors you can debug with debugger and a good eye fuck byebug is so powerful # go by larger but check that the thing doesn't go out of bounds, the only bounds that it could go out if you have the row correct is col-offset being less than 0 # ahh these return nil for everything it doesn't return for so that's the error love it great catch # don't know what you would do without byebug it's literally god mode\n sw = check_blocking_pieces((1..(7-col)).map { |offset| [row-offset, col+offset] if ((row-offset) >= 0) }.compact) # go up until col == 7 as long as row is above or equal to 0, could do it the other way too, as long as col <= 7 go until row hits 0, but same thing\n se = check_blocking_pieces((1..(7-larger)).map { |offset| [row+offset, col+offset] }) # increase up until the largest one equals 7 basically there might be some nil issues with this but this should work can't wait to check it if you add them all up and there are some nils they might not add let's see, ah nope thankfully map returns an empty array fucking love it Ruby is the best\n (nw + ne + sw + se)\nend", "def minesweeper(matrix)\n height = matrix.count - 1\n width = matrix[0].count - 1\n\n finalArray = Array.new\n \n for i in 0..height\n temp = Array.new\n for j in 0..width\n temp << check33(matrix, j, i)\n end\n finalArray << temp\n end\n finalArray\nend", "def validSolution(board)\n array_of_boxes = Array.new\n box = Array.new\n i = 0\n\n add_box_array = lambda do\n 3.times do\n 3.times do\n row = board[i]\n box.push(row[0]).push(row[1]).push(row[2])\n i += 1\n end\n\n array_of_boxes << box\n box = Array.new\n end\n end\n\n reset_and_rotate = lambda do\n i = 0\n board.each{ |row| row.rotate!(3) }\n end\n\n add_reset_rotate = lambda do\n add_box_array.call\n reset_and_rotate.call\n end\n\n 2.times {add_reset_rotate.call}\n add_box_array.call\n all_possible_arrays = (1..9).to_a.permutation.to_a\n\n # each row & each column is a unique permutation of base_array\n board.all?{ |row| all_possible_arrays.include?(row) } &&\n board.uniq.size == 9 &&\n board.transpose.all?{ |column| all_possible_arrays.include?(column) } &&\n board.transpose.uniq.size == 9 &&\n array_of_boxes.all? { |box| all_possible_arrays.include?(box) }\nend", "def diag?(twod_arr)\n first_diag = []\n second_diag = [] # two arrays for later storage\n\n (0...twod_arr.length).each do |idx| # looping though the length of the array\n first_diag << twod_arr[idx][idx] # storeing the first diag, it's easy since its index will always be the same\n second_diag << twod_arr[idx][twod_arr.length - 1 -idx] #second diag, this is the invert of \n end\n\n first_diag.uniq.length == 1 || second_diag.uniq.length == 1\nend", "def solution(a)\n # [1, -INFINITY, -INFINITY, -INFINITY, -INFINITY, -INFINITY]\n # [1,-1, 1, 10, 0, -1] row = 1. start_val = 1\n # [1,-1, 1, 10, 0, -1] row = 2. start_val = -1\n # [1,-1, 1, 10, 0, -1] row = 3. start_val = 1\n # [1,-1, 1, 10, 9, 8] row = 4. start_val = 10\n # [1,-1, 1, 10, 9, 8] row = 5. start_val = 9\n\n dp = [a[0]] + [MININT] * (a.size - 1)\n (1..a.size - 1).each do |row|\n start_index = row - 1\n start_val = dp[start_index]\n\n # we may only move forward up to 6 spots\n end_col = [a.size - 1, start_index + 6].min\n puts \"start_val: #{start_val}. Inner loop start_col: #{row} / end_col: #{end_col}\"\n\n (row..end_col).each do |col|\n puts \"row: #{row}, col: #{col}\"\n dp[col] = [dp[col], start_val + a[col]].max\n end\n p dp\n puts\n end\n\n \"Answer: #{dp.last}\"\nend", "def no_pieces_in_between_diagonal?(from_row, from_column, to_row, to_column)\n row = from_row\n column = from_column\n if to_row > from_row && to_column > from_column\n row += 1\n column += 1\n until row == to_row\n return false unless @state[row][column] == nil\n row += 1\n column += 1\n end\n elsif to_row > from_row && to_column <= from_column\n row += 1\n column -= 1\n until row == to_row\n return false unless @state[row][column] == nil\n row += 1\n column -= 1\n end\n elsif to_row <= from_row && to_column <= from_column\n row -= 1\n column -= 1\n until row == to_row\n return false unless @state[row][column] == nil\n row -= 1\n column -= 1\n end\n elsif to_row <= from_row && to_column > from_column\n row -= 1\n column += 1\n until row == to_row\n return false unless @state[row][column] == nil\n row -= 1\n column += 1\n end\n end\n true\n end", "def diagonals(arr)\n \n #define slices of array where diagonal lines can be drawn \n slices = [arr[23..36],arr[43..56],arr[63..76],arr[83..96],arr[103..116],arr[123..136],arr[143..156],arr[163..176]]\n \n #define holders for results \n diagonal_ans = []\n helper_hash = {}\n\n slices.map do |slice|\n for i in slice\n #make two sets of diagonals for each index currently selected\n #because the number of elements in each diagonal is 4, so there is no center element\n key_num1 = (arr[i-19]*arr[i]*arr[i+21]*arr[i+42])\n key_num2 = (arr[i-38]*arr[i-19]*arr[i]*arr[i+21])\n val_arr1 = [arr[i-19],arr[i],arr[i+21],arr[i+42]]\n val_arr2 = [arr[i-38],arr[i-19],arr[i],arr[i+21]]\n \n #retain the larger of the two possible diagonals for a given element \n key_num1 > key_num2 ? helper_hash[key_num1] = val_arr1 : helper_hash[key_num2] = val_arr2\n \n end\n diagonal_ans = helper_hash.max_by{|k,v| v}\n end\n @@maximums << diagonal_ans\n puts \"Diagonal max is\"\n p diagonal_ans\n\n end", "def check_diagonally_left(x, y, numbers_in_product)\n (0...numbers_in_product).inject(1) do |product, i|\n product * matrix[y+i][x-i]\n end\n end", "def check_matrix\n @matrix.each_with_index do |current_point, i|\n @edges.clear # Set up the edge buffer.\n check_triangles(current_point)\n check_edges(i)\n end\n end", "def check_diagonal1\n cell = @last_cell_played\n count = 1\n while cell.ld && cell.ld.color == cell.color\n cell = cell.ld\n end\n while cell.ru && cell.ru.color == cell.color\n cell = cell.ru\n count += 1\n end\n return true if count >= 4\n false\n end", "def gridChallenge(grid)\n grid.each do |row|\n row.sort!\n end\n columns = grid.first.size\n size = grid.size\n\n \n (0..(columns - 1)).each do |col|\n list = []\n (0..(size -1)).each do |row| \n list << grid[row][col]\n end\n return 'NO' if list != list.sort\n end\n\n 'YES'\nend", "def get_diag_ne_sw(n)\n\t\tprepare(@dim_i,@dim_j)\n\t\ttmpTab = Array.new\n\t\tdim = @dim_i\n\t\tif (n<0)\n\t\t\tdeb = n.abs\n\t\t\tfin = dim - 1\n\t\t\titerateur = dim - 1\n\t\tend\n\t\tif (n==0)\n\t\t\tdeb = 0\n\t\t\tfin = dim - 1\n\t\t\titerateur = dim - 1\n\t\tend\n\t\tif (n>0)\n\t\t\tdeb = 0\n\t\t\tfin = dim - 1 - n\n\t\t\titerateur = dim - 1 - n\n\t\tend\n\t\tfor i in deb..fin\n\t\t\ttmpTab.push @myTab[i][iterateur]\n\t\t\titerateur = iterateur - 1\n\t\tend\n\t\treturn tmpTab\n\tend", "def valid_sudoku(table)\n row_list = {}\n col_list = {}\n\n i = 0\n while i < table.length \n j = 0\n\n while j < table[i].length\n \n row_num = table[i][j]\n col_num = table[j][i]\n\n row_list = update_sub_grid(row_list, row_num)\n return false if !row_list\n\n col_list = update_sub_grid(col_list, col_num)\n return false if !col_list\n\n j += 1\n end\n\n\n row_list = {}\n col_list = {}\n \n i += 1\n end\n\n\n starting_points = [\n [0, 0],\n [0, 3],\n [0, 6],\n [3, 0],\n [3, 3],\n [3, 6],\n [6, 0],\n [6, 3],\n [6, 6]\n ]\n\n starting_points.each do |row_start, col_start|\n return false if !valid_sub_grid(table, row_start, col_start)\n end \n\n return true\nend", "def check_if_all_combos_tried(row, col, forward)\n \n if @board_indicator[row][col] == 0 && @board[row][col] == 9 && row == @row_of_first_empty_square && col == @col_of_first_empty_square\n return true\n else\n return false\n end\n # if all initial holes are filled with'9', all combos were tried\n # all_combos_tried = true\n # (0..8).each do |k|\n # (0..8).each do |j|\n # if @board_indicator[k][j] == 0 && @board[k][j] < 9\n # all_combos_tried = false\n # #break\n # end\n # end\n # end\n # puts all_combos_tried\n # all_combos_tried\n end", "def path_validator(the_board,origin_arr,destination_arr)\n\t\tpath_validator_diagonal(the_board,origin_arr,destination_arr)\n\tend", "def check_valid(columns, row, col)\n for pre_r in 0..row-1\n pre_c = columns[pre_r]\n\n # check to see if queue in the same column\n return false if pre_c == col\n\n # check diagonals\n col_dis = (col - pre_c).abs\n row_dis = (row - pre_r).abs\n\n return false if col_dis == row_dis\n end\n true\nend", "def check_diag b, play\n x = 0\n while x < 4\n y = 0\n while y < 4\n if b[x][y] == play\n if b[x+1][y+1] == play\n if b[x+2][y+2] == play\n if b[x+3][y+3] == play\n win = true\n end\n end\n end\n end\n y = y + 1\n end\n x = x + 1\n end\n return win\nend", "def check_diag2 b, play\n x = 0\n while x < 4\n y = 0\n while y < 3\n if b[x+3][y] == play\n if b[x+2][y+1] == play\n if b[x+1][y+2] == play\n if b[x][y+3] == play\n win = true\n end\n end\n end\n end\n y = y + 1\n end\n x = x + 1\n end\n return win\nend", "def parse(min_size = 0)\n diagonals = []\n column = starting_column\n row = max_row_index\n while valid_column_to_parse(column) && row >= 0\n output = []\n tmp_row = row\n tmp_column = column\n loop do\n output << @grid[tmp_column][tmp_row]\n tmp_column = next_cell_column_index(tmp_column)\n tmp_row -= 1\n if column_out_of_bounds(tmp_column) || tmp_row < 0 #out of bounds\n diagonals << output if output.length >= min_size\n if column != ending_column\n column = next_column_index(column)\n else\n row -= 1\n end\n break\n end\n end\n end\n diagonals\n end", "def testInput inputArray\n testDimensionBaseNumber inputArray\n\n dim = inputArray[0][0]\n puts \"Dimensions: \" + dim\n nOfSetNumbers = inputArray[1][0]\n puts \"Number of given numbers: \" + nOfSetNumbers\n \n testMaxValueEach(inputArray,1)\n \n lineOfNumberConstraints = (2 + nOfSetNumbers.to_i)\n \n testPositionOfAdditionalConstraints(inputArray, lineOfNumberConstraints)\n\n testMaxValueEach(inputArray, lineOfNumberConstraints)\n \n numberOfAdditionalConstraints = inputArray[lineOfNumberConstraints][0]\n \n puts \"Number of given constraints: \" + numberOfAdditionalConstraints\n \n if inputArray.length != (numberOfAdditionalConstraints.to_i+nOfSetNumbers.to_i+3)\n puts \"wrong input file - number of lines is not matching with given numbers of constraints\"\n end\n \n (2..(nOfSetNumbers.to_i+1)).each do |i|\n testNumberOfElements(inputArray,i,3)\n end\n\n (lineOfNumberConstraints+1..(numberOfAdditionalConstraints.to_i+lineOfNumberConstraints)).each do |i|\n testNumberOfElements(inputArray,i,4)\n end\n\n testValueOfElements(inputArray,dim, nOfSetNumbers,numberOfAdditionalConstraints)\n\n return dim\nend", "def input4\n [\n [1, 0, 0, 0, 1],\n [0, 0, 0, 1, 3],\n [0, 1, 0, 0, 5],\n [0, 0, 1, 0, 8]\n ]\nend", "def second_validate\n across_req_bound = Array.new((2 * (self.across) + 1),1)\n down_req_bound = Array.new((2 * (self.down) + 1),1)\n top_bound = self.plane[0]\n down_bound = self.plane[2 * (self.down)]\n left_bound = self.plane.map{|a| a[0]}\n right_bound = self.plane.map{|a| a[2 * (self.across)]}\n if(top_bound != across_req_bound || down_bound != across_req_bound ||left_bound != down_req_bound || right_bound != down_req_bound)\n puts \"One of the boundaries is not closed\"\n self.valid = false\n end\n cell_validate if(self.valid == true)\n end", "def check_row_availability_for_square(row, col)\n possible_for_row = []\n (0..8).each do |i|\n if (self[row, i].is_a? Element) && i != col\n possible_for_row |= calculate_possible_numbers_for_square(row, i)\n end\n end\n self[row, col].possibleNumbers - possible_for_row\n end", "def adjacent_clear(row,col)\n square = 1\n breaker = 0\n rowscols = []\n possibilities = [[row + square,col],[row,col + square],[row + square,col + square],[row - square,col],[row,col - square],[row - square,col - square],[row + square, col - square], [row - square, col + square]]\n if adjacent_mines(row,col) == 0 && row + square <= @row_count && row - square >= 0 && col + square <= @column_count && col - square >= 0\n possibilities.each do |position|\n rowscols << position\n end\n while row + square <= @row_count && row - square >= 0 && col + square <= @column_count && col - square >= 0\n square += 1\n possibilities.each do |check|\n breaker += adjacent_mines(check[0],check[1])\n end\n if breaker == 0\n possibilities.each do |check|\n rowscols << check\n end\n else\n break\n end\n possibilities = [[row + square,col],[row,col + square],[row + square,col + square],[row - square,col],[row,col - square],[row - square,col - square],[row + square, col - square], [row - square, col + square]]\n end\n end\n rowscols << [row,col]\n rowscols\n end", "def get_diagonal(representation)\n diagonals = []\n for k in (0..7)\n arr = []\n arr2 = []\n for i in (0..6)\n for j in (0..5)\n if (i == (j - k))\n arr << representation[i][j]\n end\n if ((i-k) == j)\n arr2 << representation[i][j]\n end\n end\n end\n diagonals.push(arr, arr2)\n end\n\n determine_winner(diagonals)\nend", "def check_diagonally_right(x, y, numbers_in_product)\n (0...numbers_in_product).inject(1) do |product, i|\n product * matrix[y+i][x+i]\n end\n end", "def valid_diagonal(top, right, n)\n bits = 0\n\n if top\n if right\n (@size - n).times { |i|\n if @state[((@size + 1) * i) + n]\n bits += 1\n end\n }\n else\n (n + 1).times { |i|\n if @state[((@size - 1) * i) + n]\n bits += 1\n end\n }\n end\n else\n n_pos = n + ((@size - 1) * @size)\n if right\n (@size - n).times { |i|\n if @state[n_pos - ((@size - 1) * i)]\n bits += 1\n end\n }\n else\n (n + 1).times { |i|\n if @state[n_pos - ((@size + 1) * i)]\n bits += 1\n end\n }\n end\n end\n\n if bits > 1\n return false\n else\n return true\n end\n end", "def part_of_diag_l_up(starting, ending)\n result = []\n x = starting[0] - 1\n y = starting[1] + 1\n while x > ending[0] && y < ending[1]\n result << @boxes[x][y]\n x -= 1\n y += 1\n end\n result\n end", "def adjacent_mines(row, col)\n count = 0\n if col < @column_count-1\n count+=1 unless @grid[row][col+1].fill.nil?\n end\n if col > 0\n count +=1 unless @grid[row][col-1].fill.nil?\n end\n if row < @row_count-1\n count+=1 unless @grid[row+1][col].fill.nil?\n end\n if row > 0\n count+=1 unless @grid[row-1][col].fill.nil?\n end\n if row < @row_count-1 && col < @column_count-1\n count+=1 unless @grid[row+1][col+1].fill.nil?\n end\n if row > 0 && col > 0\n count+=1 unless @grid[row-1][col-1].fill.nil?\n end\n if row > 0 && col < @column_count-1\n count +=1 unless @grid[row-1][col+1].fill.nil?\n end\n if row < @row_count-1 && col > 0\n count +=1 unless @grid[row+1][col-1].fill.nil?\n end\n count\n end", "def cell_validate\n height = 2 * self.down - 1\n width = 2 * self.across - 1\n for i in (1..height).step(2) do\n for j in (1..width).step(2) do\n wall_num = calculate_boundary_sum(i,j)\n if(wall_num == 4 || wall_num == 0)\n puts \"[#{j/2},#{i/2}] is an invalid cell. Please enter another valid string\"\n self.valid = false\n end\n end\n end\n end", "def is_valid?(x, y)\n return false if x < 0 || x >= @matrix.first.length\n return false if y < 0 || y >= @matrix.length\n return false unless @matrix[y][x] == 1\n return false if @visited[y][x]\n true\n end", "def b_check sym \n\t\t#check rows\n\t\ti=0\n\t\twhile i<@arr.length\n\t\t\tgame_finished=true\n\t\t\tj=0\n\t\t\twhile j<@arr.length\n\t\t\t\tif @arr[i][j]!=sym\n\t\t\t\t\tgame_finished=false\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\t\tj=j+1\n\t\t\tend\n\t\t\tif game_finished\n\t\t\t\treturn game_finished\n\t\t\tend\n\t\t\ti=i+1\n\t\tend\n\t\t# check colmns\n\t\ti=0\n\t\twhile i<@arr.length\n\t\t\tgame_finished=true\n\t\t\tj=0\n\t\t\twhile j<@arr.length\n\t\t\t\tif @arr[j][i]!=sym\n\t\t\t\t\tgame_finished=false\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\t\tj=j+1\n\t\t\tend\n\t\t\tif game_finished\n\t\t\t\treturn game_finished\n\t\t\tend\n\t\t\ti=i+1\n\t\tend\n\t\t#check diagonals\n\t\ti=0\n\t\tgame_finished=true\n\t\[email protected]\n\t\twhile i<@arr.length\n\t\t\tif @arr[i][j]!=sym\n\t\t\t\tgame_finished=false\n\t\t\t\tbreak\n\t\t\tend\n\t\t\ti=i+1\n\t\t\tj=j-1\n\t\tend\n\t\tif game_finished\n\t\t\treturn game_finished\n\t\tend\n\n\t\ti=0\n\t\tgame_finished=true\n\t\tj=0\n\t\twhile i<@arr.length\n\t\t\tif @arr[i][j]!=sym\n\t\t\t\tgame_finished=false\n\t\t\t\tbreak\n\t\t\tend\n\t\t\ti=i+1\n\t\t\tj=j+1\n\t\tend\n\t\tif game_finished\n\t\t\treturn game_finished\n\t\tend\n\t\treturn false\n\tend", "def n_valid_matrix(ds)\n vectors = ds.vectors.to_a\n m = vectors.collect do |row|\n vectors.collect do |col|\n if row==col\n ds[row].reject_values(*Daru::MISSING_VALUES).size\n else\n rowa,rowb = Statsample.only_valid_clone(ds[row],ds[col])\n rowa.size\n end\n end\n end\n\n Matrix.rows m\n end", "def diagonal_combos(position)\n left_to_right_diag = [\n [[-3,-3], [-2,-2], [-1,-1], [0,0]],\n [[-2,-2], [-1,-1], [0,0], [1,1]],\n [[-1,-1], [0,0], [1,1], [2,2]],\n [[0,0], [1,1], [2,2], [3,3]]\n ]\n d_combos = []\n poss_wins = []\n left_to_right_diag.each do |vectors|\n single_pos = []\n vectors.each do |vec|\n single_pos << add(position, vec)\n end\n poss_wins.push(single_pos)\n end\n\n d_combos.push(poss_wins)\n\nend", "def jqll\n counter = 1\n matrix = Jqll1.new\n File.open(\"src/problem-107/network\").each do |i|\n line = i.strip.split(',')\n (counter..39).each do |i|\n matrix.push Jqll2.new(line[i].to_i, counter, i + 1) if line[i] != \"-\"\n end\n counter += 1\n end\n result = matrix.total\n matrix.minimize\n result -= matrix.total\nend", "def solution \n row_search \n columns_search \n diagonal_search\n end", "def adjacent_mines(row, col)\n 0\n end", "def adjacent_mines(row, col)\n 0\n end", "def adjacent_mines(row, col)\n 0\n end", "def create_board_indicator\n @row_of_first_empty_square = 0\n @col_of_first_empty_square = 0\n first_empty_square_found = false\n board_indicator = initialize_empty_board\n (MIN_ROW_POSITION..MAX_ROW_POSITION).each do |j| \n (MIN_COL_POSITION..MAX_COL_POSITION).each do |i|\n #board_indicator[j][i] = 1 if (@board[j][i] != 0 && @board[j][i] != '')\n if (@board[j][i] == 0 || @board[j][i] == '')\n if !first_empty_square_found\n puts 'first empty'\n first_empty_square_found = true\n @row_of_first_empty_square = j\n @col_of_first_empty_square = i\n end\n else\n board_indicator[j][i] = 1\n end\n end\n end\n board_indicator\n end", "def right_to_diagonal_left_approach\n largest_prod = 0\n\n for each_row in (0..15)\n for col in (0..19)\n each_col = 19 - col\n a = $grid_of_numbers[each_row][each_col]\n b = $grid_of_numbers[each_row+1][each_col-1]\n c = $grid_of_numbers[each_row+2][each_col-2]\n d = $grid_of_numbers[each_row+3][each_col-3]\n #puts \"#{a} #{b} #{c} #{d}\"\n curr_prod = a*b*c*d\n if curr_prod > largest_prod\n largest_prod = curr_prod\n end\n end\n end\n \n return largest_prod\nend", "def coloring(connections)\n @n = connections.length\n\n for i in 0..@n-1 do\n for j in 0..@n-1 do\n if i != j and connections[i][j] > 0 then\n self[i].must_not == self[j]\n end\n end\n end\n \n end", "def gen_diagonal_up(row,col)\n array_diagonals =[]\n 0.upto(5).each do |num|\n if ( row - num < 0 || col + num > 6)\n break\n end\n\n array_diagonals << [row-num, col+num] \n end\n array_diagonals.map{|coordinates| @grid[coordinates[1]][coordinates[0]]}\n end", "def validate\n super\n rescue Sudoku::Constraint::ConstraintError => e\n raise ConstraintError, e.message + \" in a 3x3 subboard\"\n end", "def sudoku_valid? grid\n \n # grid has first index for row, 2nd index for column\n \n # Check every row\n grid.each do |row|\n seen = Set.new\n (0..9).each do |row_value|\n if !seen.add?(row_value)\n return false\n end\n end\n end\n \n # Check every column\n grid.each do |row|\n seen = Set.new\n row.each do |col_value|\n if !seen.add?(col_value)\n return false\n end\n end\n end\n \n # Check every 3x3\n [0,3,6].each do |offset|\n [0,3,6].each do |offset2|\n to_check = get3by3 grid, offset, offset2\n seen = Set.new\n to_check.each do |value|\n if !seen.add?(value)\n return false\n end\n end\n end\n end\n \n \n return true\nend", "def input1\n [\n [1, 0, 0, 0, 1],\n [0, 1, 0, 0, 5],\n [0, 0, 1, 0, 4],\n [0, 0, 0, 1, 3]\n ]\nend", "def generate_solved_array(dim)\n tiles = dim.times.map {|i| dim.times.map {|j| (j+1)+dim*(i)}}\n tiles[dim-1][dim-1] = nil\n tiles\n end", "def check_diagnal_win? \n \t\tfirst_diag=@board[2][1]!=0&&@board[1][2]!=0&&(@board[3][0]==@board[2][1]&&@board[3][0]==@board[1][2]&&@board[3][0]==@board[0][3]) #if center is not equal to 0, and \n \t\t#if two center elements from bottom left to top right are not 0 and\n \t\t#bottom left element is equal to center bottom left element and\n \t\t#bottom left element is equal to center top right element and \n \t\t#bottom left element is equal to top right element then first_diag is equal to true, else equal to false\n \t\tsecond_diag=@board[1][1]!=0&&@board[2][2]!=0&&(@board[0][0]==@board[1][1]&&@board[0][0]==@board[2][2]&&@board[0][0]==@board[3][3]) #if center is not equal to 0, and\n \t\t#if two center elements from top left to bottom right are not 0 and \n \t\t#top left element is equal to center top left element and\n \t\t#top left element is equal to center bottom right element and \n \t\t#top left element is equal to bottom right element then second_diag is equal to true, else equal to false\n \t\treturn true if (first_diag||second_diag) #if first_diag is true or second_diag is true, return true. If both are\n \t\t#false, return false.\n \t\treturn false\n \tend", "def dfs(i, j, visited, m, group)\n # These arrays are used to get row and\n # column numbers of 4 neighbours\n # of a given cell\n rowNbr = [-1, 0, 0, 1]\n colNbr = [ 0, -1, 1, 0]\n\n # Mark this cell as visited\n visited[i][j] = true\n group += 1\n #puts \"dfs #{i}, #{j} group:#{group}\"\n # Recurse for all connected neighbours\n 0.upto(4 - 1) do |k|\n if isSafe(i + rowNbr[k], j + colNbr[k], visited, m)\n # puts \"k:#{k} i:#{i + rowNbr[k]}, j:#{j + colNbr[k]}\"\n group = dfs(i + rowNbr[k], j + colNbr[k], visited, m, group)\n end\n end\n #puts \"RETURN:#{group}\"\n return group\nend", "def valid_sudoku(table)\n sudoku_box_hash = { [0, 0] => {}, [0, 1] => {}, [0, 2] => {},\n [1, 0] => {}, [1, 1] => {}, [1, 2] => {},\n [2, 0] => {}, [2, 1] => {}, [2, 2] => {}}\n\n sudoku_row_hash = { 1 => {}, 2 => {}, 3 => {},\n 4 => {}, 5 => {}, 6 => {},\n 7 => {}, 8 => {}, 9 => {}}\n \n sudoku_col_hash = { 1 => {}, 2 => {}, 3 => {},\n 4 => {}, 5 => {}, 6 => {},\n 7 => {}, 8 => {}, 9 => {}}\n\n sudoku_diagonal_hash = {1 => {}, 9 => {}}\n\n table.each_with_index do |arr, i|\n arr.each_with_index do |ele, j|\n next if ele == \".\"\n # check and add diagonals\n if i == j \n return false if sudoku_diagonal_hash[1].include?(ele)\n sudoku_diagonal_hash[1][ele] = 1\n elsif i + j + 1 == 9 || i == 4 && j == 4\n return false if sudoku_diagonal_hash[9].include?(ele)\n sudoku_diagonal_hash[9][ele] = 1\n end\n\n # check these hashes for all elements\n return false if sudoku_row_hash[i + 1].include?(ele)\n return false if sudoku_col_hash[j + 1].include?(ele)\n return false if sudoku_box_hash[[i / 3, j / 3]].include?(ele)\n\n # can add if no return \n sudoku_row_hash[i + 1][ele] = 1\n sudoku_col_hash[j + 1][ele] = 1\n sudoku_box_hash[[i / 3, j / 3]][ele] = 1 # based off calculating indices of ecah sudoku box\n end\n end\n\n return true\nend", "def valid_locations(r, c)\n positions = []\n #top row\n positions << [r - 1, c - 1]\n positions << [r - 1, c]\n positions << [r - 1, c + 1]\n\n #center row\n positions << [r, c-1]\n positions << [r, c + 1]\n\n #bottom row\n positions << [r + 1, c - 1]\n positions << [r + 1, c]\n positions << [r + 1, c + 1]\n \n #array boundry Check on the list of positions to find those that are on the board\n positions.delete_if {|v| v[0] < 0 || v[0] >= row}.delete_if{|v| v[1] < 0 || v[1] >= column}\n return positions\n end", "def diagonals\n vals = [[], []]\n (0...size).each do |i|\n vals[0].push(get_square({:column => i, :row => i}))\n vals[1].push(get_square({:column => i, :row => size - i - 1}))\n end\n vals.map {|v| Row.new(size, {:vals => v}) }\n end", "def verify(ans_arr, arr)\n p1 = []\n p2 = []\n [0,1,2].each do |i|\n [0,1,2].each do |j|\n if arr[i][j] == 1 \n p1.push(ans_arr[i][j])\n elsif arr[i][j] == 0\n p2.push(ans_arr[i][j]) \n end\n end\n end\n \n if p1.length == 3 \n puts \"Player entering 1 won\" if p1[p1.length-1] + p1[p1.length-2] + p1[p1.length-3] == 15\n end\n if p1.length == 4\n puts \"Player entering 1 won\" if p1[p1.length-1] + p1[p1.length-2] + p1[p1.length-4] == 15\n puts \"Player entering 1 won\" if p1[p1.length-2] + p1[p1.length-3] + p1[p1.length-4] == 15\n puts \"Player entering 1 won\" if p1[p1.length-1] + p1[p1.length-3] + p1[p1.length-4] == 15\n end\n if p1.length == 5\n puts \"Player entering 1 won\" if p1[p1.length-1] + p1[p1.length-2] + p1[p1.length-5] == 15 || \n p1[p1.length-1] + p1[p1.length-3] + p1[p1.length-5] == 15 ||\n p1[p1.length-1] + p1[p1.length-4] + p1[p1.length-5] == 15 ||\n p1[p1.length-2] + p1[p1.length-3] + p1[p1.length-5] == 15 ||\n p1[p1.length-2] + p1[p1.length-4] + p1[p1.length-5] == 15 || \n p1[p1.length-3] + p1[p1.length-4] + p1[p1.length-5] == 15 \n end\n if p2.length == 3 \n puts \"Player entering 0 won\" if p2[p2.length-1] + p2[p2.length-2] + p2[p2.length-3] == 15\n end\n if p2.length == 4\n puts \"Player entering 0 won\" if p2[p2.length-1] + p2[p2.length-2] + p2[p2.length-4] == 15\n puts \"Player entering 0 won\" if p2[p2.length-2] + p2[p2.length-3] + p2[p2.length-4] == 15\n puts \"Player entering 0 won\" if p2[p2.length-1] + p2[p2.length-3] + p2[p2.length-4] == 15\n end\n if p2.length == 5\n puts \"Player entering 0 won\" if p2[p2.length-1] + p2[p2.length-2] + p2[p2.length-5] == 15 || \n p2[p2.length-1] + p2[p2.length-3] + p2[p2.length-5] == 15 ||\n p2[p2.length-1] + p2[p2.length-4] + p2[p2.length-5] == 15 ||\n p2[p2.length-2] + p2[p2.length-3] + p2[p2.length-5] == 15 ||\n p2[p2.length-2] + p2[p2.length-4] + p2[p2.length-5] == 15 || \n p2[p2.length-3] + p2[p2.length-4] + p2[p2.length-5] == 15 \n end\nend", "def valid(row, col)\n if check_row(row) and check_col(col) and check_diag(row, col)\n return true\n else\n return false\n end\n end", "def neighbors(row, col, arr)\n height = arr.size\n width = arr[0].size\n neighbors = []\n neighbors << [row, col + 1] if col + 1 < width && arr[row][col + 1] >= 1\n neighbors << [row, col - 1] if col - 1 >= 0 && arr[row][col - 1] >= 1\n neighbors << [row + 1, col] if row + 1 < height && arr[row + 1][col] >= 1\n neighbors << [row - 1, col] if row - 1 >= 0 && arr[row - 1][col] >= 1\n\n neighbors\nend", "def floyd_warshall_variation()\n edges = %w( 0,1 1,2 2,3 1,3 )\n num = edges.join.gsub(\",\",\"\").split(\"\").uniq.size\n\n a = Array.new(num) { Array.new(num) { Array.new(num) } }\n \n # initialize\n num.times do |k|\n num.times do |i|\n num.times do |j|\n a[i][j][k] = Float::INFINITY\n a[i][j][k] = 0 if i == j\n a[i][j][k] = 1 if edges.include? \"#{i},#{j}\"\n end\n end\n end\n\n # run\n (1..num-1).each do |k|\n num.times do |i|\n num.times do |j|\n a[i][j][k] = [\n a[i][j][k-1] +\n a[i][k][k-1] * a[k][j][k-1]\n ].min\n end\n end\n end\n\n # print\n num.times do |i|\n num.times do |j|\n puts \"#{i},#{j}: #{a[i][j][num-1]}\"\n end\n end\n\nend", "def check_diagonals\n diagonal_winner = nil\n # stores the markers\n backward_diagonal = ''\n forward_diagonal = ''\n\n # for a diagonal to be a winner it takes the row[n], row[n+1], row[n+2] and so on..\n @board.each_with_index do |row,index|\n\n # check if left to right diagonal is a winner\n row.each_with_index do |marker, position|\n if position == index\n backward_diagonal += marker\n end\n end\n\n # check if right to left diagonal is a winner\n reversed_row = row.reverse\n reversed_row.each_with_index do |marker, position|\n if position == index\n forward_diagonal += marker\n end\n end\n end\n\n # checks iteration count of x or o in strings to find winner\n if backward_diagonal.count('x') == @board.size || forward_diagonal.count('x') == @board.size\n diagonal_winner = 'x'\n elsif backward_diagonal.count('o') == @board.size || forward_diagonal.count('o') == @board.size\n diagonal_winner = 'o'\n end\n\n diagonal_winner\n end", "def adjacent_mines(row, col)\n count = 0\n (-1..1).each do |i|\n (-1..1).each do |j|\n unless (i == 0 && j == 0) || (row + i) < 0 || (col + j) < 0\n if contains_mine?(row + i, col + j)\n count += 1\n end\n end\n end\n end\n count\n end", "def adjacent_mines(row, col)\n\n count = 0\n\n count += 1 if (row + 1) < row_count && grid[row+1][col].fill == 1\n count += 1 if (row - 1) >= 0 && grid[row-1][col].fill == 1\n count += 1 if (col + 1) < column_count && grid[row][col+1].fill == 1\n count += 1 if (col -1) >= 0 && grid[row][col-1].fill == 1\n count += 1 if (row + 1) < row_count && (col + 1) < column_count && grid[row+1][col+1].fill == 1\n count += 1 if (row + 1) < row_count && (col -1) >= 0 && grid[row+1][col-1].fill == 1\n count += 1 if (row - 1) >= 0 && (col + 1) < column_count && grid[row-1][col+1].fill == 1\n count += 1 if (row - 1) >= 0 && (col -1) >= 0 && grid[row-1][col-1].fill == 1\n\n return count\n end", "def valid_sudoku(table)\n l = table.length\n # row, time l * l\n table.each do |row|\n return false if !sudoku_helper(row)\n end\n \n # column, time l * 2l\n l.times do |i|\n column = []\n l.times do |j|\n column << table[j][i]\n end\n return false if !sudoku_helper(column)\n end\n \n # area, time l * 2l\n x = Integer.sqrt(l)\n m = n = 0\n x.times do\n x.times do \n area = []\n x.times do |i|\n area += table[n + i][m...(m+x)]\n end\n return false if !sudoku_helper(area)\n m += x\n end\n n += x\n m = 0\n end\n return true\nend", "def squarocol?(matrix)\n d = matrix.length\n d.times do |i|\n return true if matrix[i].all?{ |el| el == matrix[i][0]}\n end\n\n\n \n d.times do |c|\n flag = 0\n n = matrix[0][c]\n d.times do |r|\n if !(matrix[r][c] == n)\n flag = 1\n break\n end\n end\n return true if flag == 0\n end\n false\nend", "def part_of_diag_l_down(starting, ending)\n result = []\n x = starting[0] + 1\n y = starting[1] - 1\n while x < ending[0] && y > ending[1]\n result << @boxes[x][y]\n x += 1\n y -= 1\n end\n result\n end", "def input2\n [\n [3, 2,-4, 3],\n [2, 3, 3, 15],\n [5, -3, 1, 14]\n ]\nend", "def print_neighbours\n @x.times{ |r|\n @y.times{|c| \n #+1,+1 0,+1 +1,0\n print @mat[r+1].nil? || @mat[r+1][c+1].nil? ? \"x \" : \"- \"\n print @mat[r].nil? || @mat[r][c+1].nil? ? \"x \" : \"- \"\n print @mat[r+1].nil? || @mat[r+1][c].nil? ? \"x \" : \"- \"\n \n #-1,-1 0,-1 -1,0\n print @mat[r-1].nil? || @mat[r-1][c-1].nil? ? \"x \" : \"- \"\n print @mat[r-1].nil? || @mat[r-1][c].nil? ? \"x \" : \"- \"\n print @mat[r].nil? || @mat[r][c-1].nil? ? \"x \" : \"- \"\n \n #+1,-1 -1,+1\n print @mat[r-1].nil? || @mat[r-1][c+1].nil? ? \"x \" : \"- \"\n print @mat[r+1].nil? || @mat[r+1][c-1].nil? ? \"x \" : \"- \"\n print \"\\n\"\n \n }\n \n } \n end", "def check_potential_neighbor_nodes_validity(array_of_potential_neighbor_nodes)\n max_x = 25\n max_y = 25\n\n output_array = []\n\n array_of_potential_neighbor_nodes.each do |node|\n if node[:x] > 0 && node[:x] < max_x+1 && node[:y] > 0 && node[:y] < max_y+1\n string_x = node[:x].to_s\n string_y = node[:y].to_s\n \n if string_x.length <= 1\n string_x = \"0\" + string_x\n end\n \n if string_y.length <= 1\n string_y = \"0\" + string_y\n end\n \n output_array.push(\"#{string_x}#{string_y}\")\n end \n end\n\n output_array\n end", "def sum_of_diagonals\r\n\tresult = []\r\n\tresult.push 1\r\n\twidth = 3\r\n\twhile width <= 1001\r\n\t\tresult.push width**2, width**2 - (width-1), width**2 - (width-1)*2, width**2 - (width-1)*3\r\n\t\twidth += 2\r\n\tend\r\n\treturn result.reduce(:+)\r\nend", "def exercise_1113 (matrix)\n end", "def sim(m, w, h)\n\to = m.map{|x|x.clone}\n\t(1..w-2).each do |x|\n\t\t(1..h-2).each do |y|\n\t\t\tnext if m[y][x] == ?.\n\t\t\toccupied=[-1,0,1].product([-1,0,1]).count{|dx,dy|\n\t\t\t\tif dx != 0 || dy != 0 then\n\t\t\t\t\tpx=x+dx\n\t\t\t\t\tpy=y+dy\n\t\t\t\t\tpx,py=px+dx,py+dy until 'L#'[m[py][px]]\n\t\t\t\t\tm[py][px] == ?#\n\t\t\t\telse\n\t\t\t\t\tfalse\n\t\t\t\tend\n\t\t\t}\n\t\t\to[y][x] = ?# if m[y][x] == ?L && occupied == 0\n\t\t\to[y][x] = ?L if m[y][x] == ?# && occupied >= 5\n\t\tend\n\tend\n\treturn o\nend", "def is_free?(x,y)\n return @case_array[x][y].is_free? #liée à mon is_free de boardcase, si ma case a une valeur de 0 C'est libre \n #,ici on ajoute la dimension pr un array c'est à dire une case en abscisse et en ordo, c'est considéré comme libre si en tout x de mon rang en et au même index de colonne j'ai la valeur 0 \n end", "def diagonals\n container = Array.new()\n diag_array_1 = []\n diag_array_2 = []\n for i in 0..@size-1\n diag_array_1 << i * (@size+1) \n end\n for i in 0..@size-1\n diag_array_2 << (i * (@size-1)) + @size-1\n end\n container << diag_array_1\n container << diag_array_2\n return container\n end", "def vert_diag_row(row_index, col_index, token)\n if cur_board[row_index + 1][col_index] == token\n cur_board[row_index + 2][col_index] == token && cur_board[row_index + 3][col_index] == token\n elsif cur_board[row_index + 1][col_index - 1] == token\n cur_board[row_index + 2][col_index - 2] == token && cur_board[row_index + 3][col_index - 3] == token\n elsif cur_board[row_index + 1][col_index + 1] == token\n cur_board[row_index + 2][col_index + 2] == token && cur_board[row_index + 3][col_index + 3] == token\n else\n false\n end\n end", "def create_node_consistent_board(input,xblks, yblks)\n dim = input.length\n\n board = []\n open = []\n closed = []\n\n \t#initial configuration assigns each cell all possible values and lists all cells as open\n for x in 0..dim-1\n \t\tboard[x] = []\n\t for y in 0..dim-1\n\n\t\t board[x][y] = (1..dim).to_a\n\t\t open[open.length] = []\n open[open.length-1].concat( [x,y])\n\t end\n end\n\n for x in 0..dim-1\n\t for y in 0..dim-1\n\t\t inval = input[x][y]\n\t\t if (inval != 0)\n\n\t\t\t #assigns cell and removes cell from open list,\n \t\t\t\t# and removes value from cells involved in\n\t\t\t #constraints with this one\n\t\t\t if (!assign_spot(board,open,x, y, inval, xblks, yblks))\n\t\t\t\t #puts \"INVALID SUDOKU BOARD\", x, y, inval\n \t\t\t\t\tprint_board(board)\n\t\t\t\t return false\n\t\t\t end\n\t\t end\n \t\tend\n end\n boardhash = [board, open]\n if (board != false)\n \tboardhash = make_arc_consistent(board, open, closed, xblks, yblks)\n end\n if (boardhash == false)\n return false\n end\n\n\n return [boardhash[0], boardhash[1], boardhash[2]]\n\n end", "def neighbors(x,y)\n valid = 0..127\n [[x,y-1],[x,y+1],[x-1,y],[x+1,y]].select {|(h,v)| valid.cover?(h) && valid.cover?(v)}\nend", "def edg l,k,e\n (0..2).each do |i|\n if e[i][l] == k\n return i\n end\n end\n raise \"Not adjacent triangle\"\n end", "def check_left_diagonal\n if @game_array[0][0] == @game_array[1][1] &&\n @game_array[0][0] == @game_array[2][2] &&\n !@game_array[0][0].nil?\n\n @game_array[0][0]\n end\n end", "def create_restricted_board(without_field)\n m_temp = *@b_nl\n\n all_numbered_tiles.each do |x,y|\n next if ((x == without_field[0]) && (y == without_field[1]))\n up = [x-1,y]\n down = [x+1,y]\n left = [x,y-1]\n right = [x,y+1]\n\n numbered_fields = [up,right,down,left].reject{|a,b| ((a < 0) || (b < 0) || (a > @row_count-1) || (b > @col_count-1))}.uniq + [[x,y]]\n\n numbered_fields.each do |i,j|\n begin\n m_temp[i][j] = 1\n rescue\n binding.pry\n raise\n end\n end\n end\n\n Matrix[*m_temp]\n end", "def valid_sudoku(table)\n # edge cases\n return false if table.nil? || table.size != 9 || table[0].size != 9\n # 3 new storages will count number of occurances of each element for columns, rows and sub-boxes\n rows = Array.new(9)\n i = 0\n while i < rows.size\n rows[i] = {\"1\"=>0,\"2\"=>0,\"3\"=>0,\"4\"=>0,\"5\"=>0,\"6\"=>0,\"7\"=>0,\"8\"=>0,\"9\"=>0}\n i += 1\n end\n\n columns = Array.new(9)\n i = 0\n while i < columns.size\n columns[i] = {\"1\"=>0,\"2\"=>0,\"3\"=>0,\"4\"=>0,\"5\"=>0,\"6\"=>0,\"7\"=>0,\"8\"=>0,\"9\"=>0}\n i += 1\n end\n\n sub_boxes = Array.new(9)\n i = 0\n while i < sub_boxes.size\n sub_boxes[i] = {\"1\"=>0,\"2\"=>0,\"3\"=>0,\"4\"=>0,\"5\"=>0,\"6\"=>0,\"7\"=>0,\"8\"=>0,\"9\"=>0}\n i += 1\n end\n\n # loop through the input table to populate the above created storages with occurance numbers\n i = 0 # i is a row counter\n while i < table.size\n j = 0 # j is a column counter\n while j < table.size\n if table[i][j] != \".\"\n rows[i][table[i][j]] += 1\n columns[j][table[i][j]] += 1\n # find a number of a box/hash by calculating (i/3)*3 + (j/3)\n # e.g. for the element at indexes 1,2 the box will be: (1/3)*3 + (2/3) = 0, first box\n sub_boxes[(i/3)*3 + (j/3)][table[i][j]] += 1\n end\n j += 1\n end\n i += 1\n end\n # check if any of table elements occured more than 1 time within a row, a column or a sub-box\n rows.each do |hash|\n return false if hash.any? { |key, value| value > 1}\n end\n columns.each do |hash|\n return false if hash.any? { |key, value| value > 1}\n end\n sub_boxes.each_with_index do |hash, i|\n return false if hash.any? { |key, value| value > 1}\n end\n\n return true\nend", "def check_col_availability_for_square(row, col)\n possible_for_col = []\n (0..8).each do |i|\n if (self[i, col].is_a? Element) && i != row\n possible_for_col |= calculate_possible_numbers_for_square(i, col)\n end\n end\n self[row, col].possibleNumbers - possible_for_col\n end", "def attempt_solution(row, col)\n end", "def check_diagonals(player_mark)\n left_diag_arr = [@state[0][0], @state[1][1], @state[2][2]]\n right_diag_arr = [@state[0][2], @state[1][1], @state[2][0]]\n return true if count(left_diag_arr, player_mark) == 3\n return true if count(right_diag_arr, player_mark) == 3\n return false\n end", "def diagonals\n down_diag = []\n up_diag = []\n \n # push sets of coordinates that make up both diagonals\n 0.upto(@size - 1) do |idx|\n down_diag << [idx, idx]\n up_diag << [idx, @size - 1 - idx]\n end\n\n [down_diag, up_diag].map do |diag|\n diag.map { |pos| self[pos] }\n end\n end" ]
[ "0.60880697", "0.6075233", "0.5994307", "0.59864086", "0.59284073", "0.5913023", "0.5889624", "0.5882002", "0.58327675", "0.57243747", "0.570714", "0.5705268", "0.5631455", "0.5624177", "0.5617142", "0.55928403", "0.5592152", "0.55841285", "0.55807835", "0.55367464", "0.552159", "0.5519572", "0.55093044", "0.5506092", "0.5471099", "0.546491", "0.5457569", "0.5451587", "0.54509765", "0.544908", "0.5411516", "0.54100966", "0.539816", "0.53921705", "0.5372522", "0.53483665", "0.53120154", "0.53032035", "0.530158", "0.52952075", "0.529144", "0.5287537", "0.5283457", "0.5277045", "0.5275676", "0.5273154", "0.52695274", "0.5268424", "0.52671784", "0.52667445", "0.5265947", "0.52626675", "0.52564234", "0.5255165", "0.5251889", "0.52501094", "0.52501094", "0.52501094", "0.5248469", "0.5233083", "0.5229787", "0.5222448", "0.5213752", "0.52050805", "0.5197017", "0.5194355", "0.5190388", "0.5185212", "0.51747006", "0.51713234", "0.516554", "0.5165148", "0.51638824", "0.5162884", "0.514851", "0.5148017", "0.51477885", "0.5146299", "0.51435715", "0.5142069", "0.5138984", "0.51352346", "0.5131975", "0.5131924", "0.51304287", "0.51289064", "0.5123824", "0.5121532", "0.5119107", "0.51183116", "0.5116455", "0.51161164", "0.5115958", "0.5109546", "0.5100593", "0.50976986", "0.5095543", "0.5094296", "0.5092488", "0.50924754" ]
0.5610886
15
End of Devise methods
def new @cat = Cat.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def devise_controller?; end", "def devise_modules_hook!; end", "def user_authentication\n end", "def after_custom_authentication; end", "def clean_up_passwords; end", "def after_ip_authentication\n end", "def after_token_authentication\n end", "def after_token_authentication\n end", "def auth\n end", "def auth\n end", "def after_crowd_authentication\n end", "def after_database_authentication; end", "def sign_in\n\tend", "def sign_in\n\n end", "def after_custom_authentication\n\n end", "def authorization; end", "def login_instructions\n end", "def devise_mappings; end", "def sign_in\n end", "def signin\n end", "def after_password_reset; end", "def after_hash_token_authentication\n end", "def login; end", "def handle_unverified_request\n \tsign_out\n \tsuper\n end", "def handle_unverified_request\n \tsign_out\n \tsuper\n end", "def handle_unverified_request\n \tsign_out\n \tsuper\n end", "def handle_unverified_request\n \tsign_out\n \tsuper\n end", "def handle_unverified_request\n \tsign_out\n \tsuper\n end", "def handle_unverified_request\n \tsign_out\n \tsuper\n end", "def handle_inverified_request\n \tsignout\n \tsuper\n end", "def logged_in\r\n end", "def handle_unverified_request\n\tsign_out\n\tsuper\nend", "def email_login\n end", "def authorized!\n unless current_user and current_user.email.present?\n redirect_to root_path, alert: \"You need to be logged in to view that!\" and return if !current_user\n redirect_to email_path, alert: \"To finish signing up, please supply your email address.\" and return if current_user.email.blank?\n else\n # WARNING: It is a little DB heavy to do this, but OK for low traffic.\n current_user.update_attributes(last_signed_in_at: Time.now) if !current_user.last_signed_in_at || current_user.last_signed_in_at < 1.hour.ago\n end\n end", "def handle_unverified_request\n employee_sign_out\n company_sign_out\n super\n end", "def warden; end", "def warden; end", "def warden; end", "def handle_unverified_request\n\t\tsign_out\n\t\tsuper\n\tend", "def handle_unverified_request\n\t\tsign_out\n\t\tsuper\n\tend", "def handle_unverified_request\n\t\tsign_out\n\t\tsuper\n\tend", "def handle_unverified_request\n\t\t\tsign_out\n\t\t\tsuper\n\t\tend", "def auth_methods; end", "def user_verification; end", "def after_password_reset;\n end", "def devise_scope(scope); end", "def complete_login_form\n raise \"UnimplementedFunctionality\"\n end", "def current_user\n #super the main class of devise current_user\n super || guest_user\n end", "def log_in\n end", "def signup\n end", "def signup\n end", "def auth_user\n redirect_to new_user_registration_url unless user_signed_in?\n end", "def fetch_details_from_devise\n self.username = 'devise_user'\n self.save\n end", "def logging_in\n \t\t\n \tend", "def attemp_signup\n\n end", "def access_control\n \n end", "def logging_in\n end", "def verify_signed_out_user; end", "def verify_signed_out_user; end", "def verify_signed_out_user; end", "def handle_unverified_request\n sign_out_user\n super\n end", "def after_magic_link_authentication\n end", "def handle_unverified_request\n# sign_out\n super\n end", "def capable_login_auth?; end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n super\n sign_out_user\n end", "def signup_info\n end", "def devise_parameter_sanitizer; end", "def register\n if @user.blank? || ([email protected]_registered && @user.tips.count == 0 && @user.votes.count == 0)\n redirect_to :profile, alert: \"Registration Impossible. There is nothing to register\"\n elsif @user.is_registered\n redirect_to :profile, alert: \"Registration Impossible. Account already registered\"\n else\n if @user.register(user_registration_params.to_h)\n #cookies.delete(\"user_id\") #don't delete the cookie, just in case I'm logging in on someone else's device.\n sign_in @user\n redirect_to :profile, notice: \"Account successfully registered. You can now login from anywhere !\"\n else\n redirect_to :profile, alert: \"Registration failed. #{@user.errors.full_messages.to_sentence}\"\n end\n end\n end", "def candidate_sign_up\n\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end" ]
[ "0.72960836", "0.675834", "0.6632999", "0.6603611", "0.65627617", "0.6540016", "0.6530084", "0.6530084", "0.651165", "0.651165", "0.65039164", "0.64916915", "0.6445266", "0.6417515", "0.6395933", "0.63913167", "0.6382089", "0.63530684", "0.6330368", "0.62395906", "0.6239504", "0.62360495", "0.6234174", "0.6233367", "0.6233367", "0.6233367", "0.6233367", "0.6233367", "0.6233367", "0.6223966", "0.6215087", "0.6195057", "0.6192961", "0.6177213", "0.61655897", "0.61584413", "0.61584413", "0.61584413", "0.6156167", "0.6156167", "0.6156167", "0.61482143", "0.61416674", "0.6125546", "0.6102267", "0.6100226", "0.6093284", "0.6074419", "0.60516727", "0.6044895", "0.6044895", "0.60444194", "0.60440344", "0.60196036", "0.60191196", "0.600646", "0.600507", "0.599645", "0.599645", "0.599645", "0.5989463", "0.5989035", "0.5983704", "0.5976776", "0.5969907", "0.596472", "0.5951509", "0.5947525", "0.59377897", "0.5935344", "0.5932829", "0.5932829", "0.5932829", "0.5932829", "0.5932829", "0.5932829", "0.5932829", "0.5932829", "0.5932829", "0.59291893", "0.59291893", "0.59291893", "0.59291893", "0.59291893", "0.59291893", "0.59291893", "0.59291893", "0.59291893", "0.59291893", "0.59291893", "0.59291893", "0.59291893", "0.59291893", "0.59291893", "0.59291893", "0.59291893", "0.59291893", "0.59291893", "0.59291893", "0.59291893", "0.59291893" ]
0.0
-1
This method transforms an incoming line (Hash) of data. Each of the klass masked mappings are applied to the hash values, which are reordered by the mappng definition, yielding the klass and fields for each mapped klass.
def transform_line(line, index) return enum_for(:transform_line, line, index) unless block_given? raise 'NdrImport::PdfForm::Table expects a Hash!' unless line.is_a? Hash validate_column_mappings(line) masked_mappings.each do |klass, klass_mappings| ordered_line = order_values_by_mappings(line, klass_mappings) fields = mapped_line(ordered_line, klass_mappings) next if fields[:skip].to_s == 'true'.freeze yield(klass, fields, index) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform_line(line, index)\n return enum_for(:transform_line, line, index) unless block_given?\n\n identifier = case @row_identifier.to_s\n when 'index'\n index\n when 'uuid'\n SecureRandom.uuid\n end\n\n masked_mappings.each do |klass, klass_mappings|\n fields = mapped_line(line, klass_mappings)\n fields['row_identifier'] = identifier unless identifier.nil?\n next if fields[:skip].to_s == 'true'\n yield(klass, fields, index)\n end\n end", "def consolidate_classes(original_line, list_of_classes)\n record = {\n :original_ocr => original_line,\n :attributes_parsed => {\n :subject =>\n [\n #{:value => \"Curran Sarah\", :type => \"primary\", :occupation => \"widowed\"},\n #{:value => \"Richard\", :type => \"widower of primary\"}\n ],\n :location =>\n [\n #{:value => \"7 Sixth\", :position => \"rear\", :type => \"home\"}\n ]\n }\n }\n\n list_of_classes.each_with_index do |classed_token, index|\n parsed_class = classed_token[1][0]\n value = classed_token[0]\n if index == 0 && parsed_class == :name_component\n record[:attributes_parsed][:subject] << {:value => value, :type => 'primary'}\n end\n if index > 0\n case parsed_class\n when :job_component\n unless record[:attributes_parsed][:subject].count < 1\n record[:attributes_parsed][:subject][0][:occupation] = value\n end\n when :predicate\n case value\n when \"wid\"\n unless record[:attributes_parsed][:subject].count < 1\n record[:attributes_parsed][:subject][0][:occupation] = 'widow'\n end\n deceased_name = look_for_name_of_deceased(list_of_classes,index)\n unless deceased_name.nil?\n record[:attributes_parsed][:subject] << {:value => deceased_name, :type => 'deceased spouse of primary'}\n end\n #attach_to_next(list_of_classes, index, :name_component, [{:type => 'deceased spouse of primary'}])\n when \"h\"\n attach_to_next(list_of_classes, index, :address_component, [{:type => 'home'}])\n when \"r\"\n attach_to_next(list_of_classes, index, :address_component, [{:position => 'rear'}])\n else\n end\n ## inner case\n when :address_component\n loc = {:value => value}\n classed_token[2..-1].each do |xtra_attr| ## add in any additional attributes from predicates\n xtra_attr.each do |k, v|\n loc[k] = v\n end\n end\n unless merge_if_directly_subsequent_is_alike(list_of_classes, index, classed_token)\n record[:attributes_parsed][:location] << loc\n end\n else\n end\n end ## indices after 0\n end ## loop of classes\n\n return record\nend", "def column_level_klass_masked_mappings\n ensure_mappings_define_klass\n\n # Loop through each klass\n masked_mappings = {}\n @columns.map { |mapping| mapping['klass'] }.flatten.compact.uniq.each do |klass|\n # Duplicate the column mappings and do not capture fields that relate to other klasses\n masked_mappings[klass] = mask_mappings_by_klass(klass)\n end\n masked_mappings\n end", "def inflate_functional_fields(data, original_key_order)\n output = []\n data.each do |row|\n output_row = {}\n\n processed_keys = []\n original_key_order.each do |original_key|\n if %w[ec go ipr].include? original_key\n # First, we take all distinct keys that start with \"ec\", \"go\" or \"ipr\"\n annotation_keys = row.keys.select { |key| key.start_with? original_key }\n processed_keys += annotation_keys\n unless annotation_keys.empty?\n # Each of the values of the annotation_keys is an array. All respective values of each of\n # these arrays need to be put together into one hash. (E.g. {a => [1, 2], b=> [x, y]} --> [{a: 1, b: x}, {a: 2, b: y}])\n reconstructed_objects = []\n (0..row[annotation_keys[0]].length).each do |i|\n reconstructed_object = {}\n annotation_keys.each do |annotation_key|\n reconstructed_object[%w[ec_number go_term ipr_code].include?(annotation_key) ? annotation_key : annotation_key[annotation_key.index('_') + 1, annotation_key.length]] = row[annotation_key][i]\n end\n reconstructed_objects << reconstructed_object\n end\n output_row[original_key] = reconstructed_objects\n end\n elsif row.key? original_key\n output_row[original_key] = row[original_key]\n end\n end\n\n output << output_row\n end\n output\n end", "def clean(data)\n data.map{|line|\n Hash[line.map{ |col| \n col[1] = BOOL_MAP[col[1]] || col[1].to_s.strip.gsub(/^\\s+|\\s+$/, '').gsub(/\\n|\\r/,' ')\n col\n }]\n }\n end", "def transform_in_line(linha_strans)\n line_hash = {}\n linha_strans.instance_variables.each do |var|\n attr_name = var.to_s.delete('@')\n attr_name = @@line_attrs[attr_name]\n line_hash[attr_name] = linha_strans.instance_variable_get(var) if attr_name\n end\n line_hash = line_hash.except('veiculos')\n line_hash = line_hash.except('paradas')\n Line.new(line_hash)\n end", "def map_from_row!(row_data)\n model_data = {}\n\n BREAKOUT_COLUMNS.each do |property_name|\n model_data[property_name] = row_data.delete(property_name) if row_data.key?(property_name)\n end\n\n# Merb.logger.info(\"Container Model Data is: #{model_data}\")\n\n model_data\n end", "def process_mappings\n errors = 0\n content.each do |type, lines|\n fields = lines.shift\n klass = type.classify.constantize\n mappings[type] = []\n fields.each do |field|\n next if field == \"project_identifier\" && type == \"issues\"\n if field.match(/^customfield(\\d+)$/)\n cf = CustomField.where(:type => \"#{klass}CustomField\", :id => $1).first\n if cf.present?\n mappings[type] << cf\n else\n $stderr.puts \"Unable to find CustomField with type=#{klass}CustomField and id=#{$1}\"\n errors += 1\n end\n else\n if klass.column_names.include?(field) || klass.instance_methods.include?(:\"#{field}=\")\n mappings[type] << field\n else\n $stderr.puts \"No field #{klass}##{field}\"\n errors += 1\n end\n end\n end\n end\n exit 1 if errors > 0\n end", "def process_line(original_line, jobs, ld_cache)\n consolidate_classes(original_line, classify_decisions(category_parsing(parse_line_elements(original_line), jobs, ld_cache)))\nend", "def mask_mappings_by_klass(klass)\n @columns.dup.map do |mapping|\n if Array(mapping['klass']).flatten.include?(klass)\n mapping\n else\n { 'do_not_capture' => true }\n end\n end\n end", "def preprocess_2(data) \n data[1] = {A: 1, B: 0, C: 0 }\n data[2] = {A: 0, B: 1, C: 0 }\n data\nend", "def masked_mappings\n @masked_mappings ||= begin\n if @klass\n { @klass => @columns }\n else\n column_level_klass_masked_mappings\n end\n end\n end", "def convert(data)\n\t\trecords = []\n\t\tif @data_source == \"uniteu\"\n\t\t\tbegin\n\t\t\t\tdata.each do |row|\n\t\t\t\t\trecord = {}\n\t\t\t\t\[email protected] do |i|\n\t\t\t\t\t\ti.each do |k,v|\n\t\t\t\t\t\t\tfield = k.to_s\n\t\t\t\t\t\t\tv = v.split(\":\")\n\t\t\t\t\t\t\ttype = v[0]\n\t\t\t\t\t\t\tcol = v[1]\n\t\t\t\t\t\t\tif !record.has_key?(type.to_sym)\n\t\t\t\t\t\t\t\trecord[type.to_sym] = {}\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\trecord[type.to_sym][col] = row[k]\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\t# Make Records\n\t\t\t\t\trecord.each do |k,v|\n\t\t\t\t\t\trecords << Record.new(k.to_s,v)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\trescue Exception => e\n\t\t\t\t\tputs e\n\t\t\tend\n\t\telsif @data_source == \"rpro\"\n\t\t\tbegin\n\t\t\t\trecord = {}\n\t\t\t\tmappy(data).each do |type, fields|\n\t\t\t\t\tfields.each do |item|\n\t\t\t\t\t\tcol = item.keys[0][/[A-Za-z0-9_]+/].to_sym\n\t\t\t\t\t\tcolvalue = item.values[0]\n\t\t\t\t\t\tthisitem = []\n\t\t\t\t\t\tflags = item.keys[0][/[!+\\-#]/]\n\t\t\t\t\t\tif flags != nil\n\t\t\t\t\t\t\tflags = flags.split(//)\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tflags = []\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\t# Special Instructions\n\t\t\t\t\t\t# We need to process this stuff for the flags present\n\t\t\t\t\t\t# and then make it into records\n\t\t\t\t\t\tif !record.has_key?(type)\n\t\t\t\t\t\t\trecord[type] = {}\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif flags.empty?\n\t\t\t\t\t\t\trecord[type][col] = colvalue\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tif flags.include? \"!\"\n\t\t\t\t\t\t\t\traise \"write filter for !\"\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tif flags.include? \"#\"\n\t\t\t\t\t\t\t\tif record[type].has_key?(col)\n\t\t\t\t\t\t\t\t\trecords << Record.new(type,record[type])\n\t\t\t\t\t\t\t\t\trecord[type] = {}\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\trecord[type][col] = colvalue\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tif flags.include? \"+\"\n\t\t\t\t\t\t\t\tif record[type].has_key?(col)\n\t\t\t\t\t\t\t\t\tcolvalue = record[type][col]+colvalue\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\trecord[type][col] = colvalue\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tif flags.include? \"-\"\n\t\t\t\t\t\t\t\traise \"I didn't think we'd actually have one of these \\\"-\\\"\"\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\trescue Exception => e\n\t\t\t\traise e\n\t\t\tend\n\t\tend\n\t\trecords\n\tend", "def structure_records_from_flat_hash h\n rtn = {}\n rtn[:klass] = h.delete :klass\n rtn[:code] = h.delete :code\n rtn[:xlate] = h.extract! :name, :note, :desc\n rtn[:no_xlate] = h\n return rtn\n end", "def map_from_row!(row_data)\n model_data = {}\n case row_data.delete(:pubkey_version)\n when 0\n model_data[:public_key] = row_data.delete(:public_key)\n when 1\n model_data[:certificate] = row_data.delete(:public_key)\n when nil\n row_data.delete(:public_key) # just in case\n else\n raise ArgumentError, \"Unknown public key version.\"\n end\n\n if serialized_data = row_data.delete(:serialized_object)\n model_data.merge!(from_json(serialized_data))\n end\n\n breakout_columns(row_data).each do |property_name|\n model_data[property_name] = row_data.delete(property_name) if row_data.key?(property_name)\n end\n\n model_data\n end", "def line_postprocess(line)\n # Forces the values to be ASCII strings\n asciify(line)\n\n line[:quotation_time] = ::Nordea.parse_time(line[:quotation_time])\n line[:reserved].strip! if line[:reserved].respond_to? :strip!\n fill_proper_rate_type(line)\n\n line[:euro_area] = (line[:euro_area] == '1')\n\n line[:euro_adoption_date] = if line[:euro_area]\n Nordea.parse_date(line[:euro_adoption_date])\n else\n nil\n end\n\n line[:currency_expiry] = (line[:currency_expiry] == 'K')\n line[:currency_convertability] = (line[:currency_convertability] == 'K')\n floatify(line)\n\n line\n end", "def rewrite_attributes(h={})\n row, original_primary_key, record_class \\\n = CkuruTools.validate_hash_arguments(h,\n [:row,{:instance_that_inherits_from => ActiveRecord::Base,:required => true}],\n [:original_primary_key,{:instance_that_inherits_from => String,:required => true}],\n [:record_class,{:klass_that_inherits_from => ActiveRecord::Base,:required => true}]\n )\n\n\n new = Hash.new\n row.attributes.keys.each do |k|\n new_key = k.downcase\n if new_key == record_class.primary_key\n if new_key == original_primary_key\n ckebug 0, \"mapping #{new_key} from #{record_class.primary_key}\"\n new_key = \"original_#{new_key}\"\n else\n ckebug 1, \"skipping attribute #{new_key}; assuming this is the system generated key\"\n next\n end\n end\n new[new_key] = row.attributes[k]\n end\n return new\n end", "def apply_transforms(data)\n data.map do |line|\n line.merge(@transforms.keys.map do |key|\n next if line[key].nil?\n func_list = @transforms[key]\n value = func_list.reduce(line[key]) do |accum, func|\n func.call(accum)\n end\n { key => value}\n end.compact.reduce({}, :merge))\n end\n end", "def preprocess_concept_hash(concept_hash)\n end", "def create_record(line, line_number = -1) #:nodoc:\n h = Hash.new\n\n pack_format = self.class.get_subclass_variable 'pack_format'\n fields = self.class.get_subclass_variable 'fields'\n\n f = line.unpack(pack_format)\n (0..(fields.size-1)).map do |index|\n unless fields[index].is_padding?\n h.store fields[index].name, fields[index].pass_through_filters(f[index])\n end\n end\n Record.new(self.class, h, line_number)\n end", "def transform\n {\n 'name' => names,\n 'org' => org,\n 'other' => other_data,\n 'associates' => associates,\n 'xref' => xref,\n\n # these are lists with zero or more members; duplicates allowed; member order is arbitrary (so we pick\n # a standardized order for list comparison purposes)\n 'phones' => phones,\n 'addresses' => addresses,\n 'emails' => emails,\n 'links' => links\n }.reject {|k,v| v.nil? || v.empty?}\n end", "def map\n \n # parse source data \n @source_record = parse_input\n\n # validate the source record\n return Hash.new if !source_valid?\n\n # create sha1 from URL\n #token = Digest::SHA1.hexdigest(\n # @source_record[:make] + \n # @source_record[:model_name] + \n # @source_record[:serial]\n #)\n \n token = @source_record[:make] + @source_record[:model_name] + @source_record[:serial]\n token = token[-250..-1] if token.length > 250\n\n # is there a translation record?\n translation = Translation.where(:token => token, \n :source_id => source_id).first\n \n # if not, is there a classification rule?\n if translation.blank?\n\n # convert source data hash to a classifier\n classifier_data = {\n :source_model => @source_record[:model_name],\n :source_make => @source_record[:make],\n :source_id => source_id,\n :serial => @source_record[:serial]\n }\n\n # look for existing classifier, or make a new one\n rule = Classifier.find_from_source_record(classifier_data)\n \n # create rule\n rule ||= Classifier.create(classifier_data)\n\n # if rule is empty, then exit\n return Hash.new if rule.blank? || !rule.filled?\n\n # find a target record if one exists\n target = rule.match_target_by_serial\n\n # otherwise make a new target record\n target = rule.create_target if target.blank?\n \n # create the translation for future use\n translation = Translation.create(\n :token => token, \n :source_id => source_id, \n :target_id => target.id) if !target.blank?\n\n end\n \n # add target id to hash\n if !translation.blank?\n target_id_hash = {:target_id => translation.target_id }\n @source_record.merge! target_id_hash\n end\n\n # send hash to reducer \n return @source_record\n \n end", "def transform(lines, &block)\n return enum_for(:transform, lines) unless block\n\n self.non_tabular_lines = ensure_utf8_enum!(lines)\n remove_unwanted_lines\n\n super(read_non_tabular_array, &block)\n end", "def populate_fields\n @header = populate_hmap_header\n string_t = @raw_data[header.strings_offset..-1]\n @bucktes = populate_buckets do |bucket|\n bucket_s = bucket.to_a.map do |key|\n string_t[key..-1].match(/[^\\0]+/)[0]\n end\n HMapBucketStr.new(*bucket_s)\n end\n end", "def normalized_data\n result = { :headers => [], :values => [] }\n\n data.each do |row|\n values = []\n row.each do |key,val|\n # add the header field if needed\n result[:headers] << key unless result[:headers].include?(key)\n\n # build the values array\n index_of_header = result[:headers].index(key)\n values[index_of_header] = val\n end\n result[:values] << values\n end\n result\n end", "def process_hash_row(hsh)\n if @headers.any?\n keys_or_values = hsh.values\n @row_id = hsh[:row_id]\n else\n keys_or_values = hsh.keys.map(&:to_s)\n end\n\n file_line = keys_or_values.join(',')\n validated_line = utf_filter(check_utf(file_line))\n res = line_parse(validated_line)\n res\n end", "def transform(raw_data)\n if self.content =~ /\\A(---.*?)---(.*)/m\n self.attributes = YAML.load($1).symbolize_keys\n self.content = $2\n\n [:created_at, :updated_at].each do |field|\n attr = self.attributes[field]\n self.attributes[field] = Time.parse(attr) if attr\n end\n end\n end", "def transformed_entries entries\n\t\tentries\n\tend", "def replace_fields (fhash)\n\n if self.yattributes\n\n #self.yattributes = fhash\n\n else\n\n fields.delete_all\n fhash.each { |k, v| fields << Field.new_field(k, v) }\n end\n\n #f = Field.new_field(\"___map_type\", \"smap\")\n #\n # an old trick for backward compatibility with OpenWFEja\n\n save!\n # making sure to throw an exception in case of trouble\n end", "def from_hash( h)\n\t\th.each { |name,attributes|\n\t\t\tklass = Klass.new\n\t\t\tklass.from_hash( { name => attributes } )\n\t\t\tself.add_class( klass)\n\t\t}\n\n\t\t# this is an experiment in handling \"through\" attributes\n\t\t# i.e. enriching the model with the join classes\n\tend", "def preprocessed\n by_type(Group, Fold)\n end", "def _reduce_589(val, _values, result)\n _, (id, line) = val\n\n name = id.to_sym\n self.assignable [name, line]\n result = [:\"**#{name}\", line]\n\n result\nend", "def _reduce_589(val, _values, result)\n _, (id, line) = val\n\n name = id.to_sym\n self.assignable [name, line]\n result = [:\"**#{name}\", line]\n\n result\nend", "def rebuild_category_headers_for_entries( parse_result_hash )\n parse_result_hash[:category_header] = [] if parse_result_hash[ :category_header ].nil?\n parse_result_hash[:result_row] = [] if parse_result_hash[ :result_row ].nil?\n parse_result_hash[:entry_row].each do |entry_row|\n # Retrieve the original header row:\n old_header_row = parse_result_hash[:category_header].find({}) do |category_header|\n category_header[:id] == entry_row[:id]\n end\n birth_year, category = extract_swimmer_year_and_category( entry_row[:fields][:category_group] )\n # Compose the correct header row:\n new_header_row = {\n distance: old_header_row[:fields][:distance],\n style: old_header_row[:fields][:style],\n gender: nil, # (not available in FIN-sta -- most of the times)\n category_group: category,\n base_time: nil # (not available in FIN-sta)\n }\n new_id_key = \"#{ entry_row[:id] }-#{ category }\"\n # Update entry_row and its ID link:\n entry_row[:fields][:swimmer_year] = birth_year\n entry_row[:id] = new_id_key\n # Check that we do not insert twice the same header row:\n parse_result_hash[:category_header] << {\n id: new_id_key,\n fields: new_header_row,\n import_text: old_header_row[:import_text]\n } unless parse_result_hash[:category_header].any?{ |category_row| category_row[:id] == new_id_key }\n # Add a fake result_row so that the struct will be processed almost \"normally\":\n parse_result_hash[:result_row] << {\n id: new_id_key,\n fields: entry_row[:fields],\n import_text: entry_row[:import_text]\n }\n end\n end", "def initialize_values\n #skip the first 5 bytes, don't know what they are for and they don't contain the data.\n @data.read(5)\n \n @attributes = columns.inject({}) do |hash, column|\n \n #get the unpack flag to get this data.\n value = @data.read(column.length).unpack(\"#{column.flag(column.type, column.length)}\").first\n hash[column.name] = value\n hash[column.name.underscore] = value\n \n hash\n end\n end", "def process_lines\n\t#file_string is a string array,\n\t#extendable_hash is a hash that is created through this method\n\t\tneeded_lines = []\n\t\[email protected] do |line|\n\t\t\tunless line.strip.length == 0 || line[0] == '#' #filters empty lines and comments\n\t\t\t\tneeded_lines << line\n\t\t\tend\n\t\tend\n\n\t\t@hash = {}\n\t\tneeded_lines.map do |line| #splits every line at empty spaces\n\t\t\tline = line.split(\" \")\n\t\t\t@hash[line[0]] = line.drop(1) #line.drop(1) returns line without the first (0th) entry\n\t\tend\n\n\n\t\t# needed_lines.map do |line|\n\t\t# \thash[line[0]] = line.drop(1) #line.drop(1) returns line without the first (0th) entry\n\t\t# end\n\n\t\treturn @hash\n\tend", "def process(line)\n parts = line.chomp.split(/\\t/)\n keys = line_key(parts)\n keys.each do |k|\n yield [k, *parts]\n end\n end", "def preprocess\n if group_by?\n build_headers\n group_rows\n else\n enumerator.next\n end\n end", "def parse_attributes(data, klass = nil)\n data.keys.each do |key|\n next if data[key.to_sym].nil?\n value = klass.nil? ? data[key.to_sym] : klass.new(data[key.to_sym])\n instance_variable_set(\"@#{key.to_s.underscore}\", value)\n end\n end", "def to_marchash\n {\"type\" => \"marc-hash\", \"version\" => [MARCHASH_MAJOR_VERSION, MARCHASH_MINOR_VERSION], \"leader\" => leader, \"fields\" => map { |f| f.to_marchash }}\n end", "def load_fields!\n attributes = {}\n data_hash.each do |entry|\n next unless entry.is_a? Hash\n entry.keys.each { |key| attributes[key] ||= nil }\n end\n @fields = attributes.keys\n end", "def process_match(match,number)\n\t\tline = Hash[match.names.zip(match.captures)]\n\t\tline = Hash[line.map{|(k,v)| [k.to_sym,v]}]\n\t\tline[:type] = @line[:type]\n\t\tline[:index] = match[0].match(/^\\t{0,}/).to_s.length\n\t\tline[:number] = number\n\t\tline[:name] = 'div' and line[:type] = :tag if line[:type] == :tag_shorthand\n\t\t# attribute value to Hash\n\t\tline[:attribute] = recursive_string_to_hash(line[:attribute]) if line.key? :attribute\n\t\t# key values to String\n\t\t%w[bundle class name text value id_first id_last reset].each do |key|\n\t\t\tline[key.to_sym] = line[key.to_sym].to_s if line.key? key.to_sym\n\t\tend\n\t\t# key values to String.Strip!\n\t\t%w[text].each do |key|\n\t\t\tline[key.to_sym] = line[key.to_sym].strip! if line.key? key.to_sym\n\t\tend\n\t\t# bundle\n\t\tline[:bundle] = @line[:bundle] if line.key? :bundle and line[:bundle].to_s.length == 0\n\t\tif line[:type] == :mixin\n\t\t\tline[:bundle] = 'core' and line[:name] = line[:name][1..-1] if line[:name][0] == '.'\n\t\telsif line[:type] == :method\n\t\t\tline[:bundle] = 'core' if line[:bundle] == false\n\t\tend\n\t\t# class\n\t\tif line.key? :class and line[:class].length > 0\n\t\t\tline[:class] = '.' + line[:class]\n\t\t\tline[:attribute][:class] = line[:class].split('.').join(' ').strip!\n\t\t\tline.delete(:class)\n\t\tend\n\t\t\n\t\t# close \n\t\tline[:close] = %w(tag self none)[line[:close].to_s.length].to_sym if line.key? :close\n\t\t# id\n\t\tif line.key? :id_first and line[:id_first].length > 0\n\t\t\tline[:attribute][:id] = line[:id_first]\n\t\telsif line.key? :id_last and line[:id_last].length > 0\n\t\t\tline[:attribute][:id] = line[:id_last]\n\t\tend\n\t\tline.delete(:id_first) if line.key? :id_first\n\t\tline.delete(:id_last) if line.key? :id_last\n\t\t# reset\n\t\tline[:reset] = line[:reset].to_s.length == 0 ? false : true if line.key? :reset\n\t\t# return sorted Hash\n\t\tHash[line.sort]\n\tend", "def _reduce_593(val, _values, result)\n _, (id, line) = val\n\n name = id.to_sym\n self.assignable [name, line]\n result = [:\"**#{name}\", line]\n\n result\nend", "def _reduce_593(val, _values, result)\n _, (id, line) = val\n\n name = id.to_sym\n self.assignable [name, line]\n result = [:\"**#{name}\", line]\n\n result\nend", "def transform(hash)\n lens = hash[:lens]\n name = hash[:name]\n incl = hash[:incl]\n excl = hash[:excl]\n raise ArgumentError, \"No lens specified\" unless lens\n raise ArgumentError, \"No files to include\" unless incl\n lens = \"#{lens}.lns\" unless lens.include? '.'\n name = lens.split(\".\")[0].sub(\"@\", \"\") unless name\n\n xfm = \"/augeas/load/#{name}/\"\n set(xfm + \"lens\", lens)\n set(xfm + \"incl[last()+1]\", incl)\n set(xfm + \"excl[last()+1]\", excl) if excl\n end", "def from_fields(data)\n attrs = {}\n data.each { |k, v| attrs[k.underscore.to_sym] = v }\n self.new(attrs)\n end", "def parse_line_to_format(line,file,path_item)\r\n tmp_hash = { message: line, filebot: { format_from: path_item['format'], path_from: file.path, size_from: file.size } }.merge(path_item['fields'] || {})\r\n case path_item['format']\r\n when 'log' then tmp_hash\r\n when 'csv' then\r\n csv_arr = CSV.parse_line(line,path_item['options'].reject { |k,_| k == :headers }) rescue []\r\n if csv_arr.size == 0\r\n tags = [tmp_hash['tags'].to_a]\r\n tags.push('_csvparsefailure')\r\n tmp_hash['tags'] = tags\r\n else\r\n res = []\r\n path_item['options'][:headers].each_with_index { |field_name,i| res << [field_name,csv_arr[i]] }\r\n if res.size < csv_arr.size\r\n res << [ 'tail_csv', csv_arr[res.size..csv_arr.size-1].join(\"\\t\") ]\r\n end\r\n tmp_hash = tmp_hash.merge(res.to_h)\r\n end\r\n tmp_hash\r\n else tmp_hash\r\n end\r\n end", "def scan_line(line)\n e = { orig: line }\n entry_pattern.match(line) do |m|\n e.update(extract_groups(m))\n end\n e\n end", "def mapping(header, result)\n\n warn(\"Header length = #{header.length} not equal to entry length = #{result[0].length}, some fields will missing!\") if header.length != result[0].length\n\n result_with_header = []\n\n result.each do |values|\n entry = {}\n i = 0\n header.each do |key|\n entry[key] = values[i]\n i += 1\n end\n\n result_with_header.push(entry)\n end\n\n result_with_header\n end", "def modify_from_hash(column)\n %i[sequence_no namespaced_name data_type caption width format hide pinned\n groupable group_by_seq group_sum group_avg group_min group_max].each do |att|\n send(\"#{att}=\", column[att])\n end\n end", "def initialize( hash )\n\t\t@object_classes = self.parse_objectclasses( hash['objectClasses'] || [] )\n\t\t@attribute_types = self.parse_attribute_types( hash['attributeTypes'] || [] )\n\t\t@ldap_syntaxes = self.parse_ldap_syntaxes( hash['ldapSyntaxes'] || [] )\n\t\t@matching_rules = self.parse_matching_rules( hash['matchingRules'] || [] )\n\t\t@matching_rule_uses = self.parse_matching_rule_uses( hash['matchingRuleUse'] || [] )\n\tend", "def initialize(klass,fields=Hash.new,line_number = -1,&block)\n @fields = Hash.new()\n @klass = klass\n @line_number = line_number\n\n klass_fields = klass.get_subclass_variable('fields')\n\n klass_fields.each do |f|\n @fields.store(f.name, \"\")\n end\n\n @fields.merge!(fields)\n\n @fields.each_key do |k|\n @fields.delete(k) unless klass.has_field?(k)\n end\n\n yield(block, self)if block_given?\n\n self\n end", "def transform; end", "def transform_values!; end", "def continuize!\n @data.each_index do |data_index|\n @data[data_index].each do |attribute_name, attribute|\n att_type = @attributes.find { |attr| attr[:name] == attribute_name }\n #class is a special case. Store original value\n if att_type[:name] == \"class\" or att_type[:name] == @class_attribute\n @old_class_nominal_attributes = att_type[:nominal_attributes]\n end\n\n if att_type[:type] == \"string\" or att_type[:type] == \"nominal\"\n @data[data_index][attribute_name] = att_type[:nominal_attributes].find_index(attribute)\n end\n end\n end\n\n #change attribute types\n @attributes.each do |attribute|\n if attribute[:type] == \"string\" or attribute[:type] == \"nominal\"\n attribute[:type] = \"numeric\"\n attribute[:old_nominal_attributes] = attribute[:nominal_attributes]\n attribute[:nominal_attributes] = nil\n end\n end\n self\n end", "def process_classes(klass_hash, scope)\n interpolate_array(klass_hash['classes'], scope) +\n get_classes_from_groups(\n interpolate_array(klass_hash['class_groups'], scope), scope\n )\n end", "def preprocess_data\n # Remove things if needed\n if @filter_keys\n @input = @input.delete_if{|k, v| !@filter_keys.include?(k)}\n end\n end", "def parse_line(line)\n ln, fn, mi, sex, fav_color, dob = line.split(' | ')\n LineParser.to_h(fn, ln, mi, sex, fav_color, parse_dob(dob))\n end", "def process_line ln, line\r\n # convert inline processor\r\n while /\\#\\#(?<p_>[A-Z][_A-Z0-9]*)(:\\s*(?<a_>.+))?\\#\\#/ =~ line\r\n rst = conv_inline(p_, a_, ln, line)\r\n raise \"do not use '##.*##' inside your inline processor converting result\" if rst =~ /\\#\\#[A-Z][_A-Z0-9]*(:\\s*.+)?\\#\\#/\r\n line.sub!(/\\#\\#[A-Z][_A-Z0-9]*(:\\s*.+)?\\#\\#/, rst)\r\n end\r\n \r\n # create a token, with processor name\r\n token = self.tokenize(ln, line)\r\n # based on the the token indent level, close token stack if any\r\n self.close_stack token.indent_level\r\n \r\n # add token and then close it unless it opens a block\r\n @token_stack << token\r\n self.close_stack token.indent_level unless token.block_open?\r\n\r\n self # for methods chain\r\n end", "def _reduce_584(val, _values, result)\n _, (id, line) = val\n\n name = id.to_sym\n self.assignable [name, line]\n result = [:\"**#{name}\", line]\n\n result\nend", "def transpose_hbase_row_to_record_attributes_and_raw_data(row) # :nodoc:\n if field = attributes_schema[inheritance_attribute]\n if cell_with_record_sti_class = row.columns[field.unique_name] and cell_with_record_sti_class.present?\n if klass = field.decode(cell_with_record_sti_class.value) and klass.present?\n ensure_sti_class_is_loaded(klass)\n end\n end\n end\n\n super\n end", "def normalize_hash(hash)\n normalized_hash = {}\n hash.each do |k, v|\n case k\n when /_time$/\n normalized_hash[k.downcase.to_sym] = Time.parse(v)\n else\n data = extract_data(v)\n normalized_hash[k.downcase.to_sym] = case data\n when Hash\n normalize_hash(data)\n when Array\n normalize_array(data)\n else\n data\n end\n end\n end\n normalized_hash\n end", "def transform(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15, &rendering_code); end", "def map_input_data(hash)\n hash\n end", "def match_assembly\n @assembly_map = {}\n lines.each { |lno, assems|\n assems.each { |assem|\n if @assembly_map[assem].nil? then\n @assembly_map[assem] = [lno]\n else \n @assembly_map[assem] << lno\n end\n }\n \n }\n end", "def recordize line\n vals = line.split(\"\\t\")\n [@model_klass.from_tuple(*vals)]\n end", "def normalize_fields\n new_fields = CICPHash.new\n fields.each do |key, value|\n new_fields[key] = ApeItem.create(key, value).normalize_encodings\n end\n @fields = new_fields\n end", "def map_to_row!(user_data)\n row_data = {}\n\n # Handle public_key vs. certificates\n if user_data.key?(:public_key)\n row_data[:pubkey_version] = 0\n row_data[:public_key] = user_data.delete(:public_key)\n else\n row_data[:pubkey_version] = 1\n row_data[:public_key] = user_data.delete(:certificate)\n end\n\n breakout_columns(user_data).each do |property_name|\n row_data[property_name] = user_data.delete(property_name) if user_data.key?(property_name)\n end\n\n row_data[:serialized_object] = as_json(user_data)\n row_data\n end", "def processraw str, keys\n str.readlines.collect do |l|\n spltline = l.chomp.split \"|\"\n returning Hash.new do |h|\n keys.each_index do |i|\n h[keys[i]] = spltline[i] unless keys[i] == :ignore\n end\n end\n end\n end", "def extract_id_line model_attributes, line,item,dtypes\n #look if id is mapped to another field\n id_keys = model_attributes.to_hash.keys\n #hotfix..bad performance\n id_keys.map!{|k| k.to_s }\n id_key= id_keys.select{|k| k =~/^(ID|id|iD|Id)$/ }\n if id_key.empty?\n line[:id] = item.id\n else\n line[:id] = eval(\"item.#{model_attributes[id_key[0].to_sym]}\")\n #set the correct datatype for it\n dtypes[\"id\"]= dtypes[id_key[0]]\n #remove the id line\n line.delete id_key[0]\n end\n end", "def preformatting\n\n end", "def flat_map_rows(row)\n # match student by id first, fall back to name\n local_id_text = row['LASID']\n fullname_text = row['Student Name']\n return nil if local_id_text == '' && fullname_text == '' # blank row\n student_id = @matcher.find_student_id_with_exact_or_fuzzy_match(local_id_text, fullname_text)\n return nil if student_id.nil?\n\n # timestamp, just used import time since it's not in the sheet\n form_timestamp = @time_now\n\n # look for service names\n found_service_type_names = find_service_type_names(row)\n\n # time range is coarse, whole school year\n date_started = SchoolYear.first_day_of_school_for_year(@school_year)\n discontinued_at = SchoolYear.last_day_of_school_for_year(@school_year)\n found_service_type_names.map do |service_type_name|\n service_type = ServiceType.find_by(name: service_type_name)\n {\n student_id: student_id,\n recorded_by_educator_id: @recorded_by_educator.id,\n service_type_id: service_type.id,\n recorded_at: form_timestamp,\n date_started: date_started,\n estimated_end_date: discontinued_at,\n discontinued_at: discontinued_at,\n discontinued_by_educator_id: @recorded_by_educator.id,\n provided_by_educator_name: nil,\n service_upload_id: nil\n }\n end\n end", "def rebuild_relay_headers( parse_result_hash, season )\n parse_result_hash[:relay_header] = [] if parse_result_hash[ :relay_header ].nil?\n parse_result_hash[:relay_row].each do |relay_row|\n # Retrieve the original header row:\n old_header_row = parse_result_hash[:relay_header].find({}) do |relay_header|\n relay_header[:id] == relay_row[:id]\n end\n# DEBUG\n# puts \"\\r\\n\" << old_header_row[:fields].inspect\n# puts \"\\r\\n\" << relay_row[:fields].inspect\n category = extract_category_for_relays( relay_row[:fields][:category], season )\n # Compose the correct header row:\n new_header_row = {\n type: old_header_row[:fields][:type],\n distance: old_header_row[:fields][:distance],\n style: old_header_row[:fields][:style],\n gender: old_header_row[:fields][:gender],\n category_group: category,\n base_time: nil # (not available in FIN2)\n }\n new_id_key = \"#{ relay_row[:id] }-#{ category }\"\n # Update result_row and its ID link:\n relay_row[:fields][:result_score] = 0 # (not available in FIN2)\n relay_row[:id] = new_id_key\n # Check that we do not insert twice the same header row:\n parse_result_hash[:relay_header] << {\n id: new_id_key,\n fields: new_header_row,\n import_text: old_header_row[:import_text]\n } unless parse_result_hash[:relay_header].any?{ |relay_header| relay_header[:id] == new_id_key }\n # Clean-up old, unmatched headers (headers w/o results):\n parse_result_hash[:relay_header].delete_if do |relay_header|\n # We must remove all headers that do not have result rows associated to them:\n parse_result_hash[:relay_row].find(){ |row| row[:id] == relay_header[:id] }.nil?\n end\n end\n end", "def deep_transform_hashes_of(hash, hash_cache = {})\n new_hash = FlexHash.new(mapping)\n hash.each_pair do |key, val|\n if val.class == Hash\n # only transform a given instance once\n hash_cache[val.object_id] ||= deep_transform_hashes_of(val, hash_cache)\n val = hash_cache[val.object_id]\n end\n new_hash[key] = val\n end\n new_hash\n end", "def transform(lines, &block)\n return enum_for(:transform, lines) unless block\n\n @row_index = 0\n @header_valid = false\n @header_best_guess = nil\n @notifier.try(:started)\n\n last_col = last_column_to_transform\n skip_footer_lines(lines, footer_lines).each do |line|\n line.is_a?(Array) ? process_line(line[0..last_col], &block) : process_line(line, &block)\n end\n\n @notifier.try(:finished)\n end", "def hashToFields(hash)\n class_for_name(@templateName).class_eval {\n hash.keys.each {|item| attr_accessor item.to_sym}\n }\n end", "def flatten!\n self.class.attributes.keys.select { |k| k.end_with?('_data') }.each do |data_attr|\n reference_attr = data_attr[/(.+?)_data$/, 1]\n value = send(data_attr)\n next if value.nil?\n\n send(\"#{data_attr}=\", value)\n send(\"#{reference_attr})\", nil)\n end\n\n self\n end", "def map_data_types(hsh)\n hsh.each_with_object({}) { |(column_name, column_type), hash| hash[column_name] = map_value(column_type) }\n end", "def transform_values(context, hash)\n hash.transform_values do |blocks|\n accumulator = []\n Array(blocks).each do |block|\n block.call(context.source_record, accumulator, context)\n end\n accumulator\n end\n end", "def each_match(hash)\n line[:type, :all].count.times do |i|\n next unless hash.all? { |k, v| line[k, :all][i] == v }\n yield(\n :type => line[:type, :all][i],\n :ssn => line[:ssn, :all][i],\n :ein => line[:ein, :all][i],\n :amount => line[:amount, :all][i]\n )\n end\n end", "def sanitize_hash\n @hash_of_merged_data.map { |key,values|\n values.map! {|value| to_float_or_int(value) }\n values.uniq!\n values.sort!\n { key => values }\n }.reduce(:merge)\n end", "def _visit_ruby_hash(binding_type)\n in_value = self.input\n out_value = binding_type.definition.new_value()\n field_names = binding_type.get_field_names()\n for field in field_names\n begin\n self.input = in_value[field]\n rescue KeyError\n report_error('vapi.bindings.typeconverter.hash.missing.key',\n field)\n end\n visit(binding_type.get_field(field))\n out_value.set_field(field, result)\n end\n self.input = in_value\n self.result = out_value\n end", "def convert(lines, keys)\n array = Array.new\n \n lines.each do |line|\n zipped = keys.zip(line)\n \n # Filter value (Integer, Boolean, \"\" for nil, or String#strip)\n for pair in zipped\n value = pair.pop \n pair << filter(value)\n end\n \n array << Hash[zipped]\n end\n\n return array\n end", "def _reduce_590(val, _values, result)\n _, (id, line) = val\n\n name = id.to_sym\n self.assignable [name, line]\n result = [:\"**#{name}\", line]\n\n result\nend", "def _reduce_590(val, _values, result)\n _, (id, line) = val\n\n name = id.to_sym\n self.assignable [name, line]\n result = [:\"**#{name}\", line]\n\n result\nend", "def csv_process_row_fields(pattern_data, row, index)\n orig_row = @csv_row_arr.clone\n\n # counting back from the end, remove blank cels. \n # but if there are blank cells in the middle, leave them (ick!)\n # i need to test if this step is even necessary #*\n [*0..(@csv_row_arr.size-1)].reverse.each { |i| orig_row.delete_at(i) if orig_row[i].nil? }\n\n # in case we have columns we are skipping, we will make a hash that maps \n # column numbers to field names, called \"field_names\". note the keys are integers\n # that correspond to column offsets, but the aren't necessarily contiguous, hence hash not array.\n @field_names = Hash[Array(*[0..orig_row.size-1]).zip(orig_row.map{|x|normalize_fieldname(x)})]\n @field_names.reject!{|k,v| @skip_cols[k]} if @skip_cols\n \n # in the wierd cases where a document repeats the same field name but might have different values,\n # we want to be able to report it and make an intelligent guess as to which column we want to use.\n @repeated_field_names = {}\n if (@field_names.size > @field_names.values.uniq.size)\n # we don't care which column it's in \n @field_names.each{|k,v| @repeated_field_names[v]||=0; @repeated_field_names[v]+=1;} \n @repeated_field_names.delete_if{|k,v| v==1}\n end\n end", "def process_record(text_line)\n text_line = pre_process(text_line)\n return pad_record(text_line)\n end", "def convert\n STDERR.print \"\\nThis may take 10 minutes or more. Lines processed: \"\n line_in_count = 0\n\n # Create an object to store *all* lines of the *output* CSV\n @csv_out_data = FasterCSV.generate(FCSV_OUT_OPTS){|csv_out| \n\n # Iterate thru each *input* line\n FasterCSV.foreach(@in_file, FCSV_IN_OPTS) {|line_in|\n line_in_count += 1\n if line_in_count == 1\n self.class.verify_csv_in_headers(line_in.headers)\n @csv_out_headers = WILL_INCLUDE_INPUT_COLUMNS ? CSV_OUT_COLUMNS + CSV_IN_COLUMNS : CSV_OUT_COLUMNS\n end\n\n # Iterate thru each *output* column\n line_out = []\n @csv_out_headers.each_with_index{|col,i|\n csv_out << @csv_out_headers if line_in_count == 1 && i == 0\t# Header line\n\n case col\n when RmidItem, PrefixColOwner, PrefixColList\n line_out << line_in[col]\n when HdlItem\n line_out << get_handle_for_rmid(line_in[RmidItem])\n when HdlColOwner\n line_out << get_handle_for_collection_prefix(line_in[PrefixColOwner])\n when HdlColList\n if line_in[PrefixColList]\n prefixes = line_in[PrefixColList].split(VALUE_DELIMITER)\n handles = prefixes.inject([]){|a,prefix| a << get_handle_for_collection_prefix(prefix)}\n line_out << handles.join(VALUE_DELIMITER)\n else\n line_out << \"\"\n end\n end\n }\n csv_out << line_out\n STDERR.print \"#{line_in_count} \" if line_in_count % 200 == 0\n }\n }\n STDERR.puts \"; Total lines #{line_in_count} \"\n end", "def remap\n # This is Ruby magic for turning a hash into an array into a hash again\n Hash[*self.map do |key, value|\n yield key, value\n end.compact.flatten]\n end", "def flatten_process(hash, flatten = true)\n $process_str = \"\"\n op_array = hash.values.map{|x,|x}\n match_data_array = hash.values.map{|_,x|x}\n match_data_array.each_with_index do |data,i|\n # p $process_str\n $data = data\n info_hash = {}\n $data.names.each{|name|info_hash[name] = $data[name.to_sym]}\n info_hash\n # p \"parameter: \" + parameter\n # p $data.methods\n\n $data.names.include?('parameter')\n\n $parameter = $data[:parameter]\n $iterable = $data[:iterable]\n $op = op_array[i]\n case $op\n when :filter\n if $data.names.include?('filterable')\n $filterable = $data[:filterable]\n end\n $process_str += \"(#$iterable).filter{|#$parameter|#$filterable\".chop + \"}\"\n when :filter_map\n if $data.names.include?('filterable')\n $filterable = $data[:filterable]\n end\n if $data.names.include?('mappable')\n $mappable = $data[:mappable]\n end\n if i == op_array.length-1\n $process_str += \"(#$iterable).filter_map{|#$parameter|#$parameter if #$filterable}\"\n end\n if RUBY_VERSION >= \"2.7.0\"\n # p 'hi'\n # p $process_str\n # $mappable.gsub!($parameter, )\n # $process_str += \"(#$iterable).filter_map{|#$parameter|#$mappable if #$filterable}\"\n # $process_str.gsub!($parameter, \"\")\n else\n # $process_str += \"(#$iterable).filter_map{|#$parameter|#$mappable if #$filterable}\"\n end\n when :map\n $mappable = data[:mappable]\n if i == 0\n $process_str += \"(#$iterable).map{|#$parameter|#$mappable\"\n # elsif i == (1...)\n # $process_str += \"|#$parameter|#$mappable})\"\n else\n $process_str += \"|#$parameter|#$mappable})\"\n end\n when :identity\n identity = data[:identity]\n $process_str += \"(#$iterable).map{\" if i != op_array.length\n end\n data\n end\n case $op\n when :filter\n # \"process_str: \" + $process_str\n when :map\n $process_str.chop!\n # $process_str << \"#{$mappable}\"\n when :identity\n $process_str.chop!\n $process_str << \"{|x|x}}\"\n when :filter_map\n $process_str\n if RUBY_VERSION < \"2.7.0\"\n # p $mappable\n # $process_str << \"#$mappable if #$filterable\"\n $process_str\n else\n $mappable\n $process_str\n # $process_str << \"#$mappable if #$filterable\"\n end\n $process_str\n end\n # p hash.length, $op\n if $op == :filter\n $process_str\n if $process_str.scan(']').length > $process_str.scan('[').length\n idx = $process_str.rindex(\"]\")\n $process_str[idx] = ''\n # $process_str[$process_str.rindex(\"]\")\n $process_str\n end\n # p 'hi'\n if $process_str.scan('}').length > $process_str.scan('{').length\n idx = $process_str.rindex(\"}\")\n $process_str[idx] = ''\n # $process_str[$process_str.rindex(\"]\")\n $process_str\n end\n $process_str << \"}\" unless $process_str.scan('}').length == $process_str.scan('{').length\n end\n if $op == :filter_map\n $process_str << \"}\" * (op_array.length-1)\n if $process_str.scan(']').length > $process_str.scan('[').length\n idx = $process_str.rindex(\"]\")\n $process_str[idx] = ''\n # $process_str[$process_str.rindex(\"]\")\n $process_str\n end\n end\n if $op == :identity\n # $process_str << (\"}\"\n $process_str.chop!\n else\n $process_str.chop! if $op == :identity\n end\n # $process_str.chop! if $op == :filter_map\n # p instance_eval($process_str)\n # $process_str\n return instance_eval($process_str)\n # p $process_str\nend", "def parse_map(data: \"\", type: \"new\")\r\n if data.empty? then return end\r\n if type == \"level\" || type == \"attract\" then type = \"new\" end\r\n case type\r\n when \"new\"\r\n tiles = data[0..965].split(//).map{ |b| b.hd }.each_slice(COLUMNS).to_a\r\n object_counts = data[966..1045].scan(/../).map{ |s| s.reverse.hd }\r\n objects = data[1046..-1].scan(/.{5}/m).map{ |o| o.chars.map{ |e| e.hd } }\r\n when \"old\"\r\n data = data[8..-1]\r\n tiles = data[0..1931].scan(/../).map{ |b| b.reverse.to_i(16) }.each_slice(COLUMNS).to_a\r\n objs = data[1932..-1]\r\n objects = []\r\n OBJECTS.sort_by{ |id, o| o[:old] }.reject{ |id, o| o[:old] == -1 }.each{ |id, type|\r\n if objs.length < 4 then break end\r\n quantity = objs[0..3].scan(/../).map(&:reverse).join.to_i(16)\r\n objs[4 .. 3 + 2 * quantity * type[:att]].scan(/.{#{2 * type[:att]}}/).each{ |o|\r\n if ![3,6,8].include?(id) # everything else\r\n objects << [id] + o.scan(/../).map{ |att| att.reverse.to_i(16) }.ljust(4,0)\r\n else # door switches\r\n atts = o.scan(/../).map{ |att| att.reverse.to_i(16) }\r\n objects << [id] + atts[0..-3].ljust(4,0) # door\r\n objects << [id + 1] + atts[-2..-1].ljust(4,0) # switch\r\n end\r\n }\r\n objs = objs[4 + 2 * quantity * type[:att]..-1]\r\n }\r\n end\r\n {tiles: tiles, objects: objects.stable_sort_by{ |o| o[0] }}\r\nrescue\r\n #print(\"ERROR: Incorrect map data\\n\")\r\n return nil\r\nend", "def process_data(model, data)\n data.deep_symbolize_keys!\n @compiled_data << model.new(data) unless data.empty?\n end", "def parse\n @file_data.each {|line|\n h = {}\n data_elements = line.split('|').collect(&:strip)\n #LastName | FirstName | MiddleInitial | Gender | FavoriteColor | DateOfBirth\n @data_collection << {:last_name => data_elements[0], :first_name => data_elements[1], :middle_initial => data_elements[2], :gender => (data_elements[3] == 'M') ? 'Male' : 'Female', :favorite_color => data_elements[4], :dob => data_elements[5].gsub('-', '/'), :dob_year => data_elements[5][-4,4]}\n }\n end", "def index_source\n @lines = {}\n @index = Hash.new{ |h, k| h[k] = [] }\n if @field_names\n index_fields\n include_filter = convert_filter(@include, @field_names)\n exclude_filter = convert_filter(@exclude, @field_names)\n end\n @line_count = 0\n @skip_count = 0\n @dup_count = 0\n line_num = 0\n @data.each do |row|\n line_num += 1\n next if line_num == 1 && @field_names && @ignore_header\n unless @field_names\n if row.class.name == 'CSV::Row'\n @field_names = row.headers.each_with_index.map{ |f, i| f || i.to_s }\n else\n @field_names = row.each_with_index.map{ |f, i| f || i.to_s }\n end\n index_fields\n include_filter = convert_filter(@include, @field_names)\n exclude_filter = convert_filter(@exclude, @field_names)\n next\n end\n field_vals = row\n line = {}\n filter = false\n @field_names.each_with_index do |field, i|\n val = field_vals[i]\n val = val.to_s.strip if val && @trim_whitespace\n line[field] = val\n if include_filter && f = include_filter[i]\n filter = !check_filter(f, line[field])\n end\n if exclude_filter && f = exclude_filter[i]\n filter = check_filter(f, line[field])\n end\n break if filter\n end\n if filter\n @skip_count += 1\n next\n end\n key_values = @key_field_indexes.map{ |kf| @case_sensitive ?\n field_vals[kf].to_s :\n field_vals[kf].to_s.upcase }\n key = key_values.join('~')\n parent_key = key_values[0...(@parent_fields.length)].join('~')\n if @lines[key]\n @warnings << \"Duplicate key '#{key}' encountered at line #{line_num}\"\n @dup_count += 1\n key += \"[#{@dup_count}]\"\n end\n @index[parent_key] << key\n @lines[key] = line\n @line_count += 1\n end\n end", "def transform_hash_for_quest_back(hash, transform_keys = false)\n Hash[\n hash.map do |key, value|\n if key == :order!\n # Key was :order! - it has special meaning: The symbols within it's array are used to\n # dictate order of elements. If transform_keys is false we are on \"root keys\". These are\n # keept as symbols and Savon does it's magic and we'll do nothing. If it is true it means that keys\n # on this level is put to camelcase and the values in the :order! array must match this.\n if transform_keys\n value = value.map { |v| v.to_s.camelcase }\n end\n else\n key = transform_keys ? key.to_s.camelcase : key\n\n # Oh my god this is quick, dirty and mega hackish!\n # Type element in the RespondentDataHeader must be in namespace enum.\n key = \"enum:Type\" if key == \"Type\"\n\n # In some cases we would like to transform values as well as the key\n value = case value\n when Hash\n # Keep on transforming recursively..\n transform_hash_for_quest_back value, true\n when Array\n if value.all? { |v| v.is_a? String }\n # Put it in a structure QuestBack likes..\n {'array:string' => value}\n elsif value.all? { |v| v.is_a? Hash }\n # Keep on transforming recursively..\n value.map { |hash| transform_hash_for_quest_back(hash, true) }\n end\n else\n # We don't know anything better - just let value fall through\n value\n end\n end\n\n [key, value]\n end\n ]\n end", "def massageHash(h,top)\n resourceType = nil\n \n # if this is a FHIR class, convert to a hash\n if is_fhir_class?(h.class.name)\n resourceType = h.class.name.demodulize\n h = Marshal.load(Marshal.dump(h.attributes))\n end\n \n if h.is_a? Hash\n # remove \"_id\" attributes\n h.delete(\"_id\")\n # loop through all the entries in the hash\n h.each do |key,value|\n # massage entries that are also hashes...\n if value.is_a? Hash\n h[key] = massageHash(value,false)\n # massage entries that are arrays...\n elsif value.is_a? Array\n # replace each item in the array...\n value.map! do |item|\n if item.is_a? Hash\n next massageHash(item,false) # .. with a massaged hash\n # serialize FHIR children correctly\n elsif is_fhir_class?(item.class.name)\n next massageHash(item,false) # .. with a hash representation of an object\n else\n next item # .. or with the item itself (probably primitive data type)\n end\n end\n # after massaging the array, remove empty arrays\n if value.empty?\n h.delete(key)\n end\n # remove empty attributes\n elsif value.nil?\n h.delete(key)\n # massage entires that are FHIR classes...\n elsif is_fhir_class?(value.class.name)\n h[key] = massageHash(value,false)\n else\n #puts \"Ignoring '#{key}' inside '#{value.class.name}' of type '#{value.class.name}'\"\n end\n \n # add W3C namespace to <div/> tags\n # if key == 'div'\n # i = (h[key] =~ /^<div>/)\n # j = (h[key] =~ /^<div/)\n # if i==0\n # # replace the <div/> tag w/ one with the namespace\n # h[key] = '<div xmlns=\"http://www.w3.org/1999/xhtml\">' + value[5..value.length]\n # elsif i!=0 and j!=0\n # # there is no div tag at all -- add the full <div/> tag w/ namespace\n # h[key] = '<div xmlns=\"http://www.w3.org/1999/xhtml\">' + value + '</div>'\n # end\n # end\n \n end \n end\n \n # if this is a FHIR class, add the 'resourceType' attribute\n if top and !resourceType.nil?\n h['resourceType'] = resourceType\n end\n \n fix_all_keys(h)\n end", "def process_data\r\n $map = Map.new\r\n players = $data.shift.split(\";\") rescue nil\r\n [*players].each do |p|\r\n p = p.split(\",\")\r\n o = Dude.new p[2].split(\".\").map(&:to_i), p[1]\r\n o.id = p[0].to_i\r\n $map << o\r\n end\r\n end", "def transform(parsed_query)\n parsed_query.inject({}) do |all, (key, value)|\n if node = MAP[key]\n field = node[:field]\n all[field] = convert(value, node[:type])\n end\n all\n end\n end", "def handle_record_line(line, record)\n ret = nil\n if record.respond_to?(:process)\n if ret = record.send(:process, line.dup)\n unless ret.is_a?(Hash)\n raise Puppet::DevError,\n \"Process record type #{record.name} returned non-hash\"\n end\n else\n return nil\n end\n elsif regex = record.match\n # In this case, we try to match the whole line and then use the\n # match captures to get our fields.\n if match = regex.match(line)\n fields = []\n ret = {}\n record.fields.zip(match.captures).each do |field, value|\n if value == record.absent\n ret[field] = :absent\n else\n ret[field] = value\n end\n end\n else\n nil\n end\n else\n ret = {}\n sep = record.separator\n\n # String \"helpfully\" replaces ' ' with /\\s+/ in splitting, so we\n # have to work around it.\n if sep == \" \"\n sep = / /\n end\n line_fields = line.split(sep)\n record.fields.each do |param|\n value = line_fields.shift\n if value and value != record.absent\n ret[param] = value\n else\n ret[param] = :absent\n end\n end\n\n if record.rollup and ! line_fields.empty?\n last_field = record.fields[-1]\n val = ([ret[last_field]] + line_fields).join(record.joiner)\n ret[last_field] = val\n end\n end\n\n if ret\n ret[:record_type] = record.name\n return ret\n else\n return nil\n end\n end", "def hash_from source, line\n line_elements = line.split(source[:delim]).map(&:strip)\n Hash[source[:headers].zip(line_elements)].tap do |h|\n h[:birth_date] = Date.strptime( h[:birth_date].to_s.gsub('-','/'), '%m/%d/%Y' )\n end\n end" ]
[ "0.63029784", "0.5505414", "0.5502506", "0.54044", "0.53038436", "0.5275538", "0.5246323", "0.52140754", "0.517291", "0.5109988", "0.50749296", "0.50705767", "0.5053703", "0.5040693", "0.49770197", "0.4957514", "0.49220508", "0.49132803", "0.4892163", "0.48846743", "0.48665375", "0.48651898", "0.48546347", "0.48486254", "0.4848244", "0.48469043", "0.48465654", "0.47942317", "0.47938028", "0.47913972", "0.47901672", "0.4785661", "0.4785661", "0.47809923", "0.47792053", "0.4772563", "0.47678614", "0.47650242", "0.4761705", "0.47598794", "0.47551793", "0.47188497", "0.47104645", "0.47104645", "0.47058702", "0.4694973", "0.46910438", "0.46838778", "0.46820188", "0.4656165", "0.4654564", "0.46465716", "0.46439466", "0.46403396", "0.4636326", "0.46360326", "0.46336967", "0.462396", "0.46233687", "0.46162978", "0.46032164", "0.45857823", "0.4585759", "0.45847118", "0.4584279", "0.45813984", "0.45811138", "0.45738956", "0.45581165", "0.45547777", "0.4552635", "0.45348194", "0.45281085", "0.45267683", "0.45259562", "0.45138633", "0.45118344", "0.45117044", "0.4509196", "0.45080218", "0.45067745", "0.45059174", "0.45039478", "0.45006993", "0.45006993", "0.44970933", "0.44907224", "0.44885466", "0.4488204", "0.4487501", "0.4484609", "0.4477941", "0.44745037", "0.44688427", "0.4467514", "0.4463947", "0.44564968", "0.4455688", "0.44478208", "0.44337496" ]
0.68083143
0
Ensure every key has a column mapping
def validate_column_mappings(line) unmapped = [] line.each_key do |key| next if column_names.include? key unmapped << key end raise NdrImport::UnmappedDataError, unmapped if unmapped.any? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_complete_key(hash)\n keys_as_strings = hash.keys.map(&:to_s)\n missing = value_column_names - keys_as_strings\n extra = keys_as_strings - value_column_names\n\n missing = missing.select do |missing_column_name|\n column = @low_card_model.columns.detect { |c| c.name.to_s.strip.downcase == missing_column_name.to_s.strip.downcase }\n if column && column.default\n the_default = column.default\n the_default = type_cast(column, the_default)\n hash[column.name] = the_default\n false\n else\n true\n end\n end\n\n if missing.length > 0\n raise LowCardTables::Errors::LowCardColumnNotSpecifiedError, \"The following is not a complete specification of all columns in low-card table '#{@low_card_model.table_name}'; it is missing these columns: #{missing.join(\", \")}: #{hash.inspect}\"\n end\n\n if extra.length > 0\n raise LowCardTables::Errors::LowCardColumnNotPresentError, \"The following specifies extra columns that are not present in low-card table '#{@low_card_model.table_name}'; these columns are not present in the underlying model: #{extra.join(\", \")}: #{hash.inspect}\"\n end\n\n hash\n end", "def check_columns!\n if columns.nil? || columns.empty?\n raise Error, 'cannot literalize HashRow without columns'\n end\n end", "def assert_partial_key!(hash)\n keys_as_strings = hash.keys.map(&:to_s)\n extra = keys_as_strings - value_column_names\n\n if extra.length > 0\n raise LowCardTables::Errors::LowCardColumnNotPresentError, \"The following specifies extra columns that are not present in low-card table '#{@low_card_model.table_name}'; these columns are not present in the underlying model: #{extra.join(\", \")}: #{hash.inspect}\"\n end\n end", "def key_columns\n @key_columns ||= [\"#{self.table_name}__id\".to_sym]\n end", "def allowed_keys\n field_names - [id_column]\n end", "def restrict_columns\n columns_whitelist = @user_key.columns.restrict_to(@resource).to_a.map{|c| c.name}\n for item in @items\n for column in item.keys\n item.delete(column) unless columns_whitelist.include?(column)\n end\n end\n end", "def set_all!(key)\n @klass.update_all(\"#{@column} = COALESCE(#{@column}, 0) | #{@maps[key]}\")\n end", "def map_columns\n @map_columns ||= attribute_definitions.values.select { |c| c.type == :map }\n end", "def missing_columns(fetched_columns)\n (@all_columns - SimpleSet.new(fetched_columns)) << @primary_key\n end", "def fixup_columns\n @columns.each_index do |idx| \n\n if @columns[idx][:searchable].nil? then\n @columns[idx][:searchable] = @model_class.column_methods_hash[@columns[idx][:id].intern] ? true : false\n end\n @columns[idx][:query] = @columns[idx][:id] if @columns[idx][:query].nil?\n \n if @columns[idx][:sortable].nil? then\n @columns[idx][:sortable] = @columns[idx][:query] == false ? false : true\n end\n \n end\n end", "def columns_hash?(connection, table_name)\n @columns_hash.key?(table_name)\n end", "def make_column_mapping\n self.column_mapping = Hash.new.tap do |mapping|\n headers.collect { |h| canonicalize_header(h) }.each.with_index do |header, index|\n raise RuntimeError, \"Unrecognized canonical header #{header}\" unless HEADER_MAPPING.has_key?(header)\n if value = HEADER_MAPPING[header]\n mapping[index] = value\n end\n end\n end\n end", "def _save_update_all_columns_hash\n v = Hash[@values]\n Array(primary_key).each{|x| v.delete(x) unless changed_columns.include?(x)}\n v\n end", "def _save_update_all_columns_hash\n v = Hash[@values]\n Array(primary_key).each{|x| v.delete(x) unless changed_columns.include?(x)}\n v\n end", "def _column_hashes\n @_column_hashes ||= {}\n end", "def setup_auto_validations\n not_null_cols, explicit_not_null_cols = db_schema.select{|col, sch| sch[:allow_null] == false}.partition{|col, sch| sch[:default].nil?}.map{|cs| cs.map{|col, sch| col}}\n @auto_validate_not_null_columns = not_null_cols - Array(primary_key)\n explicit_not_null_cols += Array(primary_key)\n @auto_validate_explicit_not_null_columns = explicit_not_null_cols.uniq\n @auto_validate_max_length_columns = db_schema.select{|col, sch| sch[:type] == :string && sch[:max_length].is_a?(Integer)}.map{|col, sch| [col, sch[:max_length]]}\n table = dataset.first_source_table\n @auto_validate_unique_columns = if db.supports_index_parsing? && [Symbol, SQL::QualifiedIdentifier, SQL::Identifier, String].any?{|c| table.is_a?(c)}\n db.indexes(table).select{|name, idx| idx[:unique] == true}.map{|name, idx| idx[:columns].length == 1 ? idx[:columns].first : idx[:columns]}\n else\n []\n end\n end", "def _update_without_checking(columns)\n super(identifier_hash(columns))\n end", "def primary_key_columns\n @columns.values.find_all { |c| c.primary_key? }\n end", "def _protobuf_map_columns(force = false)\n return unless table_exists?\n\n @_protobuf_mapped_columns = false if force\n return if _protobuf_mapped_columns?\n\n @_protobuf_columns = {}\n @_protobuf_column_types = Hash.new { |h,k| h[k] = [] }\n\n columns.map do |column|\n @_protobuf_columns[column.name.to_sym] = column\n @_protobuf_column_types[column.type.to_sym] << column.name.to_sym\n end\n\n @_protobuf_mapped_columns = true\n end", "def column_mappings\n raise SolidusImportProducts::AbstractMthodCall\n end", "def hstore_has_all_keys(column, *keys)\n where(\"#{connection.quote_column_name(column)} ?& ARRAY[:keys]\", :keys => keys.flatten)\n end", "def all?(*keys)\n keys.flatten!\n if keys.any?\n # Check only the specified keys\n valid = true\n keys.each do |key|\n unless @values.has_key?(key)\n raise \"Unknown column key :#{key} in call to Row#all?\"\n end\n valid = valid && !@values[key].nil?\n end\n valid\n else\n # Check all value keys\n @values.values.all? {|v| !v.nil? }\n end\n end", "def _protobuf_map_columns(force = false)\n COLUMN_TYPE_MAP_MUTEX.synchronize do\n @_protobuf_mapped_columns = false if force\n\n return unless table_exists?\n return if _protobuf_mapped_columns?\n\n @_protobuf_columns = {}\n @_protobuf_column_types = ::Hash.new { |h, k| h[k] = ::Set.new }\n @_protobuf_date_datetime_time_or_timestamp_column = ::Set.new\n\n columns.map do |column|\n column_name_symbol = column.name.to_sym\n column_type_symbol = column.type.to_sym\n @_protobuf_columns[column_name_symbol] = column\n @_protobuf_column_types[column_type_symbol] << column_name_symbol\n\n if DATE_OR_TIME_TYPES.include?(column_type_symbol)\n @_protobuf_date_datetime_time_or_timestamp_column << column_name_symbol\n end\n end\n\n @_protobuf_mapped_columns = true\n end\n end", "def validate_columns\n columns.each do |name|\n if !column_available?(name)\n errors.add column_label_for(name), :inclusion\n end\n end if columns.present?\n end", "def build_insert_set_cols(key)\n \"#{quote_column_name(key)} = EXCLUDED.#{quote_column_name(key)}\"\n end", "def _save_update_all_columns_hash\n v = @values.dup\n Array(primary_key).each{|x| v.delete(x) unless changed_columns.include?(x)}\n v.delete(model.lock_column)\n v\n end", "def setup_columns\n if inheritable?\n SimpleSet.new([primary_key, inheritance_column])\n else\n primary_key.blank? ? SimpleSet.new : SimpleSet.new([primary_key])\n end \n end", "def set_column_mapping\n @columns_maps = {}\n\n column_alias = MC_COLUMNS_ALIAS.invert\n\n # check if column name in worksheet has an alias - if so - save the column id\n column_names = get_columns_names\n column_names.each_index do |i|\n if column_alias[column_names[i]] != nil\n @columns_maps[column_alias[column_names[i]]] = i\n end\n end\n\n @columns_maps # we return it only for tests\n end", "def check_column_conflicts\n mod = Sequel::Model\n columns.find_all{|c| mod.method_defined?(c)}.each{|c| get_column_conflict!(c)}\n columns.find_all{|c| mod.method_defined?(\"#{c}=\")}.each{|c| set_column_conflict!(c)}\n end", "def key_columns(records)\n raise 'Cannot determine key from empty batch' if records.empty?\n\n first_key = records.first.key\n record_key(first_key).keys\n end", "def missing_keys; end", "def columns_with_redhillonrails_core\n unless @columns\n columns_without_redhillonrails_core\n cols = columns_hash\n indexes.each do |index|\n next if index.columns.blank?\n column_name = index.columns.reverse.detect { |name| name !~ /_id$/ } || index.columns.last\n column = cols[column_name]\n column.case_sensitive = index.case_sensitive?\n column.unique_scope = index.columns.reject { |name| name == column_name } if index.unique\n end\n end\n @columns\n end", "def columns\n map.keys\n end", "def is_column_exist (row_key, col_family, col_name)\r\n [email protected](row_key)[col_family+':'+col_name].blank? \r\n end", "def ensure_mappings_define_klass\n klassless_mappings = @columns.\n select { |mapping| mapping.nil? || mapping['klass'].nil? }.\n reject { |mapping| mapping['do_not_capture'] }.\n map { |mapping| mapping['column'] || mapping['standard_mapping'] }\n\n return if klassless_mappings.empty?\n\n # All column mappings for the single item file require a klass definition.\n fail \"Missing klass for column(s): #{klassless_mappings.to_sentence}\"\n end", "def key?(key)\n @table.key?(key.to_sym)\n end", "def hstore_has_any_keys(column, *keys)\n where(\"#{connection.quote_column_name(column)} ?| ARRAY[:keys]\", :keys => keys.flatten)\n end", "def validate_schema\n all_cols1 = @db1.column_names(@table1)\n all_cols2 = @db2.column_names(@table2)\n if all_cols1 != all_cols2\n raise \"Columns do not match, please use full coopy toolbox\"\n end\n\n key_cols1 = @db1.primary_key(@table1)\n key_cols2 = @db2.primary_key(@table2)\n if key_cols1 != key_cols2\n raise \"Primary keys do not match, please use full coopy toolbox\"\n end\n end", "def validate_schema\n all_cols1 = @db1.column_names(@table1)\n all_cols2 = @db2.column_names(@table2)\n if all_cols1 != all_cols2\n raise \"Columns do not match, please use full coopy toolbox\"\n end\n\n key_cols1 = @db1.primary_key(@table1)\n key_cols2 = @db2.primary_key(@table2)\n if key_cols1 != key_cols2\n raise \"Primary keys do not match, please use full coopy toolbox\"\n end\n end", "def validate_schema\n all_cols1 = @db1.column_names(@table1)\n all_cols2 = @db2.column_names(@table2)\n if all_cols1 != all_cols2\n raise \"Columns do not match, please use full coopy toolbox\"\n end\n\n key_cols1 = @db1.primary_key(@table1)\n key_cols2 = @db2.primary_key(@table2)\n if key_cols1 != key_cols2\n raise \"Primary keys do not match, please use full coopy toolbox\"\n end\n end", "def synthetic_columns\n @columns ||= [:id]\n end", "def has_duplicate_db_columns?\n !get_all_db_columns.get_duplicates.empty?\n end", "def load_schema!\n @columns_hash = _projection_fields.except(*ignored_columns)\n\n @columns_hash.each do |name, column|\n define_attribute(\n name,\n connection.lookup_cast_type_from_column(column),\n default: column.default,\n user_provided_default: false\n )\n end\n end", "def set_validations\n # TODO: Move below this line to the partition class itself\n @keys.each do |key|\n case key.type\n when :continuous\n partition_class.validates_uniqueness_of(\"#{key.column}_begin\", :scope => @keys.remaining_columns(\"#{key.column}_begin\"))\n partition_class.validates_uniqueness_of(\"#{key.column}_end\", :scope => @keys.remaining_columns(\"#{key.column}_end\"))\n when :discrete\n partition_class.validates_uniqueness_of(key.column, :scope => @keys.remaining_columns(key.column))\n end\n end\n end", "def verify_header_names(key, models_columns, header)\n normalized_header = []\n\n got_error = false\n header.each_with_index do |h, i|\n logger.debug \"verify header: #{h}\"\n if h == \"id\"\n error(cur_sheet_name, 1, \"Header column #{h} not allowed, update not supported yet\")\n next\n end\n\n if h.nil?\t# ignore empty header\n normalized_header[i] = nil\n next\n else\n normalized_header[i] = normalize_header(h)\n end\n\n # see if heading is an attribute name, pseudo attribute,\n # fk_finder, refrerence id or reference to one\n # if so, put it in the models_columns :headers hash with header index\n header_is_known = false\n show_header_in_results = true\n models_columns.each_with_index do |mc, ci|\n\n # check for ambiguous header name\n if mc[:dups].has_key?(normalized_header[i])\nlogger.debug \"verify_header: ci: #{ci} found ambiguous header: #{normalized_header[i]}\"\n dup_index = mc[:dups][normalized_header[i]]\nlogger.debug \"verify_header: ci: #{ci} dup_index: #{dup_index}\"\n next if dup_index.nil?\n if dup_index == i\n header_is_known = true\n mc[:headers] << [normalized_header[i], i] # 0 based index\nlogger.debug \"header #{h} i: #{i} ci: #{ci} is_ambiguous_model_column mc[:headers]: #{mc[:headers]}\"\n break\n end\n next\n end\n\n if mc[:allowed_cols].include?(normalized_header[i])\n header_is_known = true\n mc[:headers] << [normalized_header[i], i] # 0 based index\nlogger.debug \"header #{h} is_model_column mc[:headers]: #{mc[:headers]}\"\n break\n end\n\n if is_pseudo_attr(mc[:model], normalized_header[i])\n header_is_known = true\n mc[:headers] << [normalized_header[i], i]\nlogger.debug \"header #{h} is_model_pseudo_attr mc[:headers]: #{mc[:headers]}\"\n break\n end\n\n if is_fk_finder_header(normalized_header[i], mc)\n header_is_known = true\n mc[:headers] << [normalized_header[i], i]\nlogger.debug \"header #{h} is_fk_finder mc[:headers]: #{mc[:headers]}\"\n break\n end\n\n if is_ref_def_header(normalized_header[i], mc[:model])\n header_is_known = true\n show_header_in_results = false\n @sheet_results[key][:_refs][(mc[:model]).name] = normalized_header[i]\n @sheet_results[key][:_ref_ids][normalized_header[i]] = {}\n mc[:headers] << [normalized_header[i], i]\nlogger.debug \"header #{h} is_ref_def mc[:headers]: #{mc[:headers]}\"\n break\n end\n\n if is_ref_ref_header(normalized_header[i], mc)\n header_is_known = true\n mc[:headers] << [normalized_header[i], i]\nlogger.debug \"header #{h} is_ref_ref mc[:headers]: #{mc[:headers]}\"\n break\n end\n end\n if !show_header_in_results\n normalized_header.delete_at(i)\n end\n next if header_is_known\n\n # error if not recognized, but continue to gather all errors\n got_error = true\n error(cur_sheet_name, 1, \"Header name '#{h}' is not recognized for model(s) #{model_column_names(models_columns)}\")\n end\n return false if got_error\n\n#logger.debug \"mc[0][:headers]: #{models_columns[0][:headers]}\"\n#logger.debug \"mc[1][:headers]: #{models_columns[1][:headers]}\"\n\n @sheet_results[key][:header] = [\"id\"] + normalized_header.compact\n logger.debug \"Normalized header: key: #{key} #{@sheet_results[key][:header]}\"\n return true\nend", "def check_key_name(cf)\n count = 0\n if(cf.respond_to?(:column_family))\n cf = cf.column_family\n end\n klass = OpenStruct.new(:column_family => 'system.schema_columnfamilies', :default_consistency => 'QUORUM')\n cql = DatastaxRails::Cql::ColumnFamily.new(klass)\n results = CassandraCQL::Result.new(cql.select(\"key_alias, key_aliases\").conditions('keyspace_name' => @keyspace, 'columnfamily_name' => cf).execute)\n result = results.fetch\n if(result && (result['key_alias'] == 'KEY' || result['key_aliases'].include?('KEY')) && (result['key_aliases'].blank? || !result['key_aliases'].include?('key')))\n count += 1\n say \"Renaming KEY column\", :subitem\n DatastaxRails::Cql::AlterColumnFamily.new(cf).rename(\"KEY\",'key').execute\n end\n count\n end", "def check_constraints(table)\n m = output_identifier_meth\n\n hash = {}\n _check_constraints_ds.where_each(:conrelid=>regclass_oid(table)) do |row|\n constraint = m.call(row[:constraint])\n entry = hash[constraint] ||= {:definition=>row[:definition], :columns=>[]}\n entry[:columns] << m.call(row[:column]) if row[:column]\n end\n \n hash\n end", "def validate_unique *colnames\n\t\t\tcolnames.each { |colname|\n\t\t\t\tds = self.class.where colname => send(colname)\n\t\t\t\tds.filter!(~{primary_key => send(primary_key)}) unless new?\n\t\t\t\tif ds.count > 0\n\t\t\t\t\terrors.add(colname, 'must be unique.')\n\t\t\t\tend\n\t\t\t}\n\t\tend", "def strict_keys?(input)\n (input.keys - rules.keys).empty?\n end", "def expected_columns; end", "def has_duplicate_db_columns?\n return false unless abstract_form_valid?\n !abstract_form.get_duplicate_db_columns.empty?\n end", "def absorb_all_columns\n trace :relational_columns!, \"Computing contents of all tables\" do\n @composition.all_composite_by_name.each do |composite|\n trace :relational_columns, \"Computing contents of #{composite.mapping.name}\" do\n absorb_all composite.mapping, composite.mapping\n end\n end\n end\n end", "def unmatched_keys; end", "def contains_all?( binder )\n return true if(empty?)\n @missing_columns = @comparable_mandatory_columns - binder.operator_names.collect(&:downcase)\n @missing_columns.empty?\n end", "def blacklist_keys\n @blacklist_keys ||= to_adapter.column_names.map(&:to_s) - accessible_attributes.to_a.map(&:to_s)\n end", "def key?(key)\n table.key?(key)\n end", "def transformed?(old_primary_key)\n @transformed ||= {}\n @transformed.has_key?(old_primary_key)\n end", "def each_column(cassandra, cf, key, opts={})\n start_column = opts[:start] || ''\n prev_column = nil\n while start_column != prev_column\n start_column = prev_column\n adjusted_opts = opts.merge(:start => start_column || opts[:start])\n chunk = cassandra.get(cf, key, adjusted_opts)\n chunk.each do |column, value|\n #raise \"hell\" if (column <=> start_column) < 0\n next if start_column == column\n yield column, value\n prev_column = column\n end\n end\n true\n end", "def column_code_of_hash_keys\n code_col_name_hash ={}\n code_col_name_hash[:event_id] =1\n code_col_name_hash[:event_name] =2\n code_col_name_hash[:event_start_time] =3\n code_col_name_hash[:event_end_time] =4\n code_col_name_hash[:event_description] =5\n\n code_col_name_hash[:event_place_id] =6\n code_col_name_hash[:event_place_name] =7\n code_col_name_hash[:event_place_location_data] =8\n 9==9\n code_col_name_hash[:event_place_city] =10\n code_col_name_hash[:event_place_country] =11\n code_col_name_hash[:event_place_latitude] =12\n code_col_name_hash[:event_place_longitude] =13\n code_col_name_hash[:event_place_street] =14\n code_col_name_hash[:event_place_zip] =15\n\n code_col_name_hash[:\"event_event_times_data\"] =16\n code_col_name_hash[:\"event_id\"] =17\n code_col_name_hash[:\"event_start_time\"] =18\n code_col_name_hash[:\"event_end_time\"] =19\n\n\n code_col_name_hash[:event_paging_data] =20\n code_col_name_hash[:event_paging_previous] =21\n code_col_name_hash[:event_paging_next] =22\n\n code_col_name_hash[:event_attending_count] =23\n code_col_name_hash[:event_admins] =24\n code_col_name_hash[:event_owner_id] =25\n code_col_name_hash[:event_owner_name] =26\n code_col_name_hash[:event_picture_data_url] =27\n code_col_name_hash[:event_attending] =28\n code_col_name_hash[:event_interested] =29\n return code_col_name_hash\n end", "def columns; @columns_hash.values; end", "def column?(key)\n headers.include?(key.as_sym)\n end", "def row_allowed?(row)\n if unique\n key = (unique.collect { |k| row[k] }).join('|')\n return false if compound_key_constraints[key]\n compound_key_constraints[key] = 1\n end\n return true\n end", "def masked_mappings\n @masked_mappings ||= begin\n if @klass\n { @klass => @columns }\n else\n column_level_klass_masked_mappings\n end\n end\n end", "def coerce_keys(*attrs); end", "def _check_constraints_ds\n @_check_constraints_ds ||= metadata_dataset.\n from{pg_constraint.as(:co)}.\n left_join(Sequel[:pg_attribute].as(:att), :attrelid=>:conrelid, :attnum=>SQL::Function.new(:ANY, Sequel[:co][:conkey])).\n where(:contype=>'c').\n select{[co[:conname].as(:constraint), att[:attname].as(:column), pg_get_constraintdef(co[:oid]).as(:definition)]}\n end", "def hstore_has_key(column, key)\n where(\"#{connection.quote_column_name(column)} ? :key\", :key => key) \n end", "def columns_hash(connection, table_name)\n @columns_hash.fetch(table_name) do\n @columns_hash[deep_deduplicate(table_name)] = columns(connection, table_name).index_by(&:name).freeze\n end\n end", "def can_add_primary_key_constraint_on_nullable_columns?\n true\n end", "def mapped_columns\n @columns.map do |column|\n @mappings[column] || column.to_s.send(@inflector)\n end\n end", "def key?(key)\n in_transaction\n @table.key? key\n end", "def has_natural_key?(row)\n natural_key.any? && natural_key.all? { |key| row.has_key?(key) }\n end", "def valid_column?(index)\n column_values = column(index).compact\n column_values == column_values.uniq\n end", "def columns=(cols)\n if cols && cols.uniq.size != cols.size\n handle_duplicate_columns(cols)\n end\n super\n end", "def has_key?(field_name); end", "def column_changed?(column)\n initial_values.has_key?(column)\n end", "def ignored_keys\n [id_column, :created_at, :updated_at]\n end", "def transform_keys?\n !options[:key_transform_fn].nil?\n end", "def test_it_populates_keys\n expected = %w[A1 B1 C1 D1 A2 B2 C2 D2 A3 B3 C3 D3 A4 B4 C4 D4]\n\n assert_equal expected, @board.board_hash.keys\n end", "def has_key?(name)\n @result_set ? @callsite.columns_hash.has_key?(name) : super || @monitored_columns.has_key?(name)\n end", "def key_coercions; end", "def columns_hash\n self\n end", "def kv_table(table)\n transform_table!(table).rows_hash\nend", "def needing_reencryption\n incorrect_column_prefixes = model.send(:column_encryption_metadata).map do |column, metadata|\n prefix = metadata.key_searcher.call\n (Sequel[column] < prefix) | (Sequel[column] > prefix + 'B')\n end\n\n where(Sequel.|(*incorrect_column_prefixes))\n end", "def validate_fields\n for key in self.query_parameters.keys\n for column in eval(\"#{self.model_name}\").columns\n if key == column.name.to_sym\n if column.type == :boolean\n if self.query_parameters[key] == \"0\"\n self.query_parameters[key] = false\n else\n self.query_parameters[key] = true\n end\n end\n end\n end\n end\n end", "def check_fields\n fields = %w{ipaper_id ipaper_access_key}.inject([]){|stack, f| stack << \"#{name}##{f}\" unless column_names.include?(f); stack}\n raise ScribdFuError, \"These fields are missing: #{fields.to_sentence}\" if fields.size > 0\n end", "def enabled_columns\n columns.reject { |_, c| c.ignore? }.to_h.with_indifferent_access\n end", "def essential_columns(model_class)\n model_class.reflect_on_all_associations.inject([@primary_key]) do |arr, assoc|\n if assoc.options[:dependent] && assoc.macro == :belongs_to\n arr << assoc.association_foreign_key\n end\n arr\n end\n end", "def supports_named_column_constraints?\n true\n end", "def import_table_validations(skip_columns = [])\n return unless connection.data_source_exists?(table_name)\n\n load_schema\n skip_columns += associations_foreigns\n skip_columns += [primary_key, 'created_at', 'updated_at']\n skip_columns += Rails.application.config.filter_parameters.map do |item|\n [\"#{item}\", \"#{item}_confirmation\", \"encrypted_#{item}\"]\n end.flatten\n\n @columns_hash.except(*skip_columns).each do |name, column|\n validations = {}\n\n # Prepare the validations\n unless column.null\n if boolean?(column)\n validations[:inclusion] = [true, false]\n else\n validations[:presence] = true\n end\n end\n\n unless column.limit.nil? || numeric?(column)\n validations[:length] = { maximum: column.limit }\n end\n\n # Apply validations\n validates name, validations unless validations.empty?\n end\n end", "def column_mappings\n @column_mappings ||= raw_column_mappings.map do |column_mapping|\n NdrImport::NonTabular::ColumnMapping.new(column_mapping)\n end\n end", "def num_key_fields() 1 end", "def serialized_columns\n serialization_map.keys\n end", "def nullify_keys(records)\n if (user = acting_user)\n records.each { |r| r.user_changes!(user, @reflection.primary_key_name => nil) if r.is_a?(Hobo::Model) }\n end\n\n # Normal ActiveRecord implementatin\n ids = quoted_record_ids(records)\n @reflection.klass.update_all(\n \"#{@reflection.primary_key_name} = NULL\", \n \"#{@reflection.primary_key_name} = #{@owner.quoted_id} AND #{@reflection.klass.primary_key} IN (#{ids})\"\n )\n end", "def has_key?(key)\n @table.get(key) != nil\n end", "def key?(key)\n super(convert_key(key))\n end", "def keys\n @keys ||= [column_for_order_by(relation), primary_key].compact.uniq\n end", "def ff_has_column?(column)\n key = column.to_s\n attribute_aliases[key] || column_names.include?(key)\n end", "def map_key_to_attribute(key)\n\t\t\t# By default, convert the key to snake case and find a matching attribute\n\t\t\tname = key.underscore\n\n\t\t\t@model_class.column_names.include?(name) ? name : nil\n\t\tend", "def primary_keys\n ::Kernel.raise Errors::NotImplemented\n end", "def initialize_tuple_keys\n @tuple_keys = mapping.keys.flatten + non_primitives.flat_map(&:tuple_keys)\n end" ]
[ "0.7006647", "0.6529447", "0.6290558", "0.6249446", "0.62335354", "0.61609274", "0.61510026", "0.6072055", "0.60656965", "0.6064076", "0.60543984", "0.603254", "0.59626573", "0.59626573", "0.5944907", "0.5937606", "0.5933706", "0.59186053", "0.59083956", "0.5905001", "0.5899458", "0.58969134", "0.58585835", "0.5842848", "0.5835886", "0.5832769", "0.5823953", "0.5796404", "0.57844865", "0.57201105", "0.5718158", "0.5698347", "0.5682723", "0.5669111", "0.56678355", "0.5667397", "0.56568253", "0.56434983", "0.56434983", "0.56434983", "0.56132156", "0.5602017", "0.5587275", "0.55863863", "0.5567634", "0.5548461", "0.55274004", "0.552014", "0.5514346", "0.5500863", "0.54975253", "0.54874855", "0.5478376", "0.54732955", "0.5460048", "0.54483926", "0.5437455", "0.54260737", "0.5424454", "0.5399088", "0.53972065", "0.53967804", "0.5392046", "0.53744787", "0.53605247", "0.5355396", "0.5342411", "0.5339734", "0.53274626", "0.5317994", "0.5313476", "0.5313287", "0.52942556", "0.5293962", "0.5292985", "0.52916723", "0.5289789", "0.5286478", "0.5281373", "0.5275129", "0.5273472", "0.5266213", "0.5260096", "0.52578264", "0.52469", "0.52331805", "0.52318305", "0.5231719", "0.5228872", "0.5224905", "0.52195656", "0.5218039", "0.5208521", "0.5203043", "0.5200403", "0.51990056", "0.5197347", "0.51916975", "0.51905984", "0.51901597" ]
0.6604078
1
Return an Array of the `hash` values in the order the columns are defined in the mapping, allowing mapped_line to work as normal
def order_values_by_mappings(hash, column_mappings) column_mappings.map { |column_mapping| hash[column_name_from(column_mapping)].to_s } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cols_array\n arr = Array.new\n @columns_hash.each{|k,v| arr << k}\n return arr\n end", "def columns; @columns_hash.values; end", "def hash\n rows.hash\n end", "def to_2d_array(tile_hash)\n min_x = tile_hash.min_by{|v|v[:x]}[:x]\n min_y = tile_hash.min_by{|v|v[:y]}[:y]\n map = []\n tile_hash.each do |cell|\n rel_x = cell[:x] - min_x\n rel_y = cell[:y] - min_y\n if map.length < rel_y + 1 || map[rel_y] == nil\n map[rel_y] = []\n end\n map[rel_y][rel_x] = cell[:index]\n end\n map\nend", "def raw_hash\n Hash.new.tap do |out|\n @map.each { |col| out[col.to] = @table[col.from] }\n end\n end", "def _column_hashes\n @_column_hashes ||= {}\n end", "def columns\n map.keys\n end", "def value_array(hash)\n array = []\n hash.each do |h|\n h.each do |key,value|\n if key == \"value\"\n array << value\n end\n end\n end\n return array\n end", "def convert_hash_keys_to_array(hash)\n x = []\n hash.each do |k, v|\n x << k \n end\n return x\n end", "def hash_to_array(record)\n\t\t\tarr = Array.new\n\t\t\trecord.map do |key, val |\n\t\t\t\tarr.push(val)\n\t\t\tend\t\t\t\n\t\t\tarr\n\t\tend", "def prep_hash_for_csv(data_hash)\n\tbig_array = []\n\tdata_hash.each do |key, ads|\n\t\tad_array = [].push(key)\n\t\tads.each do |ad|\n\t\t\tad_string = ad[0] + \"\\r\" + ad[1] + \"\\r\" + ad[2]\n\t\t\tad_array.push(ad_string)\n\t\tend\n\t\tbig_array.push(ad_array)\n\tend\n\toutput_array = big_array.safe_transpose\n\treturn output_array\nend", "def column_hash\n @table.hashes.reduce({}) do |h, row|\n row.each do |k,v|\n (h[k.symbolize] ||= []) << parse_formula(v)\n end\n h\n end\n end", "def convert_hash_keys_to_array(hash)\n array = []\n hash.each do |k, v|\n array.push(k)\n end\n array\n end", "def values(column_header)\n rows.map { |row| row[column_header] }\n end", "def transform_to_array(map)\n map.values.collect do |value|\n value.is_a?(Hash) ? transform_to_array(value) : value\n end.flatten\n end", "def hash_char_positions\n hash_positions= []\n @lines.each_with_index do |line, line_index|\n line.enum_for(:scan, /#/).each do\n hash_positions << [line_index, Regexp.last_match.begin(0)]\n end\n end\n if hash_positions.count != 2\n raise ArgumentError, \"Incorrect hash symbol number!!! except exactly two hash symbols.\"\n end\n hash_positions\n end", "def map(hash); end", "def my_array\n return @my_hash.values\n \n end", "def line_to_hash(line, *cols)\n Hash[cols.zip(line.strip.split(/\\s+/, cols.size))]\n end", "def hash\r\n @row + @column\r\n end", "def hash_char_positions\n [].tap do |results|\n @lines.each.with_index do |line, line_idx|\n line.enum_for(:scan, /#/).each do\n results << [line_idx, Regexp.last_match.begin(0)]\n end\n end\n end\n end", "def hash_to_arrays(hash)\n keys = []\n values = []\n hash.each do |key, value|\n keys << key\n values << value\n end\n [keys, values]\nend", "def column_values attribute\n self.map{|row| row[attribute]}.to_a.uniq\n end", "def to_hash\n Hash[ *(map { |line| [line.key, line] }).flatten ]\n end", "def hash_to_array_main(hash)\n array_1 = hash[:area_a].to_a\n array_2 = hash[:area_c].to_a\n array_3 = hash[:area_b].to_a\n return full_array = array_1 + array_2 + array_3\nend", "def hash_to_array(h)\n arr = Array.new\n for k in h.keys\n lst = [k]\n lst << h[k]\n arr << lst.flatten\n end\n return arr\nend", "def array_of_values(name_hash)\n name_hash.collect do |key, value|\n value\n end\nend", "def map_array_of_hashes(arr_hashes)\n return if arr_hashes.nil?\n\n [].tap do |output_array|\n arr_hashes.each do |hash|\n output_array.push hash.values\n end\n end\n end", "def validate_column_mappings(line)\n unmapped = []\n line.each_key do |key|\n next if column_names.include? key\n unmapped << key\n end\n raise NdrImport::UnmappedDataError, unmapped if unmapped.any?\n end", "def hash_to_array(hash)\n # Using Enumerables\n # converted = []\n # hash.each_pair do |key, value|\n # converted << [key, value]\n # end\n # return converted\n\n # Using While Loops\n # converted = []\n # keys = hash.keys\n # i = 0\n # while i < keys.length\n # converted << [keys[i], hash[keys[i]]]\n # i += 1\n # end\n # return converted\nend", "def column_hash\n data_subject.df.to_h.reduce({}) do |h, (k,v)|\n h[k.symbolize] = v.to_a\n h\n end\n end", "def machine_hash(headers,rows)\n # This is just to give a nice data structure (a hash of )\n rows.each_with_index.map do |row, index|\n # todo - rearrange the hash so it is sorted - do we need the row index?\n Hash[headers.each_with_index.map { |header, pos| \n [header, row[pos] ]}\n ].merge('row' => index+2)\n end\n end", "def columns_hash\n self\n end", "def to_ary_rows\n ary = Array.new\n rowa = Array.new\n rowi = 0\n each_index do |row, col|\n if rowi != row\n rowi = row\n ary << rowa\n rowa = Array.new\n end\n\n rowa << self[row, col]\n end\n\n ary << rowa\n ary\n end", "def to_a\n @hash.keys\n end", "def to_a\n @hash.keys\n end", "def keys\n map { |line| line.key }\n end", "def hash_to_grid(hash)\n 0.upto(grid.size - 1).map do |i|\n 0.upto(grid[i].size - 1).map do |j|\n hash[[i, j]]\n end\n end\n end", "def rows_to_array(rows)\n collection = BlocRecord::Collection.new\n rows.each { |row| collection << new(Hash[columns.zip(row)]) }\n collection # return an array\n end", "def to_a\n map { |key,val| [ UniMap.key_to_symbol( key ), val ] }\n end", "def hash_to_arr(player)\n hash_to_array = []\n player.table.each do |x,y|\n hash_to_array << \"#{x}#{y}\"\n end\n create_table(hash)\nend", "def mapping(header, result)\n\n warn(\"Header length = #{header.length} not equal to entry length = #{result[0].length}, some fields will missing!\") if header.length != result[0].length\n\n result_with_header = []\n\n result.each do |values|\n entry = {}\n i = 0\n header.each do |key|\n entry[key] = values[i]\n i += 1\n end\n\n result_with_header.push(entry)\n end\n\n result_with_header\n end", "def to_ary\n ary = Array.new\n each_index do |row, col|\n ary << self[row,col]\n end\n ary\n end", "def to_a\n columns.map { |column| @attributes[column.name.underscore] }\n end", "def to_daff_data(hs)\n return [] if hs.nil? || hs.empty?\n # first row contains the keys\n [hs[0].keys] + hs.map(&:values)\n end", "def column_code_of_hash_keys\n code_col_name_hash ={}\n code_col_name_hash[:event_id] =1\n code_col_name_hash[:event_name] =2\n code_col_name_hash[:event_start_time] =3\n code_col_name_hash[:event_end_time] =4\n code_col_name_hash[:event_description] =5\n\n code_col_name_hash[:event_place_id] =6\n code_col_name_hash[:event_place_name] =7\n code_col_name_hash[:event_place_location_data] =8\n 9==9\n code_col_name_hash[:event_place_city] =10\n code_col_name_hash[:event_place_country] =11\n code_col_name_hash[:event_place_latitude] =12\n code_col_name_hash[:event_place_longitude] =13\n code_col_name_hash[:event_place_street] =14\n code_col_name_hash[:event_place_zip] =15\n\n code_col_name_hash[:\"event_event_times_data\"] =16\n code_col_name_hash[:\"event_id\"] =17\n code_col_name_hash[:\"event_start_time\"] =18\n code_col_name_hash[:\"event_end_time\"] =19\n\n\n code_col_name_hash[:event_paging_data] =20\n code_col_name_hash[:event_paging_previous] =21\n code_col_name_hash[:event_paging_next] =22\n\n code_col_name_hash[:event_attending_count] =23\n code_col_name_hash[:event_admins] =24\n code_col_name_hash[:event_owner_id] =25\n code_col_name_hash[:event_owner_name] =26\n code_col_name_hash[:event_picture_data_url] =27\n code_col_name_hash[:event_attending] =28\n code_col_name_hash[:event_interested] =29\n return code_col_name_hash\n end", "def mhash2arr(mps)\n mps.map{|e|[e[0], e[1].to_p.find_all{|term,prob|prob > 0}.sort_val, e[2]]}.find_all{|mp|mp[1].size>0}\n end", "def to_array_of_hashes_with_values options = {}\n array_of_hashes = collect { |a| a.to_hash_with_values unless a.header? }.compact\n array_of_hashes\n end", "def yale_nd_row_as_hash i\n yale_nd_row(i, :hash)\n end", "def columns\n @columns_hash.values\n end", "def all_hash\n results = CONNECTION.execute(\"SELECT * FROM #{get_table_name};\")\n return array_list = make_object_array(results)\n end", "def values\n @hash.values\n end", "def to_ary_cols\n ary = Array.new\n cola = Array.new\n coli = 0\n each_index_by_cols do |row, col|\n if coli != col\n coli = col\n ary << cola\n cola = Array.new\n end\n\n cola << self[row, col]\n end\n\n ary << cola\n ary\n end", "def mapArrayToHash(rowarr, field_names)\n\ta = [] # an array of hashes\n\trowarr.each do |row|\n\t\thash = Hash.new\n\t\t0.upto(field_names.length-1) do |index|\n\t\t\t#puts \"#{index} #{field_names[index]} VALUE= #{row[index]} }\"\n\t\t\thash[field_names[index].downcase.to_sym] = row[index]\n\t\tend\n\t\ta << hash\n\tend\n\ta\nend", "def process_hash_row(hsh)\n if @headers.any?\n keys_or_values = hsh.values\n @row_id = hsh[:row_id]\n else\n keys_or_values = hsh.keys.map(&:to_s)\n end\n\n file_line = keys_or_values.join(',')\n validated_line = utf_filter(check_utf(file_line))\n res = line_parse(validated_line)\n res\n end", "def yale_row_as_hash i\n h = yale_nd_row(i, :hash)\n return h if i >= self.shape[1] || self[i,i].nil? || self[i,i] == 0\n h[i] = self[i,i]\n end", "def cells\n rows.map { |r| r[key] }\n end", "def rows\n @rows ||= begin\n row_indexes.map do |e|\n e.map do |e|\n @input[e]\n end\n end\n end\n end", "def array_to_hash(map)\r\n h = Hash.new # key: item, value: 1D array of [row, column]\r\n for r in 0...map.length\r\n for c in 0...map[r].length\r\n item = map[r][c]\r\n if item!= nil\r\n h[item] = [r, c]\r\n end\r\n end\r\n end\r\n h[\"ORIGIN\"] = [0, 0] # special case. always fixed at (0,0)\r\n return h\r\nend", "def attribute_values\n @columns.map do |column|\n @attributes[column.to_sym]\n end\n end", "def values_array\n @_field_path.map{ |field_| @_values[field_.name] }\n end", "def build_hash_from_full_table_line(right_side, keycode, columns=[0..127])\n raise 'cannot build expresssions for full table with no columns' if columns.empty?\n sze = right_side.size\n right_side.each_with_object(TransmutableHash.new).with_index do |(keysyms, hsh), idx|\n if Utils.in_ranged_array?(columns, idx) \n # not sure why a 'b' is in the mapping when that's not an available range\n (flat = [keysyms].flatten).last.gsub!(/^\\+?0x0b/, '0x00') \n hsh[Utils.unwrap_ary([mod_combin(idx), keycode].flatten)] = Utils.unwrap_ary(flat)\n end\n end\n end", "def load_map_chunk_column column_x, column_z; end", "def create_column_headers_index_hash\n collect_column_headers\n @column_hash = Hash[(0...@column_headers.size).zip(@column_headers)] # ==> {0=>102231711, 1=>103244134, 2=>103285344, 3=>103293593}\nend", "def read\n data = []\n\n File.open(@source) do |file|\n while line = file.gets\n data.push(Hash[@columnNames.zip(line.split(' '))])\n end\n end\n\n data\n end", "def row_hash(row)\n Hash[raw_headers.zip(row)].with_indifferent_access\n end", "def map_columns\n @map_columns ||= attribute_definitions.values.select { |c| c.type == :map }\n end", "def hash_keys\n [:x, :y]\n end", "def get_array_of_solid_blocks\n @solid_blocks = []\n\n @map_image_key.each_key do |key|\n if (key.upcase == key) and (key != ',')\n @solid_blocks.push(key)\n end\n end\n end", "def as_map\n row_names, rows = as_array\n map = {}\n row_names.zip(rows) do |row_name, row|\n map[row_name] = row\n end\n map\n end", "def sorted_processed_rows\n processed_rows.sort.to_h\n end", "def values\n sub_result = []\n i = 0\n while i < @hash.length do\n if @hash[i] != nil && @hash[i].length > 0\n @hash[i].map { |k, v| sub_result.push(v) }\n end\n i += 1\n end\n return sub_result.uniq\n end", "def values\n @hash.values\n end", "def hash_to_pairs(hash)\n hash.to_a\nend", "def header_array\n hash = get_headers \n arr = []\n hash.each do |k, v|\n\tv.each do |i|\n\tarr << k + \"=\" + i\n\tend\nend\n arr\nend", "def get_attribute_value_map\n return @attribute_values if @attribute_values\n @attribute_values = self.class.distribute_attrib_values(@attribute_values_flat)\n return @attribute_values\n end", "def array_clone\n new_map = @map.inject([]) do |result,rows|\n result << rows.collect { |e| e}\n end\n \n \n end", "def columns\n @columns = columns_hash.values\n end", "def hash_to_flat(game_hash)\n flat_array = []\n\n game_hash.values.each do |hash|\n \thash.each { |key, value| flat_array << value if key == :value }\n end\n\n return flat_array\nend", "def convert_hash_body_to_array_of_arrays\n arrays = []\n request.body.keys.each do | key |\n [*request.body[key]].each do | value |\n arrays << [key, value]\n end\n end\n\n Pact::Reification.from_term(arrays)\n end", "def keys_values\n ole_table.column_names.zip(values).to_h\n end", "def keys_values\n ole_table.column_names.zip(values).to_h\n end", "def from_hash(hsh)\n fail 'Hash must have at least 2 items' if hsh.size < 2\n [from_hash_x(hsh), from_hash_y(hsh)]\n end", "def cell_native_array(row_key, column_family, column_qualifier, value=nil, timestamp=nil)\n [\n row_key.to_s,\n column_family.to_s,\n column_qualifier.to_s,\n value.to_s\n ]\n end", "def get_column_mappings(row)\r\n mappings = {}\r\n row.each_with_index do |heading, index|\r\n # Stop collecting headings, if heading is empty\r\n if not heading.blank?\r\n mappings[heading.downcase.gsub(/\\A\\s*/, '').chomp.gsub(/\\s/, '_').to_sym] = index\r\n else\r\n break\r\n end\r\n end\r\n mappings\r\n end", "def coords_arr(arr)\n\tarr.map.with_index do |line, x|\n\t\tline.map.with_index do |point, y|\n\t\t\tCOORDS_HASH[[x,y]] = point\n\t\t\t[x,y]\n\t\tend\n\tend\nend", "def create_row_headers_index_hash\n collect_row_headers\n @row_hash = Hash[(0...@row_headers.size).zip(@row_headers)] # ==> {0=>0, 1=>734638, 2=>734639, 3=>734640, 4=>734641, 5=>734642, 6=>734643, 7=>734644, 8=>734645, 9=>734646}\nend", "def convert(lines, keys)\n array = Array.new\n \n lines.each do |line|\n zipped = keys.zip(line)\n \n # Filter value (Integer, Boolean, \"\" for nil, or String#strip)\n for pair in zipped\n value = pair.pop \n pair << filter(value)\n end\n \n array << Hash[zipped]\n end\n\n return array\n end", "def row_set_to_array_of_hashes(headers, row_set)\n result = Array.new\n row_set.each do |row|\n if row.count == headers.count\n row_hash = Hash.new\n headers.zip(row).each do |header, value|\n row_hash[header.underscore.to_sym] = value\n end\n result.push row_hash\n else\n raise BadResponseError.new(\"Row set header count (#{headers.count}) doesn't match row item count (#{row.count}).\")\n end\n end\n result\n end", "def values\n @navigable_map.values.to_a\n end", "def to_array\n # @!method _block(acc, hash_with_column_models_count, depth)\n # Returns the new ActsAsTable headers hash object with accumulated ActsAsTable column models count.\n #\n # @param [Array<Array<Object>>] acc\n # @param [ActsAsTable::Headers::Hash] hash_with_column_models_count\n # @param [Integer] depth\n # @return [ActsAsTable::Headers::Hash]\n _block = ::Proc.new { |acc, hash_with_column_models_count, depth|\n hash_with_column_models_count.each do |key, hash_with_column_models_count_or_column_models|\n case hash_with_column_models_count_or_column_models\n when ::Array\n acc[depth] ||= []\n acc[depth] << [key, hash_with_column_models_count_or_column_models.size]\n\n hash_with_column_models_count_or_column_models.each do |column_model|\n acc[depth + 1] ||= []\n acc[depth + 1] << [column_model]\n end\n when ::Hash\n acc[depth] ||= []\n acc[depth] << [key, hash_with_column_models_count_or_column_models.column_models_count]\n\n _block.call(acc, hash_with_column_models_count_or_column_models, depth + 1)\n end\n end\n\n acc\n }\n\n _block.call([], self, 0)\n end", "def date_array(hash)\n array = []\n hash.each do |h|\n temp =[]\n h.each do |key,value|\n if key == \"month\"\n temp << value\n end\n if key == \"day\"\n temp << value\n end\n if key == \"year\"\n temp << value\n end\n end\n array << temp\n end\n return array\n end", "def hash_to_pairs(hash)\n pairs = []\n hash.each { |k,v| pairs << [k,v] }\n return pairs\nend", "def select_columns_by_kv_as_arrays *args\n map_to_keys(\n map_to_keys(\n map_to_keys(\n (select_columns_by_kv(*args)),\n :to_a\n ),\n :transpose\n ),\n :last\n )\n end", "def to_array\n self.collect{|k,v| v}\n end", "def parse_hash hash\n hash_keys.map{ |k,v| hash[k] }\n end", "def to_sym_arr\n @by_symbol.keys\n end", "def hfor(ta, h)\n out = {}\n @column_maps[ta].each{|ca, c| out[c] = h[ca]}\n out\n end", "def serialized_columns\n serialization_map.keys\n end", "def additions_map\n if @changes.empty?\n self.additions\n end\n\n map = []\n starting_line = ending_line = 0\n\n @changes.each do |addition|\n if starting_line == 0\n starting_line = ending_line = addition.line_number\n elsif addition.line_number == ( ending_line + 1 )\n ending_line = addition.line_number\n else # this row is not part of the last rows \"group\"\n map.push([starting_line, ending_line])\n starting_line = ending_line = addition.line_number\n end\n end\n map.push([starting_line, ending_line])\n map\n end" ]
[ "0.66474134", "0.6356778", "0.6129696", "0.60634154", "0.60352635", "0.60185146", "0.59802306", "0.59547", "0.5949071", "0.587855", "0.5877615", "0.58046275", "0.5803588", "0.577758", "0.5770499", "0.5770416", "0.57633996", "0.57332563", "0.573114", "0.5725849", "0.57097554", "0.5689106", "0.5677731", "0.5666969", "0.5659427", "0.56472313", "0.5644652", "0.5611408", "0.56058633", "0.5600762", "0.5580036", "0.5575411", "0.5554775", "0.5538817", "0.5530908", "0.5530908", "0.5518604", "0.5515148", "0.55112016", "0.5506382", "0.55060613", "0.54954785", "0.54787946", "0.546977", "0.5466054", "0.5448814", "0.5435004", "0.5430447", "0.5428028", "0.5426628", "0.54260176", "0.54207736", "0.5415741", "0.54017085", "0.53839046", "0.53796285", "0.53751", "0.5365301", "0.5348077", "0.5336974", "0.53323674", "0.5332215", "0.53305995", "0.53242224", "0.53207356", "0.5318092", "0.5317182", "0.53159237", "0.5312173", "0.53049797", "0.5301237", "0.5299432", "0.5298203", "0.52865136", "0.5284218", "0.5282076", "0.52779317", "0.5276332", "0.52654046", "0.5241942", "0.52401817", "0.52401817", "0.5240119", "0.5235968", "0.52325994", "0.5224286", "0.52176905", "0.52173465", "0.52029604", "0.5197545", "0.51891315", "0.5187644", "0.5178227", "0.51724344", "0.5172257", "0.5168796", "0.515728", "0.5146384", "0.51441246", "0.51436156" ]
0.5705415
21
Returns the text for the most suitable locale provided.
def suitable_locale_text(texts) english = texts.select { |t| english_locales.include? t["locale"] } (english + texts).first["text"] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def text(locale = I18n.locale)\n output = send(:\"text_#{locale}\")\n output = output.blank? ? text_en : output\n output.blank? ? text_de : output\n end", "def locale\n return nil if errors\n\n locale = YAML.safe_load(@text).keys.first\n locale.to_sym\n end", "def default_locale\n FastGettext.available_locales.first\n end", "def lang locale\n if translations.find_by(locale: locale).try(:automated?)\n \"#{locale}-x-mtfrom-de\"\n else\n locale.to_s\n end\n end", "def language_name_of_text\n if self.language_of_text\n self.language_of_text.human\n end\n end", "def get_locale\n if !self.language.nil?\n return self.language.abbreviation\n else\n return nil\n end\n end", "def system\n locale_from_env || default_locale\n end", "def locale\n if !language.nil?\n language.abbreviation\n elsif !org.nil?\n org.locale\n end\n end", "def locale; end", "def locale; end", "def locale; end", "def locale; end", "def locale; end", "def locale; end", "def locale; end", "def get_locale\n if !self.language.nil?\n return self.language.abbreviation\n elsif !self.org.nil?\n return self.org.get_locale\n else\n return nil\n end\n end", "def translated_text(args = {})\n objects = args[:locale].nil? ? translations : for_language(args[:locale])\n objects.collect(&:text)\n end", "def to_gettext(locale:)\n join_char = Rails.configuration.x.locales.gettext_join_character\n locale = default_locale if locale.blank?\n convert(string: locale, join_char: join_char)\n end", "def language_of_text\n @descriptive_detail.language_of_text || @default_language_of_text\n end", "def find_locale\n locale = locales.all.detect(&:default)\n return locale.code if locale\n\n default_locale\n end", "def find_best_locale\n browser_locale =\n http_accept_language.preferred_language_from(\n Rails.application.config.automatic_locales\n )\n return browser_locale if browser_locale.present?\n\n I18n.default_locale\n end", "def current_locale\n Thread.current[:\"localite:locale\"] || base\n end", "def for_language(locale)\n translations.select { |word| word.locale == locale }\n end", "def locale_backend; end", "def default_locale\n return nil unless localized?\n u_lc = I18n.locale.to_sym\n available_locales.include?(u_lc) ? u_lc : available_locales[0]\n end", "def locale_language(locale = nil)\n (locale || I18n.locale).to_s.match(/^(\\w{2})/) ? $1.to_sym : nil\n end", "def locale\n if self.language\n LANGUAGE_CODE[self.language]\n end\n end", "def text\n # if the title is not present, show the code\n get_translation(self.text_translations, self.dataset.current_locale, self.dataset.default_language)\n end", "def get_locale(host)\r\n host.gsub(I18n.config.host_locale_regex, '\\1') || I18n.default_locale\r\n end", "def locale\n I18n.locale.to_s\n end", "def locale\n I18n.locale.to_s\n end", "def locale_name\n YAML.load(translation || \"{}\").with_indifferent_access[locale] || survey.default_locale_name\n end", "def default_locale; end", "def apply_locale; end", "def locale_language(locale=nil)\n \"#{locale || I18n.locale}\"[0, 2].to_sym\n end", "def human\n I18n.t(language, scope: :languages)\n end", "def locale\n favored_locale\n end", "def default_locale\n (self.locales.first || Locomotive::Mounter.locale).to_sym\n end", "def language_name(code)\n if configatron.locales.include?(code)\n t(:locale_name, :locale => code)\n else\n (entry = ISO_639.find(code.to_s)) ? entry.english_name : code.to_s\n end\n end", "def title\n dt = doc_text_by_current_language\n unless dt.nil?\n return dt.title \n else\n return ESTEAM_NO_LANGUAGE_TXT\n end\n end", "def payment_compatible_locale(locale)\n locale = locale.to_s.split(\"-\").first\n if [\"fr\", \"en\", \"es\", \"it\", \"pt\", \"de\", \"nl\", \"fi\"].include?(locale)\n return locale\n else\n return \"en\"\n end\n end", "def get(locale = Localization.default_locale)\n @locales[locale.to_s]\n end", "def display_language\n default = I18n.locale.try {|l| l.to_s.gsub(/\\-.*$/, '')} || \"en\"\n\n this_doc = self.language_obj.try(:iso_639_1)\n\n return nil if this_doc == default\n\n self.language_str\n end", "def _calc_locale(_l)\n _l = (_l || @_deco_locale || (h.cama_get_i18n_frontend rescue nil) || I18n.locale).to_s\n \"_#{_l}\"\n end", "def locale(locale)\n if default?\n locale.to_s\n else\n \"#{self.name}_#{locale.to_s}\"\n end\n end", "def translation\r\n translation_for(Mongoid::Globalize.locale)\r\n end", "def find_by_locale(locale)\r\n with_locale(locale.to_s).first\r\n end", "def to_deepl_compatible_locale(locale)\n locale.to_s.split('-', 2).first.upcase\n end", "def translation(locale=nil)\n return translation_for(:value, locale)\n end", "def read_locale\n raise \"Override me\"\n end", "def get_translate(locale, key)\r\n I18n.t!(key, :locale => locale)\r\n rescue\r\n nil\r\n end", "def current_locale\n I18n.locale.to_sym || I18n.default_locale.to_sym || I18n.available_locales.first.to_sym\n end", "def localize_text(locale, text)\n text_tag = Regexp.escape(localize_text_tag).to_s\n expression = Regexp.new(text_tag + \"(.*?)\" + text_tag)\n tagged_text = text[expression, 1]\n while tagged_text do\n text = text.sub(expression, translate(locale, tagged_text))\n tagged_text = text[expression, 1]\n end\n return text\n end", "def find_language(text)\n @cc.find_language(Result, SpanInfo, text.encode(Encoding::UTF_8))\n end", "def statement_text(locale=I18n.locale)\n translation(locale)[:text_as_statement] || text\n end", "def text(language = I18n.locale, gender = :both)\n return @qtext if @qtext.is_a? String\n q = @qtext[language.to_sym] || @qtext.first[1] || \"\"\n return q if q.is_a? String\n q.is_a?(String) ? q : q[gender.to_sym]\n end", "def locale\n return @locale\n end", "def locale\n return @locale\n end", "def article_lang_display(text)\n\n\t\ttext.split(\"$$\").each_cons(2) do |lang, content|\n\n\t\t\tif lang.eql?('en') and I18n.locale == :en\n\t\t\t\ten_text = content\n\t\t\t\treturn creole(en_text)\n\t\t\telsif lang.eql?('es') and I18n.locale == :es\n\t\t\t\tes_text = content\n\t\t\t\treturn creole(es_text)\n\t\t\tend\n\t\tend\n\tend", "def text\n # if the title is not present, show the code\n x = get_translation(self.text_translations, self.time_series.current_locale, self.time_series.default_language)\n return x.present? ? x : self.original_code\n end", "def translate(locale)\n translated_text = ''\n parse do |part|\n case part[:type]\n when :paragraph\n translated_text += locale.translate(part[:paragraph])\n when :empty_line\n translated_text += part[:line]\n else\n raise \"should not reach here: unexpected type: #{type}\"\n end\n end\n translated_text\n end", "def get_locale(locale = nil)\n locale || @_deco_locale || (h.cama_get_i18n_frontend rescue nil) || I18n.locale\n end", "def local_name(languages)\r\n ret = nil\r\n if languages\r\n lrs = languages.split(\",\")\r\n lrs.each do |lr|\r\n code = lr.split(\";\")[0]\r\n locale = locales.find(:first, :conditions => [\"code = ?\", code])\r\n ret = locale.name if locale\r\n break if ret\r\n end\r\n end\r\n ret || self.name\r\n end", "def hecho_en\n 'china'\n end", "def locale\n sys && sys[:locale] ? sys[:locale] : default_locale\n end", "def locale\n sys && sys[:locale] ? sys[:locale] : default_locale\n end", "def locale\r\n read_attribute(:locale).to_sym\r\n end", "def locale_from_env\n locale = nil\n # At least one environment valiables should be set on *nix system.\n [ENV[\"LC_ALL\"], ENV[\"LC_MESSAGES\"], ENV[\"LANG\"]].each do |loc|\n\tif loc != nil and loc.size > 0\n\t locale = Locale::Object.new(loc)\n\t locale.charset ||= get_charset(locale)\n\t break\n\tend\n end\n locale\n end", "def locale_title(current_locale)\n if self.locale != current_locale\n setup_locale(current_locale)\n return @locale_contents[current_locale].title if @locale_contents[current_locale]\n end\n self.title\n end", "def locale_to_name\n \t\t{'fr' => 'Français',\n 'en' => 'English',\n 'po' => 'portugues',\n 'sp' => 'Spanish',\n 'de' => 'Deutsch',\n 'it' => 'Italiano'}\n\tend", "def title\n ptxt = post_text_by_current_language\n unless ptxt.nil?\n return ptxt.title \n else\n return ESTEAM_NO_LANGUAGE_TXT\n end\n end", "def with_locale(tmp_locale = T.unsafe(nil)); end", "def extract_locale_from_accept_language_header\n begin\n locale = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first\n\n locales = {\n 'de' => 'de_DE',\n 'da' => 'da_DK',\n 'dk' => 'da_DK',\n 'fi' => 'fi_FI',\n 'fr' => 'fr_FR',\n 'de' => 'de_DE',\n 'en' => 'en_GB',\n 'uk' => 'en_GB',\n 'us' => 'en_GB',\n 'gr' => 'el_GR',\n 'is' => 'is_IS',\n 'it' => 'it_IT',\n 'ja' => 'ja_JP',\n 'nl' => 'nl_NL',\n 'no' => 'no_NO',\n 'pl' => 'pl_PL',\n 'pt' => 'pt_PT',\n 'ro' => 'ro_RO',\n 'ru' => 'ru_RU',\n 'es' => 'es_ES',\n 'sv' => 'sv_SE',\n 'se' => 'sv_SE'\n }\n\n if not locales.has_key?(locale)\n return \"en\"\n end\n\n return locales[locale]\n rescue\n return \"en\"\n end\n end", "def locale\n @grpc.locale\n end", "def locale\n @grpc.locale\n end", "def get_text_if_exists(field)\n return unless field.in? LOCALE_ACCESSORS\n\n Criteria.get_levels(name).reverse_each do |l|\n next if l.to_i > level.to_i\n\n t_key = \"criteria.#{l}.#{name}.#{field}\"\n # Disable HTML output safety. I18n translations are internal data\n # and are considered a trusted source.\n # rubocop:disable Rails/OutputSafety\n return I18n.t(t_key).html_safe if I18n.exists?(t_key)\n # rubocop:enable Rails/OutputSafety\n end\n nil\n end", "def locale=(_arg0); end", "def locale\n self.padma.try :locale\n end", "def locale_from_http_header\n language = request.env['HTTP_ACCEPT_LANGUAGE']\n unless language.blank?\n http_locale = language.scan(/^[a-z]{2}-[A-Z]{2}/)\n unless http_locale.blank?\n http_locale = http_locale.first\n else\n http_locale = language.scan(/^[a-z]{2}/).first\n end\n end\n end", "def locale\n current_site.locale || I18n.default_locale.to_s\n end", "def default_locale\n self.found_locale ||= find_locale\n end", "def get_locale_from_subdomain\n locale = @rh.match( /(.+)\\.demowatch\\.[a-z]{2,3}$/i)[1]\n return locale if ( I18N_ALL_LANGUAGES.include?( locale))\n return nil\n end", "def detectLang(path)\n # The language detector is not doing well for subs, so we will just always assume english...\n return 'en'\n\n lang = $languageDetector.language_iso(getCleanText(path))\n if (lang != nil)\n return lang.to_s()\n end\n\n return UNKNOWN_LANG\nend", "def defaultText()\n if @meta_data[@platform].key?(:text)\n return @meta_data[@platform][:text]\n else\n return ''\n end\n end", "def localize\n helpers.localize\n end", "def with_locale(tmp_locale = T.unsafe(nil), &block); end", "def to_deepl_source_locale(locale)\n locale.to_s.split('-', 2).first.upcase\n end", "def another_locale\n I18n.available_locales.map(&:to_sym).select {|locale| locale != I18n.locale.to_sym }.first\n end", "def extract_locale_from_session\n session[:locale] || nil\n end", "def locale(force = true)\n @locale || negotiate_locale(force)\n end", "def extract_locale_from_accept_language_header\n request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first\n end", "def extract_locale_from_accept_language_header\n request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first\n end", "def extract_locale_from_accept_language_header\n request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first\n end", "def description\n if I18n.locale == :en\n description_en\n else\n description_pl\n end\n end", "def locale\n lang = params.fetch(:language, I18n.default_locale).to_sym\n I18n.available_locales.include?(lang) ? lang : I18n.default_locale\n end", "def display_language(val)\n lang = LanguageList::LanguageInfo.find(val)\n lang ? lang.name : val\n end", "def cctld_from_locale( locale )\n # return \"il\" if locale.to_s == \"he\"\n return if locale.to_s.split( \"-\" ).size < 2\n\n region = locale.to_s.split( \"-\" ).last\n case region\n # There are a few exceptions to ISO 3166-1 / ccTLD mapping\n when \"gb\" then \"uk\"\n else region\n end\n end", "def discover_locale\n locales = Dir[\"#{locale_dir}/*\"]\n locales.map! { |e| File.basename(e) }\n locales.join(\" \")\n end", "def locale\n defined?(I18n) ? I18n.locale : default_locale\n end", "def get_locale_from_http_header\n return DEFAULT_LANGUAGE if request.env['HTTP_ACCEPT_LANGUAGE'].nil?\n locale = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first\n return locale if I18N_ALL_LANGUAGES.include?( locale)\n return DEFAULT_LANGUAGE\n end" ]
[ "0.7414449", "0.73241514", "0.7167041", "0.6786333", "0.6746928", "0.66649854", "0.66258925", "0.64781535", "0.6461694", "0.6461694", "0.6461694", "0.6461694", "0.6461694", "0.6461694", "0.6461694", "0.6461344", "0.6439663", "0.638591", "0.63617367", "0.62789994", "0.6277722", "0.6265308", "0.6254728", "0.62543935", "0.6229998", "0.62154126", "0.6196086", "0.61872715", "0.6181555", "0.61619467", "0.61619467", "0.6096965", "0.6095419", "0.6086449", "0.6078159", "0.6062519", "0.606175", "0.60292935", "0.5991967", "0.59914416", "0.5966583", "0.5965354", "0.59600586", "0.59508866", "0.590471", "0.5903005", "0.58964473", "0.5890242", "0.58884597", "0.58755374", "0.58631325", "0.5840612", "0.58397704", "0.58270794", "0.58181834", "0.5812862", "0.58028966", "0.58028966", "0.58021855", "0.578978", "0.57879287", "0.57788604", "0.57671183", "0.57613856", "0.57607293", "0.57607293", "0.57497996", "0.57326674", "0.5731113", "0.5717227", "0.57013625", "0.5698012", "0.56957", "0.56825686", "0.56825686", "0.5665038", "0.566322", "0.5662442", "0.56607157", "0.5657104", "0.5648385", "0.56462544", "0.56344324", "0.56282085", "0.56266737", "0.56172097", "0.5611792", "0.5605421", "0.56017756", "0.55982184", "0.55940384", "0.55940384", "0.55940384", "0.55918664", "0.55912125", "0.5590197", "0.55884117", "0.558566", "0.5578341", "0.5576291" ]
0.7295444
2
This isn't really part of KeyMap nor HotkeyFile... it is a very unique routine specific for detecting conflicts. So, for now, I'm just going to leave it defined in the global space.
def process_map(map, keymap, path) map.all_attributes.each do |attr| next if KeyMap::NO_CONFLICTS.include?(attr.name) if u = $user_attributes[attr.name] u.value.all.each do |key| keymap.add(key, u, path: path, default: false) end elsif DefaultKeymaps.instance.has_alts?(attr.name) attr.value.all.each do |key| keymap.add(key, attr, path: path, default: true) end else keymap.add(attr.value.pri, attr, path: path, default: true) if attr.value.pri end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def treat_reserved_as_conflict; end", "def treat_reserved_as_conflict=(_arg0); end", "def if_needs_rekey?; end", "def needs_rekey?; end", "def message\n \"#{base} already defines #{conflicts}, also defined on #{owner}\"\n end", "def shared_keyboard_and_mouse_event_init_keys\n shared_keyboard_and_mouse_event_init_keys ||= alternative_key_names.map do |key_grp| \n if @dom_3_attrs.include?(correct_key = key_grp.last) \n correct_key\n else\n \"keyModifierState#{correct_key}\".to_sym\n end\n end\n end", "def shared_keyboard_and_mouse_event_init_key(key_name)\n key_group = alternative_key_names.find {|key_grp| /^(#{key_grp.join('|')})$/i =~ key_name.to_s }\n if key_group\n if @dom_3_attrs.include?(correct_key = key_group.last)\n correct_key \n else\n \"keyModifierState#{correct_key}\".to_sym\n end\n end\n end", "def conflicts\n @conflicts ||= []\n end", "def conflicts\n @conflicts ||= []\n end", "def log_collision?(method_key); end", "def merge_conflict?; end", "def detect_and_fix_resolvable_conflict_events\n events = RecordingEvent.active_user_recording_events(user)\n events.each do |e|\n overlap_type = self.class.overlap_type(self, e) \n unless overlap_type.nil?\n self.class.fix_resolvable_conflict_events(self, e, overlap_type)\n end\n end\n end", "def rl_possible_completions(ignore, invoking_key)\r\n rl_complete_internal('?')\r\n end", "def resolve_key key\n clear_message\n\n # hint mode, pick file based on shortcut\n return select_hint(@viewport, key) if key.match?(/^[a-pr-zZ]$/)\n\n if '0123456789'.include?(key)\n resolve_numeric_key(key)\n elsif key == 'BACKSPACE'\n @patt = @patt[0..-2] if @patt && [email protected]?\n @message = @patt = nil if @patt == ''\n @title = nil unless @patt\n else\n resolve_binding key\n end\n true\nend", "def used_key?(key)\n @used_keys ||= find_source_keys.to_set\n @used_keys.include?(key)\n end", "def rekey!; end", "def rekey!; end", "def confirm_newkeys; end", "def check_for_command_collision(command_match, arg_string)\n collision_type = target.eval(\"defined?(#{command_match})\")\n collision_type ||= 'local-variable' if arg_string.match(%r{\\A\\s*[-+*/%&|^]*=})\n\n if collision_type\n output.puts \"#{text.bold('WARNING:')} Calling Pry command '#{command_match}',\" +\n \"which conflicts with a #{collision_type}.\\n\\n\"\n end\n rescue Pry::RescuableException\n end", "def allow_conflicts\n ((s = self.sections[\"Settings\"]) &&\n (a = s.attributes[\"AllowSetConflicts\"]) &&\n (a.value.pri == '1'))\n end", "def offer_to_overwrite_conflicts\n @host.overwrite = \"true\" if @host.errors.any? and @host.errors.are_all_conflicts?\n end", "def check_common_event\r\n SceneManager.goto(Scene_Map) if $game_temp.common_event_reserved?\r\n end", "def revert_conflicts\r\n self.update_conflicts(-1)\r\n #@tile.hit()\r\n end", "def with_repl_like_sigint; end", "def non_sql_option?(key)\n super || key == :cursor || key == :insert_conflict\n end", "def _process_key keycode, object, window\n return :UNHANDLED if @_key_map.nil?\n chr = nil\n ch = keycode\n if ch > 0 and ch < 256\n chr = ch.chr\n end\n blk = @_key_map[keycode]\n # i am scrappaing this since i am once again complicating too much\n=begin\n # if blk then we found an exact match which supercedes any ranges, arrays and regexes\n unless blk\n @_key_map.each_pair do |k,p|\n $log.debug \"KKK: processing key #{ch} #{chr} \"\n if (k == ch || k == chr)\n $log.debug \"KKK: checking match == #{k}: #{ch} #{chr} \"\n # compare both int key and chr\n $log.debug \"KKK: found match 1 #{ch} #{chr} \"\n #p.call(self, ch)\n #return 0\n blk = p\n break\n elsif k.respond_to? :include?\n $log.debug \"KKK: checking match include #{k}: #{ch} #{chr} \"\n # this bombs if its a String and we check for include of a ch.\n if !k.is_a?( String ) && (k.include?( ch ) || k.include?(chr))\n $log.debug \"KKK: found match include #{ch} #{chr} \"\n #p.call(self, ch)\n #return 0\n blk = p\n break\n end\n elsif k.is_a? Regexp\n if k.match(chr)\n $log.debug \"KKK: found match regex #{ch} #{chr} \"\n #p.call(self, ch)\n #return 0\n blk = p\n break\n end\n end\n end\n end\n=end\n # blk either has a proc or is nil\n # we still need to check for a complex map. if none, then execute simple map.\n ret = check_composite_mapping(ch, window)\n $log.debug \" composite returned (#{ret}) for #{ch} \"\n if !ret\n return execute_mapping(blk, ch, object) if blk\n end\n return execute_mapping(ret, ch, object) if ret\n return :UNHANDLED\n end", "def onKeyUp(key, repeat, flags, view)\n if( key == CONSTRAIN_MODIFIER_KEY &&\n view.inference_locked? &&\n (Time.now - @shift_down_time) > 0.5 )\n view.lock_inference\n end\nend", "def merge_conflict?\n prefix == 'U'\n end", "def unmatched_keys; end", "def are_only_global?\n self.keys.size == 1 && self.keys[0] == '*'\n end", "def dispatch_conflict?\n dispatch_modifier? && active?\n end", "def keys_defined?(k,locally=false) ##old name defined? already existing -> bug in export \n @curenv=nil\n @curenv=@local if Envir.elt_defined?(@local,k)\n return(@curenv) if @curenv and locally!=:out\n if @local.include? :prev\n\tlocal=@local\n\tbegin\n\t local=local[:prev]\n\t @curenv=local if Envir.elt_defined?(local,k)\n\tend until @curenv or !(local[:prev])\n end\n return(@curenv) if @curenv\n @curenv=@global if Envir.elt_defined?(@global,k)\n ##print 'before-> ';p @curenv\n return(@curenv) if @curenv\n ## special treatment for export in mode :out\n if locally==:out\n @curenv=@global\n return nil #no element found but @curenv is fixed\n end\n @curenv=(locally ? @local : @global)\n ##print \"key_defined?\"+k+\"\\n\";p @curenv\n return nil\n end", "def on_keydown(key, view, active_ip, reference_ip = active_ip)\n if key == CONSTRAIN_MODIFIER_KEY\n try_lock_constraint(view, active_ip)\n else\n try_lock_axis(key, view, reference_ip)\n end\n end", "def ignore_method_conflicts=(_arg0); end", "def ORIG_process_key keycode, object, window\n return :UNHANDLED if @_key_map.nil?\n blk = @_key_map[keycode]\n $log.debug \"XXX: _process key keycode #{keycode} #{blk.class}, #{self.class} \"\n return :UNHANDLED if blk.nil?\n if blk.is_a? OrderedHash \n #Ncurses::nodelay(window.get_window, bf = false)\n # if you set nodelay in ncurses.rb then this will not\n # wait for second key press, so you then must either make it blocking\n # here, or set a wtimeout here.\n #\n # This is since i have removed timeout globally since resize was happeing\n # after a keypress. maybe we can revert to timeout and not worry about resize so much\n Ncurses::wtimeout(window.get_window, 500) # will wait a second on wgetch so we can get gg and qq\n ch = window.getch\n # we should not reset here, resetting should happen in getch itself so it is consistent\n #Ncurses::nowtimeout(window.get_window, true)\n\n $log.debug \" process_key: got #{keycode} , #{ch} \"\n # next line ignores function keys etc. C-x F1, thus commented 255 2012-01-11 \n if ch < 0 #|| ch > 255\n return nil\n end\n #yn = ch.chr\n blk1 = blk[ch]\n # FIXME we are only returning the second key, what if form\n # has mapped first and second combo. We should unget keycode and ch. 2011-12-23 \n # check this out first.\n window.ungetch(ch) if blk1.nil? # trying 2011-09-27 \n return :UNHANDLED if blk1.nil? # changed nil to unhandled 2011-09-27 \n $log.debug \" process_key: found block for #{keycode} , #{ch} \"\n blk = blk1\n end\n if blk.is_a? Symbol\n if respond_to? blk\n return send(blk, *@_key_args[keycode])\n else\n ## 2013-03-05 - 19:50 why the hell is there an alert here, nowhere else\n alert \"This ( #{self.class} ) does not respond to #{blk.to_s} [PROCESS-KEY]\"\n # added 2013-03-05 - 19:50 so called can know\n return :UNHANDLED \n end\n else\n $log.debug \"rwidget BLOCK called _process_key \" if $log.debug? \n return blk.call object, *@_key_args[keycode]\n end\n #0\n end", "def default_shortcuts\r\n {\r\n \"Ctrl+Shift+S\" => {\"description\"=>\"Displays Tr8n shortcuts\", \"script\"=>\"Tr8n.UI.Lightbox.show('/tr8n/help/lb_shortcuts', {width:400});\"},\r\n \"Ctrl+Shift+I\" => {\"description\"=>\"Turns on/off inline translations\", \"script\"=>\"Tr8n.UI.LanguageSelector.toggleInlineTranslations();\"},\r\n \"Ctrl+Shift+L\" => {\"description\"=>\"Shows/hides settings selector\", \"script\"=>\"Tr8n.UI.LanguageSelector.show(true);\"},\r\n \"Ctrl+Shift+N\" => {\"description\"=>\"Displays notifications\", \"script\"=>\"Tr8n.UI.Lightbox.show('/tr8n/translator/notifications/lb_notifications', {width:600});\"},\r\n \"Ctrl+Shift+K\" => {\"description\"=>\"Adds software keyboard for each entry field\", \"script\"=>\"Tr8n.Utils.toggleKeyboards();\"},\r\n \"Ctrl+Shift+C\" => {\"description\"=>\"Display current component status\", \"script\"=>\"Tr8n.UI.Lightbox.show('/tr8n/help/lb_source?source=' + Tr8n.source, {width:420});\"},\r\n \"Ctrl+Shift+T\" => {\"description\"=>\"Displays Tr8n statistics\", \"script\"=>\"Tr8n.UI.Lightbox.show('/tr8n/help/lb_stats', {width:420});\"},\r\n \"Ctrl+Shift+D\" => {\"description\"=>\"Debug Tr8n Proxy\", \"script\"=>\"Tr8n.SDK.Proxy.debug();\"},\r\n\r\n \"Alt+Shift+C\" => {\"description\"=>\"Displays Tr8n credits\", \"script\"=>\"window.location = Tr8n.host + '/tr8n/help/credits';\"},\r\n \"Alt+Shift+D\" => {\"description\"=>\"Opens dashboard\", \"script\"=>\"window.location = Tr8n.host + '/tr8n/translator/dashboard';\"},\r\n \"Alt+Shift+M\" => {\"description\"=>\"Opens sitemap\", \"script\"=>\"window.location = Tr8n.host + '/tr8n/app/sitemap';\"},\r\n \"Alt+Shift+P\" => {\"description\"=>\"Opens phrases\", \"script\"=>\"window.location = Tr8n.host + '/tr8n/app/phrases';\"},\r\n \"Alt+Shift+T\" => {\"description\"=>\"Opens translations\", \"script\"=>\"window.location = Tr8n.host + '/tr8n/app/translations';\"},\r\n \"Alt+Shift+A\" => {\"description\"=>\"Opens awards\", \"script\"=>\"window.location = Tr8n.host + '/tr8n/app/awards';\"},\r\n \"Alt+Shift+B\" => {\"description\"=>\"Opens message board\", \"script\"=>\"window.location = Tr8n.host + '/tr8n/app/forum';\"},\r\n \"Alt+Shift+G\" => {\"description\"=>\"Opens glossary\", \"script\"=>\"window.location = Tr8n.host + '/tr8n/app/glossary';\"},\r\n \"Alt+Shift+H\" => {\"description\"=>\"Opens help\", \"script\"=>\"window.location = Tr8n.host + '/tr8n/help';\"}\r\n }\r\n end", "def canBecomeKeyWindow\n true\n end", "def canBecomeKeyWindow\n true\n end", "def global?; end", "def rekey_as_needed; end", "def rl_bind_keyseq_if_unbound_in_map(keyseq, default_func, kmap)\r\n if (keyseq)\r\n func = rl_function_of_keyseq(keyseq, kmap, nil)\r\n if (func.nil? || func == :rl_vi_movement_mode)\r\n return (rl_bind_keyseq_in_map(keyseq, default_func, kmap))\r\n else\r\n return 1\r\n end\r\n end\r\n 0\r\n end", "def ignore_method_conflicts; end", "def system_preferences_conflict!\n spinner.update title: Pastel.new.yellow(\"#{good} (please quit System Preferences first)\")\n spinner.stop\n end", "def check_version_conflict(other) # :nodoc:\n return if self.version == other.version\n\n # This gem is already loaded. If the currently loaded gem is not in the\n # list of candidate gems, then we have a version conflict.\n\n msg = \"can't activate #{full_name}, already activated #{other.full_name}\"\n\n e = Gem::LoadError.new msg\n e.name = self.name\n\n raise e\n end", "def update\n super\n check_key_delete\n check_forced_close\n update_key_scan\n end", "def alternative_key_names\n @alternative_key_names ||= [[:alt, :menu, :altKey], [:alt_graph, :AltGraph], [:caps_lock, :CapsLock], [:ctrl, :control, :ctrlKey], \n [:Fn], [:fn_lock, :FnLock], [:Hyper], [:meta, :metaKey], [:num_lock, :NumLock], [:OS], \n [:scroll_lock, :ScrollLock], [:shift, :shiftKey], [:Super], [:Symbol], [:symbol_lock, :SymbolLock]]\n end", "def symbols_places_unlocked\n @known_places ||= MapConfig.default_place\n @known_places\n end", "def possible_keys(key); end", "def already_reported; end", "def already_reported; end", "def method_conflicts\n (@module.instance_methods + @module.private_instance_methods) &\n (Boson.main_object.methods + Boson.main_object.private_methods)\n end", "def key_defined?(named = name)\n keymap?(named) && keymap(named).key_defined?(key)\n end", "def activate_buffers_for_matching\n @triggers.keys.each do |pattern|\n debug \"checking #{@key_path} matches #{pattern}\"\n if JsonPath.matches?(@key_path, pattern) && !@active_buffers.keys.include?(pattern)\n debug \">> Activating buffer for #{pattern.inspect}\"\n @active_buffers[pattern] = ''\n end\n end\n end", "def exit_shortcut_not_found(name)\n puts \"Shortcut \\033[1m#{name}\\033[0m not found :(\"\n if Fast.shortcuts.any?\n puts \"Available shortcuts are: #{Fast.shortcuts.keys.join(', ')}.\"\n Fast.load_fast_files!\n end\n exit 1\n end", "def resident_key?; end", "def chrome_conflict!\n spinner.update title: Pastel.new.yellow(\"#{good} (please quit Chrome first)\")\n spinner.stop\n end", "def used_key?(key, strict = false)\n used_key_names(strict).include?(key)\n end", "def applicationDidFinishLaunching(notification)\n @hotkeys = HotKeys.new\n\n # Seriously for a second; For some reason a global hotkey or at least \n # the way I've got it to working blocks the keystroke. Which I guess is normal?\n #\n # Maybe I'll hack around that with system events for a bypass option, it wouldn't \n # be elegate, but this is new territory anywho\n #\n @hotkeys.addHotString(\"S+OPTION\") do\n puts \"PRESSED: S+OPTION\"\n end\n\n # Will only trigger if Safari is frontmost application, second option can be left blank\n # for a global shortcut\n @hotkeys.addHotString(\"S+OPTION\", :bundle_identifier => \"com.apple.Safari\") do\n puts \"PRESSED: S+OPTION IN SAFARI TOO\"\n end\n\nend", "def conflicts\n conflicts = {}\n self.runtime_dependencies.each do |dep|\n spec = Gem.loaded_specs[dep.name]\n if spec and not spec.satisfies_requirement? dep\n (conflicts[spec] ||= []) << dep\n end\n end\n env_req = Gem.env_requirement(name)\n (conflicts[self] ||= []) << env_req unless env_req.satisfied_by? version\n conflicts\n end", "def map_keys\n @mapped_keys = true\n require 'canis/core/include/listbindings'\n bindings\n=begin\n bind_key([?g,?g], 'goto_start'){ goto_start } # mapping double keys like vim\n bind_key(279, 'goto_start'){ goto_start }\n bind_keys([?G,277], 'goto end'){ goto_end }\n bind_keys([?k,KEY_UP], \"Up\"){ up }\n bind_keys([?j,KEY_DOWN], \"Down\"){ down }\n bind_key(?\\C-e, \"Scroll Window Down\"){ scroll_window_down }\n bind_key(?\\C-y, \"Scroll Window Up\"){ scroll_window_up }\n bind_keys([32,338, ?\\C-d], \"Scroll Forward\"){ scroll_forward }\n # adding CTRL_SPACE as back scroll 2014-04-14\n bind_keys([0,?\\C-b,339], \"Scroll Backward\"){ scroll_backward }\n # the next one invalidates the single-quote binding for bookmarks\n #bind_key([?',?']){ goto_last_position } # vim , goto last row position (not column)\n bind_key(?/, :ask_search)\n bind_key(?n, :find_more)\n bind_key([?\\C-x, ?>], :scroll_right)\n bind_key([?\\C-x, ?<], :scroll_left)\n bind_key(?\\M-l, :scroll_right)\n bind_key(?\\M-h, :scroll_left)\n bind_key(?L, :bottom_of_window)\n bind_key(?M, :middle_of_window)\n bind_key(?H, :top_of_window)\n bind_key(?w, :forward_word)\n bind_key(?b, :backward_word)\n bind_key(?l, :cursor_forward)\n bind_key(?h, :cursor_backward)\n bind_key(?$, :cursor_eol)\n bind_key(KEY_ENTER, :fire_action_event)\n=end\n end", "def canBecomeKeyWindow\n false\n end", "def global_key?\n key_defined?('_global_')\n end", "def alpha_mapping\n {# 1st line\n Q: '__{ KeyCode::Q, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n W: \"__{ KeyCode::KEY_5, #{shift_opt}, KeyCode::MINUS, #{shift_opt}, #{left} }__\", # []\n E: \"__{ KeyCode::KEY_5, KeyCode::MINUS, #{left} }__\", # ()\n R: \"__{ KeyCode::KEY_5, #{opt}, KeyCode::MINUS, #{opt}, #{left} }__\", # {}\n T: \"__{ KeyCode::BACKQUOTE, KeyCode::BACKQUOTE, #{shift}, #{left} }__\", # <>\n Y: \"__{ KeyCode::KEY_1, #{shift} }__\", # 1\n U: \"__{ KeyCode::CURSOR_LEFT, #{cmd} }__\", # left\n I: '__{ KeyCode::CURSOR_UP }__', # up\n O: \"__{ KeyCode::CURSOR_RIGHT, #{cmd} }__\", # right\n P: nil,\n\n # 2nd line\n A: '__{ KeyCode::A, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n S: '__{ KeyCode::S, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n D: '__{ KeyCode::D, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n F: \"__{ KeyCode::KEY_3, KeyCode::KEY_3, #{left} }__\", # \"\",\n G: \"__{ KeyCode::KEY_4, KeyCode::KEY_4, #{left} }__\", # '',\n H: '__{ KeyCode::RawValue::0x97 }__', # nil, # 0, # ----- # todo: <- NC #'__{ KeyCode::M }__',\n J: '__{ KeyCode::CURSOR_LEFT }__', # LEFT\n K: '__{ KeyCode::CURSOR_DOWN }__', # DOWN\n L: '__{ KeyCode::CURSOR_RIGHT }__', # RIGHT\n QUOTE: '__{ KeyCode::RawValue::0x98 }__', # todo: -> NC\n\n # 3rd line\n Z: '__{ KeyCode::Z, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n X: '__{ KeyCode::X, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n C: '__{ KeyCode::C, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n V: '__{ KeyCode::V, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n B: '__{ KeyCode::B, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n N: '__{ KeyCode::N, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n M: \"__{ KeyCode::CURSOR_LEFT, #{opt} }__\", # <- word\n COMMA: '__{ KeyCode::RawValue::0x96 }__', # down something\n DOT: \"__{ KeyCode::CURSOR_RIGHT, #{opt} }__\", # -> word\n # BACKQUOTE: 'BACKSLASH', Z: 'COMMA',\n\n KEY_2: \"__{ KeyCode::L, #{shift_opt}, KeyCode::L, #{shift_opt}, #{left} }__\", # ||\n KEY_3: \"__{ KeyCode::KEY_3, KeyCode::KEY_3, #{left} }__\", # '', # -----\n KEY_4: \"__{ KeyCode::KEY_4, KeyCode::KEY_4, #{left} }__\", # \"\", # -----\n KEY_5: \"__{ KeyCode::BACKSLASH, KeyCode::BACKSLASH, #{left} }__\", # ``,\n KEY_7: nil,\n KEY_8: '__{ KeyCode::RawValue::0x95 }__',\n KEY_9: nil\n }.with_indifferent_access\n end", "def _defensio_keys\n @_defensio_keys ||= DEFENSIO_KEYS.dup\n end", "def cannot_have_conflicts\n \terrors.add(:base, \"Conflicts with another reservation\") if self.has_conflicts?\n end", "def implausible_common_name; end", "def find_resident_session_conflict(resident_session)\n conflicting_resident_session = nil\n resident = resident_session.resident\n session = resident_session.session \n\n self.sessions.resident_sessions.all.each do |existing_resident_session|\n\n if existing_resident_session.resident.name == resident.name \n if existing_resident_session.session.overlaps? session\n #puts \" >>> found overlap...<<<\"\n conflicting_resident_session = existing_resident_session\n end\n \n #puts \">>> printing all conflicts after adding\"\n #puts all_conflicts\n #puts \"<<<\"\n end\n end\n \n conflicting_resident_session\n end", "def raise_if_conflicts # :nodoc:\n if has_conflicts?\n raise Gem::ConflictError.new self, conflicts\n end\n end", "def known_invalid_idref(mapkey, oldid)\n\treturn false;\n\t# \treturn ( ((mapkey==:version or mapkey==:fixfor) and oldid==21907 or oldid==21881 or oldid==21743) or\n\t# \t\t\t(mapkey==:version and (oldid==21240 or oldid==21743)) or \n\t# \t\t\t(mapkey==:issuestatus and (oldid==2 or oldid==-3)) or\n\t# \t\t\t(mapkey==:resolution and oldid==6)\n\t# \t )\nend", "def conflicts *syms\n syms.each { |sym| raise ArgumentError, \"unknown option '#{sym}'\" unless @specs[sym] }\n @constraints << [:conflicts, syms]\n end", "def command_found; end", "def used?; end", "def conflict?(placement)\n placement_dots(placement).any? { |d| taken_dots.include?(d) }\n end", "def require_master_key=(_arg0); end", "def require_master_key=(_arg0); end", "def init_accelerators\n @window.signal_connect \"key_press_event\" do |widget, event|\n ctrl = Gdk::Window::ModifierType::CONTROL_MASK == event.state\n g = Gdk::Keyval\n k = Gdk::Keyval.to_lower(event.keyval)\n\n # Nerd Shortcuts\n # This is used to provide an alternative to the arrow keys for\n # selecting an answer. It allows correcting more easily because\n # you don't need to move your hand while hitting enter. Great\n # for when eating pizza (or watching porn). It's located at:\n # QWERTZ: üöä#\n # QWERTY: [;'\\\n # NEO2DE: ßdy\\\n h = event.hardware_keycode\n\n # UNDO\n undo if(ctrl && k == g::GDK_z) || k == g::GDK_BackSpace\n\n # QUESTIONS UP/DOWN\n select_prev_question if(ctrl && k == g::GDK_Up) || k == g::GDK_Page_Up\n select_next_question if(ctrl && k == g::GDK_Down) || k == g::GDK_Page_Down\n\n # ANSWERS\n select_prev_answer if event.keyval == Gdk::Keyval::GDK_Left || h == 47\n select_next_answer if event.keyval == Gdk::Keyval::GDK_Right || h == 51\n\n # Go 5 answers down or up (especially useful for selecting tutors)\n select_prev_answer(5) if event.keyval == Gdk::Keyval::GDK_Up || h == 34\n select_next_answer(5) if event.keyval == Gdk::Keyval::GDK_Down || h == 48\n\n # FAILED QUESTION\n find_failed_question if(k == g::GDK_3270_Enter || k == g::GDK_ISO_Enter)\n find_failed_question if(k == g::GDK_KP_Enter || k == g::GDK_Return)\n\n # QUIT\n quit_application if ctrl && k == g::GDK_q\n\n @window.signal_emit_stop('key_press_event')\n end\n end", "def keyboard_block_auto_correct\n return @keyboard_block_auto_correct\n end", "def ask_hint deflt=nil\n f = nil\n key = get_char\n return deflt if key == 'ENTER'\n\n ix = get_index(key, @vps)\n f = @viewport[ix] if ix\n f\nend", "def onKeyUp(key, repeat, flags, view)\n if( key == CONSTRAIN_MODIFIER_KEY &&\n view.inference_locked? &&\n (Time.now - @shift_down_time) > 0.5 )\n view.lock_inference\n end\n end", "def setup_reserved_common_event\r\n if $game_temp.common_event_reserved?\r\n setup($game_temp.reserved_common_event.list)\r\n $game_temp.clear_common_event\r\n true\r\n else\r\n false\r\n end\r\n end", "def map_keys\n return if @keys_mapped\n bind_key(KEY_F1, 'help') { hm = help_manager(); hm.display_help }\n bind_keys([?\\M-?,?\\?], 'show field help') { \n #if get_current_field.help_text \n #textdialog(get_current_field.help_text, 'title' => 'Help Text', :bgcolor => 'green', :color => :white) \n #else\n print_key_bindings\n #end\n }\n bind_key(FFI::NCurses::KEY_F9, \"Print keys\", :print_key_bindings) # show bindings, tentative on F9\n bind_key(?\\M-:, 'show menu') {\n fld = get_current_field\n am = fld.action_manager()\n #fld.init_menu\n am.show_actions\n }\n @keys_mapped = true\n end", "def placebo?; false end", "def is_replacement_order\n end", "def auto_recover\n self.redeclare unless predefined?\n end", "def onKeyDown(key, repeat, flags, view)\n if( key == CONSTRAIN_MODIFIER_KEY && repeat == 1 )\n @shift_down_time = Time.now\n \n # if we already have an inference lock, then unlock it\n if( view.inference_locked? )\n # calling lock_inference with no arguments actually unlocks\n view.lock_inference\n elsif( @state == 0 && @ip1.valid? )\n view.lock_inference @ip1\n elsif( @state == 1 && @ip2.valid? )\n view.lock_inference @ip2, @ip1\n end\n end\nend", "def apple\n #`setxkbmap -model applealu_ansi -option \"\" -option grp:shift_caps_toggle -option altwin:swap_alt_win`\n `setxkbmap -model applealu_ansi -option \"\" -option \"grp:shift_caps_toggle\" -option \"altwin:swap_alt_win\"`\nend", "def do_target_vm_map\r\n (vm = self[:vm]) && vm.map_foorth_exclusive(@symbol)\r\n end", "def key?(p0) end", "def global?; true end", "def key_manager; end", "def valid_attack_pair_callback(previous_answer=nil)\n ->(text) do\n text =~ /([a-z]*)_([a-z]*)/\n base_name = $2\n style_name = $1\n if previous_answer\n previous_answer =~ /([a-z]*)_([a-z]*)/\n return false if $2 == base_name || $1 == style_name\n end\n return false if (style_name == \"specialaction\") && !@special_action_available\n bases.map(&:name).include?(base_name) && styles.map(&:name).include?(style_name)\n end\n end", "def conflict(val)\n conflicts << val\n conflicts.dup\n end", "def conflict(val)\n conflicts << val\n conflicts.dup\n end", "def key?(*) end", "def missing_keys; end", "def common_event_reserved?\n !@reserved_common_events.empty?\n end", "def resolve_friendly_id_conflict(candidates)\n candidates.first\n end", "def rekey_as_needed\n return if algorithms.pending?\n socket.if_needs_rekey? { rekey! }\n end", "def update_conflicts(amt=1)\r\n\r\n # for ease\r\n pos = [@mapx, @mapy]\r\n\r\n # left to right\r\n i = 0\r\n j = @mapy\r\n loop do\r\n # stop if border reached\r\n if i == @board.w+1\r\n break\r\n end\r\n if i != @mapx\r\n @board.at(i,j).hit(amt)\r\n end\r\n i += 1\r\n end\r\n\r\n # top to bottom\r\n i = @mapx\r\n j = 0\r\n loop do\r\n # stop if border reached\r\n if j == @board.h+1\r\n break\r\n end\r\n if j != @mapy\r\n @board.at(i,j).hit(amt)\r\n end\r\n j += 1\r\n end\r\n\r\n # negative diagonal\r\n # (start from topleft)\r\n max = pos.max\r\n min = pos.min\r\n dif = max - min\r\n\r\n if @mapx == max\r\n dx = dif\r\n dy = 0\r\n else\r\n dx = 0\r\n dy = dif\r\n end\r\n\r\n # top -> bottom\r\n # left -> right\r\n i = dx\r\n j = dy\r\n loop do\r\n # stop if border reached\r\n if i == @board.w+1 || j == @board.h+1\r\n break\r\n end\r\n if i != @mapx && j != @mapy\r\n @board.at(i,j).hit(amt)\r\n end\r\n i += 1\r\n j += 1\r\n end\r\n\r\n # positive diagonal\r\n # (start from bottomleft)\r\n ht = @board.h\r\n y = ht - @mapy\r\n x = @mapx\r\n max = [x,y].max\r\n min = [x,y].min\r\n dif = max - min\r\n\r\n if x == max\r\n dx = dif\r\n dy = ht\r\n else\r\n dx = 0\r\n dy = ht - dif\r\n end\r\n\r\n # bottom -> top\r\n # left -> right\r\n i = dx\r\n j = dy\r\n loop do\r\n # stop if border reached\r\n if i == @board.w+1 || j < 0\r\n break\r\n end\r\n if i != @mapx && j != @mapy\r\n @board.at(i,j).hit(amt)\r\n end\r\n i += 1\r\n j -= 1\r\n end\r\n\r\n end", "def check_for_label_conflict(r, label)\n msg_id = 0\n arg2 = nil\n if (!(@grammar.get_global_scope(label.get_text)).nil?)\n msg_id = ErrorManager::MSG_SYMBOL_CONFLICTS_WITH_GLOBAL_SCOPE\n else\n if (!(@grammar.get_rule(label.get_text)).nil?)\n msg_id = ErrorManager::MSG_LABEL_CONFLICTS_WITH_RULE\n else\n if (!(@grammar.get_token_type(label.get_text)).equal?(Label::INVALID))\n msg_id = ErrorManager::MSG_LABEL_CONFLICTS_WITH_TOKEN\n else\n if (!(r.attr_rule_scope).nil? && !(r.attr_rule_scope.get_attribute(label.get_text)).nil?)\n msg_id = ErrorManager::MSG_LABEL_CONFLICTS_WITH_RULE_SCOPE_ATTRIBUTE\n arg2 = r.attr_name\n else\n if ((!(r.attr_return_scope).nil? && !(r.attr_return_scope.get_attribute(label.get_text)).nil?) || (!(r.attr_parameter_scope).nil? && !(r.attr_parameter_scope.get_attribute(label.get_text)).nil?))\n msg_id = ErrorManager::MSG_LABEL_CONFLICTS_WITH_RULE_ARG_RETVAL\n arg2 = r.attr_name\n end\n end\n end\n end\n end\n if (!(msg_id).equal?(0))\n ErrorManager.grammar_error(msg_id, @grammar, label, label.get_text, arg2)\n end\n end", "def test_mapping_is_exhaustive\n unsupported = [:bytes, :limit_definition, :log_level, :weighted_values, :int_range]\n\n supported = PrefabProto::ConfigValue.descriptor.entries.reject do |entry|\n unsupported.include?(entry.name.to_sym)\n end.map(&:number)\n\n mapped = Prefab::ContextShape::MAPPING.values.uniq\n\n unless mapped == supported\n raise \"ContextShape MAPPING needs update: #{mapped} != #{supported}\"\n end\n end" ]
[ "0.6656321", "0.6267235", "0.6137481", "0.59569526", "0.59454536", "0.59100956", "0.581545", "0.5722955", "0.5722955", "0.5701576", "0.56724006", "0.5560017", "0.5552768", "0.5528456", "0.54792887", "0.5445249", "0.5445249", "0.5414225", "0.5395847", "0.53220344", "0.5292858", "0.5282521", "0.52792877", "0.52759254", "0.527319", "0.5268906", "0.5266445", "0.5240375", "0.52372277", "0.52294725", "0.5195433", "0.51709634", "0.51698923", "0.5161499", "0.5156736", "0.51453596", "0.5145288", "0.5145288", "0.5144889", "0.5132896", "0.5132491", "0.5115372", "0.5114294", "0.5097962", "0.508516", "0.50685936", "0.50647175", "0.5057284", "0.5049525", "0.5049525", "0.5039232", "0.50231206", "0.5017978", "0.49970186", "0.49938712", "0.49920338", "0.49897566", "0.4987802", "0.498673", "0.49605444", "0.49589533", "0.49503902", "0.49362537", "0.4921068", "0.49187887", "0.49163368", "0.4887806", "0.48846805", "0.48795825", "0.48759276", "0.48726848", "0.48694602", "0.48582432", "0.4857426", "0.4857426", "0.4852796", "0.4851501", "0.4846873", "0.48444352", "0.48326102", "0.48324275", "0.4826265", "0.4813533", "0.48126608", "0.48110992", "0.48077616", "0.48023912", "0.47999975", "0.4794334", "0.47911513", "0.47835448", "0.4778428", "0.4778428", "0.47730604", "0.47711933", "0.47705066", "0.4766864", "0.47494027", "0.47470987", "0.4745423", "0.47384894" ]
0.0
-1
FIXME: this is a Hash, whereas member_json returns a string. Given json, these should probably return the same datatype; so I'm betting we're not doing this right
def failure_json { errors: 'Sorry you are not eligible for WellMatch' } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json_data\n members = self.members.map do |member|\n member.group_json_data(self.id)\n end\n { group: self, members: members, member_split: self.member_split.round(2), total_spend: self.expenses_total.round(2)}\n end", "def hash\n members.hash\n end", "def member_to_hash(member)\n {\n :name => member[:name].get_str,\n :type => NWRFCLib::RFC_TYPE[member[:type]],\n :nucLength => member[:nucLength],\n :ucLength => member[:ucLength],\n :decimals => member[:decimals],\n :typeDescHandle => member[:typeDescHandle]\n }\n end", "def json_fields\n\n mappings = {}\n\n json = self.record.json\n return mappings unless json\n\n lang_materials = json['lang_materials']\n if lang_materials\n mappings['language'] = lang_materials\n .select { |lm| lm['language_and_script'].present? and lm['language_and_script']['language'].present?}\n .map{ |lm| lm['language_and_script']['language'] }\n .flatten\n .join(\";\")\n end\n\n language = json['language']\n if language\n mappings['language'] = language\n end\n\n\n notes = json['notes']\n if notes\n mappings['physical_location_note'] = notes\n .select { |note| note['type'] == 'physloc' and note['content'].present? and note['publish'] == true }\n .map { |note| note['content'] }\n .flatten\n .join(\"; \")\n\n mappings['accessrestrict'] = notes\n .select { |note| note['type'] == 'accessrestrict' and note['subnotes'] }\n .map { |note| note['subnotes'] }\n .flatten\n .select { |subnote| subnote['content'].present? and subnote['publish'] == true}\n .map { |subnote| subnote['content'] }\n .flatten\n .join(\"; \")\n end\n\n if json['dates']\n json['dates']\n .select { |date| date['expression'].present? }\n .group_by { |date| date['label'] }\n .each { |label, dates|\n mappings[\"#{label}_date\"] = dates\n .map { |date| date['expression'] }\n .join(\"; \")\n }\n end\n\n\n if json['linked_agents']\n mappings['creators'] = json['linked_agents']\n .select { |l| l['role'] == 'creator' and l['_resolved'] }\n .map { |l| l['_resolved']['names'] }.flatten\n .select { |n| n['is_display_name'] == true}\n .map { |n| n['sort_name']}\n .join(\"; \")\n end\n\n if json['rights_statements']\n mappings['rights_type'] = json['rights_statements'].map{ |r| r['rights_type']}.uniq.join(';')\n end\n\n digital_instances = json['instances'].select { |instance| instance['instance_type'] == 'digital_object'}\n if (digital_instances.any?)\n mappings[\"digital_objects\"] = digital_instances.map{|d| d['digital_object']['ref']}.join(';')\n end\n\n mappings['restrictions_apply'] = json['restrictions_apply']\n mappings['display_string'] = json['display_string']\n\n instances = self.container_instances\n return mappings unless instances\n\n mappings['requests'] = instances\n .each_with_index\n .map { |instance, i|\n request = {}\n \n instance_count = i + 1\n\n request['Request'] = \"#{instance_count}\"\n\n request[\"instance_is_representative_#{instance_count}\"] = instance['is_representative']\n request[\"instance_last_modified_by_#{instance_count}\"] = instance['last_modified_by']\n request[\"instance_instance_type_#{instance_count}\"] = instance['instance_type']\n request[\"instance_created_by_#{instance_count}\"] = instance['created_by']\n\n container = instance['sub_container']\n return request unless container\n\n request[\"instance_container_grandchild_indicator_#{instance_count}\"] = container['indicator_3']\n request[\"instance_container_child_indicator_#{instance_count}\"] = container['indicator_2']\n request[\"instance_container_grandchild_type_#{instance_count}\"] = container['type_3']\n request[\"instance_container_child_type_#{instance_count}\"] = container['type_2']\n request[\"instance_container_last_modified_by_#{instance_count}\"] = container['last_modified_by']\n request[\"instance_container_created_by_#{instance_count}\"] = container['created_by']\n\n top_container = container['top_container']\n return request unless top_container\n\n request[\"instance_top_container_ref_#{instance_count}\"] = top_container['ref']\n\n top_container_resolved = top_container['_resolved']\n return request unless top_container_resolved\n\n request[\"instance_top_container_long_display_string_#{instance_count}\"] = top_container_resolved['long_display_string']\n request[\"instance_top_container_last_modified_by_#{instance_count}\"] = top_container_resolved['last_modified_by']\n request[\"instance_top_container_display_string_#{instance_count}\"] = top_container_resolved['display_string']\n request[\"instance_top_container_restricted_#{instance_count}\"] = top_container_resolved['restricted']\n request[\"instance_top_container_created_by_#{instance_count}\"] = top_container_resolved['created_by']\n request[\"instance_top_container_indicator_#{instance_count}\"] = top_container_resolved['indicator']\n request[\"instance_top_container_barcode_#{instance_count}\"] = top_container_resolved['barcode']\n request[\"instance_top_container_type_#{instance_count}\"] = top_container_resolved['type']\n request[\"instance_top_container_uri_#{instance_count}\"] = top_container_resolved['uri']\n\n if (top_container_resolved['container_locations'])\n request[\"instance_top_container_location_note_#{instance_count}\"] = top_container_resolved['container_locations'].map{ |l| l['note']}.join{';'}\n end\n\n request[\"requestable_#{instance_count}\"] = (top_container_resolved['active_restrictions'] || [])\n .map{ |ar| ar['local_access_restriction_type'] }\n .flatten.uniq\n .select{ |ar| (self.repo_settings[:hide_button_for_access_restriction_types] || []).include?(ar)}\n .empty?\n\n locations = top_container_resolved[\"container_locations\"]\n if locations.any?\n location_id = locations.sort_by { |l| l[\"start_date\"]}.last()[\"ref\"]\n location = archivesspace.get_location(location_id)\n request[\"instance_top_container_location_#{instance_count}\"] = location['title']\n request[\"instance_top_container_location_id_#{instance_count}\"] = location_id\n request[\"instance_top_container_location_building_#{instance_count}\"] = location['building']\n end\n\n collection = top_container_resolved['collection']\n if collection\n request[\"instance_top_container_collection_identifier_#{instance_count}\"] = collection\n .select { |c| c['identifier'].present? }\n .map { |c| c['identifier'] }\n .join(\"; \")\n\n request[\"instance_top_container_collection_display_string_#{instance_count}\"] = collection\n .select { |c| c['display_string'].present? }\n .map { |c| c['display_string'] }\n .join(\"; \")\n end\n\n series = top_container_resolved['series']\n if series\n request[\"instance_top_container_series_identifier_#{instance_count}\"] = series\n .select { |s| s['identifier'].present? }\n .map { |s| s['identifier'] }\n .join(\"; \")\n\n request[\"instance_top_container_series_display_string_#{instance_count}\"] = series\n .select { |s| s['display_string'].present? }\n .map { |s| s['display_string'] }\n .join(\"; \")\n\n end\n\n request\n }\n\n mappings\n end", "def member_metadata(member_name)\n # TODO: Cache metadata definitions; will it be quicker than making a hash of metadata for a given member each time?\n member = member_name.to_s.upcase\n if self.class == NWRFC::FunctionCall\n fpar = NWRFCLib::RFCFuncParam.new\n rc = NWRFCLib.get_parameter_desc_by_name(@desc, member.cU, fpar.to_ptr, @error.to_ptr)\n NWRFC.check_error(@error) if rc > 0\n member_to_hash(fpar)\n elsif self.class == NWRFC::Table || self.class == NWRFC::Structure\n fd = NWRFCLib::RFCFieldDesc.new\n rc = NWRFCLib.get_field_desc_by_name(@desc, member.cU, fd.to_ptr, @error.to_ptr)\n NWRFC.check_error(@error) if rc > 0\n member_to_hash(fd)\n end\n end", "def add_member_data(lb, member)\n begin\n obj = JSON.parse(lb.member_data_for(member[:handle]))\n obj.each { |key, value| member[key] = value }\n rescue\n # fail silently if no data exists\n end\n member\nend", "def members_get_info(members:, trace: false)\n members_json = []\n members.each do |m|\n if m['team_member_id'] != nil\n members_json << \"{\\\".tag\\\":\\\"team_member_id\\\",\\\"team_member_id\\\":\\\"#{m['team_member_id']}\\\"}\"\n elsif m['external_id'] != nil\n members_json << \"{\\\".tag\\\":\\\"external_id\\\",\\\"external_id\\\":\\\"#{m['external_id']}\\\"}\"\n elsif m['email'] != nil\n members_json << \"{\\\".tag\\\":\\\"email\\\",\\\"email\\\":\\\"#{m['email']}\\\"}\"\n end\n end\n dropbox_query(query: '2/team/members/get_info', query_data: \"{\\\"members\\\":[#{members_json.join(',')}]}\", trace: trace)\n end", "def profile\n render_json 0,\"ok\",current_member.as_profile\n end", "def json_field\n @opts.fetch(:json, @name.to_s)\n end", "def guild_member_format\n {\n mute: @mute,\n deaf: @deaf,\n joined_at: Ldash.format_time(@joined_at),\n user: @user.compact,\n roles: @roles.map(&:id).map(&:to_s)\n }\n end", "def get_member_brief_stats(custid)\n res = $client.get(\"/membersite/member/CareerStats.do?custid=#{custid}\", $headers)\n start = res.body.index('buf = \\'{\"memberSince\"') + 7\n length = res.body.index(\"MemberProfile.driver = extractJSON\") - 3 - start\n data = res.body[start, length]\n JSON.parse data\nend", "def json_data\n { id: self.id, membership_id: self.membership_id, amount: self.amount.round(2), paid_by: self.user.full_name, description: self.description, vendor: self.vendor, group_id: self.group.id }\n end", "def generate_json\n members = []\n @rs.members.each do |member|\n machine = @machine.env.machine(member[:host], @machine.provider_name)\n copy = member.dup\n copy[:host] = get_ip_address(machine)\n members << copy\n end\n\n { :_id => @rs.name, :members => members }.to_json\n end", "def json_fields\n\n mappings = {}\n\n json = self.record.json\n if !json\n return mappings\n end\n\n mappings['language'] = json['language']\n\n if json['notes']\n json['notes'].each do |note|\n if note['type'] == 'physloc' and !note['content'].blank?\n mappings['physical_location_note'] = note['content'].map { |cont| \"#{cont}\" }.join(\"; \")\n end\n end\n end\n\n if json['dates']\n json['dates']\n .select { |date| date['expression'].present? }\n .group_by { |date| date['label'] }\n .each { |label, dates|\n mappings[\"#{label}_date\"] = dates\n .map { |date| date['expression'] }\n .join(\"; \")\n }\n end\n\n mappings['restrictions_apply'] = json['restrictions_apply']\n mappings['display_string'] = json['display_string']\n\n instances = json.fetch('instances', false)\n if !instances\n return mappings\n end\n\n mappings['requests'] = instances\n .select{ |instance| !instance['digital_object'] }\n .each_with_index\n .map { |instance, i|\n request = {}\n\n instance_count = i + 1\n\n request['Request'] = \"#{instance_count}\"\n\n request[\"instance_is_representative_#{instance_count}\"] = instance['is_representative']\n request[\"instance_last_modified_by_#{instance_count}\"] = instance['last_modified_by']\n request[\"instance_instance_type_#{instance_count}\"] = instance['instance_type']\n request[\"instance_created_by_#{instance_count}\"] = instance['created_by']\n\n container = instance['sub_container']\n if container\n request[\"instance_container_grandchild_indicator_#{instance_count}\"] = container['indicator_3']\n request[\"instance_container_child_indicator_#{instance_count}\"] = container['indicator_2']\n request[\"instance_container_grandchild_type_#{instance_count}\"] = container['type_3']\n request[\"instance_container_child_type_#{instance_count}\"] = container['type_2']\n\n request[\"instance_container_last_modified_by_#{instance_count}\"] = container['last_modified_by']\n request[\"instance_container_created_by_#{instance_count}\"] = container['created_by']\n\n top_container = container['top_container']\n if top_container\n request[\"instance_top_container_ref_#{instance_count}\"] = top_container['ref']\n\n top_container_resolved = top_container['_resolved']\n if top_container_resolved\n request[\"instance_top_container_long_display_string_#{instance_count}\"] = top_container_resolved['long_display_string']\n request[\"instance_top_container_last_modified_by_#{instance_count}\"] = top_container_resolved['last_modified_by']\n request[\"instance_top_container_display_string_#{instance_count}\"] = top_container_resolved['display_string']\n request[\"instance_top_container_restricted_#{instance_count}\"] = top_container_resolved['restricted']\n request[\"instance_top_container_created_by_#{instance_count}\"] = top_container_resolved['created_by']\n request[\"instance_top_container_indicator_#{instance_count}\"] = top_container_resolved['indicator']\n request[\"instance_top_container_barcode_#{instance_count}\"] = top_container_resolved['barcode']\n request[\"instance_top_container_type_#{instance_count}\"] = top_container_resolved['type']\n request[\"instance_top_container_uri_#{instance_count}\"] = top_container_resolved['uri']\n\n collection = top_container_resolved['collection']\n if collection\n request[\"instance_top_container_collection_identifier_#{instance_count}\"] = collection\n .select { |c| c['identifier'].present? }\n .map { |c| c['identifier'] }\n .join(\"; \")\n\n request[\"instance_top_container_collection_display_string_#{instance_count}\"] = collection\n .select { |c| c['display_string'].present? }\n .map { |c| c['display_string'] }\n .join(\"; \")\n end\n\n series = top_container_resolved['series']\n if series\n request[\"instance_top_container_series_identifier_#{instance_count}\"] = series\n .select { |s| s['identifier'].present? }\n .map { |s| s['identifier'] }\n .join(\"; \")\n\n request[\"instance_top_container_series_display_string_#{instance_count}\"] = series\n .select { |s| s['display_string'].present? }\n .map { |s| s['display_string'] }\n .join(\"; \")\n end\n\n end\n end\n end\n\n request\n }\n\n return mappings\n end", "def apply_json_trait(value); end", "def parse\n (type, subtype) = parse_object([@name], JSON.parse(@json))\n (subtype || type).to_s.gsub(/\\n\\n$/, \"\\n\")\n end", "def hash_for_json(*_arg0); end", "def json\n @obj.get_json_regex\n end", "def include_meta(json)\n json\n end", "def members_get_info_v2(members:, trace: false)\n members_array = []\n members.each do |h|\n (tag, key) = h.to_a[0]\n case tag\n when 'team_member_id', 'email', 'external_id'\n members_array << { '.tag' => tag, \"#{tag}\" => \"#{key}\" }\n else\n raise 'members_get_info_v2() Only team_member_id, email or external_id can be used as indexes'\n end\n end\n dropbox_query(query: '2/team/members/get_info_v2', query_data: { 'members' => members_array }, trace: trace)\n end", "def member_names; end", "def members_in_subreddit(subreddit, member_type)\n subreddit_name = extract_string(subreddit, :display_name)\n response = get(\"r/#{subreddit_name}/about/#{member_type}.json\", nil)\n\n members = response[:body][:data][:children]\n members.collect { |member| OpenStruct.new(member) }\n end", "def json\n value.sub(/^serialized-/, '')\n end", "def json_value(name, type)\n type, optional = check_type(type)\n\n if type == \"bytes\"\n #return \"NSData()/*TODO: Fixme*/\"\n end\n\n cast = json_cast(type, optional)\n value = if cast\n \"json[\\\"#{name}\\\"]#{cast}\"\n else\n \"#{type}.fromJSON(json[\\\"#{name}\\\"])\"\n end\n\n if @enums.include?(type)\n value = \"#{type}(rawValue: #{value})!\"\n end\n\n if type.kind_of?(Hash) && type[\"type\"] == \"array\"\n value = \"#{model_name(type[\"items\"])}.fromJSONArray(#{value})\"\n end\n\n value\nend", "def inspect\n members.map {|m| m.inspect}.join(\" \")\n end", "def get_members\n @user = User.find_by(user_params)\n @members = @user.members\n \n if not @members.nil?\n render json: @members\n else \n render json: \"\"\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @member }\n end\n end", "def json\n @json_hash.to_json\n end", "def members; end", "def members; end", "def members; end", "def members; end", "def members; end", "def members; end", "def members; end", "def as_json_type9\n as_json({\n only: [\n :id,\n :key,\n :name,\n :permit_tag_list,\n :name_input_at,\n ],\n include: {\n emotions: Actb::Emotion.json_type13,\n },\n methods: [\n :avatar_path,\n :rating,\n :skill_key,\n :description,\n :twitter_key,\n :actb_created_after_days,\n :session_lock_token,\n ],\n })\n end", "def get_pokemon_JSON\n r = \n {\n :p1 => JSON.parse(self.pokeserver(self.p1)), \n :p2 => JSON.parse(self.pokeserver(self.p2)), \n :p3 => JSON.parse(self.pokeserver(self.p3)), \n :p4 => JSON.parse(self.pokeserver(self.p4)), \n :p5 => JSON.parse(self.pokeserver(self.p5)), \n :p6 => JSON.parse(self.pokeserver(self.p6)) \n }\n \n JSON.generate(r)\n end", "def user_data_is_json_hash settings, debug=false\n user_data_hash = settings[:user_data]\n puts \"*****\\n\\n#{JSON.pretty_generate(user_data_hash)}\\n**********\\n\" if debug\n user_data user_data_hash.to_json\nend", "def type_of(member)\n self::MEMBERS_HASH[member].type\n end", "def to_ary\n load_members\n @members\n end", "def members_with_types\n @members_with_types ||= MEMBERS_TYPES\n end", "def member_attributes\n {\n created_by: member.created_by || current_user,\n access_level: access_level,\n expires_at: args[:expires_at]\n }\n end", "def method_missing(m, *args, &block)\n method_name = m.to_s\n if json && json.has_key?(method_name)\n return json[method_name]\n end\n super(m, *args, &block)\n end", "def the_json_field(field_key, default_val = '')\n r = JSON.parse(object.get_field(field_key, default_val) || '{}').with_indifferent_access\n r.keys.each do |k|\n r[k] = h.do_shortcode(r[k].to_s.translate(@_deco_locale), object)\n end\n r\n end", "def test_get_member_basic_success\n\n client = create_mock_client\n refute_nil client, \"Client object couldn't be created.\"\n\n stub_request(:get, mock_uri('Groups', '17', 'Members', '15'))\n .to_return(status: 200, body: { 'Success' => true,\n 'Message' => \"Operation succeeded\",\n 'ApiId' => API_ID,\n 'Member' => { 'Id' => 15,\n 'Name' => 'someone',\n 'Number' => '91XXXXXXXXXX' } }.to_json)\n\n status, member = client.group.get_member(17, 15)\n refute_nil status, \"No status object returned.\"\n assert status.success, \"Status did not indicate success: \" + status.message.to_s\n refute_nil member, \"No member item returned.\"\n assert_equal 15, member.id, \"ID is not correct.\"\n assert_equal 'someone', member.name, \"Name is not correct.\"\n assert_equal '91XXXXXXXXXX', member.number, \"Number is not correct.\"\n\n end", "def members\n return nil unless MEMBERS_EVENT.include?(type)\n @members ||= begin\n payload.each_line.map do |line|\n name, address, _, tags_str = line.chomp.split(/\\t/)\n {name: name, address: address, tags: parse_tags(tags_str || '')}\n end\n end\n end", "def json_serialize\n end", "def family_data_formatted(member, options={:show_private=>false, :include_contacts=>true})\n formatted = {}\n wife = member.wife\n emails = []\n member_name = member.last_name_first(:short=>true, :middle=>false)\n wife_name = wife ? \" & #{wife.short}\" : ''\n formatted[:couple]= member_name + wife_name\n if member.in_country \n away_string = ''\n else\n away_string = \"*\"\n away_string << \" (#{t(:return)} ~ #{member.arrival_date})\" if \n (member.arrival_date && member.arrival_date >= Date.today)\n end\n formatted[:couple_w_status] = member_name + wife_name + away_string\n return formatted unless options[:include_contacts]\n emails[0] = member.email_1 || '---'\n if wife # if there IS a wife\n emails[1] = wife.email_1 if wife.email_1 &&\n wife.email_1 != member.email_1\n end\n # Add a second phone & email if they exist and only one has been used already\n emails[1] = member.email_2 if member.email_2 && emails.length < 2\n formatted[:phones] = phone_string_couple(member)\n formatted[:emails] = emails\n return formatted\n end", "def json_ld; end", "def format_data\n formatted_data = nil\n unless @raw_data.class == Hash # Webmock hack\n case options.format.to_sym\n when :json\n formatted_data = JSON.parse(@raw_data, symbolize_names: true)\n when :xml\n formatted_data = MultiXml.parse(@raw_data)['userinfo']\n end\n end\n\n formatted_data\n end", "def json_format\n object.to_json(\n only: [:id, :title, :key_information, :description],\n methods: [:photo_url, :net_mrp, :mrp_per_unit],\n :include => {\n store: {\n only: [:name, :id],\n methods: [:full_address, :logo_url, :store_rating, :store_distance]\n }\n }\n )\n end", "def members\n @spec['members']\n end", "def for_json\n# time = Time.strptime(post.time, '%Y%m%d%H%M%S').strftime('%H:%M:%S')\n# ua_or_login = post.info[0..20]\n# class_display = 'ua'\n#\n# if post.login != ''\n# ua_or_login = post.login\n# class_display = 'login'\n# end\n# re = Regexp.new(\"(?<=\\s|^|>|#)(?:(?:([0-2]?[0-9])\\:([0-5][0-9])\\:([0-5][0-9])|([0-2]?[0-9])([0-5][0-9])([0-5][0-9]))(?:[\\:\\^]([0-9]{1,2})|([¹²³]))?)|([0-2]?[0-9])\\:([0-5][0-9])(?=\\s|$|<)\")\n# totoz = Regexp.new(\"\\\\\\[:([0-9a-zA-Z \\*\\$@'_-]+)\\\\\\]\")\n# message = post.message.gsub(re) {|s|\n# \"<span class='horloge_ref'>#{s}</span>\"\n# }\n# message.gsub!(totoz) {|s|\n# \"<span class='totoz'>#{s}</span>\"\n# }\n# message.gsub!(/:([a-z0-9\\+\\-_]+):/) {|m|\n# if Emoji.names.include?($1)\n# \"<img height='20' src='\" + asset_path(\"#{1}.png\") + \"' style='vertical-align:middle' width='20' />\"\n# else\n# m\n# end\n#\n#\n# }\n#\n# display = post.login.presence || post.info\n# %>\n#{\n# \"id\": <%=post.p_id%>,\n# \"time\":\"<%=time%>\",\n# \"info\":<%=raw post.info.to_json%>,\n# \"class_display\":\"<%=class_display%>\",\n# \"ua_or_login\":<%=raw ua_or_login.to_json%>,\n# \"message\":<%=raw message.to_json%>,\n# \"rules\": \"<%=post.rules%>\"\n#}\n end", "def load_raw_json(json_data)\n temp = Hashie::Mash.new(MultiJson.load(json_data))\n @structure = temp.structure ? temp.structure : Hashie::Mash.new\n @measure_instances = temp.measure_instances ? temp.measure_instances : Hashie::Mash.new\n # these could be set in the file\n @analysis_id = temp.structure.analysis_id if temp.structure.analysis_id\n @user_defined_id = temp.structure.user_defined_id if temp.structure.user_defined_id\n\n return true\n end", "def inspect\n members.map {|m| m.inspect}.join(\", \")\n end", "def inspect\n members.map {|m| m.inspect}.join(\", \")\n end", "def inspect\n members.map {|m| m.inspect}.join(\", \")\n end", "def json\n @hash ||= ::JSON.parse(data)\n end", "def all_names\n @json_data['family_members'].collect { |user| user['name'] }\n end", "def json\n @@id += 1\n \"{\" +\n \"\\\"type\\\": \\\"#{@type}\\\", \\\"id\\\": \\\"A#{@@id}\\\", \\\"value\\\": \\\"#{@value}\\\", \" +\n \"\\\"offset\\\": #{@offset}, \\\"length\\\": #{@length}\" +\n \"}\"\n end", "def members(*) end", "def render_json\n end", "def members\n response = service.get_members\n response.map do |member_data|\n Member.new(member_data)\n end\n end", "def raw_members\n @raw_members ||= members_table.xpath('.//tr[td]').map { |tr| data = fragment(tr => MemberRow).to_h }\n end", "def type\n @json['type']\n end", "def get_member_of_list(user, list, member_id)\n get(\"/#{user}/#{list}/members/#{member_id}.json\")\n end", "def variables\n super.transform_values do |details|\n if details['type'] == 'Json'\n JSON.parse(details['value'])\n else\n details['value']\n end\n end\n end", "def api_attributes\n {\n :id => id.to_s,\n :type => self.class.name.underscore.downcase,\n :user => user.api_attributes,\n :member_type => member_type.api_attributes,\n :first_name => first_name,\n :last_name => last_name,\n }\n end", "def to_json_sub\n to_json_struct.to_json\n end", "def in_json\n {\n bio: {\n originatingSourceSystem: SOURCE_SYSTEM,\n permissionType: @permission_type,\n permissionValue: @permission_value,\n sourceDate: @source_date,\n sourceSystemUser: @source_system_user,\n permissionId: @id,\n vet360Id: @vet360_id,\n effectiveStartDate: @effective_start_date,\n effectiveEndDate: @effective_end_date\n }\n }.to_json\n end", "def get_field_deserializers()\n return super.merge({\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"members\" => lambda {|n| @members = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::DirectoryObject.create_from_discriminator_value(pn) }) },\n \"roleTemplateId\" => lambda {|n| @role_template_id = n.get_string_value() },\n \"scopedMembers\" => lambda {|n| @scoped_members = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ScopedRoleMembership.create_from_discriminator_value(pn) }) },\n })\n end", "def members\n @members\n end", "def members\n @members\n end", "def to_json_raw_object()\n #This is a stub, used for indexing\n end", "def json_reflect\n @content_type = 'text/plain'\n @render_nothing = true\n @rendered_template = true\n @current_layout = nil\n h = {}\n params.each do |x,y|\n h[x]=y\n end\n write_json h\n end", "def member_objects\n members.collect do |member|\n obj = case member.type\n when :node, 'node' then @db.get_node(member.ref)\n when :way, 'way' then @db.get_way(member.ref)\n when :relation, 'relation' then @db.get_relation(member.ref)\n end\n raise OSMLib::Error::NotFoundError.new(\"not in database: #{member.type} #{member.ref}\") unless obj\n obj\n end\n end", "def json_data\n json_format = params[:json_format] or 'default'\n case json_format\n when 'basic'\n collection.map {|p| {'id' => p.id, 'name' => p.name}}.to_json\n else\n collection.to_json()\n end\n end", "def member\n Member.find(@member.name)\n end", "def json_field(json, field)\n return nil unless json\n fields = field.split('/')\n fields.each do |field|\n if json.is_a?(Array)\n json = json[field.to_i]\n else\n json = json[field]\n end\n return nil unless json\n end\n json\n end", "def member_status\n output = riak_admin 'member_status'\n result = {}\n if $?.success?\n output.each_line do |line|\n next if line =~ /^(?:[=-]|Status)+/ # Skip the pretty headers\n if line =~ %r{^Valid:(\\d+) / Leaving:(\\d+) / Exiting:(\\d+) / Joining:(\\d+) / Down:(\\d+)}\n result.merge!(:valid => $1.to_i,\n :leaving => $2.to_i,\n :exiting => $3.to_i,\n :joining => $4.to_i,\n :down => $5.to_i)\n else\n result[:members] ||= {}\n status, ring, pending, node = line.split(/\\s+/)\n node = $1 if node =~ /^'(.*)'$/\n ring = $1.to_f if ring =~ /(\\d+\\.\\d+)%/\n result[:members][node] = {\n :status => status,\n :ring => ring,\n :pending => (pending == '--') ? 0 : pending.to_i\n }\n end\n end\n end\n result\n end", "def fields\n preview_json['fields']\n end", "def getActualJsonObject()\n return $jsonObjectMain\nend", "def as_basic_json(time = nil)\n _b = anonymous_time_verification\n self.anonymous_time_verification = time if time\n res = as_json(only: [:id, :email, :phone_number, :first_name, :last_name, :mention_key, :sex, :full_name, :avatar_url])\n self.anonymous_time_verification = _b\n res\n end", "def as_json\n attributes\n end", "def as_json\n attributes\n end", "def convert_members(friends)\n if new_record?\n members_as_venmoid = Array.new\n names = members.split(', ')\n names.reject! { |n| n.empty? }\n names.each do |n|\n friends.each do |f|\n if f['display_name'] == n\n members_as_venmoid << f['id']\n break\n end\n end\n end\n self.members = members_as_venmoid.to_json\n return true\n else\n return false\n end\n end", "def parse_profile_data_json(profile_string)\n profile_hash_org = MultiJson.decode(profile_string)['profile-list']['researcher-profile']\n profile_hash = {\n :firstname => profile_hash_org['first-name'],\n :lastname => profile_hash_org['last-name'],\n }\n puts \"Final hash with profile data from JSON\"\n pp profile_hash\n return profile_hash\n end", "def jde_buyer_invoice_hashes_array\n jde_invoice_hashes_array('member')\n end", "def json_data\n json_format = params[:json_format] or 'default'\n case json_format\n when 'basic'\n collection.map { |v| { 'id' => v.product.id, 'name' => v.product.name }}.uniq { |i| i['id'] }.to_json\n when 'autocomplete'\n collection.map { |v| {\n :data => {\n :id => v.id,\n :product_id => v.product.id,\n :name => v.fullname,\n :sku => v.sku,\n :count_on_hand => v.count_on_hand,\n :image_url => (v.images.count > 0 ? v.images.first.attachment.url(:mini) : nil)\n },\n :value => v.fullname,\n :result => v.fullname\n }\n }.to_json\n else\n collection.to_json(:include => {:variants => {:include => {:option_values => {:include => :option_type},\n :images => {:only => [:id], :methods => :mini_url}}},\n :images => {:only => [:id], :methods => :mini_url}, :master => {}})\n end\n end", "def person_type\n \"Member\"\n end", "def team_members_for_output\n members = team_memberships.map do |tm|\n profile = tm.person_profile.published_version\n next unless profile.present?\n {\n title: profile.content_item.title,\n url_path: profile.content_item.url_path,\n role_holder_name: profile.role_holder_name,\n summary: profile.content_item.summary,\n role_holder_photo_url: profile.role_holder_photo_url,\n role_holder_photo_alt_text: profile.role_holder_photo_alt_text,\n role_holder_photo_caption: profile.role_holder_photo_caption,\n member_order: tm.member_order\n }\n end\n members.compact!\n\n # Split up the members who have or do not have an order for separate sorting later\n members_without_order = []\n members_with_order = []\n members.each do |member|\n if member[:member_order].nil?\n members_without_order << member\n else\n members_with_order << member\n end\n end\n\n # Sort the team members who have a specified order by order, then name\n members_with_order.sort_by! { |m| [m[:member_order], m[:role_holder_name]] }\n # Sort the team members who do not have a specified order by name only\n members_without_order.sort_by! { |m| m[:role_holder_name] }\n\n # List the ordered ones first, then ones without an order\n members_with_order + members_without_order\n end", "def members\n\t\t\[email protected]\n\t\tend", "def member_info(member_path, options={})\n raise NotImplementedError\n end", "def store_fields(json=true)\n data = @data.map do |data|\n type = parse_store_renderer(data[\"renderer\"])\n hash = { :name => data[\"dataIndex\"] , :mapping => data[\"mapping\"] }\n hash.merge!(type) if type\n hash\n end\n json ? JSON.pretty_generate(data) : data\n end", "def show\n team = Team.find(params[:id])\n image_url = team.image.url\n members = team.members.select(:name, :surname)\n member_names = []\n members.each do |m|\n member_names.push(m.name + \" \" + m.surname)\n end\n team = team.attributes\n\n team[:members] = member_names\n team[:image] = image_url\n render json: team\n end", "def getJsonValue(key)\n return $jsonObjectMain[key]\nend", "def json_data\n json_format = params[:json_format] || 'default'\n case json_format\n when 'basic'\n collection.map { |u| { 'id' => u.id, 'name' => u.email } }.to_json\n else\n address_fields = [:firstname, :lastname, :address1, :address2, :city, :zipcode, :phone, :state_name, :state_id, :country_id]\n includes = { only: address_fields, include: { state: { only: :name }, country: { only: :name } } }\n\n collection.to_json(only: [:id, :email], include:\n { bill_address: includes, ship_address: includes })\n end\n end", "def inspect\n \"#<#{self.class}:0x#{object_id.to_s(16)}> JSON: \" +\n JSON.pretty_generate(@data)\n end", "def to_h\n obj = { 'id' => @id, 'name' => @name, 'manager' => @manager.id, 'squads' => @member_squads.map(&:id).sort }\n unless @member_exceptions.empty?\n obj['exceptions'] = @member_exceptions.map(&:id).sort\n end\n unless @metadata.empty?\n obj['metadata'] = @metadata\n end\n\n obj\n end", "def in_json\n {\n bio: {\n addressId: @id,\n addressLine1: @address_line1,\n addressLine2: @address_line2,\n addressLine3: @address_line3,\n addressPOU: @address_pou,\n addressType: @address_type,\n cityName: @city,\n countryCodeISO2: @country_code_iso2,\n countryCodeISO3: @country_code_iso3,\n countryName: @country_name,\n county: {\n countyCode: @county_code,\n countyName: @county_name\n },\n intPostalCode: @international_postal_code,\n provinceName: @province,\n stateCode: @state_code,\n zipCode4: @zip_code,\n zipCode5: @zip_code_suffix,\n originatingSourceSystem: SOURCE_SYSTEM,\n sourceSystemUser: @source_system_user,\n sourceDate: @source_date,\n vet360Id: @vet360_id,\n effectiveStartDate: @effective_start_date,\n effectiveEndDate: @effective_end_date\n }\n }.to_json\n end", "def get_field_deserializers()\n return {\n \"guestsCount\" => lambda {|n| @guests_count = n.get_number_value() },\n \"membersCount\" => lambda {|n| @members_count = n.get_number_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"ownersCount\" => lambda {|n| @owners_count = n.get_number_value() },\n }\n end" ]
[ "0.6231882", "0.61340785", "0.5943855", "0.59309256", "0.5885714", "0.58704954", "0.58562696", "0.58170664", "0.5812353", "0.5727779", "0.5680383", "0.5658426", "0.5610169", "0.5598211", "0.5563802", "0.5462433", "0.54433686", "0.54297924", "0.54235786", "0.53837883", "0.53678346", "0.5355929", "0.5346678", "0.5328291", "0.5326433", "0.5322311", "0.53065187", "0.528576", "0.5284241", "0.5284241", "0.5284241", "0.5284241", "0.5284241", "0.5284241", "0.5284241", "0.5261335", "0.52605927", "0.5249137", "0.52447546", "0.52360344", "0.5233947", "0.5222132", "0.5208064", "0.52060676", "0.5205744", "0.5197832", "0.5179537", "0.51785165", "0.51779205", "0.51710457", "0.51522094", "0.5152099", "0.51472235", "0.51345235", "0.5125718", "0.5125718", "0.5125718", "0.5118953", "0.51153016", "0.51085716", "0.50959265", "0.5088752", "0.50822437", "0.50771326", "0.5049363", "0.5046222", "0.5032583", "0.50318223", "0.50243074", "0.5021527", "0.50176567", "0.50158846", "0.50158846", "0.5015652", "0.50134164", "0.5007477", "0.5003216", "0.5002844", "0.5001977", "0.50014085", "0.49903047", "0.49884084", "0.4985526", "0.49843472", "0.49843472", "0.49841395", "0.497969", "0.49772897", "0.49720767", "0.4965532", "0.49616805", "0.49599513", "0.49430463", "0.49414825", "0.49368298", "0.49360585", "0.49343365", "0.49341914", "0.4931727", "0.49268174", "0.49255309" ]
0.0
-1
GET /userinfos/1 GET /userinfos/1.xml
def show @userinfo = Userinfo.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @userinfo } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def users_get_info_response_xml\n <<-XML\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <users_getInfo_response xmlns=\"\" xmlns:xsi=\"\" xsi:schemaLocation=\"\" list=\"true\">\n\t<user>\n\t <uid>kangtk</uid>\n\t <nickname>康泰克</nickname>\n\t <facebig>http://userface3.51.com/ce/25/kangtk_130.gif?v=20071208033821</facebig>\n\t <sex>1</sex>\n\t <vip>3</vip>\n\t <isconfirm>1</isconfirm>\n\t</user>\n </users_getInfo_response>\n XML\n end", "def show\n @user = nil\n id_or_name = params[:id]\n begin\n @user = User.find(id_or_name)\n rescue\n @user = User.find_by_name(id_or_name)\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml {\n xml = Builder::XmlMarkup.new(:indent => 2)\n xml.instruct! directive_tag=:xml, :encoding=> 'utf-8'\n render :xml => xml.user {|u|\n u.id(@user.id)\n u.name(@user.name)\n u.statuses {|ss|\n @user.statuses.each {|stat|\n ss.status {|s|\n s.id(stat.id)\n s.user_id(stat.user_id)\n s.text(stat.text)\n s.geo_tag(stat.geo_tag)\n s.created_at(stat.created_at)\n }\n }\n }\n }\n }\n end\n end", "def show\n @user = User.find(params[:id])\n render :xml => @user\n rescue\n render :nothing => true, :status => :not_found\n end", "def get_info(user_name)\n uri = create_api_uri(@@base_uri, user_name, 'getInfo')\n return get(uri)\n end", "def me\n users(request(\"users/authenticate.xml\", :auth => true))\n end", "def show\n @user = User.find(params[:id])\n usr = prepare_user(@user);\n respond_to do |format|\n format.xml { render :xml => usr.to_xml }\n end\n end", "def show\n @user = User.find(params[:id])\n @title = @user.username\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user.to_xml(:except => [:password_digest, :remember_token])}\n end\n end", "def show\n @user = User.find(params[:id])\n render :xml => @user.to_xml(:except => [ :password ])\n end", "def show \n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n respond_to do |format|\n format.html\n format.xml { render :xml => @user }\n end\n end", "def user_data_xml\n run_url = 'http://nikerunning.nike.com/nikeplus/v1/services/widget/get_public_user_data.jsp?userID='\n run_url += @id.to_s\n open(run_url)\n end", "def show\n @user = V1::User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def get_info\r\n return @infoxml unless @infoxml.nil?\r\n \r\n response = Net::Flickr.instance().request('flickr.people.getInfo', 'user_id' => @id)\r\n \r\n return @infoxml = response.at('person')\r\n end", "def append_user_info(username, xml); end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @user }\n end\n end", "def info()\n _params = {}\n return @master.call 'users/info', _params\n end", "def info\n\t@user = User.find(params[:id])\n end", "def show\n @user_name = UserName.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user_name }\n end\n end", "def show\n @user_detail = UserDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user_detail }\n end\n end", "def show\n @user_detail = UserDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user_detail }\n end\n end", "def get_user_info(list)\n\trequire 'net/http'\n\tNet::HTTP.get(ENV[\"VERITAS-USER-SERVER\"] + \"/users?user_ids=#{list}\")\nend", "def show\n @user_datum = UserDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user_datum }\n end\n end", "def list_users(api_object)\r\n puts \"Current Users:\"\r\n doc = Nokogiri::XML.parse api_object.read\r\n names = doc.xpath('users').collect {|e| e.text }\r\n puts names.join(\", \")\r\n puts \"\"\r\nend", "def show\n @site_user_info = SiteUserInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @site_user_info }\n end\n end", "def get_user_info\n get(\"/api/v1/oauth_user_info.json\")\n end", "def index\n @users = LinkedData::Client::Models::User.all\n respond_to do |format|\n format.html\n format.xml { render xml: @users.to_xml }\n end\n end", "def show\n\t\t@user = User.find(params[:id])\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml\t{ render :xml => @user }\n\t\tend\n\tend", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @user.to_xml }\n end\n end", "def show\n @user = User.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def append_user_info(username, xml)\n end", "def index\n @users = User.all\n render :xml => @users\n end", "def show\n @usr = Usr.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @usr }\n end\n end", "def show\n @users = User.find(params[:id])\n if @users\n respond_to do |format|\n format.json { render :json => @users }\n format.xml { render :xml => @users }\n end\n else\n head :not_found\n end\n end", "def show\n @utilisateur = Utilisateur.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @utilisateur }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @user.to_xml }\r\n end\r\n end", "def show\n @user = User.find(params[:id])\n @page_title = '用户基本信息'\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def index\n @user_infos = UserInfo.all\n end", "def index\n @user_infos = UserInfo.all\n end", "def show\n @user = @current_user\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @user }\n end\n end", "def show\n #@user = User.find_by_id(params[:id]) \n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def info()\n get(:session, {:method => \"user.getInfo\"})\n end", "def show\n @user = @person.user\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @user.to_xml }\n end\n end", "def show\n @user = User.find_by_id(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id]) or raise ActiveRecord::RecordNotFound\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @user.to_xml }\n end\n end", "def show\n\t\t@user = User.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml { render :xml => @user }\n\t\tend\n\tend", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\nend", "def show\n\t\t@the_user = User.find(params[:id])\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml { render :xml => @the_user }\n\t\tend\n\tend", "def show\n @user = User.first(:id => params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n respond_to do |format|\n format.html\n format.xml { render :xml => @user }\n format.json { render :json => @user }\n end\n\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @users }\n end\n end", "def show\n \n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @user }\n end\n end", "def index\n @title = \"All users\"\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users.to_xml(:except => [:password_digest, :remember_token])}\n end\n end" ]
[ "0.7011156", "0.68958706", "0.6836286", "0.68173355", "0.67957693", "0.6785852", "0.66955936", "0.66265553", "0.66068935", "0.65898204", "0.658483", "0.6583918", "0.6582853", "0.65776205", "0.65661854", "0.6561844", "0.6560396", "0.6560124", "0.6552189", "0.6552189", "0.6548261", "0.65425193", "0.6540894", "0.6537469", "0.6522275", "0.6522014", "0.65118957", "0.6509069", "0.6494857", "0.64853805", "0.64850444", "0.64750963", "0.6473555", "0.6459541", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6459335", "0.6438976", "0.6438976", "0.6438976", "0.6437707", "0.64363784", "0.6428297", "0.64281124", "0.64281124", "0.64259833", "0.6406044", "0.6395454", "0.6386268", "0.6385274", "0.6383755", "0.6357784", "0.6351519", "0.63455725", "0.63371956", "0.6334493", "0.63334996", "0.6333315", "0.62948054" ]
0.72638065
0
GET /userinfos/new GET /userinfos/new.xml
def new @userinfo = Userinfo.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @userinfo } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @user = User.new\n\n respond_to do |format|\n format.xml { render xml: @user}\n end\n end", "def new\n logger.debug(\"Create a new user\")\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n get_list\n respond_to do |format|\n format.html # new.html.haml\n format.xml { render :xml => @user }\n end\n end", "def new\n\tputs \"\\n\\t\\t in new\\n\"\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @user }\n end\n end", "def new\n @user = User.new\n render :xml => @user\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new \n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n logger.info 'huyen anh'\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @usr = Usr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @usr }\n end\n end", "def new\n @user = User.new()\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n respond_to do |format|\n format.html\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n respond_to do |format|\n format.html\n format.xml { render :xml => @user }\n end\n end", "def new\n @user_name = UserName.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_name }\n end\n end", "def new\n @user = V1::User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @site_user_info = SiteUserInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site_user_info }\n end\n end", "def new\n @user = User.new\n respond_to do |format|\n\tformat.html # new.html.erb\n\tformat.xml { render :xml => @user }\n end\nend", "def new\n @info = Info.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @info }\n end\n end", "def new\n @info = Info.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @info }\n end\n end", "def new\n # When a http GET request to '/users/new' is received, have it render:\n # a view file with an empty form to create a new user.\n end", "def new\n\t\t@user = User.new\n\t\t@addresses = Address.all\n\t\t@address = Address.new\n\t\t\n\t\twidok = 'new'\n\t\twidok = 'user_new' if !(admin_logged_in?)\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html { render widok } # new.html.erb\n\t\t\tformat.xml\t{ render :xml => @user }\n\t\tend\n\tend", "def new\n @user_detail = UserDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_detail }\n end\n end", "def new\n @user = User.new\n @title = \"Signup to Studyers\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def create\n @userinfo = Userinfo.new(params[:userinfo])\n\n respond_to do |format|\n if @userinfo.save\n flash[:notice] = 'Userinfo was successfully created.'\n format.html { redirect_to(@userinfo) }\n format.xml { render :xml => @userinfo, :status => :created, :location => @userinfo }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @userinfo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @user_addon = UserAddon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_addon }\n end\n end", "def new\n @user = User.new\n @page_title = '创建新用户'\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @utilisateur = Utilisateur.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @utilisateur }\n end\n end", "def new\n @latestinfo = Latestinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @latestinfo }\n end\n end", "def new\n @personal_info = PersonalInfo.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @personal_info }\n end\n end", "def new\n @nickname = Nickname.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nickname }\n end\n end", "def new\n @user = User.new\n @title = \"Sign Up\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @users = User.find(:all)\n @invoice = Invoice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invoice }\n end\n end", "def new\n @usuario = Usuario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @usuario }\n end\n end", "def new\n @users_hacktag = UsersHacktag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @users_hacktag }\n end\n end", "def new\n @user = User.new\n @users = @firm.users.all\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html { render :layout=>false}\n format.xml { render :xml => @user }\n end\n end", "def new\n respond_to do |format|\n format.json { render :json => @user } \n format.xml { render :xml => @user }\n format.html\n end\n end", "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @online_retailer_user }\n end\n end", "def new\n @user = User.new :step => '1'\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @usuario = Usuario.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @usuario }\n end\n end", "def new\n @user = User.new\n\n #respond_to do |format|\n # format.html # new.html.erb\n # format.xml { render :xml => @user }\n # end\n end", "def new\n @newuser = Newuser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newuser }\n end\n end", "def new\n @usuario = Usuario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @Usuario }\n end\n end", "def new\n @user_template = UserTemplate.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_template }\n end\n end", "def new\n @user = User.new\n @user.stats = Stats.new\n @stats = @user.stats\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @user }\n end\n end", "def new\n @usernew = Usernew.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usernew }\n end\n end", "def new\n @user_follow = UserFollow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_follow }\n end\n end", "def new\n @user_twin = UserTwin.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_twin }\n end\n end" ]
[ "0.7399565", "0.7383971", "0.7353943", "0.7320244", "0.7307075", "0.7248093", "0.7205856", "0.7205856", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71816397", "0.71601367", "0.71378464", "0.71378464", "0.71378464", "0.71378464", "0.71378464", "0.7130458", "0.7126185", "0.7118483", "0.7113003", "0.7109182", "0.7106307", "0.71038556", "0.707868", "0.6998762", "0.6988019", "0.6988019", "0.695786", "0.6957821", "0.6952951", "0.6940309", "0.69211525", "0.69139326", "0.68987066", "0.68759704", "0.68493176", "0.6840928", "0.68258244", "0.6820913", "0.682081", "0.6820778", "0.6813441", "0.6812217", "0.68071", "0.68000984", "0.6789869", "0.6781035", "0.67797124", "0.67590886", "0.67548686", "0.675431", "0.6747062", "0.67296535", "0.67082685", "0.67044294", "0.6699157" ]
0.774022
0
POST /userinfos POST /userinfos.xml
def create @userinfo = Userinfo.new(params[:userinfo]) respond_to do |format| if @userinfo.save flash[:notice] = 'Userinfo was successfully created.' format.html { redirect_to(@userinfo) } format.xml { render :xml => @userinfo, :status => :created, :location => @userinfo } else format.html { render :action => "new" } format.xml { render :xml => @userinfo.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append_user_info(username, xml); end", "def append_user_info(username, xml)\n end", "def create\n @user_info = UserInfo.new(user_info_params)\n\n respond_to do |format|\n if @user_info.save\n format.html { redirect_to @user_info, notice: 'User info was successfully created.' }\n format.json { render action: 'show', status: :created, location: @user_info }\n else\n format.html { render action: 'new' }\n format.json { render json: @user_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @userinfo = Userinfo.new(userinfo_params)\n print \"called create\"\n respond_to do |format|\n if @userinfo.save\n format.html { redirect_to @userinfo, notice: 'Userinfo was successfully created.' }\n format.json { render :show, status: :created, location: @userinfo }\n else\n format.html { render :new }\n format.json { render json: @userinfo.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @userinfo = Userinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @userinfo }\n end\n end", "def build_user_details(xml, options)\n xml.User{\n xml.Name(@options[:user])\n xml.Password(@options[:password])\n xml.ClientId(@options[:clientId], :DataType => \"S32\")\n }\n end", "def users_get_info_response_xml\n <<-XML\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <users_getInfo_response xmlns=\"\" xmlns:xsi=\"\" xsi:schemaLocation=\"\" list=\"true\">\n\t<user>\n\t <uid>kangtk</uid>\n\t <nickname>康泰克</nickname>\n\t <facebig>http://userface3.51.com/ce/25/kangtk_130.gif?v=20071208033821</facebig>\n\t <sex>1</sex>\n\t <vip>3</vip>\n\t <isconfirm>1</isconfirm>\n\t</user>\n </users_getInfo_response>\n XML\n end", "def create\n @user_infom = UserInfom.new(user_infom_params)\n\n respond_to do |format|\n if @user_infom.save\n format.html { redirect_to @user_infom, notice: 'User infom was successfully created.' }\n format.json { render :show, status: :created, location: @user_infom }\n else\n format.html { render :new }\n format.json { render json: @user_infom.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.xml { render xml: @user}\n end\n end", "def parseUserData(doc, params)\n \n real_name = (doc.find_first('//xmpp2rest/user/real_name')) ? doc.find_first('//xmpp2rest/user/real_name').content : nil\n password = (doc.find_first('//xmpp2rest/user/password')) ? doc.find_first('//xmpp2rest/user/password').content : nil\n \n if not real_name or not password\n raise Exception.new(\"Missing elements data for creating new user!\")\n end \n \n params.merge!({:real_name => real_name})\n params.merge!({:password => password})\n \n return params\n end", "def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end", "def user_data_xml\n run_url = 'http://nikerunning.nike.com/nikeplus/v1/services/widget/get_public_user_data.jsp?userID='\n run_url += @id.to_s\n open(run_url)\n end", "def user_information_params\n params[:user_information]\n end", "def create\n @site_user_info = SiteUserInfo.new(params[:site_user_info])\n\n respond_to do |format|\n if @site_user_info.save\n format.html { redirect_to(@site_user_info, :notice => 'Site user info was successfully created.') }\n format.xml { render :xml => @site_user_info, :status => :created, :location => @site_user_info }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @site_user_info.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <name>#{name}</name>\r\n <age>#{age}</age>\r\n </person>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n response.body \r\n end", "def create\n @user_tasks_info = UserTasksInfo.new(user_tasks_info_params)\n\n respond_to do |format|\n if @user_tasks_info.save\n format.html { redirect_to @user_tasks_info, notice: 'User tasks info was successfully created.' }\n format.json { render :show, status: :created, location: @user_tasks_info }\n else\n format.html { render :new }\n format.json { render json: @user_tasks_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @user = User.new\n render :xml => @user\n end", "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.json { render json: @user }\n format.xml { render xml: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n format.xml { render xml: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user = User.new(@user_info)\n if user.save && user.errors.empty?\n render json: { status: 200, data: UserSerializer.new(user).as_json }\n else\n render json: { status: 400, error: user.errors.full_messages }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @user }\n end\n end", "def new\n @site_user_info = SiteUserInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site_user_info }\n end\n end", "def user_info(user_oauth_token)\n api_post(@user_info_url, user_oauth_token)\n end", "def create\n @user = User.new(params[:user])\n get_list\n\n respond_to do |format|\n if @user.save\n flash[:notice] = \"User #{@user.fname} #{@user.lname} was successfully created.\"\n format.html { redirect_to(:action => :index) }\n format.xml { head :ok }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def user_infom_params\n params.require(:user_infom).permit(:name, :address, :phone_number, :email)\n end", "def create\n @user = User.new(user_params)\n @user.remote_ip = request.remote_ip\n\n response = Apis.get_imsi_ecgi(request.remote_ip)\nlogger.error '### ' + response.code.to_s\n \tif response.code != 200\n\t\tredirect_to new_user_path, notice: '해당 사용자가 등록되어 있지 않습니다.'\n\telse \n\t\txml_parser = Nori.new\n\n\t\tresult = xml_parser.parse(response.body)\n\t\[email protected] = result['BODY']['IMSI']\n\t\[email protected] = result['BODY']['ECGI']\n\t\t\n\t\trespond_to do |format|\n\t\t\t\tif @user.save\n\t\t\t\t\tsign_in(@user)\n\t\t\t\t\tformat.html { redirect_to setting_path, notice: '가입을 축하합니다' }\n\t\t\t\t\tformat.json { render action: 'show', status: :created, location: @user }\n\t\t\t\telse\n\t\t\t\t\tformat.html { render action: 'new' }\n\t\t\t\t\tformat.json { render json: @user.errors, status: :unprocessable_entity }\n\t\t\t\tend\n\t\tend\n\tend\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to(users_url, :notice => \"User #{@user.name} was successfully created.\") }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def user_information\n { \"username\": @user.username, \"email\": @user.email, \"id\": @user.id }\n end", "def create\n user = current_user\n @personal_info = user.create_personal_info(params[:personal_info])\n\n respond_to do |format|\n if @personal_info.save\n format.html { redirect_to user_path, notice: 'Personal info was successfully created.' }\n format.json { render json: @personal_info, status: :created, location: @personal_info }\n else\n format.html { render action: \"new\" }\n format.json { render json: @personal_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_detail = UserDetail.new(params[:user_detail])\n\n respond_to do |format|\n if @user_detail.save\n flash[:notice] = 'UserDetail was successfully created.'\n format.html { redirect_to(@user_detail) }\n format.xml { render :xml => @user_detail, :status => :created, :location => @user_detail }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user_detail.errors, :status => :unprocessable_entity }\n end\n end\n end", "def postUser( email, user_id, first_name, last_name, active, trust, creation_date, user_type, social_network, social_network_id, reseller_admin_masheryid, group_id, admin_upgrader)\n params = Hash.new\n params['email'] = email\n params['user_id'] = user_id\n params['first_name'] = first_name\n params['last_name'] = last_name\n params['active'] = active\n params['trust'] = trust\n params['creation_date'] = creation_date\n params['user_type'] = user_type\n params['social_network'] = social_network\n params['social_network_id'] = social_network_id\n params['reseller_admin_masheryid'] = reseller_admin_masheryid\n params['group_id'] = group_id\n params['admin_upgrader'] = admin_upgrader\n return doCurl(\"post\",\"/user\",params)\n end", "def add_user(name, value)\n self.class.post(\"/users/#{name}\",\n body: value,\n headers: {\n 'Content-Type' => 'application/json; charset=UTF-8',\n Connection: 'keep-alive',\n Accept: 'application/json, text/plain, */*'\n })\n end", "def new\n logger.debug(\"Create a new user\")\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n flash[:notice] = 'User was successfully created.'\n format.html { redirect_to(:root) }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\", :layout=>false }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def CreateUser params = {}\n \n APICall(path: 'users.json',method: 'POST',payload: params.to_json)\n \n end", "def new\n @user = User.new\n @title = \"Signup to Studyers\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def create\n @user_datum = UserDatum.new(params[:user_datum])\n @user_datum.data_type_id = params[:user_datum][:data_type_id]\n @user_datum.user = current_user\n @user_datum.verified = false\n\n respond_to do |format|\n if @user_datum.save\n format.html { redirect_to(user_data_url) }\n format.xml { render :xml => @user_datum, :status => :created, :location => @user_datum }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user_datum.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\t\tparams.permit!\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to(users_url,\n :notice => \"User #{@user.name} was successfully created.\") }\n format.xml { render :xml => @user,\n :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = V1::User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n flash[:notice] = 'V1::User was successfully created.'\n format.html { redirect_to(@user) }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def user_info_params\n params.require(:user_info).permit(:user_id, :name, :tel, :address,:province,:city,:county,:is_default)\n end", "def create\n @personal_info = current_user.create_personal_info(params[:personal_info])\n\n respond_to do |format|\n if @personal_info.save\n format.html { redirect_to user_path(current_user), notice: 'Personal info was successfully created.' }\n format.json { render json: @personal_info, status: :created, location: @personal_info }\n else\n format.html { render action: \"new\" }\n format.json { render json: @personal_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to(:users, :notice => 'User was successfully created.') }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def openid_connect_userInfo(options = {})\n post('openid.connect.userInfo', options)\n end", "def create\n doc = Nokogiri::XML(request.body.read)\n bNode = doc.xpath('elwak/benutzer')\n\n @benutzer = Benutzer.new(benutzer_params(bNode))\n if @benutzer.save\n if bNode.xpath('objekt_zuordnungs').length > 0\n objekt_ids = bNode.xpath('objekt_zuordnungs/objekt_id').map{|oz| oz.text.to_s.to_i}\n @benutzer.setze_objekt_zuordnungen(objekt_ids)\n end\n success(@benutzer.id)\n else\n error(@benutzer.errors)\n end\n end", "def new\n @user = User.new\n logger.info 'huyen anh'\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def create\n @user = User.new(params[:user])\n respond_to do |format|\n if @user.save\n format.html { render :json => {:success => true} }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :json => ( (@user.errors.full_messages.join(\".<br />\").to_s + \".\").to_json ) } unless @user.errors.empty?\n format.html { render :json => {:success => false} }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def user_info\n response = from_server \"api/user.json\"\n response.data\n end", "def create_user(params:)\n parse(JSON.parse(connection.post(\"users\", params.to_json).body))\n end", "def create\n @user = User.new(params[:user])\n puts params[:user]\n respond_to do |format|\n if @user.save\n format.html { redirect_to :users, notice: 'Registration successful.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def info()\n _params = {}\n return @master.call 'users/info', _params\n end", "def create\r\n @user = User.new(params[:user])\r\n \r\n respond_to do |format|\r\n if @user.save\r\n flash[:notice] = 'User was successfully created.'\r\n format.html { redirect_to user_url(@user) }\r\n format.xml { head :created, :location => user_url(@user) }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @user.errors.to_xml }\r\n end\r\n end\r\n end", "def user_info_params\n params.require(:user_info).permit(:first_name, :last_name, :photo)\n end", "def new\n @user_name = UserName.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_name }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def create\n redirect_to root_url, :notice => 'Informacja! Rejestracja zosta&#322;a wy&#322;&#261;czona'\n #@user = User.new(params[:user])\n\n #respond_to do |format|\n #if @user.save\n #format.html { redirect_to( root_url, :notice => 'Informacja! Konto zarejestrowane!') }\n #format.xml { render :xml => @user, :status => :created, :location => @user }\n #else\n #format.html { render :action => \"new\" }\n #format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n #end\n #end\nend", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n flash[:notice] = 'Firm was successfully created.'\n format.html { redirect_to(@user) }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def get_detail_info(fids)\n uri = \"https://api.twitter.com/1/users/lookup.json\"\n req = Typhoeus::Request.new(uri,\n :method =>\"post\",\n :params =>{:user_id=>fids, :include_entities=>\"true\"})\n \n sign_request(req,uri)\n hydra = Typhoeus::Hydra.new\n hydra.queue(req)\n hydra.run\n JSON.parse(req.response.body)\n \n end", "def create\n @users_hacktag = UsersHacktag.new(params[:users_hacktag])\n\n respond_to do |format|\n if @users_hacktag.save\n format.html { redirect_to(@users_hacktag, :notice => 'Users hacktag was successfully created.') }\n format.xml { render :xml => @users_hacktag, :status => :created, :location => @users_hacktag }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @users_hacktag.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n flash[:notice] = 'User was successfully created.'\n format.html { redirect_to(@user) }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @user_detail = UserDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_detail }\n end\n end", "def new\n @user = User.new\n @users = @firm.users.all\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n flash[:notice] = 'User was successfully created.'\n format.html { redirect_to user_url(@user) }\n format.xml { head :created, :location => user_url(@user) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors.to_xml }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n flash[:notice] = 'User was successfully created.'\n format.html { redirect_to(:action=>\"index\") }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n flash[:notice] = 'User was successfully created.'\n format.html { redirect_to(@user) }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n flash[:notice] = 'User was successfully created.'\n format.html { redirect_to(@user) }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n flash[:notice] = 'User was successfully created.'\n format.html { redirect_to(@user) }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n flash[:notice] = 'User was successfully created.'\n format.html { redirect_to(@user) }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n flash[:notice] = 'User was successfully created.'\n format.html { redirect_to(@user) }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n flash[:notice] = 'User was successfully created.'\n format.html { redirect_to(@user) }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n flash[:notice] = 'User was successfully created.'\n format.html { redirect_to(@user) }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n flash[:notice] = 'User was successfully created.'\n format.html { redirect_to(@user) }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def show\n @userinfo = Userinfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @userinfo }\n end\n end", "def create\n if !current_user || is_admin?\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to(:root, :notice => 'Registration successfull.') }\n #format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n #format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n else\n redirect_to :root\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to(@user, :notice => 'user was successfully created.') }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n puts 'Holaaaaaaaaaaaaaaaaaaaaaaaa'\n puts user_params\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n puts @users\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @usern = Usern.new(usern_params)\n\n respond_to do |format|\n if @usern.save\n format.html { redirect_to @usern, notice: 'Usern was successfully created.' }\n format.json { render :show, status: :created, location: @usern }\n else\n format.html { render :new }\n format.json { render json: @usern.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @user = User.new \n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n flash[:notice] = 'User was successfully created.'\n format.html { redirect_to user_url(@user) }\n format.xml { head :created, :location => user_url(@user) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n respond_to do |format|\n if @user.save\n flash[:notice] = 'User was successfully created.'\n format.html { redirect_to(:action => :index) }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end" ]
[ "0.6786364", "0.65938085", "0.63673097", "0.6219625", "0.6070042", "0.5999379", "0.5972065", "0.5970282", "0.5936594", "0.59037507", "0.58908343", "0.58631206", "0.5832076", "0.58149314", "0.5634006", "0.5628109", "0.56202567", "0.5580599", "0.5568617", "0.5554242", "0.55511826", "0.5538642", "0.55344635", "0.5532766", "0.5525339", "0.55123705", "0.5498786", "0.5497959", "0.5486062", "0.54738903", "0.5469763", "0.54540956", "0.5451349", "0.54352933", "0.5425526", "0.54190516", "0.5412566", "0.5399527", "0.5399439", "0.5393546", "0.53925025", "0.5391846", "0.5387045", "0.5378335", "0.5377618", "0.5373741", "0.5372042", "0.53693527", "0.53684", "0.5367318", "0.5365233", "0.53609926", "0.5359647", "0.5359647", "0.5358081", "0.53547", "0.5351113", "0.5337251", "0.5334875", "0.53320694", "0.5331392", "0.53306264", "0.5325794", "0.5324842", "0.5324842", "0.5324842", "0.5324842", "0.5324842", "0.5324842", "0.5324842", "0.5324842", "0.5324812", "0.53233975", "0.5323351", "0.53172505", "0.5315253", "0.5308592", "0.5308137", "0.53054726", "0.5305221", "0.5305221", "0.5305221", "0.5305221", "0.5305221", "0.5305221", "0.5305221", "0.5305221", "0.5305221", "0.5305221", "0.5305221", "0.5305221", "0.5305221", "0.5305221", "0.5305221", "0.5305221", "0.5305221", "0.5305221", "0.5305221", "0.5305221", "0.5305221" ]
0.6702249
1
PUT /userinfos/1 PUT /userinfos/1.xml
def update @userinfo = Userinfo.find(params[:id]) respond_to do |format| if @userinfo.update_attributes(params[:userinfo]) flash[:notice] = 'Userinfo was successfully updated.' format.html { redirect_to(@userinfo) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @userinfo.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append_user_info(username, xml); end", "def update!\n @authorize = nil\n update_plan! &&\n resp = put(\"/users/#{username}.xml\", {\n :user_key => apikey,\n \"user[first_name]\" => first_name,\n \"user[last_name]\" => last_name\n })\n end", "def append_user_info(username, xml)\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def update\n @user = V1::User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'V1::User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_info(uid, info)\n object(\"#{uid}.info\").put(body: info.to_json)\n end", "def edit_info(params, userid)\n db = connect()\n db.execute('UPDATE users SET Info=? WHERE Id=?', params[\"info\"], userid)\n end", "def update\n respond_to do |format|\n if @userinfo.update(userinfo_params)\n format.html { redirect_to @userinfo, notice: 'Userinfo was successfully updated.' }\n format.json { render :show, status: :ok, location: @userinfo }\n else\n format.html { render :edit }\n format.json { render json: @userinfo.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 userinfo_set(userinfo)\n rebuild_uri :userinfo => userinfo\n end", "def updateUser\n options = {\n :body => params.to_json,\n :headers => {\n 'Content-Type' => 'application/json',\n 'Authorization' => request.headers['Authorization']\n }\n }\n results = HTTParty.put(\"http://192.168.99.101:4051/users/\"+@current_user[\"id\"].to_s, options)\n render json: results.parsed_response, status: results.code\n end", "def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end", "def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend", "def update\n @info = Info.find(params[:id])\n\n respond_to do |format|\n if @info.update_attributes(params[:info])\n format.html { redirect_to(@info, :notice => 'Info was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @info.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_user_info\n @user_info = UserInfo.find(params[:id])\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 @user_infom.update(user_infom_params)\n format.html { redirect_to @user_infom, notice: 'User infom was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_infom }\n else\n format.html { render :edit }\n format.json { render json: @user_infom.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(root_path, :notice => 'Usuario alterado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(users_url,:notice => \"User #{@user.name} was successfully updated.\") }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user_info.update(user_info_params)\n format.html { redirect_to '/profile?id=%s' % [session[:user_id]], notice: 'User info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @site_user_info = SiteUserInfo.find(params[:id])\n\n respond_to do |format|\n if @site_user_info.update_attributes(params[:site_user_info])\n format.html { redirect_to(@site_user_info, :notice => 'Site user info was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @site_user_info.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(users_url, :notice => \"User #{@user.name} was successfully updated.\") }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def update\n @user = User.find_by_urlname(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = \"Account updated successfully\"\n format.html { redirect_to user_path(@user) }\n format.xml { head :ok }\n else\n flash[:error] = \"There were problems updating the profile\"\n format.html { render :action => 'edit' }\n format.xml { @user.errors.to_xml }\n end\n end\n end", "def modify_user(user)\n query_api_object Model::User, '/rest/user', user.to_hash, 'PUT'\n end", "def update\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to([:admin, @user], notice: 'User was successfully updated.') }\n format.xml { head :ok }\n website.add_log(user: current_user, action: \"Updated user #{@user.name}\")\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(self.current_user)\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:success] = 'You Have Successfully Updated Your Details'\n format.html { redirect_to user_url(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors.to_xml }\n end\n end\n end", "def update\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash.now[:notice] = 'Successfully updated.'\n format.html { render :action => \"edit\" }\n format.xml { head :ok }\n else\n flash.now[:error] = 'Could not update. Please see errors below...'\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @userinfo = Userinfo.new(params[:userinfo])\n\n respond_to do |format|\n if @userinfo.save\n flash[:notice] = 'Userinfo was successfully created.'\n format.html { redirect_to(@userinfo) }\n format.xml { render :xml => @userinfo, :status => :created, :location => @userinfo }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @userinfo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @utilisateur = Utilisateur.find(params[:id])\n\n respond_to do |format|\n if @utilisateur.update_attributes(params[:utilisateur])\n flash[:notice] = 'Utilisateur was successfully updated.'\n format.html { redirect_to(@utilisateur) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @utilisateur.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_2\n @user = User.find(params[:id])\n data = {\"latitude\" => params[:latitude], \"longitude\" => params[:longitude], \"ip\" => request.remote_ip}\n \n respond_to do |format|\n if @user.update_attributes(data)\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n authorize @user_information\n @user_information.updated_by = @user.id\n @user_information.update(user_information_params)\n respond_with(@user_information)\n end", "def modify_user(user)\n query_api_object User, \"/rest/user\", user.dump(), \"PUT\"\n end", "def update\n @users_hacktag = UsersHacktag.find(params[:id])\n\n respond_to do |format|\n if @users_hacktag.update_attributes(params[:users_hacktag])\n format.html { redirect_to(@users_hacktag, :notice => 'Users hacktag was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @users_hacktag.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n logger.info 'ffffff'\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @users = User.find(params[:id])\n\n respond_to do |format|\n if @users.update_attributes(params[:regist])\n format.html { redirect_to @users, notice: 'Regist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @users.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user_detail = UserDetail.find(params[:id])\n\n respond_to do |format|\n if @user_detail.update_attributes(params[:user_detail])\n flash[:notice] = 'UserDetail was successfully updated.'\n format.html { redirect_to(@user_detail) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user_detail.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n doc = Nokogiri::XML(request.body.read)\n bNode = doc.xpath('elwak/benutzer')\n\n @benutzer = Benutzer.find(params[:id])\n \n #Sicherstellen, dass Benutzer synchronisiert wird auch wenn nur Objekt-Zuordnungen anders sind!\n @benutzer.updated_at = DateTime.now \n\n if bNode.xpath('objekt_zuordnungs').length > 0\n @benutzer.setze_objekt_zuordnungen(bNode.xpath('objekt_zuordnungs/objekt_id').map{|oz| oz.text.to_s.to_i})\n end\n if @benutzer.update(benutzer_params(bNode))\n success(nil)\n else\n error(@benutzer.errors)\n end\n end", "def update\n respond_to do |format|\n if @lab_user_info.update(lab_user_info_params)\n format.html { redirect_to @lab_user_info, notice: 'Lab user info was successfully updated.' }\n format.json { render :show, status: :ok, location: @lab_user_info }\n else\n format.html { render :edit }\n format.json { render json: @lab_user_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_container_info(username, container_info)\n all_users = YAML.load(File.open(USERS_FILE)) || {}\n all_users[username] = container_info\n File.open(USERS_FILE, 'w') {|f| f.write all_users.to_yaml }\nend", "def update\n user_info = User.find(params[:id])\n if !user_info.points\n @user[:points] = 100\n end\n if !user_info.image\n @user[:image] = 'https://graph.facebook.com/'+user_info.uid.to_s+'/picture?width=360&height=210'\n end\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n # @userinfos = Userinfo.find(params[:id])\n\n end", "def set_userinfo\n @userinfo = Userinfo.find(params[:id])\n end", "def update\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_should_update_invite_via_API_XML\r\n get \"/logout\"\r\n put \"/invites/1.xml\", :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => '[email protected]',\r\n :user_id => 1 }\r\n assert_response 401\r\n end", "def update\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(users_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @info = Info.find(params[:id])\n\n respond_to do |format|\n if @info.update_attributes(params[:info])\n flash[:notice] = 'News was successfully updated.'\n format.html { redirect_to([:admin, @info]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @info.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_user(handle, description= {})\n request(Net::HTTP::Put, \"/api/#{API_VERSION}/user/#{handle}\", nil, description, true)\n end", "def update\n @user_datum = UserDatum.find(params[:id])\n\n respond_to do |format|\n if @user_datum.update_attributes(params[:user_datum])\n format.html { redirect_to(user_data_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user_datum.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(\"/parametres_cabinets/#{@user.parametres_cabinet_id}/edit\") }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put user_id, options={}, headers={}\n @connection.put \"users/#{user_id}.json\", options, headers\n end", "def update_info(uid, info)\n files_collection.update_one({filename: uid}, {\"$set\" => {metadata: info}})\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user_name = UserName.find(params[:id])\n\n respond_to do |format|\n if @user_name.update_attributes(params[:user_name])\n format.html { redirect_to(@user_name, :notice => 'User name was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user_name.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(users_url, :notice => 'User has been updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @usuario = Usuario.find(params[:id])\n #@[email protected]\n respond_to do |format|\n if @usuario.update_attributes(params[:usuario])\n format.html { redirect_to(@usuario, :notice => t('exitom')) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @usuario.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n #@user = User.find_by_id(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @user_info = args[:user_info] if args.key?(:user_info)\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to root_url }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n get_list\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = \"User #{@user.fname} #{@user.lname} was successfully updated.\"\n format.html { redirect_to(:action => :index) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end", "def update_current_logged_in_user(args = {}) \n id = args['id']\n temp_path = \"/users.json/current\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"userId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to user_url(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors.to_xml }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = \"User #{@user.username} was successfully updated.\"\n format.html { redirect_to(:action =>'show', :id => @user.id) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_user\n end", "def update\n @user = @current_user\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, notice: 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :edit }\n format.xml { render xml: @user.errors, status: :unprocessable_entity }\n #render action: :edit\n end\n end\n end", "def update\n respond_to do |format|\n if @user_tasks_info.update(user_tasks_info_params)\n format.html { redirect_to @user_tasks_info, notice: 'User tasks info was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_tasks_info }\n else\n format.html { render :edit }\n format.json { render json: @user_tasks_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tipo_system_user = TipoSystemUser.find(params[:id])\n\n respond_to do |format|\n if @tipo_system_user.update_attributes(params[:tipo_system_user])\n format.html { redirect_to(@tipo_system_user, :notice => 'Tipo system user was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_system_user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end", "def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(:action => :index) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n respond_with @user\n end", "def update\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n respond_with @user\n end", "def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend", "def update\n @usuario = Usuario.find(params[:id])\n\n respond_to do |format|\n if @usuario.update_attributes(params[:usuario])\n format.html { redirect_to(@usuario, :notice => 'Usuario was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @usuario.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = current_user\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(root_url, :notice => 'Successfully updated profile.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n head :ok\n else\n render :xml => @user.errors, :status => :unprocessable_entity\n end\n rescue\n render :nothing => true, :status => :not_found\n end", "def update\n @user = User.find(params[:id])\n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(home_url()) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.62927645", "0.62615234", "0.6223693", "0.62155145", "0.6183314", "0.6155302", "0.61155343", "0.6097311", "0.59757406", "0.59750223", "0.5964583", "0.5946108", "0.5910489", "0.5902028", "0.590074", "0.58936524", "0.5877312", "0.58746475", "0.5872516", "0.5870541", "0.586794", "0.58253396", "0.58013374", "0.5776872", "0.5758452", "0.57514894", "0.57498205", "0.5749393", "0.57358575", "0.5731161", "0.57171303", "0.57138526", "0.57077914", "0.56974524", "0.56749135", "0.5674075", "0.56692266", "0.56650156", "0.5658303", "0.5655021", "0.564896", "0.56463", "0.56461877", "0.56283957", "0.5621128", "0.56204855", "0.56187624", "0.5617885", "0.5616678", "0.56154007", "0.5614316", "0.561314", "0.56122446", "0.56107837", "0.56107837", "0.56107837", "0.56107837", "0.56107837", "0.56107837", "0.56107837", "0.56107837", "0.56107837", "0.56107837", "0.5608155", "0.5603958", "0.56031805", "0.5601019", "0.5595951", "0.5595142", "0.5592167", "0.5592167", "0.5592167", "0.5592167", "0.5592167", "0.5592167", "0.5592167", "0.5592167", "0.5592167", "0.5592167", "0.5592167", "0.5592167", "0.55920804", "0.5591906", "0.5587812", "0.5575026", "0.5573655", "0.5572531", "0.5564439", "0.5559673", "0.554031", "0.5534891", "0.5533418", "0.55309784", "0.55294365", "0.55294365", "0.55291533", "0.55239546", "0.552367", "0.55229473", "0.55220634" ]
0.67879987
0
DELETE /userinfos/1 DELETE /userinfos/1.xml
def destroy @userinfo = Userinfo.find(params[:id]) @userinfo.destroy respond_to do |format| format.html { redirect_to(userinfos_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n @user = User.find(params[:id])\n @user.rvsps.delete_all()\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find_by_urlname(params[:id])\n @user.destroy\n \n respond_to do |format|\n flash[:notice] = \"User deleted from the system\"\n format.html { redirect_to users_path }\n format.xml { head :ok }\n end\n end", "def destroy\n @user_detail = UserDetail.find(params[:id])\n @user_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_details_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user_detail = UserDetail.find(params[:id])\n @user_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_details_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n #@user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @utilisateur = Utilisateur.find(params[:id])\n @utilisateur.destroy\n\n respond_to do |format|\n format.html { redirect_to(utilisateurs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = V1::User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(v1_users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @users = Users.find(params[:id])\n @users.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @usuario = User.find(params[:id])\n @usuario.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user_info.destroy\n respond_to do |format|\n format.html { redirect_to user_infos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @site_user_info = SiteUserInfo.find(params[:id])\n @site_user_info.destroy\n\n respond_to do |format|\n format.html { redirect_to(site_user_infos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n user = User.get(params[:id])\n user.destroy if user\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user_info.destroy\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(scriptwords_users_url) }\n format.xml { head :ok }\n end\n end", "def delete_users\n delete(users_path)\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(entries_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\nend", "def destroy\n #@user = User.find_by_login(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @user.destroy\r\n \r\n respond_to do |format|\r\n format.html { redirect_to users_url }\r\n format.xml { head :ok }\r\n end\r\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(:first, :conditions => [\"id = ?\", params[:id]])\n @user.destroy\n respond_to do |format|\n format.html { redirect_to(users_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.xml { head :no_content }\n end\n end", "def destroy\n @user_name = UserName.find(params[:id])\n @user_name.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_names_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @userinfo.destroy\n respond_to do |format|\n format.html { redirect_to userinfos_url, notice: 'Userinfo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to(admin_users_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted user #{@user.name}\")\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(\"/parametres_cabinets/#{@user.parametres_cabinet_id}/edit\") }\n format.xml { head :ok }\n end\n end", "def user_delete(user_id)\n\t\tdelete_call = Curl::Easy.http_delete(\"#{@ip_address}:#{@port_2}/v2.0/users/#{user_id}\"\n\t\t) do |curl|\n\t\t\tcurl.headers['x-auth-token'] = @token\n\t\t\tcurl.headers['userId'] = user_id\n\t\tend\n\t\n\tend", "def deleteUser(userInfo)\r\n\t\tnum = 0\r\n\t\tuser_id = 0\r\n\t\tuserInfo.each_pair { | name, value |\r\n\t\t\tif(name == \"user_id\")\r\n\t\t\t\tuser_id = value\r\n\t\t\telse\r\n\t\t\t\tputs \"wrong parameter: #{name}\"\r\n\t\t\t\treturn \"wrong parameter: #{name}\"\r\n\t\t\tend\t\t\t\t\r\n\t\t}\r\n\r\n\t\tputs \"Connecting to database...\"\r\n\t\tbegin\r\n\t\t\t# connect to the MySQL server\r\n\t\t\tdbh = DBI.connect(\"DBI:Mysql:#{$db}:#{$db_ip}\",\"#{$user}\", \"#{$pass}\")\r\n\t\t\t\r\n\t\t\tnum = dbh.do(\"DELETE FROM nitlab.b9tj1_users WHERE id = '#{user_id}' AND id!='62'\")\r\n\t\t\tif (num == 1)\r\n\t\t\t\tputs \"User deleted...\"\r\n\t\t\t\treturn 0\r\n\t\t\tend\r\n\t\t\t\r\n\t\trescue DBI::DatabaseError => e\r\n\t\t\tputs \"An error occurred\"\r\n\t\t\tputs \"Error code: #{e.err}\"\r\n\t\t\tputs \"Error message: #{e.errstr}\"\r\n\t\tensure\r\n\t\t\t# disconnect from server\r\n\t\t\tdbh.disconnect if dbh\r\n\t\tend\r\n\t\t\t\r\n\t\treturn -1\r\n\tend", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n respond_to do |format|\n format.html { redirect_to(admin_users_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n \n flash[:notice] = \"User #{@user.login} deleted\"\n \n respond_to do |format|\n format.html { redirect_to(space_users_path(@space)) }\n format.xml { head :ok }\n format.atom { head :ok }\n end\n end", "def destroy\n @tipo_system_user = TipoSystemUser.find(params[:id])\n @tipo_system_user.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_system_users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n\t\t@user = User.find(params[:id])\n\t\[email protected]\n\t\tSite.where(:user_id => params[:id]).each do |site|\n\t\t\tsite.destroy\n\t\t\tputs \"chciałbym usunąć adres #{site.adres.to_yaml}\"\n\t\t\n\t\tend\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to(users_url) }\n\t\t\tformat.xml\t{ head :ok }\n\t\tend\n\tend", "def destroy\n @users_hacktag = UsersHacktag.find(params[:id])\n @users_hacktag.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_hacktags_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @udetail = Udetail.find(params[:id])\n @udetail.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_udetails_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n\t\tparams.permit!\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @usertogo = User.find(params[:id])\n @usertogo.destroy\n \n respond_to do |format|\n flash[:success] = \"User destroyed.\"\n format.html { redirect_to(root_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n redirect_to(:action=>\"index\") if session[:user_id] != params[:id].to_i\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @usuario = Usuario.find(params[:id])\n @usuario.destroy\n \n respond_to do |format|\n format.html { redirect_to(usuarios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @usuario = Usuario.find(params[:id])\n @usuario.destroy\n\n respond_to do |format|\n format.html { redirect_to(usuarios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @usuario = Usuario.find(params[:id])\n @usuario.destroy\n\n respond_to do |format|\n format.html { redirect_to(usuarios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @usuario = Usuario.find(params[:id])\n @usuario.destroy\n\n respond_to do |format|\n format.html { redirect_to(usuarios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @usuario = Usuario.find(params[:id])\n @usuario.destroy\n\n respond_to do |format|\n format.html { redirect_to(usuarios_url) }\n format.xml { head :ok }\n end\n end", "def delete_user(id)\n elektron_identity.delete(\"users/#{id}\")\n end", "def destroy\n @info = Info.find(params[:id])\n @info.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_infos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @info = Info.find(params[:id])\n @info.destroy\n\n respond_to do |format|\n format.html { redirect_to(infos_url) }\n format.xml { head :ok }\n end\n end", "def remove_user\n query_api '/rest/user', nil, 'DELETE'\n end" ]
[ "0.6818971", "0.67526174", "0.6606075", "0.6606075", "0.66028523", "0.6593021", "0.6589902", "0.6580657", "0.65690243", "0.6556147", "0.65520084", "0.6534515", "0.6530311", "0.6527603", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.65053916", "0.64963776", "0.64936745", "0.64880633", "0.6487491", "0.6484618", "0.6484618", "0.6484549", "0.64701706", "0.64694077", "0.6467883", "0.6464221", "0.6452006", "0.6451102", "0.6451102", "0.6451102", "0.6450418", "0.6446554", "0.6439726", "0.6439591", "0.6431798", "0.64279157", "0.63800234", "0.63753235", "0.6356032", "0.63509744", "0.6347459", "0.6347459", "0.631094", "0.63094306", "0.62986606", "0.6291156", "0.62901115", "0.6279022", "0.62565017", "0.62541825", "0.6250359", "0.62389547", "0.62389547", "0.62389547", "0.62389547", "0.62356514", "0.6222757", "0.62176317", "0.62115276" ]
0.73564196
0
Add `ontop: true` as an additional option here in order to prevent it from actually daemonizing. It helps a ton with debugging.
def build_daemon base = { app_name: name, dir_mode: :normal, dir: dir }.merge(daemon) base.tap do |hash| base[:ontop] = true if ServiceLayer.config.debug end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_top\n get_value :ontop\n end", "def daemonopts()\n {\n :ontop => false,\n :backtrace => false,\n :dir_mode => :normal,\n :app_name => 'graphiteme',\n :dir => '/var/run/graphiteme/',\n :log_output => true,\n :log_dir => '/var/log/graphiteme/',\n }\nend", "def no_autostart\n @plezi_autostart = false\n end", "def start_none\n unless options[:ontop]\n Daemonize.daemonize(output_logfile, @group.app_name)\n else\n Daemonize.simulate(output_logfile)\n end\n\n @pid.pid = Process.pid\n\n # We need this to remove the pid-file if the applications exits by itself.\n # Note that <tt>at_text</tt> will only be run if the applications exits by calling\n # <tt>exit</tt>, and not if it calls <tt>exit!</tt> (so please don't call <tt>exit!</tt>\n # in your application!\n #\n at_exit do\n begin; @pid.cleanup; rescue ::Exception; end\n\n # If the option <tt>:backtrace</tt> is used and the application did exit by itself\n # create a exception log.\n if options[:backtrace] && !options[:ontop] && !$daemons_sigterm\n begin; exception_log; rescue ::Exception; end\n end\n\n end\n\n # This part is needed to remove the pid-file if the application is killed by\n # daemons or manually by the user.\n # Note that the applications is not supposed to overwrite the signal handler for\n # 'TERM'.\n #\n trap(SIGNAL) do\n begin; @pid.cleanup; rescue ::Exception; end\n $daemons_sigterm = true\n\n if options[:hard_exit]\n exit!\n else\n exit\n end\n end\n end", "def overlay(options = {})\r\n end", "def on_top=(on_top)\n set_default :ontop, on_top\n end", "def adjust_overhead\n false\n end", "def topup_start\n nil\n end", "def merge_puppet_args!(yard_args)\n yard_args.unshift '--debug' if Puppet[:debug]\n yard_args.unshift '--backtrace' if Puppet[:trace]\n\n yard_args\n end", "def no_close\n @commands_and_opts.push OPTIONAL_OPTS[:no_close]\n self\n end", "def options_other opts, colors\n\t\t\t\topts.separator \"\"\n\t\t\t\topts.separator \"Other Options: \".colorize(colors[:green])\n\n\t\t\t\t#todo -h\n\t\t\t\topts.on('-h', '--help', 'displays this screen' ) do\n\t\t\t\t\tputs opts\n\t\t\t\t\texit\n\t\t\t\tend\n\t\t\t\t#todo -w\n\t\t\t\topts.on('-w', \"displays the name of the current list\") do\n\t\t\t\t\tputs \"Working list is #{Config[:working_list_name]}\"\n\t\t\t\t\texit\n\t\t\t\tend\n\t\t\tend", "def daemon_show_usage\n daemon_show_version\n puts \"\\nUsage:\"\n puts \" -b, --background work in background mode\"\n puts \" -v, --version view version of daemon\"\n puts \" -h, --help view this help\"\nend", "def daemonize?\n options[:daemonize] || false\n end", "def force\n add option: \"-force\"\n end", "def update_kafka_heap_opts\n sudo(\"sed -i -e '/export KAFKA_HEAP_OPTS/d' /etc/profile.d/kafka.sh > /dev/null 2>&1 || true\")\n sudo(\"echo \\\"export KAFKA_HEAP_OPTS='#{KafkaHelpers.kafka_heap_opts}'\\\" | sudo tee -a /etc/profile.d/kafka.sh\")\n end", "def daemon=(_)\n @application.daemon = true\n end", "def configure_logging\n Backdat::Log.init(Backdat::Config[:log_location])\n if ( Backdat::Config[:log_location] != STDOUT ) && STDOUT.tty? &&\n ( !Backdat::Config[:daemonize] )\n stdout_logger = Logger.new(STDOUT)\n STDOUT.sync = true\n stdout_logger.formatter = Backdat::Log.logger.formatter\n Backdat::Log.loggers << stdout_logger\n end\n Backdat::Log.level = Backdat::Config[:log_level]\n end", "def autostart; end", "def default_task_options\n {:reatime => false}\n end", "def standard_rake_options\n options.no_cache = true\n super().concat([\n ['--status', \"Print the status of the Rokuby.\",\n lambda { |value|\n options.show_status = true\n }\n ],\n ['--nocache [cache]', \"Do not use caching during processing(specify cache as all, lib, src or nothing for all).\",\n lambda { |value|\n if(!value || value == \"all\")\n options.no_cache = true\n elsif(value == \"lib\")\n options.no_lib_cache = true\n elsif(value == \"src\")\n options.no_src_cache = true\n else\n raise \"Unknown option value '#{value}' for --nocache.\"\n end\n } \n ]\n ])\n end", "def setup_defaults!\n @options[:touch] = true unless @options.key?(:touch)\n end", "def unclean_shutdown_mode\n super\n end", "def supervisor(options)\n\n end", "def default_options\n { dir_mode: :normal, dir: File.expand_path('daemon', project.path),\n multiple: false, log_output: true }\n end", "def shell_opts(options)\n filtered_opts = options.reject do |key, _value|\n [:use_sudo, :sudo_command, :log_subject, :quiet].include?(key)\n end\n { live_stream: logger, timeout: 60_000 }.merge(filtered_opts)\n end", "def display_bar?\n !@options['debug'] && !@options['silent']\n end", "def options; [] end", "def after_launched(force=false) \n end", "def before_shell\n end", "def show_summary!\n @runopts[:show_log] = false\n end", "def shutdown\n super\n $log.info 'php_fpm_status_datadog output shutting down'\n end", "def before_exec_command\n end", "def configure_early?\n true\n end", "def process_options\n \n \n @options.verbose = false if @options.quiet\n end", "def with_force_shutdown; end", "def debug?; run_options[:debug]; end", "def show_tool_tip(out = nil)\n print out if out\n exit 206\n end", "def daemon_running?; end", "def always_on_top=(value)\n @peer.always_on_top = value\n end", "def clear_timeless_option\n self.class.timestamping = true\n end", "def set_layout_to_none\n options[:layout] = false\n end", "def options\n result = options_pre_mizuno\n result[:reuse_address] = true\n result\n end", "def dont_exit_on_help=(val) #:nodoc:\n @@exit = true\n end", "def process_options\n @options.verbose = false if @options.quiet\n end", "def override_tomcat?; false; end", "def quiet?; run_options[:quiet]; end", "def common_options(opts)\n opts.separator ''\n opts.separator 'Other options:'\n opts.on('--[no-]color', 'Run without color') do |v|\n Term::ANSIColor.coloring = v\n end\n opts.on_tail('-v', '--version', 'Show version.') do\n ui.trace \"inch #{Inch::VERSION}\"\n exit\n end\n opts.on_tail('-l', '--language [LANGUAGE]',\n 'Set language (elixir|javascript|ruby).') do |language|\n @language = language\n end\n opts.on_tail('-r', '--read-from-dump [FILE]',\n 'Read objects from dump.') do |file|\n @read_dump_file = file\n end\n opts.on_tail('-h', '--help', 'Show this help.') do\n ui.trace opts\n exit\n end\n end", "def disable_unexpectedly_quit_dialog\n if Maze.config.os_version.floor == 11\n # com.apple.CrashReporter defaults seem to be ignored on macOS 11\n # Note: unloading com.apple.ReportCrash disables creation of crash reports in ~/Library/Logs/DiagnosticReports\n `/bin/launchctl unload /System/Library/LaunchAgents/com.apple.ReportCrash.plist`\n at_exit do\n `/bin/launchctl load /System/Library/LaunchAgents/com.apple.ReportCrash.plist`\n end\n else\n # Use Notification Center instead of showing dialog.\n `defaults write com.apple.CrashReporter UseUNC 1`\n end\nend", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end" ]
[ "0.5627171", "0.5598656", "0.54221094", "0.53796285", "0.53509796", "0.521135", "0.50964594", "0.5079381", "0.50769544", "0.49649146", "0.49249712", "0.49225807", "0.49084163", "0.48479152", "0.4844704", "0.48378855", "0.48269588", "0.48089743", "0.48047203", "0.48029384", "0.47911817", "0.47666404", "0.47543287", "0.4744243", "0.47356126", "0.47246313", "0.4718883", "0.47161853", "0.4708943", "0.47066724", "0.46941575", "0.46864903", "0.4653347", "0.46411616", "0.46408436", "0.463373", "0.46331897", "0.4632027", "0.46090475", "0.4605734", "0.460399", "0.45998335", "0.4594805", "0.45875213", "0.45859733", "0.45845", "0.45843166", "0.4581785", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606", "0.4575606" ]
0.48134065
17
GET /gtfs_agencies/1 GET /gtfs_agencies/1.xml
def show @gtfs_agency = GtfsAgency.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @gtfs_agency } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tafs(params={})\n perform_get('/tafs.xml', params)\n end", "def show\n @agencies = Agency.find(params[:id])\n\n if @agencies \n respond_to do |format|\n format.json { render :json => @agencies }\n format.xml { render :xml => @agencies }\n end \n else\n head :not_found\n end\n end", "def show\n @agencies = Agency.find(params[:id])\n\n if @agencies \n respond_to do |format|\n format.json { render :json => @agencies }\n format.xml { render :xml => @agencies }\n end \n else\n head :not_found\n end\n end", "def index\n @agencies = Agency.all\n end", "def taf(id)\n perform_get(\"/tafs/#{id}.xml\")\n end", "def agencies_get(id, opts = {})\n data, _status_code, _headers = agencies_get_with_http_info(id, opts)\n data\n end", "def index\n @agencies = current_user.agencies.all\n end", "def agencies_search_with_http_info(q, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AgenciesApi.agencies_search ...'\n end\n # verify the required parameter 'q' is set\n if @api_client.config.client_side_validation && q.nil?\n fail ArgumentError, \"Missing the required parameter 'q' when calling AgenciesApi.agencies_search\"\n end\n # resource path\n local_var_path = '/v1/agencies'\n\n # query parameters\n query_params = {}\n query_params[:'q'] = q\n query_params[:'pageNumber'] = opts[:'page_number'] if !opts[:'page_number'].nil?\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].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', 'text/json', 'text/html', 'application/xml', 'text/xml'])\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<DomainAgencyServiceV2ModelAgencySummary>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AgenciesApi#agencies_search\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def new\n @gtfs_agency = GtfsAgency.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gtfs_agency }\n end\n end", "def index\n @otf_lookups = OtfLookup.all(:include => :feature)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @otf_lookups }\n end\n end", "def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end", "def create\n @gtfs_agency = GtfsAgency.new(params[:gtfs_agency])\n\n respond_to do |format|\n if @gtfs_agency.save\n format.html { redirect_to(@gtfs_agency, :notice => 'Gtfs agency was successfully created.') }\n format.xml { render :xml => @gtfs_agency, :status => :created, :location => @gtfs_agency }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @gtfs_agency.errors, :status => :unprocessable_entity }\n end\n end\n end", "def get_gtdb_taxonomy\n gtdb_genome = metadata[:gtdb_assembly] or return\n\n doc = MiGA::Json.parse(\n MiGA::RemoteDataset.download(\n :gtdb, :genome, gtdb_genome, 'taxon-history', nil, ['']\n ),\n contents: true\n )\n lineage = { ns: 'gtdb' }\n lineage.merge!(doc.first) # Get only the latest available classification\n release = lineage.delete(:release)\n @metadata[:gtdb_release] = release\n lineage.transform_values! { |v| v.gsub(/^\\S__/, '') }\n MiGA.DEBUG \"Got lineage from #{release}: #{lineage}\"\n MiGA::Taxonomy.new(lineage)\n end", "def index\n @agencies = Agency.where(:status => 'Y').paginate(:page => params[:page], :per_page => 10)\n end", "def agencies_head(q, opts = {})\n agencies_head_with_http_info(q, opts)\n nil\n end", "def get_agencies\n @type = params[:value]\n agencies= Agency.where(:deleted => false)\n render :layout => false \n end", "def agencies_get_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AgenciesApi.agencies_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 AgenciesApi.agencies_get\"\n end\n # resource path\n local_var_path = '/v1/agencies/{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', 'text/json', 'text/html', 'application/xml', 'text/xml'])\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 => 'DomainAgencyServiceV2ModelAgency')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AgenciesApi#agencies_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def destroy\n @gtfs_agency = GtfsAgency.find(params[:id])\n @gtfs_agency.destroy\n\n respond_to do |format|\n format.html { redirect_to(gtfs_agencies_url) }\n format.xml { head :ok }\n end\n end", "def all\n f = options[:format]\n a = options[:agency]\n ::Taxi::Status.list_all(format: f, agency: a)\n end", "def statuses\n request(:get, \"applicant_tracking/statuses\")\n end", "def index\n id = params[:id].to_i\n\n if id != 0\n \t @agencies = @agencies.paginate(page: params[:page], per_page: 10).order(:name).find_all_by_id(id)\n if @agencies.any?\n @agency_name = @agencies.first.name\n end\n else\n \t @agencies = @agencies.paginate(page: params[:page], per_page: 10).order(:name).find(:all)\n end\n\n\t\t@records_returned = @agencies.count\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @agencies }\n end\n end", "def retrieve_xml_structure\n \n begin\n\n \tdh = DHHtp.new('maps.googleapis.com')\n \tdh.retrieve_xml_structure(ARGV.first)\n\n rescue => e\n \tputs \"\\nError! #{e}\\n\"\n \n end\n\t\nend", "def agencies_head_with_http_info(q, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AgenciesApi.agencies_head ...'\n end\n # verify the required parameter 'q' is set\n if @api_client.config.client_side_validation && q.nil?\n fail ArgumentError, \"Missing the required parameter 'q' when calling AgenciesApi.agencies_head\"\n end\n # resource path\n local_var_path = '/v1/agencies'\n\n # query parameters\n query_params = {}\n query_params[:'q'] = q\n query_params[:'pageNumber'] = opts[:'page_number'] if !opts[:'page_number'].nil?\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].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', 'text/json', 'text/html', 'application/xml', 'text/xml'])\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(:HEAD, 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: AgenciesApi#agencies_head\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def trends_available\n get(\"/trends/available.json\")\n end", "def index\n @registering_agencies = RegisteringAgency.all\n end", "def get_listings_xml(url)\n @client.get_content(url)\n end", "def index\n @geofences = Geofence.all\n end", "def fetch_xml(uri)\n http = Net::HTTP.new(uri.host, uri.port)\n\n if uri.scheme == 'https'\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n\n http.read_timeout = GoogleCustomSearch.configuration.timeout\n\n request = Net::HTTP::Get.new(uri.request_uri)\n request.initialize_http_header({ 'User-Agent' => user_agent })\n\n response = http.request(request)\n\n raise GoogleCustomSearch::InvalidRequest if response.code.match(/[34]\\d{2}/)\n raise GoogleCustomSearch::ServerError if response.code.match(/5\\d{2}/)\n\n response.body\n end", "def show\n @gtfs_trip = GtfsTrip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gtfs_trip }\n end\n end", "def route_geosearch\n get '/gtfs/routes/geosearch/'\n end", "def show\n find_agencies(params[:id])\n increment_views_amount(@public_agency)\n end", "def update\n @gtfs_agency = GtfsAgency.find(params[:id])\n\n respond_to do |format|\n if @gtfs_agency.update_attributes(params[:gtfs_agency])\n format.html { redirect_to(@gtfs_agency, :notice => 'Gtfs agency was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @gtfs_agency.errors, :status => :unprocessable_entity }\n end\n end\n end", "def available_trends\n get(\"/trends/available.json\")\n end", "def make_request_get_response_trend_availible\n @path_trend_availible = '/1.1/trends/available.json'\n @address_trend_availible = URI(\"#{@baseurl}#{@path_trend_availible}\")\n # Set up HTTP. Need ssL to make the connection\n @request_trend_availible = Net::HTTP::Get.new @address_trend_availible.request_uri\n @http = Net::HTTP.new @address_trend_availible.host, @address_trend_availible.port\n @http.use_ssl = true\n @http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n # Issue the request.\n @request_trend_availible.oauth! @http, @consumer_key_country, @access_token_country\n @http.start\n @response_trend_availible = @http.request @request_trend_availible\n @response_trend_availible\n end", "def fetch_thesauri\n doc = create_doc('gaz-thesauri/administrativeThesaurus.xml')\n ## loop through each <term> element in the thesaurus\n vocabs=[]\n (doc/\"thesaurus/root/term\").each do |term|\n STDOUT << puts \n STDOUT << term.inspect\n STDOUT << puts \n\n end\n vocabs\n end", "def getRoutes\n # [[\"MTA NYCT_B65\", \"B65\", \"Downtown Brooklyn - Crown Heights\", \"via Bergen St & Dean St\"]...]\n url = \"http://bustime.mta.info/api/where/routes-for-agency/MTA%20NYCT.xml?key=#{APIKEY}\"\n xml_str = Net::HTTP.get URI(url)\n xml = Nokogiri::XML(xml_str)\n xml.css(\"response data list route\").to_a.map{|rte| [rte.css('id').text, rte.css('shortName').text, rte.css('longName').text, rte.css('description').text]}\nend", "def get_agreements\n get_agreements_response = Echochamber::Request.get_agreements(token)\n get_agreements_response.fetch(\"userAgreementList\")\n end", "def fetch_feature_docs\n docs=[]\n d = Dir[@source + \"/*.xml\"]\n #puts d.inspect\n\n d.entries.each do |file|\n docs << file\n end\n #puts docs.inspect\n docs\n end", "def get_flows()\n\tputs \"Getting flows\"\n\tresponse = request_get('/api/partner/flow')\n\tputs response.body\nend", "def show\n @gene_ontology = GeneOntology.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gene_ontology }\n end\n end", "def list_tasks(api_object)\n puts \"Current Tasks:\"\n doc = Nokogiri::XML.parse api_object.read\n puts doc\n descriptions = doc.xpath('tasks/task/description').collect {|e| e.text }\n puts descriptions.join(\", \")\n puts \"\"\nend", "def get_architect_dependencytracking_types_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ArchitectApi.get_architect_dependencytracking_types ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/architect/dependencytracking/types\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\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 => 'DependencyTypeEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ArchitectApi#get_architect_dependencytracking_types\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @gtd = Gtd.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gtd }\n end\n end", "def agencies\n Agency.where(id: transportation_agencies.pluck(:id) + oversight_agencies.pluck(:id))\n end", "def topology_tag_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TopologiesApi.topology_tag_get ...'\n end\n # resource path\n local_var_path = '/ttms/1.0.0/topology_tag'\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 = ['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<Topology>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TopologiesApi#topology_tag_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def retrieve_announces\n puts \"Retrieving announcements from the chef server and depositing them in '#{Settings[:announces_file]}'...\"\n Chef::Config.from_file(Settings[:knife_config])\n query = Chef::Search::Query.new\n nodes = {}\n query.search(:node,\"name:#{Settings[:node]}\") do |node|\n nodes[node.name] = node['announces'].to_hash unless node['announces'].nil?\n end\n File.open(Settings[:announces_file], 'w') {|f| f.write(nodes.to_json)}\nend", "def index\n @resource_allocations = ResourceAllocation.scoped\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @resource_allocations }\n end\n end", "def getgpx\n trek = Trek.find_by_id(params[:id])\n send_file trek.get_gpx(), :type => \"text/xml\", :disposition => \"inline\"\n end", "def frequent_foods\n get(\"/user/#{@user_id}/foods/log/frequent.json\")\n end", "def get_architect_dependencytracking_with_http_info(name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ArchitectApi.get_architect_dependencytracking ...\"\n end\n \n \n # verify the required parameter 'name' is set\n fail ArgumentError, \"Missing the required parameter 'name' when calling ArchitectApi.get_architect_dependencytracking\" if name.nil?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/architect/dependencytracking\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'name'] = name\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\n query_params[:'objectType'] = @api_client.build_collection_param(opts[:'object_type'], :multi) if opts[:'object_type']\n query_params[:'consumedResources'] = opts[:'consumed_resources'] if opts[:'consumed_resources']\n query_params[:'consumingResources'] = opts[:'consuming_resources'] if opts[:'consuming_resources']\n query_params[:'consumedResourceType'] = @api_client.build_collection_param(opts[:'consumed_resource_type'], :multi) if opts[:'consumed_resource_type']\n query_params[:'consumingResourceType'] = @api_client.build_collection_param(opts[:'consuming_resource_type'], :multi) if opts[:'consuming_resource_type']\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 => 'DependencyObjectEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ArchitectApi#get_architect_dependencytracking\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_architect_dependencytracking_with_http_info(name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ArchitectApi.get_architect_dependencytracking ...\"\n end\n \n \n # verify the required parameter 'name' is set\n fail ArgumentError, \"Missing the required parameter 'name' when calling ArchitectApi.get_architect_dependencytracking\" if name.nil?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/architect/dependencytracking\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'name'] = name\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\n query_params[:'objectType'] = @api_client.build_collection_param(opts[:'object_type'], :multi) if opts[:'object_type']\n query_params[:'consumedResources'] = opts[:'consumed_resources'] if opts[:'consumed_resources']\n query_params[:'consumingResources'] = opts[:'consuming_resources'] if opts[:'consuming_resources']\n query_params[:'consumedResourceType'] = @api_client.build_collection_param(opts[:'consumed_resource_type'], :multi) if opts[:'consumed_resource_type']\n query_params[:'consumingResourceType'] = @api_client.build_collection_param(opts[:'consuming_resource_type'], :multi) if opts[:'consuming_resource_type']\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 => 'DependencyObjectEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ArchitectApi#get_architect_dependencytracking\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_architect_dependencytracking_types_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ArchitectApi.get_architect_dependencytracking_types ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/architect/dependencytracking/types\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\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 => 'DependencyTypeEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ArchitectApi#get_architect_dependencytracking_types\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def pivotal_tracker(server)\n clnt = HTTPClient.new\n clnt.get(server[:url], nil, { \"X-TrackerToken\" => server[:token] })\nend", "def output_tax(refseq_data)\n rs = refseq_data\n taxid = rs[:taxid]\n gene_label_url = URI.escape(rs[:gene_label])\n\n $output_ttl.puts triple(\"<http://togogenome.org/gene/#{taxid}:#{gene_label_url}>\", \"rdfs:seeAlso\", \"tax:#{rs[:taxid]}\") unless $gene_list[rs[:gene_rsrc]]\n $output_ttl.puts triple(\"<http://togogenome.org/gene/#{taxid}:#{gene_label_url}>\", \"skos:exactMatch\", \"<http://identifiers.org/refseq/#{rs[:gene_rsrc]}>\") unless $gene_list[rs[:gene_rsrc]]\n $output_ttl.puts triple(\"tax:#{rs[:taxid]}\", \"rdf:type\", \"<http://identifiers.org/taxonomy>\") unless $tax_type_list[rs[:taxid]]\n $tax_type_list[rs[:taxid]] = true # to prevent duplicate output\n $gene_list[rs[:gene_rsrc]] = true # to prevent duplicate output\nend", "def alltags\n tag_context = params[:context] # tag context\n @tags = TagsService.tag_counts_on(SurveyRespondent, tag_context)\n \n respond_to do |format|\n format.xml\n end\n end", "def getToolsSyndicateGoogle( entity_id)\n params = Hash.new\n params['entity_id'] = entity_id\n return doCurl(\"get\",\"/tools/syndicate/google\",params)\n end", "def index\n @admin_agencies = Admin::Agency.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_agencies }\n end\n end", "def send_request_to_google_analytics(utm_url)\n options = {\n \"method\" => \"GET\",\n \"user_agent\" => ENV[\"HTTP_USER_AGENT\"],\n \"header\" => \"Accepts-Language: #{ENV[\"HTTP_ACCEPT_LANGUAGE\"]}\"\n }\n if $cgi[\"utmdebug\"] == \"\"\n OpenURI::open_uri(utm_url, options)\n else\n OpenURI::open_uri(utm_url, options) {|f| warn f.read }\n end\nend", "def get\n appid = ENV['TRIMET_APP_ID']\n response = Unirest.get( \"http://developer.trimet.org/ws/v2/vehicles?appid=#{appid}\" )\n response.body\nend", "def gt(action, params = {})\n get url_for(action), extract_request_params(params)\nend", "def index\n #pseudo scope \n if params[:phone] \n @agencies = Agency.find_by_phone(params[:phone]);\n if @agencies \n respond_to do |format|\n format.json { render :json => @agencies }\n format.xml { render :xml => @agencies }\n end \n else\n head :not_found\n end\n else\n # Aqui estoy haciendo que el api responda en mas de 1 formato\n @agencies = Agency.all\n respond_to do |format|\n format.json { render :json => @agencies }\n format.xml { render :xml => @agencies }\n end\n\n end \n end", "def routes\n routes = get('/gtfs/routes')\n routes.map do |route|\n Route.from_json(route)\n end\n end", "def parse_agencies(elem)\n #funding agency, detect country if Unknown\n agencies = elem.following_siblings()[0].search(\"li\")\n @agencies = []\n agencies.each { |agency| \n @agencies << agency.inner_html \n } \n end", "def fetch_bart_stations\n bart_url = 'http://bart.gov/dev/eta/bart_eta.xml'\n\n xml_data = Net::HTTP.get_response(URI.parse(bart_url)).body\n xml_doc = REXML::Document.new(xml_data)\n\n stations = xml_doc.records('station')\n stations.each_with_index do |station, index|\n etas = xml_doc.records(\"//station[#{index + 1}]/eta\")\n stations[index].merge!({ \"eta\" => etas })\n end\n \n return stations\nend", "def index\n # Fetch all the categories the current user has preferred.\n @agencies = UsersAgency.preferrence_of current_user\n render template: 'api/v1/agencies/index', locals: { current_user: current_user }, status: :ok\n\n end", "def fetch_bart_stations\n bart_url = 'http://bart.gov/dev/eta/bart_eta.xml'\n\n xml_data = Net::HTTP.get_response(URI.parse(bart_url)).body\n xml_doc = REXML::Document.new(xml_data)\n\n stations = xml_doc.records('station')\n stations.each_with_index do |station, index|\n etas = xml_doc.records(\"//station[#{index}]/eta\")\n stations[index].merge!({ \"eta\" => etas })\n end\n \n return stations\nend", "def agencies_get_statistics_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AgenciesApi.agencies_get_statistics ...'\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 AgenciesApi.agencies_get_statistics\"\n end\n if @api_client.config.client_side_validation && opts[:'time_period'] && !['last7Days', 'last90Days', 'wholeCampaign'].include?(opts[:'time_period'])\n fail ArgumentError, 'invalid value for \"time_period\", must be one of last7Days, last90Days, wholeCampaign'\n end\n if @api_client.config.client_side_validation && opts[:'status_filter'] && !['live', 'liveAndArchived'].include?(opts[:'status_filter'])\n fail ArgumentError, 'invalid value for \"status_filter\", must be one of live, liveAndArchived'\n end\n # resource path\n local_var_path = '/v1/agencies/{id}/statistics'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'timePeriod'] = opts[:'time_period'] if !opts[:'time_period'].nil?\n query_params[:'statusFilter'] = opts[:'status_filter'] if !opts[:'status_filter'].nil?\n query_params[:'pageNumber'] = opts[:'page_number'] if !opts[:'page_number'].nil?\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].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', 'text/json', 'text/html', 'application/xml', 'text/xml'])\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<DomainPublicAdapterWebApiModelsV1ListingsStatistics>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AgenciesApi#agencies_get_statistics\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def services\n Service.where(agency: agencies)\n end", "def opensearch\n respond_to do |format|\n format.xml do\n render :layout => false\n end\n format.json do\n render :json => get_opensearch_response\n end\n end\n end", "def index\n @feature_requests = FeatureRequest.all\n end", "def index\n @ganglia_graphs = GangliaGraph.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ganglia_graphs }\n end\n end", "def show\n @county = County.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.xml { render :xml => @county }\n format.xml { render :xml => @county.to_xml(:include => { :libraries => { :include => :departments } }) }\n end\n end", "def index\n # This should never be called, just used for debugging\n @emergencies = Emergency.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @emergencies }\n end\n end", "def activities_xml(time = nil, filter = nil)\n timestamp = time ? time.to_gnip_bucket_id : 'current'\n if filter\n _name, _endpoint = filter.name, \"#{self.uri}/#{filter.path}/activity/#{timestamp}.xml\"\n else\n _name, _endpoint = self.name, \"#{self.uri}/activity/#{timestamp}.xml\"\n end\n log_action(_name, time, timestamp)\n response, activities_xml = fetch(_endpoint)\n end", "def show\n @agile_task = AgileTask.find(params[:id])\n\n respond_to do |format|\n format.xml { render :xml => @agile_task }\n end\n end", "def index\n @tag_refs = TagRef.all\n end", "def index\n @st_has_deps = StHasDep.all\n end", "def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end", "def index\n @aoo_refs = AooRef.search(params, 50)\n end", "def api_xml(path,method=:get,options={})\n xml_message(amee,\"/data\"+path,method,options)\n end", "def get_organization_info\n path = \"/d2l/api/lp/#{$lp_ver}/organization/info\"\n _get(path)\n # return: Organization JSON block\nend", "def disp_xml_rq\n body= File.open(\"public/OTA/OTA_HotelAvailRQ100.xml\").read\n render :xml => body\n end", "def getAllTargetCollections()\n return sendHttpRequest(nil, \"GET\", @@PATH_ADD_TC)\n end", "def get_tracking_categories\n response_xml = http_get(\"#{xero_url}/tracking\")\n parse_response(response_xml) \n end", "def show\n @arc = Arc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @arc.to_xml(:except => [ :created_at, :updated_at ], :include => :tahs) }\n end\n end", "def path\n \"/onca/xml\"\n end", "def http_get(uri)\n conn = Net::HTTP.start(GCE_METADATA_ADDR)\n conn.read_timeout = 6\n conn.get(uri, {\n \"Metadata-Flavor\" => \"Google\",\n \"User-Agent\" => \"chef-ohai/#{Ohai::VERSION}\",\n })\n end", "def http_get(uri)\n conn = Net::HTTP.start(GCE_METADATA_ADDR)\n conn.read_timeout = 6\n conn.get(uri, {\n \"Metadata-Flavor\" => \"Google\",\n \"User-Agent\" => \"chef-ohai/#{Ohai::VERSION}\",\n }\n )\n end", "def to_xml\n self.xml ||= fetch({\"service\"=>self.service_type,\"metric\"=>self.metric,\"start\"=>self.sdate.to_s,\"end\"=>self.edate.to_s,\"artistID\"=>self.artist_id,\"apiKey\"=>$nbs_api_key,\"format\"=>\"xml\"})\n end", "def extractDatabase(type)\n Nokogiri::XML(IO.read(\"#{$path}../../databases/taxonomy.xml\")).xpath(\"//taxon[@label=\\\"#{type}\\\"]//file/@URL\").to_s\nend", "def opensearch\n respond_to do |format|\n format.xml do\n render :layout => false\n end\n format.json do\n render :json => get_opensearch_response\n end\n end\n end", "def get_client_summary_for_tenant(args = {}) \n get(\"/tenants.json/backoffice/clients/summary/#{args[:tenantId]}\", args)\nend", "def route_xml(route_id, query_params = nil)\n get(\"/routes/#{route_id}/xml\", query_params)\n end", "def get_resolved_incidents\n # use status of incident as a filter\n res = RestClient.get INCIDENT_QUERY_URL, :params => { :status => \"resolved\", :fields => \"incident_number\" }\n end", "def show\n @step = TaskrequestsStep.find(params[:taskrequests_step_id])\n @absence_request = @step.absence_requests.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @absence_request }\n end\n end", "def gather_issues\n url = \"#{URL}/projects/foreman/issues.json?status_id=1&limit=100&release_id=#{@current_release_id}\"\n puts url\n uri = URI(URI.escape(url))\n response = Net::HTTP.get(uri)\n JSON.parse(response)\nend", "def agencies_search(q, opts = {})\n data, _status_code, _headers = agencies_search_with_http_info(q, opts)\n data\n end", "def index\n @nodes = Node.all\n @title = \"List of taxonomy nodes - Browse organisms\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nodes }\n end\n end", "def index\n @entity_end_point_rels = EntityEndPointRel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entity_end_point_rels }\n end\n end", "def get\n @research_output = @service.get({type: params[:graph], detail: params[:detail], id: params[:id]},\n host: request.env[\"HTTP_HOST\"], limit: params[:num_results], offset: params[:start_offset], :per_project => params[:per_project], format: params[:format])\n\n respond_with @research_output\n end" ]
[ "0.58717054", "0.58518404", "0.5811786", "0.5714095", "0.5660901", "0.5581845", "0.55206776", "0.55132425", "0.54419893", "0.5418334", "0.53592414", "0.5325008", "0.53200316", "0.53065544", "0.5303332", "0.5287367", "0.5250927", "0.51807016", "0.51742536", "0.5090325", "0.50875837", "0.5026019", "0.5025961", "0.50117", "0.4997205", "0.4971636", "0.49689922", "0.49669886", "0.49511227", "0.49481672", "0.49473023", "0.49218008", "0.49067226", "0.48974648", "0.48948354", "0.48915035", "0.4889652", "0.4879179", "0.48744488", "0.48609543", "0.48534057", "0.48375273", "0.4821056", "0.48197335", "0.481118", "0.48081297", "0.48080352", "0.47919533", "0.4782028", "0.47782305", "0.47782305", "0.47777364", "0.47746065", "0.4737374", "0.4734689", "0.47282064", "0.47070685", "0.47066733", "0.4691422", "0.46912467", "0.4690715", "0.46770322", "0.46433878", "0.464217", "0.4640399", "0.46375135", "0.46300626", "0.46122932", "0.46113768", "0.46093395", "0.46076667", "0.46003324", "0.45983827", "0.45935035", "0.4587458", "0.4586266", "0.45759085", "0.45756066", "0.45740688", "0.4571395", "0.4570795", "0.4567095", "0.4564819", "0.45580012", "0.45551458", "0.45539615", "0.45488662", "0.45471093", "0.45460758", "0.45374018", "0.45311084", "0.45277497", "0.45242557", "0.45227948", "0.4521154", "0.4510504", "0.4508728", "0.4505894", "0.45039886", "0.4501651" ]
0.61627245
0
GET /gtfs_agencies/new GET /gtfs_agencies/new.xml
def new @gtfs_agency = GtfsAgency.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @gtfs_agency } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @gtfs_agency = GtfsAgency.new(params[:gtfs_agency])\n\n respond_to do |format|\n if @gtfs_agency.save\n format.html { redirect_to(@gtfs_agency, :notice => 'Gtfs agency was successfully created.') }\n format.xml { render :xml => @gtfs_agency, :status => :created, :location => @gtfs_agency }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @gtfs_agency.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @gene_ontology = GeneOntology.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gene_ontology }\n end\n end", "def new\n @gtfs_trip = GtfsTrip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gtfs_trip }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ontology }\n end\n end", "def new\n @step = TaskrequestsStep.find(params[:taskrequests_step_id])\n @absence_request = @step.absence_requests.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @absence_request }\n end\n end", "def new\n @gtd = Gtd.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gtd }\n end\n end", "def new\n @auditflows_flownode = AuditflowsFlownode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @auditflows_flownode }\n end\n end", "def new\n @gnode = Gnode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gnode }\n end\n end", "def new\n @tracker = Tracker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tracker }\n end\n end", "def new\n @feature_status = FeatureStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @feature_status }\n end\n end", "def new\n @location_tag = LocationTag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location_tag }\n end\n end", "def new\n @treq = Treq.new\n @treq = @treq.incrament(@treq)\n @treq_file = @treq.treq_files.build\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @treq }\n end\n end", "def new\n @node = Node.new\n @title = \"Taxonomy node - organism relationships\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @discovery = Discovery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @discovery }\n end\n end", "def create\n @gtfs_trip = GtfsTrip.new(params[:gtfs_trip])\n\n respond_to do |format|\n if @gtfs_trip.save\n format.html { redirect_to(@gtfs_trip, :notice => 'Gtfs trip was successfully created.') }\n format.xml { render :xml => @gtfs_trip, :status => :created, :location => @gtfs_trip }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @gtfs_trip.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @gpath = Gpath.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gpath }\n end\n end", "def create\n @gene_ontology = GeneOntology.new(params[:gene_ontology])\n\n respond_to do |format|\n if @gene_ontology.save\n format.html { redirect_to(@gene_ontology, :notice => 'Gene ontology was successfully created.') }\n format.xml { render :xml => @gene_ontology, :status => :created, :location => @gene_ontology }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @gene_ontology.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @lookup_set = LookupSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_set }\n end\n end", "def new\n @annotation_task = AnnotationTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @annotation_task }\n end\n end", "def create\n @gtd = Gtd.new(params[:gtd])\n\n respond_to do |format|\n if @gtd.save\n flash[:notice] = 'Gtd was successfully created.'\n format.html { redirect_to(@gtd) }\n format.xml { render :xml => @gtd, :status => :created, :location => @gtd }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @gtd.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @lookup_pettracer = LookupPettracer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_pettracer }\n end\n end", "def new\n @lookup_pettracer = LookupPettracer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_pettracer }\n end\n end", "def new\n @probe = Probe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @probe }\n end\n end", "def new\n @retain_node = RetainNode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @retain_node }\n format.json { render :json => @retain_node }\n end\n end", "def show\n @gtfs_agency = GtfsAgency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gtfs_agency }\n end\n end", "def new\n @req_breakdown = ReqBreakdown.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @req_breakdown }\n end\n end", "def new\n @lookup_source = LookupSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_source }\n end\n end", "def new\n @feature = Feature.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @feature }\n end\n end", "def new\n @projecttrack = Projecttrack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @projecttrack }\n end\n end", "def new\n @retain_node_selector = RetainNodeSelector.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @retain_node_selector }\n end\n end", "def new\n @graded_component = GradedComponent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @graded_component }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @agency }\n end\n end", "def new\n @old_route_tag = OldRouteTag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @old_route_tag }\n end\n end", "def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @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 @agency = Agency.new\n end", "def new\n @constituency = Constituency.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @constituency }\n end\n end", "def new\n @lookup_scantask = LookupScantask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_scantask }\n end\n end", "def new\n @annotation = Tate::Annotation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @annotation }\n end\n end", "def new\n @entity_end_point_rel = EntityEndPointRel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entity_end_point_rel }\n end\n end", "def new\n @usage_status = UsageStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @usage_status }\n end\n end", "def new\n @range_specification = RangeSpecification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @range_specification }\n end\n end", "def new\n @tso = Tso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tso }\n end\n end", "def new\n @genome_reference = GenomeReference.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @genome_reference }\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 @node_incident = NodeIncident.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @node_incident }\n end\n end", "def new_rest\n @page_usage_event = PageUsageEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page_usage_event }\n end\n end", "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @goaltemplate = Goaltemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @goaltemplate }\n end\n end", "def new\n @agency_type = AgencyType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @agency_type }\n end\n end", "def create_url\n \"#{api_url}/gists\"\n end", "def new\n @nagios_service_escalation_template = NagiosServiceEscalationTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nagios_service_escalation_template }\n end\n end", "def create\n expire_page :action => :index\n expire_page :action => :show\n \n @ganglia_graph = GangliaGraph.new(params[:ganglia_graph])\n\n respond_to do |format|\n if @ganglia_graph.save\n format.html { redirect_to(@ganglia_graph, :notice => 'Ganglia Graph was successfully created.') }\n format.xml { render :xml => @ganglia_graph, :status => :created, :location => @ganglia_graph }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ganglia_graph.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @agency_relationship = AgencyRelationship.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def new\n @assettrack = Assettrack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @assettrack }\n end\n end", "def new\n expire_page :action => :index\n expire_page :action => :show\n \n @ganglia_graph = GangliaGraph.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ganglia_graph }\n end\n end", "def new\n @assistance_list = AssistanceList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @assistance_list }\n end\n end", "def new\n @tstat = Tstat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tstat }\n end\n end", "def new\n @pdig = Pdig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pdig }\n end\n end", "def new\n @hr_attendence = Hr::Attendence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hr_attendence }\n end\n end", "def new\n @ref = Ref.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ref }\n end\n end", "def new\n @traffic = Traffic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @traffic }\n end\n end", "def new\n @trip_feature = TripFeature.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trip_feature }\n end\n end", "def new\n @lookup_demographichandedness = LookupDemographichandedness.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_demographichandedness }\n end\n end", "def new\n @distribution = @foyer.distributions.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @distribution }\n end\n end", "def new\n @rg_task = RgTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rg_task }\n end\n end", "def new\n @taxonomy_term = TaxonomyTerm.new\n\tset_site_entities @taxonomy_term\n\t\n\trespond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taxonomy_term }\n end\n end", "def new\n @mt_distribution = MtDistribution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mt_distribution }\n end\n end", "def new\n @feat = @person.feats.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @feat }\n end\n end", "def new\n @rest_service = RestService.new\n params[:annotations] = { }\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rest_service }\n end\n end", "def new\n @provider = Provider.new\n @provider.locations.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provider }\n end\n end", "def new\n @prd_threshold = PrdThreshold.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prd_threshold }\n end\n end", "def new\n @reqinfo = Reqinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reqinfo }\n end\n end", "def new\n @specification = Specification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @specification }\n end\n end", "def new\n @goal = Mg::Goal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @goal }\n end\n end", "def new\n @subway = Subway.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @subway }\n end\n end", "def new\n @newtype = params[:newtype]\n @ptbudget = Ptbudget.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ptbudget }\n end\n end", "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @location_region }\n end\n end", "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @get_started_page }\n end\n end", "def new\n @partyrelationship = Partyrelationship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @partyrelationship }\n end\n end", "def new\n @old_point_tag = OldPointTag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @old_point_tag }\n end\n end", "def new\n @travel_fix = TravelFix.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @travel_fix }\n end\n end", "def new\n @trace = Trace.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trace }\n end\n end", "def new\n @lookup_demographicrelativerelationship = LookupDemographicrelativerelationship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_demographicrelativerelationship }\n end\n end", "def new\n @encyclopaedia = Encyclopaedia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @encyclopaedia }\n end\n end", "def new\n @force = Force.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @force }\n end\n end", "def new\n @resource_allocation = ResourceAllocation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource_allocation }\n end\n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @location }\n end\n end", "def new\n @mt_use_additional_energy_data = MtUseAdditionalEnergyData.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mt_use_additional_energy_data }\n end\n end", "def new\n @ptbudget = Ptbudget.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ptbudget }\n end\n end", "def new\n @requirement = Requirement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @requirement }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @download_registration }\n end\n end", "def new\n @event = Event.find(params[:event_id])\n @term = Term.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @term }\n end\n end", "def create\n @gnode = Gnode.new(params[:gnode])\n\n respond_to do |format|\n if @gnode.save\n format.html { redirect_to @gnode, notice: 'Gnode was successfully created.' }\n format.json { render json: @gnode, status: :created, location: @gnode }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gnode.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @track = Track.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @track }\n end\n end", "def new\n @track = Track.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @track }\n end\n end", "def new\n @tracked_action = TrackedAction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tracked_action }\n end\n end", "def new_rest\n @item_usage = ItemUsage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_usage }\n end\n end", "def new\n @frequencia_orgao = Frequencia::Orgao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @frequencia_orgao }\n end\n end" ]
[ "0.67938685", "0.6025093", "0.59955025", "0.57807696", "0.57473403", "0.5719189", "0.5705475", "0.56247216", "0.56038046", "0.55940866", "0.55797917", "0.5557403", "0.5554469", "0.55422163", "0.55147487", "0.5513282", "0.55113035", "0.54881865", "0.5485803", "0.5472135", "0.54612577", "0.54611707", "0.54377866", "0.54262835", "0.5418747", "0.5413678", "0.54040164", "0.54031235", "0.5393802", "0.53911257", "0.53885317", "0.53880936", "0.536792", "0.53654283", "0.53614664", "0.5358336", "0.53433186", "0.53396666", "0.5331081", "0.5328199", "0.5327362", "0.5324159", "0.5323138", "0.53210306", "0.5310824", "0.53100514", "0.5304589", "0.53015244", "0.53015244", "0.52980167", "0.52977157", "0.5297007", "0.52958524", "0.5290357", "0.5286366", "0.5277545", "0.52717036", "0.5264548", "0.52638155", "0.52586627", "0.52584654", "0.52571", "0.5255828", "0.52501434", "0.5248266", "0.5244675", "0.5241037", "0.52396274", "0.52348703", "0.5232666", "0.5227676", "0.5226521", "0.5224078", "0.52240413", "0.5222431", "0.5220415", "0.5218066", "0.52172333", "0.52165246", "0.5211889", "0.5205902", "0.52055264", "0.5198767", "0.51927614", "0.5185336", "0.51829207", "0.5182783", "0.5180631", "0.5180588", "0.51765853", "0.51755565", "0.5170854", "0.51660806", "0.51637715", "0.5161767", "0.5160492", "0.5160492", "0.5160083", "0.51518655", "0.51518464" ]
0.69585145
0
POST /gtfs_agencies POST /gtfs_agencies.xml
def create @gtfs_agency = GtfsAgency.new(params[:gtfs_agency]) respond_to do |format| if @gtfs_agency.save format.html { redirect_to(@gtfs_agency, :notice => 'Gtfs agency was successfully created.') } format.xml { render :xml => @gtfs_agency, :status => :created, :location => @gtfs_agency } else format.html { render :action => "new" } format.xml { render :xml => @gtfs_agency.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tafs(params={})\n perform_get('/tafs.xml', params)\n end", "def new\n @gtfs_agency = GtfsAgency.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gtfs_agency }\n end\n end", "def index\n @agencies = Agency.all\n end", "def destroy\n @gtfs_agency = GtfsAgency.find(params[:id])\n @gtfs_agency.destroy\n\n respond_to do |format|\n format.html { redirect_to(gtfs_agencies_url) }\n format.xml { head :ok }\n end\n end", "def update\n @gtfs_agency = GtfsAgency.find(params[:id])\n\n respond_to do |format|\n if @gtfs_agency.update_attributes(params[:gtfs_agency])\n format.html { redirect_to(@gtfs_agency, :notice => 'Gtfs agency was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @gtfs_agency.errors, :status => :unprocessable_entity }\n end\n end\n end", "def agencies_create_test_agency_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AgenciesApi.agencies_create_test_agency ...'\n end\n # resource path\n local_var_path = '/v1/agencies/_testAgency'\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', 'text/json', 'text/html', 'application/xml', 'text/xml'])\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(: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 => 'DomainAgencyServiceV2ModelAgency')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AgenciesApi#agencies_create_test_agency\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def postEntityAdvertiserTag( gen_id, entity_id, language, tags_to_add, tags_to_remove)\n params = Hash.new\n params['gen_id'] = gen_id\n params['entity_id'] = entity_id\n params['language'] = language\n params['tags_to_add'] = tags_to_add\n params['tags_to_remove'] = tags_to_remove\n return doCurl(\"post\",\"/entity/advertiser/tag\",params)\n end", "def create\n @tenancy_agreement = TenancyAgreement.new(params[:tenancy_agreement])\n @tenancy_agreement.estate_agent_id = current_user.estate_agent_id\n respond_to do |format|\n if @tenancy_agreement.save\n format.html { redirect_to tenancy_agreements_path, notice: 'Tenancy agreement was successfully created.' }\n format.json { render json: @tenancy_agreement, status: :created, location: @tenancy_agreement }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tenancy_agreement.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @agency = Agency.new(agency_params)\n if @agency.save\n @agency = Agency.new\n @agencies = Agency.all\n @flag = true\n else\n @flag = false\n end\n end", "def agency_params\n params.require(:agency).permit(:name,\n :agycode,\n :photo,\n :description,\n :restrictions,\n :hours_of_operation,\n :address_id,\n :contact_name,\n :contact_phone,\n :contact_email,\n :services,\n :geographic_restrictions,\n :family_stipulations,\n :faith_based,\n :is_active,\n :general_information,\n { :service_ids => [] },\n address_attributes: [:id, :street_line_1, :street_line_2, :city, :state, :zip])\n end", "def create\n @agency = Agency.new(agency_params)\n\n if @agency.save\n render json: @agency, status: :created, location: @agency\n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end", "def create\n @gtd = Gtd.new(params[:gtd])\n\n respond_to do |format|\n if @gtd.save\n flash[:notice] = 'Gtd was successfully created.'\n format.html { redirect_to(@gtd) }\n format.xml { render :xml => @gtd, :status => :created, :location => @gtd }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @gtd.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @agencies = current_user.agencies.all\n end", "def agencies_create_test_agency(opts = {})\n data, _status_code, _headers = agencies_create_test_agency_with_http_info(opts)\n data\n end", "def index\n @registering_agencies = RegisteringAgency.all\n end", "def agencies_search_with_http_info(q, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AgenciesApi.agencies_search ...'\n end\n # verify the required parameter 'q' is set\n if @api_client.config.client_side_validation && q.nil?\n fail ArgumentError, \"Missing the required parameter 'q' when calling AgenciesApi.agencies_search\"\n end\n # resource path\n local_var_path = '/v1/agencies'\n\n # query parameters\n query_params = {}\n query_params[:'q'] = q\n query_params[:'pageNumber'] = opts[:'page_number'] if !opts[:'page_number'].nil?\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].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', 'text/json', 'text/html', 'application/xml', 'text/xml'])\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<DomainAgencyServiceV2ModelAgencySummary>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AgenciesApi#agencies_search\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def import_taxonomy\n\n parser = XML::Parser.file(@taxonomy_file_full_path, :encoding => XML::Encoding::UTF_8)\n taxonomy_document = parser.parse\n\n # root node\n root_node = taxonomy_document.find_first('//taxonomy_name')\n @taxonomy.add_node('0', root_node.content, nil)\n @logger.debug \"Root: #{root_node.content}\"\n\n # parsing the taxonomy doc into my Taxonomy class\n taxonomy_document.find('//node').each do |node|\n\n @logger.debug \"Node: #{node.attributes['atlas_node_id']}\"\n\n if node.children?\n\n node_id = node.attributes['atlas_node_id']\n node_name = node.find_first('./node_name').content\n @taxonomy.add_node(node_id, node_name, '0')\n\n node.find('./node').each do |child|\n\n @logger.debug \"Child #{child.attributes['atlas_node_id']}\"\n\n child_id = child.attributes['atlas_node_id']\n child_name = child.find_first('./node_name').content\n @taxonomy.add_node(child_id, child_name, node_id)\n\n end\n\n end\n\n end\n\n end", "def get_gtdb_taxonomy\n gtdb_genome = metadata[:gtdb_assembly] or return\n\n doc = MiGA::Json.parse(\n MiGA::RemoteDataset.download(\n :gtdb, :genome, gtdb_genome, 'taxon-history', nil, ['']\n ),\n contents: true\n )\n lineage = { ns: 'gtdb' }\n lineage.merge!(doc.first) # Get only the latest available classification\n release = lineage.delete(:release)\n @metadata[:gtdb_release] = release\n lineage.transform_values! { |v| v.gsub(/^\\S__/, '') }\n MiGA.DEBUG \"Got lineage from #{release}: #{lineage}\"\n MiGA::Taxonomy.new(lineage)\n end", "def generate_tags\n uri = URI.parse(\"https://api.thomsonreuters.com/permid/calais\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n post_body = []\n post_body << \"<Document><Body>\"\n # stip html\n post_body << ActionView::Base.full_sanitizer.sanitize(params[:desc])\n # no strip\n # post_body << params[:desc]\n post_body << \"</Body></Document>\"\n request = Net::HTTP::Post.new(uri.request_uri)\n request.add_field(\"Content-Type\",\"text/xml\")\n request.add_field(\"outputFormat\",\"application/json\")\n #request.add_field(\"outputFormat\",\"text/n3\") \n request.add_field(\"x-ag-access-token\",\"fY7WUM3GGCXHm9ATOhtzhrvlWX8oPo5X\")\n request.body = post_body.join\n # request[\"Content-Type\"] = \"multipart/form-data, boundary=#{BOUNDARY}\"\n\n render :json => http.request(request).body\n end", "def add_agency_link\n self.get_element(@browser, '//a[contains(@href, \"/insertion_orders_organizations_agencies/create?insertion_orders.id=\")]')\n end", "def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend", "def create\n @agency = Agency.new(agency_params)\n\n if @agency.save\n render json: @agency, status: :created, location: @agency\n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end", "def show\n @gtfs_agency = GtfsAgency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gtfs_agency }\n end\n end", "def postEntityAdvertiserCreate( entity_id, tags, locations, max_tags, max_locations, expiry_date, is_national, language, reseller_ref, reseller_agent_id, publisher_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['tags'] = tags\n params['locations'] = locations\n params['max_tags'] = max_tags\n params['max_locations'] = max_locations\n params['expiry_date'] = expiry_date\n params['is_national'] = is_national\n params['language'] = language\n params['reseller_ref'] = reseller_ref\n params['reseller_agent_id'] = reseller_agent_id\n params['publisher_id'] = publisher_id\n return doCurl(\"post\",\"/entity/advertiser/create\",params)\n end", "def to_rdf(format, options = {})\n \n # TODO: type of tagging\n \n httpURI = options[:httpURI] ||= \"http://example.com/missingBaseURI\"\n host = options[:host] ||= \"http://maphub.info\"\n \n # Defining the custom vocabulary # TODO: move this to separate lib\n oa_uri = RDF::URI('http://www.w3.org/ns/openannotation/core/')\n oa = RDF::Vocabulary.new(oa_uri)\n oax_uri = RDF::URI('http://www.w3.org/ns/openannotation/extensions/')\n oax = RDF::Vocabulary.new(oax_uri)\n maphub_uri = RDF::URI('http://maphub.info/ns/vocab#')\n maphub = RDF::Vocabulary.new(maphub_uri)\n foaf_uri = RDF::URI('http://xmlns.com/foaf/spec/')\n foaf = RDF::Vocabulary.new(foaf_uri)\n dcterms_uri = RDF::URI('http://purl.org/dc/dcmitype/')\n dcterms = RDF::Vocabulary.new(dcterms_uri)\n dc_uri = RDF::URI('http://purl.org/dc/elements/1.1/')\n dc = RDF::Vocabulary.new(dc_uri)\n \n # Building the annotation graph\n baseURI = RDF::URI.new(httpURI)\n graph = RDF::Graph.new\n graph << [baseURI, RDF.type, oa.Annotation]\n graph << [baseURI, RDF.type, oax.Tagging]\n graph << [baseURI, RDF.type, maphub.GeoReference]\n unless self.created_at.nil?\n graph << [\n baseURI,\n oa.annotated, \n RDF::Literal.new(self.created_at, :datatype => RDF::XSD::dateTime)]\n end\n unless self.updated_at.nil?\n graph << [\n baseURI,\n oa.generated, \n RDF::Literal.new(self.updated_at, :datatype => RDF::XSD::dateTime)]\n end\n graph << [baseURI, oa.generator, RDF::URI(host)]\n \n # Adding user and provenance data\n user_uuid = UUIDTools::UUID.timestamp_create().to_s\n user_node = RDF::URI.new(user_uuid)\n graph << [baseURI, oa.annotator, user_node]\n graph << [user_node, foaf.mbox, RDF::Literal.new(self.user.email)]\n graph << [user_node, foaf.name, RDF::Literal.new(self.user.username)]\n\n \n # Adding the body\n unless self.geonames_uri.nil?\n graph << [baseURI, oax.hasSemanticTag, RDF::URI(self.geonames_uri)] \n end\n\n # Adding the target\n specific_target_uuid = UUIDTools::UUID.timestamp_create().to_s\n specific_target = RDF::URI.new(specific_target_uuid)\n graph << [baseURI, oa.hasTarget, specific_target]\n graph << [specific_target, RDF.type, oa.SpecificResource]\n source_node = RDF::URI.new(self.map.raw_image_uri)\n graph << [specific_target, oa.hasSource, source_node]\n \n # Source details\n graph << [source_node, RDF.type, dcterms.StillImage]\n graph << [source_node, dc.format, \"image/jp2\"]\n \n # the Point selector\n point_selector_uuid = UUIDTools::UUID.timestamp_create().to_s\n point_selector_node = RDF::URI.new(point_selector_uuid)\n graph << [specific_target, oa.hasSelector, point_selector_node]\n graph << [point_selector_node, RDF.type, oa.FragmentSelector]\n graph << [point_selector_node, RDF.value, self.fragment]\n \n # Serializing RDF graph to string\n RDF::Writer.for(format.to_sym).buffer do |writer|\n writer.prefix :dcterms, RDF::URI('http://purl.org/dc/terms/')\n writer.prefix :oa, oa_uri\n writer.prefix :oax, oax_uri\n writer.prefix :rdf, RDF::URI(RDF.to_uri)\n writer.prefix :maphub, maphub_uri\n writer.prefix :foaf, foaf_uri\n writer.prefix :dcterms, dcterms_uri\n writer.prefix :dc, dc_uri\n writer << graph\n end\n \n end", "def create\n @gene_ontology = GeneOntology.new(params[:gene_ontology])\n\n respond_to do |format|\n if @gene_ontology.save\n format.html { redirect_to(@gene_ontology, :notice => 'Gene ontology was successfully created.') }\n format.xml { render :xml => @gene_ontology, :status => :created, :location => @gene_ontology }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @gene_ontology.errors, :status => :unprocessable_entity }\n end\n end\n end", "def taf(id)\n perform_get(\"/tafs/#{id}.xml\")\n end", "def show\n @agencies = Agency.find(params[:id])\n\n if @agencies \n respond_to do |format|\n format.json { render :json => @agencies }\n format.xml { render :xml => @agencies }\n end \n else\n head :not_found\n end\n end", "def create_taxonomy(rid, add_params = nil)\n params = {\n uid: uid,\n rid: rid,\n }\n api_call('/stores/:uid/taxonomies/:rid(.:format)',:post,params,add_params)\n end", "def show\n @agencies = Agency.find(params[:id])\n\n if @agencies \n respond_to do |format|\n format.json { render :json => @agencies }\n format.xml { render :xml => @agencies }\n end \n else\n head :not_found\n end\n end", "def add_arrays_to_tenant(args = {}) \n post(\"/tenants.json/#{args[:tenantId]}/arrays\", args)\nend", "def gtag_params\n params.require(:gtag).permit(:tag_uid, :banned, :customer_id, :redeemed, :ticket_type_id)\n end", "def agencies\n Agency.where(id: transportation_agencies.pluck(:id) + oversight_agencies.pluck(:id))\n end", "def get_agencies\n @type = params[:value]\n agencies= Agency.where(:deleted => false)\n render :layout => false \n end", "def create\n @gtfs_trip = GtfsTrip.new(params[:gtfs_trip])\n\n respond_to do |format|\n if @gtfs_trip.save\n format.html { redirect_to(@gtfs_trip, :notice => 'Gtfs trip was successfully created.') }\n format.xml { render :xml => @gtfs_trip, :status => :created, :location => @gtfs_trip }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @gtfs_trip.errors, :status => :unprocessable_entity }\n end\n end\n end", "def agency_params\n params.require(:agency).permit( :name, :phone, :contact_name, :contact_email, :address, :latitude, :longitude, :website_url, :num_employees, :golden_pitch, :silver_pitch, :medium_risk_pitch, :high_risk_pitch, :agency )\n end", "def build_xml\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.TrackRequest(:xmlns => \"http://fedex.com/ws/track/v5\"){\n add_web_authentication_detail(xml)\n add_client_detail(xml)\n add_version(xml)\n # add_request_timestamp(xml)\n add_track_request(xml)\n }\n end\n builder.doc.root.to_xml\n end", "def output_tax(refseq_data)\n rs = refseq_data\n taxid = rs[:taxid]\n gene_label_url = URI.escape(rs[:gene_label])\n\n $output_ttl.puts triple(\"<http://togogenome.org/gene/#{taxid}:#{gene_label_url}>\", \"rdfs:seeAlso\", \"tax:#{rs[:taxid]}\") unless $gene_list[rs[:gene_rsrc]]\n $output_ttl.puts triple(\"<http://togogenome.org/gene/#{taxid}:#{gene_label_url}>\", \"skos:exactMatch\", \"<http://identifiers.org/refseq/#{rs[:gene_rsrc]}>\") unless $gene_list[rs[:gene_rsrc]]\n $output_ttl.puts triple(\"tax:#{rs[:taxid]}\", \"rdf:type\", \"<http://identifiers.org/taxonomy>\") unless $tax_type_list[rs[:taxid]]\n $tax_type_list[rs[:taxid]] = true # to prevent duplicate output\n $gene_list[rs[:gene_rsrc]] = true # to prevent duplicate output\nend", "def index\n @agencies = Agency.where(:status => 'Y').paginate(:page => params[:page], :per_page => 10)\n end", "def create\n @agency = Agency.new(agency_params)\n\n respond_to do |format|\n if @agency.save\n format.html { redirect_to @agency, notice: \"Agency was successfully created.\" }\n format.json { render :show, status: :created, location: @agency }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @agency.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/loan/v1\")\n end", "def route_geosearch\n get '/gtfs/routes/geosearch/'\n end", "def sfa_advertisement_xml(resources, opts = {})\n doc = Nokogiri::XML::Document.new\n #<rspec expires=\"2011-09-13T09:07:09Z\" generated=\"2011-09-13T09:07:09Z\" type=\"advertisement\" xmlns=\"http://www.protogeni.net/resources/rspec/2\" xmlns:emulab=\"http://www.protogeni.net/resources/rspec/ext/emulab/1\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.protogeni.net/resources/rspec/2 http://www.protogeni.net/resources/rspec/2/ad.xsd http://www.protogeni.net/resources/rspec/ext/emulab/1 http://www.protogeni.net/resources/rspec/ext/emulab/1/ptop_extension.xsd http://company.com/rspec/ext/stitch/1 http://company.com/rspec/ext/stitch/1/ad.xsd \"> \n root = doc.add_child(Nokogiri::XML::Element.new('rspec', doc))\n root.add_namespace(nil, \"http://www.protogeni.net/resources/rspec/2\")\n @@sfa_namespaces.each do |prefix, urn|\n root.add_namespace(prefix.to_s, urn)\n end\n\n root.set_attribute('type', \"advertisement\")\n now = Time.now\n root.set_attribute('generated', now.iso8601)\n root.set_attribute('expires', (now + (opts[:valid_for] || 600)).iso8601)\n\n #root = doc.create_element('rspec', doc)\n #doc.add_child root\n obj2id = {}\n _to_sfa_xml(resources, root, obj2id, opts) \n end", "def build_tracking_xml_request\n xml = \"\"\n\n builder = ::Builder::XmlMarkup.new :target => xml \n builder.TrackRequest :USERID => config.user_id do |t|\n t.TrackID :ID => package_id\n end\n\n xml\n end", "def postEntityAdvertiserUpsell( entity_id, tags, locations, extra_tags, extra_locations, is_national, language, reseller_ref, reseller_agent_id, publisher_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['tags'] = tags\n params['locations'] = locations\n params['extra_tags'] = extra_tags\n params['extra_locations'] = extra_locations\n params['is_national'] = is_national\n params['language'] = language\n params['reseller_ref'] = reseller_ref\n params['reseller_agent_id'] = reseller_agent_id\n params['publisher_id'] = publisher_id\n return doCurl(\"post\",\"/entity/advertiser/upsell\",params)\n end", "def build_request\n b = builder\n xml = b.TrackRequest(:xmlns => \"http://fedex.com/ws/track/v#{VERSION[:major]}\") do\n build_authentication(b)\n build_version(b, \"trck\", VERSION[:major], VERSION[:intermediate], VERSION[:minor])\n \n b.PackageIdentifier do\n b.Value tracking_number\n b.Type \"TRACKING_NUMBER_OR_DOORTAG\"\n end\n \n b.IncludeDetailedScans true\n end\n end", "def post_report dep_name, user, vars, log\n require 'net/http'\n require 'uri'\n\n returning(Net::HTTP.post_form(\n URI.parse('http://gist.github.com/api/v1/xml/new'),\n {\n \"files[from]\" => user,\n \"files[vars.yml]\" => vars,\n \"files[#{dep_name}.log]\" => log.decolorize\n }\n )) do |response|\n report_report_result dep_name, response\n end.is_a? Net::HTTPSuccess\n end", "def agency_params\n params.require(:agency).permit(:title, :reg_number, :address, :phone, :status)\n end", "def create\n if params['cancel']\n redirect_to agencies_url and return\n end\n @agency = Agency.new(agencies_params)\n @agency.updated_by = current_user.login\n\n publication = Publication.new(publication_params)\n @agency.publications << publication unless publication.empty?\n\n #@agency.build_restriction\n #@agency.restriction.update_attributes(params[:restriction])\n #@agency.restriction.states=params[:state_abbrevs].collect{|s| State.find(s)} unless params[:state_abbrevs].to_s.blank?\n #@agency.restriction.counties=params[:county_ids].collect{|c| County.find(c)} unless params[:county_ids].nil?\n #@agency.restriction.cities=params[:city_ids].collect{|c| City.find(c)} unless params[:city_ids].nil?\n #@agency.restriction.zips=params[:zip_ids].collect{|c| Zip.find(c)} unless params[:zip_ids].nil?\n\n #composed_of fields must be created manually\n update_pha_contact\n\n if @agency.save\n flash[:notice] = 'Agency was successfully created.'\n redirect_to agencies_url() and return if params['update_and_return']\n redirect_to edit_agency_url(@agency)\n else\n render :action => \"new\"\n end\n end", "def build_tracking_request(order_ids, options)\n xml = Builder::XmlMarkup.new :indent => 2\n xml.instruct!\n xml.tag! 'TrackingXML' do\n add_credentials(xml)\n\n order_ids.each do |o_id|\n xml.tag! 'Tracking' do\n xml.tag! 'Order', o_id\n end\n end\n end\n end", "def set_gtag\n gtags = @current_event.gtags\n\n Rollbar.silenced do\n gtag_id = gtags.find_by(id: params[:id])&.id || gtags.find_by(tag_uid: params[:id])&.id\n\n @gtag = gtags.find(gtag_id)\n authorize @gtag\n end\n end", "def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/investmentaccount/v1\")\n end", "def create\n @gnode = Gnode.new(params[:gnode])\n\n respond_to do |format|\n if @gnode.save\n format.html { redirect_to @gnode, notice: 'Gnode was successfully created.' }\n format.json { render json: @gnode, status: :created, location: @gnode }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gnode.errors, status: :unprocessable_entity }\n end\n end\n end", "def agency_params\n params.require(:agency).permit(I18n.t('agencies_controller.agency_params').map(&:to_sym))\n end", "def create_legacy_ingest_payload( rt_overrides, dirname, solr_doc, fedora_doc )\n\n\n payload = {}\n\n #\n # add all the required fields\n #\n\n # date and time attributes\n create_date = solr_doc.at_path( 'system_create_dt' )\n payload[ :create_date ] = create_date if create_date.present?\n modified_date = solr_doc.at_path( 'system_modified_dt' )\n payload[ :modified_date ] = modified_date if modified_date.present?\n\n # resource type\n rt = determine_resource_type( rt_overrides, solr_doc )\n payload[ :resource_type ] = rt if rt.present?\n\n # title\n title = extract_title( payload, solr_doc, fedora_doc )\n payload[ :title ] = title if title.present?\n\n # abstract\n abstract = extract_abstract( payload, solr_doc, fedora_doc )\n payload[ :abstract ] = abstract if abstract.present?\n\n # author\n payload[ :authors ] = []\n author_number = 0\n while true\n added, payload[ :authors ] = add_author( solr_doc, author_number, payload[ :authors ] )\n break unless added\n author_number += 1\n end\n\n # document contributor\n payload[ :contributors ] = []\n contributor_number = 0\n while true\n added, payload[ :contributors ] = add_contributor( solr_doc, contributor_number, payload[ :contributors ] )\n break unless added\n contributor_number += 1\n end\n\n # issue date\n issued_date = extract_issued_date( payload, solr_doc, fedora_doc )\n payload[ :issued ] = issued_date if issued_date.present?\n\n # embargo attributes\n embargo_type = IngestHelpers.solr_first_field_extract(solr_doc, 'release_to_t' )\n payload[ :embargo_type ] = embargo_type if embargo_type.present?\n release_date = IngestHelpers.solr_first_field_extract(solr_doc, 'embargo_embargo_release_date_t' )\n payload[ :embargo_release_date ] = release_date if release_date.present?\n\n # document work source\n payload[ :work_source ] = solr_doc.at_path( 'id' )\n\n # related URL's\n related_urls = extract_related_url( payload, solr_doc, fedora_doc )\n payload[ :related_url ] = related_urls if related_urls.present?\n\n # sponsoring agency\n agencies = extract_sponsoring_agency( payload, solr_doc, fedora_doc )\n payload[:sponsoring_agency] = agencies if agencies.present?\n\n #\n # handle optional fields\n #\n\n # keywords\n keywords = solr_doc.at_path( 'subject_topic_t' )\n payload[ :keywords ] = keywords if keywords.present?\n\n # language\n languages = IngestHelpers.solr_all_field_extract(solr_doc, 'language_lang_code_t' )\n languages = languages.map { |l| IngestHelpers.language_code_lookup( l ) } if languages.present?\n payload[ :language ] = languages if languages.present?\n\n # notes\n notes = extract_notes( payload, solr_doc, fedora_doc )\n payload[ :notes ] = notes if notes.present?\n\n # publisher attributes\n publisher = extract_publisher( payload, solr_doc, fedora_doc )\n payload[ :publisher ] = publisher if publisher.present?\n publish_location = extract_publish_location( payload, solr_doc, fedora_doc )\n payload[ :publish_location ] = publish_location if publish_location.present?\n publish_date = extract_publish_date( payload, solr_doc, fedora_doc )\n payload[ :publish_date ] = publish_date if publish_date.present?\n\n # ISBN & ISSN\n isbn = extract_isbn( payload, solr_doc, fedora_doc )\n payload[ :isbn ] = isbn if isbn.present?\n issn = extract_issn( payload, solr_doc, fedora_doc )\n payload[ :issn ] = issn if issn.present?\n\n # conference attributes\n conference_title = extract_conference_name( payload, solr_doc, fedora_doc )\n payload[ :conference_title ] = conference_title if conference_title.present?\n conference_location = extract_conference_location( payload, solr_doc, fedora_doc )\n payload[ :conference_location ] = conference_location if conference_location.present?\n conference_date = extract_conference_date( payload, solr_doc, fedora_doc )\n payload[ :conference_date ] = conference_date if conference_date.present?\n\n # page attributes\n start_page = extract_start_page( payload, solr_doc, fedora_doc )\n payload[ :start_page ] = start_page if start_page.present?\n end_page = extract_end_page( payload, solr_doc, fedora_doc )\n payload[ :end_page ] = end_page if end_page.present?\n\n # journal attributes\n journal_title = extract_journal_name( payload, solr_doc, fedora_doc )\n payload[ :journal_title ] = journal_title if journal_title.present?\n journal_volume = extract_journal_volume( payload, solr_doc, fedora_doc )\n payload[ :journal_volume ] = journal_volume if journal_volume.present?\n journal_issue = extract_journal_issue( payload, solr_doc, fedora_doc )\n payload[ :journal_issue ] = journal_issue if journal_issue.present?\n journal_year = extract_journal_year( payload, solr_doc, fedora_doc )\n payload[ :journal_publication_year ] = journal_year if journal_year.present?\n\n # edited book attributes\n payload[ :editors ] = []\n editor_number = 0\n while true\n added, payload[ :editors ] = add_editor( solr_doc, editor_number, payload[ :editors ] )\n break unless added\n editor_number += 1\n end\n\n # special case...\n if payload[ :publish_date ].blank? && payload[:conference_date].present?\n payload[ :publish_date ] = payload[:conference_date]\n end\n\n # construct the citation\n payload[ :citation ] = CitationHelpers.construct( payload )\n\n return payload\n end", "def index\n @otf_lookups = OtfLookup.all(:include => :feature)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @otf_lookups }\n end\n end", "def postEntityGeopoint( entity_id, longitude, latitude, accuracy)\n params = Hash.new\n params['entity_id'] = entity_id\n params['longitude'] = longitude\n params['latitude'] = latitude\n params['accuracy'] = accuracy\n return doCurl(\"post\",\"/entity/geopoint\",params)\n end", "def create\n @location_tag = LocationTag.new(params[:location_tag])\n\n respond_to do |format|\n if @location_tag.save\n flash[:notice] = 'Location tag was successfully created.' \n format.html { redirect_to (location_tags_path(:farm_id => @farm.id))}\n format.xml { render :xml => @location_tag, :status => :created, :location => @location_tag }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @location_tag.errors, :status => :unprocessable_entity }\n end\n end\n end", "def build_xml\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.PickupAvailabilityRequest(:xmlns => \"http://fedex.com/ws/pickup/v5\"){\n add_web_authentication_detail(xml)\n add_client_detail(xml)\n add_version(xml)\n add_pickup_address(xml)\n }\n end\n builder.doc.root.to_xml\n end", "def create\n @environmental_subtag = EnvironmentalSubtag.new(environmental_subtag_params)\n\n respond_to do |format|\n if @environmental_subtag.save\n format.html { redirect_to @environmental_subtag, notice: 'Environmental subtag was successfully created.' }\n format.json { render :show, status: :created, location: @environmental_subtag }\n else\n format.html { render :new }\n format.json { render json: @environmental_subtag.errors, status: :unprocessable_entity }\n end\n end\n end", "def agency_params\n params.require(:agency).permit(:code, :name, :description, :is_active)\n end", "def alltags\n tag_context = params[:context] # tag context\n @tags = TagsService.tag_counts_on(SurveyRespondent, tag_context)\n \n respond_to do |format|\n format.xml\n end\n end", "def parse_agencies(elem)\n #funding agency, detect country if Unknown\n agencies = elem.following_siblings()[0].search(\"li\")\n @agencies = []\n agencies.each { |agency| \n @agencies << agency.inner_html \n } \n end", "def create\n @step = TaskrequestsStep.find(params[:taskrequests_step_id])\n @absence_request = @step.absence_requests.build(params[:absence_request])\n\n respond_to do |format|\n if @absence_request.save\n format.html { redirect_to taskrequest_process_step_url(@step.taskrequest), :notice => 'Aanvraag Afwezigheid was succesvol verstuurd.' }\n format.xml { render :xml => @absence_request, :status => :created, :location => @absence_request }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @absence_request.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_tenant_scope(args = {}) \n put(\"/tenants.json/scope/#{args[:tenantId]}\", args)\nend", "def create\n @taxonomy_term = TaxonomyTerm.new(params[:taxonomy_term])\n\n respond_to do |format|\n if @taxonomy_term.save\n format.html { redirect_to admin_taxonomy_term_path(@taxonomy_term), notice: 'Taxonomy term was successfully created.' }\n format.json { render json: @taxonomy_term, status: :created, location: @taxonomy_term }\n else\n \tset_site_entities @taxonomy_term\n \t\n format.html { render action: \"new\" }\n format.json { render json: @taxonomy_term.errors, status: :unprocessable_entity }\n end\n end\n end", "def generate_xml_request\n tax_receipt = generate_tax_receipt\n @certificate.certifica tax_receipt\n @key.sella tax_receipt\n tax_receipt.to_xml\n end", "def test_detailed_properties_for_leads_properties\n property_service = PropertyService.new(SAMPLE_UDPRN)\n agent = Agents::Branches::AssignedAgent.last\n branch = Agents::Branch.last\n agent.branch_id = branch.id\n branch.district = SAMPLE_DISTRICT\n assert agent.save!\n assert branch.save!\n vendor_id = Vendor.last.id\n\n get :detailed_properties, { agent_id: agent.id }\n assert_response 200\n response = Oj.load(@response.body)\n assert_equal response['properties'].length, 0\n\n ### Create a new lead\n property_service.attach_vendor_to_property(vendor_id)\n\n ### Claim that lead for the agent\n post :claim_property, { udprn: SAMPLE_UDPRN.to_i, agent_id: agent.id }\n\n get :detailed_properties, { agent_id: agent.id }\n\n assert_response 200\n response = Oj.load(@response.body)\n assert_equal response['properties'].length, 1\n end", "def topology_tag_post_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TopologiesApi.topology_tag_post ...'\n end\n # resource path\n local_var_path = '/ttms/1.0.0/topology_tag'\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[:'topotagcreaterequest'])\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 => 'Topology')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TopologiesApi#topology_tag_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @geofences = Geofence.all\n end", "def get_agreements\n get_agreements_response = Echochamber::Request.get_agreements(token)\n get_agreements_response.fetch(\"userAgreementList\")\n end", "def new\n @step = TaskrequestsStep.find(params[:taskrequests_step_id])\n @absence_request = @step.absence_requests.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @absence_request }\n end\n end", "def create\n @indicate_taxonomy = Indicate::Taxonomy.new(indicate_taxonomy_params)\n\n respond_to do |format|\n if @indicate_taxonomy.save\n format.html { redirect_to @indicate_taxonomy, notice: 'Taxonomy was successfully created.' }\n format.json { render :show, status: :created, location: @indicate_taxonomy }\n else\n format.html { render :new }\n format.json { render json: @indicate_taxonomy.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n id = params[:id].to_i\n\n if id != 0\n \t @agencies = @agencies.paginate(page: params[:page], per_page: 10).order(:name).find_all_by_id(id)\n if @agencies.any?\n @agency_name = @agencies.first.name\n end\n else\n \t @agencies = @agencies.paginate(page: params[:page], per_page: 10).order(:name).find(:all)\n end\n\n\t\t@records_returned = @agencies.count\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @agencies }\n end\n end", "def make_req(point,geofence_id)\n\t# Deleting old fences\n\t@@vars['leaving_a'] = []\n\t@@vars['arriving_a'] = []\n\t@@vars['radii'] = {}\n\n\tdebug_c = []\n\tdebug_r = []\n\tdebug_t = []\n\n\t@@vars['request_counter'] += 1\n\n\tdata = {\n\t\t'device' => {\n\t\t\t'name' => 'Sim_fake_device',\n\t\t\t'foreign_id' => 'sim_id_1',\n\t\t\t'location' => {\n\t\t\t\t'lon' => \"#{point[0]}\", \n\t\t\t\t'lat' => \"#{point[1]}\"\n\t\t\t}\n\t\t},\n\t\t'speed' => \"#{@@vars['walk_speed_ms'][point[2]]}\",\n\t\t'geo_object_ids' => [@@vars['sim_geofence_ids'][geofence_id]]\n\t}\n\n\tresponse = @@vars['access_token'].put(\"/api/v3/devices.json\", JSON[data], HEADERS)\n\n\t@@vars['request_size'] += response.body.length\n\n\tif response && response.code == \"200\"\n\t puts \"Got #{JSON[response.body]['sleep_until'].length} new fences\" if @@vars['sim_static_walk'] < 1\n\t for fence in JSON[response.body]['sleep_until'] do\n\t \tdebug_c << fence['center']\n\t \tdebug_r << fence['radius']\n\t \tdebug_t << fence['status']\n\t \tif fence['type'] == 'circle'\n\n\t \t\tcenter = @@vars['factory'].point(fence['center'][0],fence['center'][1])\n\t \t\tpoly = center.buffer(fence['radius'])\n\n\t \t\t# Add poly to leaving list\n\t \t\tif fence['status'] == 'LEAVING'\n\t \t\t\t#puts \"Got leaving fence\"\n\t \t\t\t@@vars['leaving_a'] << poly\n\t \t\t\t@@vars['radii'][poly] = fence['radius']\n\t \t\tend\n\n\t \t\t# Add poly to arriving list\n \t\t\tif fence['status'] == 'ARRIVING'\n \t\t\t\t#puts \"Got arriving fence\"\n \t\t\t\t@@vars['arriving_a'] << poly\n \t\t\t\t@@vars['radii'][poly] = fence['radius']\n \t\t\tend\n\t \telse\n\t \t\tputs \"ERROR! The returned fences should only be circles!\"\n\t \tend\n\t \t#puts poly\n\t end\n\t #puts jj JSON[response.body]['sleep_until'] # require \"json\" for this to work.\n\telse\n\t #puts jj JSON[response.body]['sleep_until'] # require \"json\" for this to work.\n\tend\n\n\tif @@vars['html_debug']\n\t\t#puts \"{\\\"centers\\\": #{debug_c}, \\\"radii\\\": #{debug_r}}\"\n\t\t@@vars['html_debug_aux_text'] << \"{\\\"centers\\\": #{debug_c}, \\\"radii\\\": #{debug_r}, \\\"type\\\": #{debug_t}}\"\n\tend\nend", "def agencies_search(q, opts = {})\n data, _status_code, _headers = agencies_search_with_http_info(q, opts)\n data\n end", "def export_as_uketd_dc_xml\n xml = Builder::XmlMarkup.new\n xml.tag!(\"uketd_dc:uketddc\",\n 'xmlns:oai_dc' => \"http://www.openarchives.org/OAI/2.0/oai_dc/\",\n 'xmlns:dc' => \"http://purl.org/dc/elements/1.1/\",\n 'xmlns:xsi' => \"http://www.w3.org/2001/XMLSchema-instance\",\n 'xmlns:dcterms' => \"http://purl.org/dc/terms/\",\n 'xmlns:uketd_dc' => \"http://naca.central.cranfield.ac.uk/ethos-oai/2.0/\",\n 'xmlns:uketdterms' => \"http://naca.central.cranfield.ac.uk/ethos-oai/terms/\",\n 'xsi:schemaLocation' => %{http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd}) do\n self.to_semantic_values.select { |field, values| dc_field_names.include? field.to_sym }.each do |field,values|\n values.each do |v|\n xml.tag! 'dc:' + field.to_s, v\n end\n end\n xml.tag! \"dc:date\", self.to_semantic_values[:date_created].first unless self.to_semantic_values[:date_created].first.nil? \n self.to_semantic_values.select { |field, values| dc_terms_field_names.include? field.to_sym }.each do |field,values|\n values.each do |v|\n xml.tag! 'dcterms:' + field.to_s, v\n end\n end\n self.to_semantic_values.select { |field, values| uketd_terms_field_names.include? field.to_sym }.each do |field,values|\n values.each do |v|\n xml.tag! 'uketdterms:' + field.to_s, v\n end\n end\n xml.tag!(\"dcterms:isReferencedBy\", self.full_resource_uri, \"xsi:type\" => \"dcterms:URI\") unless self.full_resource_uri.nil? \n xml.tag!(\"dc:identifier\", self.main_asset_uri, \"xsi:type\" => \"dcterms:URI\") unless self.main_asset_uri.nil? \n xml.tag!(\"dc:format\", mime_type, \"xsi:type\" => \"dcterms:IMT\") unless mime_type.nil? \n xml.tag!(\"dc:language\", self.language_code, \"xsi:type\" => \"dcterms:ISO6392\") unless self.language_code.nil? \n xml.tag! \"uketdterms:institution\", institution unless institution.nil?\n xml.tag! \"uketdterms:department\", department unless department.nil? \n end\n xml.target!\n end", "def create\n @agency = Agency.new(agency_params)\n respond_to do |format|\n if @agency.save\n format.html { redirect_to session[:redirect_to], notice: 'Agency was successfully created.' }\n #format.json { render action: 'show', status: :created, location: @agency }\n else\n format.html { render action: 'new' }\n format.json { render json: @agency.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @agency_relationship = AgencyRelationship.new(params[:agency_relationship])\n\n respond_to do |format|\n if @agency_relationship.save\n flash[:notice] = 'AgencyRelationship was successfully created.'\n format.html { redirect_to(\n agency_relationship_url(@agency_relationship)) }\n else\n format.html { render :action => \"new\" }\n end\n end\n end", "def agencies_get_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AgenciesApi.agencies_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 AgenciesApi.agencies_get\"\n end\n # resource path\n local_var_path = '/v1/agencies/{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', 'text/json', 'text/html', 'application/xml', 'text/xml'])\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 => 'DomainAgencyServiceV2ModelAgency')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AgenciesApi#agencies_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_ontology(ont_info)\n uri = URI.parse(TARGET_API)\n http = Net::HTTP.new(uri.host, uri.port)\n\n req = Net::HTTP::Put.new(\"/ontologies/#{ont_info['acronym']}\")\n req['Content-Type'] = 'application/json'\n req['Authorization'] = \"apikey token=#{TARGET_APIKEY}\"\n\n if ont_info['viewingRestriction'] == 'private'\n # In case of private ontology (acl: list of user that have the right to see the ontology)\n req.body = { 'acronym': ont_info['acronym'], 'name': ont_info['name'],\n 'group': ont_info['group'], 'hasDomain': ont_info['hasDomain'],\n 'administeredBy': [TARGETED_PORTAL_USER],\n 'viewingRestriction': 'private',\n 'acl': [TARGETED_PORTAL_USER] }.to_json\n else\n req.body = { 'acronym': ont_info['acronym'], 'name': ont_info['name'],\n 'group': ont_info['group'], 'hasDomain': ont_info['hasDomain'],\n 'administeredBy': [TARGETED_PORTAL_USER] }.to_json\n end\n\n response = http.start do |http|\n http.request(req)\n end\n\n return response\nend", "def create_url\n \"#{api_url}/gists\"\n end", "def getAllTargetCollections()\n return sendHttpRequest(nil, \"GET\", @@PATH_ADD_TC)\n end", "def create_uri\n return URI_GOODS % [@parameters[\"code_agence\"].to_s]\n end", "def create\n @lcb_financing_target_tag = LcbFinancingTargetTag.new(lcb_financing_target_tag_params)\n\n respond_to do |format|\n if @lcb_financing_target_tag.save\n format.html { redirect_to @lcb_financing_target_tag, notice: 'Lcb financing target tag was successfully created.' }\n format.json { render :show, status: :created, location: @lcb_financing_target_tag }\n else\n format.html { render :new }\n format.json { render json: @lcb_financing_target_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_agent_new_enquiries\n agent_id = Agents::Branches::AssignedAgent.last.id\n verification_status = true\n get :agent_new_enquiries, { agent_id: agent_id }\n attach_agent_to_property_and_update_details(agent_id, SAMPLE_UDPRN, 'Green', \n verification_status, SAMPLE_BEDS, SAMPLE_BATHS, \n SAMPLE_RECEPTIONS)\n\n # assert_response 200\n # earlier_response = Oj.load(@response.body)\n # assert_equal earlier_response['enquiries'].length, 0\n len = 0\n buyer_id = PropertyBuyer.last.id\n\n property_details = get_es_address(SAMPLE_UDPRN)\n Trackers::Buyer::ENQUIRY_EVENTS.each do |event|\n process_event_helper(event, @address_doc['_source'], agent_id)\n get :agent_new_enquiries, { agent_id: agent_id }\n len += 1\n assert_response 200\n response = Oj.load(@response.body)\n assert_equal response['enquiries'].length, len\n\n ### Test property attributes\n attrs = ['price', 'street_view_image_url', 'udprn', 'offers_over', \n 'fixed_price', 'asking_price', 'dream_price', 'current_valuation', 'verification_status']\n attrs.each do |attr_val|\n assert_equal response['enquiries'].last[attr_val], property_details['_source'][attr_val]\n end\n\n assert_equal response['enquiries'].last['status'], property_details['_source']['property_status_type']\n\n ### Test buyer attributes\n buyer = PropertyBuyer.find(buyer_id).as_json\n buyer_attrs = ['id', 'status', 'full_name', 'email', 'image_url', 'mobile', 'budget_from', 'budget_to']\n buyer_attrs.each do |attr_val|\n assert_equal response['enquiries'].last[\"buyer_#{attr_val}\"], buyer[attr_val]\n end\n\n assert_equal response['enquiries'].last['buyer_funding'], PropertyBuyer::REVERSE_FUNDING_STATUS_HASH[buyer['funding']]\n assert_equal response['enquiries'].last['buyer_biggest_problem'], PropertyBuyer::REVERSE_FUNDING_STATUS_HASH[buyer['biggest_problem']]\n assert_equal response['enquiries'].last['buyer_buying_status'], PropertyBuyer::REVERSE_FUNDING_STATUS_HASH[buyer['buying_status']]\n \n ### Test enquiries, views, hotness and qualifying_stage \n enquiries = response['enquiries'].last['enquiries']\n buyer_enquiries = enquiries.split('/')[0].to_i\n total_enquiries = enquiries.split('/')[1].to_i\n assert_equal buyer_enquiries, total_enquiries\n end\n\n ### Test viewed\n process_event_helper('viewed', @address_doc['_source'])\n get :agent_new_enquiries, { agent_id: agent_id }\n response = Oj.load(@response.body)\n views = response['enquiries'].last['views']\n buyer_views = views.split('/')[0].to_i\n total_views = views.split('/')[1].to_i\n assert_equal total_views, 1\n assert_equal buyer_views, 1\n\n\n ### Test hotness\n assert_equal response['enquiries'].last['hotness'], 'cold_property'\n process_event_helper('warm_property', @address_doc['_source'])\n get :agent_new_enquiries, { agent_id: agent_id }\n response = Oj.load(@response.body)\n hotness = response['enquiries'].last['hotness']\n assert_equal hotness, 'warm_property'\n\n process_event_helper('hot_property', @address_doc['_source'])\n get :agent_new_enquiries, { agent_id: agent_id }\n response = Oj.load(@response.body)\n hotness = response['enquiries'].last['hotness']\n assert_equal hotness, 'hot_property'\n\n #### Test qualifying stage filter\n (Trackers::Buyer::QUALIFYING_STAGE_EVENTS-[:qualifying_stage, :viewing_stage]).each do |event|\n process_event_helper(event, @address_doc['_source'])\n get :agent_new_enquiries, { agent_id: agent_id }\n response = Oj.load(@response.body)\n stage = response['enquiries'].last['qualifying']\n assert_equal stage, event.to_s\n\n get :agent_new_enquiries, { agent_id: agent_id, qualifying_stage: event }\n response = Oj.load(@response.body)\n response['enquiries'].each do |each_elem|\n assert_equal each_elem['qualifying'], event.to_s\n end\n\n end\n\n ### Test Filters\n ### i) enquiry_type\n (Trackers::Buyer::ENQUIRY_EVENTS-[:viewing_stage]).each do |event|\n get :agent_new_enquiries, { agent_id: agent_id, enquiry_type: event }\n response = Oj.load(@response.body)\n assert_equal response['enquiries'].length, 1\n end\n\n ### ii) type_of_match\n get :agent_new_enquiries, { agent_id: agent_id }\n response = Oj.load(@response.body)\n response_length = response['enquiries'].length\n\n get :agent_new_enquiries, { agent_id: agent_id, type_of_match: 'Potential' }\n response = Oj.load(@response.body)\n assert_equal response['enquiries'].length, 0\n\n get :agent_new_enquiries, { agent_id: agent_id, type_of_match: 'Perfect' }\n response = Oj.load(@response.body)\n # assert_equal response['enquiries'].length, response_length\n\n ### Test for rent properties\n create_rent_enquiry_event\n attach_agent_to_property_and_update_details(agent_id, '123456', 'Rent', \n verification_status, SAMPLE_BEDS, SAMPLE_BATHS, \n SAMPLE_RECEPTIONS)\n\n\n property_status_type = 'Rent'\n\n get :agent_new_enquiries, { agent_id: agent_id, property_for: 'Rent' }\n assert_response 200\n response = Oj.load(@response.body)\n assert_equal response.length, 1\n destroy_rent_enquiry_event\n end", "def create\n @st_has_dep = StHasDep.new(st_has_dep_params)\n\n respond_to do |format|\n if @st_has_dep.save\n format.html { redirect_to @st_has_dep, notice: 'St has dep was successfully created.' }\n format.json { render :show, status: :created, location: @st_has_dep }\n else\n format.html { render :new }\n format.json { render json: @st_has_dep.errors, status: :unprocessable_entity }\n end\n end\n end", "def attitude_params\n params.require(:attitude).permit(:organization_id, :target_id, :desired_status)\n end", "def agency_params\n params.require(:agency).permit(:name, :city, :adress, :zipcode, :phone_number, :logo_agency_url, :siren)\n end", "def getAllTargetCollections\n return sendRequest('GET', PATH_ADD_TC)\n end", "def getAllTargetCollections\n return sendRequest('GET', PATH_ADD_TC)\n end", "def process_GENDATA(nodes, event)\n # Time, EventType, DataId, GeneratorId, Transmitting Size\n # 178.0,GENDATA,Data00000143,sensor-033,1024,\n\n # Extract necessary information from Eventlist\n data_creation = event[0].to_i\n id_data = event[2]\n id_gene = event[3]\n size = event[4].to_i\n\n # nodes creation (preparation)\n if (nodes[id_gene] == nil) then # firstly appeared\n nodes[id_gene] = Node.new\n end\n\n # Simulating for data storing in generation\n data = {\"id\" => id_data, \"size\" => size, \"creationtime\" => data_creation}\n data.each do |key,value|\n #puts \"#{key} : #{value}\"\n end \n #puts data[\"id\"]\n #puts data[\"size\"]\n #puts data[\"creationtime\"]\n\n nodes[id_gene].put(id_data, data)\n end", "def add_terms(params)\n send_get \"add_terms\", params\n end", "def create\n @node = Node.new(params[:node])\n @title = \"Taxonomy node - organism relationships\"\n\n respond_to do |format|\n if @node.save\n format.html { redirect_to(@node, :notice => 'Node was successfully created.') }\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 build_xml\n\t\t\t\tbuilder = Nokogiri::XML::Builder.new do |xml|\n\t\t\t\t\txml.SearchLocationsRequest(:xmlns => \"http://fedex.com/ws/locs/v3\"){\n\t\t\t\t\t\tadd_web_authentication_detail(xml)\n\t\t\t\t\t\tadd_location_client_detail(xml)\n\t\t\t\t\t\tadd_version(xml)\n\t\t\t\t\t\tadd_request_timestamp(xml)\n\t\t\t\t\t\tadd_location_search_criterion(xml)\n\t\t\t\t\t\tadd_unique_tracking_number(xml)\n\t\t\t\t\t\tadd_origin_address(xml)\n\t\t\t\t\t\tadd_phone_number(xml)\n\t\t\t\t\t\tadd_geographic_coordinates(xml)\n\t\t\t\t\t}\n\t\t\t\tend\n\t\t\t\tbuilder.doc.root.to_xml\n\t\t\tend", "def agreements()\n return MicrosoftGraph::Agreements::AgreementsRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def agencies_get(id, opts = {})\n data, _status_code, _headers = agencies_get_with_http_info(id, opts)\n data\n end", "def retrieve_xml_structure\n \n begin\n\n \tdh = DHHtp.new('maps.googleapis.com')\n \tdh.retrieve_xml_structure(ARGV.first)\n\n rescue => e\n \tputs \"\\nError! #{e}\\n\"\n \n end\n\t\nend", "def retrieve_announces\n puts \"Retrieving announcements from the chef server and depositing them in '#{Settings[:announces_file]}'...\"\n Chef::Config.from_file(Settings[:knife_config])\n query = Chef::Search::Query.new\n nodes = {}\n query.search(:node,\"name:#{Settings[:node]}\") do |node|\n nodes[node.name] = node['announces'].to_hash unless node['announces'].nil?\n end\n File.open(Settings[:announces_file], 'w') {|f| f.write(nodes.to_json)}\nend", "def get_feature_values\n out = File.open(\"#{$prepare_dir}/refseq_genes_result.tsv\", \"w\")\n template = File.read(\"#{@base_dir}/sparql/create_refseq2up_tsv.rq.erb\")\n stats = {}\n @refseq_list.each {|refseq|\n retry_cnt = 0 #prevent from infinite loop\n rsid = refseq [\"refseq_id\"]\n #next unless (rsid == \"NZ_CP011382.1\" || rsid == \"NC_003272.1\" || rsid == \"NC_000010.11\") #TODO delete\n query_text = ERB.new(template).result(binding)\n begin\n result = \"\"\n puts rsid\n @sparql_ep.query(query_text, :format => 'json') do |json|\n result += json\n end\n $stderr.puts \"success get featurs of #{rsid} .\"\n result = JSON.parse(result)[\"results\"][\"bindings\"]\n rescue # when occures timeout or json parse error\n retry_cnt += 1\n $stderr.puts \"error get featurs of #{rsid} .\"\n if retry_cnt <= 10\n $stderr.puts \"start retry after 30 sec...\"\n sleep 30\n retry\n else #prevent from infinite loop\n $stderr.puts \"finally, cloudn't get featurs of #{rsid} . Please check the data or environment\"\n next\n end\n end\n result.each do |entry|\n refseq_data = [\n entry['taxonomy_id']['value'],\n entry['gene']['value'],\n entry['gene_label']['value']\n ]\n if entry['protein_id']\n refseq_data.push(entry['protein_id']['value'])\n else\n refseq_data.push(\"\")\n end\n if entry['insdc_gene_id']\n refseq_data.push(entry['insdc_gene_id']['value'])\n else\n refseq_data.push(\"\")\n end\n out.puts refseq_data.join(\"\\t\")\n end\n }\n out.flush\n out.close\nend" ]
[ "0.5092229", "0.5078417", "0.5059218", "0.49429503", "0.48785475", "0.48385835", "0.48376653", "0.47317272", "0.4723608", "0.46779332", "0.46573249", "0.46541524", "0.46472257", "0.46465603", "0.46414372", "0.463291", "0.46328992", "0.46259022", "0.46251053", "0.46196553", "0.4614672", "0.4587337", "0.45726454", "0.4561164", "0.4557265", "0.45021877", "0.44926983", "0.44860998", "0.44782114", "0.44752848", "0.44638595", "0.44497344", "0.44340122", "0.44289604", "0.44272742", "0.4421715", "0.44184992", "0.44131586", "0.44031438", "0.43905336", "0.43790886", "0.43780854", "0.4365403", "0.43598717", "0.43439347", "0.43262511", "0.43185762", "0.43139634", "0.43119594", "0.4311705", "0.43068168", "0.4298325", "0.42944923", "0.42755887", "0.4273671", "0.42530155", "0.42482865", "0.42473963", "0.42339033", "0.42310008", "0.42250755", "0.42095906", "0.42092386", "0.42060706", "0.41986823", "0.4193343", "0.41853726", "0.41845515", "0.41661212", "0.41603124", "0.415453", "0.41480318", "0.41417393", "0.4137765", "0.41374007", "0.41213056", "0.4115305", "0.41109848", "0.4110455", "0.41088957", "0.41084692", "0.41076943", "0.41028586", "0.41027993", "0.41006726", "0.40998772", "0.40971017", "0.40942076", "0.40829775", "0.40816155", "0.40813303", "0.40764955", "0.40754294", "0.40730596", "0.40655923", "0.40654412", "0.40638667", "0.40634403", "0.4063297", "0.40612048" ]
0.6088978
0
PUT /gtfs_agencies/1 PUT /gtfs_agencies/1.xml
def update @gtfs_agency = GtfsAgency.find(params[:id]) respond_to do |format| if @gtfs_agency.update_attributes(params[:gtfs_agency]) format.html { redirect_to(@gtfs_agency, :notice => 'Gtfs agency was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @gtfs_agency.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @gtfs_agency = GtfsAgency.new(params[:gtfs_agency])\n\n respond_to do |format|\n if @gtfs_agency.save\n format.html { redirect_to(@gtfs_agency, :notice => 'Gtfs agency was successfully created.') }\n format.xml { render :xml => @gtfs_agency, :status => :created, :location => @gtfs_agency }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @gtfs_agency.errors, :status => :unprocessable_entity }\n end\n end\n end", "def destroy\n @gtfs_agency = GtfsAgency.find(params[:id])\n @gtfs_agency.destroy\n\n respond_to do |format|\n format.html { redirect_to(gtfs_agencies_url) }\n format.xml { head :ok }\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def show\n @gtfs_agency = GtfsAgency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gtfs_agency }\n end\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def taf(id)\n perform_get(\"/tafs/#{id}.xml\")\n end", "def new\n @gtfs_agency = GtfsAgency.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gtfs_agency }\n end\n end", "def update\n @agency = Agency.find(params[:id])\n\n if @agency.update(agency_params)\n #head :no_content\n render json: @agency, status: :accepted, location: @agency #sera? status accepted? \n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end", "def update\n @agency = Agency.find(params[:id])\n\n if @agency.update(agency_params)\n #head :no_content\n render json: @agency, status: :accepted, location: @agency #sera? status accepted? \n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end", "def update\n if @agency.update(agency_params)\n @agency = Agency.new\n @agencies = Agency.all\n @flag = true\n else\n @flag = false\n end\n end", "def index\n @agencies = Agency.all\n end", "def set_tenant_scope(args = {}) \n put(\"/tenants.json/scope/#{args[:tenantId]}\", args)\nend", "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 show\n @agencies = Agency.find(params[:id])\n\n if @agencies \n respond_to do |format|\n format.json { render :json => @agencies }\n format.xml { render :xml => @agencies }\n end \n else\n head :not_found\n end\n end", "def update\n @gene_ontology = GeneOntology.find(params[:id])\n\n respond_to do |format|\n if @gene_ontology.update_attributes(params[:gene_ontology])\n format.html { redirect_to(@gene_ontology, :notice => 'Gene ontology was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @gene_ontology.errors, :status => :unprocessable_entity }\n end\n end\n end", "def show\n @agencies = Agency.find(params[:id])\n\n if @agencies \n respond_to do |format|\n format.json { render :json => @agencies }\n format.xml { render :xml => @agencies }\n end \n else\n head :not_found\n end\n end", "def tafs(params={})\n perform_get('/tafs.xml', params)\n end", "def update\n @gtfs_trip = GtfsTrip.find(params[:id])\n\n respond_to do |format|\n if @gtfs_trip.update_attributes(params[:gtfs_trip])\n format.html { redirect_to(@gtfs_trip, :notice => 'Gtfs trip was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @gtfs_trip.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @canonical_gconcepts = args[:canonical_gconcepts] if args.key?(:canonical_gconcepts)\n end", "def update\n @node = Node.find(params[:id])\n @title = \"Taxonomy node - organism relationships\"\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to(@node, :notice => 'Node was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(attrs, path=nil)\n resp = api_client.put(path || url, JSON.dump(attrs))\n refresh(JSON.load(resp.body))\n end", "def update\n @tenancy_agreement = TenancyAgreement.find(params[:id])\n\n respond_to do |format|\n if @tenancy_agreement.update_attributes(params[:tenancy_agreement])\n format.html { redirect_to tenancy_agreements_path, notice: 'Tenancy agreement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tenancy_agreement.errors, status: :unprocessable_entity }\n end\n end\n end", "def agencies_search_with_http_info(q, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AgenciesApi.agencies_search ...'\n end\n # verify the required parameter 'q' is set\n if @api_client.config.client_side_validation && q.nil?\n fail ArgumentError, \"Missing the required parameter 'q' when calling AgenciesApi.agencies_search\"\n end\n # resource path\n local_var_path = '/v1/agencies'\n\n # query parameters\n query_params = {}\n query_params[:'q'] = q\n query_params[:'pageNumber'] = opts[:'page_number'] if !opts[:'page_number'].nil?\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].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', 'text/json', 'text/html', 'application/xml', 'text/xml'])\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<DomainAgencyServiceV2ModelAgencySummary>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AgenciesApi#agencies_search\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def putEntityserve( entity_id, country, event_type, domain, path)\n params = Hash.new\n params['entity_id'] = entity_id\n params['country'] = country\n params['event_type'] = event_type\n params['domain'] = domain\n params['path'] = path\n return doCurl(\"put\",\"/entityserve\",params)\n end", "def update\n respond_to do |format|\n if @gt_registration.update(gt_registration_params)\n format.html { redirect_to index_with_payed_gt_race_gt_category_gt_registrations_path(@gt_race,0), notice: 'Gt registration was successfully updated.' }\n format.json { render :show, status: :ok, location: @gt_registration }\n else\n format.html { render :edit }\n format.json { render json: @gt_registration.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_location(params)\n @client.put(\"#{path}/location\", nil, params, \"Content-Type\" => \"application/json\")\n end", "def update\n @graph.update_attributes_from_request(update_params)\n head :no_content\n end", "def update!(**args)\n @agency_associations = args[:agency_associations] if args.key?(:agency_associations)\n end", "def update!(**args)\n @feature_type = args[:feature_type] if args.key?(:feature_type)\n @gconcepts = args[:gconcepts] if args.key?(:gconcepts)\n end", "def topology_tag_uuid_put_with_http_info(topotaguuid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TopologiesApi.topology_tag_uuid_put ...'\n end\n # verify the required parameter 'topotaguuid' is set\n if @api_client.config.client_side_validation && topotaguuid.nil?\n fail ArgumentError, \"Missing the required parameter 'topotaguuid' when calling TopologiesApi.topology_tag_uuid_put\"\n end\n # resource path\n local_var_path = '/ttms/1.0.0/topology_tag/{topotaguuid}/'.sub('{' + 'topotaguuid' + '}', topotaguuid.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[:'topotagupdateresponse'])\n auth_names = ['oAuth2']\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 => 'Topology')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TopologiesApi#topology_tag_uuid_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_agency\n @agency = Agency.find(params[:id])\n end", "def set_agency\n @agency = Agency.find(params[:id])\n end", "def set_agency\n @agency = Agency.find(params[:id])\n end", "def set_agency\n @agency = Agency.find(params[:id])\n end", "def set_agency\n @agency = Agency.find(params[:id])\n end", "def set_agency\n @agency = Agency.find(params[:id])\n end", "def update\n @ontology = SYMPH::Ontology.find(params[:id])\n\n respond_to do |format|\n if @ontology.update_attributes(params[:ontology])\n flash[:notice] = 'Ontology was successfully updated.'\n format.html { redirect_to(ontologies_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ontology.errors, :status => :unprocessable_entity }\n end\n end\n\t\n end", "def show\n find_agencies(params[:id])\n increment_views_amount(@public_agency)\n end", "def agencies_create_test_agency_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AgenciesApi.agencies_create_test_agency ...'\n end\n # resource path\n local_var_path = '/v1/agencies/_testAgency'\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', 'text/json', 'text/html', 'application/xml', 'text/xml'])\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(: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 => 'DomainAgencyServiceV2ModelAgency')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AgenciesApi#agencies_create_test_agency\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n @gtd = Gtd.find(params[:id])\n\n respond_to do |format|\n if @gtd.update_attributes(params[:gtd])\n flash[:notice] = 'Gtd was successfully updated.'\n format.html { redirect_to(@gtd) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @gtd.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @agency.update(agency_params)\n format.html { redirect_to @agency, notice: \"Agency was successfully updated.\" }\n format.json { render :show, status: :ok, location: @agency }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @agency.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_put\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end", "def update_feature_request(folder_id, feature_content, file_name)\n url = URI(\"#{$base_url}/api/projects/#{$project_id}/folders/#{folder_id}/update_from_feature\")\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Patch.new(url)\n request[\"accept\"] = 'application/vnd.api+json; version=1'\n request[\"access-token\"] = $access_token\n request[\"uid\"] = $uid\n request[\"client\"] = $client\n request[\"Content-Type\"] = 'application/json'\n\n data = {\n data: {\n attributes: {\n \"feature\": feature_content\n }\n }\n }\n\n request.body = JSON.generate(data)\n response = http.request(request)\n\n if response.code == 200.to_s\n update_response = JSON.parse(response.read_body)['data']\n puts \"Feature '#{update_response['attributes']['name']}' with '#{update_response['attributes']['scenarios-count']} scenario(s)' updated.\"\n $success_uploaded_count = $success_uploaded_count + 1\n $uploaded_features_list.push(file_name)\n $updated_count = $updated_count + 1\n else\n $fail_uploaded_count = $fail_uploaded_count + 1\n $not_uploaded_features_list.push(file_name)\n end\n\n response.code\nend", "def update\n respond_to do |format|\n if @agency.update_attributes(params[:agency])\n format.html { redirect_to @agency, notice: 'Agency was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @agency.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @gnode = Gnode.find(params[:id])\n\n respond_to do |format|\n if @gnode.update_attributes(params[:gnode])\n format.html { redirect_to @gnode, notice: 'Gnode was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gnode.errors, status: :unprocessable_entity }\n end\n end\n end", "def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend", "def agencies_get_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AgenciesApi.agencies_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 AgenciesApi.agencies_get\"\n end\n # resource path\n local_var_path = '/v1/agencies/{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', 'text/json', 'text/html', 'application/xml', 'text/xml'])\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 => 'DomainAgencyServiceV2ModelAgency')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AgenciesApi#agencies_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_geofence\n @geofence = Geofence.find(params[:id])\n end", "def set_geofence\n @geofence = Geofence.find(params[:id])\n end", "def agency_params\n params.require(:agency).permit(:name,\n :agycode,\n :photo,\n :description,\n :restrictions,\n :hours_of_operation,\n :address_id,\n :contact_name,\n :contact_phone,\n :contact_email,\n :services,\n :geographic_restrictions,\n :family_stipulations,\n :faith_based,\n :is_active,\n :general_information,\n { :service_ids => [] },\n address_attributes: [:id, :street_line_1, :street_line_2, :city, :state, :zip])\n end", "def update\n @step = TaskrequestsStep.find(params[:taskrequests_step_id])\n @absence_request = @step.absence_requests.find(params[:id])\n\n respond_to do |format|\n if @absence_request.update_attributes(params[:absence_request])\n format.html { redirect_to(@absence_request, :notice => 'Absence request was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @absence_request.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_agency\n @agency = Agency.find_by_id(params[:id])\n end", "def set_gtag\n gtags = @current_event.gtags\n\n Rollbar.silenced do\n gtag_id = gtags.find_by(id: params[:id])&.id || gtags.find_by(tag_uid: params[:id])&.id\n\n @gtag = gtags.find(gtag_id)\n authorize @gtag\n end\n end", "def create_update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.path)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n end", "def set_agency\n @agency = Agency.find(params[:agency_id])\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance/{tenantId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def test_putway_update_valid\n way = create(:way_with_nodes, :nodes_count => 3)\n cs_id = way.changeset.id\n user = way.changeset.user\n\n assert_not_equal({ \"test\" => \"ok\" }, way.tags)\n amf_content \"putway\", \"/1\", [\"#{user.email}:test\", cs_id, way.version, way.id, way.nds, { \"test\" => \"ok\" }, [], {}]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 8, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal way.id, result[2]\n assert_equal way.id, result[3]\n assert_equal({}, result[4])\n assert_equal way.version + 1, result[5]\n assert_equal({}, result[6])\n assert_equal({}, result[7])\n\n new_way = Way.find(way.id)\n assert_equal way.version + 1, new_way.version\n assert_equal way.nds, new_way.nds\n assert_equal({ \"test\" => \"ok\" }, new_way.tags)\n\n # Test changing the nodes in the way\n a = create(:node).id\n b = create(:node).id\n c = create(:node).id\n d = create(:node).id\n\n assert_not_equal [a, b, c, d], way.nds\n amf_content \"putway\", \"/1\", [\"#{user.email}:test\", cs_id, way.version + 1, way.id, [a, b, c, d], way.tags, [], {}]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 8, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal way.id, result[2]\n assert_equal way.id, result[3]\n assert_equal({}, result[4])\n assert_equal way.version + 2, result[5]\n assert_equal({}, result[6])\n assert_equal({}, result[7])\n\n new_way = Way.find(way.id)\n assert_equal way.version + 2, new_way.version\n assert_equal [a, b, c, d], new_way.nds\n assert_equal way.tags, new_way.tags\n\n amf_content \"putway\", \"/1\", [\"#{user.email}:test\", cs_id, way.version + 2, way.id, [a, -1, b, c], way.tags, [[4.56, 12.34, -1, 0, { \"test\" => \"new\" }], [12.34, 4.56, b, 1, { \"test\" => \"ok\" }]], { d => 1 }]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n new_node_id = result[4][\"-1\"].to_i\n\n assert_equal 8, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal way.id, result[2]\n assert_equal way.id, result[3]\n assert_equal({ \"-1\" => new_node_id }, result[4])\n assert_equal way.version + 3, result[5]\n assert_equal({ new_node_id.to_s => 1, b.to_s => 2 }, result[6])\n assert_equal({ d.to_s => 1 }, result[7])\n\n new_way = Way.find(way.id)\n assert_equal way.version + 3, new_way.version\n assert_equal [a, new_node_id, b, c], new_way.nds\n assert_equal way.tags, new_way.tags\n\n new_node = Node.find(new_node_id)\n assert_equal 1, new_node.version\n assert_equal true, new_node.visible\n assert_equal 4.56, new_node.lon\n assert_equal 12.34, new_node.lat\n assert_equal({ \"test\" => \"new\" }, new_node.tags)\n\n changed_node = Node.find(b)\n assert_equal 2, changed_node.version\n assert_equal true, changed_node.visible\n assert_equal 12.34, changed_node.lon\n assert_equal 4.56, changed_node.lat\n assert_equal({ \"test\" => \"ok\" }, changed_node.tags)\n\n deleted_node = Node.find(d)\n assert_equal 2, deleted_node.version\n assert_equal false, deleted_node.visible\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def update_xml\n self.xml= dumpRouteAsXml\n self.save\n end", "def create\n @tenancy_agreement = TenancyAgreement.new(params[:tenancy_agreement])\n @tenancy_agreement.estate_agent_id = current_user.estate_agent_id\n respond_to do |format|\n if @tenancy_agreement.save\n format.html { redirect_to tenancy_agreements_path, notice: 'Tenancy agreement was successfully created.' }\n format.json { render json: @tenancy_agreement, status: :created, location: @tenancy_agreement }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tenancy_agreement.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params)\n request(:put, path, params)\n end", "def put(path, opts = {})\n request(:put, path, opts).body\n end", "def put(path, params={}, options={})\n request(:put, api_path(path), params, options)\n end", "def index\n @agencies = current_user.agencies.all\n end", "def agencies_head_with_http_info(q, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AgenciesApi.agencies_head ...'\n end\n # verify the required parameter 'q' is set\n if @api_client.config.client_side_validation && q.nil?\n fail ArgumentError, \"Missing the required parameter 'q' when calling AgenciesApi.agencies_head\"\n end\n # resource path\n local_var_path = '/v1/agencies'\n\n # query parameters\n query_params = {}\n query_params[:'q'] = q\n query_params[:'pageNumber'] = opts[:'page_number'] if !opts[:'page_number'].nil?\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].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', 'text/json', 'text/html', 'application/xml', 'text/xml'])\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(:HEAD, 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: AgenciesApi#agencies_head\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n @location_tag = LocationTag.find(params[:id])\n\n respond_to do |format|\n if @location_tag.update_attributes(params[:location_tag])\n flash[:notice] = 'Location tag was successfully updated.' \n format.html { redirect_to(location_tags_path(:farm_id => @farm.id)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @location_tag.errors, :status => :unprocessable_entity }\n end\n end\n end", "def add_aos_version(args = {}) \n post(\"/aosversions.json/\", args)\nend", "def update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}/volumes\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.request_uri)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n\n end", "def update\n @admin_agency = Admin::Agency.find(params[:id])\n\n respond_to do |format|\n if @admin_agency.update_attributes(params[:admin_agency])\n format.html { redirect_to @admin_agency, notice: 'Agency was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_agency.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def update\n @taxonomy_term = TaxonomyTerm.find(params[:id])\n\n respond_to do |format|\n if @taxonomy_term.update_attributes(params[:taxonomy_term])\n format.html { redirect_to admin_taxonomy_terms_path , notice: 'Taxonomy term was successfully updated.' }\n format.json { head :no_content }\n else\n \tset_site_entities @taxonomy_term\n format.html { render action: \"edit\" }\n format.json { render json: @taxonomy_term.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @agency = Agency.new(agency_params)\n\n if @agency.save\n render json: @agency, status: :created, location: @agency\n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end", "def update_current_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update_fusion\n end", "def update\n respond_to do |format|\n if @agency.update(agency_params)\n format.html { redirect_to @agency, notice: 'Agency was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @agency.errors, status: :unprocessable_entity }\n end\n end\n end", "def enable_alert_feature \n put(\"/globalsettings.json/alerts/enable\")\nend", "def destroy\n @agency.update_attribute(:status, 'N')\n respond_to do |format|\n format.html { redirect_to agencies_url, notice: 'Agency was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def create_ontology(ont_info)\n uri = URI.parse(TARGET_API)\n http = Net::HTTP.new(uri.host, uri.port)\n\n req = Net::HTTP::Put.new(\"/ontologies/#{ont_info['acronym']}\")\n req['Content-Type'] = 'application/json'\n req['Authorization'] = \"apikey token=#{TARGET_APIKEY}\"\n\n if ont_info['viewingRestriction'] == 'private'\n # In case of private ontology (acl: list of user that have the right to see the ontology)\n req.body = { 'acronym': ont_info['acronym'], 'name': ont_info['name'],\n 'group': ont_info['group'], 'hasDomain': ont_info['hasDomain'],\n 'administeredBy': [TARGETED_PORTAL_USER],\n 'viewingRestriction': 'private',\n 'acl': [TARGETED_PORTAL_USER] }.to_json\n else\n req.body = { 'acronym': ont_info['acronym'], 'name': ont_info['name'],\n 'group': ont_info['group'], 'hasDomain': ont_info['hasDomain'],\n 'administeredBy': [TARGETED_PORTAL_USER] }.to_json\n end\n\n response = http.start do |http|\n http.request(req)\n end\n\n return response\nend", "def put_update\n response = self.class.put(\"/service/#{$service_id}/version/#{$service_version}/logging/sftp/#{$name}\", \n headers: { \"Fastly-Key\" => $key }, \n body: $put_form_data )\n end", "def update\n @taxonomy = Taxonomy.find(params[:id])\n\n respond_to do |format|\n if @taxonomy.update_attributes(params[:taxonomy])\n format.html { redirect_to edit_admin_taxonomy_path(@taxonomy), notice: 'Taxonomy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to :action => 'edit', alert: 'Updating taxonomy was failed.' }\n format.json { render json: @taxonomy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @node_incident = NodeIncident.find(params[:id])\n\n respond_to do |format|\n if @node_incident.update_attributes(params[:node_incident])\n format.html { redirect_to @node_incident, :notice => 'Node incident was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @node_incident.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put_request(path, params={}, options={})\n request(:put, path, params, options)\n end", "def add_agency_link\n self.get_element(@browser, '//a[contains(@href, \"/insertion_orders_organizations_agencies/create?insertion_orders.id=\")]')\n end", "def update_metadata(params)\n @client.put(metadata_path, nil, params, \"Content-Type\" => \"application/json\")\n end", "def put(path, params={})\n RestClient.put request_base+path, params\n end", "def update\n @agency_type = AgencyType.find(params[:id])\n\n respond_to do |format|\n if @agency_type.update_attributes(params[:agency_type])\n format.html { redirect_to @agency_type, notice: 'Agency type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @agency_type.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.5668073", "0.5418147", "0.50160056", "0.49147582", "0.48893866", "0.48783252", "0.48439917", "0.48429257", "0.48283055", "0.48032257", "0.47987753", "0.4734048", "0.47269425", "0.46899068", "0.4686061", "0.4659577", "0.46583828", "0.46485117", "0.46348712", "0.46254843", "0.4574911", "0.4555562", "0.45358852", "0.45352176", "0.4480828", "0.4479987", "0.44774857", "0.4474298", "0.44675434", "0.44649425", "0.44441247", "0.44441247", "0.44441247", "0.44441247", "0.44441247", "0.44441247", "0.44372693", "0.44213846", "0.44153127", "0.44149536", "0.44118065", "0.43969858", "0.4394557", "0.43932533", "0.43798435", "0.43791983", "0.43606627", "0.43584222", "0.43584222", "0.43564898", "0.43557772", "0.43556765", "0.43544698", "0.43493047", "0.43484172", "0.43469188", "0.4345489", "0.43419424", "0.43404418", "0.43404418", "0.43404418", "0.43401194", "0.43311432", "0.4328729", "0.4328729", "0.4328729", "0.4328729", "0.4328729", "0.4328729", "0.4328729", "0.4328729", "0.43267033", "0.43205625", "0.43130982", "0.43104887", "0.43104038", "0.43060473", "0.43044683", "0.4299325", "0.42887396", "0.42742157", "0.42742157", "0.4271777", "0.42681903", "0.42616138", "0.42566547", "0.42518267", "0.42453843", "0.42446098", "0.4242258", "0.42386043", "0.4237598", "0.42359808", "0.42327663", "0.42308468", "0.42284477", "0.42260596", "0.42260244", "0.4222811", "0.42216584" ]
0.62252223
0
DELETE /gtfs_agencies/1 DELETE /gtfs_agencies/1.xml
def destroy @gtfs_agency = GtfsAgency.find(params[:id]) @gtfs_agency.destroy respond_to do |format| format.html { redirect_to(gtfs_agencies_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(path)\n path = relativize_path path\n\n Precog.connect self do |http|\n uri = Addressable::URI.new\n uri.query_values = { :apiKey => api_key }\n\n http.delete \"/ingest/v#{VERSION}/fs/#{path}?#{uri.query}\"\n end\n end", "def deleteEntityAdvertiser( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/advertiser\",params)\n end", "def destroy\n @gtd = Gtd.find(params[:id])\n @gtd.destroy\n\n respond_to do |format|\n format.html { redirect_to(gtds_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @gene_ontology = GeneOntology.find(params[:id])\n @gene_ontology.destroy\n\n respond_to do |format|\n format.html { redirect_to(gene_ontologies_url) }\n format.xml { head :ok }\n end\n end", "def deleteEntityTag( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/tag\",params)\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @agency.update_attribute(:status, 'N')\n respond_to do |format|\n format.html { redirect_to agencies_url, notice: 'Agency was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @agency = Agency.find(params[:id])\n @agency.destroy\n redirect_to agencies_url\n end", "def deleteEntityFax( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/fax\",params)\n end", "def destroy\n @auditflows_flownode = AuditflowsFlownode.find(params[:id])\n @auditflows_flownode.destroy\n\n respond_to do |format|\n format.html { redirect_to(auditflows_flownodes_url) }\n format.xml { head :ok }\n end\n end", "def cfdelete(dist_id) # cf://DIST_ID\n send_command \"cfdelete\", dist_id\n end", "def deleteEntityDocument( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/document\",params)\n end", "def destroy\n @dataload_ga = DataloadGa.find(params[:id])\n @dataload_ga.destroy\n\n respond_to do |format|\n format.html { redirect_to dataload_gas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_agency = Admin::Agency.find(params[:id])\n @admin_agency.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_agencies_url }\n format.json { head :no_content }\n end\n end", "def deleteEntityYext_list( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/yext_list\",params)\n end", "def deleteEntityList( gen_id, entity_id)\n params = Hash.new\n params['gen_id'] = gen_id\n params['entity_id'] = entity_id\n return doCurl(\"delete\",\"/entity/list\",params)\n end", "def destroy\n @tenancy_agreement = TenancyAgreement.find(params[:id])\n @tenancy_agreement.destroy\n\n respond_to do |format|\n format.html { redirect_to tenancy_agreements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @gtfs_trip = GtfsTrip.find(params[:id])\n @gtfs_trip.destroy\n\n respond_to do |format|\n format.html { redirect_to(gtfs_trips_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @taxonomy = Taxonomy.find(params[:id])\n taxonomy_type = @taxonomy.taxonomy_type \n @taxonomy.delete_node_keep_sub_nodes\n @taxonomy.reload\n @taxonomy.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_taxonomies_url(:taxonomy_type => taxonomy_type) }\n format.json { head :no_content }\n end\n end", "def delete\n\t\tdb.execute{ \"delete edge #{ref_name} #{rrid}\" }\n\tend", "def delete_asg name\n auto_scaling = new_auto_scaling\n groups = auto_scaling.groups\n raise \"unable to delete asg, #{name}. asg not found!\" if groups[name].nil? \n\n asg = groups[name]\n\n puts \"deleting asg, #{asg.name}\"\n asg.delete({:force => true})\n delete_launch_configs\nend", "def destroy\n @user_testcase_xref = UserTestcaseXref.find(params[:id])\n @user_testcase_xref.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_testcase_xrefs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @agency = Agency.find(params[:id])\n @agency.destroy\n\n #head :no_content\n head :accepted # o deberia dejarlo en not_content\n end", "def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "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 destroy\n @gnode = Gnode.find(params[:id])\n @gnode.destroy\n\n respond_to do |format|\n format.html { redirect_to gnodes_url }\n format.json { head :no_content }\n end\n end", "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def destroy\n @gpath = Gpath.find(params[:id])\n @gpath.destroy\n\n respond_to do |format|\n format.html { redirect_to gpaths_url }\n format.json { head :no_content }\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @genome_reference = GenomeReference.find(params[:id])\n @genome_reference.destroy\n\n respond_to do |format|\n format.html { redirect_to(genome_references_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @req_breakdown = ReqBreakdown.find(params[:id])\n @req_breakdown.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_req_breakdowns_url) }\n format.xml { head :ok }\n end\n end", "def delete()\n\n client.delete(\"/tags/#{gid}\") && true\n end", "def destroy\n @auto1h_fold_change = Auto1hFoldChange.find(params[:id])\n @auto1h_fold_change.destroy\n\n respond_to do |format|\n format.html { redirect_to(auto1h_fold_changes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n expire_page :action => :index\n expire_page :action => :show\n \n @ganglia_graph = GangliaGraph.get(params[:id])\n @ganglia_graph.destroy\n\n respond_to do |format|\n format.html { redirect_to(ganglia_graphs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @absence_request = AbsenceRequest.find(params[:id])\n @absence_request.destroy\n\n respond_to do |format|\n format.html { redirect_to(absence_requests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @configattribincl.destroy\n respond_to do |format|\n format.html { redirect_to configattribs_path, notice: 'Configattribincl Threshold is reset to default.' }\n format.json { head :no_content }\n end\n end", "def destroy\n \n @ontology = SYMPH::Ontology.find(params[:id])\n @ontology.disable\n @ontology.destroy\n \n respond_to do |format|\n format.html { redirect_to :action => :index }\n format.xml { head :ok }\n end\n end", "def delete_course_template(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/coursetemplates/#{org_unit_id}\"\n _delete(path)\n puts '[+] Course template data deleted successfully'.green\nend", "def destroy\n @short_term_goal = ShortTermGoal.find(params[:id])\n @short_term_goal.tasks.each do |task|\n task.destroy\n end\n @short_term_goal.destroy\n\n respond_to do |format|\n format.html { redirect_to(short_term_goals_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def deleteEntityAffiliate_link( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/affiliate_link\",params)\n end", "def delete\n Iterable.request(conf, base_path).delete\n end", "def destroy\n @engagement_attendee.destroy\n head :no_content\n end", "def destroy\n @test_dep_collector.destroy\n respond_to do |format|\n format.html {redirect_to test_dep_collectors_url, notice: 'Test dep collector was successfully destroyed.'}\n format.json {head :no_content}\n end\n end", "def destroy\n @gpsd.destroy\n\n head :no_content\n end", "def destroy\n @chef_att_source.destroy\n respond_to do |format|\n format.html { redirect_to chef_att_sources_url, notice: 'Chef att source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @hdfs_path = HdfsPath.find(params[:id])\n @hdfs_path.destroy\n\n respond_to do |format|\n format.html { redirect_to hdfs_paths_url }\n format.json { head :ok }\n end\n end", "def deleteEntityGroup( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/group\",params)\n end", "def destroy\n @hr_attendence = Hr::Attendence.find(params[:id])\n @hr_attendence.destroy\n\n respond_to do |format|\n format.html { redirect_to(hr_attendences_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @annotation_task = AnnotationTask.find(params[:id])\n @annotation_task.destroy\n\n respond_to do |format|\n format.html { redirect_to(annotation_tasks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @agency_relationship = AgencyRelationship.find(params[:id])\n @agency_relationship.destroy\n\n respond_to do |format|\n format.html { redirect_to(agency_relationships_url) }\n end\n end", "def deleteEntityAssociation_membership( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/association_membership\",params)\n end", "def destroy\n @gene = Gene.find(params[:gene_id])\n @feature = @gene.features.find(params[:id])\n @feature.destroy\n\n respond_to do |format|\n format.html { redirect_to @gene, notice: 'Feature was removed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @node_config = NodeConfig.destroy(params[:id])\n xml=@node_config.to_xml\n json=@node_config.to_json\n @node_config.destroy\n\n respond_to do |format|\n format.html { redirect_to(node_configs_url) }\n format.json { render :json => json}\n format.xml { render :xml => xml}\n end\n end", "def destroy\n @agency = Agency.find(params[:id])\n @agency.destroy\n\n #head :no_content\n head :accepted # o deberia dejarlo en not_content\n end", "def destroy\n @feature = Feature.find(params[:id])\n @feature.destroy\n\n respond_to do |format|\n format.html { redirect_to(features_url) }\n format.xml { head :ok }\n end\n end", "def deleteEntityDescription( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/description\",params)\n end", "def destroy\n @registering_agency.destroy\n respond_to do |format|\n format.html { redirect_to registering_agencies_url }\n format.json { head :no_content }\n end\n end", "def deleteEntityCategory( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/category\",params)\n end", "def destroy\n @service_level_agreement = current_user.company.service_level_agreements.find(params[:id])\n @service_level_agreement.destroy\n\n render :json => {:success => true}\n end", "def destroy\n @helocagree = Helocagree.find(params[:id])\n @helocagree.destroy\n\n respond_to do |format|\n format.html { redirect_to(helocagrees_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @feature_status = FeatureStatus.find(params[:id])\n @feature_status.destroy\n\n respond_to do |format|\n format.html { redirect_to(feature_statuses_url) }\n format.xml { head :ok }\n end\n end", "def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end", "def destroy\n @node_incident = NodeIncident.find(params[:id])\n @node_incident.destroy\n\n respond_to do |format|\n format.html { redirect_to node_incidents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @agent = Agent.find(params[:id])\n @agent.destroy\n \n respond_to do |format|\n format.html { redirect_to(agents_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @agency.destroy\n respond_to do |format|\n format.html { redirect_to agencies_url, notice: \"Agency was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @geofence.destroy\n respond_to do |format|\n format.html { redirect_to geofences_url, notice: 'Geofence was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @graded_component = GradedComponent.find(params[:id])\n @graded_component.destroy\n\n respond_to do |format|\n format.html { redirect_to(graded_components_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @location_tag = LocationTag.find(params[:id])\n @location_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to(location_tags_url(:farm_id => @farm.id)) }\n format.xml { head :ok }\n end\n end", "def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end", "def destroy\n @tax_computation = TaxComputation.find(params[:id])\n @tax_computation.destroy\n\n respond_to do |format|\n format.html { redirect_to(tax_computations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n chef_server_rest.delete(\"nodes/#{name}\")\n end", "def destroy\n @encounter_area_feature = EncounterAreaFeature.find(params[:id])\n @encounter_area_feature.destroy\n\n respond_to do |format|\n format.html { redirect_to(encounter_area_features_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @guide_taxon.destroy\n\n respond_to do |format|\n format.html { redirect_to edit_guide_url(@guide_taxon.guide_id), notice: \"Taxon removed\" }\n format.json { head :no_content }\n end\n end", "def delete\n @options[:connection].delete(\"/namespaces/#{path}\") && true\n end", "def deleteEntityOpening_times( entity_id)\n params = Hash.new\n params['entity_id'] = entity_id\n return doCurl(\"delete\",\"/entity/opening_times\",params)\n end", "def destroy\n @discovery = Discovery.find(params[:id])\n @discovery.destroy\n\n respond_to do |format|\n format.html { redirect_to(discoveries_url) }\n format.xml { head :ok }\n end\n end", "def delete_analysis(analysis_id); rest_delete(\"#{link('analyses')}/#{analysis_id}\"); nil; end", "def destroy\n @constituency = Constituency.find(params[:id])\n @constituency.destroy\n\n respond_to do |format|\n format.html { redirect_to(constituencies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @retain_node_selector = RetainNodeSelector.find(params[:id])\n @retain_node_selector.destroy\n\n respond_to do |format|\n format.html { redirect_to(retain_node_selectors_url) }\n format.xml { head :ok }\n end\n end", "def deleteEntityAffiliate_adblock( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/affiliate_adblock\",params)\n end", "def delete_course_by_id(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/courses/#{org_unit_id}\" # setup user path\n # ap path\n _delete(path)\n puts '[+] Course data deleted successfully'.green\nend", "def delete_all(xpath); end", "def destroy\n @vdocs_requirement = VdocsRequirement.find(params[:id])\n @vdocs_requirement.destroy\n\n respond_to do |format|\n format.html { redirect_to(vdocs_requirements_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @beacon.destroy\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 @tracker.destroy\n\n head :no_content\n end", "def destroy\n @gig = Gig.find(params[:id])\n @gig.destroy\n\n respond_to do |format|\n format.html { redirect_to(gigs_url) }\n format.xml { head :ok }\n end\n end", "def delete_consistency_group_snapshot_view(sys_id, cg_id, view_id)\n\t response = request(:delete, \"/devmgr/v2/storage-systems/#{sys_id}/consistency-groups/#{cg_id}/views/#{view_id}\")\n status(response, 204, 'Failed to remove consistency group snapshot view')\n end", "def destroy\n @agency\n # if ComplianceRecord.exists?(compliance_type_id: @agency.id)\n # flash[:alert] = \"This Compliance Type is used in Transaction\"\n # else\n @agency.destroy\n @agencies = Agency.all\n #end\n redirect_to agencies_path\n end", "def destroy\n @gt_registration.destroy\n respond_to do |format|\n format.html { redirect_to index_with_payed_gt_race_gt_category_gt_registrations_path(@gt_race,0), notice: 'Gt registration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete uri\n @change_semaphore.synchronize do\n filename = uri_to_file(uri)\n library.delete filename\n # Remove diagnostics for deleted files\n send_notification \"textDocument/publishDiagnostics\", {\n uri: uri,\n diagnostics: []\n }\n end\n end", "def destroy\n @taxon_determination.destroy\n respond_to do |format|\n format.html { redirect_to taxon_determinations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @probe = Probe.find(params[:id])\n @probe.destroy\n\n respond_to do |format|\n format.html { redirect_to(probes_url) }\n format.xml { head :ok }\n end\n end", "def delete_gists(id)\n result = self.class.delete(\"/gists/#{id}\", :headers => @headers)\n puts \"#{result.headers['x-ratelimit-remaining']} requests left!\"\n end", "def destroy\n @expectation_stem = RiGse::ExpectationStem.find(params[:id])\n @expectation_stem.destroy\n\n respond_to do |format|\n format.html { redirect_to(expectation_stems_url) }\n format.xml { head :ok }\n end\n end", "def delete!( opts = {} )\n http_action :delete, nil, opts\n end", "def deleteEntityEmployee( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/employee\",params)\n end" ]
[ "0.6112878", "0.5997687", "0.59097254", "0.5873835", "0.5868019", "0.57327247", "0.5721108", "0.5714357", "0.5694244", "0.5650237", "0.5639041", "0.5635341", "0.5630738", "0.5623372", "0.56099933", "0.5598466", "0.5577469", "0.5575416", "0.55738604", "0.5562374", "0.5547541", "0.55394256", "0.55368656", "0.55329055", "0.55245763", "0.5501822", "0.55004275", "0.5486706", "0.54839176", "0.5477237", "0.54693705", "0.54692745", "0.545401", "0.54505694", "0.5443404", "0.54365927", "0.54326147", "0.5432314", "0.5429663", "0.54258794", "0.54247034", "0.542455", "0.54238665", "0.54229873", "0.54187584", "0.5408448", "0.54079926", "0.5407735", "0.5403606", "0.54022956", "0.5396407", "0.5395206", "0.53945255", "0.5383833", "0.53813124", "0.53761184", "0.5375767", "0.5374601", "0.53681093", "0.5367476", "0.53646064", "0.5360012", "0.53589416", "0.5358698", "0.5357465", "0.5353914", "0.53530395", "0.5344365", "0.53434587", "0.53377026", "0.5335185", "0.5334831", "0.53318876", "0.53315365", "0.53236556", "0.5319669", "0.5317531", "0.53165495", "0.5313072", "0.53102875", "0.53101075", "0.5306846", "0.53043705", "0.53031486", "0.5298877", "0.5297859", "0.529415", "0.5292884", "0.5286586", "0.5286024", "0.5285171", "0.52814424", "0.52802986", "0.52796733", "0.5279273", "0.5278792", "0.52748847", "0.52721673", "0.5270098", "0.5269754" ]
0.71470106
0
GET /users GET /users.json
def index @users = User.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def users(args = {})\n get(\"/users.json\",args)\n end", "def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end", "def GetUsers params = {}\n\n params = params.merge(path: 'users.json')\n APICall(params)\n\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end", "def list_users\n self.class.get('/users')\n end", "def users\n get('get_users')\n end", "def index\n users = User.all\n json_response(users)\n end", "def show\n @users = User.all\n json_response(@users)\n end", "def list\r\n users = User.all\r\n render json: users\r\n end", "def show\n @users = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @users }\n end\n end", "def get \n render :json => User.find(params[:id])\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n users = User.all\n render json: { users: users }, status: :ok\n end", "def index\r\n users = User.all\r\n render json: users\r\n end", "def users(params = {})\n params.merge!(key: 'users')\n objects_from_response(Code42::User, :get, 'user', params)\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def users(params = {})\n make_get_request('/account/users', params)\n end", "def index\n users = User.all\n render json: users \n end", "def index\n users = User.all\n\n render json: users, each_serializer: Api::V1::UsersSerializer\n end", "def index\n user= User.all\n render json: {users:user}\n end", "def index\n @users = User.all\n render json: @users, status: :ok\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n json_response(User.all) \n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end", "def index\n users = User.all \n render json: users \n end", "def index\n\t\t# specifying json format in the URl\n\t uri = \"#{API_BASE_URL}/users.json\"\n\t # It will create new rest-client resource so that we can call different methods of it\n\t rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n\n\t # this next line will give you back all the details in json format, \n\t #but it will be wrapped as a string, so we will parse it in the next step.\n\t users = rest_resource.get \n\n\t # we will convert the return data into an array of hash. see json data parsing here\n\t @users = JSON.parse(users, :symbolize_names => true)\n\tend", "def list\n render json: User.all\n end", "def index\n\t\t@users = User.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @users.map(&:as_json) }\n\t\tend\n\tend", "def index\n @users = User.all\n render json: @users, status: :ok\n end", "def user\n render :json=> User.find(params[:id])\n end", "def index\n\n users = User.all \n render json: users\n\n end", "def show\n render json: Users.find(params[\"id\"])\n end", "def GetUser id\n\n APICall(path: \"users/#{id}.json\")\n\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html\n format.json { render json: @users }\n end\n end", "def show\n @users = User.find(params[:id])\n if @users\n respond_to do |format|\n format.json { render :json => @users }\n format.xml { render :xml => @users }\n end\n else\n head :not_found\n end\n end", "def index\n \t@users = User.all\n\n respond_to do |format| \n format.json { render json: @users }\n end\n end", "def list\n get('users')['users']\n end", "def index\n render ActiveModelSerializers::SerializableResource.new(@users,\n each_serializer: UserSerializer\n ).to_json, status: 200\n end", "def index\n @users = User.all \n render json: @users, status: :ok \n end", "def index\n @users = User.all\n logger.debug(\"user index\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n render json: User.all\n end", "def index\n @users = User.order_by(last_name: :desc)\n if @users\n render json: Oj.dump(json_for(@users, include: ['phones', 'cards'], meta: meta), mode: :compat)\n else\n return head :unauthorized\n end\n end", "def users(params = {})\n response = get('users/lookup.json', params)\n response.map {|user| Croudia::Object::User.new(user) }\n end", "def index\n render json: User.all\n end", "def index\n render json: User.all\n end", "def show\n user = User.find(params[:id])\n render json: @user\nend", "def show\n user = User.find(params[:id])\n render json: user\n end", "def list_users(user_id)\n self.class.get(\"/users/#{user_id}\")\n end", "def index\n @users = User.all(limit: 100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users.as_json(user: current_user) }\n end\n end", "def index\n\t\t@users = User.all\n\n\t\trespond_to do |format|\n\t\t format.html # index.html.erb\n\t\t format.json { render json: @users }\n\t\tend\n\tend", "def get_users\r\n # Prepare query url.\r\n _path_url = '/users'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n decoded.map { |element| User.from_hash(element) }\r\n end", "def show\n # When a http GET request to '/users/1' is received, have it show,\n # in json format, user 1's information.\n @id = params[:id]\n @user = User.find(@id)\n render json: @user\n end", "def show\n user = User.find(params[:id])\n\n render json: user\n end", "def index \n render json: User.all\n end", "def index\n @myusers = Myuser.all\n\n render json: @myusers\n end", "def index\n\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def query_users(options={}) path = \"/api/v2/users\"\n get(path, options, AvaTax::VERSION) end", "def index\n @users = User.all\n\n respond_with do |format|\n format.json do\n render json: @users,\n each_serializer: Api::UserSerializer,\n root: 'users'\n end\n end\n end", "def list\n response = @client.get(\"/users\")\n response[\"users\"].map {|u| User.new(@client, u) }\n end", "def users\n\t\trespond_with User.all\n\tend", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end" ]
[ "0.8210063", "0.78731877", "0.78600395", "0.78103924", "0.78053653", "0.76777875", "0.76582843", "0.7632195", "0.75826395", "0.7529077", "0.7487757", "0.7448671", "0.7439283", "0.7437491", "0.74267244", "0.739832", "0.739832", "0.739832", "0.739832", "0.73765147", "0.73729014", "0.7369062", "0.7368926", "0.73668975", "0.73590183", "0.73590183", "0.73590183", "0.73590183", "0.73590183", "0.73590183", "0.73590183", "0.73590183", "0.73590183", "0.73590183", "0.7351432", "0.7350643", "0.7350643", "0.7350643", "0.7350643", "0.7350643", "0.7350643", "0.7346363", "0.7343178", "0.7331029", "0.7323025", "0.732243", "0.7312822", "0.72958225", "0.7274743", "0.7265865", "0.72622997", "0.7260527", "0.7224177", "0.72189367", "0.719325", "0.71878123", "0.718746", "0.71809554", "0.7171059", "0.71693754", "0.7155354", "0.7154987", "0.7154987", "0.714082", "0.7134951", "0.7134066", "0.7131236", "0.713069", "0.7119148", "0.71146935", "0.7113002", "0.7108284", "0.7098436", "0.7095541", "0.7095541", "0.7092079", "0.70892197", "0.70887285", "0.70885944", "0.70851743", "0.70851743", "0.70851743", "0.70851743", "0.70851743", "0.70851743", "0.70851743", "0.70814484", "0.70814484", "0.70814484", "0.70814484", "0.70814484", "0.70814484", "0.70814484", "0.70814484", "0.70814484", "0.70814484", "0.70814484", "0.70814484", "0.70814484", "0.70814484", "0.70814484" ]
0.0
-1
GET /users/1 GET /users/1.json
def show @user = User.find(params[:id]) @self = current_user.try(:id) == @user.id respond_to do |format| format.html format.json { render json: @user.as_json(only: [:type, :name, :email, :dob, :community, :nationality, :address, :number], include: [branches: {only:[:id, :name] } ] ) } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end", "def get \n render :json => User.find(params[:id])\n end", "def GetUser id\n\n APICall(path: \"users/#{id}.json\")\n\n end", "def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end", "def users(args = {})\n get(\"/users.json\",args)\n end", "def show\n # When a http GET request to '/users/1' is received, have it show,\n # in json format, user 1's information.\n @id = params[:id]\n @user = User.find(@id)\n render json: @user\n end", "def user\n render :json=> User.find(params[:id])\n end", "def fetch_one_user_data\n get_url(\"/api/v1/users/#{@filter}\")\n end", "def show\n user = User.find(params[:id])\n render json: @user\nend", "def show\n user = User.find(params[:id])\n render json: user\n end", "def show\n user = User.find(params[:id])\n\n render json: user\n end", "def show\n render json: Users.find(params[\"id\"])\n end", "def show\n user = User.find(params[:id])\n render json: user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n user = User.select(:id, :username, :email).find(params[:id])\n render :json => user\n end", "def show\n render json: User.find(params[\"id\"])\n end", "def show\n @users = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @users }\n end\n end", "def show\n @user = User.find(params[:id])\n render json: @user\nend", "def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end", "def show\n render json: User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n render json:@user\n end", "def show\n @user = User.find(params[:id])\n render json:@user\n end", "def get_by_id\n \n # the user_id param comes from our route\n user = User.find(params[:user_id])\n \n if user\n render json: user, status: :ok\n else\n render json: { errors: 'User not found' }, status: :not_found\n end\n end", "def GetUsers params = {}\n\n params = params.merge(path: 'users.json')\n APICall(params)\n\n end", "def get_user_details\n @user = User.find_by_id(params[:user_id])\n render json: @user\n end", "def show\n render json: User.find(params[:id])\n end", "def show\n user = User.find_by(id: params[:id])\n render json: user, status: :ok\n end", "def user(id)\n self.class.get(\"/user/#{id}\", @options).parsed_response\n end", "def show\n @user = User.find(params[:id])\n render json: {user: @user}\n end", "def list_users\n self.class.get('/users')\n end", "def show\n user = User.find(params[:id])\n render json: user\n end", "def show\n user = User.friendly.find(params[:user_id]) \n render json: user\n end", "def show\n render :json => User.find(params[:id])\n end", "def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response[\"user\"]\n end", "def index\n users = User.all\n json_response(users)\n end", "def show\n @user = ActiveRecord::Base.connection.execute(\"\n SELECT * \n FROM users \n WHERE username = '#{params[:username].downcase}' \n LIMIT 1\").first\n\n respond_to do |format|\n format.html\n format.json {render json: User.find(@user[0])}\n end\n end", "def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response.first[1]\n end", "def show\n @users = User.all\n json_response(@users)\n end", "def index\n json_response(User.all) \n end", "def get(user_id:)\n path = '/users/{userId}'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'GET',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::User\n )\n end", "def index\n users = User.all\n render json: { users: users }, status: :ok\n end", "def show\n # @user = User.first\n user = User.find(params[:id])\n render json: user\n end", "def user(user_id, params = {})\n make_get_request(\"/users/#{user_id}\", params)\n end", "def show_user_profile\n @user = User.find(username: params[:username])\n render json: @user\n end", "def user(id = nil)\n id.to_i.zero? ? get('/user') : get(\"/users/#{id}\")\n end", "def get_user id, options={}, headers={}\n @connection.get \"users/#{id}.json\", options, headers\n end", "def user(user=nil)\n if user\n get(\"/users/#{user}\", {}, 3)\n else\n get(\"/user\", {}, 3)\n end\n end", "def index\n \n @user = User.find(current_user.id) \n\n respond_to do |format|\n format.html { render action: \"show\" }\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @user }\n end\n end", "def get_user(user_id:)\n parse(JSON.parse(connection.get(\"users/#{user_id}\").body))\n end", "def index\n user= User.all\n render json: {users:user}\n end", "def index\r\n users = User.all\r\n render json: users\r\n end", "def show\n # puts params[:id]\n render json: User.find(params[:id])\n end", "def get_user_info\n id = params[\"id\"]\n error_list = []\n status = 1\n json_response = {}\n user = User.find_by(id: id)\n\n if user.nil?\n error_list.append(\"Error: The specified user doesn't exist.\")\n status = -1\n else\n json_response[\"user\"] = user.get_user_json_data\n end\n\n if status == -1\n json_response[\"errors\"] = error_list\n end\n\n json_response[\"status\"] = status\n\n # Format the json_response into proper JSON and respond with it\n json_response = json_response.to_json\n\n respond_to do |format|\n format.json { render json: json_response }\n end\n end", "def show\n @user = User.find(params[:id])\n if @user\n render json: {\n user: @user\n }\n else\n render json: {\n status: 500,\n errors: ['user not found']\n }\n end\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def show\n @user = User.find(params[:id])\n render json: {\n username: @user.username,\n first_name: @user.first_name,\n last_name: @user.last_name,\n email: @user.email,\n phone_number: @user.phone_number,\n contacts: @user.contacts\n }, status: :ok\n end", "def get_user(user_id)\n request(Route.new(:GET, '/users/%{user_id}', user_id: user_id))\n end", "def show\n @user = User.find(params[:id])\n render 'api/v1/users/show'\n end", "def index\n users = User.all\n\n render json: users, each_serializer: Api::V1::UsersSerializer\n end", "def index\n users = User.all\n render json: users \n end", "def user(user_id)\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n get(\"users/#{user_id}.json\", params)\n end", "def index\n users = User.all \n render json: users \n end", "def list\r\n users = User.all\r\n render json: users\r\n end", "def json_show_user_profile_by_user_id\n @user = User.find(params[:user_id])\n\n respond_to do |format|\n format.json { render json: @user.as_json(only:[:email,:username]) }\n end\n end", "def index\n\t\t# specifying json format in the URl\n\t uri = \"#{API_BASE_URL}/users.json\"\n\t # It will create new rest-client resource so that we can call different methods of it\n\t rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n\n\t # this next line will give you back all the details in json format, \n\t #but it will be wrapped as a string, so we will parse it in the next step.\n\t users = rest_resource.get \n\n\t # we will convert the return data into an array of hash. see json data parsing here\n\t @users = JSON.parse(users, :symbolize_names => true)\n\tend", "def show\n user = User.find_by(uid: params[:id])\n if user\n puts 'USER FOUND'\n render json: user\n else\n puts 'NO USER'\n render json: 'no user'.to_json\n end\n end", "def show\n render json: UserService.get_user(params[:id]), includes: 'questions, answers'\n end", "def index\n @users = User.all(limit: 100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users.as_json(user: current_user) }\n end\n end", "def index\n render :json => User.all, status: 200\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users, status: :ok\n end", "def show\n @users = User.find(params[:id])\n if @users\n respond_to do |format|\n format.json { render :json => @users }\n format.xml { render :xml => @users }\n end\n else\n head :not_found\n end\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end" ]
[ "0.81046426", "0.7703556", "0.77011716", "0.76262826", "0.7582106", "0.74818", "0.7461394", "0.7446168", "0.730656", "0.7300699", "0.72902125", "0.72781444", "0.72358584", "0.72335744", "0.72335744", "0.72335744", "0.72335744", "0.72335744", "0.72335744", "0.72335744", "0.7225407", "0.7225407", "0.7225407", "0.7225407", "0.7225407", "0.7225407", "0.7225407", "0.7225407", "0.72222257", "0.72165024", "0.72137505", "0.72096044", "0.71930283", "0.7182953", "0.7182144", "0.7182144", "0.7180289", "0.71750754", "0.7173851", "0.71640617", "0.71636444", "0.71453786", "0.7145053", "0.7129776", "0.71256554", "0.71160513", "0.7095665", "0.70941204", "0.70772994", "0.7070785", "0.7070607", "0.7063351", "0.70552826", "0.7025071", "0.7014598", "0.70047677", "0.6998373", "0.69910055", "0.6984177", "0.6979766", "0.6972448", "0.6972228", "0.6968384", "0.69666255", "0.6956339", "0.69506294", "0.6945614", "0.6943135", "0.69351804", "0.6932212", "0.6932212", "0.6932212", "0.6932212", "0.6927094", "0.69255126", "0.6925136", "0.6917375", "0.6907744", "0.68947464", "0.6882589", "0.6875701", "0.68749416", "0.68633634", "0.6861618", "0.6858055", "0.6855495", "0.68530583", "0.685255", "0.685255", "0.685255", "0.685255", "0.685255", "0.685255", "0.685255", "0.685255", "0.685255", "0.685255", "0.6849599", "0.6847195", "0.6847074", "0.6847074" ]
0.0
-1
POST /users POST /users.json PATCH/PUT /users/1 PATCH/PUT /users/1.json
def update respond_to do |format| if @user.update(user_params) format.html { redirect_to @user, notice: 'User was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @user.errors.full_messages } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end", "def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n if user.update(user_params)\n render json: user\n else\n render json: {errors: \"Cannot create user\"}, :status => 420\n end\n end", "def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end", "def update\n respond_to do |format|\n if @user.update(form_params)\n format.json { render json: { users: @user }, status: :ok, location: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_many\n if @users.update_all(user_params)\n render json: @users, status: :ok, location: users_url\n else\n render json: @users.errors, status: :unprocessable_entity\n end\n end", "def update\n begin\n user = User.find(params[:user_id])\n if user.update(user_params)\n render json: { users: user }, status: :ok\n else\n render json: { errors: user.errors.messages }, status: 422\n end\n rescue => e\n render json: { errors: e.message }, status: 404\n end\n end", "def update\n \trespond_to do |format|\n if @user.update(user_params)\n format.json { render json: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n\t \t\n end", "def update\n user = User.find(params[:id])\n\n # Use update with user_params to do a mass-assignment update and save. \n if user.update_attributes(user_params)\n render json: user\n else \n render json: user.errors.full_messages, status: :unprocessable_entity\n end\n end", "def updateUser\n options = {\n :body => params.to_json,\n :headers => {\n 'Content-Type' => 'application/json',\n 'Authorization' => request.headers['Authorization']\n }\n }\n results = HTTParty.put(\"http://192.168.99.101:4051/users/\"+@current_user[\"id\"].to_s, options)\n render json: results.parsed_response, status: results.code\n end", "def update\n @user = selected_user\n if @user.update(users_params)\n render 'api/users/show'\n else\n render json: @user.errors.full_messages, status: 422\n end\n end", "def update_user(options)\n patch(\"/user\", options, 3)\n end", "def update\n @user = User.find(params[:id])\n @user.name = params[:name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.photo = params[:photo]\n @user.save\n render json:@user\n end", "def update\n @user = User.find(params[:id])\n @user.name = params[:name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.photo = params[:photo]\n @user.role = params[:type]\n @user.save\n render json:@user\n end", "def update\n\t\tif @user.update(users_params)\n \t\tjson_response(@user, \"User Update Successfully.\")\n \telse\n \t\trender json: {message: @user.errors.full_messages.join(\" \")}, status: 400\n \tend\n\tend", "def update \n user = User.find(params[:id])\n # byebug\n user.update(user_params)\n\n render json: user\n end", "def update\n @user = User.find(params[:id]) \n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User #{@user.name} was successfully created.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_user_features\n \n # create new user\n post '/user', \"{ \\\"First Name\\\": \\\"Tom\\\", \\\"Last Name\\\": \\\"#{$user_name}\\\", \\\"User Login\\\": \\\"#{$user_name}\\\", \\\"act_key\\\": 1, \\\"Role\\\": \\\"Full-Time\\\" }\"\n assert (last_response.status == 200), \"Create user: response is not 200\"\n \n # get user with Last Name \"$user_guid\"\n get \"/user?Last%20Name=#{$user_name}\"\n $user_guid = JSON::parse(last_response.body)[0]['usr_key']\n assert (last_response.body.size > 50), \"Get user by name: response too small for valid data\"\n\n # modify user with guid defined in @guid variable\n put \"/user/#{$user_guid}\", '{\"Fax\": \"12345\", \"Description\": \"User Description\"}'\n assert (last_response.status == 200), \"Put user (modify): response is not 200\"\n \n # get user with uid defined in $user_guid variable\n get \"/user/#{$user_guid}\"\n assert (last_response.body.size > 50), \"Get user by id: response too small for valid data\"\n\n # change password for user with guid defined in $user_guid variable\n put \"/user/#{$user_guid}/password\", '{\"password\": \"Montag14\", \"notify_racf\": \"false\"}'\n assert (last_response.status == 200), \"Response is not 200\"\n \n # get user with uid defined in $user_name variable\n get \"/#{$user_name}\"\n assert (last_response.body.size > 50), \"Get user by username: response too small for valid data\"\n\n ## change password for user with user login defined in $user_name variable\n put \"/#{$user_name}/password\", '{\"password\": \"Montag15\", \"notify_racf\": false}'\n assert (last_response.status == 200), \"Response is not 200\"\n \n # get all users\n get '/user'\n assert (last_response.body.size > 50), \"Get all users: Response too small for valid data\"\n\n # get available user attributes\n get '/user/attributes'\n assert (last_response.body.size > 50), \"Get user attributes: Response too small for valid data\"\n \n # delete user with uid defined in @guid variable\n delete \"/user/#{$user_guid}\"\n assert (last_response.status == 204), \"Response is not 204\"\n end", "def update\n user = User.find(params[:id])\n user.update(user_params)\n if user.valid?\n render json: user\n else\n render json: user.errors\n end\n end", "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n user = User.find_by(id: params[:id])\n user.update(user_params)\n render json: user\n end", "def update\n if @user.update(user_params)\n render json: @user, status: 200\n else\n render json: @user.errors, status: 422\n end\n end", "def create\n # old_user = User.find(params[:id])\n\n # if old_user\n # old_user.update(user_params)\n # else\n @user = User.new(user_params)\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n # end\n end", "def update\n user = find_user\n user.update!(user_params)\n render json: user\n end", "def update\n respond_to do |format|\n if user.update(user_params)\n render json: user, status: :ok\n else\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n user = User.find(params[:id])\n if user.update(params_user)\n render json: user, status: 200\n else\n render json: user.errors, status: 422\n end\n\n end", "def update\n if @user.update(user_params)\n render json: @user, status: :ok\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: {error: \"Could not update user\"}\n end\n end", "def update\n if @user.id == current_api_user.id\n if @user.update(user_params)\n render json: @user.as_json(except: [:updated_at]), status: :ok\n else\n render json: @user.errors, status: :bad_request\n end\n else\n render json: '', status: :forbidden\n end\n end", "def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend", "def update\n\t\tif @user.update(user_params)\n\t\t\trender json: @user\n\t\telse\n\t\t\trender json: @user.errors, status: :unprocessable_entity\n\t\tend\n\tend", "def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end", "def update\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to users_path }\n format.json { render :json => @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user.update(user_params)\n respond_with @user\n end", "def post_users_with_http_info(users, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersApi.post_users ...'\n end\n # verify the required parameter 'users' is set\n if @api_client.config.client_side_validation && users.nil?\n fail ArgumentError, \"Missing the required parameter 'users' when calling UsersApi.post_users\"\n end\n # resource path\n local_var_path = '/users'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(users) \n\n # return_type\n return_type = opts[:return_type] || 'User' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Bearer']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#post_users\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n respond_to do |format|\n if @user\n @user.active = false\n @user.pending = false\n @user.save\n end\n format.json { render json: {:status => :ok}}\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n user = @user_service.update_user(params[:id])\n render json: user, status: :ok\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update user_params(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n if @user.update(user_params)\n render json: @user, status: :ok, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def my_stuff\n respond_to do |format|\n @user.valid?\n if @user.update(user_params)\n format.json {render json: '[]', status: :ok}\n else\n format.json {render json: @user.errors, status: :unprocessable_entity}\n end\n end\n end", "def update\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n respond_with @user\n end", "def update\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n respond_with @user\n end", "def patch_user(user_id, body)\n raise Auth0::MissingUserId, 'Must supply a valid user_id' if user_id.to_s.empty?\n raise Auth0::InvalidParameter, 'Must supply a valid body' if body.to_s.empty? || body.empty?\n path = \"#{users_path}/#{user_id}\"\n patch(path, body)\n end", "def update\n user = User.find(params[:id])\n render json: { status: 200, msg: 'User details have been updated.' } if user.update(user_params)\n end", "def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend", "def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend", "def update\n respond_to do |format|\n if current_user.update(user_params)\n format.json {\n render json: {\n status: 'success',\n data: current_user\n },\n status: :ok\n }\n else\n format.json { render json: current_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: I18n.t(:users_update) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def modify_user(user)\n query_api_object Model::User, '/rest/user', user.to_hash, 'PUT'\n end", "def update\n \tnew_params = user_params.delete_blanks!\n\n \trespond_to do |format|\n if @user.update_attributes(new_params)\n \tformat.html { redirect_to edit_user_path(@user.id), notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\nend", "def update \n user = User.where(:id => current_user.user)\n if user.update(user_params)\n render :json => {:user => user }\n else\n render :json => {:error => user.errors.full_messages.first}\n end\nend", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params[:user]))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update \n @current_user.update(user_params)\n render json: @current_user\n end", "def update\n @user.update(user_params_update)\n json_response(@user)\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n render json:@user\n else\n render json: { error: {code: 404, message: 'Invalid user' }}, status: :not_found\n end\n end", "def update\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to v1_resources_users_path(username: @user.username), notice: 'User was updated.' }\n format.json { render json: @user, status: :ok }\n else\n format.html { render(file: Rails.root.join('public', '422'), :formats => [:html], status: 422, layout: false) }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_user\n @user = User.find(params[:id])\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status :unprocessable_entity\n end\n end", "def update\n load_user\n build_user\n respond_to do |format|\n if user.save\n format.html { redirect_to user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @ser }\n else\n format.html { render :edit }\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n @user.update(user_params)\n render json: @current_user\n end", "def update\n params[\"user\"].each do |key, value| \n value.strip!\n if value == \"\"\n params[\"user\"].delete(key)\n end\n end\n \n params[\"user\"][\"email\"].downcase!\n \n @prev_user_info = User.find_by_id(params[\"user\"][\"id\"])\n existing_user = User.find_by_id(params[\"user\"][\"id\"])\n \n if !params[\"user\"][\"password_hash\"].blank?\n existing_user.password = params[\"user\"][\"password_hash\"]\n end\n\n if existing_user.update_attributes(params[\"user\"])\n @object = existing_user\n \n render \"user_success\"\n\n else\n @error_messages = existing_user.errors.to_a\n @user = User.new\n @new_item = User.find_by_id(params[\"id\"])\n\n render \"edit\"\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { render action: \"edit\"}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n \n end", "def update\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to users_path, notice: t('.updated_successful') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n user = User.find(params[:id])\n if user.update(user_params)\n render json: user\n else\n render json: user.errors.full_messages\n end\n end", "def update\n begin\n if request.content_type == \"application/json\" # Validamos el formato\n if @user.update(user_params)\n render json: @user\n else\n render status: :bad_request\n end\n else\n render status: :bad_request\n end\n rescue => exception\n # En caso de cualquier error que pueda ocurrir de formato u otro no capturado, devolveremos un status 400\n render status: :bad_request\n end\n \n end", "def update_user\n end", "def update\n respond_to do |format|\n if @user.update(user_params)\n @edit = true # Variable criated to differentiate edit and create when entering user edit _form.html.erb\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # only update the values that have things filled in\n updatedValues = params[:user]\n updatedValues.keep_if { |key, value| !value.blank? }\n\n respond_to do |format|\n if @user.update_attributes(updatedValues)\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_users\n if @project.user_id == current_user.id\n success = []\n errors = []\n @users.each do |user|\n extract_user = extract_user_id(user)\n if extract_user.nil?\n errors << { error: 'User does not exist' }\n else\n project_user = ProjectUser.find_user_in_project(extract_user, @project).first\n if project_user.nil?\n errors << { error: 'User does not have an assigned role in the project' }\n else\n project_user.role = user[:role]\n project_user.valid? ? success << project_user : errors << project_user.errors\n end\n end\n end\n if errors.empty?\n # Save is bad and shouldnt work, but update wont so here it is.\n success.each { |user| user.save }\n render json: @project.project_users, status: :created\n else\n render json: { errors: errors }, status: :unprocessable_entity\n end\n else\n render json: { error: 'Only the project owner can edit project users' }, status: :unauthorized\n end\n end", "def update\n user = User.find(params[:id])\n if user.update(user_params)\n render json: {\n status: 'OK',\n msg: 'User details have been updated.',\n error: 'nil'\n }, status: :accepted\n else\n not_good(406)\n end\n end", "def update\n respond_to do |format|\n if @user.update(user_params)\n @user.phones.destroy_all\n phone_count = phone_params[\"type_ids\"].try(:count) || 0\n\n phone_count.times do |index|\n unless phone_params[\"numbers\"][index] == \"\"\n @user.phones.create(type_id: phone_params[\"type_ids\"][index], number: phone_params[\"numbers\"][index], extension: phone_params[\"extensions\"][index])\n end\n end\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n\t\t@user = User.find(params[:id])\n\t\t# @user.assign_attributes(user_params)\n\n\t\t# Only try to save attributes that have been updated\n\t\tparams[:user].delete(:password) if params[:user][:password].blank?\n\t\t\n\t\tif @user.update_attributes(user_params)\n\n\t\t\t\trender json: @user, status: 200\n\n\t\telse\n\t\t\tprint(\"error updating user #{@user.errors.messages.inspect}\")\n\t\t\trender json: { errors: @user.errors.messages.inspect }, status: 422\n\t\tend\n\n\tend", "def update\n @user = User.find(params[:id])\n\n if @user.update(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @todo = Todo.find(params[:todo][:id])\n if @todo.update_attributes(user_params)\n render json: @todo\n else\n render nothing: true, status: :bad_request\n end\n end", "def update_user(user, options = {})\n put \"/users/#{user}\", options\n end", "def update\n if @api_v1_user.update(api_v1_user_params)\n head :no_content\n else\n render json: @api_v1_user.errors, status: :unprocessable_entity\n end\n end", "def update_user\n user = current_user\n if user.update(update_params)\n render json: { status: { updated: \"Ok\" } }\n else\n render json: user.errors.full_messages\n end\n end", "def update\n @user = User.find(params[:id])\n if @user.update_attributes(user_params)\n redirect_to @user\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\nend", "def update\n if @user.update_attributes(user_params)\n render json: @user\n else\n log_modal_errors @user\n render json: @user.errors.full_messages, status: :bad_request\n end\n end", "def update\n @user = current_api_user\n unless @user.update(user_params)\n render json: { error: @user.errors.full_messages.to_sentence }, status: :not_found\n end\n end", "def update\n UserComposite.new( user_params.merge(id: params[:id]) ).update!\n render json: StatusSerializer.new(:accepted), status: :accepted\n rescue ActiveRecord::RecordInvalid => ex\n render json: UserSerializer.new( ex.record ), status: :unprocessable_entity\n end", "def update\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to :back, notice: 'Changes Saved.' }\n format.json { head :no_content }\n else\n format.html { redirect_to :back, notice: 'Something went wrong.' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_path, :notice => 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @user.update(user_params)\n \tdata = { data: @user, status: :ok, message: \"User was successfully updated.\" }\n render :json => data\n else\n \tdata = { data: @user.errors, status: :unprocessable_entity }\n render :json => data\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update_user(uid, params={})\n begin\n RestClient.post construct_url(\"user/#{uid}\"), params\n true\n rescue RestClient::BadRequest => e\n @last_error = e.http_body\n @last_error_code = e.http_code\n false\n end\n end", "def update\n @users = User.find(params[:id])\n\n respond_to do |format|\n if @users.update_attributes(params[:regist])\n format.html { redirect_to @users, notice: 'Regist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @users.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\tuser = User.find(params[:id])\n if user\n if @current_user.id == user.id\n \n user.encrypted_password = nil if params[:password]\n user.password = params[:password] if params[:password]\n user.password_confirmation = params[:password_confirmation] if params[:password]\n user.first_name = params[:first_name] if params[:first_name]\n user.last_name = params[:last_name] if params[:last_name]\n \n if user.save()\n payload = {\n error: false,\n id: user.id\n }\n render status: 200, json: payload\n else\n errors = []\n user.errors.keys.each do |key|\n errors << {field: key, message: user.errors.full_messages_for(key).first}\n end\n payload = {\n error: true,\n errors: errors\n }\n render status: 200, json: payload\n end\n else\n render status: 403\n end\n else\n render status: 404\n end\n\tend", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(params[:user])\n @user.status = 'active'\n\n respond_to do |format|\n if @user.save\n format.json { render :json => @user, :status => :created }\n format.html { redirect_to(users_path) }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_current_logged_in_users_password(args = {}) \n put(\"/users.json/current/password\", args)\nend", "def create\n respond_to do |format|\n if @user.save\n flash[:notice] = 'User was successfully created.'\n @changed << @user.id\n \n format.html { redirect_to users_path }\n format.js { render 'shared/index'; flash.discard }\n format.json { render json: @user, status: :created, location: @user }\n else\n @edited << 'new'\n @expanded << 'new'\n\n format.html { render action: 'new', template: 'shared/new' }\n format.js { render 'user' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_edit_user\n case request.method\n when :get\n if !params[:id].nil?\n @user = User.find(params[:id])\n else\n @user = nil\n end\n render\n return\n when :post\n if params[:id].nil?\n @user = User.new(:verified => 1,\n :new_password => \"default\")\n else\n @user = User.find(params[:id])\n end\n @user.login_id = params[:login_id]\n @user.phone = params[:phone]\n if @user.save\n flash[:success] = \"Saved the user: \" + @user.login_id\n redirect_to :action => \"users\"\n else\n flash[:error] = \"Problems with saving the user: <br />\"\n flash[:error] += @user.errors.full_html_error_string\n render\n return\n end\n end\n end", "def modify_user(user)\n query_api_object User, \"/rest/user\", user.dump(), \"PUT\"\n end", "def update\n user_params.delete(:password) if user_params[:password].nil? || user_params[:password] == \"\"\n r = @api.update_user(params[:id], user_params)\n respond_to do |format|\n if r.code == 204\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n else\n response = JSON.parse(r.body)\n format.html { redirect_to users_url, alert: response['message']}\n end\n end\n end" ]
[ "0.6738925", "0.6675159", "0.6655539", "0.66540796", "0.65905225", "0.65167177", "0.6503634", "0.64781594", "0.6477745", "0.6390173", "0.63605255", "0.6355535", "0.634593", "0.63340324", "0.6327199", "0.63032496", "0.6296734", "0.6283449", "0.62784576", "0.62697935", "0.62697935", "0.6244638", "0.62424237", "0.62385607", "0.62365925", "0.62179697", "0.6213495", "0.61904085", "0.6174231", "0.61550313", "0.61476797", "0.6143595", "0.6143237", "0.6131201", "0.61199296", "0.6109842", "0.6087856", "0.60865843", "0.60865843", "0.60746485", "0.60671866", "0.60568506", "0.60514396", "0.60285574", "0.60285574", "0.60273063", "0.60244644", "0.6006963", "0.6006963", "0.6002458", "0.5994901", "0.5989544", "0.5988776", "0.59826994", "0.59802437", "0.59775263", "0.5971055", "0.5967051", "0.59638524", "0.59583104", "0.59461814", "0.5940609", "0.593549", "0.5924223", "0.5918617", "0.59179854", "0.5905364", "0.59044003", "0.5903317", "0.5901774", "0.5897755", "0.58943677", "0.5893624", "0.58910316", "0.58885324", "0.58884686", "0.5886704", "0.58856267", "0.58826137", "0.5871738", "0.58712256", "0.5868105", "0.5868058", "0.5867337", "0.58672595", "0.58670264", "0.5866582", "0.5864119", "0.586316", "0.586316", "0.58614105", "0.585864", "0.5856944", "0.58567107", "0.58567107", "0.5853763", "0.5848774", "0.5845631", "0.5844833", "0.5844299", "0.58438164" ]
0.0
-1
DELETE /users/1 DELETE /users/1.json
def destroy @user = User.find(params[:id]) @user.destroy respond_to do |format| format.html { redirect_to users_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end", "def delete\n render json: User.delete(params[\"id\"])\n end", "def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end", "def delete\n render json: Users.delete(params[\"id\"])\n end", "def delete\n @user.destroy\n respond_to do |format|\n format.html { redirect_to v1_resources_users_all_path, notice: 'User was deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end", "def destroy\n @user = V1::User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(v1_users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n \"\"\"\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n \"\"\"\n end", "def destroy\n debugger\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n user = User.find(params[:id]) # from url, nothing to do with table\n user.destroy\n render json: user\n end", "def destroy\n @user.destroy\n format.json { head :no_content }\n end", "def destroy\n @user.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find_by_id_or_username params[:id]\n @user.destroy\n render api_delete @user\n end", "def delete_user\n @user = User.find(params[:id])\n if @user.destroy\n render :json => @user\n else\n render :json => @user.errors.full_messages\n end\n end", "def destroy\n @user = user.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @v1_user.destroy\n respond_to do |format|\n format.html { redirect_to v1_users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n \n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7873292", "0.7750298", "0.7712461", "0.7608525", "0.74697524", "0.7405238", "0.7405238", "0.7367449", "0.7343722", "0.7337858", "0.73261935", "0.7307456", "0.73072684", "0.73045266", "0.7295572", "0.7288997", "0.72888744", "0.7287881", "0.72815514", "0.72480947", "0.72480947", "0.72480947", "0.72480947", "0.72480947", "0.72480947", "0.72480947", "0.72480947", "0.72480947", "0.72480947", "0.72480947", "0.72480947", "0.72480947", "0.72480947", "0.72480947", "0.72480947", "0.72480947", "0.7242396", "0.7239353", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735", "0.72293735" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_user @user = User.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def set_actions\n actions :all\n end", "def define_action_helpers?; end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def 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 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 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\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def 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 setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def duas1(action)\n action.call\n action.call\nend", "def call\n setup_context\n super\n end" ]
[ "0.6165422", "0.60457647", "0.5946384", "0.5916027", "0.58905005", "0.583495", "0.5777223", "0.56995213", "0.56995213", "0.56532377", "0.5621348", "0.5422839", "0.54118705", "0.54118705", "0.54118705", "0.53935355", "0.5379617", "0.53577393", "0.53407264", "0.53398263", "0.53316694", "0.53116405", "0.52972704", "0.5296464", "0.529617", "0.52609056", "0.52449894", "0.52388823", "0.52388823", "0.52388823", "0.52388823", "0.52388823", "0.52339035", "0.52324325", "0.52277064", "0.5221976", "0.5219301", "0.52134573", "0.5207571", "0.52070796", "0.51770556", "0.517467", "0.51727664", "0.51673347", "0.51603955", "0.51581466", "0.515401", "0.51533973", "0.5152852", "0.5143863", "0.5140699", "0.513394", "0.5113603", "0.5113603", "0.51126283", "0.5110439", "0.51070756", "0.50922215", "0.50881314", "0.50826275", "0.50788856", "0.50678945", "0.5055518", "0.5052638", "0.5049997", "0.5049997", "0.50348604", "0.5026469", "0.50217324", "0.50154436", "0.5013927", "0.50015604", "0.50013465", "0.49973735", "0.49900484", "0.49900484", "0.49862546", "0.4981161", "0.49783245", "0.49772155", "0.49678212", "0.49645492", "0.49579585", "0.49572104", "0.49550694", "0.4954394", "0.4952923", "0.49466532", "0.49427935", "0.49338013", "0.4931052", "0.49276745", "0.4927467", "0.4924998", "0.49223173", "0.49208498", "0.49184024", "0.49167758", "0.49163175", "0.4916066", "0.49157935" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def user_params params.require(:user).permit(:type, :name, :email, :dob, :community, :nationality, :address, :number) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def 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
(3:003:30) question 1 30 mins
def str_index_of(str1, str2) if str_include(str1, str2) get_index(str1, str2) else return -1 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_notification\n \"You have #{@time_to_answer / 60} min #{@time_to_answer % 60} sec left\"\n end", "def ask_time\n # twelve\n end", "def time_to_solve\n 1.hour\n end", "def reading_time(index)\n words_per_second = 270 / 60\n total_words = description(index).scan(/\\s+/).count\n article_time_seconds = total_words / words_per_second\n article_time_minutes = (article_time_seconds / 60).round\n\n return \"less than a minute read\" unless article_time_minutes > 0\n \"#{article_time_minutes} min read\"\n end", "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 find_quality_of_answer(text, typos, attempt, answer_time)\n if typos < text.size / 3.0\n quality = 5 - attempt\n quality = [quality - 1, 3].max if answer_time.to_f > 30.0\n else\n quality = [(text.size / typos).floor, 2].min\n end\n quality\n end", "def get_time_tutor_can_help\n start_time = self.student_requests.where(status:\"active\").first.start_time\n if(Time.now-start_time)/60>30 #if a tutor has been working longer than 30 min\n return Time.now.in_time_zone + 60*30\n end\n return start_time + 60*30\n end", "def display_time_at\n gm = self.good_memories.count\n bm = self.bad_memories.count\n lifespan = (Time.now.to_i - self.created_at.to_i)\n unless gm == 0\n shift = (lifespan * (bm + 1)) / gm\n return (Time.now.to_i - shift)\n else\n shift = lifespan * (bm + 1)\n return (Time.now.to_i - shift)\n end\n end", "def seconds_for_expedition\n possible_votes / 3 + 1\n end", "def prep_time_passed\n return \"7:34\"\n end", "def askQuestion(timeframe=1*DAY_TO_SECONDS)\n facts = @kb.getFacts(timeframe)\n while facts.length > 0\n fact = facts.sample\n matched = []\n @qat.each do |qat|\n ismatch = qat.matches(fact)\n matched.push(ismatch) if ismatch\n end\n qat,matchesArr = matched.sample\n if not qat #matching failed to match QAT and Tag\n facts = facts - [fact]\n next\n else\n #write question\n question,answers = qat.generateQuestionAnswerPair(fact,matchesArr)\n answers = [answers]\n if qat.aconds.first[:type] and qat.aconds.first[:type].include? 'list'\n similar = @kb.getSimilar(fact,timeframe,(not qat.aconds.first[:type].include? 'anysubclass'))\n similar.each do |simfact|\n answers << qat.generateQuestionAnswerPair(simfact,matchesArr)[1]\n end\n end\n puts \"Question:#{question}\"\n puts \"Possible Answers:#{answers.map {|a| a.gsub(\"\\n\",\"\")}}\"\n return [question,answers]\n end\n end\n return false\n end", "def get_time_recent(which_q, subreddit, which_to)\n result = which_to.call(subreddit.name, 1)\n result.first.nil? ? time = Time.now.to_f : time = result.first.timestamp \n time \n end", "def pill_taking_time_diff(record)\n ptime = record.pill_time_at\n ctime = record.actual_pill_time_at\n\tif ctime == nil\n\t\treturn \"No submission\"\n\tend\n range = (ptime - 10.minutes)..(ptime + 10.minutes)\n\n if range.cover? ctime\n \"Taken on time\"\n elsif record.created_at < record.pill_time_at\n \"Taken early by #{distance_of_time_in_words(ctime, ptime)}\"\n else\n \"Taken late by #{distance_of_time_in_words(ctime, ptime)}\"\n end\n end", "def time_in_symptomatics_last_30_days\n time_for_event_with_title_since(\"Accessed Symptomatics\", 30.days.ago)\n end", "def min() time[1] end", "def cooking_time\n end", "def time; end", "def time; end", "def time; end", "def time; end", "def time; end", "def time; end", "def time; end", "def time; end", "def time; end", "def submission_time_diff(record)\n ptime = record.pill_time_at\n ctime = record.created_at\n range = (ptime - 10.minutes)..(ptime + 10.minutes)\n\n if range.cover? ctime\n \"Submitted on time\"\n elsif record.created_at < record.pill_time_at\n \"Submitted early by #{distance_of_time_in_words(ctime, ptime)}\"\n else\n \"Submitted late by #{distance_of_time_in_words(ctime, ptime)}\"\n end\n end", "def completed_quests; $game_variables[17]; end", "def cstime=(*) end", "def parse_time\n # add a default time for a task.\n length_of_task = Time.now + 15.minutes\n\n # splits the entered text.\n sentence = body.split ' '\n esc_code = sentence.first\n\n # determines if the word is long enough.\n # if it was long enough, split the word into the necessary code.\n if esc_code.length >= 2\n esc_code_prefix = esc_code[0]\n esc_code_suffix = esc_code[1..-1]\n end\n\n # checks for valid escape sequence to parse.\n if esc_code_prefix == \"+\" and esc_code_suffix.match /\\d/\n # set time specified by user.\n length_of_task = Time.now + (esc_code_suffix.to_i * 60)\n # remove the escape code from the string.\n sentences = body.split ' ', 2\n self.body = sentences[1]\n end\n\n # set the completed at time field.\n self.completed_at = length_of_task\n \n end", "def when_to_run\n time - @@REMINDER_TIME\n end", "def validate_answer(result, right_answer, status, start_time, time)\r\n case result\r\n when right_answer\r\n # Get the stop time stamp to calculate the score, the faster to get the answer, the more bounds score is earned.\r\n answer_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)\r\n time_used = (answer_time - start_time).round(1)\r\n # Basic socre for each corrent answer is 500\r\n total_score = 500 + (time - time_used) * 10\r\n # Update the score and pass back to the loop\r\n status[0] += total_score\r\n status[1] += 1\r\n puts \"\\n\\n Hooray!!! You got it!!\"\r\n\r\n else\r\n puts \"\\n\\nSorry, not correct answer or time expired!\\nIt's fine. Let's keep going\"\r\n status[2] += 1\r\n end\r\n enter_to_continue\r\n end", "def timeofday_greet(m)\n return unless m.message =~ /\\b(good)? ?(morning|afternoon|evening|night),? #{m.bot.nick}\\b/i\n m.reply \"Good #{Regexp.last_match(2).downcase}, #{m.user.nick}!\"\n end", "def duration(quest)\n created = quest.created_at\n updated = quest.updated_at\n minutes = (updated - created) / 1.minutes\n return minutes.round\n end", "def time_limit\n [2, problem.time_limit].min\n end", "def question_timer(minutes)\n choice = :blank_answer\n Timeout::timeout(minutes * 60) do\n puts \"Времени на ответ в минутах: #{minutes}\"\n puts \"Выберите номер: \"\n choice = STDIN.gets.to_i\n end\n rescue Timeout::Error\n choice\nend", "def calculate_duration_of(task) ; 5 ; end", "def total_time; end", "def timebomb n, m, finis = nil, start = nil\n require \"time\"\n finis = Time.parse(finis || \"#{Time.now.year}-12-31\")\n start = Time.parse(start || \"#{Time.now.year}-01-01\")\n rest = (finis - Time.now)\n full = (finis - start)\n\n [((n - m) * rest / full).to_i + m, m].max\n end", "def build_timing; end", "def how_much_time?\n puts \"\"\n puts Rainbow(\"*\").blue * 70\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"About how much time do you have?\"\n puts \"\"\n puts \" 1. Less than 15 minutes.\"\n puts \" 2. 15 minutes - 30 minutes.\"\n puts \" 3. More than 30 minutes.\"\n puts \"\"\n puts \"\"\n puts \"Please enter a number.\"\n puts \"\"\n user_time = gets.strip\n self.quit if user_time == \"quit\"\n case user_time\n when \"1\"\n self.limit_time = 15\n when \"2\"\n self.limit_time = 30\n when \"3\"\n self.limit_time = 60\n else\n self.what_was_that?\n self.how_much_time?\n end\n self.suggest_possibility\n end", "def get_t_score(number_of_hours, previous_sets_to_compare)\n current_count = Word.where(\"name = ? AND story_date > ? AND story_date <= ?\", self, Time.now - number_of_hours.hours, Time.now).count\n word_counts = self.get_count(number_of_hours, previous_sets_to_compare)\n previous_mean = word_counts.drop(1).mean\n standard_deviation = word_counts.drop(1).standard_deviation\n sample_size = previous_sets_to_compare\n t_score = (current_count - previous_mean) / (standard_deviation / sample_size.to_f.sqrt)\n return t_score\n end", "def start_time; end", "def show_time?(reply)\n\t\t(Time.now - reply.created_at.localtime) > 300.0\n\tend", "def test_120_tasks_every_second_with_ms_task\n min_time = 1\n rl = @testClass.new 120, min_time\n delta = timed_run(rl) { sleep 0.001 }\n # puts \"\\n#{delta} >? #{min_time}\"\n assert((delta / min_time) > TIMING_TOLERANCE)\n end", "def read_time\n (number_of_words.to_f / WORDS_PER_MINUTE).ceil\n end", "def timer; end", "def timer; end", "def timer; end", "def timer; end", "def tock\n @minute += 1\n end", "def retrieve_and_print_worktime\n times = retrieve_worktime\n\n puts \"printing new worktime\"\n if (times[:over] > 0)\n puts \"Worktime: #{times[:over]} h\"\n else\n puts \"tasks.over: 0.0 h\"\n puts \"tasks.during: #{times[:during]} h\"\n puts \"tasks.into: #{times[:into]} h\"\n puts \"tasks.beyond: #{times[:beyond]} h\"\n end\n end", "def running_time(word, word_times)\n t = Time.now\n word.reverse * word_times\n t2 = Time.now\n running_time = t2 - t\nend", "def therapist_quest; end", "def hint\n if @config[:mode] == \"trivia\" # make sure we are in trivia mode\n if (Time.now - @trivia[:last_hint]) >= 5 # make sure a hint wasn't requested less than 5 seconds ago\n rnd = rand 5\n hint = \"\"\n # answer length\n (hint = \"It is #{@questions[@trivia[:cur_quest]][:answer].length} characters long.\") if rnd == 0\n # start and ending letters\n (hint = \"It starts with #{@questions[@trivia[:cur_quest]][:answer][0].chr} and ends with #{@questions[@trivia[:cur_quest]][:answer][-1].chr}.\") if rnd == 1\n # shows the vowels\n (hint = \"#{@questions[@trivia[:cur_quest]][:answer].gsub(/[^aeiou]/i, '*')}\") if rnd == 2\n # converts each character into ascii\n (@questions[@trivia[:cur_quest]][:answer].each_byte {|c| hint << \" #{c}\"}) if rnd == 3\n # replaces the vowels with asterisks\n (hint = @questions[@trivia[:cur_quest]][:answer].gsub(/[aeiou]/, '*')) if rnd == 4\n self.say \"\\00313 Hint: #{hint}\"\n @trivia[:last_hint] = Time.now\n else\n self.say \"\\0037 You have requested a hint less than 5 seconds ago.\"\n end\n else\n self.say \"Not in trivia mode\"\n end \n end", "def timer_update(event)\n if (event)\n tc = DateTime.now.to_i - event.created_at.to_i\n tu = DateTime.now.to_i - event.updated_at.to_i\n [tu, tc].min > 4\n end\n end", "def relative_word_time(time)\n now = Time.now\n if time - now > 0\n 'in ' + distance_of_time_in_words(time, now)\n elsif now - time > 7.days\n 'on ' + l(time, format: :short)\n else\n distance_of_time_in_words(time, now) + ' ago'\n end\n end", "def min_available_talks_time_in_a_day\n 6*60\n end", "def test_time_of_schedule_reminders\n @reminder.scheduled_reminders.each{|x| assert_equal x.run_at.hour, @reminder.fq_time.hour}\n @reminder.scheduled_reminders.each{|x| assert_equal x.run_at.min, @reminder.fq_time.min}\n end", "def p(s) puts \"-- #{Time.now.strftime('[%H:%M:%S]')} #{s}\" end", "def p(s) puts \"-- #{Time.now.strftime('[%H:%M:%S]')} #{s}\" end", "def cstime(*) end", "def index\n\n @questions = Questionnaire.limit(5).order(\"RAND()\").includes(:questionnaire_items)\n time = @student.java_timer\n has_started = time.try(:start_at).nil?\n\n start_dt = Time.now.utc\n # binding.pry\n timer = (cookies[:timer] || start_dt).to_s.to_datetime + 20.seconds#1.hour\n\n hash_diff = time_diff_hash(timer, start_dt)\n\n @timer_until = if timer > start_dt\n start_dt + hash_diff[:minutes].minutes + hash_diff[:seconds].seconds\n else\n start_dt\n end\n\n\n\n if has_started\n time_class = time || JavaTimer.new(student_id: @student.id)\n # time_class.update_attribute(:start_at, start_dt)\n cookies[:timer] = { :value => start_dt, :expires => start_dt + 1.minutes}\n end\n end", "def lead_time\n 4\n end", "def test_one_job_at_a_time_timing\n stqe = @session.jobs['stqe']\n kaner = stqe.subjobs['kaner - usage testing']\n\n now = Time.local('2002', 2, 19)\n @session.start(kaner, now)\n now += 50.minutes\n @session.stop(kaner, now)\n\n @session.start(stqe, now)\n now += 3.minutes\n @session.stop(stqe, now)\n\n now += 35.minutes\n\n @session.start(stqe, now)\n now += (1.hour+6.minutes)\n @session.stop(stqe, now)\n\n records = @session.records\n assert_equal(3, records.length)\n\n stringifier = RecordStringifier.new(records[0])\n assert_equal('stqe', stringifier.job)\n assert_equal('kaner - usage testing', stringifier.subjob)\n assert_equal('02002/02/19 12:00 AM', stringifier.start_date_time)\n assert_equal(' 0.83 hours', stringifier.cumulative_hours)\n\n stringifier = RecordStringifier.new(records[1])\n assert_equal('stqe', stringifier.job)\n assert_equal('', stringifier.subjob)\n assert_equal('02002/02/19 12:50 AM', stringifier.start_date_time)\n assert_equal(' 0.05 hours', stringifier.cumulative_hours)\n \n stringifier = RecordStringifier.new(records[2])\n assert_equal('stqe', stringifier.job)\n assert_equal('', stringifier.subjob)\n assert_equal('02002/02/19 1:28 AM', stringifier.start_date_time)\n assert_equal(' 1.10 hours', stringifier.cumulative_hours)\n end", "def disp_time\n @placement_exam = PlacementExam.find(params[:exam_id])\n @company = Company.find(params[:company_id])\n @questions = Company.conduct_exam(@company, @placement_exam)\n @time = @placement_exam.timeperiod.strftime('%M').to_i\n end", "def get_gravity(hour_time_range, previous_sets_to_compare)\n t_score = self.get_t_score(hour_time_range, previous_sets_to_compare)\n current_c = Word.where(\"name = ? and story_date > ?\", self.name, Time.now-24.hours).count\n if current_c > 3\n return t_score\n else\n return 0\n end\n end", "def story_time\n touch(@@detailsheader)\n sleeper(30)\n end", "def fizz_buzz_cuckoo_clock(time)\n array = time.split(\":\").map(&:to_i)\n array[0] = array[0] % 12\n case\n when array[0] == 0 && array[1] == 0\n answer = (\"Cuckoo\" + \" \") * 11 + \"Cuckoo\"\n when array[1] == 0\n answer = (\"Cuckoo\" + \" \") * (array[0] - 1) + \"Cuckoo\"\n when array[1] == 30\n answer = \"Cuckoo\"\n when (array[1] % 3) == 0 && (array[1] % 5) == 0\n answer = \"Fizz Buzz\"\n when (array[1] % 3) == 0\n answer = \"Fizz\"\n when (array[1] % 5) == 0\n answer = \"Buzz\"\n else\n answer = \"tick\"\n end\n return answer\nend", "def time_check thistime=nil\n @sugtime = thistime ? (thistime.to_i*2) : 1\n end", "def time_to_solve\n self.kase && self.kase.time_to_solve ? self.kase.time_to_solve : 1.hour\n end", "def attempting_times_left\n @times_left ||= begin\n return MAX_ATTEMPTING_TIMES unless question.actable.attempt_limit\n\n times = question.actable.attempt_limit - submission.evaluated_or_graded_answers(question).size\n times = 0 if times < 0\n times\n end\n end", "def tricks_taken \n \t\tself.score-(self.correct*10)\n \tend", "def lead_time\n 1\n end", "def start_game\n players = build_list_of_players\n team1 = select_players_for_gryffindor(players, [])\n team2 = select_players_for_slytherin(players, team1)\n puts \"team1 is #{team1.join(\", \")}\"\n puts \"team2 is #{team2.join(\", \")}\"\n puts\n team1_score = 0\n team2_score = 0\n scores = [ team1_score, team2_score ]\n puts \"brooms up!!\"\n 60.times do\n sleep 0.1 # this is new! write a comment, what does this line of code do?\n determine_who_scored(team1, team2, scores)\n puts \"another minute has gone by...\"\n end\n finalize_game(scores)\nend", "def max_talk_time_length\n 240\n end", "def wait_time(attempts)\n 2 ** (attempts.to_i + 2)\n end", "def timeat(msg)\n msg.reply @ta_bot.time_check(msg.params[1])\n end", "def test_time_added\n result=[]\n at=Activity_tracker.new do |id|\n result.push id\n end\n at.active 1\n sleep at.tick_time\n at.active 2\n sleep at.tick_time\n at.active 1\n sleep at.timeout\n assert result==[2], 'result was: '+result.join(',')\n end", "def show\n @question = Question.find(params[:id])\n @question.start_time = Time.now\n @question.save\n\n end", "def total_time=(_arg0); end", "def get_time_required\n 0 # number of minutes\n end", "def start_time\n return \"1530\";\n end", "def total_time(caption_length)\n\tcount = 0\n\tunless @user_time.nil? \n\t\tcount += 1\n\tend\n\tunless @book_time.nil?\n\t\tcount += 1\n\tend\n\tunless @review_time.nil?\n\t\tcount += 1\n\tend\n\tif count.nil? || count == 0\n\t\tputs \"No time to show.\"\n\telse\n\t\tBenchmark.benchmark(CAPTION, caption_length, FORMAT, \"total:\", \"avg:\") do |x|\n\t\t\ttotal_time = [@user_time, @book_time, @review_time].compact.inject(&:+)\n\t\t\t[total_time, total_time / count]\n\t\tend\n\tend\nend", "def run_game(attempt, grid, start_time, end_time)\n result = { time: (end_time - start_time), score: 0 }\n\n if word_in_the_grid?(attempt, grid) != true\n result[:message] = 'Word is not in the grid!'\n elsif english_word?(attempt) != true\n result[:message] = 'not an english word'\n else\n result[:score] = 100 - (end_time - start_time) + attempt.length\n result[:message] = 'well done'\n end\n result\n end", "def atime() end", "def atime() end", "def tv_sec() end", "def get_ponderated_best\n # Maybe better trace if no results collected\n # @best_results.exists? ? Timing.new() : @ponderated_time\n @ponderated_time\n end", "def hasTopStoryDeadlineEnded?\n Time.now.to_s.slice(11..12).to_i > 11 \n end", "def work_time(date)\n open, closed = open_close_times(date)\n closed - open - time_already_open(date)\n end", "def time_remaining\n end", "def distance_of_time_in_words(time)\n minutes = (Time.new.to_i - time.to_i).floor / 60\n case\n when minutes < 1\n \"less than a minute\"\n when minutes < 2\n \"about a minute\"\n when minutes < 50\n \"#{minutes} minutes\"\n when minutes < 90\n \"about an hour\"\n when minutes < 1080\n \"#{(minutes / 60.to_f).ceil} hours\"\n when minutes < 2160\n \"1 day\"\n else\n \"#{(minutes / 1440).round} days\"\n end\n end", "def max_run_time\n 96.hours\n end", "def duration\n if leg_a_answered_at.nil?\n return 0\n else\n if hangup? \n (leg_a_hangup_at - leg_a_answered_at).round\n else\n (Time.now - leg_a_answered_at).round\n end\n end\n end", "def timeis_up\n current_user.submit_answers\n render text: true\n end", "def mayday\n\tprint \"Les ennemis attaquent \"\n\t\t3.times do\n\t\tsleep(0.2)\n\t\tprint \".\"\n\tend\n\tprint \"POW!\"\n\t3.times do\n\t\tsleep(0.2)\n\t\tprint \".\"\n\tend\n\tputs \"THUMP...\" \n\tsleep(0.5)\n\tputs \"\"\nend", "def time\n [self.game_begins, [self.game_ends, Time.now].min].max\n end", "def processing_times\n total = ab_output.match(/Total:\\s+([0-9.]+)\\s+([0-9.]+)\\s+([0-9.]+)\\s+([0-9.]+)\\s+([0-9.]+)/)\n ninety = ab_output.match(/ 90%\\s+([0-9.]+)/)\n ninetyfive = ab_output.match(/ 95%\\s+([0-9.]+)/)\n [total[1], total[2], total[4], ninety[1], ninetyfive[1], total[5]]\n end", "def fizzbuzz2\n a = Time.now.to_f\n\n puts (1..100).map { |i|\n\tf = i % 3 == 0 ? 'Fizz' : nil\n\tb = i % 5 == 0 ? 'Buzz' : nil\n\tf || b ? \"#{ f }#{ b }\" : i\n }\n b = Time.now.to_f\n\n diff = b - a\n puts \"time diff \" + diff.to_s\nend", "def test_loop(type, quiz_name, quiz, user_name, time)\r\n clear\r\n # Initialize the array container for all necessary arguments\r\n status = []\r\n total_score = 0\r\n correct_count = 0\r\n incorrect_count = 0\r\n result = nil\r\n right_answer = nil\r\n start_time = 0\r\n status.push(total_score).push(correct_count).push(incorrect_count)\r\n # Loop the length of the quiz collection times to finish the test\r\n (1..quiz['Content'].size).each do |i|\r\n # Workaround timeout method by using the timeout libray in Ruby which automatically terminate the previous thread in a setting time\r\n Timeout.timeout(time) do\r\n clear\r\n # Get the start time stamp for future score calculation\r\n start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)\r\n # Displaying the question content and prompt for selection\r\n puts '-------------------Time is ticking:D---------------------------'.colorize(:light_magenta)\r\n puts 'You have get ' + (status[1]).to_s.colorize(:light_yellow) + ' correct answer(s) so far. And the total score is' + \" #{status[0]}.\\n\\n\".colorize(:light_blue)\r\n puts \"Question #{i}.\".colorize(:blue) + \" #{quiz['Content'][i - 1]['Question']}\\n\\n\"\r\n right_answer = quiz['Content'][i - 1]['Right_answer']\r\n\r\n # According to the selection, invoke the vailidat_answer method and pass necessary attributes\r\n options = [\r\n { name: \"A. #{quiz['Content'][i - 1]['A']}\", value: lambda {\r\n result = 'A'\r\n return result, right_answer, status, start_time, time\r\n } },\r\n { name: \"B. #{quiz['Content'][i - 1]['B']}\", value: lambda {\r\n result = 'B'\r\n return result, right_answer, status, start_time, time\r\n } },\r\n { name: \"C. #{quiz['Content'][i - 1]['C']}\", value: lambda {\r\n result = 'C'\r\n return result, right_answer, status, start_time, time\r\n } },\r\n { name: \"D. #{quiz['Content'][i - 1]['D']}\", value: lambda {\r\n result = 'D'\r\n return result, right_answer, status, start_time, time\r\n } }\r\n ]\r\n option = @prompt.select(\r\n \"Please select the answer as fast as you can to gain more score.\\nIf you select wrong answer or time expired, you will not get the score for Question #{i}\", options, help: \"(Pressing Enter to go back)\\n\\n\\n\", show_help: :always, per_page: 4\r\n )\r\n end\r\n validate_answer(result, right_answer, status, start_time, time)\r\n # If time expired, then apply the following logic to assian attribute to validate method\r\n rescue Timeout::Error\r\n clear\r\n timeout_banner\r\n puts\r\n puts \"\\n\\nOh, no!!! The #{time}s haven been passed.\"\r\n start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)\r\n right_answer = quiz['Content'][i - 1]['Right_answer']\r\n result = 'expired'\r\n validate_answer(result, right_answer, status, start_time, time)\r\n end\r\n\r\n clear\r\n test_banner\r\n puts\r\n puts \"Well done, My friend. You did a great job! Let's see waht the results is.\"\r\n enter_to_continue\r\n mode = @test.time_level.key(time)\r\n # Gather all the necessary attributes and form a array\r\n status.push(type).push(quiz_name).push(user_name).push(mode)\r\n # After finsih the test loop, pass attribute array to display result and save method\r\n dispaly_result_and_save(status)\r\n end", "def durations; end" ]
[ "0.6235086", "0.6084603", "0.6000901", "0.59780073", "0.59548825", "0.59336287", "0.5926185", "0.58832926", "0.57773465", "0.5746759", "0.56516075", "0.5644546", "0.56351864", "0.56276083", "0.5623318", "0.5617937", "0.56091696", "0.56091696", "0.56091696", "0.56091696", "0.56091696", "0.56091696", "0.56091696", "0.56091696", "0.56091696", "0.55846775", "0.5564372", "0.55573803", "0.5542612", "0.55380565", "0.55298644", "0.5513049", "0.5504555", "0.54996914", "0.5497107", "0.5491022", "0.5489036", "0.54831445", "0.5479726", "0.54747266", "0.5466731", "0.54494554", "0.5421012", "0.54206574", "0.54113346", "0.53955173", "0.53955173", "0.53955173", "0.53955173", "0.5394098", "0.53878766", "0.5380363", "0.53746665", "0.53426003", "0.53394556", "0.5335729", "0.5331581", "0.5323145", "0.5320981", "0.5320981", "0.5319608", "0.53190744", "0.5300868", "0.52906734", "0.52842724", "0.5278911", "0.5271356", "0.5265798", "0.52626526", "0.5260935", "0.5260262", "0.5259442", "0.5249092", "0.5246468", "0.52402645", "0.5239751", "0.52378094", "0.52356714", "0.523251", "0.5212031", "0.5206808", "0.52067375", "0.5202485", "0.52019787", "0.520154", "0.520154", "0.51961607", "0.5187615", "0.5185753", "0.5182533", "0.5175154", "0.5174601", "0.5174203", "0.51661855", "0.51637065", "0.5161189", "0.5160069", "0.51582307", "0.51565164", "0.51495314", "0.514735" ]
0.0
-1
Title: Playing with digits v2
def dig_pow(n, p) sum = n.digits.reverse.each_with_index.sum { |d, index| d**(p + index) } (sum % n).zero? ? sum.div(n) : -1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def say_digits(digits, escapeDigits=ALL_SPECIAL_DIGITS) \r\n\t\tmsg=\"SAY DIGITS #{digits} #{escape_digit_string(escapeDigits)}\"\r\n\t\tsend(msg)\r\n\t\treturn get_int_result()\r\n\tend", "def digit; end", "def initialize(digits)\n @digits = digits\n end", "def digit!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 46 )\n\n \n # - - - - main rule block - - - -\n # at line 392:10: '0' .. '9'\n match_range( 0x30, 0x39 )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 46 )\n\n end", "def background_digits(digit_string, digits='', path='digits')\n audio = []\n digit_string.to_s.scan(/./m) { |digit| audio << \"#{path}/#{digit}\" }\n begin\n response = background(audio, digits)\n rescue Exception\n raise\n end\n return response\n end", "def digit!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 37 )\n\n type = DIGIT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 136:8: '0' .. '9'\n match_range( 0x30, 0x39 )\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__, 37 )\n\n end", "def speak_as_digits(element)\n speak_as(element, /[0-9]/, 'digits', method(:operation_speak_as_digits))\n end", "def two_digit(number)\n dizaine = (number/10) * 10\n unit = (number % 10)\n if unit == 0\n return specific_word(dizaine)\n else\n return specific_word(dizaine) + \" \" + specific_word(unit)\n end\nend", "def digit!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 53 )\n\n type = DIGIT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 352:8: '0' .. '9'\n match_range( 0x30, 0x39 )\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__, 53 )\n\n end", "def kidmod10(base); end", "def play_and_get_digits file, invalid_file, args={}, &block\n min = args[:min] || 1\n max = args[:max] || 2\n tries = args[:tries] || 3\n terminators = args[:terminators] || \"#\"\n timeout = args[:timeout] || 5000\n variable = args[:variable] || \"read_digits_var\"\n regexp = args[:regexp] || \"\\\\d+\"\n\n args = [min, max, tries, timeout, terminators, file, invalid_file,\n variable, regexp].join \" \"\n\n params = {:variable => variable}\n\n application \"play_and_get_digits\", args, params, &block\n end", "def digit\n rand(10)\n end", "def say_digits(number, digits='\"\"')\n response = AGIResponse.new\n command_str = \"SAY DIGITS #{number} #{digits}\"\n begin\n response.native = execute(command_str)\n rescue AGITimeoutError, AGICommandError, AGIHangupError\n raise\n end\n if response.native == -1 then\n raise AGIChannelError.new(@last_response, \"Channel Failure in (#{command_str})\")\n elsif response.native == 0\n response.success = true\n else\n response.success = true\n response.data = response.native.chr\n end\n return response\n end", "def super_digit(n)\n super_digit_helper({}, n)\n \nend", "def rand_digit #generate random digit\n\treturn rand(10)\nend", "def featured(integer)\n return \"There is no possible number that fulfills those requirements\" if \n integer >= 9_876_543_210\n integer += 1\n until integer % 7 == 0 && integer.odd? && integer.digits.uniq! == nil\n integer += 1\n end\n integer\nend", "def integer_print_10\nend", "def get_xkcd(number)\n \t\t# This works too\n \t\t# JSON.parse self.class.get(\"http://xkcd-unofficial-api.herokuapp.com/xkcd?num=#{number}\")\n \t\tJSON.parse HTTParty.get(\"http://xkcd-unofficial-api.herokuapp.com/xkcd?num=#{number}\")\n \tend", "def get_xkcd(number)\n \t\t# This works too\n \t\t# JSON.parse self.class.get(\"http://xkcd-unofficial-api.herokuapp.com/xkcd?num=#{number}\")\n \t\tJSON.parse HTTParty.get(\"http://xkcd-unofficial-api.herokuapp.com/xkcd?num=#{number}\")\n \tend", "def digit!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 47 )\n\n type = DIGIT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 184:12: ( '0' .. '9' )+\n # at file 184:12: ( '0' .. '9' )+\n match_count_3 = 0\n while true\n alt_3 = 2\n look_3_0 = @input.peek( 1 )\n\n if ( look_3_0.between?( 0x30, 0x39 ) )\n alt_3 = 1\n\n end\n case alt_3\n when 1\n # at line 184:13: '0' .. '9'\n match_range( 0x30, 0x39 )\n\n else\n match_count_3 > 0 and break\n eee = EarlyExit(3)\n\n\n raise eee\n end\n match_count_3 += 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__, 47 )\n\n end", "def test_victorious\n\t\tp = Print.new\n\t\tassert_output(\"Going home victorious!\\n\") {p.print_game_win_or_lose(16)}\n\tend", "def dig(dig,num)\n\tnum/dig%10\nend", "def test_for_bigger_numbers\n\t\tassert_equal(\"MCXCI\", roman_converter(1191))\n\t\tassert_equal(\"MLXVI\", roman_converter(1066))\n\t\tassert_equal(\"XLIX\", roman_converter(49))\n\t\tassert_equal(\"CMXCIX\", roman_converter(999))\n\t\tassert_equal(\"DCLXVI\", roman_converter(666))\n\tend", "def refined_super_digit(n, k)\n \nend", "def refined_super_digit(n, k)\n \nend", "def _digits\n\n _save = self.pos\n while true # choice\n _tmp = match_string(\"0\")\n break if _tmp\n self.pos = _save\n\n _save1 = self.pos\n while true # sequence\n _tmp = scan(/\\A(?-mix:[1-9])/)\n unless _tmp\n self.pos = _save1\n break\n end\n _tmp = scan(/\\A(?-mix:[0-9]*)/)\n unless _tmp\n self.pos = _save1\n end\n break\n end # end sequence\n\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_digits unless _tmp\n return _tmp\n end", "def featured(integer)\n return \"Error: There is no possible number that fulfills those requirements\" if integer >= 9_876_543_210\n counter = integer + 1\n counter += 1 until counter % 7 == 0 && counter.odd?\n \n loop do\n return counter if counter.digits.uniq.size == counter.digits.size\n counter += 14\n end\nend", "def initialize(digits)\n @value = digits.to_s.to_i\n end", "def apnumber\n #Record.dot(content)\n Cruncher.crunch(content)\n end", "def digit_match(n, m)\n\nend", "def refined_super_digit(n, k)\n \nend", "def speak (bark_num)\n bark_num.times {puts \"Woof!\"}\n end", "def consume_number; end", "def full_game\n 52.times do\n round\n end\n output\n rematch\n end", "def refined_super_digit(n, k)\n return n if n < 10\n super_digit(n.digits.sum * k) # k magic hint from https://www.hackerrank.com/challenges/super-digit/forum\nend", "def test_check_digits_alpha\r\n assert_nil @g.check_digits('01234a6789')\r\n end", "def play\n \"We're rockiinnggg\"\n end", "def generate_production_number\n start_digits = rand(10000..99999)\n end_digits = rand(10000..99999)\n alphabet = (\"A\"..\"Z\").to_a\n middle_digits = \"2017\"\n 5.times { middle_digits << alphabet.sample}\n \"#{start_digits}-#{middle_digits}-#{end_digits}\"\n end", "def generate_production_number\n start_digits = rand(10000..99999)\n end_digits = rand(10000..99999)\n alphabet = (\"A\"..\"Z\").to_a\n middle_digits = \"2017\"\n 5.times { middle_digits << alphabet.sample}\n \"#{start_digits}-#{middle_digits}-#{end_digits}\"\n end", "def card_number\n s1 = s2 = 0\n cc_number = @record.cc_number.gsub(/\\D/, '') # remove all white space\n\n cc_number.to_s.reverse.chars.each_slice(2) do |odd, even|\n s1 += odd.to_i\n\n double = even.to_i * 2\n double -= 9 if double >= 10\n s2 += double\n end\n\n if (s1 + s2) % 10 != 0\n @record.errors[:cc_number] << 'is invalid'\n end\n end", "def call_player\n print \"C'est à #{@name} de jouer : Choisissez une case à jouer entre 1 et 9 \"\n gets.chomp.to_i\n end", "def stringy(int)\n (int/2).times { print 10 }\n 1 if int.odd?\nend", "def test_check_digits_true\r\n assert_equal true, @g.check_digits('0123456789')\r\n end", "def strass_real_usage(num)\n if num.to_i == 1 or num.to_i == 8\n puts \"Available Encoder & Decoder Options: \".underline.white\n puts \"b64 STR\".light_yellow + \" => \".white + \"Base64 Encode String\".light_red\n puts \"b64d STR\".light_yellow + \" => \".white + \"Base64 Decode String\".light_red\n puts \"up STR\".light_yellow + \" => \".white + \"UPPERCASE String\".light_red\n puts \"down STR\".light_yellow + \" => \".white + \"lowercase String\".light_red\n puts \"rev STR\".light_yellow + \" => \".white + \"esreveR|Reverse String\".light_red\n puts \"rot13 STR\".light_yellow + \" => \".white + \"ROT13 Encode/Decode String\".light_red\n puts \"hex STR\".light_yellow + \" => \".white + \"HEX Encode String\".light_red\n puts \"unhex STR\".light_yellow + \" => \".white + \"HEX to ASCII\".light_red\n puts \"mysqlhex STR\".light_yellow + \" => \".white + \"0xMySQL HEX Encode String\".light_red\n puts \"mysqlunhex STR\".light_yellow + \" => \".white + \"0xMySQL HEX to ASCII\".light_red\n puts \"ascii STR\".light_yellow + \" => \".white + \"Returns ASCII Value of String\".light_red\n puts \"mysqlchar STR\".light_yellow + \" => \".white + \"Returns MySQL CHAR() Value of String\".light_red\n puts \"mssqlchar STR\".light_yellow + \" => \".white + \"Returns MSSQL CHAR() Value of String\".light_red\n puts \"oraclechar STR\".light_yellow + \" => \".white + \"Returns Oracle CHR() Value of String\".light_red\n puts \"unicode STR\".light_yellow + \" => \".white + \"Unicode Encode String\".light_red\n puts \"urienc STR\".light_yellow + \" => \".white + \"URI Encode String\".light_red\n puts \"uridec STR\".light_yellow + \" => \".white + \"URI Decode String\".light_red\n puts \"doubleurl STR\".light_yellow + \" => \".white + \"URI Double Encode String\".light_red\n puts \"ent_dec STR\".light_yellow + \" => \".white + \"HTML Entity Decimal Encode String (&#DD)\".light_red\n puts \"ent_ddec STR\".light_yellow + \" => \".white + \"HTML Entity Decimal Decode String (&#DD)\".light_red\n puts \"ent_hex STR\".light_yellow + \" => \".white + \"HTML Entity HEX Encode String (&#xXX)\".light_red\n puts \"ent_dhex STR\".light_yellow + \" => \".white + \"HTML Entity HEX Decode String (&#xXX)\".light_red\n puts \"ent_name STR\".light_yellow + \" => \".white + \"HTML Entity Named Encoding of String\".light_red\n puts \"ent_dname STR\".light_yellow + \" => \".white + \"HTML Entity Named Decoding of String\".light_red\n print_line(\"\")\n end\n\n # Now print the QUERY BUILDER Functions if requested\n if num.to_i == 2 or num.to_i == 8\n puts \"Available SQLi Query Builder Options: \".underline.white\n puts \"union NUMBER\".light_yellow + \" => \".white + \"Union Select Query using provided NUMBER of columns\".light_red\n puts \"union_null NUMBER\".light_yellow + \" => \".white + \"Union Select Query with NULL value for provided NUMBER of columns\".light_red\n puts \"union_cust CUSTOM NUMBER\".light_yellow + \" => \".white + \"Union Select Query with CUSTOM value for provided NUMBER of columns\".light_red\n puts \"union_bof BUFFER NUMBER\".light_yellow + \" => \".white + \"BoF Union Select Query using provided BUFFER & NUMBER of Columns\".light_red\n print_line(\"\")\n end\n\n # Now print the SQLi & Tamper Functions if requested\n if num.to_i == 3 or num.to_i == 8\n puts \"Available SQLi Tamper Options: \".underline.white\n puts \"wafcap STR\".light_yellow + \" => \".white + \"Randomly Capitalize ALL Words Throughout String\".light_red\n puts \"wafcap_common STR\".light_yellow + \" => \".white + \"Randomly Capitalize SQLi Key Words in String\".light_red\n puts \"doubleup STR\".light_yellow + \" => \".white + \"Double Up SQLi Key Words (UNunionION)\".light_red\n puts \"comment STR\".light_yellow + \" => \".white + \"C Comment SQLi Key Words (/*UNION*/)\".light_red\n puts \"mycomment STR\".light_yellow + \" => \".white + \"MySQL Friendly C Style Comment of SQLi Key Words (/*!UNION*/)\".light_red\n puts \"mykeyhex STR\".light_yellow + \" => \".white + \"URL Hex Encode SQLi Key Words (U%6eIO%6e S%65L%65CT 1,2,3)\".light_red\n puts \"zerocomment STR\".light_yellow + \" => \".white + \"Zero Versioned MySQL Friendly C Style Comment on SQLi Key Words (/*!0UNION*/)\".light_red\n puts \"randcomment STR\".light_yellow + \" => \".white + \"C Style Comments Randomly Inserted into SQLi Key Words (U/*N*/IO/*N*/)\".light_red\n puts \"modsec_vers STR\".light_yellow + \" => \".white + \"Versioned MySQL C Comments Encapsulating Query String (/*!30187UNION SELECT 1,2,3,4*/)\".light_red\n puts \"modsec_zerovers STR\".light_yellow + \" => \".white + \"Zero Versioned MySQL C Comments Encapsulating Query String (/*!00000UNION SELECT 1,2,3,4*/)\".light_red\n puts \"bluecoat STR\".light_yellow + \" => \".white + \"Bluecoat WAF: Adds Legal ASCII Blank Char following SQLi Key Words (UNION%09 SELECT%09 1,2,3 FROM foo#)\".light_red\n puts \"securesphere STR\".light_yellow + \" => \".white + \"Imperva SecureSphere WAF: Appends \\\"magic\\\" string to each request (and '0having'='0having')\".light_red\n puts \"equal2like STR\".light_yellow + \" => \".white + \"Convert '=' comparison to 'LIKE' comparison\".light_red\n puts \"gt2between STR\".light_yellow + \" => \".white + \"Convert '>' comparison to 'NOT BETWEEN' comparison\".light_red\n puts \"percent STR\".light_yellow + \" => \".white + \"Places '%' after each char in string (Common ASP Bypass)\".light_red\n puts \"singleq2utf STR\".light_yellow + \" => \".white + \"Convert Single Quotes (') to UTF version (%EF%BC%87)\".light_red\n puts \"singleq2null STR\".light_yellow + \" => \".white + \"Convert Single Quotes (') to NULL URI Encoded version (%00%27)\".light_red\n puts \"unmagicquotes STR\".light_yellow + \" => \".white + \"Convert Single Quotes (') to multi-byte combo (%bf%27)and add dash (--) comment to end to balance\".light_red\n print_line(\"\")\n end\n\n # Now print the Append Functions if requested\n if num.to_i == 4 or num.to_i == 8\n puts \"Available Append Options: \".underline.white\n puts \"addnull STR\".light_yellow + \" => \".white + \"Append NULL Byte (%00)\".light_red\n puts \"adddash STR\".light_yellow + \" => \".white + \"Append Dash Delimieter (--)\".light_red\n puts \"addsdash STR\".light_yellow + \" => \".white + \"Append String Based Dash Delimieter (-- -)\".light_red\n puts \"addhash STR\".light_yellow + \" => \".white + \"Append Hash/Pound Delimieter (\\#)\".light_red\n puts \"addcomm STR\".light_yellow + \" => \".white + \"Append MS-SQL Comment Style Delimieter (/*)\".light_red\n puts \"addsp STR\".light_yellow + \" => \".white + \"Append sp_password for MS-SQL Log Evasion\".light_red\n print_line(\"\")\n end\n\n # Now print the Space Functions if requested\n if num.to_i == 5 or num.to_i == 8\n puts \"Available White Space Manipulation Options: \".underline.white\n puts \"space2comment STR\".light_yellow + \" => \".white + \"Convert Spaces to C Style Comment (' ' => /**/)\".light_red\n puts \"space2mycomment STR\".light_yellow + \" => \".white + \"Convert Spaces to MySQL Friendly C Style Comment (' ' => /*!*/)\".light_red\n puts \"space2dash STR\".light_yellow + \" => \".white + \"Convert Spaces to Dash (--) followed by random string and a new line (ZeroNights: ' ' => --aXyNOfLq%0A)\".light_red\n puts \"space2dashline STR\".light_yellow + \" => \".white + \"Convert Spaces to Dash (--) followed by a new line (' ' => --%0A)\".light_red\n puts \"space2hash STR\".light_yellow + \" => \".white + \"Convert Spaces to Hash/Pound (\\#) followed by random string and a new line (ModSec-Challenge: ' ' => \\#aXyNOfLq%0A)\".light_red\n puts \"space2hashline STR\".light_yellow + \" => \".white + \"Convert Spaces to Hash/Pound (\\#) followed by a new line (' ' => \\#%0A)\".light_red\n puts \"space2mssql STR\".light_yellow + \" => \".white + \"Convert Spaces to any 1 of 15 possible chars considered legal by MS-SQL\".light_red\n puts \"space2mysql STR\".light_yellow + \" => \".white + \"Convert Spaces to any 1 of 6 possible chars considered legal in MySQL\".light_red\n puts \"space2rand STR\".light_yellow + \" => \".white + \"Convert Spaces to any 1 of 4 possible chars considered universally legal\".light_red\n puts \"space2oa STR\".light_yellow + \" => \".white + \"Convert Spaces to New Line (%0A)\".light_red\n puts \"space2o9 STR\".light_yellow + \" => \".white + \"Convert Spaces to Horizontal Tab (%09)\".light_red\n puts \"space2ob STR\".light_yellow + \" => \".white + \"Convert Spaces to Vertical Tab (%0B)\".light_red\n puts \"space2oc STR\".light_yellow + \" => \".white + \"Convert Spaces to New Page (%0C)\".light_red\n puts \"space2od STR\".light_yellow + \" => \".white + \"Convert Spaces to Carriage Return (%0D)\".light_red\n puts \"space2plus STR\".light_yellow + \" => \".white + \"Convert Spaces to Plus (+)\".light_red\n print_line(\"\")\n end\n\n # Now print the FLOOR(RAND(0)*2) Functions if requested\n if num.to_i == 6 or num.to_i == 8\n puts \"Available FLOOR(RAND(0)*2) Manipulation Options: \".underline.white\n puts \"floor2xor STR\".light_yellow + \" => \".white + \"Convert FLOOR(RAND(0)*2) to RAND(0) XOR 1\".light_red\n puts \"floor2greatest STR\".light_yellow + \" => \".white + \"Convert FLOOR(RAND(0)*2) to GREATEST(rand(0),2)\".light_red\n puts \"floor2div STR\".light_yellow + \" => \".white + \"Convert FLOOR(RAND(0)*2) to RAND(0) div 1\".light_red\n puts \"floor2round STR\".light_yellow + \" => \".white + \"Convert FLOOR(RAND(0)*2) to ROUND(RAND(0),2)\".light_red\n puts \"floor2rand STR\".light_yellow + \" => \".white + \"Convert FLOOR(RAND(0)*2) to RAND(0) | RAND(0)\".light_red\n print_line(\"\")\n end\n\n # Now print the FLOOR(RAND(0)*2) Functions if requested\n if num.to_i == 7 or num.to_i == 8\n puts \"Available Comma Manipulation Options: \".underline.white\n puts \"comma2comm STR\".light_yellow + \" => \".white + \"C Style Comment out commas (,) to (/*,*/)\".light_red\n puts \"comma2mycomm STR\".light_yellow + \" => \".white + \"MySQL Friendly C Style Comment out commas (,) to (/*!,*/)\".light_red\n puts \"comma2char STR\".light_yellow + \" => \".white + \"Add mysql char(44) after each comma (',') in hopes it remains after normal comma stripped by WAF\".light_red\n puts \"comma2join STR\".light_yellow + \" => \".white + \"Convert basic Union Select 1,2,3 Query to join statements (union (select 1)a join (select 2)b join (select 3)c)\".light_red\n print_line(\"\")\n end\nend", "def digits(cc_num)\n cc_num.to_i.digits\nend", "def explain_game\n\t\tputs \"In the Secret Number Game, you guess a number between 1 and 10 and, if you pick the right number, you win!\"\n\t\tputs \"Good luck #{@player}!\"\n\tend", "def test_can_convert_numbers\n\t\tassert_equal(11, arabic_converter(\"XI\"))\n\t\tassert_equal(14, arabic_converter(\"XIV\"))\n\t\tassert_equal(19, arabic_converter(\"XIX\"))\n\t\tassert_equal(16, arabic_converter(\"XVI\"))\n\t\tassert_equal(18, arabic_converter(\"XVIII\"))\n\tend", "def digit \n\t\n\t$cst.add_branch(\"digit\")\n\t\n\tmatch_token(\"T_DIGIT\", $tokens[$index])\n\t\n\t$cst.ascend\n\t\nend", "def refined_super_digit(n, k)\n new_num = 0\n times = k\n numbers = n.to_s.split(\"\")\n if numbers.length <= 1\n return n\n end\n numbers.each do |i|\n new_num += i.to_i\n end\n new_n = times * new_num\n return super_digit(new_n) \nend", "def set_last_digits\n end", "def to_roman2 number\t\r\n\t@roman = ''\r\n\tmarker = ['I','V','X','L','C','D','M']\r\n\t(0..Math.log10(number).to_i).each do |i|\r\n\t\tputs i\r\n\t\t@unit_number = (number % (10^(i+1)))/10^i\r\n\t\tputs @unit_number\t\r\n\t\t@roman = @roman + show_power_of_ten(@unit_number,marker[2*i+2],marker[2*i+1],marker[2*i])\t\r\n\tend\r\n\[email protected]\r\nend", "def lyric1 num_now\n \"#{num_now} \" + bottle(num_now) + \" of beer on the wall, \" +\n \"#{num_now} \" + bottle(num_now) + \" of beer\"\n end", "def digits(text)\n return text.digits if text.is_a?(self)\n number = text.to_s.gsub(/\\D/,'')\n number = \"1#{number}\" if number.length == 10\n number\n end", "def super_digit(n)\n return n if n < 10\n count = add_digits(n)\n return super_digit(count)\n\nend", "def expected_check_digit\n digits.last\n end", "def play\r\n @secret_word = get_random_word\r\n @secret_word_letters = @secret_word.chars.to_a\r\n print_instructions\r\n play_loop\r\n end", "def teletext_add_digit _value\n send_cmd(\"teletext_add_digit #{_value}\")\n end", "def luhnother(ccNumber)\n ccNumber = ccNumber.gsub(/\\d/,'').split(//).collect { |digit| digit.to_i }\n parity = ccNumber.length % 2\n sum = 0\n ccNumber.each_with_index do |digit,index|\n digit = digit * 2 if index%2==parity\n digit = digit - 9 if digit > 9\n sum = sum + digit\n end\n return (sum%10)==0\nend", "def luhnother(ccNumber)\n ccNumber = ccNumber.gsub(/\\d/,'').split(//).collect { |digit| digit.to_i }\n parity = ccNumber.length % 2\n sum = 0\n ccNumber.each_with_index do |digit,index|\n digit = digit * 2 if index%2==parity\n digit = digit - 9 if digit > 9\n sum = sum + digit\n end\n return (sum%10)==0\nend", "def crackle(number)\n\treturn \"Crackle\" if number % 3 == 0\nend", "def refined_super_digit(n, k)\n refined = \"\"\n\n k.times do \n refined += n.to_s \n end \n refined = refined.to_i\n\n super_digit(refined)\n\nend", "def add_digits(number)\nend", "def featured(int)\n if int >= 9_876_543_210\n return 'There is no possible number that fulfills those requirements.'\n end\n \n featured_num = 0\n until featured_num > int\n loop do\n featured_num += 7\n next if featured_num.even?\n next if featured_num.digits != featured_num.digits.uniq\n break\n end\n end\n featured_num\nend", "def voip_number\n FFaker.numerify('3### ####')\n end", "def featured(number)\n number += 1\n\n until number % 7 == 0 && number.odd?\n number += 1\n end\n\n loop do\n if number.digits.uniq == number.digits\n return number\n else\n number += 14\n end\n break if number.digits.size > 10\n end\n\n \"Error\"\nend", "def persistence(n)\n count = 0\n while n > 9 do\n n = n.digits.inject(:*)\n count += 1\n end\n count\nend", "def refined_super_digit(n, k)\n\n n = n.digits.sum * k\n super_digit(n)\n\nend", "def play_random_song_from_band(term)\n response = search_itunes(term)\n results = response[\"results\"]\n pick = results.sample\n system(\"open\", pick[\"previewUrl\"]) \nend", "def print_changing_numbers\n\t\ti = 1\n\t\t#zolang i kleiner is dan 11\n\t\twhile i < 11\n\t\t\t#print de string met het nummer variabele en verhoog het daarna met 1\n\t\t\tputs \"This sentence is number #{i}\"\n\t\t\ti = i+1\n\t\tend\n\tend", "def speak(num)\n num.times do\n p \"Woof!\"\n end\n end", "def exercise_119 (number)\n end", "def refined_super_digit(n, k)\n # return super_digit(n * k)\n num = (n.to_s * k).to_i\n return super_digit(num)\nend", "def featured(num)\n return 'Error! No featured numbers exist over 10 digits!' if num >= 9876543210\n loop do\n num += 1\n break if num.odd? && (num % 7).zero? && num.digits.uniq! == nil\n end\n num\nend", "def say_number(number, escapeDigits=ALL_SPECIAL_DIGITS)\r\n msg=\"SAY NUMBER #{number} #{escape_digit_string(escapeDigits)}\"\r\n send(msg)\r\n return get_int_result()\r\n\tend", "def do_digit(chr, base)\n result = \"\"\n num = chr.to_i\n case num\n when (1..3)\n 1.upto(num) { result << ROMANS[base] }\n when 4 \n result << 'IV' if base == 1 #=> 4\n result << 'IL' if base == 10 #=> 40\n result << 'ID' if base == 100 #=> 400\n # no 4000+ in roman number, max roman number is 3000\n when 5\n result << 'V' if base == 1 #=> 5\n result << 'L' if base == 10 #=> 50\n result << 'D' if base == 100 #=> 500\n # no 5000 in roman number, max roman number is 3000\n when (6..8)\n result << 'V' if base == 1 #=> 6+\n result << 'L' if base == 10 #=> 60+\n result << 'D' if base == 100 #=> 600+\n 1.upto(num-5) { result << ROMANS[1] } # add extra 'III'\n # no 6000+ in roman number, max roman number is 3000\n when 9\n result << 'IX' if base == 1 #=> 9\n result << 'XC' if base == 10 #=> 90\n result << 'CM' if base == 100 #=> 900\n # no 9000 in roman number, max roman number is 3000\n end \n result\n end", "def refined_super_digit(n, k)\n number = (n.to_s * k).to_i\n super_digit(number)\nend", "def times_two(number)\n\t\tputs number * 2\n\tend", "def kids_musical; end", "def refined_super_digit(n, k)\n s = \"\"\n k.times do\n s += n.to_s\n end\n return super_digit(s.to_i)\nend", "def digits(input)\n verify_int(input).to_s.split(//)\nend", "def speak_as_digits_inherit(element)\n reverse_speak_as(element, 'digits')\n\n isolate_text_node(element)\n\n visit(element, method(:speak_as_digits))\n end", "def tenBells\n 10.times do\n # beep if you can\n print \"-\"\n end\nend", "def kaprekar(num)\n kaprekars_constant = 6174\n iterations = 0\n\n until num == kaprekars_constant\n num = (desc_digits(num) - asce_digits(num))\n iterations = iterations + 1\n end\n iterations\nend", "def digit_match(n, m)\n digit_match_helper(n, m)\nend", "def testrandom\n zplay \"e 0..11\"\n sleep 0.5\n zplay \"e (0..11)~\"\n sleep 0.5\n zplay \"e ( (100,1000) :3)<r>\"\n sleep 0.5\n zplay \"e (0..2)<m>\"\n sleep 0.5\n zplay \"e (0..6)?\"\n sleep 0.5\n zplay \"e (0..6)?2\"\n sleep 0.5\n zplay \"e (0..6)~2*2\"\n sleep 0.5\n zplay \"e ((0,6))+1*2/3%7\"\n sleep 0.5\n zplay \"e (w q q e e)<>((1000,4000))\"\n sleep 0.5\n zplay \"e (w q q e e e)<>(0..8)\"\n sleep 0.5\n zplay \"e (w q q e e e)<>(0..8)~\"\n sleep 0.5\n zplay \"q (q e e)<>(: 100..1000 :3)?5$\"\n sleep 0.5\n zplay \"(q e e)<>(: 100..1000 :3)?5&\"\n sleep 0.5\n zplay \"(e q e)<>(: 0..4 :4)~2+1*3\"\n\nend", "def api_nonce\n\t\t\t8.times.map { [*'0'..'9'].sample }.join\n\t\tend", "def digits\n @digits ||= numbers.insert(3, digit(numbers).to_s)\n end", "def show_deck_number\n @deck_number = Text.new(\n \"Deck: \" + @deck.length.to_s,\n x: 595, y: 22,\n size: 40,\n color: 'blue'\n )\n end", "def verbose(card)\n suits = {H: 'Hearts', C: 'Clubs', D: 'Diamonds', S: 'Spades'}\n royals = {K: 'King', Q: 'Queen', J: 'Jack', A: 'Ace'}\n card_val = card[0..-2]\n card_suit = card[-1]\n card_suit = suits[card_suit.to_sym] # Converts abreviation to suit name.\n if card_val.to_i == 0 # checks for royals\n royal = royals[card_val.to_sym]\n \"#{royal} of #{card_suit}\"\n else # numerical cards\n \"#{card_val} of #{card_suit}\"\n end\nend", "def _test_numbers ; process_test_case(\"numbers\") ; end", "def start(example_count)\n send_message(\"TESTC\", \"#{example_count} v2\")\n end", "def initialize(phone_pad)\n super(phone_pad)\n @cycle = ['*']\n end", "def reverse_digits(int)\n \nend", "def refined_super_digit(n, k)\n concatenated = \"#{n}\" * k\n return super_digit(concatenated.to_i) \nend", "def speak(integer)\n integer.times do\n puts \"Woof!\"\n end\n end", "def test_display_two\r\n assert_output(\"After 2 days, Rubyist #2 found:\\n\\t2 rubies.\\n\\t2 fake rubies.\\n\") { @g.display_rubies(2, 2, 2, 2) }\r\n end", "def test_ki()\n\n breaker = CodebreakerKIRandom.new(\"Captain Random\")\n breaker.talking = false\n # Testen von vierstelligen codes\n game = play(Game.new(@setting_length,@setting_range, @setting_turns, @dummy_maker,breaker))\n \n # Mindestens 1 Zug und das Spiel muss beendet sein\n assert_true(game.turns.size >= 1 && game.finished?() )\n \n end", "def captiveNum _args\n \"captiveNum _args;\" \n end", "def birth_path_number_again(digits)\n no1 = digits[0].to_i\n no2 = digits[1].to_i\n number = no1 + no2\n number = number.to_s\nend", "def s1 num\n\tnum % 2\nend", "def example num\n puts\n puts \"------ Example #{num} ------\"\nend" ]
[ "0.6195371", "0.60537344", "0.5969719", "0.5903429", "0.5686479", "0.56535673", "0.56495404", "0.5647547", "0.5623916", "0.5594184", "0.55928594", "0.55687016", "0.5528463", "0.55276966", "0.5491444", "0.5449811", "0.5446632", "0.5433583", "0.5433583", "0.5428844", "0.5391142", "0.53728056", "0.535273", "0.53428805", "0.53428805", "0.533302", "0.5332025", "0.53310794", "0.53236127", "0.5323519", "0.5319743", "0.5310747", "0.5300893", "0.5286182", "0.52722925", "0.5269543", "0.5260384", "0.5259428", "0.5259428", "0.5252565", "0.52507025", "0.5246629", "0.5241837", "0.5226385", "0.5224722", "0.52103406", "0.5201004", "0.52005476", "0.5192943", "0.51906544", "0.5189677", "0.517831", "0.5172", "0.51718336", "0.51604366", "0.5160385", "0.5151909", "0.5151686", "0.5151686", "0.5149807", "0.51484686", "0.5145728", "0.5129251", "0.51289135", "0.5128557", "0.51230294", "0.51225656", "0.5119952", "0.51112586", "0.51061726", "0.5103496", "0.5102837", "0.50947255", "0.50943244", "0.5093387", "0.5092526", "0.5082172", "0.50792676", "0.50739646", "0.5073604", "0.5070994", "0.5068552", "0.50647205", "0.50642645", "0.5063183", "0.5060414", "0.50603753", "0.5058215", "0.50531214", "0.5052491", "0.50480735", "0.50479835", "0.5046844", "0.50457644", "0.50369734", "0.5036968", "0.5036459", "0.50361204", "0.5035921", "0.5035805", "0.50337654" ]
0.0
-1
The return value should be a string that begins with the century number, and ends with st, nd, rd, or th as appropriate for that number. New centuries begin in years that end with 01. So, the years 19012000 comprise the 20th century. =begin Input: Integer Output: String Rules: take in a year as an Integer return a string that gives century with appropriate suffix centuries begin in year 01 Algorithm: calculate the appropriate century date use a case statement to attach the right suffix 11 = th 12 = th 13 = th end in 1 = st end in 2 = nd end in 3 = rd else = th =end
def century(year) century, check = year.divmod(100) check == 0 ? century : century += 1 suffix = century % 100 if suffix == 11 || suffix == 12 || suffix == 13 century.to_s + 'th' elsif suffix % 10 == 1 century.to_s + 'st' elsif suffix % 10 == 2 century.to_s + 'nd' elsif suffix % 10 == 3 century.to_s + 'rd' else century.to_s + 'th' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def century(year)\n # create century_str--------------\n if year.to_s.end_with?('00')\n century_str = year / 100\n else\n century_str = year / 100 + 1\n end\n century_str = century_str.to_s\n # --------------------------------\n\n # create suffix-------------------\n suffix = nil\n\n if century_str.length == 1\n if century_str == '1'\n suffix = 'st'\n elsif century_str == '2'\n suffix = 'nd'\n elsif century_str == '3'\n suffix = 'rd'\n else\n suffix = 'th'\n end\n\n elsif century_str.length < 4\n if century_str.reverse[1] == '1'\n suffix = 'th'\n elsif century_str.end_with?('1')\n suffix = 'st'\n elsif century_str.end_with?('2')\n suffix = 'nd'\n elsif century_str.end_with?('3')\n suffix = 'rd'\n else\n suffix = 'th'\n end\n\n elsif century_str.length == 3\n # case century_str\n # end\n end\n # --------------------------------\n\n result = \"#{century_str}#{suffix}\"\n\n\n\n p result\nend", "def century(year)\n century_string = ''\n case year.to_s.length \n when 1..2\n century_string = '1'\n when 3\n century_string = (year.to_s[0].to_i+1).to_s\n when 4\n if year.to_s[-1] == '0'\n century_string = year.to_s[0..1].to_i.to_s\n else \n century_string = (year.to_s[0..1].to_i+1).to_s\n end \n when 5\n century_string = (year.to_s[0..2].to_i+1).to_s\n end \ncentury_string += last_digit(century_string)\n\nend", "def century(year)\r\n cent = (year.to_f / 100).ceil.to_s\r\n\r\n if cent.end_with?(\"1\") && !(cent.end_with?(\"11\"))\r\n cent << \"st\"\r\n elsif cent.end_with?(\"2\") && !(cent.end_with?(\"12\"))\r\n cent << \"nd\"\r\n elsif cent.end_with?(\"3\") && !(cent.end_with?(\"13\"))\r\n cent << \"rd\"\r\n else\r\n cent << \"th\"\r\n end\r\nend", "def century(year)\n century = year / 100\n if year % 100 > 0\n century += 1\n end\n century = century.to_s\n if (century[-1] == \"1\") && (century[-2] != \"1\")\n century += 'st'\n elsif (century[-1] == \"2\") && (century[-2] != \"1\")\n century += 'nd'\n elsif (century[-1] == \"3\") && (century[-2] != \"1\")\n century += 'rd'\n else\n century += 'th'\n end\nend", "def century(year)\n\n\t# code below determines the century number\n\n\tcentury = ''\n\tcentury_number = 0\n\t\n\tif year < 101\n\t\treturn century += '1st'\n\telse\n\t\tif year%100 >= 01\n\t\t\tcentury_number = (year/100) + 1\n\t\telse\n\t\t\tcentury_number = year/100\n\t\tend\n\tend\n\t\n\t# code below determines the appropriate suffix\n\n\tlast_digit = century_number % 10\n\n\tspecial_case = [11,12,13]\n\n\tstandard_case = {0 =>'th', 1 => 'st', 2 => 'nd', 3 => 'rd',\n\t\t\t\t\t 4 => 'th', 5 => 'th', 6 => 'th', 7 => 'th', \n\t\t\t\t\t 8 => 'th' , 9 => 'th' }\n\n\tif special_case.include?(century_number%100)\n\t\treturn century += century_number.to_s\t+ 'th'\n\tend\t\n\n\t\n\tif standard_case.has_key?(last_digit)\n\t\treturn century += century_number.to_s + standard_case[last_digit]\n\tend\n\n\n\nend", "def century(year)\n if year % 100 == 0\n century = (year / 100).to_s\n else\n century = (year / 100 + 1).to_s\n end\n \n if century[-2] == '1'\n century + 'th'\n elsif century[-1] == '1'\n century + 'st'\n elsif century[-1] == '2'\n century + 'nd'\n elsif century[-1] == '3'\n century + 'rd'\n else\n century + 'th'\n end\nend", "def century(year)\n return '1st' if year == 0\n century_number, remainder = year.divmod(100)\n if remainder != 0\n century_number +=1\n end\n century_number = century_number.to_s\n particular_cases = ['11', '12', '13']\n termination = \"\"\n case\n when particular_cases.include?(century_number[-2..-1]) then termination << 'th'\n when century_number[-1] == '1' then termination << 'st'\n when century_number[-1] == '2' then termination << 'nd'\n when century_number[-1] == '3' then termination << 'rd'\n else\n termination << 'th'\n end\n century_number + termination\nend", "def century(year)\n year % 100 == 0 ? cent = (year / 100).to_s : cent = (year / 100 + 1).to_s\n \n if cent[-1] == \"1\" && cent[-2] != \"1\"\n cent + \"st\"\n elsif cent[-1] == \"2\" && cent[-2] != \"1\"\n cent + \"nd\"\n elsif cent[-1] == \"3\" && cent[-2] != \"1\"\n cent + \"rd\"\n else\n cent + \"th\"\n end\nend", "def century(year)\n century = (((year - 1) / 100) + 1).to_s\n ends_with = case century[-1]\n when \"1\" then \"st\"\n when \"2\" then \"nd\"\n when \"3\" then \"rd\"\n else \"th\"\n end\n if century[-2] == \"1\"\n ends_with = \"th\"\n end\n century + ends_with\nend", "def century(year)\n cent = (year / 100) + 1\n year.to_s.end_with?('0') ? cent -= 1 : cent\n chars_array = cent.to_s.chars\n \n if chars_array[-2] == '1'\n chars_array.push('th')\n end\n \n case chars_array[-1]\n when '1'\n chars_array.push('st') unless chars_array[-2] == '1'\n when '2'\n chars_array.push('nd') unless chars_array[-2] == '1'\n when '3'\n chars_array.push('rd') unless chars_array[-2] == '1'\n else chars_array.push('th') unless chars_array.include?('th')\n end\n p chars_array.join\nend", "def century(year)\n hundreds = ( (year + 99) / 100 ).to_s\n if hundreds[-2] == '1'\n suffix = 'th'\n else\n last_digit = hundreds[-1]\n case last_digit\n when '1' then suffix = 'st'\n when '2' then suffix = 'nd'\n when '3' then suffix = 'rd'\n else suffix = 'th'\n end\n end\n hundreds + suffix\nend", "def century(year)\n num = (year - 1) / 100 + 1\n century = num.to_s + suffix(num)\nend", "def century(year)\n \n century = year / 100\n unless year % 100 == 0\n century += 1\n end\n \n century = century.to_s\n \n \n suffix = if century[-2..-1] == \"11\" then \"th\"\n elsif century[-2..-1] == \"12\" then \"th\" \n elsif century[-2..-1] == \"13\" then \"th\"\n elsif century[-1] == \"1\" then \"st\"\n elsif century[-1] == \"2\" then \"nd\"\n elsif century[-1] == \"3\" then \"rd\"\n else \"th\"\n end\n \n century + suffix\nend", "def century(year)\n if year % 100 == 0\n cent = year / 100\n else \n cent = year / 100 + 1\n end\n\n cent = cent.to_s\n\n case\n when cent.end_with?(\"11\") then cent << \"th\"\n when cent.end_with?(\"12\") then cent << \"th\"\n when cent.end_with?(\"13\") then cent << \"th\"\n when cent.end_with?(\"1\" ) then cent << \"st\"\n when cent.end_with?(\"2\" ) then cent << \"nd\"\n when cent.end_with?(\"3\" ) then cent << \"rd\"\n else cent << \"th\"\n end\n\n cent\nend", "def century(year)\n\tcentury = year / 100\n\n\tcentury += 1 if year.digits.reverse.pop > 0\n\n\tcentury_string = century.to_s\n\n\treturn century_string << 'th' if ('11'..'13').to_a.include?(century_string[-2,2])\n\n\tcase \n\twhen century_string.end_with?('1')\n\t\tcentury_string << 'st'\n\twhen century_string.end_with?('2')\n\t\tcentury_string << 'nd'\n\twhen century_string.end_with?('3')\n\t\tcentury_string << 'rd'\n\telse\n\t\tcentury_string << 'th'\n\tend\n\tcentury_string\nend", "def century(year)\n century = (year.to_f / 100).ceil.to_s\n suffix(century)\nend", "def century(year)\n century = year/100 + 1\n century -= 1 if year.to_s.end_with?('00')\n suffix = if [11, 12, 13].include?(century % 100)\n 'th'\n else\n case century % 10\n when 3 then 'rd'\n when 2 then 'nd'\n when 1 then 'st'\n else 'th'\n end\n end\n century.to_s + suffix\nend", "def century_year(year)\n\n\tcentury_year = year.div(100) + 1\n\tcentury_year -= 1 if year % 100 == 0\n\tcentury_year.to_s + century_suffix(century_year)\n\nend", "def century(year)\n century = (year / 100) + 1\n century -= 1 if year % 100 == 0\n \n century.to_s + century_suffix(century)\nend", "def century(year)\n century = (year.to_f) / 100\n \n if century != (year / 100)\n century = (century + 1).to_i.to_s\n else\n century = century.to_i.to_s\n end\n \n endings = {st: [1],\n nd: [2],\n rd: [3],\n th: [4, 5, 6, 7, 8, 9, 0]\n }\n \n endings.each do |k, v|\n if v.include?(century.to_i.digits.reverse.last)\n century << k.to_s\n end\n end\n \n century\nend", "def century(year)\n postfix_arr = %w(st nd rd th)\n\n century_number, century_modulus = year.divmod(100)\n century_number += 1 unless century_modulus == 0\n postfix_index = century_number % 20 # Because the 'teens' don't conform!\n\n postfix_str = postfix_index < 4 ? postfix_arr[postfix_index - 1] : 'th'\n \"#{century_number.to_s + postfix_str}\"\nend", "def century(year)\n h = Hash.new('th') # 'th' is default suffix; teen centuries plus centuries ending in 0, 4-9\n h[1] = 'st'\n h[2] = 'nd'\n h[3] = 'rd'\n century_num = (year - 1) / 100 + 1\n suffix = ((century_num % 100) / 10) == 1 ? 'th' : h[century_num % 10] # teens : others\n century_num.to_s + suffix\nend", "def century(year)\n century = year / 100\n century += 1 if year % 100 != 0\n century.to_s + suffix(century)\nend", "def century(year)\n if year % 100 == 0\n century = year / 100\n else\n century = (year / 100) + 1\n end\n\n century.to_s + century_suffix(century)\nend", "def century(num)\n century_num = ((num - 1) / 100) + 1\n\n century_string = century_num.to_s\n century_string << if (century_num % 100).between?(11, 13)\n 'th'\n elsif century_num % 10 == 1\n 'st'\n elsif century_num % 10 == 2\n 'nd'\n elsif century_num % 10 == 3\n 'rd'\n else\n 'th'\n end\nend", "def century(year)\n century = year / 100 + 1\n century -= 1 if year % 100 == 0\n century.to_s + century_suffix(century)\nend", "def century(year)\n century = year / 100 + 1\n century -= 1 if year % 100 == 0\n century.to_s + century_suffix(century)\nend", "def century(year)\n century = year / 100 + 1\n century -= 1 if year % 100 == 0\n century.to_s + century_suffix(century)\nend", "def century(year)\n century = year / 100 + 1\n century -= 1 if year % 100 == 0\n century.to_s + century_suffix(century)\nend", "def century(year)\n century = year / 100 + 1\n century -= 1 if year % 100 == 0\n century.to_s + century_suffix(century)\nend", "def century(year)\n century = (year / 100) + 1\n century -= 1 if year % 100 == 0\n return century.to_s + century_suffix(century)\nend", "def century(year)\n if year % 100 == 0\n c = year / 100\n else\n c = (year / 100) + 1\n end\n\n h = { 0 => 'th', 1 => 'st', 2 => 'nd', 3 => 'rd',\n 4 => 'th', 5 => 'th', 6 => 'th', 7 => 'th',\n 8 => 'th', 9 => 'th' }\n t = { 11 => 'th', 12 => 'th', 13 => 'th'}\n\n digit = c % 10\n if c == 11 || c == 12 || c == 13\n \"#{c}#{t[c]} century\"\n else\n \"#{c}#{h[digit]} century\"\n end\nend", "def century(integer)\n century_number = integer / 100 + 1\n century_number -= 1 if integer % 100 == 0\n century_number.to_s + century_suffix(century_number)\nend", "def century(year)\n century = year / 100\n remainder = year % 100\n \n remainder > 0 ? century += 1 : century\n \n \"#{century}\" + century_suffix(century)\nend", "def century(number)\n century_int = ''\n suffix_str = ''\n\n century_int = (number / 100) + 1\n century_int -= 1 if number % 100 == 0\n suffix_str = suffix(century_int)\n\n century_int.to_s + suffix_str\nend", "def century(year)\n result = year.divmod(100)\n century = result[0] + 1\n century -= 1 if year % 100 == 0\n century.to_s + century_suffix(century)\nend", "def sortable_year_for_century\n return unless orig_date_str\n return if orig_date_str =~ /B\\.C\\./\n\n century_matches = orig_date_str.match(CENTURY_4CHAR_REGEXP)\n if century_matches\n return $1 + '00' if $1.length == 2\n return '0' + $1 + '00' if $1.length == 1\n end\n century_str_matches = orig_date_str.match(CENTURY_WORD_REGEXP)\n if century_str_matches\n yy = ($1.to_i - 1).to_s\n return yy + '00' if yy.length == 2\n return '0' + yy + '00' if yy.length == 1\n end\n end", "def century(year)\n century = year / 100 if year % 100 == 0\n century = (year / 100) + 1 if year % 100 != 0\n \"#{century}#{ordinal(century)}\"\nend", "def century?(year)\n year = (year.to_f / 100).ceil\n last_two = (year % 100)\n last_num = year % 10\n suffix = {\n 1=>'st', \n 2=>'nd', \n 3=>'rd', \n 4=>'th',\n 5 => 'th',\n 6 => 'th',\n 7 => 'th',\n 8 => 'th',\n 9 => 'th',\n 0 => 'th'\n }\n \n if (last_two != 11 && last_two != 12 && last_two != 13)\n suffix = suffix[last_num]\n puts \"#{year}#{suffix}\"\n else \n suffix = 'th'\n puts \"#{year}#{suffix}\"\n end \nend", "def format_year_to_century(year)\n if year.to_s[-1].to_i.zero?\n year / 100\n else\n year / 100 + 1\n end\nend", "def century(year)\n which_century(year) + numberth(which_century(year))\nend", "def centuryFromYear(year)\n if (year % 100 == 0)\n year/100\n else\n (year/100) + 1\n end\nend", "def which_century(year)\n year.to_s[-1] == \"0\" ? (year / 100).to_s : (year / 100 + 1).to_s\nend", "def century_suffix(century)\n return 'th' if [11, 12, 13].include? century % 100\n last_digit = century % 10 # key to validating 1, 2, 3 1\n\n case last_digit\n when 1 then 'st'\n when 2 then 'nd'\n when 3 then 'rd'\n else 'th'\n end\nend", "def century_suffix(century)\n return 'th' if [11, 12, 13].include?(century)\n\n case century\n when /1\\z/\n 'st'\n when /2\\z/\n 'nd'\n when /3\\z/\n 'rd'\n else\n 'th'\n end\nend", "def century_name_ending(number)\n if number[-2] == '1' # 10-19 are last two digits\n 'th'\n else\n case number[-1]\n when '0', '4', '5', '6', '7', '8', '9' then 'th'\n when '1' then 'st'\n when '2' then 'nd'\n when '3' then 'rd'\n end\n end\nend", "def century_validate(year)\n century = (year / 100) + 1\n century.to_s + validate_ordinal(year)\nend", "def calc_century(year)\n if year.to_s.end_with?('0')\n year / 100\n else\n (year + 100) / 100\n end\nend", "def what_century(year)\n year % 100 == 0 ? year / 100 : year / 100 + 1\nend", "def century_to_year(century, offset)\n return century * 100 + offset\n end", "def display_str_for_century\n return unless orig_date_str\n return if orig_date_str =~ /B\\.C\\./\n\n century_str_matches = orig_date_str.match(CENTURY_WORD_REGEXP)\n return century_str_matches.to_s if century_str_matches\n\n century_matches = orig_date_str.match(CENTURY_4CHAR_REGEXP)\n if century_matches\n require 'active_support/core_ext/integer/inflections'\n return \"#{($1.to_i + 1).ordinalize} century\"\n end\n end", "def century_suffix(century)\n case\n when century.end_with?(*%w(11 12 13)) then 'th'\n when century.end_with?('1') then 'st'\n when century.end_with?('2') then 'nd'\n when century.end_with?('3') then 'rd'\n else 'th'\n end\nend", "def calculate_century(year)\n (year % 100).zero? ? year / 100 : year / 100 + 1\nend", "def get_single_digit_century(dates)\n dates.each do |f_date|\n matches = f_date.scan(/\\d{1}th/)\n next if matches.empty?\n\n if matches.length == 1\n @pub_year = (matches.first[0, 2].to_i - 1).to_s + '--'\n return @pub_year\n else\n # when there are multiple matches, check for ones with CE after them\n matches.each do |match|\n pos = f_date.index(Regexp.new(match + '...CE'))\n pos = pos ? pos.to_i : f_date.index(Regexp.new(match + ' century CE'))\n pos = pos ? pos.to_i : 0\n if f_date.include?(match + ' CE') || pos > 0\n @pub_year = (match[0, 1].to_i - 1).to_s + '--'\n return @pub_year\n end\n end\n end\n end\n nil\n end", "def get_double_digit_century(dates)\n dates.each do |f_date|\n matches = f_date.scan(/\\d{2}th/)\n next if matches.empty?\n\n if matches.length == 1\n @pub_year = (matches.first[0, 2].to_i - 1).to_s + '--'\n return @pub_year\n else\n # when there are multiple matches, check for ones with CE after them\n matches.each do |match|\n pos = f_date.index(Regexp.new(match + '...CE'))\n pos = pos ? pos.to_i : f_date.index(Regexp.new(match + ' century CE'))\n pos = pos ? pos.to_i : 0\n if f_date.include?(match + ' CE') || pos > 0\n @pub_year = (match[0, 2].to_i - 1).to_s + '--'\n return @pub_year\n end\n end\n end\n end\n nil\n end", "def convert_yy_2_yyyy( birth_year )\n return nil if birth_year.nil?\n # Already a 4-digit year?\n if birth_year.to_i > 1900\n birth_year\n\n # 2-digit year?\n elsif birth_year.to_i < 100\n # We keep track upto M105:\n if DateTime.now.year - 1900 - birth_year.to_i > 105\n 2000 + birth_year.to_i\n else\n 1900 + birth_year.to_i\n end\n\n # 3-digit year?\n elsif birth_year.to_i < 1000\n # We keep track upto M105:\n if DateTime.now.year - 1000 - birth_year.to_i > 105\n 2000 + birth_year.to_i\n else\n 1000 + birth_year.to_i\n end\n end\n end", "def add_suffix(century)\n case century % 100\n when 11 then return 'th'\n when 12 then return 'th'\n when 13 then return 'th'\n end\n\n # digits = century.to_s.length\n # ending = century > 9 ? 10 ** (digits - 1) : 10\n\n case century % 10\n when 1 then 'st'\n when 2 then 'nd'\n when 3 then 'rd'\n else 'th'\n end\nend", "def yn(year)\n return year if year.size == 4\n\n y = Date.today.year.to_s[2..4].to_i + 1\n case year.to_i\n when 0...y then \"20#{year}\"\n when y..99 then \"19#{year}\"\n end\n end", "def century(date)\n c = ((date.year.abs.to_i / 100) + 1).ordinalize + ' century'\n return [c, BCE_SUFFIX].join(' ') if (date.year <= -1)\n c\n end", "def year(input) = new_year(input).year - 621", "def work_out_year(value)\n case value\n when 0..39\n 2000 + value\n when 40..99\n 1900 + value\n else\n value\n end\n end", "def year_name(number); end", "def yearCode year\r\n if year =~ /freshman/\r\n 1\r\n elsif year =~ /sophomore/\r\n 2\r\n elsif year =~ /junior/\r\n 3\r\n elsif year =~ /senior/\r\n 4\r\n else \r\n 0\r\n end\r\nend", "def silly_years(year)\n result_arr = []\n # retrieves first two digits\n first_half = year.to_s.split('')[0..1].join('').to_i\n while result_arr.length < 10\n first_half += 1\n mid = first_half%10\n next if mid*10 - first_half < 0\n \n mid = mid*10 + (((mid*10) - first_half)/10)\n second_half = mid - first_half\n year = first_half.to_s\n if second_half.to_s.length == 1\n year += \"0\" + second_half.to_s\n else\n year += second_half.to_s\n end\n \n \n result_arr << year.to_i\n end\n\n result_arr\nend", "def yearCode(year)\r\n\tif year =~ /freshman/\r\n\t\treturn 1\r\n\telsif year =~ /sophomore/\r\n\t\treturn 2\r\n\telsif year =~ /junior/\r\n\t\treturn 3\r\n\telsif year =~ /senior/\r\n\t\treturn 4\r\n\telse\r\n\t\treturn 0\r\n\tend\r\nend", "def year\n current_year = Date.today.year\n\n case raw_year\n when current_year; \"this year\"\n when current_year.next; \"next year\"\n when current_year.pred; \"last year\"\n else; raw_year.to_s\n end\n end", "def get_plain_four_digit_year(dates)\n dates.each do |f_date|\n matches = f_date.scan(/\\d{4}/)\n if matches.length == 1\n @pub_year = matches.first\n else\n # when there are multiple matches, check for ones with CE after them\n matches.each do |match|\n # look for things like '1865-6 CE'\n pos = f_date.index(Regexp.new(match + '...CE'))\n pos = pos ? pos.to_i : 0\n if f_date.include?(match + ' CE') || pos > 0\n @pub_year = match\n return match\n end\n end\n end\n return matches.first\n end\n nil\n end", "def make_year(year, bias); end", "def academic_year\n academic_year = case quarter_code_id\n when 1\n \"#{year-1}-#{year}\"\n when 2\n \"#{year-1}-#{year}\"\n when 3\n \"#{year}-#{year+1}\"\n when 4\n \"#{year}-#{year+1}\"\n end\n academic_year\n end", "def post_year\n chars = @date.split('')\n chars.pop(4).join('').to_i\n end", "def work_out_year(value)\n case value\n when 0..39\n 2000 + value\n when 40..99\n 1900 + value\n when nil\n Time.zone.now.year\n else\n # We may be passed something that's not a straight out integer\n # These things include: BigDecimals, Floats and Strings.\n value.to_i\n end\n end", "def estimated_birthyear_range_to_s\n earliest = earliest_birthdate\n latest = latest_birthdate\n if (earliest.nil? && latest.nil?)\n result = \"?\"\n elsif (earliest.nil?)\n result = \"before #{latest.year}\"\n elsif (latest.nil?)\n result = \"after #{earliest.year}\"\n else\n result = \"#{earliest.year}/#{latest.year}\"\n end\n return result\n end", "def to_s\n fy = first.year.to_s\n end_year = last.year\n fy += \"-\" + end_year.to_s unless first.year == end_year\n fy\n end", "def copyright_years(start_year)\n end_year = Date.today.year\n if start_year == end_year\n start_year.to_s\n else\n start_year.to_s + '-' + end_year.to_s\n end\n end", "def fiscal_year(year, klass = nil)\n\n # some controllers might have a special formatter instead of the default one to use the FY string\n # eventually default might be a SystemConfig.instance attribute as well but for now hard-coded\n\n unless klass\n if defined? params\n klass = params[:controller].classify\n elsif self.class.to_s.include? 'Controller'\n klass = self.class.to_s[0..-('Controller'.length+1)]\n else\n klass = self.class.to_s\n end\n end\n\n formatter = SystemConfig.instance.special_fiscal_year_formatters[klass]\n formatter = SystemConfig.instance.default_fiscal_year_formatter if formatter.nil?\n\n if formatter == 'start_year'\n \"#{year}\"\n elsif formatter == 'end_year'\n \"#{year+1}\"\n else\n yr = year - fy_century(year)\n first = \"%.2d\" % yr\n if yr == 99 # when yr == 99, yr + 1 would be 100, which causes: \"FY 99-100\"\n next_yr = 00\n else\n next_yr = (yr + 1)\n end\n last = \"%.2d\" % next_yr\n \"#{first}-#{last}\"\n end\n end", "def get_year_with_number\n date_receipt.strftime(\"%Y\") + \"-\" + sprintf( \"%03i\", receipt_num )\n end", "def full_academic_year\n unless academic_year.blank?\n academic_year.to_s + '-' + (academic_year + 1).to_s\n end\n end", "def year(string)\n return if string.blank?\n return string if string.is_a?(Range)\n\n components = string\n .split(\"-\")\n .map(&:to_i)\n .map { |y| y.zero? ? nil : y }\n\n return if components.empty?\n\n # Set end if only one year\n components << components.first if components.count == 1\n\n components[0]..components[1]\n end", "def fy_century(fy)\n fy < 2000 ? 1900 : 2000\n end", "def copyright_notice_year_range(start_year)\n\t\t# In case the input was not a number (nil.to_i will return a 0)\n\t\tstart_year = start_year.to_i\n\n\t\t# Get the current year from the system\n\t\tcurrent_year = Time.new.year\n\n\t\t# When the current year is more recent than the start year, return a string \n\t\t# of a range (e.g., 2010 - 2012). Alternatively, as long as the start year \n\t\t# is reasonable, return it as a string. Otherwise, return the current year \n\t\t# from the system.\n\t\tif current_year > start_year && start_year > 2000\n\t\t\t\"#{start_year} - #{current_year}\"\n\t\telsif start_year > 2000\n\t\t\t\"#{start_year}\"\n\t\telse\n\t\t\t\"#{current_year}\"\n\t\tend\n\tend", "def format_year(year)\n \"#{year}-#{year+1}\"\n end", "def to_century(**options) = convert_to('century', **options)", "def century? = unit == 'century'", "def expected_death_year\n Chronic.parse(\"#{years_to_live} years from now\").year.to_s\n end", "def year() end", "def silly_years(year)\n years = []\n\n until years.length == 10\n year += 1\n digits = year.to_s\n\n first_two, middle_two, last_two = [\n digits[0..1], digits[1..2], digits[2..-1]\n ].map { |pair| pair.to_i }\n\n years << year if (first_two + last_two) == middle_two\n\n end\n\n years\nend", "def copyright_years(start_year)\n end_year = Date.today.year\n if start_year == end_year\n \"\\#{start_year}\"\n else\n \"\\#{start_year}&#8211;\\#{end_year}\"\n end\n end", "def year\n puts \"Please enter a year:\"\n year = gets.chomp.to_s\n puts \"Fantasic! You have answered #{year}\".colorize(:light_blue)\n year = year.to_i\n\n case year\n when 0..500\n puts \"year 0 to 500AD\"\n return 1\n when 501..1000\n puts \"year 501AD to 1000AD\"\n return 2\n when 1001..1500\n puts \"year 1001 to the 1500\"\n return 3\n when 1501..2000\n puts \"1501 to 2000\"\n return 4\n when 2001..2020\n puts \"Current time : 2001 to 2020\"\n return 5\n when 2020..3000\n puts \"The future 2020 to 3000 and beyond!\"\n return 6\n end\n#might be better to put the case in here for the years\nend", "def estimated_deathyear_range_to_s\n result = \"\"\n \n # only bother with this calculation if this person is dead with an unkwown date\n # or the person would be over 120 years old\n if (is_dead?)\n earliest = earliest_deathdate\n latest = latest_deathdate\n if (earliest.nil? && latest.nil?)\n result = \"?\"\n elsif (earliest.nil?)\n result = \"before #{latest.year}\"\n elsif (latest.nil?)\n result = \"after #{earliest.year}\"\n else\n result = \"#{earliest.year}/#{latest.year}\"\n end\n end\n return result\n end", "def year_to_season(y); \"#{y}-#{sprintf('%02d', (y + 1) % 100)}\"; end", "def cwyear\n end", "def normalized\n expanded = length == 2 ? \"20#{self}\".to_i : self.to_i # Assume no 3-digit years\n expanded >= Time.now.year ? expanded : Time.now.year\n end", "def leapyear(n)\n start = (n % 100 != 0 && n % 4 == 0) || (n % 100 == 0 && n % 400 == 0) ? n : n + (4 - (n % 4))\n (0...100).step(4).each do |e|\n year = start + e\n if year % 100 != 0\n puts year\n elsif year % 400 == 0\n puts year\n end\n end\nend", "def year_int_from_date_str\n return if orig_date_str == '0000-00-00' # shpc collection has these useless dates\n # B.C. first in case there are 4 digits, e.g. 1600 B.C.\n return sortable_year_int_for_bc if orig_date_str.match(BC_REGEX)\n\n result = sortable_year_for_yyyy_or_yy\n result ||= sortable_year_for_decade # 19xx or 20xx\n result ||= sortable_year_for_century\n result ||= sortable_year_int_for_early_numeric\n unless result\n # try removing brackets between digits in case we have 169[5] or [18]91\n no_brackets = remove_brackets\n return DateParsing.new(no_brackets).year_int_from_date_str if no_brackets\n end\n result.to_i if result && self.class.year_int_valid?(result.to_i)\n end", "def year_via_ruby_parsing\n return unless orig_date_str =~ /\\d\\d/ # need at least 2 digits\n # need more in string than only 2 digits\n return if orig_date_str.match(/^\\d\\d$/) || orig_date_str.match(/^\\D*\\d\\d\\D*$/)\n return if orig_date_str =~ /\\d\\s*B.C./ # skip B.C. dates\n\n date_obj = Date.parse(orig_date_str)\n date_obj.year.to_s\n rescue ArgumentError\n nil # explicitly want nil if date won't parse\n end", "def first_year\n 2012\n end", "def get_bc_year(dates)\n dates.each do |f_date|\n matches = f_date.scan(/\\d{3} B.C./)\n unless matches.empty?\n bc_year = matches.first[0..2]\n return (bc_year.to_i - 1000).to_s\n end\n end\n nil\n end", "def expected_death_year\n Chronic.parse(\"#{@years_to_live} years from\nnow\").year\n end", "def extract_swimmer_year_and_category( compound_year_or_category )\n parts = compound_year_or_category.to_s.split(/\\s+/)\n if (parts[0] =~ /\\d{4}/) && (parts[1] =~ /\\d{2}/)\n [ parts[0] , \"M#{parts[1]}\" ]\n\n elsif (parts[0] =~ /\\d{4}/) && (parts[1] == '0')\n [ parts[0] , 'U25' ]\n\n elsif parts[0] =~ /M|U/i\n [ nil, parts.join ]\n\n else\n [ nil, nil ]\n end\n end", "def year_rome_founded\n bce(753)\n end" ]
[ "0.870891", "0.84951717", "0.8441888", "0.8409901", "0.8393028", "0.8372144", "0.83571666", "0.83431906", "0.83330226", "0.8295295", "0.82802355", "0.82577956", "0.82452583", "0.82100415", "0.8201105", "0.81640667", "0.8163631", "0.81413585", "0.8135555", "0.8129648", "0.80999726", "0.8099566", "0.80895466", "0.8054485", "0.80521464", "0.8037578", "0.8037578", "0.8037578", "0.8037578", "0.8037578", "0.79653144", "0.7957239", "0.7924764", "0.79221064", "0.78754926", "0.7841071", "0.78401613", "0.77837884", "0.77746665", "0.77647316", "0.7742696", "0.77360445", "0.766283", "0.76395446", "0.7572105", "0.75406903", "0.752243", "0.7512473", "0.7486246", "0.74826723", "0.7465692", "0.74266475", "0.74210346", "0.7417263", "0.7274131", "0.7124937", "0.710653", "0.7093674", "0.6998329", "0.6948794", "0.6876444", "0.6706583", "0.6686207", "0.6625047", "0.6596036", "0.6585076", "0.6578282", "0.6573996", "0.6510068", "0.6492541", "0.6460829", "0.6445467", "0.64451045", "0.63773406", "0.63561773", "0.6345614", "0.6339962", "0.63067836", "0.6288393", "0.62876713", "0.6273529", "0.6266148", "0.6254213", "0.6238149", "0.62357605", "0.6211895", "0.6204605", "0.61992836", "0.61775744", "0.6160058", "0.6151512", "0.61503553", "0.6150228", "0.61360306", "0.6123853", "0.61201346", "0.60952526", "0.60906476", "0.6061211", "0.60592014" ]
0.81146216
20
tests for condition block
def test_conditional_true act = acl { respond(200) { true } }.call({}) assert_equal([200, {}, []], act) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def condition; end", "def condition\n expect :if\n self[1]\n end", "def cond; end", "def cond; end", "def cond; end", "def run_cond; end", "def if_condition; end", "def complex_condition?(condition); end", "def condition &block\n return unless block\n\n case @deferred_status\n when :succeeded, :failed\n SetCallbackFailed.new\n else\n @conditions ||= []\n @conditions.unshift block\n end\n end", "def conditionally(*) end", "def conditionally(*) end", "def define_condition(&blk)\n @condition_defined = true\n define_singleton_method :invoke_condition, &blk\n end", "def pass_control_on_condition\n puts \"Inside the method\"\n\n if block_given?\n yield\n end\n\n puts \"Back inside the method\"\nend", "def condition(&block)\n self.processes << Proc.new do |scenario, args|\n res = catch(:rootage_process_failure) do\n get_process_context_class(scenario).new(scenario).instance_exec(*args, &block)\n true\n end\n throw :rootage_item_stop unless res\n end\n end", "def scope_condition() {} end", "def pass_control_on_condition\n puts \"Inside the method\"\n yield if block_given?\n puts \"Back inside the method\"\nend", "def condition(x)\r\n if x\r\n puts \"condition executed\"\r\n end\r\nend", "def parse_condition; end", "def parse_condition; end", "def block_given?() end", "def child_condition; end", "def assert cond\n fail! unless cond\n end", "def run_when(&blk)\n raise(\"A block is needed to evaluate for run_when\") unless block_given?\n @run_condition = blk\n end", "def run_condition_task\n condition_command = @if\n condition_command ||= @unless\n\n # this is needed since Timeout block will not allow initialization of new variables\n condition_process_status = nil\n\n begin\n Timeout.timeout(@timeout) do\n _out, _err, condition_process_status = Open3.capture3(condition_command)\n end\n rescue Exception => e\n # do not log error in cases it was expected. Meaning that 'unless' condition was set.\n Log.warn(\"Condition command '#{condition_command}' ran into an exception, message: #{e.message}\") unless @unless\n # return true if unless condition was used\n return @unless ? true : false\n end\n\n return condition_process_status.exitstatus > 0 ? false : true if @if\n return condition_process_status.exitstatus > 0 ? true : false if @unless\n end", "def ok_failed(condition)\n if (condition)\n puts \"OK\"\n else\n puts \"FAILED\"\n end\nend", "def pass_control_on_condition\n puts \"Inside the method\"\n yield if block_given? #only if the block present the yield will be executed\n # or yield\n # end\n puts \"Back inside the method\"\nend", "def conditional(condition, block)\n lambda do |record, accumulator, context|\n if condition.call(record, context)\n block.call(record, accumulator, context)\n end\n end\n end", "def ok_failed(condition)\n if condition\n puts \"OK\"\n else\n puts \"FAILED\"\n end\nend", "def else_clause\n expect :if\n self[3]\n end", "def condition(name, msg=nil, &block)\n raise ArgumentError, \"no condition block given\" unless block_given?\n conditions[name] = [msg, block]\n end", "def block?; end", "def trigger_condition_met?(_job)\n true\n end", "def check_condition binding\n return true if condition.nil? || condition.empty?\n begin\n Evaluator.eval_condition binding, condition\n rescue\n set_error_state \"Unable to evaluate condition\",\n refers_to: :BREAKPOINT_CONDITION\n false\n end\n end", "def cond=(_arg0); end", "def cond=(_arg0); end", "def cond=(_arg0); end", "def non_complex_expression?(condition); end", "def block_checker(param) \n [ param , block_given? ]\nend", "def then_clause\n expect :if\n self[2]\n end", "def unless_condition; end", "def with_checking(description)\n puts \"Checking #{description}\"\n result = yield\n if result\n puts \"OK\"\n else\n puts \"FAILED\"\n end\nend", "def test_truth\r\n assert_kind_of Condition, @condition\r\n end", "def inspect_condition(c)\n pc = c.parsed_condition\n\n ctag_count[[c.parent, c.tag]] += 1\n\n pending_question(pc.qtag, c) if pc.qtag\n pending_answer(pc.qtag, pc.atag, c) if pc.qtag && pc.atag\n end", "def stop_condition(&block)\n self.gracefully_stop_mark = block\n end", "def i_check_if_block\n if block_given?\n yield\n else\n puts \"no block\"\n end\nend", "def block\n true\n end", "def supports_block_expectations?\n true\n end", "def block_valid?(block)\n # ...\n end", "def assert( condition, message=nil )\r\n ## note: use message to avoid conflict with msg helper/builtin in contract!!!\r\n if condition == true\r\n ## do nothing\r\n else\r\n if message\r\n raise \"Contract Assertion Failed; Contract Halted (Stopped): #{message}\"\r\n else\r\n raise 'Contract Assertion Failed; Contract Halted (Stopped)'\r\n end\r\n end\r\n end", "def refute(condition, message='')\n assert(!condition, message)\n end", "def block?\n !!block\n end", "def win_condition\nend", "def hit_condition()\n #This is a stub, used for indexing\n end", "def do_conditional\n cond = inequality\n\n loop do\n type = @lexer.peek_next_type\n\n break unless [:AND, :OR].include? type\n @lexer.skip\n\n # The rhs has to be evaluated here because of short-circuiting\n\n rhs = inequality\n\n cond &&= rhs if type == :AND\n cond ||= rhs if type == :OR\n end\n\n return unless cond\n\n expect [:THEN]\n line_do\n end", "def before_block_boundary?; end", "def skip_or_pending_inside_block?(param0 = T.unsafe(nil)); end", "def verify_block(&blk)\n begin\n return true if yield\n rescue\n false\n end\n end", "def check_condition(condition)\n temp_repository = @repository.clone\n temp_repository << [ LV.condition, LV.was, LV.true, :helper_graph ]\n\n temp_reasoner = Reasoner.new temp_repository\n result = temp_reasoner.imply(condition, :helper_graph)\n\n result.query([ LV.condition, LV.was, LV.true ]).any?\n end", "def parse_condition(exp); end", "def block_checker\n block_given?\nend", "def condition\n node.condition\n end", "def test_assert_block_works\n assert_block do\n true\n end\n end", "def node_within_block_or_conditional?(node, stop_search_node); end", "def were_we_given_a_block?\n\tif block_given?\n\t\t\"WE GOT A BLOCK\"\n\telse\n\t\t\"WE DIDN'T GET A BLOCK\"\n\tend\nend", "def test_conditionnal_item(item )\n if item == @conditional_item\n then return true\n end\n return false\n end", "def check_conditions(*args, &block)\n conditions.all? do |condition|\n condition.call(machine.target, *args, &block)\n end\n end", "def if_block_given\n p \"hoge\"\n yield if block_given?\n p \"end\"\nend", "def assert(cond)\n failure unless cond\n end", "def if_state(*expected_states) # :nodoc:\n mutex.lock\n raise ArgumentError.new('no block given') unless block_given?\n\n if expected_states.include? @state\n yield\n else\n false\n end\n ensure\n mutex.unlock\n end", "def test_check_block_num_unequal\r\n assert_nil nil, @g.check_block_num(1, 0)\r\n end", "def test_block_empty\n check(C::Block, <<-EOS)\n | {\n | }\n EOS\n end", "def assert\n# puts \"Processing...\"\n raise \"Assertion failed!\" unless yield \n puts \"True!\"\nend", "def condition_check(condition, event)\n # Procs are the easiest to evaluate\n return condition.call(event) if condition.is_a?(Proc)\n\n # If not a proc, condition must be a hash - iterate over values. All must be true to\n # return true.\n for (key, value) in condition\n return false unless value === event.send(key)\n end\n return true\n end", "def assert\n\t# if yield\n\t# \tputs \"true\"\n\traise \"Assertion failed\" unless yield \n# end \nend", "def condition(stag, &block)\n @conditions << [stag, block]\n end", "def check_block\n finished = @finishable.nil? or @finishable.is_finished?\n puts finished\n if finished\n @finishable, @blocked = nil, false\n return @blocked\n end\n \n @blocked = !finished\n end", "def wait_condition(name, &block)\n resource = WaitCondition.new\n resource.evaluate &block\n\n if resource.handle.nil?\n handle_name = \"#{name}Handle\"\n\n if not resources.include? handle_name\n wait_condition_handle handle_name\n end\n\n resource.handle = handle_name\n end\n\n add_resource(name, resource)\n end", "def waitUntil\n until yield\n sleep 0.5\n end\nend", "def get_condition\n @condition\n end", "def test_block_number_correct_true\n assert @bv.block_number_correct?(1, 1)\n end", "def test_block_count_correct_false\n assert_equal(false, @bv.block_count_correct?(1, [1,2,3,4]))\n end", "def precondition(_op)\n # gain access to operation instance methods \n op = Operation.find(_op.id)\n \n # get params\n response_request = op.input(\"Response Request Message\").val\n response_regex = op.input(\"Response Regex Format\").val\n response_tag = op.input(\"Response Tag\").val\n response_status_tag = \"Response Block status\"\n response_level = op.input(\"Response Level\").val\n \n case response_level\n when \"Plan\"\n obj = _op.plan\n response_tag += \" [#{_op.id}]\"\n response_status_tag += \" [#{_op.id}]\"\n when \"Operation\"\n obj = _op\n when \"Item\"\n obj = _op.input(\"Sample\").item\n end\n \n # library method from ControlBlock (Could this interface be improved?)\n user_response = get_user_response(op, response_request_message: response_request, response_regex: response_regex)\n \n # if the user hasn't responded yet, fail and keep downstream operations in waiting\n return false if user_response.nil?\n \n # Response recieved!\n \n # associate response to the item being passed through\n obj.associate(response_tag, user_response)\n \n # associate note on operation to indicate that you cant retroactively change response\n op.associate \"Response Block status\", \"Your response was successfully recorded as \\\"#{user_response}\\\"\"\n \n # pass input, allowing downstream operations to begin\n op.pass(\"Sample\", \"Sample\")\n\n # set status to done, so this block will not be evaluated again\n op.status = \"done\"\n op.save\n \n return true\nend", "def test_block_number_correct_false\n assert_equal(false, @bv.block_number_correct?(0, 1))\n end", "def add_condition(msg, &block)\n raise ArgumentError, \"block is missing\" unless block_given?\n @conditions.push [block, msg]\n end", "def valid()\n if (@block) then @block.call(true) end\n end", "def waiting actual\n interval = 0.5\n i = 0\n while true\n if actual == yield\n return 'true!!'\n end\n i += interval\n puts '.'\n sleep i\n end\n 'false!!'\nend", "def executeAssertionBlock(block)\n !!block.call(object)\n end", "def wait_for_condition(timeout, step = 0.1, &block)\n defer{ wait_for_condition_sync(timeout, step, &block) }\n end", "def wait_until(timeout=10, &block)\n time = Time.now\n success = false\n until success\n if (Time.now - time) >= timeout\n raise \"Waited for #{timeout} seconds, but block never returned true\"\n end\n sleep 0.5\n success = yield\n end\n end", "def assert\n raise \"ERROR!\" unless yield \nend", "def timeout_check_equal(duration, expected, &block)\n execute_ok = false\n duration.times do\n sleep(1)\n text = instance_eval(&block)\n execute_ok = true and break if (text == expected)\n end\n execute_ok.should == true\n end", "def assert\n puts \"Processing...\"\n raise \"Assertion failed!\" unless yield \n puts \"True!\"\nend", "def captured_by_block?; end", "def _evaluateCondition(obj, clazz=obj.class) # :nodoc:\r\n\t\ttb = self.class._transformer_blocks[clazz]\r\n\t\tblock_description = nil\r\n\t\tif tb.is_a?(TransformationDescription)\r\n\t\t\t# non-conditional\r\n\t\t\tblock_description = tb\r\n\t\telsif tb\r\n\t\t\told_object, @current_object = @current_object, obj\r\n\t\t\ttb.each_pair {|condition, block|\r\n\t\t\t\tif condition.is_a?(Proc)\r\n\t\t\t\t\tresult = instance_eval(&condition)\r\n\t\t\t\telsif condition.is_a?(Symbol)\r\n\t\t\t\t\tresult = _invokeMethod(condition)\r\n\t\t\t\telse\r\n\t\t\t\t\tresult = condition\r\n\t\t\t\tend\r\n\t\t\t\tif result\r\n\t\t\t\t\tblock_description = block \r\n\t\t\t\t\tbreak\r\n\t\t\t\tend\r\n\t\t\t}\r\n\t\t\t@current_object = old_object\r\n\t\tend\r\n\t\tblock_description = _evaluateCondition(obj, clazz.superclass) if block_description.nil? && clazz != Object\r\n\t\tblock_description\r\n\tend", "def test_check_block_num_equal\r\n assert_equal true, @g.check_block_num(1, 1)\r\n end", "def condition\n return @condition\n end", "def condition\n return @condition\n end", "def test02_FlagEventComment_TC_24319\n\t\tcommentEventPop\n\t\tsleep 4\n\t\tcommentPopSubmit\n\t\tsleep 4\n\t\tcommentFlag\n\t\t\n\t\tbegin \n\t\tassert $comment_flag_success.exists?\n\t\t\trescue => e\n\t\t\tputs \"IPS05T02: FAILED! User unable to flag comment!\"\n\t\t\tputs e\n\t\tend\n\tend", "def each_condition_node\n @elements.each do |e|\n if e.condition_node?\n yield e\n else\n e.each_condition_node do |e_child|\n yield e_child\n end\n end\n end\n end", "def after_block_boundary?; end", "def assert\n raise \"Alert Fail!\" unless yield\nend" ]
[ "0.7705128", "0.74539584", "0.7257162", "0.7257162", "0.7257162", "0.7232347", "0.7037876", "0.7018443", "0.6787561", "0.67472076", "0.67472076", "0.66986597", "0.66069186", "0.6600873", "0.6590601", "0.6569773", "0.65691495", "0.65093297", "0.65093297", "0.64882267", "0.64368236", "0.6429129", "0.63939226", "0.63766944", "0.63754433", "0.6344037", "0.6312285", "0.63093257", "0.6308532", "0.6274741", "0.62674737", "0.6262212", "0.6257065", "0.6251178", "0.6251178", "0.6251178", "0.6236625", "0.62327456", "0.62215245", "0.62071586", "0.62057525", "0.61918116", "0.61774385", "0.6176213", "0.6169218", "0.614071", "0.61354405", "0.6126256", "0.61154956", "0.6114935", "0.6108678", "0.61084485", "0.61073065", "0.6099286", "0.6067867", "0.6067411", "0.60622966", "0.60313326", "0.6013941", "0.60052615", "0.59994584", "0.5998477", "0.59896976", "0.5976975", "0.5958039", "0.59507227", "0.59319746", "0.5926559", "0.59211457", "0.591359", "0.59109455", "0.5904538", "0.58940154", "0.58924705", "0.5885357", "0.5881843", "0.58677673", "0.5858088", "0.58571756", "0.58566165", "0.58383703", "0.5835391", "0.58340424", "0.58248115", "0.5811438", "0.5800302", "0.57944894", "0.5793726", "0.57928395", "0.57907486", "0.57793653", "0.57722133", "0.5771454", "0.5761554", "0.5754927", "0.5752156", "0.5752156", "0.57497424", "0.57460195", "0.5745715", "0.5744214" ]
0.0
-1
tests for acl block
def test_empty act = acl { }.call({})[0] assert_equal(399, act) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_set3_16_check()\n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n acc_type = 'deny' \n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n end", "def test_set3_14_check() \n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n acc_type = 'deny'\n res_ob_adrs='/db/temp/test'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs) \n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n \n res_ob_adrs='/db/temp'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n end", "def test_set3_15_check() \n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n \n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n \n res_ob_adrs='/db/temp/test' \n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n \n res_ob_adrs='/db/temp/test/hokus'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n end", "def test_set3_17_check() \n prin_name = 'nikdo'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp/*'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp/*'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n \n res_ob_adrs='/db/temp'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n \n res_ob_adrs='/db/temp/test'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n \n res_ob_adrs='/db/temp/test/hokus'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n end", "def test_set3_13_check() \n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'ALL_PRIVILEGES'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n prin_name = 'Klubicko'\n acc_type = 'deny'\n priv_name = 'ALTER'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n priv_name = 'ALTER'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n priv_name = 'DROP'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n end", "def acl_for(role = :all, &block)\n @_aclize_acl.setup(role, &block)\n end", "def test_set3_17_check() \n prin_name = 'nikdo'\n acc_type = 'deny'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp/*'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n prin_name = 'Klubicko'\n acc_type = 'deny'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp/*'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n \n res_ob_adrs='/db/temp'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n \n res_ob_adrs='/db/temp/test'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n \n res_ob_adrs='/db/temp/test/hokus'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n end", "def checkAcl(path,principal,readGranted,writeGranted)\n acl = @authz.getacl(path)\n\t# check user1\n\tassert_not_nil(acl[principal],\"Expected for find ACE for #{principal}\"[email protected](acl))\n\tace = acl[principal]\n\tif ( readGranted || writeGranted ) then\n\t assert_not_nil(ace[\"granted\"],\"Expected ace for #{principal} to have granted something granted ace was nil \"[email protected](acl))\n\t puts(\"ACE for user #{principal} was \"[email protected](ace)+\":\"+ace[\"granted\"].to_s)\n\tend\n\tif ( !readGranted || !writeGranted ) then\n assert_not_nil(ace[\"denied\"],\"Expected ace for #{principal} to have denied something, denied was nil \"[email protected](acl))\n puts(\"ACE for user #{principal} was \"[email protected](ace)+\":\"+ace[\"denied\"].to_s)\n end\n\n if ( readGranted ) then\n assert_equal(true,ace[\"granted\"].include?(\"jcr:read\"),\"Expected ace for #{principal} to have jcr:read granted ace was \"[email protected](ace))\n if ( ace[\"denied\"] != nil ) then\n assert_equal(false,ace[\"denied\"].include?(\"jcr:read\"),\"Expected ace for #{principal} not to have jcr:read denied ace was \"[email protected](ace))\n\t end\n else\n assert_equal(true,ace[\"denied\"].include?(\"jcr:read\"),\"Expected ace for #{principal} to have jcr:read denied ace was \"[email protected](ace))\n if ( ace[\"granted\"] != nil ) then\n assert_equal(false,ace[\"granted\"].include?(\"jcr:read\"),\"Expected ace for #{principal} not to have jcr:read granted ace was \"[email protected](ace))\n\t end\n end\n if ( writeGranted ) then\n assert_equal(true,ace[\"granted\"].include?(\"jcr:write\"),\"Expected ace for #{principal} to have jcr:write granted ace was \"[email protected](ace))\n if ( ace[\"denied\"] != nil ) then\n assert_equal(false,ace[\"denied\"].include?(\"jcr:write\"),\"Expected ace for #{principal} not to have jcr:write denied ace was \"[email protected](ace))\n\t end\n else\n assert_equal(true,ace[\"denied\"].include?(\"jcr:write\"),\"Expected ace for #{principal} to have jcr:write denied ace was \"[email protected](ace))\n if ( ace[\"granted\"] != nil ) then\n assert_equal(false,ace[\"granted\"].include?(\"jcr:write\"),\"Expected ace for #{principal} not to have jcr:write granted ace was \"[email protected](ace))\n\t end\n end\n end", "def acl(params = nil)\n if @name_index\n @conf.insert(@name_index + @conf.length, \" \" + \"acl \" + params.to_s + \"\\n\")\n else\n puts \"no #{@proxy_type} name assigned\"\n return false\n end\n end", "def test_lock_acl\n new_file 'file'\n lock = lock 'file'\n \n acl = get_acl 'file'\n ace = RubyDav::Ace.new :grant, test_principal_uri, false, :read\n acl.unshift ace\n\n response = @request.acl 'file', acl\n assert_equal '423', response.status\n\n response = @request.propfind 'file', 0, :acl, testcreds\n assert_equal '403', response.status\n\n response = @request.acl 'file', acl, :if => lock.token\n assert_equal '200', response.status\n\n response = @request.propfind 'file', 0, :acl, testcreds\n assert_equal '207', response.status\n assert_equal '403', response[:acl].status\n\n acl.unshift RubyDav::Ace.new(:grant, test_principal_uri, false, :'read-acl')\n response = @request.acl 'file', acl, :if => lock.token\n assert_equal '200', response.status\n\n response = @request.propfind 'file', 0, :acl, testcreds\n assert_equal '207', response.status\n assert_equal '200', response[:acl].status\n\n response = @request.unlock 'file', lock.token\n assert_equal '204', response.status\n\n delete_file 'file'\n end", "def test_object_acl_get\r\n\t\tVCR.use_cassette('object_acl_get') do\r\n\t\t\tcred=JSON.parse(YAML::load_file('test/fixtures/credential.yml').to_json)\r\n\t\t\tjson = JSON.parse(File.read(\"test/fixtures/acl_list.json\"))\r\n\t\t\tid = \"#{CORDRA_PREFIX}/RMNH.RENA.38646\"\r\n\t\t\tresult=CordraRestClient::DigitalObject.get_acl(API_URL, id, json, cred[\"uc_1\"])\r\n\r\n\t\t\t#check result returned\r\n\t\t\tassert_equal 2, result.length\r\n\t\t\tassert_equal 2, result[\"readers\"].length\r\n\t\t\tassert_equal '#{CORDRA_PREFIX}/1517d545cc11283e2360', result[\"readers\"][0]\r\n\t\t\tassert_equal '#{CORDRA_PREFIX}/1517d545cc11283e2360', result[\"writers\"][0]\r\n\t\tend\r\n\tend", "def test_valid_block\n chain = \"SYSTEM>Kurt(50)\"\n block = Blockchain.new(\"5\", \"5\", chain, \"1518892051.812065000\", \"ch77\")\n\n assert_equal 1, block.is_valid\n end", "def test_good_block\r\n\t\ts = \"SYSTEM>Gaozu(100)\"\r\n\t\ttb = Block.new(\"0\", \"0\", s, \"1518893687.329767000\", \"fd18\")\r\n\t\t\r\n\t\tassert_equal 1, tb.validate_block\r\n\tend", "def test_conditional_true\n act = acl {\n respond(200) { true }\n }.call({})\n assert_equal([200, {}, []], act)\n end", "def set_acl_statement\n super\n end", "def test_object_acl_set\r\n\t\tVCR.use_cassette('object_acl_set') do\r\n\t\t\tcred=JSON.parse(YAML::load_file('test/fixtures/credential.yml').to_json)\r\n\t\t\tjson = JSON.parse(File.read(\"test/fixtures/acl_list.json\"))\r\n\t\t\tid = \"#{CORDRA_PREFIX}/RMNH.RENA.44084\"\r\n\t\t\tresult=CordraRestClient::DigitalObject.set_premissions(API_URL, id, json, cred[\"uc_1\"])\r\n\t\t\t#check that the result is saved\r\n\t\t\tassert_equal 200, result[:code]\r\n\t\t\tassert_equal \"OK\", result[\"message\"]\r\n\t\t\tassert_equal 4, result.length\r\n\t\t\tassert_equal 1, result[\"readers\"].length\r\n\t\t\tassert_equal '#{CORDRA_PREFIX}/1517d545cc11283e2360', result[\"readers\"][0]\r\n\t\tend\r\n\tend", "def test_invalid_block\n chain = \"SYSTEM>Kurt(50)\"\n block = Blockchain.new(\"5\", \"5\", chain, \"1518892051.812065000\", \"ch78\")\n\n assert_equal 0, block.is_valid\n end", "def parse_acl(buffer)\n acl_buf = Net::SSH::Buffer.new(buffer.read_string)\n acl = []\n acl_buf.read_long.times do\n acl << ACL.new(acl_buf.read_long, acl_buf.read_long, acl_buf.read_long, acl_buf.read_string)\n end\n acl\n end", "def test_bad_block\r\n\t\ts = \"SYSTEM>Gaozu(100)\"\r\n\t\ttb = Block.new(\"0\", \"0\", s, \"1518893687.329767000\", \"fd19\")\r\n\t\t\r\n\t\tassert_equal 0, tb.validate_block\r\n\tend", "def authorization(*args, &block); end", "def block_allowed?(role)\n ::ActiveSupport::Deprecation.warn(\"block_allowed? has been deprecated.\", caller)\n _die_if_undefined\n return false if (rules = access_allowed_for[role]).nil?\n !rules.detect { |rule| block_allowed_by_rule?(rule) }.nil?\n end", "def get_block_vpool_acl(block_vpool_id,auth=nil, cert=nil)\n\t\trest_get(\"#{@base_url}/block/vpools/#{block_vpool_id}/acl\", auth.nil? ? @auth_token : auth, cert.nil? ? @verify_cert : cert)\n\tend", "def request_acl\n body = bucket_request(:get, :params => \"acl\").body\n parse_acl(body)\n end", "def block_valid?(block)\n # ...\n end", "def test_create_timebase_acl_rule\n user = createUser(\"1\")\n node = createNode(\"1\")\n res = @s.set_node_acl_rule_entries(node, user, {\"jcr:read\" => \"granted\"}, {\"rule\" => \"TestingThatRuleWorks\"})\n\tassert_equal(\"200\",res.code,\"Failed to add Rule ACL \"+res.body)\t\n\t\n\tacl = @s.get_node_ruleacl(node)\n\[email protected](acl)\n\tassert_equal(1,acl.size)\n\t\n\truleace = findRuleAce(acl, user.name)\n\tassert_not_nil(ruleace)\n\tassert_equal(0,ruleace[\"order\"])\n\tgranted = ruleace[\"granted\"]\n\tassert_equal(1,granted.size)\n\tassert_equal(\"jcr:read\",granted[0])\n\tdenied = ruleace[\"denied\"]\n\tassert_nil(denied)\n\tassert_equal(\"TestingThatRuleWorks\",ruleace[\"sakai:rule-processor\"])\n\t\n\t\n\t\n\t\n end", "def permissions_policy(&block); end", "def getacl\n url = prefix + \"getacl\"\n return response(url)\n end", "def bucket_acl_set?(s3_client, bucket_name, access_level)\r\n s3_client.put_bucket_acl(\r\n bucket: bucket_name,\r\n acl: access_level\r\n )\r\n return true\r\nrescue StandardError => e\r\n puts \"Error setting bucket ACL: #{e.message}\"\r\n return false\r\nend", "def test_ut_t2_ars_arc_012\n current_user = User.find_by_id(TCANA_MEMBER_ID)\n ars = AnalyzeRuleConfig.find_by_id(1)\n assert !ars.editable?(current_user,PU_ID,PJ_ID)\n end", "def acl\n attribute_prop(9)\n end", "def test_check_good_block\n line = ['0', '0', 'SYSTEM>569274(100)', '1553184699.650330000', '288d']\n line_num = 1\n assert_output(nil) { @verify.check_block(line, line_num) }\n end", "def getacl\n url = prefix + \"getacl\"\n return response(url)\n end", "def effective_acl(parsed_labels=[])\n acl\n end", "def valid?\n IsValidAcl(@acl)\n end", "def call &block\n return true if before(@action)\n return true if send(@action)\n raise Lux::Error.unauthorized('Access disabled in policy')\n rescue Lux::Error\n error = $!.message\n error += \" - #{self.class}.#{@action}\" if Lux.config(:dump_errors)\n raise Lux::Error.unauthorized(error) unless block\n block.call(error)\n false\n end", "def test_block_hash_match\n \tblock = \"1|1c12|SYSTEM>George(100)|1518892051.740967000|abb2\".split(\"|\")\n \tassert(@bv.block_hash_correct(block))\n end", "def acl\n 'public-read'\n end", "def run_me\r\n bucket_name = 'doc-example-bucket'\r\n permission = 'READ'\r\n owner_id = 'b380d412791d395dbcdc1fb1728b32a7cd07edae6467220ac4b7c0769EXAMPLE'\r\n region = 'us-west-2'\r\n s3_client = Aws::S3::Client.new(region: region)\r\n\r\n if bucket_acl_set_for_owner_id?(\r\n s3_client,\r\n bucket_name,\r\n permission,\r\n owner_id\r\n )\r\n puts 'Bucket ACL set.'\r\n else\r\n puts 'Bucket ACL not set.'\r\n end\r\nend", "def acl(url, acl, options={})\n acl.delete_if{|ace| ace.protected? || ace.kind_of?(InheritedAce)}\n acl.compact! if acl.compacting?\n stream = RubyDav.build_xml_stream { |xml| acl.printXML xml }\n request :acl, url, stream, options\n end", "def access?(x, acl:nil)\n return true if acl.nil?\n return true if %w(* all any public).include? acl.to_s\n return true if acl.to_s == \"user\" and x.usr?\n case acl\n when String, Symbol\n return (x.usr[\"grp\"] and x.usr[\"grp\"].include? acl.to_s)\n when Array\n return (x.usr[\"grp\"] and (x.usr[\"grp\"] & acl).size > 0)\n when Hash \n g = nil\n if acl.keys.include? :any or acl.keys.include? :all\n g = acl[:any] || acl[:all]\n elsif acl.keys.include? :read and [:get, :head, :options].include? x.meth\n g = acl[:read]\n elsif acl.keys.include? :write and [:put, :post, :delete, :patch].include? x.meth\n g = acl[:write]\n else\n g = acl[x.meth]\n end\n return false if g.nil?\n return true if %w(* all any public).include? g.to_s\n return access?(x, g)\n when Proc\n return acl.call(x)\n else\n Waxx.debug \"No acl type recognized in App.access? for acl: #{acl.inspect}\", 1\n false\n end\n false\n end", "def test_ut_t2_ars_arc_013\n # pu admin\n current_user = User.find_by_id(PU_ADMIN_ID)\n # pu ars\n pu_id = PrivilegesUsers.find_all_by_user_id(current_user.id)[0].pu_id\n ars = Pu.find_by_id(pu_id).analyze_rule_configs[0]\n #\n assert ars.editable?(current_user,pu_id,nil)\n end", "def test_check_bad_block\n assert_raises SystemExit do\n assert_output \"Line 1: Invalid block, missing or extra element(s)\\nBLOCKCHAIN INVALID\" do\n line = ['0', '0', 'SYSTEM>569274(100)', '1553184699.650330000', '288d', '']\n line_num = 1\n @verify.check_block(line, line_num)\n end\n end\n end", "def acl\n @acl ||= AlbumACL.new(id)\n end", "def test_put_bucket_predefined_acl\n @client.put_bucket(new_bucket_name, :predefined_acl => \"publicRead\")\n end", "def aws_acl?\n ['private', 'public-read', 'public-read-write', 'authenticated-read', 'bucket-owner-read', 'bucket-owner-full-control'].include?(aws_access_control_list)\n end", "def get_acl_definition\n return @_aclize_acl\n end", "def object_acl_set?(s3_client, bucket_name, object_key, access_level)\r\n s3_client.put_object_acl(\r\n bucket: bucket_name,\r\n key: object_key,\r\n acl: access_level\r\n )\r\n return true\r\nrescue StandardError => e\r\n puts \"Error setting object ACL: #{e.message}\"\r\n return false\r\nend", "def acl=(_acl)\n fail Dav::Exception::Forbidden, 'Setting ACL is not allowed here'\n end", "def test_block_verifier_is_a_block_verifier\n assert @bv.is_a?(BlockVerifier)\n end", "def blocklists; end", "def test_valid_block_number\n assert check_block_number('0', 0)\n end", "def assert_permitted(tor, *args)\n role = tor.is_a?(Authorize::Role) ? tor : tor.role\n resource = args.pop\n request_mask = Authorize::Permission::Mask[*args]\n assert_block(\"Role #{role} is not permitted (#{request_mask})\") do\n Authorize::Permission.over(resource).as(role.roles).permit?(request_mask)\n end\n end", "def test_ut_t2_ars_arc_011\n current_user = User.find_by_id(TCANA_ADMIN_ID)\n ars = AnalyzeRuleConfig.find_by_id(1)\n assert ars.editable?(current_user,PU_ID,PJ_ID)\n end", "def test_read_file_many_blocks\r\n hash_calc = Minitest::Mock.new('test_hash_calculator')\r\n block_checker = Minitest::Mock.new('test_block_checker')\r\n account_tracker = Minitest::Mock.new('account_tracker')\r\n def block_checker.read_next_line; \"1|2|3|4|5|6\"; end\r\n def block_checker.parse(string, char); [\"1\",\"2\",\"3\",\"4\",\"5\",\"6\"]; end\r\n output = \"Line 0: Too many '|' in the block '1|2|3|4|5|6'\"\r\n assert_equal output, @g.read_file(hash_calc, block_checker, account_tracker)\r\n end", "def display_acl?\n convention_admin? || super_admin?\n end", "def test_ut_t2_ars_arc_015\n # pu admin\n current_user = User.find_by_id(PU_ADMIN_ID)\n # pj ars\n pu_id = PrivilegesUsers.find_all_by_user_id(current_user.id)[0].pu_id\n pu_pj = Pu.find_by_id(pu_id).pjs[0]\n ars = Pj.find_by_id(pu_pj.id).analyze_rule_configs[0]\n #\n assert ars.editable?(current_user,pu_id,nil)\n end", "def facls_different?(acl1, acl2)\n sanitize_acl_for_comparison(acl1) != sanitize_acl_for_comparison(acl2)\n end", "def blockable?(obj)\n \tif is_released?(obj.release_status)\n \t\tif obj.uploader_role == \"Sectionhead\" && is_department_head?\n \t\t true\n \t\telsif obj.uploader_role == \"Normal\" && is_section_head?\n \t\t true\n \t\tend\n \tend\n \t\t \t \n end", "def conf_acl\n ace = $ts.dut.call(\"mesa_ace_init\", \"MESA_ACE_TYPE_ANY\")\n ace[\"id\"] = 1\n action = ace[\"action\"]\n action[\"port_action\"] = \"MESA_ACL_PORT_ACTION_REDIR\"\n action[\"port_list\"] = \"#{$port_list[0]}\"\n ace[\"port_list\"] = \"#{$port_list[1]}\"\n policy = ace[\"policy\"]\n policy[\"value\"] = 1\n policy[\"mask\"] = 0x3f\n $ts.dut.call(\"mesa_ace_add\", 0, ace)\nend", "def check_edit_rights(current_user, sample)\n true if current_user.id == sample.author_id && Time.now - sample.created_at < 3600 && current_user.baned == false\n end", "def test_ut_t2_ars_arc_024\n # tcana admin\n current_user = User.find_by_id(TCANA_MEMBER_ID)\n ars = AnalyzeRuleConfig.create() # ars is not being used.\n assert !ars.deletable?(current_user, PU_ID, nil)\n end", "def access_control( uri_pattern=nil, **options, &block )\n\t\t\toptions[ :block ] = block if block\n\t\t\tself.access_controls << [ uri_pattern, options ]\n\t\tend", "def test_assert_block_works\n assert_block do\n true\n end\n end", "def test_ut_t2_ars_arc_014\n # pu admin\n current_user = User.find_by_id(PU_ADMIN_ID)\n # ars created by pu\n pu_id = PrivilegesUsers.find_all_by_user_id(current_user.id)[0].pu_id\n ars = Pu.find_by_id(pu_id).analyze_rule_configs[0]\n ars.created_by = current_user.id\n ars.save\n #\n assert ars.editable?(current_user,pu_id,nil)\n end", "def check_access_control\n @bot = Bot.find(params[:id])\n\n response_access_denied unless current_user.has_role?(:admin) || current_user.id == @bot.account.user_id\n rescue\n response_access_denied\n end", "def list_object_acls(s3_client, bucket_name, object_key)\r\n response = s3_client.get_object_acl(bucket: bucket_name, key: object_key)\r\n if response.grants.count.zero?\r\n puts 'No ACLs for this object.'\r\n else\r\n puts\r\n puts \"Owner #{response.owner.display_name}\"\r\n puts\r\n response.grants.each do |grant|\r\n grantee = grant.grantee\r\n if grantee.type == 'Group'\r\n puts 'Grantee GROUP'\r\n puts 'URI ' + grantee.uri\r\n else\r\n if grantee.display_name.nil?\r\n puts 'Grantee EVERYONE'\r\n else\r\n puts 'Grantee ' + grantee.display_name\r\n end\r\n if grantee.id.nil?\r\n puts 'ID NONE'\r\n else\r\n puts 'ID ' + grantee.id\r\n end\r\n end\r\n puts 'Permission ' + grant.permission\r\n puts\r\n end\r\n end\r\nrescue StandardError => e\r\n puts \"Error getting bucket ACLs: #{e.message}\"\r\nend", "def block_valid?(block, difficulty = 4)\n block.valid?(difficulty) &&\n block.parent_digest == head_digest &&\n balances([block]).none? { |user, balance| balance < 0 }\n end", "def test_ut_t2_ars_arc_022\n # tcana admin\n current_user = User.find_by_id(PU_ADMIN_ID)\n ars = AnalyzeRuleConfig.create() # ars is not being used.\n ars.created_by = current_user.id\n ars.save\n assert ars.deletable?(current_user, PU_ID, nil)\n end", "def test_block_number_correct_true\n assert @bv.block_number_correct?(1, 1)\n end", "def blocklisted_response; end", "def set_acl_entry( slot, params )\n raise RangeError.new(\"slot #{slot} outside range 0-9\") unless (0..9).include?(slot)\n raise ArgumentError.new(\"policy must be either permit or deny\") unless ['permit', 'deny'].include? params[:policy]\n Penctl.execute(@pen, \"acl #{slot} #{params[:policy]} #{params[:source_ip]} #{params[:netmask]}\".strip)\n end", "def allow\n Test::Spec::Rails::Macros::Authorization::TestGenerator.new(test_case,\n :access_denied?, false,\n 'Expected access to be allowed'\n )\n end", "def granted?(resource, principal)\n\n # LimeBerry principal can do anything\n return true if principal == Principal.limeberry\n\n # consisting of the transitive group membership\n membership_str =\n \"(SELECT group_id, member_id FROM transitive_membership\\n\" +\n \"WHERE member_id = :principal_id\\n\" +\n \"UNION\\n\" +\n # and a pseudo-membership where principal is a member of\n # itself\n \"SELECT :principal_id group_id, :principal_id member_id) membership\\n\"\n\n # be sure to check aggregate privileges which may contain this one\n privs_str = \"(SELECT par_priv.id par_priv_id\\n\" +\n \"FROM privileges par_priv\\n\" +\n \"INNER JOIN\\n\" + # privileges joins with itself\n \"privileges chi_priv\\n\" +\n \"ON par_priv.lft <= chi_priv.lft AND par_priv.rgt >= chi_priv.rgt\\n\" +\n \"WHERE chi_priv.namespace_id = :namespace_id AND chi_priv.id = :privilege_id ) privs\\n\"\n\n # join aces to the resource in question\n # and any resources it may inherit ACLs from\n inherited_res_str = \"(SELECT par_res.resource_id resource_id, par_res.rgt par_res_rgt\\n\" +\n \"FROM acl_inheritance par_res\\n\" +\n \"INNER JOIN acl_inheritance chi_res\\n\" +\n \"ON (\\n\" +\n #\"par_res.base_id = chi_res.base_id AND\\n\" +\n \"par_res.lft < chi_res.lft AND par_res.rgt > chi_res.rgt)\\n\" +\n \"WHERE chi_res.resource_id = :resource_id\\n\" +\n \"UNION\\n\" +\n \"SELECT :resource_id resource_id, -1 par_res_rgt)\\n\" +\n \"inherited_res\\n\"\n\n sql_query = \"SELECT aces.id, aces.grantdeny, aces.protected FROM aces aces \\n\" +\n \"INNER JOIN aces_privileges ap\\n\" +\n \"ON aces.id = ap.ace_id\\n\" +\n \"INNER JOIN\\n\" +\n membership_str +\n \"ON aces.principal_id = membership.group_id\\n\" +\n \"INNER JOIN\\n\" +\n privs_str +\n \"ON ap.privilege_id = privs.par_priv_id\\n\" +\n \"INNER JOIN\\n\" +\n inherited_res_str +\n \"ON aces.resource_id = inherited_res.resource_id\\n\" +\n \"ORDER BY aces.protected DESC, par_res_rgt ASC, aces.position ASC\\n\" +\n \"LIMIT 1;\"\n\n values = {\n :namespace_id => self.namespace_id,\n :principal_id => principal.id,\n :privilege_id => self.id,\n :resource_id => resource.id\n }\n\n aces = Ace.find_by_sql( [ sql_query, values ])\n\n return false if aces.empty?\n\n aces[0].grantdeny == Ace::GRANT\n\n end", "def bucket_acl_set_for_owner_id?(\r\n s3_client,\r\n bucket_name,\r\n permission,\r\n owner_id\r\n)\r\n s3_client.put_bucket_acl(\r\n access_control_policy: {\r\n grants: [\r\n {\r\n grantee: {\r\n id: owner_id,\r\n type: 'CanonicalUser'\r\n },\r\n permission: permission\r\n }\r\n ],\r\n owner: {\r\n id: owner_id\r\n }\r\n },\r\n bucket: bucket_name\r\n body: \"c:\\\\my-file.txt\",\r\n )\r\n return true\r\nrescue StandardError => e\r\n puts \"Error setting bucket ACL: #{e.message}\"\r\n return false\r\nend", "def acls_equal(target_acl, actual_acl)\n if actual_acl.nil?\n return target_acl.nil?\n end\n\n actual_acl = actual_acl.select { |ace| !ace.inherited? }\n # When ACLs apply to children, Windows splits them on the file system into two ACLs:\n # one specific applying to this container, and one generic applying to children.\n new_target_acl = []\n target_acl.each do |target_ace|\n if target_ace.flags & INHERIT_ONLY_ACE == 0\n self_ace = target_ace.dup\n # We need flag value which is already being set in case of WRITE permissions as 3, so we will not be overwriting it with the hard coded value.\n self_ace.flags = 0 unless target_ace.mask == Chef::ReservedNames::Win32::API::Security::WRITE\n self_ace.mask = securable_object.predict_rights_mask(target_ace.mask)\n new_target_acl << self_ace\n end\n # As there is no inheritance needed in case of WRITE permissions.\n if target_ace.mask != Chef::ReservedNames::Win32::API::Security::WRITE && target_ace.flags & (CONTAINER_INHERIT_ACE | OBJECT_INHERIT_ACE) != 0\n children_ace = target_ace.dup\n children_ace.flags |= INHERIT_ONLY_ACE\n new_target_acl << children_ace\n end\n end\n actual_acl == new_target_acl\n end", "def verify_block(&blk)\n begin\n return true if yield\n rescue\n false\n end\n end", "def test_ut_t2_ars_arc_023\n # tcana admin\n current_user = User.find_by_id(PU_ADMIN_ID)\n ars = AnalyzeRuleConfig.create() # ars is not being used.\n assert !ars.deletable?(current_user, PU_ID, nil)\n end", "def test_ut_t2_ars_arc_020\n # tcana admin\n current_user = User.find_by_id(TCANA_ADMIN_ID)\n ars = Pu.find_by_id(PU_ID).analyze_rule_configs[0] # ars being used\n assert !ars.deletable?(current_user, PU_ID, PJ_ID)\n end", "def auth_mifare_block(blk, cuid = card_uid, key = PN532::MIFARE_DEFAULT_KEY)\n uid = PN532::DataBuffer.new.set(cuid)\n\n resp = PN532.mifare_authenticate_block(\n pn_struct,\n uid,\n uid.nonzero_length,\n blk,\n PN532::MIFARE_CMD_AUTH_A,\n key\n )\n\n check_error(resp)\n end", "def test_block_count_correct_true\n assert @bv.block_count_correct?(1, [1,2,3,4,5])\n end", "def verify\n response = script_mode do \n query(\"configshow | grep RBAC\")\n end \n response.data.match(/#{Replies::RBAC_DENIED}/) ? false : true\n end", "def container_acl(name, key = nil)\n key ||= properties.key1\n\n response = blob_response(key, \"restype=container&comp=acl\", name)\n response.headers[:private?] = response.headers.include?(:x_ms_blob_public_access) ? false : true\n\n ContainerProperty.new(response.headers)\n end", "def test_authorization_and_void\n return if Base.mode == :test # only tests in production mode\n assert_equal Base.mode, :production\n assert authorization = @gateway.authorize(@amount, @credit_card, @options)\n assert_success authorization\n \n assert void = @gateway.void(authorization.authorization)\n assert_success void\n assert_match(/This transaction has been approved/, void.message)\n end", "def acl=(_acl)\n fail Dav::Exception::MethodNotAllowed, 'You\\'re not allowed to update the ACL'\n end", "def acl=(_acl)\n fail Dav::Exception::MethodNotAllowed, 'You\\'re not allowed to update the ACL'\n end", "def test_check_block_num_equal\r\n assert_equal true, @g.check_block_num(1, 1)\r\n end", "def has_permission_on(*args)\n options = args.extract_options!\n context = args.flatten\n \n raise DSLError, \"has_permission_on only allowed in role blocks\" if @current_role.nil?\n options = {:to => [], :join_by => :or}.merge(options)\n \n privs = options[:to] \n privs = [privs] unless privs.is_a?(Array)\n raise DSLError, \"has_permission_on either needs a block or :to option\" if !block_given? and privs.empty?\n\n file, line = file_and_line_number_from_call_stack\n rule = AuthorizationRule.new(@current_role, privs.map(&:to_sym), context, options[:join_by],\n :source_file => file, :source_line => line)\n @auth_rules << rule\n if block_given?\n @current_rule = rule\n yield\n raise DSLError, \"has_permission_on block content specifies no privileges\" if rule.privileges.empty?\n # TODO ensure?\n @current_rule = nil\n end\n end", "def test_specific_overrides\n @store.allow(\"host.madstop.com\")\n @store.deny(\"*.madstop.com\")\n\n\n assert(\n @store.allowed?(\"host.madstop.com\", \"192.168.0.1\"),\n\n \"More specific allowal by name failed\")\n\n @store.allow(\"192.168.0.1\")\n @store.deny(\"192.168.0.0/24\")\n\n\n assert(\n @store.allowed?(\"host.madstop.com\", \"192.168.0.1\"),\n\n \"More specific allowal by ip failed\")\n end", "def allowed_acl(sid, expected_perms, flags = 0)\n acl = [ ACE.access_allowed(sid, expected_perms[:specific], flags) ]\n if expected_perms[:generic]\n acl << ACE.access_allowed(sid, expected_perms[:generic], (Chef::ReservedNames::Win32::API::Security::SUBFOLDERS_AND_FILES_ONLY))\n end\n acl\n end", "def create_group_acls(acls)\n acls_ids = Array.new\n\n acls.each{|rule|\n\n acl = OpenNebula::Acl.new(OpenNebula::Acl.build_xml,@client)\n\n rule_ast = \"#{rule} *\" #Add all zone id's\n\n parsed_acl = OpenNebula::Acl.parse_rule(rule_ast)\n\n return parsed_acl, [] if OpenNebula.is_error?(parsed_acl)\n\n rc = acl.allocate(*parsed_acl)\n\n return rc, \"\" if OpenNebula.is_error?(rc)\n\n acls_ids << acl.id\n }\n\n return true, acls_ids\n end", "def acl=(_acl)\n fail Dav::Exception::MethodNotAllowed, 'Changing ACL is not yet supported'\n end", "def update_acl(bucket, accesskey, acl)\n Result.new(call(CMD_UPDATE_ACL % [bucket, accesskey, acl]))\n end", "def block\n true\n end", "def test_ut_t2_ars_arc_021\n # tcana admin\n current_user = User.find_by_id(TCANA_ADMIN_ID)\n ars = AnalyzeRuleConfig.create() # ars is not being used.\n assert ars.deletable?(current_user, PU_ID, PJ_ID)\n end", "def get_block(*params); raise('Stub or mock required.') end", "def test_permissios\n source = <<EOF\n [groups]\n g1=user1\n g2=user1,user2\n [/]\n * = r\n [repo1:/dir1]\n @g1 = rw\n @g2 =\n [repo1:/dir1/dir2]\n user1=\n user2=r\n [repo2:/home]\n user1 = garbage\n [/dir1]\n user2 = rw\nEOF\n io = StringIO.new(source)\n @svnauthz.load(io)\n assert_equal(\"r\",@svnauthz.permissions('user0','repo1:/'))\n assert_equal(\"rw\",@svnauthz.permissions('user1','repo1:/dir1'))\n assert_equal(\"\",@svnauthz.permissions('user2','repo1:/dir1'))\n assert_equal(\"rw\",@svnauthz.permissions('user2','repo2:/dir1'))\n assert_equal(\"\",@svnauthz.permissions('user1','repo1:/dir1/dir2'))\n assert_equal(\"r\",@svnauthz.permissions('user2','repo1:/dir1/dir2'))\n exception = assert_raise(RuntimeError){ @svnauthz.permissions('user1','repo2:/home') }\n assert_match /Syntax error/, exception.message\n end", "def acl=(acl)\n @acl = acl.to_s.gsub(\"_\",\"-\") if acl\n end", "def test_multi_resource_lock_forbidden\n response = @request.delete('coll')\n\n response = @request.mkcol('coll')\n assert_equal '201', response.status\n\n response = @request.mkcol('coll/subcoll')\n assert_equal '201', response.status\n\n response = @request.put('coll/secret', @stream)\n assert_equal '201', response.status\n\n # get the acl of collection\n response = @request.propfind 'coll', 0, :acl\n assert !response.error?\n acl = response[:acl].acl.modifiable\n\n # grant test user all privileges on collection\n acl.unshift RubyDav::Ace.new(:grant, test_principal_uri, false, :all)\n response = @request.acl('coll', acl)\n assert_equal '200', response.status\n\n # get acl of secret file\n response = @request.propfind 'coll/secret', 0, :acl\n assert !response.error?\n acl = response[:acl].acl.modifiable\n\n # deny test user all privileges on secret file\n acl.unshift RubyDav::Ace.new(:deny, test_principal_uri, false, :all)\n response = @request.acl('coll/secret', acl)\n assert_equal '200', response.status\n\n # assert that test user can't PUT on secret file\n response = @request.put('coll/secret', StringIO.new(\"Investigate small file\"), testcreds)\n assert_equal '403', response.status\n\n # lock the collection\n response = @request.lock 'coll', testcreds\n # assert multi-status with 424 for req-uri and 403 for troublesome child\n assert_equal '207', response.status\n resps = response.responses\n assert_equal '424', resps[@uri.path + 'coll'].status\n assert_equal '403', resps[@uri.path + 'coll/secret'].status\n\n # cleanup\n response = @request.delete('coll', :depth => RubyDav::INFINITY)\n assert_equal '204', response.status\n end", "def test_block_count_correct_false\n assert_equal(false, @bv.block_count_correct?(1, [1,2,3,4]))\n end", "def deny(*args, &block)\n if block.nil?\n test = args.first\n msg = args[1]\n assert !test, msg # this makes it get passed up to the framework\n else\n aver(:deny, *args, &block)\n end\n end" ]
[ "0.6512224", "0.64589405", "0.63460326", "0.63172895", "0.6222977", "0.61907774", "0.6190758", "0.6156618", "0.61100674", "0.608572", "0.6078659", "0.6019188", "0.5984663", "0.5975176", "0.57724375", "0.5719806", "0.57072496", "0.5686343", "0.5662822", "0.5639642", "0.563046", "0.56162363", "0.5614833", "0.56098485", "0.55952567", "0.55120033", "0.5499656", "0.54697496", "0.5428064", "0.542279", "0.5400913", "0.5393222", "0.5389873", "0.5376874", "0.5366739", "0.5348024", "0.5339269", "0.532914", "0.532359", "0.5305144", "0.5297093", "0.5283622", "0.5277356", "0.5277244", "0.5274496", "0.52636975", "0.52590317", "0.5257428", "0.5255471", "0.5240767", "0.5225434", "0.5224029", "0.5217583", "0.5211301", "0.5205348", "0.5195741", "0.5183002", "0.51829255", "0.5168879", "0.5159169", "0.5152184", "0.51405036", "0.51393753", "0.5137155", "0.5132578", "0.5113097", "0.5105429", "0.5102917", "0.5095155", "0.5093963", "0.5093727", "0.5091981", "0.50816715", "0.5078509", "0.50673056", "0.50551", "0.50492525", "0.5048943", "0.5047782", "0.50378484", "0.50370127", "0.5035583", "0.50257957", "0.5021858", "0.5021858", "0.501453", "0.50060946", "0.5001388", "0.49951455", "0.49840772", "0.49823874", "0.49715185", "0.49680257", "0.49634427", "0.49593982", "0.49590805", "0.49575737", "0.49550018", "0.49525213", "0.49514052" ]
0.6054309
11
rubocop:disable Metrics/AbcSize rubocop:disable Metrics/MethodLength
def draw puts " | |" puts " #{@squares[1]} | #{@squares[2]} | #{@squares[3]}" puts " | |" puts "-----+-----+-----" puts " | |" puts " #{@squares[4]} | #{@squares[5]} | #{@squares[6]}" puts " | |" puts "-----+-----+-----" puts " | |" puts " #{@squares[7]} | #{@squares[8]} | #{@squares[9]}" puts " | |" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def implementation; end", "def implementation; end", "def refutal()\n end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def schubert; end", "def strategy; end", "def used?; end", "def offences_by; end", "def custom; end", "def custom; end", "def suivre; end", "def isolated; end", "def isolated; end", "def private_method\n end", "def intensifier; end", "def spec; end", "def spec; end", "def internal; end", "def initialize\n\n end", "def initialize\n\n end", "def operations; end", "def operations; end", "def initialize\n \n end", "def initialize\n \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", "def initialize; end", "def initialize; end", "def initialize; end", "def missing; end", "def apply\n\t\t\n\tend", "def apply\n\t\t\n\tend", "def celebration; end", "def ignores; end", "def initialize\n super()\n end", "def initialize\n super\n end", "def initialize\n super\n end", "def initialize\n super\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n\t\t\n\tend", "def extra; end", "def initialize() end", "def villian; end", "def weber; end", "def apply\n end", "def executor; end", "def executor; end", "def executor; end", "def overrides; end", "def internship_passed; end", "def initialize\r\n\r\n end", "def initialize\n # nothing here for now\n end", "def anchored; 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 identify; end", "def ignore; end", "def who_we_are\r\n end", "def wrapper; end", "def missing?; end", "def requirements; end", "def requirements; end", "def requirements; end", "def requirements; end", "def init; end", "def init; end", "def init; end", "def init; end", "def processor; end", "def formation; end", "def same; end", "def operation; end", "def common\n \n end", "def sitemaps; end" ]
[ "0.7688308", "0.63501185", "0.63158923", "0.63158923", "0.62753135", "0.62092173", "0.62092173", "0.62092173", "0.62092173", "0.6173984", "0.6030169", "0.5963718", "0.5913621", "0.5882073", "0.5882073", "0.58618", "0.5853187", "0.5853187", "0.58392256", "0.579109", "0.5769591", "0.5769591", "0.57512623", "0.57423663", "0.57423663", "0.5740498", "0.5740498", "0.5732147", "0.5725376", "0.5716897", "0.5716897", "0.5716897", "0.5716897", "0.5716897", "0.5716897", "0.5716897", "0.5716897", "0.5716897", "0.5716897", "0.5716897", "0.5696534", "0.56719124", "0.56719124", "0.56703085", "0.5663176", "0.5653849", "0.56535083", "0.56535083", "0.56535083", "0.5633189", "0.5633189", "0.5633189", "0.5633189", "0.5633189", "0.5633189", "0.5633189", "0.5633189", "0.5633189", "0.5633189", "0.56271106", "0.5619856", "0.5617381", "0.5615263", "0.5597603", "0.5594719", "0.559014", "0.559014", "0.559014", "0.5586974", "0.5577081", "0.55690026", "0.5567593", "0.55642796", "0.5562134", "0.5562134", "0.5562134", "0.5562134", "0.5562134", "0.5562134", "0.5562134", "0.5562134", "0.5562134", "0.55564153", "0.5555076", "0.5553205", "0.55510765", "0.5550073", "0.5546505", "0.5546505", "0.5546505", "0.5546505", "0.55448616", "0.55448616", "0.55448616", "0.55448616", "0.5543262", "0.5540663", "0.55274475", "0.55250216", "0.55151474", "0.5513711" ]
0.0
-1
rubocop:enable Metrics/AbcSize rubocop:enable Metrics/MethodLength
def reset (1..9).each { |key| @squares[key] = Square.new } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def implementation; end", "def implementation; end", "def refutal()\n end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def schubert; end", "def used?; end", "def strategy; end", "def suivre; end", "def custom; end", "def custom; end", "def offences_by; end", "def isolated; end", "def isolated; end", "def intensifier; end", "def private_method\n end", "def operations; end", "def operations; end", "def internal; end", "def spec; end", "def spec; end", "def missing; end", "def celebration; end", "def apply\n\t\t\n\tend", "def apply\n\t\t\n\tend", "def who_we_are\r\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", "def initialize; end", "def initialize; end", "def initialize; end", "def extra; end", "def internship_passed; end", "def villian; end", "def anchored; end", "def formation; end", "def ignores; end", "def initialize\n\n end", "def initialize\n\n end", "def weber; end", "def initialize\n \n end", "def initialize\n \n end", "def same; end", "def identify; end", "def missing?; end", "def operation; end", "def apply\n end", "def requirements; end", "def requirements; end", "def requirements; end", "def requirements; end", "def processor; end", "def common\n \n end", "def executor; end", "def executor; end", "def executor; end", "def wrapper; end", "def initialize\n\t\t\n\tend", "def initialize() end", "def sitemaps; end", "def overrides; 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 initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def terpene; end", "def checks; end", "def appraisals; end", "def appraisals; end", "def initialize\n super()\n end", "def initialize\n super\n end", "def initialize\n super\n end", "def initialize\n super\n end", "def ignore; end", "def init; end", "def init; end" ]
[ "0.7739466", "0.6475757", "0.6350966", "0.6350966", "0.62901074", "0.6278411", "0.6278411", "0.6278411", "0.6278411", "0.62739927", "0.60279757", "0.5989889", "0.59686774", "0.5967138", "0.5967138", "0.5941473", "0.5891728", "0.5891728", "0.5874962", "0.58383375", "0.58337486", "0.58337486", "0.58235043", "0.57906264", "0.57906264", "0.5774391", "0.57231826", "0.57183814", "0.57183814", "0.571415", "0.57129", "0.57129", "0.57129", "0.57129", "0.57129", "0.57129", "0.57129", "0.57129", "0.57129", "0.57129", "0.57129", "0.57102454", "0.57034767", "0.5700867", "0.569677", "0.56954974", "0.56946933", "0.5688637", "0.5688637", "0.56819487", "0.5677899", "0.56461066", "0.5645715", "0.5644078", "0.5626016", "0.56176215", "0.56168294", "0.56069386", "0.56069386", "0.56069386", "0.56069386", "0.5604833", "0.56042355", "0.5593757", "0.5593757", "0.5593757", "0.5592536", "0.55913764", "0.55891263", "0.5586205", "0.5583339", "0.55814075", "0.55814075", "0.55814075", "0.55814075", "0.55814075", "0.55814075", "0.55814075", "0.55814075", "0.55814075", "0.55791163", "0.55791163", "0.55791163", "0.55791163", "0.55791163", "0.55791163", "0.55791163", "0.55791163", "0.55791163", "0.55791163", "0.55778134", "0.5567225", "0.55557823", "0.55557823", "0.5554004", "0.55528253", "0.55528253", "0.55528253", "0.5551285", "0.5549951", "0.5549951" ]
0.0
-1
the cache initializer, which uses this info).
def determine_revision # Note the revision number we're running, and a # more-informative string containing it. number = `git log -1`.split(' ')[1][0...8] rescue '???' details = "#{Rails.env} #{number} #{`hostname -f`.strip}" return number, details end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize\n @cache = {}\n end", "def _init_cache\n @cache_parent = {}\n end", "def initialize(cache)\n self.cache = cache\n end", "def initialize(cache = Global.cache)\n @cache = cache.new\n end", "def cache=(_arg0); end", "def cache=(_arg0); end", "def cache=(_arg0); end", "def cache=(_arg0); end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def initialize\n @cache_last_reset= Time.now\n\n @use_cache = false\n @cache_ttl = (5 * 60) # 5 mins\n\n @data_store = {}\n end", "def configure_cache; end", "def initialize(source , name , cache_entry)\n super(source)\n @name = name\n @cache_entry = cache_entry\n end", "def cache_store=(_arg0); end", "def cache_store=(_arg0); end", "def cache_store; end", "def cache_store; end", "def initialize_cache\n @elephant_cache = {}\n end", "def cache\n @__cache ||= Cache.new self\n end", "def initialize(hits,miss,entries,size)\n @cache_hits=hits\n @cache_miss=miss\n @cache_entries=entries\n @cache_size=size\n end", "def cache\n @cache ||= build_cache\n end", "def initialize(data)\n @data = data\n @cache_hit = nil\n end", "def initialize!\n @cache = JSON.load(File.read(cache_file)) rescue {}\n unless @cache.is_a?(Hash)\n $stderr.puts \"Warning: #{cache_file} was corrupt. Contents:\\n#{@cache.inspect}\"\n @cache = {}\n end\n @cache[\"targets\"] ||= {}\n @cache[\"directories\"] ||= {}\n @cache[\"configuration_data\"] ||= {}\n @lookup_checksums = {}\n end", "def initialize(size)\n\t\t@cache=Cache.new(size)\n\tend", "def set_cache(value); end", "def set_cache(value); end", "def singleton0_cache; end", "def singleton_cache; end", "def initialize\n @memory_store = ActiveSupport::Cache::MemoryStore.new\n end", "def initialize(cache_store)\n @cache_store = cache_store\n end", "def cache; shrine_class.new(cache_key); end", "def cache(data); end", "def cache!\n @@cache\n end", "def initialize(connection)\n @is_cached = false\n @connection = connection\n cache_list\n end", "def initialize(db)\n @db = db\n @opts = {}\n @cache_mutex = Mutex.new\n @cache = {}\n end", "def instance_cache; end", "def initialize(log, cache)\n @log, @cache = log, cache\n end", "def cache_on?; end", "def cache_on?; end", "def counter_cache=(_arg0); end", "def cache\n @cache ||= {}\n end", "def cache\n @cache ||= {}\n end", "def cache_dir=(_arg0); end", "def initialize(cache_dir, data)\n @cache_dir = Path.new(cache_dir)\n @data = data\n end", "def cache\n yield\n end", "def cached?; end", "def cache_info(info)\n @info = info\n end", "def cache\n @cache ||= {}\n end", "def initialize(finder)\n @finder = finder\n @cache = Gitlab::SafeRequestStore[CACHE_KEY] ||= initialize_cache\n end", "def cache\n @cache ||= Flareshow::Cache.new\n end", "def initialize cache = nil\n if cache.is_a? String\n @cache = FileCache.new(cache)\n elsif cache\n @cache = cache\n else\n @cache = NilCache.new\n end\n\n # initialize default #when_auth\n @get_auth_details = lambda do |abs_url, realm|\n if @user and @pass\n [@user, @pass]\n else\n nil\n end\n end\n end", "def update_cache\n # Does nothing...up to subclasses to implement.\n end", "def initialize_file_based_cache\n Dir.mkdir(\"cache\")\n @document_cache = ActiveSupport::Cache::FileStore.new(\"cache\")\n @file_based_cache = true\n end", "def load_cache\n @load_cache\n end", "def cached\n raise NotImplementedError\n end", "def cache\n @cache ||= {}\n end", "def cache\n @cache ||= {}\n end", "def cache_classes=(_arg0); end", "def cache_classes=(_arg0); end", "def use_cache(cache)\n @cache = cache\n end", "def cache\n DataCache\n end", "def initialize(cache_root, logger = nil)\n @cache_root = cache_root\n @logger = logger\n @cached_files = {}\n \n initialize_root\n \n super()\n end", "def cache\n @cache ||= MemoryCache.new\n end", "def make_cache\n if !@thread_safe \n @@c = {}\n elsif defined?(ThreadSafe)\n @@c = ThreadSafe::Hash.new\n else\n raise 'ThreadSafe is required to use the Memory cache.'\n end \n end", "def cache_fetch(*args)\n super { |key| @store[key] }\n end", "def cache\n @cache ||= ::Shopidav::Cache.new(site)\n end", "def initialize\n countries.each do |country|\n\t\t\tRails.cache.fetch(country[:code]) do\n\t\t\t\tJSON.parse(Net::HTTP.get(URI.parse(\"https://api.fitpass.mx/v3/cities.json?country=#{country[:code]}\")))\n\t\t\tend\n end\n\tend", "def initialize(id)\n @nhl_id = id\n @cache_file = \"cache/#{@nhl_id}.html\"\n @cahce_life = 24 * 60\n end", "def prepare\n namespace = @config[:namespace] || 'merb-cache'\n host = @config[:host] || '127.0.0.1:11211'\n @memcache = MemCache.new(host, {:namespace => namespace})\n @tracking_key = \"_#{namespace}_keys\" unless @config[:no_tracking]\n raise NotReady unless @memcache.active?\n true\n rescue NameError\n raise NotDefined\n end", "def disable_caching=(_arg0); end", "def cache\n @cache ||= Chef::Cache.new()\n end", "def init!\n unless(Thread.current[:sparkle_cache])\n Thread.current[:sparkle_cache] = {}\n end\n self\n end", "def initialize(cache_path = Chef::Config[:syntax_check_cache_path])\n @cache_path = cache_path\n @cache_path_created = false\n end", "def initialize(ttl=1.day, backup_rates_file_location = nil)\n @cache = CashHandler::Cache.new(ttl, backup_rates_file_location)\n end", "def initialize *args\n @max_load = $MAX_LOAD\n @max_object_size = $MAX_OBJECT_SIZE\n @current_load = 0\n @cache = Hash.new()\n @semaphor = Mutex.new()\n end", "def base_cache_manager\n @cache_manager ||= PublicEarth::Db::MemcacheManager.new\n end", "def cache\n @@_cache[self.class.name]\n end", "def initialize( organization, app_identifier, version )\n @organization, @app_identifier, @version = organization, app_identifier, version\n @cache = Cache.new\n end", "def initialize_memcache\n require 'memcache'\n memcache_options = {\n :c_threshold => 10_000,\n :compression => true,\n :debug => false,\n :namespace => 'backgroundrb_result_hash',\n :readonly => false,\n :urlencode => false\n }\n @cache = MemCache.new(memcache_options)\n @cache.servers = BackgrounDRb::BDRB_CONFIG[:memcache].split(',')\n end", "def initialize(cache, git_resolver)\n @git_resolver = git_resolver\n @constraints = []\n @cache = cache\n end", "def cache(new_cache = nil)\n @cache = new_cache if new_cache\n @cache\n end", "def cache\n @@cache ||= PStore.new(File.expand_path(@@cache_file))\n end", "def cache_size\n super\n end", "def initialize(cachedContentFile)\n #N Without this the name of the cached content file won't be remembered\n @cachedContentFile = cachedContentFile\n end", "def class_cache # :nodoc:\n end", "def class_cache # :nodoc:\n end", "def cached\n self\n end", "def initialize\n self.cache_ttl = 60\n self.api_path = 'https://api-pl.easypack24.net/v4/'\n end", "def initialize_cache( type=nil )\n case type\n when /memcache/\n servers = [\"localhost\"]\n opts = { :namespace => \"martsearch\", :no_reply => true }\n \n if self.config[\"cache\"][\"servers\"]\n servers = self.config[\"cache\"][\"servers\"]\n end\n \n if self.config[\"cache\"][\"namespace\"]\n opts[:namespace] = self.config[\"cache\"][\"namespace\"]\n end\n \n return ActiveSupport::Cache::MemCacheStore.new( servers, opts )\n when /file/\n file_store = \"#{File.dirname(__FILE__)}/../tmp/cache\"\n if self.config[\"cache\"][\"file_store\"]\n file_store = self.config[\"cache\"][\"file_store\"]\n end\n return ActiveSupport::Cache::FileStore.new( file_store )\n else\n return ActiveSupport::Cache::MemoryStore.new()\n end\n end", "def cache_value?; end", "def cache_dir; end", "def cache_dir; end", "def _cache_control; end", "def cache_for(expires, *args, &blk)\n @cache_data ||= CacheData.new\n @cache_data.value caller_locations(1,1)[0].label.to_sym, expires, args, &blk\n end", "def cache_key\n end", "def initialize(url, cache_size)\n @url = url\n end" ]
[ "0.7975239", "0.7903088", "0.78209746", "0.77808446", "0.7602022", "0.7602022", "0.7602022", "0.7602022", "0.748774", "0.748774", "0.748774", "0.748774", "0.748774", "0.748774", "0.748774", "0.7441652", "0.73994964", "0.725463", "0.72540873", "0.72540873", "0.72341764", "0.72341764", "0.72143316", "0.71729684", "0.71405077", "0.7121244", "0.7060471", "0.7056756", "0.7028556", "0.69889367", "0.69889367", "0.6985183", "0.6981874", "0.6969972", "0.69586134", "0.69559073", "0.69331783", "0.6908888", "0.68972176", "0.689006", "0.6877945", "0.6795891", "0.6779251", "0.6779251", "0.6746952", "0.67390525", "0.67390525", "0.6729775", "0.67207044", "0.67136407", "0.67110294", "0.6710517", "0.6687489", "0.668152", "0.66756076", "0.6658185", "0.6656228", "0.665497", "0.6651338", "0.6638129", "0.6627628", "0.6627628", "0.6614727", "0.6614727", "0.65850013", "0.657677", "0.65709144", "0.6570369", "0.65040547", "0.6502903", "0.6493436", "0.6488105", "0.6484705", "0.64825904", "0.6470462", "0.6468177", "0.64575326", "0.64266443", "0.6419819", "0.6416267", "0.6387933", "0.6383041", "0.6382144", "0.63726705", "0.6372515", "0.63631445", "0.6363007", "0.6362895", "0.6361322", "0.6358338", "0.6358338", "0.63306046", "0.6318214", "0.6315761", "0.6305805", "0.6304946", "0.6304946", "0.62982875", "0.62686825", "0.6260467", "0.6256823" ]
0.0
-1
used with Rails, takes an exception, controller, request and parameters creates an ExceptionData object
def handle(exception, controller, request, params, current_user = nil) Exceptional.log! "Handling #{exception.message}", 'info' begin e = parse(exception) # Additional data for Rails Exceptions e.framework = "rails" e.controller_name = controller.controller_name e.action_name = controller.action_name e.application_root = Exceptional.application_root? e.occurred_at = Time.now.strftime("%Y%m%d %H:%M:%S %Z") e.environment = request.env.to_hash e.url = "#{request.protocol}#{request.host}#{request.request_uri}" e.environment = safe_environment(request) e.session = safe_session(request.session) e.parameters = sanitize_hash(params.to_hash) # Add info about current user if configured to do so add_user_data(e, current_user) if(Exceptional.send_user_data? && !current_user.nil?) post(e) rescue Exception => exception Exceptional.log! "Error preparing exception data." Exceptional.log! exception.message Exceptional.log! exception.backtrace.join("\n"), 'debug' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle(exception, controller, request, params)\n log! \"Handling #{exception.message}\", 'info'\n e = parse(exception)\n # Additional data for Rails Exceptions\n e.framework = \"rails\"\n e.controller_name = controller.controller_name\n e.action_name = controller.action_name\n e.application_root = self.application_root\n e.occurred_at = Time.now.strftime(\"%Y%m%d %H:%M:%S %Z\")\n e.environment = request.env.to_hash\n e.url = \"#{request.protocol}#{request.host}#{request.request_uri}\"\n # Need to remove rack data from environment hash\n safe_environment = request.env.to_hash\n safe_environment.delete_if { |k,v| k =~ /rack/ }\n e.environment = safe_environment\n \n safe_session = {}\n request.session.instance_variables.each do |v|\n next if v =~ /cgi/\n next if v =~ /db/\n # remove prepended @'s\n var = v.sub(\"@\",\"\")\n safe_session[var] = request.session.instance_variable_get(v)\n end\n \n e.session = safe_session\n e.parameters = params.to_hash\n\n if mode == :queue\n worker.add_exception(e)\n else # :direct mode\n begin\n post e\n rescue Exception => exception\n log! \"Error posting data to Exceptional.\"\n log! exception.message\n log! exception.backtrace.join(\"\\n\"), 'debug'\n end\n end\n end", "def exception_data\n exception_service.merge(\n error_class: @exception.class.to_s,\n message: @exception.respond_to?(:message) ? @exception.message : exception.inspect,\n backtrace: @exception.respond_to?(:backtrace) ? (@exception.backtrace || []).join(\"\\n\") : nil,\n cause: @exception.respond_to?(:cause) ? @exception.cause : nil\n )\n end", "def process_exception(exception)\n exception_data = {\n :exception =>\n { :class => exception.class,\n :message => exception.message,\n :backtrace => exception.backtrace.map { |l| \"\\t#{l}\" }.join(\"\\n\")\n }\n }\n end", "def exception_with_data(e, code, msg, data = {})\n\n OstKycSdkRuby::Util::Result.exception(\n e, {\n error: code,\n error_message: msg,\n data: data\n }\n )\n\n end", "def post(exception_data)\n hash = exception_data.to_hash\n if hash[:session]\n hash[:session].delete(\"initialization_options\")\n hash[:session].delete(\"request\")\n end\n\n Exceptional.post_exception(hash.to_json)\n end", "def post(exception_data)\n hash = exception_data.to_hash\n hash[:session].delete(\"initialization_options\")\n hash[:session].delete(\"request\")\n call_remote(:errors, hash.to_json)\n end", "def enter_exception_context(exception); end", "def hubssolib_set_exception_data(e)\n HubSsoLib::Crypto.encode_object(e.message, request.remote_ip)\n end", "def parse(exception)\n exception_data = ExceptionData.new\n exception_data.exception_backtrace = exception.backtrace\n exception_data.exception_message = exception.message\n exception_data.exception_class = exception.class.to_s\n exception_data\n end", "def exception(params)\n update_attributes(\n {\n :res_message => \"Exception\",\n :status => 'EXCEPTION'\n }.merge(params)\n )\n end", "def catch(exception)\n exception_data = parse(exception)\n exception_data.controller_name = File.basename($0)\n post(exception_data)\n end", "def hubssolib_get_exception_data(data)\n HubSsoLib::Crypto.decode_object(data, request.remote_ip)\n end", "def exception\n request.env['action_dispatch.exception']\n end", "def serve_exception(_exception); end", "def dispatch_exception(request, response, exception)\n klass = Exceptions rescue Controller\n request.params[:original_params] = request.params.dup rescue {}\n request.params[:original_session] = request.session.dup rescue {}\n request.params[:original_cookies] = request.cookies.dup rescue {}\n request.params[:exception] = exception\n request.params[:action] = exception.name\n dispatch_action(klass, exception.name, request, response, exception.class::STATUS)\n rescue => dispatch_issue\n dispatch_issue = controller_exception(dispatch_issue) \n # when no action/template exist for an exception, or an\n # exception occurs on an InternalServerError the message is\n # rendered as simple text.\n # ControllerExceptions raised from exception actions are \n # dispatched back into the Exceptions controller\n if dispatch_issue.is_a?(ControllerExceptions::NotFound)\n dispatch_default_exception(klass, request, response, exception)\n elsif dispatch_issue.is_a?(ControllerExceptions::InternalServerError)\n dispatch_default_exception(klass, request, response, dispatch_issue)\n else\n exception = dispatch_issue\n retry\n end\n end", "def create\n @trace_exception = TraceException.new(trace_exception_params)\n\n respond_to do |format|\n if @trace_exception.save\n format.html { redirect_to @trace_exception, notice: 'Trace exception was successfully created.' }\n format.json { render :show, status: :created, location: @trace_exception }\n else\n format.html { render :new }\n format.json { render json: @trace_exception.errors, status: :unprocessable_entity }\n end\n end\n end", "def POST\r\n@env[\"action_dispatch.request.request_parameters\"] ||= (normalize_encode_params(super) || {})\r\nrescue TypeError => e\r\nraise ActionController::BadRequest.new(:request, e)\r\nend", "def exception_context(exception)\n context(:exception => exception.class.to_s)\n end", "def exception\n @context[:exception]\n end", "def extract_information_from(env)\n exception = env['action_dispatch.exception']\n exception_wrapper = ActionDispatch::ExceptionWrapper.new(env, exception)\n @rescue_response = ActionDispatch::ExceptionWrapper.rescue_responses[exception.class.name]\n @message = exception.message\n @status_code = exception_wrapper.status_code\n end", "def handle_request_error(exception)\n end", "def exceptions_app=(_arg0); end", "def exceptions_app=(_arg0); end", "def render_error(exception)\n # use the exception_notifier gem to send out an e-mail\n # to the notification list specified in config/environment.rb\n ExceptionNotifier.notify_exception(exception, env: request.env,\n data: {\n user: current_user,\n course: @course,\n assessment: @assessment,\n submission: @submission\n })\n\n respond_to do |format|\n format.html do\n # stack traces are only shown to instructors and administrators\n # by leaving @error undefined, students and CAs do not see stack traces\n if !current_user.nil? && (current_user.instructor? || current_user.administrator?)\n @error = exception\n\n # Generate course id and assessment id objects\n @course_name = params[:course_name] ||\n (params[:controller] == \"courses\" ? params[:name] : nil)\n if @course_name\n @assessment_name = params[:assessment_name] ||\n (params[:controller] == \"assessments\" ? params[:name] : nil)\n\n end\n end\n\n render \"home/error_500\"\n end\n format.json { head :internal_server_error }\n format.js { head :internal_server_error }\n end\n end", "def handle_exception(exception, options = {})\n request = options[:request]\n render_errors = options[:render_errors] || false\n proc_name = options[:proc_name] || config[:app_name]\n error_messages = options[:error_messages] || ['']\n\n error_messages = [error_messages] unless error_messages.is_a?(Array)\n\n if exception.respond_to?(:backtrace)\n backtrace = exception.backtrace\n else\n backtrace = caller\n end\n\n # extract the relevant request data and also filter out any params\n # that should NOT be logged/emailed (passwords etc.)\n request_data = request_data_from_request(request) unless request.nil?\n\n supplementary_info = nil\n\n unless config[:call_for_supplementary_info].nil?\n supplementary_info = config[:call_for_supplementary_info].call(request)\n supplementary_info = [supplementary_info] unless supplementary_info.is_a?(Array)\n end\n\n unless supplementary_info.blank?\n error_messages << \"Supplementary info:\"\n error_messages += supplementary_info\n end\n\n if exception.nil?\n exception_classname = nil\n status_code = nil\n log_error error_messages.inspect\n log_error backtrace\n log_error \"Request params were:\"\n log_error request_data.to_yaml\n error_string = error_messages.shift\n else\n status_code =\n Wrangler::ExceptionHandler.status_code_for_exception(exception)\n\n log_exception(exception, request_data, status_code, error_messages)\n\n if exception.is_a?(Class)\n exception_classname = exception.name\n else\n exception_classname = exception.class.name\n end\n\n if exception.respond_to?(:message)\n error_string = exception.message\n else\n error_string = exception.to_s\n end\n end\n\n if send_notification?(exception, request, status_code)\n if notify_with_delayed_job?\n # don't pass in request as it contains not-easily-serializable stuff\n log_error \"Wrangler sending email notification asynchronously\"\n Wrangler::ExceptionNotifier.send_later(:deliver_exception_notification,\n exception_classname,\n error_string,\n error_messages,\n proc_name,\n backtrace,\n supplementary_info,\n status_code,\n request_data)\n else\n log_error \"Wrangler sending email notification synchronously\"\n Wrangler::ExceptionNotifier.deliver_exception_notification(exception_classname,\n error_string,\n error_messages,\n proc_name,\n backtrace,\n supplementary_info,\n status_code,\n request_data,\n request)\n end\n end\n\n if render_errors\n render_error_template(exception, status_code)\n end\n\n rescue Exception => unhandled_exception\n # if it looks like a temporary error interacting with SMTP, then enqueue\n # the error using delayed job if possible\n # (testing by name this way in case the exception isn't loaded into\n # environment, which would cause a NameError and be counterproductive...)\n if unhandled_exception.class.name == 'Net::SMTPAuthenticationError' &&\n Wrangler::ExceptionNotifier.respond_to?(:send_later)\n\n log_error \"Wrangler failed to send error notification: #{unhandled_exception.class.name}:\"\n log_error \" #{unhandled_exception.to_s}\"\n\n # note: this is specific to an old-ish version of delayed job...should\n # make wrangler compatible with the old and the new...\n log_error \"Wrangler attempting to send via delayed job\"\n Wrangler::ExceptionNotifier.send_later(:deliver_exception_notification,\n exception_classname,\n error_string,\n error_messages,\n proc_name,\n backtrace,\n supplementary_info,\n status_code,\n request_data)\n else\n log_error \"/!\\\\ FAILSAFE /!\\\\ Wrangler encountered an unhandled exception \" +\n \"while trying to handle an error. The arguments it received \" +\n \"were:\"\n log_error \" exception: #{exception.inspect}\"\n log_error \" options: #{options.inspect}\"\n log_error \"The unhandled error encountered was #{unhandled_exception.class.name}:\"\n log_error \" #{unhandled_exception.to_s}\"\n end\n end", "def trace_exception_params\n params.require(:trace_exception).permit(:message, :trace, :instance_variables, :instance_variable_names, :rack_session, :request_method, :query_hash, :request_params, :query_params, :path, :env)\n end", "def create\n @daily_data_delivery_exception = DailyDataDeliveryException.new(params[:daily_data_delivery_exception])\n\n respond_to do |format|\n if @daily_data_delivery_exception.save\n format.html { redirect_to @daily_data_delivery_exception, notice: 'Daily data delivery exception was successfully created.' }\n format.json { render json: @daily_data_delivery_exception, status: :created, location: @daily_data_delivery_exception }\n else\n format.html { render action: \"new\" }\n format.json { render json: @daily_data_delivery_exception.errors, status: :unprocessable_entity }\n end\n end\n end", "def render_exception(ex)\n error_code = ex.respond_to?(:code) ? ex.code : 1\n message = ex.message\n internal_error = true\n field = ex.respond_to?(:field) ? ex.field : nil\n\n case ex\n when OpenShift::ValidationException\n return render_error(:unprocessable_entity, nil, nil, nil, nil, get_error_messages(ex.resource))\n\n when Mongoid::Errors::Validations\n field_map =\n case ex.document\n when Domain then requested_api_version <= 1.5 ? {\"namespace\" => \"id\"} : {\"namespace\" => \"name\"}\n end\n messages = get_error_messages(ex.document, field_map || {})\n return render_error(:unprocessable_entity, nil, nil, nil, nil, messages)\n\n when Mongoid::Errors::InvalidFind\n status = :not_found\n message = \"No resource was requested.\"\n internal_error = false\n\n when Mongoid::Errors::DocumentNotFound\n status = :not_found\n model = ex.klass\n\n target =\n if ComponentInstance >= model then target = 'Cartridge'\n elsif CartridgeInstance >= model then target = 'Cartridge'\n elsif CartridgeType >= model then target = 'Cartridge'\n elsif GroupInstance >= model then target = 'Gear group'\n else model.to_s.underscore.humanize\n end\n\n message =\n if ex.unmatched.length > 1\n \"The #{target.pluralize.downcase} with ids #{ex.unmatched.map{ |id| \"'#{id}'\"}.join(', ')} were not found.\"\n elsif ex.unmatched.length == 1\n \"#{target} '#{ex.unmatched.first}' not found.\"\n else\n if name = (\n (Domain >= model and ex.params[:canonical_namespace].presence) or\n (Application >= model and ex.params[:canonical_name].presence) or\n (ComponentInstance >= model and ex.params[:cartridge_name].presence) or\n (CartridgeInstance >= model and ex.params[:name].presence) or\n (CartridgeType >= model and ex.params[:name].presence) or\n (Alias >= model and ex.params[:fqdn].presence) or\n (CloudUser >= model and ex.params[:login].presence) or\n (CloudUser >= model and ex.params[:_id].presence) or\n (SshKey >= model and ex.params[:name].presence)\n )\n \"#{target} '#{name}' not found.\"\n else\n \"The requested #{target.downcase} was not found.\"\n end\n end\n error_code =\n if Cartridge >= model then 129\n elsif ComponentInstance >= model then 129\n elsif SshKey >= model then 118\n elsif GroupInstance >= model then 101\n elsif Authorization >= model then 129\n elsif Domain >= model then 127\n elsif Alias >= model then 173\n elsif Application >= model then 101\n else error_code\n end\n internal_error = false\n\n when OpenShift::UserException\n status = ex.response_code || :unprocessable_entity\n error_code, node_message, messages = extract_node_messages(ex, error_code, message, field)\n message = node_message || \"Unable to complete the requested operation. \\nReference ID: #{request.uuid}\"\n messages.push(Message.new(:error, message, error_code, field))\n return render_error(status, message, error_code, field, nil, messages, false)\n\n when OpenShift::AccessDeniedException\n status = :forbidden\n internal_error = false\n\n when OpenShift::AuthServiceException\n status = :internal_server_error\n message = \"Unable to authenticate the user. Please try again and contact support if the issue persists. \\nReference ID: #{request.uuid}\"\n\n when OpenShift::DNSException, OpenShift::DNSLoginException\n status = :internal_server_error\n\n when OpenShift::LockUnavailableException\n status = :internal_server_error\n message ||= \"Another operation is already in progress. Please try again in a minute.\"\n internal_error = false\n\n when OpenShift::NodeUnavailableException\n Rails.logger.error \"Got Node Unavailable Exception\"\n status = :internal_server_error\n message = \"\"\n if ex.resultIO\n error_code = ex.resultIO.exitcode\n message = ex.resultIO.errorIO.string.strip + \"\\n\" unless ex.resultIO.errorIO.string.empty?\n Rail.logger.error \"message: #{message}\"\n end\n message ||= \"\"\n message += \"Unable to complete the requested operation due to: #{ex.message}. Please try again and contact support if the issue persists. \\nReference ID: #{request.uuid}\"\n\n when OpenShift::ApplicationOperationFailed\n status = :internal_server_error\n error_code, node_message, messages = extract_node_messages(ex, error_code, message, field)\n messages.push(Message.new(:error, node_message, error_code, field)) unless node_message.blank?\n message = \"#{message}\\nReference ID: #{request.uuid}\"\n return render_error(status, message, error_code, field, nil, messages, internal_error)\n\n when OpenShift::NodeException, OpenShift::OOException\n status = :internal_server_error\n error_code, message, messages = extract_node_messages(ex, error_code, message, field)\n message ||= \"unknown error\"\n message = \"Unable to complete the requested operation due to: #{message}\\nReference ID: #{request.uuid}\"\n\n # just trying to make sure that the error message is the last one to be added\n messages.push(Message.new(:error, message, error_code, field))\n\n return render_error(status, message, error_code, field, nil, messages, internal_error)\n else\n status = :internal_server_error\n message = \"Unable to complete the requested operation due to: #{message}\\nReference ID: #{request.uuid}\"\n end\n\n Rails.logger.error \"Reference ID: #{request.uuid} - #{ex.message}\\n #{ex.backtrace.join(\"\\n \")}\" if internal_error\n\n render_error(status, message, error_code, field, nil, nil, internal_error)\n end", "def exception_data(deliverer = nil)\n if deliverer\n write_inheritable_attribute(:exception_data, deliverer)\n else\n read_inheritable_attribute(:exception_data)\n end\n end", "def exception_data(deliverer = nil)\n if deliverer\n write_inheritable_attribute(:exception_data, deliverer)\n else\n read_inheritable_attribute(:exception_data)\n end\n end", "def define_exception_handler(data)\n exception_handler.merge!(data)\n end", "def handle_exception(data)\n logger.warn \"Got exception from remote call of #{data[\"action\"]}: #{data[\"message\"]}\"\n end", "def handle_exception(e, env)\n trace = e.backtrace.join \"\\n\"\n Tom::Log.logger.info e\n Tom::Log.logger.info trace\n [500, {}, {error: e,\n stacktrace: trace,\n url: env[\"REQUEST_URI\"]\n }.to_json]\n end", "def create\n @claim_validation_exception = ClaimValidationException.new(params[:claim_validation_exception])\n\n respond_to do |format|\n if @claim_validation_exception.save\n format.html { redirect_to @claim_validation_exception, notice: 'Claim validation exception was successfully created.' }\n format.json { render json: @claim_validation_exception, status: :created, location: @claim_validation_exception }\n else\n format.html { render action: \"new\" }\n format.json { render json: @claim_validation_exception.errors, status: :unprocessable_entity }\n end\n end\n end", "def dispatch_default_exception(klass, request, response, e)\n controller = klass.build(request, response, e.class::STATUS)\n if e.is_a? ControllerExceptions::Redirection\n controller.headers.merge!('Location' => e.message)\n controller.instance_variable_set(\"@_body\", %{ }) #fix\n else\n @exception = e # for ERB\n controller.instance_variable_set(\"@_body\", DEFAULT_ERROR_TEMPLATE.result(binding))\n end\n [controller, e.name]\n end", "def exception(*rest) end", "def exception(exception, status)\n @current_step[:exception] = build_exception_detail(exception)\n end", "def my_rescue_action_in_public(exception)\n # MorLog.my_debug exception.to_yaml\n # MorLog.my_debug exception.backtrace.to_yaml\n time = Time.now()\n id = time.strftime(\"%Y%m%d%H%M%S\")\n address = '[email protected]'\n extra_info = \"\"\n swap = nil\n begin\n MorLog.my_debug(\"Rescuing exception: #{exception.class.to_s} controller: #{params[:controller].to_s}, action: #{params[:action].to_s}\", true)\n if important_exception(exception)\n MorLog.my_debug(\" >> Exception is important\", true)\n MorLog.log_exception(exception, id, params[:controller].to_s, params[:action].to_s) if params[:do_not_log_test_exception].to_i == 0\n\n trace = exception.backtrace.collect { |t| t.to_s }.join(\"\\n\")\n\n exception_class = escape_for_email(exception.class).to_s\n exception_class_previous = Confline.get_value(\"Last_Crash_Exception_Class\", 0).to_s\n exception_send_email = Confline.get_value(\"Exception_Send_Email\").to_i\n\n # Lots of duplication but this is due fact that in future there may be\n # need for separate link for every error.\n flash_help_link = nil\n\n\n if exception_class.include?(\"Net::SMTPFatalError\")\n flash_notice = _('smtp_server_error')\n flash_help_link = \"\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'smtp_server_error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Errno::ENETUNREACH\")\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_Errno::ENETUNREACH\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Errno::EACCES\")\n flash_notice = _('File_permission_error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'File_permission_error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Errno::EHOSTUNREACH\") or (exception_class.include?(\"Errno::ECONNREFUSED\") and trace.to_s.include?(\"rami.rb:380\"))\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_SystemExit\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"SystemExit\") or (exception_class.include?('RuntimeError') and (exception.message.include?('No route to host') or exception.message.include?('getaddrinfo: Name or service not known') or exception.message.include?('Connection refused')))\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_SystemExit\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n end\n\n if exception_class.include?('RuntimeError') and (exception.message.include?('Connection timed out') or exception.message.include?('Invalid argument') or exception.message.include?('Connection reset by peer') or exception.message.include?('Network is unreachable') or exception.message.include?('exit'))\n flash_notice = _('Your_Asterisk_server_is_not_accessible_Please_check_if_address_entered_is_valid_and_network_is_OK')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n exception_send_email = 0\n end\n\n if exception_class.include?(\"SocketError\") and !trace.to_s.include?(\"smtp_tls.rb\")\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_SystemExit\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n end\n if exception_class.include?(\"Errno::ETIMEDOUT\")\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_SystemExit\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n exception_send_email = 0\n end\n\n if exception_class.include?(\"OpenSSL::SSL::SSLError\") or exception_class.include?(\"OpenSSL::SSL\")\n flash_notice = _('Verify_mail_server_details_or_try_alternative_smtp_server')\n flash_help_link = ''\n exception_send_email = 0\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'SMTP_connection_error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"ActiveRecord::RecordNotFound\")\n flash_notice = _('Data_not_found')\n flash_help_link = ''\n exception_send_email = 1\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Data_not_found', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"ActiveRecord::StatementInvalid\") and exception.message.include?('Access denied for user')\n flash_notice = _('MySQL_permission_problem_contact_Kolmisoft_to_solve_it')\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'MySQL_permission_problem', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Transactions::TransactionError\")\n flash_notice = _(\"Transaction_error\")\n swap = []\n swap << %x[vmstat]\n # swap << ActiveRecord::Base.connection.select_all(\"SHOW INNODB STATUS;\")\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Transaction_errors', :data2 => exception.message).save\n exception_send_email = 0\n end\n\n if exception_class.include?(\"Errno::ENOENT\") and exception.message.include?('/tmp/mor_debug_backup.txt')\n flash_notice = _('Backup_file_not_found')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Backup_file_not_found', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"GoogleCheckoutError\") and exception.message.include?(\"No seller found with id\")\n flash_notice = _('Internal_Error_Contact_Administrator')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n # database not updated\n if exception_class.include?(\"NoMethodError\") and !exception.message.include?(\"nil:NilClass\") and exception.message.include?(\"for #<\")\n flash_notice = _('Database_Error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Database_Error', :data2 => exception.message).save\n end\n if exception_class.include? \"ActiveModel::MissingAttributeError\"\n flash_notice = _('Database_Error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Database_Error', :data2 => exception.message).save\n end\n if exception_class.include?(\"ActiveRecord::StatementInvalid\") and exception.message.include?(\"Unknown column\")\n flash_notice = _('Database_Error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Database_Error', :data2 => exception.message).save\n end\n #\n\n if exception_class.include?(\"GoogleCheckoutError\") and exception.message.include?(\"The currency used in the cart must match the currency of the seller account.\")\n flash_notice = _('Internal_Error_Contact_Administrator')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Google4R\") and exception.message.include?(\"Missing URL component: expected id:\")\n flash_notice = _('Internal_Error_Contact_Administrator')\n flash_help_link = ''\n exception_send_email = 0\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Google4R\") and exception.message.include?('expected id: (\\d{10})|(\\d{15})')\n flash_notice = _(\"Payment_Error_Contact_Administrator_enter_merchant_id\")\n flash_help_link = ''\n exception_send_email = 0\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Google4R\") and exception.message.include?('Seller Account') and exception.message.include?('is not active.')\n flash_notice = _(\"Payment_Error_Contact_Administrator_account_not_active\")\n flash_help_link = ''\n exception_send_email = 0\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception.message.include?('Unexpected response code')\n flash_notice = _(\"Google_checkout_error\") + ': ' + exception.message.to_s #.gsub('Google Unexpected response code', 'Unexpected response code')\n flash_help_link = ''\n exception_send_email = 0\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception.message.include?('An API Certificate or API Signature is required to make requests to PayPal')\n flash_notice = _('An_API_Certificate_or_API_Signature_is_required_to_make_requests_to_PayPal')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception.message.include?('Temporary failure in name resolution')\n flash_notice = _('DNS_Error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'DNS_Error', :data2 => exception.message).save\n end\n\n if exception.message.include?('Ambethia::ReCaptcha::Controller::RecaptchaError')\n flash_notice = _('ReCaptcha_Error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'ReCaptcha_Error', :data2 => exception.message).save\n end\n\n #if exception_class.include?(\"Net::SMTP\") or (exception_class.include?(\"Errno::ECONNREFUSED\") and trace.to_s.include?(\"smtp_tls.rb\")) or (exception_class.include?(\"SocketError\") and trace.to_s.include?(\"smtp_tls.rb\")) or ((exception_class.include?(\"Timeout::Error\") and trace.to_s.include?(\"smtp.rb\"))) or trace.to_s.include?(\"smtp.rb\")\n flash_help_link = email_exceptions(exception) if flash_help_link.blank? and flash_notice.blank?\n #end\n\n if exception_class.include?(\"LoadError\") and exception.message.to_s.include?('locations or via rubygems.')\n if exception.message.include?('cairo')\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/Cannot_generate_PDF\"\n else\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_Ruby_Gems\"\n end\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Ruby_gems_not_found', :data2 => exception.message).save\n exception_send_email = 0\n end\n\n # Specific case for acunetix security scanner\n if (exception.message.include?('invalid byte sequence in UTF-8') or exception.message.include?('{\"$acunetix\"=>\"1\"}')) and ['try_to_login', 'signup_end'].member?(params[:action])\n flash_notice = _('Internal_Error_Contact_Administrator')\n exception_send_email = 0\n end\n\n if exception_send_email == 1 and exception_class != exception_class_previous and !flash_help_link or params[:this_is_fake_exception].to_s == \"YES\"\n MorLog.my_debug(\" >> Need to send email\", true)\n\n if exception_class.include?(\"NoMemoryError\")\n extra_info = get_memory_info\n MorLog.my_debug(extra_info)\n end\n\n # Gather all exception\n rep, rev, status = get_svn_info\n rp = []\n (params.each { |k, v| rp << [\"#{k} => #{v}\"] })\n\n message = [\n \"ID: #{id.to_s}\",\n \"IP: #{request.env['SERVER_ADDR']}\",\n \"Class: #{exception_class}\",\n \"Message: #{exception}\",\n \"Controller: #{params[:controller]}\",\n \"Action: #{params[:action]}\",\n \"User ID: #{session ? session[:user_id].to_i : 'possible_from_api'}\",\n \"----------------------------------------\",\n \"Repositority: #{rep}\",\n \"Revision: [#{rev}]\",\n \"Local version modified: #{status}\",\n \"----------------------------------------\",\n\n \"Request params: \\n#{rp.join(\"\\n\")}\",\n \"----------------------------------------\",\n \"Seesion params: \\n#{nice_session if session}\",\n \"----------------------------------------\"\n ]\n if extra_info.length > 0\n message << \"----------------------------------------\"\n message << extra_info\n message << \"----------------------------------------\"\n end\n message << \"#{trace}\"\n\n if test_machine_active?\n if File.exists?('/var/log/mor/test_system')\n message << \"----------------------------------------\"\n message << %x[tail -n 50 /var/log/mor/test_system]\n end\n end\n\n if swap\n message << \"----------------------------------------\"\n message << swap.to_yaml\n end\n\n if exception_class.include?(\"Errno::EPERM\")\n message << \"----------------------------------------\"\n message << %x[ls -la /home/mor/tmp/]\n message << \"----------------------------------------\"\n message << %x[ls -la /home/mor/]\n end\n\n Confline.set_value(\"Last_Crash_Exception_Class\", exception_class, 0)\n\n if params[:this_is_fake_exception].to_s == \"YES\"\n MorLog.my_debug(' >> Crash email NOT sent THIS IS JUST TEST', true)\n return :text => flash_notice.to_s + flash_help_link.to_s + message.join(\"\\n\")\n #render :text => message.join(\"\\n\") and return false\n else\n\n subject = \"#{ExceptionNotifier_email_prefix} Exception. ID: #{id.to_s}\"\n time = Confline.get_value(\"Last_Crash_Exception_Time\", 0)\n if time and !time.blank? and (Time.now - Time.parse(time)) < 1.minute\n MorLog.my_debug(\"Crash email NOT sent : Time.now #{Time.now.to_s(:db)} - Last_Crash_Exception_Time #{time}\")\n else\n send_crash_email(address, subject, message.join(\"\\n\")) if params[:do_not_log_test_exception].to_i == 0\n Confline.set_value(\"Last_Crash_Exception_Time\", Time.now.to_s(:db), 0)\n MorLog.my_debug('Crash email sent')\n end\n end\n else\n MorLog.my_debug(\" >> Do not send email because:\", true)\n MorLog.my_debug(\" >> Email should not be sent. Confline::Exception_Send_Email: #{exception_send_email.to_s}\", true) if exception_send_email != 1\n MorLog.my_debug(\" >> The same exception twice. Last exception: #{exception_class.to_s}\", true) if exception_class == exception_class_previous\n MorLog.my_debug(\" >> Contained explanation. Flash: #{ flash_help_link}\", true) if flash_help_link\n end\n\n if !flash_help_link.blank?\n flash[:notice] = _('Something_is_wrong_please_consult_help_link')\n flash[:notice] += \"<a id='exception_info_link' href='#{flash_help_link}' target='_blank'><img alt='Help' src='#{Web_Dir}/assets/icons/help.png' title='#{_('Help')}' /></a>\".html_safe\n else\n flash[:notice] = flash_notice.to_s.blank? ? \"INTERNAL ERROR. - ID: #{id} - #{exception_class}\" : flash_notice\n end\n\n if session and session[:forgot_pasword] == 1\n session[:forgot_pasword] = 0\n flash[:notice_forgot]= (_('Cannot_change_password') + \"<br />\" + _('Email_not_sent_because_bad_system_configurations')).html_safe\n end\n\n if session and session[:flash_not_redirect].to_i == 0\n #redirect_to Web_Dir + \"/callc/main\" and return false\n else\n session[:flash_not_redirect] = 0 if session\n #render(:layout => \"layouts/mor_min\") and return false\n end\n end\n rescue Exception => e\n MorLog.log_exception(e, id, params[:controller].to_s, params[:action].to_s)\n message =\"Exception in exception at: #{escape_for_email(request.env['SERVER_ADDR'])} \\n --------------------------------------------------------------- \\n #{escape_for_email(%x[tail -n 50 /var/log/mor/test_system])}\"\n command = ApplicationController::send_email_dry(\"[email protected]\", address, message, \"#{ExceptionNotifier_email_prefix} SERIOUS EXCEPTION\", \"-o tls='auto'\")\n system(command)\n flash[:notice] = \"INTERNAL ERROR.\"\n #redirect_to Web_Dir + \"/callc/main\" and return false\n end\n end", "def exception_class; end", "def processerror(exception)\n case exception\n\n when RestClient::NotAcceptable #406\n raise RequestFailureException, \"Request failure\"\n when RestClient::Unauthorized #401\n raise RequestFailureException, \"Unauthorized access\"\n when RestClient::ResourceNotFound #404\n raise RequestFailureException, \"Incorrect request parameters. Check your url and the input xml\"\n when RestClient::InsufficientStorage # 507\n raise RequestFailureException, \"Account is full.User cannot make any more requests\"\n when RestClient::ServiceUnavailable # 503 => 'Service Unavailable',\n raise RequestFailureException, \"Your API has been throttled for now. Please try again later\"\n\n when ArgumentError\n raise exception\n\n else\n puts exception.message\n raise UnhandledException\n\n\n end\n\n end", "def rescue_from(exception); end", "def exception_details(e, msg); end", "def original_exception=(_arg0); end", "def exception\n\t\t@exception\n\tend", "def wrapped_exception; end", "def process_action(*args)\n super\n rescue ActionDispatch::Http::Parameters::ParseError => exception\n json_response(nil ,400, :bad_request)\n end", "def exception_with_internal_code(e, code, msg, internal_code, data = {})\n\n Result::Base.exception(\n e, {\n error: code,\n error_message: msg,\n data: data,\n http_code: internal_code\n }\n )\n end", "def exceptions_app; end", "def exceptions_app; end", "def create\n @throwable = Throwable.new(throwable_params)\n\n respond_to do |format|\n if @throwable.save\n format.html { redirect_to @throwable, notice: 'Throwable was successfully created.' }\n format.json { render :show, status: :created, location: @throwable }\n else\n format.html { render :new }\n format.json { render json: @throwable.errors, status: :unprocessable_entity }\n end\n end\n end", "def exception_handler(ex)\n \nend", "def handle_exception(exception)\n end", "def vuln_exception_create(input)\n options = {}\n\n if input.nil?\n raise ArgumentError.new 'The input element cannot be null'\n end\n\n vuln_id = input[:vuln_id]\n unless vuln_id\n raise ArgumentError.new 'The vulnerability ID is required'\n end\n options['vuln-id'] = vuln_id\n\n reason = input[:reason]\n if reason.nil? || reason.empty?\n raise ArgumentError.new 'The reason is required'\n end\n\n unless reason =~ /False Positive|Compensating Control|Acceptable Use|Acceptable Risk|Other/\n raise ArgumentError.new 'The reason type is invalid'\n end\n options['reason'] = reason\n\n scope = input[:scope]\n if scope.nil? || scope.empty?\n raise ArgumentError.new 'The scope is required'\n end\n\n # For scope case matters.\n unless scope =~ /All Instances|All Instances on a Specific Asset|Specific Instance of Specific Asset/\n raise ArgumentError.new 'The scope type is invalid'\n end\n\n if scope =~ /All Instances on a Specific Asset|Specific Instance of Specific Asset/\n device_id = input[:device_id]\n vuln_key = input[:vuln_key]\n port = input[:port]\n if device_id\n options['device-id'] = device_id\n end\n\n if scope =~ /All Instances on a Specific Asset/ && (vuln_key || port)\n raise ArgumentError.new 'Vulnerability key or port cannot be used with the scope specified'\n end\n\n if vuln_key\n options['vuln-key'] = vuln_key\n end\n\n if port\n options['port-no'] = port\n end\n end\n options['scope'] = scope\n\n xml = make_xml('VulnerabilityExceptionCreateRequest', options)\n\n comment = input[:comment]\n if comment && !comment.empty?\n comment_xml = make_xml('comment', {}, comment, false)\n xml.add_element comment_xml\n else\n raise ArgumentError.new 'The comment cannot be empty'\n end\n\n r = execute xml, '1.2'\n if r.success\n r.res.elements.each('//VulnerabilityExceptionCreateResponse') do |vecr|\n return vecr.attributes['exception-id']\n end\n else\n false\n end\n end", "def pass_exception\n throw :next_exception_handler\n end", "def log_exception(exception, request_data = nil,\n status_code = nil, error_messages = nil)\n msgs = []\n msgs << \"An exception was caught (#{exception.class.name}):\"\n\n if exception.respond_to?(:message)\n msgs << exception.message\n else\n msgs << exception.to_s\n end\n\n if error_messages.is_a?(Array)\n msgs.concat error_messages\n elsif !error_messages.nil? && !error_messages.empty?\n msgs << error_messages\n end\n\n unless request_data.blank?\n msgs << \"Request params were:\"\n msgs << request_data.inspect\n end\n unless status_code.blank?\n msgs << \"Handling with status code: #{status_code}\"\n end\n if exception.respond_to?(:backtrace) && !exception.backtrace.blank?\n msgs << exception.backtrace.join(\"\\n \")\n end\n\n log_error msgs\n end", "def debug_exception_response_format=(_arg0); end", "def debug_exception_response_format=(_arg0); end", "def get_date_in_exception\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/error/dateInException'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\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 BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _context.response.status_code == 444\r\n raise ExceptionWithDateException.new(\r\n 'date in exception',\r\n _context\r\n )\r\n end\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) unless\r\n _context.response.raw_body.nil? ||\r\n _context.response.raw_body.to_s.strip.empty?\r\n decoded\r\n end", "def context\n @context ||= [{'server' => hostname, 'type' => 'exception'}]\n end", "def original_exception; end", "def throwable_params\n params[:throwable]\n end", "def exception_handler; end", "def handle_exception(exception)\n diagnosis = SData::Diagnosis::DiagnosisMapper.map(exception)\n\n status diagnosis.http_status_code || 500\n content_type 'application/xml'\n\n diagnosis.to_xml(:root)\n exception.to_s\n end", "def get_dynamic_in_exception\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/error/dynamicInException'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\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 BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _context.response.status_code == 444\r\n raise ExceptionWithDynamicException.new(\r\n 'dynamic in Exception',\r\n _context\r\n )\r\n end\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) unless\r\n _context.response.raw_body.nil? ||\r\n _context.response.raw_body.to_s.strip.empty?\r\n decoded\r\n end", "def new\n @daily_data_delivery_exception = DailyDataDeliveryException.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @daily_data_delivery_exception }\n end\n end", "def show\n @exception = ExceptionHandler::Exception.new request #-> Service Object\n render status: @exception.status #-> Show apppropriate response\n end", "def in_exception_context?; end", "def create\n @exception_date = ExceptionDate.new(exception_date_params)\n\n respond_to do |format|\n if @exception_date.save\n flash[:success] = 'Exception date was successfully created.'\n format.html { redirect_to exception_dates_url}\n format.json { render :show, status: :created, location: @exception_date }\n else\n format.html { render :new }\n format.json { render json: @exception_date.errors, status: :unprocessable_entity }\n end\n end\n end", "def fields_from_exception( exception )\n\t\tfields = {\n\t\t\ttype: exception.class.name,\n\t\t\tmessage: exception.message,\n\t\t}\n\n\t\tif exception.cause\n\t\t\tcause_fields = self.fields_from_exception( exception.cause )\n\t\t\tfields[ :cause ] = cause_fields[ :error ]\n\t\tend\n\n\t\tif ( locations = exception.backtrace_locations )\n\t\t\tfields[ :backtrace ] = locations.map do |loc|\n\t\t\t\t{ label: loc.label, path: loc.absolute_path, lineno: loc.lineno }\n\t\t\tend\n\t\tend\n\n\t\treturn { error: fields }\n\tend", "def handle_exception(e)\n if e.flags.has_key?(:layout) then\n @_layout = e.flags[:layout]\n end\n\n if e.flags.has_key?(:no_after_filters) then\n @_stop_no_after_filters = true\n end\n\n if e.flags.has_key?(:redirect) then\n @_layout = false\n to = e.flags[:redirect]\n clear\n @_content = \"<!DOCTYPE HTML PUBLIC \\\"-//W3C//DTD HTML 4.0 Transitional//EN\\\"><html><head><title>Redirecting...</title><meta http-equiv=\\\"REFRESH\\\" content=\\\"0;url=#{to}\\\"></HEAD></HTML>\"\n @cancel_execution = true\n end\n\n if e.flags.has_key?(:error) then\n @_layout = false\n http_status \"SERVER_ERROR\"\n clear\n @error_message = e.flags[:error]\n @cancel_execution = true\n trace = ''\n if Cuca::App.config['display_errors'] then\n e.backtrace.each do |b|\n trace<< \"<br/>#{b}\"\n end\n end\n mab { html { body { h2 \"Error\"; text @error_message; br; text trace }}}\n end\n \n if e.flags.has_key?(:cancel_execution) then\n @cancel_execution = true\n end\n end", "def extract_and_merge_controller_data(data)\n if @controller\n data[:request] = {\n params: @controller.request.parameters.to_hash,\n rails_root: defined?(Rails) && defined?(Rails.root) ? Rails.root : \"Rails.root not defined. Is this a test environment?\",\n url: @controller.complete_request_uri\n }\n data[:environment].merge!(@controller.request.env.to_hash)\n\n @controller.session[:fault_in_session]\n data[:session] = {\n key: @controller.request.session_options[:id],\n data: @controller.session.to_hash\n }\n end\n end", "def new\n @import = Import.new\n\n #testing for Airbrake\n begin\n #pass otehr stuff to the notice in a params hash!\n params = {\"Rails Environment\" => Rails.env}\n my_unpredicable_method(params)\n rescue => e\n Airbrake.notify(\n :error_class => \"Custom Class\"\n :error_message => \"Generated from inside of the new method in the imports controller\"\n :parameters => params\n )\n\n end \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @import }\n end\n end", "def request(datas)\n \n ExceptionHandler.validate_request_params(datas)\n args = build_args(datas) \n\n ExceptionHandler.validate_binary_output(:request, `#{@request_path} #{args}`) \n end", "def set_trace_exception\n @trace_exception = TraceException.find(params[:id])\n end", "def exc_msg_and_response(exc, response = T.unsafe(nil)); end", "def exception_service\n hash = {}\n @exception.instance_variables.select do |ivar|\n attr_value = @exception.instance_variable_get(ivar)\n hash[ivar.to_s] = attr_value if attr_value.present?\n end\n hash\n end", "def initialize(exception, **options)\n @exception = exception\n\n @status = options[:status]\n\n @title = options[:title]\n\n @detail = options[:detail]\n if options[:message] && @detail.nil?\n # Deprecated, from GraphitiErrors\n @detail = (options[:message] == true) ? :exception : options[:message]\n end\n\n @meta = options[:meta]\n @code = options[:code]\n\n # TODO: Warn about unrecognized options\n end", "def extract_exception(payload)\n if payload[:exception]\n exception, message = payload[:exception]\n status = ::ActionDispatch::ExceptionWrapper.status_code_for_exception(exception)\n backtrace = if LogStasher.backtrace\n if LogStasher.backtrace_filter.respond_to?(:call)\n LogStasher.backtrace_filter.call($!.backtrace).join(\"\\n\")\n else\n $!.backtrace.join(\"\\n\")\n end\n else\n $!.backtrace.first\n end\n message = \"#{exception}\\n#{message}\\n#{backtrace}\"\n { status: status, error: message }\n else\n {}\n end\n end", "def handle_exception datagram, e\n # stub\n end", "def underlying_exception=(_arg0); end", "def exception_message(e)\n <<-EXCEPTION\nException happend\nType: #{@type.inspect}\nData: #{@data.inspect}\nError occurs: #{e.class.inspect}(#{e.message})\nBacktrace: #{e.backtrace.join(\"\\n\") rescue ''}\n EXCEPTION\n end", "def egregious_exception_handler(exception)\n egregious_flash(exception)\n egregious_log(exception)\n egregious_respond_to(exception)\n end", "def execute request_context\n raise \"You gotta implement this method and return a hash like => {:status => <integer>, :body => <string>, :headers => <hash>}\"\n end", "def get_receive_exception_with_rfc_1123_datetime\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/error/rfc1123Exception'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\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 BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _context.response.status_code == 444\r\n raise Rfc1123Exception.new(\r\n 'Rfc1123 Exception',\r\n _context\r\n )\r\n end\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) unless\r\n _context.response.raw_body.nil? ||\r\n _context.response.raw_body.to_s.strip.empty?\r\n decoded\r\n end", "def rails_controller_rescue\n yield\n rescue Exception => exception\n rails_controller_instance.rescue_with_handler(exception) || raise\n\n unless rails_controller_instance.performed?\n raise Rodauth::Rails::Error, \"rescue_from handler didn't write any response\"\n end\n end", "def exception_data\n {\n company: company.id,\n notified_user_ids: begin\n anniversary_hash = get_todays_event_hash(:anniversary) || {}\n birthday_hash = get_todays_event_hash(:birthday) || {}\n notified_user_ids = (anniversary_hash.keys + birthday_hash.keys).uniq\n notified_user_ids\n end\n }\n end", "def handle_exception e\n response.headers['Content-Type'] = 'application/json'\n response.body = { message: e.message, backtrace: e.backtrace }.to_json\n end", "def exception_handling_data(e)\n self.rescue_handlers.each do |handler|\n return handler if (handler.key?(:exception_classes) && handler[:exception_classes].include?(e.class))\n if handler.key?(:exception_ancestor_classes)\n handler[:exception_ancestor_classes].each do |ancestor|\n return handler if e.class.ancestors.include?(ancestor)\n end\n elsif !handler.key?(:exception_classes) && !handler.key?(:exception_ancestor_classes)\n return handler\n end\n end\n nil\n end", "def handle_generic_error(exception)\n end", "def exception_renderer=(_arg0); end", "def report_exception(service_class, service_data, exception)\n backtrace = Array(exception.backtrace)[0..500]\n\n data = {\n 'app' => 'github-services',\n 'type' => 'exception',\n 'class' => exception.class.to_s,\n 'server' => settings.hostname,\n 'message' => exception.message[0..254],\n 'backtrace' => backtrace.join(\"\\n\"),\n 'rollup' => Digest::MD5.hexdigest(exception.class.to_s + backtrace[0]),\n 'service' => service_class.to_s\n }\n\n if exception.kind_of?(Service::Error)\n if exception.original_exception\n data['original_class'] = exception.original_exception.to_s\n data['backtrace'] = exception.original_exception.backtrace.join(\"\\n\")\n data['message'] = exception.original_exception.message[0..254]\n end\n elsif !exception.kind_of?(Service::TimeoutError)\n data['original_class'] = data['class']\n data['class'] = 'Service::Error'\n end\n\n if service_class == Service::Web\n data['service_data'] = service_data.inspect\n end\n\n if settings.hostname =~ /^sh1\\.(rs|stg)\\.github\\.com$/\n # run only in github's production environment\n Net::HTTP.new('haystack', 80).\n post('/async', \"json=#{Rack::Utils.escape(data.to_json)}\")\n else\n $stderr.puts data[ 'message' ]\n $stderr.puts data[ 'backtrace' ]\n end\n\n rescue => boom\n $stderr.puts \"reporting exception failed:\"\n $stderr.puts \"#{boom.class}: #{boom}\"\n $stderr.puts \"#{boom.backtrace.join(\"\\n\")}\"\n # swallow errors\n end", "def api_exception_handler(exception)\n errors = []\n errors << exception.message\n @api_response[:code] = @response_codes['internal_error']\n # @logger.error \"#{Time.now} SESSION_ID:#{session[:session_id]} EXCEPTION IS: #{errors} \\n #{exception.backtrace}\"\n [errors, @api_response]\n end", "def merge_exception(hash, test, exception, bt=false)\n hash['exception'] = {}\n hash['exception']['file' ] = code(exception).file\n hash['exception']['line' ] = code(exception).line\n hash['exception']['source' ] = code(exception).to_str\n hash['exception']['snippet' ] = code(exception).to_omap\n hash['exception']['message' ] = exception.message\n hash['exception']['backtrace'] = clean_backtrace(exception) if bt\n end", "def handle_exception(exception)\n if safe_rescue_exception?(exception)\n # This exception should be safely rescued to prevent false positive for the dynamic scanners. Log the exception\n message = \"Automatic handled \" + exception.class.to_s + \": \" + exception.message + \" to prevent false positive\"\n logger.debug message\n flash[:alert] = message unless running?\n # Try to render the normal controller action (although with empty results) as if everything is well\n render\n else\n # This exception should not be safe rescued (possible SQL injection!). Simply raise the exception again to display the full error.\n logger.fatal \"Params: \"+ params.inspect\n raise exception\n end\n end", "def create\n# puts \"request.inspect:#{request.inspect}\"\n logtag = ControllerHelper.gen_logtag\n # Stores objs that causes problem except inbound_email\n # which is handled by different error handler in :action => new\n # view\n @error_obj_arr = []\nputs \"InboundEmail, create:#{params[:inbound_email].inspect}\"\n # The user is redirected to a different return_url if provided\n # else the standard page is rendered\n return_url = params[Constants::RETURN_URL_INPUT]\n logger.debug(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}: return_url:#{return_url}\")\n # If the inbound_email was created using the interface then\n # it will keys like \"commit\", etc and the hash for the inbound_email\n # is stored using :inbound_email key\n inbound_email_params = params[:inbound_email]\n # If inbound_email was created using external mechanims, e.g.,\n # sendgrid, then there is no :inbound_email key so we\n # use the params directly\n inbound_email_params ||= params\n # We can also based on certain values, e.g., smtp ip or header\n # fields decide which field_mapper to get, but we need at least\n # one field that is guarateed there, for sendgrid, we can use headers\n field_mapper_type = nil\n if inbound_email_params[:headers].match /sendgrid.meant.it/\n field_mapper_type = InboundEmailFieldMapperFactory::SENDGRID\n end # end if inbound_email_params ...\n field_mapper = InboundEmailFieldMapperFactory.get_inbound_email_field_mapper(field_mapper_type)\n logger.debug(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, field_mapper_type:#{field_mapper_type}\")\n logger.debug(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, field_mapper:#{field_mapper.inspect}\")\n @inbound_email = InboundEmail.new(\n :headers => inbound_email_params[field_mapper[:headers]],\n :body_text => inbound_email_params[field_mapper[:body_text]],\n :body_html => inbound_email_params[field_mapper[:body_html]],\n :from => inbound_email_params[field_mapper[:from]],\n :to => inbound_email_params[field_mapper[:to]],\n :subject => inbound_email_params[field_mapper[:subject]],\n :cc => inbound_email_params[field_mapper[:cc]],\n :dkim => inbound_email_params[field_mapper[:dkim]],\n :spf => inbound_email_params[field_mapper[:spf]],\n :envelope => inbound_email_params[field_mapper[:envelope]],\n :charsets => inbound_email_params[field_mapper[:charsets]],\n :spam_score => inbound_email_params[field_mapper[:spam_score]],\n :spam_report => inbound_email_params[field_mapper[:spam_report]],\n :attachment_count => inbound_email_params[field_mapper[:attachment_count]]\n )\n\n unless @inbound_email.save\n error_display(\"Error creating inbound_email:#{@inbound_email.errors}\", @inbound_email.errors, :error, logtag) \n return\n end # end unless @inbound_email ...\n logger.info(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, created inbound_email with id:#{@inbound_email.id}\")\n sender_str = inbound_email_params[field_mapper[:from]]\n logger.debug(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, sender_str = inbound_email_params[field_mapper[:from]]:#{inbound_email_params[field_mapper[:from]]}\")\n # If not from sendgrid server url then don't use the sender_str\n # make it anonymous or use session\n if !self.request.path.match(/#{Constants::SENDGRID_PARSE_URL}/) # or !Constants::SENDGRID_SMTP_WHITELIST.include?(self.request.env['REMOTE_ADDR'])\n # Check for session id\n # CODE!!!\n # else use anonymous\n sender_str = \"anonymous#{Constants::MEANT_IT_PII_SUFFIX}\" if !admin?\n end # end if !self.request.path.match(/#{Constants::SENDGRID_PARSE_URL}/)\n sender_email_hash = ControllerHelper.parse_email(sender_str)\n sender_str = sender_email_hash[ControllerHelper::EMAIL_STR]\n sender_nick_str = sender_email_hash[ControllerHelper::EMAIL_NICK_STR]\n # Parse sender string to derive nick and email address\n # If sender_nick_str is email, e.g., some smtp servers provide\n # \"[email protected] <[email protected]>\" then we\n # don't use the nick\n sender_nick_str = nil if !sender_nick_str.nil? and !sender_nick_str.match(/.*@.*\\..*/).nil?\n logger.info(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, sender_str:#{sender_str}\")\n logger.info(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, sender_nick_str:#{sender_nick_str}\")\n sender_email_addr = inbound_email_params[field_mapper[:to]]\n logger.debug(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, sender_email_addr = inbound_email_params[field_mapper[:to]]:#{inbound_email_params[field_mapper[:to]]}\")\n message_type_str = ControllerHelper.parse_message_type_from_email_addr(sender_email_addr, logtag)\n logger.info(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, message_type_str:#{message_type_str}\")\n # Create sender EndPoint\n sender_pii_hash = ControllerHelper.get_pii_hash(sender_str)\n logger.info(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, sender_pii_hash:#{sender_pii_hash.inspect}\")\n pii_cond = \"found\"\n @sender_pii = Pii.find_or_create_by_pii_value_and_pii_type_and_pii_hide(sender_pii_hash[ControllerHelper::PII_VALUE_STR], sender_pii_hash[ControllerHelper::PII_TYPE], sender_pii_hash[ControllerHelper::PII_HIDE]) do |pii_obj|\n pii_cond = \"created\"\n end # end Pii.find_or_create_by_pii ...\n logger.info(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, #{pii_cond} sender_pii, pii_value:#{@sender_pii.pii_value}\")\n unless @sender_pii.errors.empty?\n @error_obj_arr << @sender_pii\n error_display(\"Error creating sender_pii '#{sender_str}':#{@sender_pii.errors}\", @sender_pii.errors, :error, logtag)\n return\n end # unless @sender_pii.errors.empty?\n#20110628a @sender_endPoint = @sender_pii.endPoint\n#20110628a : Start\n sender_endPoints = @sender_pii.endPoints\n sender_endPoints_arr = sender_endPoints.select { |elem| elem.creator_endpoint_id == elem.id }\n if !sender_endPoints_arr.nil?\n @sender_endPoint = sender_endPoints_arr[0]\n if sender_endPoints_arr.size > 1\n logger.warn(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, more than one sender_endPoints with id == creator_endpoint_id, sender_endPoints_arr:#{sender_endPoints_arr.inspect}\")\n end # end if sender_endPoints_arr.size > 1\n end # end if sender_endPoints_arr.nil?\n#20110628a : End\n if @sender_endPoint.nil?\n#20110628a @sender_endPoint = @sender_pii.create_endPoint(:nick => sender_nick_str, :start_time => Time.now)\n @sender_endPoint = @sender_pii.endPoints.create(:nick => sender_nick_str, :start_time => Time.now)\n # Save the association\n @sender_endPoint.pii = @sender_pii\n @sender_endPoint.nick = sender_nick_str\n @sender_endPoint.creator_endpoint_id = @sender_endPoint.id\n unless @sender_endPoint.save\n @error_obj_arr << @sender_endPoint\n error_display(\"Error creating @sender_endPoint '#{@sender_endPoint.inspect}:#{@sender_endPoint.errors}\", @sender_endPoint.errors, :error, logtag)\n return\n end # end unless @sender_endPoint.save\n logger.info(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, created sender_endPoint, @sender_endPoint.inspect:#{@sender_endPoint.inspect}\")\n @sender_pii.reload\n#20110725add_auth @sender_pii.endPoints << @sender_endPoint\n#20110725add_auth unless @sender_pii.save\n#20110725add_auth @error_obj_arr << @sender_pii\n#20110725add_auth error_display(\"Error saving @sender_pii'#{@sender_pii.inspect}:#{@sender_pii.errors}\", @sender_pii.errors, :error, logtag)\n#20110725add_auth return\n#20110725add_auth end # end unless @sender_pii.save\n logger.info(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, acquired sender_endPoint with id:#{@sender_endPoint.id}\")\n else\n logger.info(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, found sender_endPoint, @sender_endPoint.inspect:#{@sender_endPoint.inspect}\")\n end # end if @sender_endPoint.nil?\n logger.debug(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, @sender_endPoint.entities:#{@sender_endPoint.entities}\")\n#20110713 if @sender_endPoint.entities.empty?\n#20110713 # Create person\n#20110713 @person = ControllerHelper.find_or_create_person_by_email(sender_nick_str, sender_str, logtag)\n#20110713 unless @person.errors.empty?\n#20110713 @error_obj_arr << @person\n#20110713 error_display(\"Error creating person 'name:#{sender_nick_str}, email:#{sender_str}:#{@person.errors}\", @person.errors, :error, logtag)\n#20110713 return\n#20110713 end # end unless @person.errors.empty?\n#20110713 # Create an entity having property_document with sender email\n#20110713 entity_collection = Entity.where(\"property_document_id = ?\", @person.id.to_s)\n#20110713 logger.debug(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, for @person.id:#{@person.id}, entity_collection.inspect:#{entity_collection.inspect}\")\n#20110713 if entity_collection.empty?\n#20110713 @entity = Entity.create(:property_document_id => @person.id)\n#20110713 else\n#20110713 @entity = entity_collection[0]\n#20110713 end # end if entity_collection.empty?\n#20110713 unless @entity.errors.empty?\n#20110713 @error_obj_arr << @entity\n#20110713 error_display(\"Error creating entity 'property_document_id:#{@person.id}':#{@entity.errors}\", @entity.errors, :error, logtag)\n#20110713 return\n#20110713 end # end unless @entity.errors.empty?\n#20110713 # Link entity to the @sender_endPoint\n#20110713 if @entity.errors.empty?\n#20110713 # We cannot just do @entity.endPoints << @sender_endPoint\n#20110713 # because EntityEndPointRels.verification_type must not be null\n#20110713 @entityEndPointRel1 = @entity.entityEndPointRels.create(:verification_type => VerificationTypeValidator::VERIFICATION_TYPE_EMAIL)\n#20110713 @entityEndPointRel1.endpoint_id = @sender_endPoint.id\n#20110713 unless @entityEndPointRel1.save\n#20110713 @error_obj_arr << @entityEndPointRel1\n#20110713 error_display(\"Error creating entityEndPointRel 'entity:#{@entity.name} relate @sender_endPoint:#{@sender_endPoint.id}':#{@entityEndPointRel1.errors}\", @entityEndPointRel1.errors, :error, logtag)\n#20110713 return\n#20110713 end # end unless @entityEndPointRel1.save\n#20110713 end # end if @entity.errors.empty?\n#20110713 end # end if @sender_endPoint.entities.empty?\n # Look at subject if it's not nil\n # else use body_text\n input_str = inbound_email_params[field_mapper[:subject]]\n if input_str.nil? or input_str.empty?\n input_str = inbound_email_params[field_mapper[:body_text]]\n end # end if input_str.nil? or input_str.empty?\n logger.info(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, input_str:#{input_str}\")\n # Decide what to do on nick, pii, message, tags...\n # Case:\n # nick (yes) :xxx (no) ;yyy (*) tags (yes): sender (global id-able source)\n # Dup input_str in case we need it\n # Don't manipulate the original input_str since it is used\n # to re-populate form on failures\n input_str_dup = input_str.dup\n meantItInput_hash = ControllerHelper.parse_meant_it_input(input_str_dup, logtag)\n message_str = meantItInput_hash[ControllerHelper::MEANT_IT_INPUT_MESSAGE]\n receiver_pii_str = meantItInput_hash[ControllerHelper::MEANT_IT_INPUT_RECEIVER_PII]\n receiver_pii_hash = ControllerHelper.get_pii_hash(receiver_pii_str)\n receiver_pii_str = receiver_pii_hash[ControllerHelper::PII_VALUE_STR]\n logger.info(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, receiver_pii_hash:#{receiver_pii_hash.inspect}\")\n receiver_nick_str = meantItInput_hash[ControllerHelper::MEANT_IT_INPUT_RECEIVER_NICK]\n tag_str_arr = meantItInput_hash[ControllerHelper::MEANT_IT_INPUT_TAGS]\n\n # Four conditions:\n # 1. receiver_pii_str: empty, receiver_nick_str: empty\n # 2. receiver_pii_str: yes, receiver_nick_str: yes\n # 3. receiver_pii_str: yes, receiver_nick_str: empty\n # 4. receiver_pii_str: empty, receiver_nick_str: yes\n logger.info(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, receiver_pii_str:#{receiver_pii_str}, receiver_nick_str:#{receiver_nick_str}\")\n\n # Case 1. receiver_pii_str: empty, receiver_nick_str: empty\n # Cannot identify receiver\n if (receiver_pii_str.nil? or receiver_pii_str.empty?) and (receiver_nick_str.nil? or receiver_nick_str.empty?)\n logger.info(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, case 1\")\n @receiver_endPoint = EndPoint.new\n @error_obj_arr << @receiver_endPoint\n error_display(\"Error finding/creating @receiver_endPoint, both receiver_nick and receiver_pii are empty\", @receiver_endPoint.errors, :error, logtag)\n return\n end # end Case 1. ... if (receiver_pii_str.nil? or ...\n\n # Case 2. receiver_pii_str: yes, receiver_nick_str: yes\n # or\n # Case 3. receiver_pii_str: yes, receiver_nick_str: empty\n # We need to find_or_create the receiver_pii\n if (\n ((!receiver_pii_str.nil? and !receiver_pii_str.empty?) and (!receiver_nick_str.nil? and !receiver_nick_str.empty?)) or\n ((!receiver_pii_str.nil? and !receiver_pii_str.empty?) and (receiver_nick_str.nil? or receiver_nick_str.empty?))\n )\n logger.info(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, case 2, 3\")\n # Create receiver pii if it does not possess one\n pii_cond = \"found\"\n @receiver_pii = Pii.find_or_create_by_pii_value_and_pii_type_and_pii_hide(receiver_pii_hash[ControllerHelper::PII_VALUE_STR], receiver_pii_hash[ControllerHelper::PII_TYPE], receiver_pii_hash[ControllerHelper::PII_HIDE]) do |pii_obj|\n pii_cond = \"created\"\n end # end Pii.find_or_create_by_pii ...\n logger.info(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, #{pii_cond} receiver_pii, pii_value:#{@receiver_pii.pii_value} - case 2, 3\")\n # If @receiver_pii has an entity prefix \n # automatically tie it to the prefix\n if (receiver_pii_match_arr = ControllerHelper.auto_entity_domain?(@receiver_pii.pii_value))\n receiver_entity = Entity.find(receiver_pii_match_arr[ControllerHelper::AUTO_ENTITY_DOMAIN_ENTITY_ID]) if !receiver_pii_match_arr.nil?\n logger.debug(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, receiver_entity.inspect:#{receiver_entity.inspect}\")\n if !receiver_entity.nil?\n entityEndPointRel_exist = receiver_entity.endPoints.collect { |ep_elem| ep_elem.pii.pii_value if !ep_elem.pii.nil? }.include?(@receiver_pii.pii_value)\n logger.debug(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, entityEndPointRel_exist.inspect:#{entityEndPointRel_exist.inspect}\")\n if !entityEndPointRel_exist\n # Since entity can only tie to endpoints, we use the sender endpoint\n # NOTE: a receiver has many endpoints, each with own nick so we\n # tie to only the receiver endpoint which is its sending endpoint\n ep_cond = \"found\"\n receiver_sender_endPoint = ControllerHelper.find_or_create_sender_endPoint_and_pii(@receiver_pii.pii_value, @receiver_pii.pii_type, @receiver_pii.pii_hide)\n entityEndPointRel1 = receiver_entity.entityEndPointRels.create(:verification_type => VerificationTypeValidator::VERIFICATION_TYPE_AUTO_ENTITY_DOMAIN)\n entityEndPointRel1.endpoint_id = receiver_sender_endPoint.id\n unless entityEndPointRel1.save\n logger.error(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, entityEndPointRel1.errors.inspect:#{entityEndPointRel1.errors.inspect}\")\n end # end unless entityEndPointRel1.save\n logger.info(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, created entityEndPointRel, entityEndPointRel1.inspect:#{entityEndPointRel1.inspect}\")\n receiver_sender_endPoint.reload\n end # end if !entityEndPointRel_exist\n end # end if !receiver_entity.nil?\n end # end if (receiver_pii_match_arr = ControllerHelper.auto_entity_domain? ...\n unless @receiver_pii.errors.empty?\n @error_obj_arr << @receiver_pii\n error_display(\"Error creating receiver_pii '#{receiver_pii_str}'\", @receiver_pii.errors, :error, logtag) \n return\n end # end unless @receiver_pii.errors.empty?\n end # end get @receiver_pii ... if (receiver_pii_str.nil? or ...\n\n # Case 2. receiver_pii_str: yes, receiver_nick_str: yes\n # or\n # Case 4. receiver_pii_str: empty, receiver_nick_str: yes\n # Need to find EndPoint\n if (\n ((!receiver_pii_str.nil? and !receiver_pii_str.empty?) and (!receiver_nick_str.nil? and !receiver_nick_str.empty?)) or\n ((receiver_pii_str.nil? or receiver_pii_str.empty?) and (!receiver_nick_str.nil? and !receiver_nick_str.empty?))\n )\n logger.info(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, case 2, 4\")\n ep_cond = \"found\"\n @receiver_endPoint = EndPoint.find_or_create_by_nick_and_creator_endpoint_id(:nick => receiver_nick_str, :creator_endpoint_id => @sender_endPoint.id, :start_time => Time.now) do |ep_obj|\n ep_cond = \"created\"\n end # end @receiver_endPoint ...\n logger.info(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, #{ep_cond} receiver_endPoint - case 2, 4\")\n end # end Cases 2 and 4 ...\n\n # For Case 2. receiver_pii_str: yes, receiver_nick_str: yes \n # and they have been linked before, we check validity\n # If @receiver_pii and @receiver_endPoints exist and there were no \n # errors creating them they must point to each other if they\n # are not pointing to nil.\np \"### @receiver_pii.inspect:#{@receiver_pii.inspect}\"\np \"### @receiver_endPoint.inspect:#{@receiver_endPoint.inspect}\"\n#20110628a : Start\n # We are only interested in endPoints created by us\n # They may have different nicks/roles/empty nicks\n # Resist the urge to populate empty nicks because if\n # a user sends to just pii, i.e., without nick, then we update\n # the endPoint with empty nick.\n our_receiver_pii_endPoints = []\n our_receiver_pii_endPoints = @receiver_pii.endPoints.select { |elem| elem.creator_endpoint_id == @sender_endPoint.id } if !@receiver_pii.nil? and !@receiver_pii.endPoints.nil?\np \"### our_receiver_pii_endPoints:#{our_receiver_pii_endPoints.inspect}\"\n#20110628a : End\n if (!@receiver_pii.nil? and !@receiver_pii.errors.any?) and (!@receiver_endPoint.nil? and !@receiver_endPoint.errors.any?)\n#20110628a : Start\n # Endpoint can only have one pii so need to check that\n if !@receiver_endPoint.pii.nil? and (@receiver_endPoint.pii.pii_value != @receiver_pii.pii_value)\n @error_obj_arr << @receiver_endPoint\n error_display(\"receiver_endPoint '#{@receiver_endPoint.nick}' already has pii_value '#{@receiver_endPoint.pii.pii_value}' so it cannot accept new value '#{receiver_pii_str}'\", @receiver_endPoint.errors, :error, logtag) \n return\n end # end if @receiver_endPoint.pii.pii_value ...\n # Since we permite a user to create mulitple nicks/roles\n # tied to a pii, e.g., manager ([email protected]), lover ([email protected])\n # we just need to check that the new nick endpoint does not exist,\n # before adding them. If it exists use it as exsiting endpoints.\n # This also handles if initially receiver is just nick (endpoint created)\n # later the nick is accompanied with pii.\n if our_receiver_pii_endPoints.index(@receiver_endPoint).nil?\n @receiver_endPoint.pii = @receiver_pii\n unless @receiver_endPoint.save\n @error_obj_arr << @receiver_endPoint\n error_display(\"Error saving receiver_pii '#{@receiver_pii.inspect}' to receiver_endPoint '{@receiver_endPoint.inspect}'\", @receiver_endPoint.errors, :error, logtag) \n return\n end # end unless @receiver_endPoint.save\n @receiver_pii.reload\n#20110725add_auth @receiver_pii.endPoints << @receiver_endPoint\n#20110725add_auth unless @receiver_pii.save\n#20110725add_auth @error_obj_arr << @receiver_pii\n#20110725add_auth error_display(\"Error saving @receiver_pii'#{@receiver_pii.inspect}:#{@receiver_pii.errors}\", @receiver_pii.errors, :error, logtag)\n#20110725add_auth return\n#20110725add_auth end # end unless @receiver_pii.save\n end # end if our_receiver_pii_endPoints.index(@receiver_endPoint).nil?\n#20110628a : End\n#20110628a : End\n#20110628a # We have an endpoint (nick) and pii\n#20110628a # Each nick/pii can either point to each other (OK)\n#20110628a # another entity (ERROR), or nothing.\n#20110628a # There are 9 combos:\n#20110628a # The only valid ones are:\n#20110628a # Case #A: nick/pii points to nil\n#20110628a p \"AAAAAAAAAAA @receiver_pii:#{@receiver_pii.inspect}\"\n#20110628a p \"AAAAAAAAAAA @receiver_endPoint:#{@receiver_endPoint.inspect}\"\n#20110628a p \"AAAAAAAAAAA @receiver_endPoint.pii:#{@receiver_endPoint.pii.inspect}\"\n#20110628a if @receiver_pii.endPoint.nil? and @receiver_endPoint.pii.nil?\n#20110628aAA if receiver_pii_endPoints.empty? and @receiver_endPoint.pii.nil?\n#20110628a p \"\\nAAAAAAAAAAA NORMAL!!!\\n\"\n#20110628a @receiver_pii.endPoint = @receiver_endPoint\n#20110628a @receiver_pii.save\n#20110628aAA @receiver_endPoint.pii = @receiver_pii\n#20110628aAA @receiver_endPoint.save\n#20110628a : Start\n#20110628a # Case #Aa: receiver_pii points to some empty nick_name\n#20110628a elsif !receiver_pii_endPoints.empty? and @receiver_endPoint.pii.nil?\n#20110628a#20110628a : End\n#20110628a # Case #B: nick points to nothing, pii points to something but has no nick\n#20110628a # and has the same creator_endpoint_id\n#20110628a elsif (!@receiver_pii.endPoint.nil? and @receiver_pii.endPoint.nick.nil?) and @receiver_endPoint.pii.nil?\n#20110628ap \"\\n!!!!!! YOU CAN'T BE SERIOUS!!!!!\\n\"\n#20110628a @receiver_pii.endPoint.nick = receiver_nick_str\n#20110628a @receiver_pii.save\n#20110628a @receiver_endPoint.destroy\n#20110628a @receiver_endPoint = @receiver_pii.endPoint\n#20110628a # Case #C: nick points to this pii and vice versa\n#20110628a elsif (!@receiver_pii.endPoint.nil? and !@receiver_endPoint.pii.nil? and @receiver_pii.endPoint == @receiver_endPoint and @receiver_endPoint.pii == @receiver_pii)\n#20110628ap \"\\nHUH!!!!?!??! NORMAL!!!\\n\"\n#20110628a # OK\n#20110628a elsif (!@receiver_pii.endPoint.nil? and !@receiver_endPoint.pii.nil? and @receiver_pii.endPoint != @receiver_endPoint and @receiver_endPoint.pii != @receiver_pii)\n#20110628a @error_obj_arr << @receiver_endPoint\n#20110628a error_display(\"receiver_endPoint '#{@receiver_endPoint.nick}' already has pii_value '#{@receiver_endPoint.pii.pii_value}' so it cannot accept new value '#{receiver_pii_str}'\", @receiver_endPoint.errors, :error, logtag) \n#20110628a return\n#20110628a else\n#20110628a # Should not happen unless corrupted\n#20110628a @error_obj_arr << @receiver_endPoint\n#20110628a error_display(\"receiver_endPoint 'nick:#{@receiver_endPoint.nick}, pii:#{@receiver_endPoint.pii.inspect}' conflicts with receiver_pii 'pii:#{@receiver_pii.pii_value}, endPoint:#{@receiver_pii.endPoint.inspect}\", @receiver_endPoint.errors, :error, logtag) \n#20110628a return\n#20110628a end # end if @receiver_pii.endPoint.nil? and @receiver_endPoint.pii.nil?\n\n#20110627a if !@receiver_pii.endPoint.nil? and !@receiver_endPoint.pii.nil?\n#20110627a unless (@receiver_pii.endPoint == @receiver_endPoint and @receiver_endPoint.pii = @receiver_pii)\n#20110627a @error_obj_arr << @receiver_endPoint\n#20110627a error_display(\"receiver_endPoint '#{@receiver_endPoint.nick}' already has pii_value '#{@receiver_endPoint.pii.pii_value}' so it cannot accept new value '#{receiver_pii_str}'\", @receiver_endPoint.errors, :error, logtag) \n#20110627a return\n#20110627a end # end unless @receiver_pii.endPoint == ...\n#20110627a else\n#20110627a if @receiver_pii.endPoint.nil?\n#20110627a @receiver_pii.endPoint = @receiver_endPoint\n#20110627a end # end if @receiver_pii.endPoint.nil?\n#20110627a if @receiver_endPoint.pii.nil?\n#20110627a @receiver_endPoint.pii = @receiver_pii\n#20110627a end # end if @receiver_endPoint.pii.nil?\n#20110627a end # end if !@receiver_pii.endPoint.nil? and !@receiver_endPoint.pii.nil?\n end # end if (!@receiver_pii.nil? and !@receiver_pii.errors.any?) ...\n\n # For Case 3. receiver_pii_str: yes, receiver_nick_str: empty\n # we create endPoint and tie receiver_pii to it\n if ((!receiver_pii_str.nil? and !receiver_pii_str.empty?) and (receiver_nick_str.nil? or receiver_nick_str.empty?))\n#20110628a : Start\n # Check if we already have endPoint with no nick. If so use it.\n receiver_endPoint_no_nick_arr = our_receiver_pii_endPoints.select { |elem| elem.nick.nil? }\n @receiver_endPoint = receiver_endPoint_no_nick_arr[0] if !receiver_endPoint_no_nick_arr.nil? and receiver_endPoint_no_nick_arr.size > 0\n if receiver_endPoint_no_nick_arr.size > 1\n logger.warn(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, more than one receiver_endPoints with nick = nil, receiver_endPoint_no_nick_arr:#{receiver_endPoint_no_nick_arr.inspect}\")\n end # end if receiver_endPoint_no_nick_arr.size > 1\n#20110628a : End\n#20110628a @receiver_endPoint = EndPoint.create(:creator_endpoint_id => @sender_endPoint.id, :start_time => Time.now)\n @receiver_endPoint = EndPoint.create(:creator_endpoint_id => @sender_endPoint.id, :start_time => Time.now) if @receiver_endPoint.nil?\n logger.info(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, created receiver_endPoint - case 3\")\n @receiver_endPoint.pii = @receiver_pii\n unless @receiver_endPoint.save\n @error_obj_arr << @receiver_endPoint\n error_display(\"Error saving receiver_pii '#{@receiver_pii.inspect}' to receiver_endPoint '{@receiver_endPoint.inspect}'\", @receiver_endPoint.errors, :error, logtag) \n return\n end # end unless @receiver_endPoint.save\n @receiver_pii.reload\n#20110725add_auth @receiver_pii.endPoints << @receiver_endPoint\n#20110725add_auth unless @receiver_pii.save\n#20110725add_auth @error_obj_arr << @receiver_pii\n#20110725add_auth error_display(\"Error saving @receiver_pii'#{@receiver_pii.inspect}:#{@receiver_pii.errors}\", @receiver_pii.errors, :error, logtag)\n#20110725add_auth return\n#20110725add_auth end # end unless @receiver_pii.save\n end # end if ((!receiver_pii_str.nil? and !receiver_pii_str.empty?) ...\n \n # For Case 4. receiver_pii_str: empty, receiver_nick_str: yes\n # We already have endPoint. Tags, meant_it_rels are tied to endPoints.\n\n # At this stage all Case 2, 3, 4 have @receiver_endPoints\n\n#20110627 @receiver_endPoint = EndPoint.find_or_create_by_nick_and_creator_endpoint_id(:nick => receiver_nick_str, :creator_endpoint_id => @sender_endPoint.id, :start_time => Time.now) do |ep_obj|\n#20110627 logger.info(\"#{File.basename(__FILE__)}:#{self.class}:create:#{logtag}, created receiver_endPoint\")\n#20110627 end # end EndPoint.find_or_create_by ...\n#20110627 if @receiver_endPoint.pii\n#20110627 # Ensure the existing pii is the same otherwise flag error\n#20110627 unless @receiver_endPoint.pii.pii_value == receiver_pii_str or receiver_pii_str.nil? or receiver_pii_str.empty?\n#20110627 @error_obj_arr << @receiver_endPoint\n#20110627 error_display(\"receiver_endPoint '#{@receiver_endPoint.nick}' already has pii_value '#{@receiver_endPoint.pii.pii_value}' so it cannot accept new value '#{receiver_pii_str}'\", @receiver_endPoint.errors, :error, logtag) \n#20110627 return\n#20110627 end # end if @receiver_endPoint.pii != ...\n#20110627 else\n#20110627 # Create receiver pii if it does not possess one\n#20110627 @receiver_pii = Pii.find_or_create_by_pii_value_and_pii_type(receiver_pii_str, PiiTypeValidator::PII_TYPE_EMAIL) do |pii_obj|\n#20110627 logger.info(\"#{File.basename(__FILE__)}:#{self.class}:create:#{logtag}, created receiver_pii\")\n#20110627 end # end Pii.find_or_create_by_pii ...\n#20110627 unless @receiver_pii.errors.empty? or receiver_pii_str.nil? or receiver_pii_str.empty?\n#20110627 @error_obj_arr << @receiver_pii\n#20110627 error_display(\"Error creating receiver_pii '#{receiver_pii_str}'\", @receiver_pii.errors, :error, logtag) \n#20110627 return\n#20110627 end # end unless @receiver_pii.errors.empty?\n#20110627 @receiver_endPoint.pii = @receiver_pii\n#20110627 unless @receiver_endPoint.save\n#20110627 @error_obj_arr << @receiver_endPoint\n#20110627 error_display(\"Error saving receiver_pii '#{@receiver_pii.inspect}' to receiver_endPoint '{@receiver_endPoint.inspect}'\", @receiver_endPoint.errors, :error, logtag) \n#20110627 return\n#20110627 end # end unless @receiver_endPoint.save\n#20110627 end # end if @receiver_endPoint.pii\n\n\n unless @receiver_endPoint.errors.empty?\n @error_obj_arr << @receiver_endPoint\n error_display(\"Error creating @receiver_endPoint '#{@receiver_endPoint.inspect}':#{@receiver_endPoint.errors}\", @receiver_endPoint.errors, :error, logtag)\n return\n end # end unless @receiver_endPoint.errors.empty?\n if !@receiver_endPoint.nil?\n logger.debug(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, tag_str_arr.inspect:#{tag_str_arr.inspect}\")\n # Add tags that are not yet attached to the @receiver_endPoint\n existing_tag_str_arr = @receiver_endPoint.tags.collect { |tag_elem| tag_elem.name }\n logger.debug(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, existing_tag_str_arr:#{existing_tag_str_arr}\")\n#20110628b yet_2b_associated_tag_str_arr = (existing_tag_str_arr - tag_str_arr) + (tag_str_arr - existing_tag_str_arr)\n yet_2b_associated_tag_str_arr = tag_str_arr - existing_tag_str_arr\n logger.debug(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, yet_2b_associated_tag_str_arr:#{yet_2b_associated_tag_str_arr}\")\n yet_2b_associated_tag_str_arr.each { |tag_str_elem|\n norm_tag_str_elem = tag_str_elem.downcase\n tag_cond = \"found\"\n @new_tag = Tag.find_or_create_by_name(norm_tag_str_elem) do |tag_obj|\n tag_cond = \"created\"\n end # end Tag.find_or_create_by ...\n logger.info(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, #{tag_cond} tag:#{norm_tag_str_elem}\")\n unless @new_tag.errors.empty?\n @error_obj_arr << @new_tag\n error_display(\"Error creating new_tag '#{norm_tag_str_elem}':#{@new_tag.errors}\", @new_tag.errors, :error, logtag)\n return\n end # end unless @new_tag.errors.empty?\n @receiver_endPoint.tags << @new_tag\n logger.info(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, created EndPointTagRel.tag\")\n } # end tag_str_arr.each ...\n end # end if !@receiver_endPoint.nil?\n # Create meant_it rel\n if !@sender_endPoint.nil? and !@receiver_endPoint.nil? and !@inbound_email.nil?\n @meantItRel = @sender_endPoint.srcMeantItRels.create(:message_type => message_type_str, :message => message_str, :src_endpoint_id => @sender_endPoint.id, :dst_endpoint_id => @receiver_endPoint.id, :inbound_email_id => @inbound_email.id)\n unless @meantItRel.errors.empty?\n @error_obj_arr << @meantItRel\n error_display(\"Error creating meantItRel 'sender_endPoint.id:#{@sender_endPoint.id}, message_type:#{@meantItRel.message_type}, @receiver_endPoint.id#{@receiver_endPoint.id}':#{@meantItRel.errors}\", @meantItRel.errors, :error, logtag)\n return\n end # end unless @meantItRel.errors.empty?\n logger.info(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, created meantItRel, @meantItRel.inspect:{@meantItRel.inspect}\")\n if @meantItRel.errors.empty?\n if message_type_str == MeantItMessageTypeValidator::MEANT_IT_MESSAGE_OTHER\n # Call mood reasoner\n # CODE!!!!! Implement this in ControllerHelper\n else\n logger.debug(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}: creating mood using message_type_str:#{message_type_str}\")\n mood_tag_cond = \"found\"\n @new_mood_tag = Tag.find_or_create_by_name_and_desc(message_type_str, MeantItMoodTagRel::MOOD_TAG_TYPE) do |tag_obj|\n mood_tag_cond = \"created\"\n end # end Tag.find_or_create_by ...\n logger.info(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, #{mood_tag_cond} mood_tag:#{message_type_str}\")\n unless @new_mood_tag.errors.empty?\n @error_obj_arr << @new_mood_tag\n error_display(\"Error creating new_mood_tag '#{message_type_str}':#{@new_mood_tag.errors}\", @new_mood_tag.errors, :error, logtag)\n return\n end # end unless @new_mood_tag.errors.empty?\n @meantItRel.tags << @new_mood_tag\n logger.info(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}, created MeantItMoodTagRel.tag\")\n end # end if message_type_str == MeantItMessageTypeValidator:: ...\n end # end if @meantItRel.errors.empty?\n end # end if !@sender_endPoint.nil? and !@receiver_endPoint.nil? and !@inbound_email.nil?\n # Things that require 200 otherwise they'll keep resending, e.g.\n # sendgrid\n if self.request.path.match(/#{Constants::SENDGRID_PARSE_URL}/)\n render :xml => @inbound_email, :status => 200\n return\n end # end if self.request.path.match(/#{Constants::SENDGRID_PARSE_URL}/)\n # This is from meant_it find/send main page\n if self.request.path.match(/send_inbound_emails/)\n if !@sender_pii.nil? and !@receiver_pii.nil?\n logger.debug(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}: send_inbound_emails: @sender_pii.inspect:#{@sender_pii.inspect}, @receiver_pii.inspect:#{@receiver_pii.inspect}, message_type_str:#{message_type_str}\")\n # Check for space\n sender_pii_pii_value_str = @sender_pii.pii_value\n receiver_pii_pii_value_str = @receiver_pii.pii_value\n if !@sender_pii.pii_value.scan(' ').empty?\n sender_pii_pii_value_str = \"'#{@sender_pii.pii_value}'\"\n end # end if @sender_pii.pii_value.scan(' ').empty?\n if !@receiver_pii.pii_value.scan(' ').empty?\n receiver_pii_pii_value_str = \"'#{@receiver_pii.pii_value}'\"\n end # end if @receiver_pii.pii_value.scan(' ').empty?\n find_any_input_str = \"#{sender_pii_pii_value_str} #{message_type_str} #{receiver_pii_pii_value_str}\"\n logger.debug(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}: @sender_pii.inspect:#{@sender_pii.inspect}, @receiver_pii.inspect:#{@receiver_pii.inspect}, message_type_str:#{message_type_str}, find_any_input_str:#{find_any_input_str}\")\n#20111017 render \"/find_any/show_pii_pii_with_message_type.html.erb\", :layout => \"find_any\", :locals => { :notice => nil, :sender_pii => @sender_pii, :receiver_pii => @receiver_pii, :message_type => message_type_str, :find_any_input => find_any_input_str }\n if return_url.nil?\n render \"/home/index\", :layout => \"find_any\", :locals => { :notice => nil }\n else\n redirect_to(return_url)\n end # end if return_url.nil?\n elsif !@sender_pii.nil? and @receiver_pii.nil? and !@receiver_endPoint.nil?\n sender_pii_pii_value_str = @sender_pii.pii_value\n if !@sender_pii.pii_value.scan(' ').empty?\n sender_pii_pii_value_str = \"'#{@sender_pii.pii_value}'\"\n end # end if @sender_pii.pii_value.scan(' ').empty?\n find_any_input_str = \"#{sender_pii_pii_value_str} #{message_type_str} #{@receiver_endPoint.nick}\"\n logger.debug(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:create:#{logtag}: @sender_pii.inspect:#{@sender_pii.inspect}, @receiver_endPoint.inspect#{@receiver_endPoint.inspect}, message_type_str:#{message_type_str}, find_any_input_str:#{find_any_input_str}\")\n#20111017 render \"/find_any/show_endpoints_pii_with_message_type\", :layout => \"find_any\", :locals => { :notice => nil, :endPoints => [@receiver_endPoint], :pii => @sender_pii, :message_type => message_type_str, :find_any_input => find_any_input_str }\n if return_url.nil?\n render \"/home/index\", :layout => \"find_any\", :locals => { :notice => nil }\n else\n redirect_to(return_url)\n end # end if params[Constants::RETURN_URL_INPUT].nil?\n end # end if !@sender_pii.nil? ...\n return\n end # end if self.request.path.match(/send_inbound_emails/)\n respond_to do |format|\n format.html { redirect_to(@inbound_email, :notice => 'Inbound email was successfully created.') }\n format.xml { render :xml => @inbound_email, :status => :created, :location => @inbound_email }\n#puts \"InboundEmail, @inbound_email.errors:#{@inbound_email.errors.inspect}\"\n end\n end", "def build_exception\n begin\n klopfer!\n rescue => e\n return e\n end\n end", "def exception_info(e)\n backtrace = Array(e.backtrace)[0, 500]\n\n res = {\n 'class' => e.class.to_s,\n 'message' => e.message,\n 'backtrace' => backtrace.join(\"\\n\"),\n 'rollup' => Digest::MD5.hexdigest(\"#{e.class}#{backtrace[0]}\")\n }\n\n if original = (e.respond_to?(:original_exception) && e.original_exception)\n remote_backtrace = []\n remote_backtrace << original.message\n if original.backtrace\n remote_backtrace.concat(Array(original.backtrace)[0,500])\n end\n res['remote_backtrace'] = remote_backtrace.join(\"\\n\")\n end\n\n res\n end", "def model_exception(e)\n\t puts e\n\tend", "def send_exception_to_honeybadger(exception_info)\n exception = exception_info.exception\n exception_description = exception_info.exception_description\n\n # Note: Both commas and spaces are treated as delimiters for the :tags string. Space-delimiters are not officially documented.\n # https://github.com/honeybadger-io/honeybadger-ruby/pull/422\n tags = (honeybadger_auto_tags(exception) + exception_info.honeybadger_tags).join(' ')\n response = Honeybadger.notify(error_class: exception_description ? exception_description.filter_name : exception.class.name,\n error_message: exception.message.to_s,\n exception: exception,\n context: exception_info.honeybadger_context_data,\n controller: exception_info.controller_name,\n tags: tags)\n response ? :success : :failure\n rescue Exception => ex\n warn(\"ExceptionHandling.send_exception_to_honeybadger rescued exception while logging #{exception_info.exception_context}:\\n#{exception.class}: #{exception.message}:\\n#{ex.class}: #{ex.message}\\n#{ex.backtrace.join(\"\\n\")}\")\n write_exception_to_log(ex, \"ExceptionHandling.send_exception_to_honeybadger rescued exception while logging #{exception_info.exception_context}:\\n#{exception.class}: #{exception.message}\", exception_info.timestamp)\n :failure\n end", "def exception(arg0, arg1, *rest)\n end" ]
[ "0.7119154", "0.65862703", "0.65387523", "0.63619196", "0.62228584", "0.6163275", "0.6152219", "0.604346", "0.60348225", "0.6014422", "0.590377", "0.5896904", "0.58777493", "0.5850866", "0.57773083", "0.57716084", "0.57681847", "0.5699557", "0.56877905", "0.56654406", "0.5660795", "0.5651337", "0.5651337", "0.5648832", "0.5632877", "0.5632387", "0.5581501", "0.5560017", "0.5526429", "0.5526429", "0.5493646", "0.54596007", "0.5455538", "0.5417962", "0.5400509", "0.53482527", "0.53465945", "0.53096926", "0.5306354", "0.5298927", "0.5298704", "0.529748", "0.5282634", "0.5264284", "0.5256629", "0.52558935", "0.5250987", "0.52472425", "0.52472425", "0.521886", "0.52151346", "0.52136946", "0.521164", "0.5209914", "0.5187194", "0.51804405", "0.51804405", "0.5163082", "0.51488787", "0.51405483", "0.5127018", "0.5115529", "0.5114787", "0.5098449", "0.5090578", "0.508733", "0.50781673", "0.50772095", "0.50743836", "0.50714004", "0.5067984", "0.50451624", "0.5043327", "0.50397813", "0.50384414", "0.5037956", "0.50286937", "0.5022792", "0.5016196", "0.5015501", "0.5011448", "0.49912763", "0.49664837", "0.49646133", "0.49564514", "0.49554363", "0.49513322", "0.49372068", "0.49349466", "0.4933815", "0.4922284", "0.49156147", "0.4910153", "0.4906334", "0.49017864", "0.49016395", "0.4893065", "0.48844364", "0.48803097", "0.48760268" ]
0.6885798
1
rescue any exceptions within the given block, send it to exceptional, then raise
def rescue(&block) begin block.call rescue Exception => e self.catch(e) raise(e) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_and_convert_exceptions(&block)\n block.call\n rescue *self.class.expected_errors => e\n raise self.class.horza_error_from_orm_error(e.class).new(e.message)\n end", "def do_yield(&block)\n begin\n block.call\n rescue Exception => e\n puts \"Exception! #{e.to_s}\"\n Rails.logger.error \"Caught exception: #{e.to_s}\"\n raise e\n end\n end", "def rescue_action(e) raise e end", "def rescue_action(e) raise e end", "def rescue_action(e) raise e end", "def rescue_action(e) raise e end", "def ignore_raise\n yield\nrescue StandardError\n :raised\nend", "def rescue_action(e); raise e; end", "def catch_exceptions\n begin\n yield\n rescue\n rollback\n raise\n end\n end", "def log_exceptions\n yield\n rescue Exception => e\n self.exception e\n raise e\n end", "def raise(exception); end", "def safely(&block)\r\n begin\r\n yield\r\n rescue Exception => e\r\n if e.message =~ /connection was aborted/\r\n puts \" [yp searcher] Error: #{e} #{e.message}. Continuing.\"\r\n end\r\n end\r\n end", "def catch_exceptions\n begin\n yield\n rescue Exception\n rollback\n raise\n end\n end", "def _catch_warden(&block); end", "def try &bk\n yield\n rescue Exception => ex\n ex\n end", "def CATCH(exception_klass, &block)\n yield\n rescue ::Exception\n if $!.instance_of?(exception_klass)\n pass\n else\n failure(\"Faced a exception, that instance of #{exception_klass}.\",\n \"Faced a exception, that instance of #{$!.class}.\", 2)\n end\n else\n failure(\"Faced a exception, that instance of #{exception_klass}.\",\n 'The block was not faced any exceptions.', 2)\n ensure\n _declared!\n end", "def regardless(&block)\n yield\nrescue\nend", "def execute_with_rescue(&block)\n begin\n yield block\n rescue Flickr::Error => ex\n self.error_messages ||= []\n self.error_messages << {:date => Time.now, :msg => ex.message}\n if ex.message.match(/(User not found|Invalid auth token)/)\n self.status = 'inactive'\n end\n self.save\n return\n end\n end", "def rescue_from(exception); end", "def pass_exception\n throw :next_exception_handler\n end", "def handle_exceptions &block\n begin\n yield\n rescue RestClient::Exception => e\n Response.new(e.response, :error => e.message)\n end\n end", "def RESCUE(exception_klass, &block)\n fmt_err = ->err_cls { err_cls.ancestors.take_while { |mod| mod != Object }.join(' < ') }\n yield\n rescue exception_klass\n pass\n rescue ::Exception\n failure(\"Faced a exception, that kind of #{exception_klass}(#{fmt_err.call(exception_klass)}).\",\n \"Faced a exception, that instance of #{$!.class}(#{fmt_err.call($!.class)}).\", 2)\n else\n failure(\"Faced a exception, that kind of #{exception_klass}(#{fmt_err.call(exception_klass)}).\",\n 'The block was not faced any exceptions.', 2)\n ensure\n _declared!\n end", "def catch_sftp_exception(&block)\n yield block\n rescue Exception => e\n @errors.push(e.message)\n DevOn::print \"SFTP ERRORS\"\n DevOn::print @errors\n raise e.backtrace\n end", "def method_missing(m, *args, &block)\n begin\n return super(m, *args, &block)\n rescue Exception => exception\n @exception_handler.yield(exception)\n end\n end", "def execute_with_rescue\n yield if block_given?\n rescue Interrupt\n rescue_interrupt\n rescue => error\n log_error(error)\n end", "def ensure(&block)\n raise \"catch or each must be called before ensure\" unless @used\n block.call\n raise_if_failures\n end", "def refute_exception\n yield\n rescue StandardError => e\n flunk e.message\n end", "def raise_and_rescue \n begin \n puts 'Before the raise.' \n raise 'An error occured.' \n puts 'After the raise.' \n rescue \n puts 'Code rescued.' \n end \n puts 'After the begin block.' \n end", "def handle_exceptions_gracefully\n\n begin\n\n yield\n\n rescue => se\n\n Rails.logger.error(\"Exception in API: #{se.message} trace: #{se.backtrace}\")\n\n ExceptionNotifier.notify_exception(\n se,\n env: request.env\n )\n\n r = Result::Base.error(\n internal_id: 'ac_3',\n general_error_identifier: 'something_went_wrong'\n )\n\n return render_api_response(r)\n\n end\n\n end", "def _perform(&block)\n\n begin\n\n r = validate\n return r unless r.success?\n\n yield if block_given?\n\n mark_contract_event_as_processed\n\n success\n\n rescue StandardError => se\n\n mark_contract_event_as_failed\n\n return exception_with_data(\n se,\n 'cem_b_1',\n 'exception in contract event management: ' + se.message,\n 'Something went wrong.',\n GlobalConstant::ErrorAction.default,\n {contract_event_obj_id: @contract_event_obj.id}\n )\n\n end\n\n end", "def raise(*rest) end", "def raise(*rest) end", "def raise_rescue\n begin\n puts 'I am before the raise.'\n raise 'An error has occured.'\n puts 'I am after the raise.'\n rescue RuntimeError # 指定捕获异常的类型\n puts 'I am rescue!'\n end\n puts 'I am after the rescue.'\nend", "def one\n too { yield }\nendbegin;1;rescue => e1;e1;end", "def yield\n wait\n case result\n when Exception\n raise result\n else\n result\n end\n end", "def handle_exception(&block)\r\n yield\r\n\r\n rescue TypeError\r\n return Parsers::Message.invalid_type\r\n rescue Exception\r\n return Parsers::Message.unexpected_error\r\n end", "def catch_ssh_exception(&block)\n yield block\n rescue Exception => e\n @errors.push(e.message)\n DevOn::print \"SSH ERRORS\"\n DevOn::print @errors\n raise e.backtrace\n end", "def record_internal_exception\n yield\n rescue => e\n @internal_exception = e\n raise\n end", "def raise_exc\n raise\n rescue\n end", "def yield_rescued\n begin\n yield\n rescue Exception => e\n MONITORING_LOG.error e\n end\n end", "def ignore &block\n begin; block.call; rescue; end\n end", "def block_with_rescue(result_hash = {:result => false, :errors => []})\n begin\n ActiveRecord::Base.transaction do\n yield(result_hash)\n raise Exception if result_hash[:errors].any?\n end\n rescue Exception => e\n Rails.logger.error('*'*100)\n Rails.logger.error(e.message)\n Rails.logger.error('*'*100)\n result_hash[:result] = false\n result_hash[:errors] << 'Произошла непредвиденная ошибка. Попробуйте позже'\n end\n\n result_hash\n end", "def raise_exception\n\tbegin\n\t\tputs \"I am before the raise 1\"\n\t\traise 'An error has occured during the process'\n\t\tputs 'After the raise'\n\trescue\n\t\tputs 'Rescued for the first time'\n\tend\nend", "def raise_multiple_rescue\n begin\n puts 'I am before the raise.'\n raise 'An error has occured.'\n puts 'I am after the raise.'\n raise ArgumentError,\"参数错误!\"\n puts 'here'\n rescue RuntimeError # 指定捕获异常的类型\n puts 'I am RuntimeError rescue!'\n rescue ArgumentError\n puts \"I am ArgumentError resuce!\"\n else\n puts \"I am other resuce!\"\n end\n puts 'I am after the rescue.'\nend", "def safe_loop &block\n begin\n loop &block\n rescue => ex\n $log.debug( \"APP.rb rescue reached \")\n $log.debug( ex) if ex\n $log.debug(ex.backtrace.join(\"\\n\")) if ex\n ensure\n close\n # putting it here allows it to be printed on screen, otherwise it was not showing at all.\n if ex\n puts \"========== EXCEPTION ==========\"\n p ex \n puts \"===============================\"\n puts(ex.backtrace.join(\"\\n\")) \n end\n end\n end", "def catch_exceptions; end", "def error_handler(*args)\r\n puts \"1. Doing this, then yielding to the block\"\r\n yield\r\n # The following will run only if there wasn't an error.\r\n # Otherwise, we move straight to +rescue+\r\n puts \"3b. The block has finished running without an error\"\r\nrescue StandardError => ex\r\n puts ex.message\r\n puts \"4. If an error was raised, we retry this entire method, so ..\\n\"\r\n retry\r\nend", "def retry_block(options = {}, &block)\n options = {\n :retry => 1,\n :data => {},\n :type => StandardError\n }.merge(options)\n \n retries = case options[:retry]\n when true\n 1\n when Integer\n options[:retry]\n else\n 0\n end\n \n types = [ options[:type] ].flatten.compact\n \n begin\n yield\n rescue *types => ex\n if retries > 0\n return self.send(__method__, options.merge(:retry => retries - 1), &block)\n else\n notify_exception(ex, :data => options[:data], :raise => true)\n end\n end\n end", "def helper_nested_raise(*args)\n Proc.new{\n raise(*args)\n }.call\n end", "def log_on_error\n begin\n yield if block_given?\n rescue Exception => e\n logger.error \"IronNails Error: #{e}\"\n raise e\n end\n end", "def protect_runtime_errors # &block\n\t\tbegin\n\t\t\tyield\n\t\trescue StandardError => e\n\t\t\t# switch states first, in case extra messages need to be printed to contexualize the actual exception\n\t\t\tself.runtime_error()\n\t\t\t\n\t\t\t\n\t\t\t# keep execption from halting program,\n\t\t\t# but still output the exception's information.\n\t\t\tprint_wrapped_error(e)\n\t\t\t\n\t\t\t\n\t\tend\n\tend", "def safe_call# (&block)\n yield\n rescue Sunra::Utils::Recording::DBProxy::DBProxyError,\n Sunra::Recording::RecorderManager::RecorderError,\n APIError => e\n _error e\n end", "def propagate\n @propagate_exceptions = true\n end", "def each_exception_handler(&iterator); model.each_exception_handler(&iterator) end", "def on_uncaught_exception(&block)\n @channel.on_uncaught_exception(&block)\n end", "def raise_exc\n <<-CODE\n t1 = stack_pop();\n cpu_raise_exception(state, c, t1);\n CODE\n end", "def raise_and_rescue\n begin\n\tputs 'This is Before Exception Arise!'\n\n\t # using raise to create an exception\n\t raise 'Exception Created!'\n puts 'After Exception'\n\n # using Rescue method\n rescue\n\t puts 'Finally Saved!'\n\tend\n\nputs 'Outside from Begin Block!'\t\nend", "def raise(fiber, *arguments); end", "def run_with_rescue\n begin\n yield if block_given?\n rescue SystemExit\n end\nend", "def on_connection_exception(&block)\n @exception_block = block\n end", "def catch(on_reject=nil, &block)\n on_reject = block if block_given?\n return self.then(nil, on_reject)\n end", "def keep_it_in\n raise \"rawr\"\nrescue\n # ahem\nend", "def with_error_handling\n yield\n rescue => error\n report_error(error)\n Process.exit(false)\n end", "def rescue_standard_error\n yield\n rescue StandardError => e\n if ENV['RESCUE_EXCEPTION']\n nil\n else\n raise e\n end\n end", "def catch_errors(data = nil, view_config = nil, options = nil)\n begin\n yield\n\n rescue Rester::UnprocessableEntityException => e\n raise Ruminant::DataInvalidException.new(e.message)\n\n rescue Rester::AccessDeniedException => e\n raise Ruminant::AuthInvalidException.new(e.message)\n end\n end", "def handle_error(env = nil, &block)\n begin\n yield\n rescue Aws::DynamoDB::Errors::Base,\n Aws::SessionStore::DynamoDB::InvalidIDError => e\n @config.error_handler.handle_error(e, env)\n end\n end", "def with_exception_handling\r\n yield\r\n rescue Timeout::Error => exc\r\n return { code: Scrapers::StatusCodes::BLOCKED_REQUEST }\r\n rescue Exception => exc\r\n @logger.error(\"\\n#{self.class} error\")\r\n @logger.error(exc)\r\n @logger.error(exc.backtrace.join(\"\\n\"))\r\n @logger.error(body)\r\n\r\n return { code: Scrapers::StatusCodes::INTERNAL_ERROR }\r\n end", "def errback(&block)\n super do |*args|\n safe_deferrable_block(*args, &block)\n end\n end", "def try(&block)\n begin\n yield\n rescue Errno::ETIMEDOUT, Timeout::Error, Net::HTTPNotFound\n log \"Connection Error\"\n rescue Exception => exc\n log exc.message\n log exc.backtrace\n end\n end", "def catch_simple\n begin\n yield\n rescue => e\n Rails.logger.info e.message\n end\n end", "def capture_exception\n ex = nil\n begin\n yield\n rescue Exception => e\n ex = e\n end\n ex\nend", "def may_fail # block\n begin\n yield\n rescue\n end\nend", "def handling_kestrel_errors\n raise \"Needs a block!\" unless block_given?\n yield\n rescue KJess::Error => e\n check.critical(\"Error while talking to Kestrel(#{name}): #{e}\")\n end", "def f(&block)\n # The block is a proc.\n block.class == Proc or raise\n block.call\n end", "def capture(&block)\n if block\n begin\n block.call\n rescue Error => e\n raise # Don't capture Opbeat errors\n rescue Exception => e\n self.captureException(e)\n raise\n end\n else\n # Install at_exit hook\n at_exit do\n if $!\n logger.debug \"Caught a post-mortem exception: #{$!.inspect}\"\n self.capture_exception($!)\n end\n end\n end\n end", "def catch_exceptions\n yield\n rescue ActiveRecord::RecordNotFound\n render_record_not_found\n rescue ActiveRecord::RecordInvalid => e\n render_error e.message, 400\n rescue Exception => e\n Rails.logger.debug e.inspect\n Rails.logger.debug e.message.inspect\n e.backtrace.each {|l| Rails.logger.debug l.inspect }\n render_error e.message\n end", "def on_error(&block)\n @@error_block = block\n end", "def assert_raise(error_to_raise = Exception)\n begin\n # Dangerous Code\n yield\n rescue => the_error_object\n if the_error_object.class == error_to_raise\n print \".\"\n else\n print \"F\"\n end\n else\n print \"E\"\n end\n\nend", "def capture(&block)\n if block\n begin\n block.call\n rescue Error => e\n raise # Don't capture Raven errors\n rescue Exception => e\n evt = Event.capture_exception(e)\n send(evt) if evt\n raise\n end\n else\n # Install at_exit hook\n at_exit do\n if $!\n logger.debug \"Caught a post-mortem exception: #{$!.inspect}\"\n evt = Event.capture_exception($!)\n send(evt) if evt\n end\n end\n end\n end", "def each_exception_handler(&iterator)\n model.each_exception_handler(&iterator)\n end", "def rocket_job_fail_on_exception!(worker_name, re_raise_exceptions = false)\n yield\n rescue Exception => exc\n if failed? || !may_fail?\n self.exception = JobException.from_exception(exc)\n exception.worker_name = worker_name\n save! unless new_record? || destroyed?\n elsif new_record? || destroyed?\n fail(worker_name, exc)\n else\n fail!(worker_name, exc)\n end\n raise exc if re_raise_exceptions\n end", "def on_exception(&value)\n @on_exception = value if block_given?\n \n @on_exception\n end", "def execute_and_rescue\n begin\n yield if block_given?\n rescue SystemExit\n end\nend", "def on_error_in node_type, &block\n @exceptions[node_type] = block\n end", "def abort_on_exception=(*) end", "def action_wrapper\n begin\n yield\n rescue ::Rbt::Error::AuthError => e\n handle_auth_error(e)\n rescue ActiveRecord::RecordInvalid => e\n handle_validation_error(e)\n rescue => e\n handle_unknown_error(e)\n end\n end", "def on_exception(&blk)\n @on_exception = blk\n end", "def continued_exception; end", "def watch_yield\n current = currently_loaded_files\n new_exceptions = Array.new\n begin\n result = yield\n rescue Interrupt, SystemExit\n raise\n rescue Exception => e\n new_exceptions << e\n run_hook :on_exception, e\n exceptions << e\n # cross-drb exceptions are broken w.r.t. #backtrace_locations. It\n # returns a string in their case. Since it happens only on\n # exceptions that originate from the server (which means a broken\n # Roby codepath), let's just ignore it\n if !e.backtrace_locations.kind_of?(String)\n backtrace = e.backtrace_locations.map { |l| Pathname.new(l.absolute_path) }\n else\n STDERR.puts \"Caught what appears to be a cross-drb exception, which should not happen\"\n STDERR.puts e.message\n STDERR.puts e.backtrace.join(\"\\n \")\n backtrace = Array.new\n end\n error_paths.merge(backtrace)\n if e.kind_of?(LoadError) && e.path\n error_paths << Pathname.new(e.path)\n end\n end\n required_paths.merge(currently_loaded_files - current)\n return result, new_exceptions\n end", "def render_or_pass(&block)\n begin yield\n rescue Exception => e\n logger.error e.message\n pass\n end\n end", "def reraise(exceptions)\n if exceptions.size == 1\n e = exceptions.first\n if e.kind_of?(Roby::ExecutionException)\n e = e.exception\n end\n raise e, e.message, e.backtrace\n else\n raise Aborting.new(exceptions.map(&:exception))\n end\n end", "def reraise\n raise $!.class, $!.message, caller[1..-1]\nend", "def handle_error(e)\n raise e\n end", "def on_error(&block)\n block_given? ? @_on_error = block : @_on_error\n end", "def on_error(&block)\n block_given? ? @_on_error = block : @_on_error\n end", "def on_error(&block)\n block_given? ? @_on_error = block : @_on_error\n end", "def on_error(&block)\n if block_given?\n @on_error = block\n self\n else\n @on_error\n end\n end", "def raise_exception \n puts 'I am before the raise.' \n raise 'An error has occuredzzzz' \n puts 'I am after the raise' \nend", "def catch_exceptions\n yield\n rescue Accounts::MegamAPIError => mai\n ascii_bomb\n puts_stacktrace(mai)\n # notify hipchat, send an email to [email protected] which creates a support ticket.\n # redirect to the users last visited page.\n if !signed_in?\n #gflash error: \"#{mai.message}\"\n redirect_to(signin_path, flash: { api_error: 'api_error' }) && return\n else\n # gflash error: \"#{mai.message}\"\n redirect_to(cockpits_path, flash: { api_error: 'api_error' }) && return\n end\n end" ]
[ "0.7244392", "0.70046616", "0.69982564", "0.69982564", "0.69982564", "0.69982564", "0.6924747", "0.69211155", "0.67805254", "0.6756068", "0.6744988", "0.6740115", "0.6734472", "0.6724487", "0.6700559", "0.6652584", "0.66431344", "0.66384596", "0.6630474", "0.65376484", "0.65002584", "0.6480393", "0.64769477", "0.64687926", "0.6448649", "0.64213806", "0.6416515", "0.639575", "0.63800013", "0.6344574", "0.63336676", "0.63336676", "0.632635", "0.6320845", "0.6319474", "0.63160187", "0.6309529", "0.6282334", "0.62750864", "0.6250569", "0.6224913", "0.6224883", "0.6222661", "0.6220384", "0.61825323", "0.6177017", "0.6151604", "0.6146714", "0.61395425", "0.61326724", "0.61272305", "0.61205554", "0.61043733", "0.608879", "0.60614836", "0.6058002", "0.6045293", "0.6031787", "0.60256165", "0.6023934", "0.60072196", "0.5998263", "0.5983993", "0.5977069", "0.5976581", "0.5970345", "0.59545946", "0.5951455", "0.5950362", "0.5937225", "0.592482", "0.5921458", "0.5919725", "0.59159374", "0.5915369", "0.5909397", "0.58923024", "0.5884004", "0.586038", "0.58548677", "0.5852504", "0.5846656", "0.58403414", "0.58354765", "0.5823676", "0.5810711", "0.5800788", "0.5798533", "0.5792761", "0.5786152", "0.57822716", "0.5775614", "0.5772732", "0.57704324", "0.57704324", "0.57704324", "0.5767879", "0.57618827", "0.57501197" ]
0.7608781
1
post the given exception data to getexceptional.com
def post(exception_data) hash = exception_data.to_hash if hash[:session] hash[:session].delete("initialization_options") hash[:session].delete("request") end Exceptional.post_exception(hash.to_json) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(exception_data)\n hash = exception_data.to_hash\n hash[:session].delete(\"initialization_options\")\n hash[:session].delete(\"request\")\n call_remote(:errors, hash.to_json)\n end", "def handle_exception(data)\n logger.warn \"Got exception from remote call of #{data[\"action\"]}: #{data[\"message\"]}\"\n end", "def exception_with_data(e, code, msg, data = {})\n\n OstKycSdkRuby::Util::Result.exception(\n e, {\n error: code,\n error_message: msg,\n data: data\n }\n )\n\n end", "def hubssolib_set_exception_data(e)\n HubSsoLib::Crypto.encode_object(e.message, request.remote_ip)\n end", "def post_exception(options={})\n # Don't throw our own errors\n begin\n require 'net/http'\n require 'net/https'\n \n url = URI.parse options[:url]\n req = Net::HTTP::Post.new(url.path, 'Content-type' => 'text/plain; charset=utf-8')\n if options[:username] and options[:password]\n req.basic_auth options[:username], options[:password]\n end\n \n req.body = ''\n if options[:environment]\n ForestWatcher::ENVIRONMENT_MAP.each do |item|\n key = item[1..-1].find { |key| options[:environment][key] }\n req.body << \"#{item[0]}: #{options[:environment][key]}\\n\" if key\n end\n end\n if options[:params]\n req.body << \"Params : #{options[:params].inspect}\\n\"\n end\n if options[:exception]\n req.body << \"Exception : #{options[:exception].inspect}\\n\"\n end\n if options[:environment]\n req.body << \"\\n--- Environment\\n\\n\" unless req.body.empty?\n req.body << \"#{options[:environment].inspect}\\n\"\n end\n if options[:exception].respond_to?(:backtrace)\n req.body << \"\\n--- Backtrace\\n\\n\"\n req.body << options[:exception].backtrace.join(\"\\n\")\n end\n \n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true if url.scheme == 'https'\n res = http.start { |http| http.request(req) }\n unless res.code == '200'\n logger.info \"Failed to send error to: #{options[:url]} (#{res.inspect})\"\n end\n rescue Exception => e\n logger.info \"Failed to send error to: #{options[:url]} (#{e.message})\"\n end\n end", "def post_sqreen_exception(exception)\n post('sqreen_exception', exception.to_hash, {}, 5)\n rescue *NET_ERRORS => e\n Sqreen.log.warn(format('Could not post exception (network down? %s) %s',\n e.inspect,\n exception.to_hash.inspect))\n nil\n end", "def serve_exception(_exception); end", "def handle_exception(e, env)\n trace = e.backtrace.join \"\\n\"\n Tom::Log.logger.info e\n Tom::Log.logger.info trace\n [500, {}, {error: e,\n stacktrace: trace,\n url: env[\"REQUEST_URI\"]\n }.to_json]\n end", "def hubssolib_get_exception_data(data)\n HubSsoLib::Crypto.decode_object(data, request.remote_ip)\n end", "def failure(exception, input_variables={})\n variables_information = \"Input variables are #{input_variables.inspect}\\n\\n\" if input_variables.present?\n self.class.post_raw(\"#{collection_path}/#{id}/failure\",\n workerId: worker_id, errorMessage: exception.message,\n errorDetails:\n variables_information.to_s + exception.message +\n backtrace_cleaner.clean(exception.backtrace).join(\"\\n\"))[:response]\n end", "def exception(params)\n update_attributes(\n {\n :res_message => \"Exception\",\n :status => 'EXCEPTION'\n }.merge(params)\n )\n end", "def report_exception(service_class, service_data, exception)\n backtrace = Array(exception.backtrace)[0..500]\n\n data = {\n 'app' => 'github-services',\n 'type' => 'exception',\n 'class' => exception.class.to_s,\n 'server' => settings.hostname,\n 'message' => exception.message[0..254],\n 'backtrace' => backtrace.join(\"\\n\"),\n 'rollup' => Digest::MD5.hexdigest(exception.class.to_s + backtrace[0]),\n 'service' => service_class.to_s\n }\n\n if exception.kind_of?(Service::Error)\n if exception.original_exception\n data['original_class'] = exception.original_exception.to_s\n data['backtrace'] = exception.original_exception.backtrace.join(\"\\n\")\n data['message'] = exception.original_exception.message[0..254]\n end\n elsif !exception.kind_of?(Service::TimeoutError)\n data['original_class'] = data['class']\n data['class'] = 'Service::Error'\n end\n\n if service_class == Service::Web\n data['service_data'] = service_data.inspect\n end\n\n if settings.hostname =~ /^sh1\\.(rs|stg)\\.github\\.com$/\n # run only in github's production environment\n Net::HTTP.new('haystack', 80).\n post('/async', \"json=#{Rack::Utils.escape(data.to_json)}\")\n else\n $stderr.puts data[ 'message' ]\n $stderr.puts data[ 'backtrace' ]\n end\n\n rescue => boom\n $stderr.puts \"reporting exception failed:\"\n $stderr.puts \"#{boom.class}: #{boom}\"\n $stderr.puts \"#{boom.backtrace.join(\"\\n\")}\"\n # swallow errors\n end", "def exception_data\n exception_service.merge(\n error_class: @exception.class.to_s,\n message: @exception.respond_to?(:message) ? @exception.message : exception.inspect,\n backtrace: @exception.respond_to?(:backtrace) ? (@exception.backtrace || []).join(\"\\n\") : nil,\n cause: @exception.respond_to?(:cause) ? @exception.cause : nil\n )\n end", "def postFailResult(exception,caseId)\n puts \"----------------------------------------------------------------------------------\"\n puts \"\"\n puts exception\n caseInfo = @testRailUtility.getCase(caseId)\n #puts \"$$$$$$$$$$$$$$$$$$$$$\"\n #puts caseInfo['id']\n @passedLogs = @objRollbar.addLog(\"[Result ] Failed\")\n @passedLogs = @objRollbar.addLog(\"#{exception}\")\n #puts \"postResult---->#{@passedLogs[caseInfo['id'].to_s]}\"\n #puts @passedLogs[caseInfo['id']]\n @objRollbar.postRollbarData(caseInfo['id'], caseInfo['title'], @passedLogs[caseInfo['id'].to_s])\n #puts \"&&&&&&&&&&&&&&&&&&&\"\n Rollbar.error(exception)\n @testRailUtility.postResult(caseId,\"Result for case #{caseId} is #{@passedLogs[caseInfo['id'].to_s]}\",5,@runId)\n raise exception\nend", "def report_exception(service_class, service_data, exception, options = {})\n error = (exception.respond_to?(:original_exception) &&\n exception.original_exception) || exception\n backtrace = Array(error.backtrace)[0..500]\n\n data = {\n 'app' => 'pay4bugs-hooks',\n 'type' => 'exception',\n 'class' => error.class.to_s,\n 'server' => settings.hostname,\n 'message' => error.message[0..254],\n 'backtrace' => backtrace.join(\"\\n\"),\n 'rollup' => Digest::MD5.hexdigest(\"#{error.class}#{backtrace[0]}\"),\n 'service' => service_class.to_s,\n }.update(options)\n\n # if service_class == Hook::Web\n # data['service_data'] = service_data.inspect\n # end\n\n #if settings.hostname =~ /^sh1\\.(rs|stg)\\.github\\.com$/\n # # run only in github's production environment\n # Net::HTTP.new('haystack', 80).\n # post('/async', \"json=#{Rack::Utils.escape(data.to_json)}\")\n #else\n $stderr.puts data[ 'message' ]\n $stderr.puts data[ 'backtrace' ]\n #end\n\n rescue => boom\n $stderr.puts \"reporting exception failed:\"\n $stderr.puts \"#{boom.class}: #{boom}\"\n $stderr.puts \"#{boom.backtrace.join(\"\\n\")}\"\n # swallow errors\n end", "def process_exception(exception)\n exception_data = {\n :exception =>\n { :class => exception.class,\n :message => exception.message,\n :backtrace => exception.backtrace.map { |l| \"\\t#{l}\" }.join(\"\\n\")\n }\n }\n end", "def exception(exception, status)\n @current_step[:exception] = build_exception_detail(exception)\n end", "def send_error(e, res)\n res.code = 500\n res['Content-Type'] = 'application/json'\n body = { code: -1, error: \"#{e.class}: #{e.message}\" }\n body[:backtrace] = e.backtrace\n res.body = @shell.data(body).json(@shell.indent)\n @shell.logger.warn(Impl.format_error(e))\n\tend", "def handle_request_error(exception)\n end", "def vuln_exception_resubmit(input)\n options = {}\n\n if input.nil?\n raise ArgumentError.new 'The input element cannot be null'\n end\n\n exception_id = input[:exception_id]\n unless exception_id\n raise ArgumentError.new 'The exception ID is required'\n end\n options['exception-id'] = exception_id\n\n reason = input[:reason]\n if !reason.nil? && !reason.empty?\n unless reason =~ /False Positive|Compensating Control|Acceptable Use|Acceptable Risk|Other/\n raise ArgumentError.new 'The reason type is invalid'\n end\n options['reason'] = reason\n\n end\n\n xml = make_xml('VulnerabilityExceptionResubmitRequest', options)\n\n comment = input[:comment]\n if comment && !comment.empty?\n comment_xml = make_xml('comment', {}, comment, false)\n xml.add_element comment_xml\n end\n\n r = execute xml, '1.2'\n r.success\n end", "def exception\n\t\t@exception\n\tend", "def send_error(e, res)\n res.status = 500\n res['Content-Type'] = 'application/json'\n body = { code: -1, error: \"#{e.class}: #{e.message}\" }\n body[:backtrace] = e.backtrace\n res.body = @shell.data(body).json(@shell.indent)\n @shell.logger.warn(Impl.format_error(e))\n\tend", "def hubssolib_get_exception_message(id_data)\n hubssolib_get_exception_data(CGI::unescape(id_data))\n end", "def save\n return unless deliver?\n return unless response = http_post_request\n\n if response.code == '200'\n log \"success - api accepted the exception data.\"\n else\n body = response.body if response.respond_to? :body\n log \"fail - expected: 200 OK, received: #{response.code} #{response.message}\"\n end\n end", "def catch(exception)\n exception_data = parse(exception)\n exception_data.controller_name = File.basename($0)\n post(exception_data)\n end", "def send_exception_to_honeybadger(exception_info)\n exception = exception_info.exception\n exception_description = exception_info.exception_description\n\n # Note: Both commas and spaces are treated as delimiters for the :tags string. Space-delimiters are not officially documented.\n # https://github.com/honeybadger-io/honeybadger-ruby/pull/422\n tags = (honeybadger_auto_tags(exception) + exception_info.honeybadger_tags).join(' ')\n response = Honeybadger.notify(error_class: exception_description ? exception_description.filter_name : exception.class.name,\n error_message: exception.message.to_s,\n exception: exception,\n context: exception_info.honeybadger_context_data,\n controller: exception_info.controller_name,\n tags: tags)\n response ? :success : :failure\n rescue Exception => ex\n warn(\"ExceptionHandling.send_exception_to_honeybadger rescued exception while logging #{exception_info.exception_context}:\\n#{exception.class}: #{exception.message}:\\n#{ex.class}: #{ex.message}\\n#{ex.backtrace.join(\"\\n\")}\")\n write_exception_to_log(ex, \"ExceptionHandling.send_exception_to_honeybadger rescued exception while logging #{exception_info.exception_context}:\\n#{exception.class}: #{exception.message}\", exception_info.timestamp)\n :failure\n end", "def handle_exception e\n response.headers['Content-Type'] = 'application/json'\n response.body = { message: e.message, backtrace: e.backtrace }.to_json\n end", "def exception_with_internal_code(e, code, msg, internal_code, data = {})\n\n Result::Base.exception(\n e, {\n error: code,\n error_message: msg,\n data: data,\n http_code: internal_code\n }\n )\n end", "def exception(*rest) end", "def api_post(endpoint, key, data)\n tries ||= 3\n response = do_post(endpoint, key, data)\n raise unless response.code == '200'\n return if response.body.empty?\n parsed = Oj.load(response.body)\n raise unless parsed['success']\n parsed['data']\n rescue StandardError => e\n tries -= 1\n sleep 2 && retry unless tries.zero?\n log_error(e, update_service: @update_service,\n sentry_extra: { query: data,\n response_body: response&.body,\n language: @wiki.language,\n project: @wiki.project })\n end", "def my_rescue_action_in_public(exception)\n # MorLog.my_debug exception.to_yaml\n # MorLog.my_debug exception.backtrace.to_yaml\n time = Time.now()\n id = time.strftime(\"%Y%m%d%H%M%S\")\n address = '[email protected]'\n extra_info = \"\"\n swap = nil\n begin\n MorLog.my_debug(\"Rescuing exception: #{exception.class.to_s} controller: #{params[:controller].to_s}, action: #{params[:action].to_s}\", true)\n if important_exception(exception)\n MorLog.my_debug(\" >> Exception is important\", true)\n MorLog.log_exception(exception, id, params[:controller].to_s, params[:action].to_s) if params[:do_not_log_test_exception].to_i == 0\n\n trace = exception.backtrace.collect { |t| t.to_s }.join(\"\\n\")\n\n exception_class = escape_for_email(exception.class).to_s\n exception_class_previous = Confline.get_value(\"Last_Crash_Exception_Class\", 0).to_s\n exception_send_email = Confline.get_value(\"Exception_Send_Email\").to_i\n\n # Lots of duplication but this is due fact that in future there may be\n # need for separate link for every error.\n flash_help_link = nil\n\n\n if exception_class.include?(\"Net::SMTPFatalError\")\n flash_notice = _('smtp_server_error')\n flash_help_link = \"\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'smtp_server_error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Errno::ENETUNREACH\")\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_Errno::ENETUNREACH\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Errno::EACCES\")\n flash_notice = _('File_permission_error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'File_permission_error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Errno::EHOSTUNREACH\") or (exception_class.include?(\"Errno::ECONNREFUSED\") and trace.to_s.include?(\"rami.rb:380\"))\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_SystemExit\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"SystemExit\") or (exception_class.include?('RuntimeError') and (exception.message.include?('No route to host') or exception.message.include?('getaddrinfo: Name or service not known') or exception.message.include?('Connection refused')))\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_SystemExit\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n end\n\n if exception_class.include?('RuntimeError') and (exception.message.include?('Connection timed out') or exception.message.include?('Invalid argument') or exception.message.include?('Connection reset by peer') or exception.message.include?('Network is unreachable') or exception.message.include?('exit'))\n flash_notice = _('Your_Asterisk_server_is_not_accessible_Please_check_if_address_entered_is_valid_and_network_is_OK')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n exception_send_email = 0\n end\n\n if exception_class.include?(\"SocketError\") and !trace.to_s.include?(\"smtp_tls.rb\")\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_SystemExit\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n end\n if exception_class.include?(\"Errno::ETIMEDOUT\")\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_SystemExit\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n exception_send_email = 0\n end\n\n if exception_class.include?(\"OpenSSL::SSL::SSLError\") or exception_class.include?(\"OpenSSL::SSL\")\n flash_notice = _('Verify_mail_server_details_or_try_alternative_smtp_server')\n flash_help_link = ''\n exception_send_email = 0\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'SMTP_connection_error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"ActiveRecord::RecordNotFound\")\n flash_notice = _('Data_not_found')\n flash_help_link = ''\n exception_send_email = 1\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Data_not_found', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"ActiveRecord::StatementInvalid\") and exception.message.include?('Access denied for user')\n flash_notice = _('MySQL_permission_problem_contact_Kolmisoft_to_solve_it')\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'MySQL_permission_problem', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Transactions::TransactionError\")\n flash_notice = _(\"Transaction_error\")\n swap = []\n swap << %x[vmstat]\n # swap << ActiveRecord::Base.connection.select_all(\"SHOW INNODB STATUS;\")\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Transaction_errors', :data2 => exception.message).save\n exception_send_email = 0\n end\n\n if exception_class.include?(\"Errno::ENOENT\") and exception.message.include?('/tmp/mor_debug_backup.txt')\n flash_notice = _('Backup_file_not_found')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Backup_file_not_found', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"GoogleCheckoutError\") and exception.message.include?(\"No seller found with id\")\n flash_notice = _('Internal_Error_Contact_Administrator')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n # database not updated\n if exception_class.include?(\"NoMethodError\") and !exception.message.include?(\"nil:NilClass\") and exception.message.include?(\"for #<\")\n flash_notice = _('Database_Error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Database_Error', :data2 => exception.message).save\n end\n if exception_class.include? \"ActiveModel::MissingAttributeError\"\n flash_notice = _('Database_Error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Database_Error', :data2 => exception.message).save\n end\n if exception_class.include?(\"ActiveRecord::StatementInvalid\") and exception.message.include?(\"Unknown column\")\n flash_notice = _('Database_Error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Database_Error', :data2 => exception.message).save\n end\n #\n\n if exception_class.include?(\"GoogleCheckoutError\") and exception.message.include?(\"The currency used in the cart must match the currency of the seller account.\")\n flash_notice = _('Internal_Error_Contact_Administrator')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Google4R\") and exception.message.include?(\"Missing URL component: expected id:\")\n flash_notice = _('Internal_Error_Contact_Administrator')\n flash_help_link = ''\n exception_send_email = 0\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Google4R\") and exception.message.include?('expected id: (\\d{10})|(\\d{15})')\n flash_notice = _(\"Payment_Error_Contact_Administrator_enter_merchant_id\")\n flash_help_link = ''\n exception_send_email = 0\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Google4R\") and exception.message.include?('Seller Account') and exception.message.include?('is not active.')\n flash_notice = _(\"Payment_Error_Contact_Administrator_account_not_active\")\n flash_help_link = ''\n exception_send_email = 0\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception.message.include?('Unexpected response code')\n flash_notice = _(\"Google_checkout_error\") + ': ' + exception.message.to_s #.gsub('Google Unexpected response code', 'Unexpected response code')\n flash_help_link = ''\n exception_send_email = 0\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception.message.include?('An API Certificate or API Signature is required to make requests to PayPal')\n flash_notice = _('An_API_Certificate_or_API_Signature_is_required_to_make_requests_to_PayPal')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception.message.include?('Temporary failure in name resolution')\n flash_notice = _('DNS_Error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'DNS_Error', :data2 => exception.message).save\n end\n\n if exception.message.include?('Ambethia::ReCaptcha::Controller::RecaptchaError')\n flash_notice = _('ReCaptcha_Error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'ReCaptcha_Error', :data2 => exception.message).save\n end\n\n #if exception_class.include?(\"Net::SMTP\") or (exception_class.include?(\"Errno::ECONNREFUSED\") and trace.to_s.include?(\"smtp_tls.rb\")) or (exception_class.include?(\"SocketError\") and trace.to_s.include?(\"smtp_tls.rb\")) or ((exception_class.include?(\"Timeout::Error\") and trace.to_s.include?(\"smtp.rb\"))) or trace.to_s.include?(\"smtp.rb\")\n flash_help_link = email_exceptions(exception) if flash_help_link.blank? and flash_notice.blank?\n #end\n\n if exception_class.include?(\"LoadError\") and exception.message.to_s.include?('locations or via rubygems.')\n if exception.message.include?('cairo')\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/Cannot_generate_PDF\"\n else\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_Ruby_Gems\"\n end\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Ruby_gems_not_found', :data2 => exception.message).save\n exception_send_email = 0\n end\n\n # Specific case for acunetix security scanner\n if (exception.message.include?('invalid byte sequence in UTF-8') or exception.message.include?('{\"$acunetix\"=>\"1\"}')) and ['try_to_login', 'signup_end'].member?(params[:action])\n flash_notice = _('Internal_Error_Contact_Administrator')\n exception_send_email = 0\n end\n\n if exception_send_email == 1 and exception_class != exception_class_previous and !flash_help_link or params[:this_is_fake_exception].to_s == \"YES\"\n MorLog.my_debug(\" >> Need to send email\", true)\n\n if exception_class.include?(\"NoMemoryError\")\n extra_info = get_memory_info\n MorLog.my_debug(extra_info)\n end\n\n # Gather all exception\n rep, rev, status = get_svn_info\n rp = []\n (params.each { |k, v| rp << [\"#{k} => #{v}\"] })\n\n message = [\n \"ID: #{id.to_s}\",\n \"IP: #{request.env['SERVER_ADDR']}\",\n \"Class: #{exception_class}\",\n \"Message: #{exception}\",\n \"Controller: #{params[:controller]}\",\n \"Action: #{params[:action]}\",\n \"User ID: #{session ? session[:user_id].to_i : 'possible_from_api'}\",\n \"----------------------------------------\",\n \"Repositority: #{rep}\",\n \"Revision: [#{rev}]\",\n \"Local version modified: #{status}\",\n \"----------------------------------------\",\n\n \"Request params: \\n#{rp.join(\"\\n\")}\",\n \"----------------------------------------\",\n \"Seesion params: \\n#{nice_session if session}\",\n \"----------------------------------------\"\n ]\n if extra_info.length > 0\n message << \"----------------------------------------\"\n message << extra_info\n message << \"----------------------------------------\"\n end\n message << \"#{trace}\"\n\n if test_machine_active?\n if File.exists?('/var/log/mor/test_system')\n message << \"----------------------------------------\"\n message << %x[tail -n 50 /var/log/mor/test_system]\n end\n end\n\n if swap\n message << \"----------------------------------------\"\n message << swap.to_yaml\n end\n\n if exception_class.include?(\"Errno::EPERM\")\n message << \"----------------------------------------\"\n message << %x[ls -la /home/mor/tmp/]\n message << \"----------------------------------------\"\n message << %x[ls -la /home/mor/]\n end\n\n Confline.set_value(\"Last_Crash_Exception_Class\", exception_class, 0)\n\n if params[:this_is_fake_exception].to_s == \"YES\"\n MorLog.my_debug(' >> Crash email NOT sent THIS IS JUST TEST', true)\n return :text => flash_notice.to_s + flash_help_link.to_s + message.join(\"\\n\")\n #render :text => message.join(\"\\n\") and return false\n else\n\n subject = \"#{ExceptionNotifier_email_prefix} Exception. ID: #{id.to_s}\"\n time = Confline.get_value(\"Last_Crash_Exception_Time\", 0)\n if time and !time.blank? and (Time.now - Time.parse(time)) < 1.minute\n MorLog.my_debug(\"Crash email NOT sent : Time.now #{Time.now.to_s(:db)} - Last_Crash_Exception_Time #{time}\")\n else\n send_crash_email(address, subject, message.join(\"\\n\")) if params[:do_not_log_test_exception].to_i == 0\n Confline.set_value(\"Last_Crash_Exception_Time\", Time.now.to_s(:db), 0)\n MorLog.my_debug('Crash email sent')\n end\n end\n else\n MorLog.my_debug(\" >> Do not send email because:\", true)\n MorLog.my_debug(\" >> Email should not be sent. Confline::Exception_Send_Email: #{exception_send_email.to_s}\", true) if exception_send_email != 1\n MorLog.my_debug(\" >> The same exception twice. Last exception: #{exception_class.to_s}\", true) if exception_class == exception_class_previous\n MorLog.my_debug(\" >> Contained explanation. Flash: #{ flash_help_link}\", true) if flash_help_link\n end\n\n if !flash_help_link.blank?\n flash[:notice] = _('Something_is_wrong_please_consult_help_link')\n flash[:notice] += \"<a id='exception_info_link' href='#{flash_help_link}' target='_blank'><img alt='Help' src='#{Web_Dir}/assets/icons/help.png' title='#{_('Help')}' /></a>\".html_safe\n else\n flash[:notice] = flash_notice.to_s.blank? ? \"INTERNAL ERROR. - ID: #{id} - #{exception_class}\" : flash_notice\n end\n\n if session and session[:forgot_pasword] == 1\n session[:forgot_pasword] = 0\n flash[:notice_forgot]= (_('Cannot_change_password') + \"<br />\" + _('Email_not_sent_because_bad_system_configurations')).html_safe\n end\n\n if session and session[:flash_not_redirect].to_i == 0\n #redirect_to Web_Dir + \"/callc/main\" and return false\n else\n session[:flash_not_redirect] = 0 if session\n #render(:layout => \"layouts/mor_min\") and return false\n end\n end\n rescue Exception => e\n MorLog.log_exception(e, id, params[:controller].to_s, params[:action].to_s)\n message =\"Exception in exception at: #{escape_for_email(request.env['SERVER_ADDR'])} \\n --------------------------------------------------------------- \\n #{escape_for_email(%x[tail -n 50 /var/log/mor/test_system])}\"\n command = ApplicationController::send_email_dry(\"[email protected]\", address, message, \"#{ExceptionNotifier_email_prefix} SERIOUS EXCEPTION\", \"-o tls='auto'\")\n system(command)\n flash[:notice] = \"INTERNAL ERROR.\"\n #redirect_to Web_Dir + \"/callc/main\" and return false\n end\n end", "def send_error_email exception\n begin\n data = {\n path: request.path,\n current_user: current_user.try(:email),\n referer: request.referer,\n params: params,\n exception: exception.inspect,\n user_agent: request.user_agent,\n http_accept: request.env['HTTP_ACCEPT'],\n ip: request.ip,\n backtrace: exception.backtrace\n }\n\n if Rails.env.production?\n DebugEmailWorker.perform_async({\n from: '[email protected]',\n to: '[email protected]',\n subject: \"[#{ENV['RACK_ENV']}] EndRun Exception\",\n text_body: JSON.pretty_generate(data)\n })\n end\n rescue\n logger.error \"Error while reporting error! Not reported! #{$!.inspect}\" # this happens if the API call fails.\n end\n\n raise # reraise the initial error\n end", "def exception; end", "def exception; end", "def exception; end", "def exception; end", "def exception; end", "def api_exception_handler(exception)\n errors = []\n errors << exception.message\n @api_response[:code] = @response_codes['internal_error']\n # @logger.error \"#{Time.now} SESSION_ID:#{session[:session_id]} EXCEPTION IS: #{errors} \\n #{exception.backtrace}\"\n [errors, @api_response]\n end", "def handle(exception, controller, request, params)\n log! \"Handling #{exception.message}\", 'info'\n e = parse(exception)\n # Additional data for Rails Exceptions\n e.framework = \"rails\"\n e.controller_name = controller.controller_name\n e.action_name = controller.action_name\n e.application_root = self.application_root\n e.occurred_at = Time.now.strftime(\"%Y%m%d %H:%M:%S %Z\")\n e.environment = request.env.to_hash\n e.url = \"#{request.protocol}#{request.host}#{request.request_uri}\"\n # Need to remove rack data from environment hash\n safe_environment = request.env.to_hash\n safe_environment.delete_if { |k,v| k =~ /rack/ }\n e.environment = safe_environment\n \n safe_session = {}\n request.session.instance_variables.each do |v|\n next if v =~ /cgi/\n next if v =~ /db/\n # remove prepended @'s\n var = v.sub(\"@\",\"\")\n safe_session[var] = request.session.instance_variable_get(v)\n end\n \n e.session = safe_session\n e.parameters = params.to_hash\n\n if mode == :queue\n worker.add_exception(e)\n else # :direct mode\n begin\n post e\n rescue Exception => exception\n log! \"Error posting data to Exceptional.\"\n log! exception.message\n log! exception.backtrace.join(\"\\n\"), 'debug'\n end\n end\n end", "def exception_details(e, msg); end", "def new_ticket(request, exception)\n ticket = Lighthouse::Ticket.new(:project_id => project_id)\n ticket.title = \"Exception: #{exception.exception}\"\n host_with_port = request.host\n host_with_port << \":#{request.port}\" if request.port != 80\n ticket_link = \"#{request.scheme}://#{host_with_port}/exceptions/#{exception.id}.html\"\n ticket.body = ticket_link\n ticket.tags = \"exception\"\n ticket\n end", "def handle_exception(exception)\n diagnosis = SData::Diagnosis::DiagnosisMapper.map(exception)\n\n status diagnosis.http_status_code || 500\n content_type 'application/xml'\n\n diagnosis.to_xml(:root)\n exception.to_s\n end", "def processerror(exception)\n case exception\n\n when RestClient::NotAcceptable #406\n raise RequestFailureException, \"Request failure\"\n when RestClient::Unauthorized #401\n raise RequestFailureException, \"Unauthorized access\"\n when RestClient::ResourceNotFound #404\n raise RequestFailureException, \"Incorrect request parameters. Check your url and the input xml\"\n when RestClient::InsufficientStorage # 507\n raise RequestFailureException, \"Account is full.User cannot make any more requests\"\n when RestClient::ServiceUnavailable # 503 => 'Service Unavailable',\n raise RequestFailureException, \"Your API has been throttled for now. Please try again later\"\n\n when ArgumentError\n raise exception\n\n else\n puts exception.message\n raise UnhandledException\n\n\n end\n\n end", "def update_body_with_exception(body, exception)\n body.merge(\n \"retries\" => body.fetch(\"retries\", 0) + 1,\n \"exceptions\" => Array(body[\"exceptions\"]) + [{\n 'exception' => exception.class.name,\n 'message' => exception.to_s,\n 'backtrace' => exception.backtrace\n }]\n )\n end", "def exception_json(exception,code=500)\n render :json => Status::Errors.exception_json(exception, code).to_json, :status => code\n end", "def error_on(exception, message)\n env.logger.debug \"---BUILD ERROR RESPONSE #{self.class}---\\t #{exception.inspect} with message #{message}\"\n raise exception, message\n end", "def define_exception_handler(data)\n exception_handler.merge!(data)\n end", "def post_request(client, post_information_hash, additional_hash = nil)\n new_hash = {:content_type => \"application/json\"}\n additional_hash ||= {} \n new_hash.merge!(additional_hash)\n\n begin\n client.post(JSON.generate(post_information_hash, {:max_nesting => 100}), new_hash)\n rescue OpenSSL::SSL::SSLError => e\n raise \"SSLError occurred when calling REST service; #{e}\"\n rescue RestClient::Exception => e # if the request failed, RestClient will throw an error. We want to retrieve that error and the response within\n puts \"RestClient::Exception hit when calling REST service\"\n puts e\n puts e.response\n return e.response\n rescue => e\n raise \"Unexpected error occurred when calling REST service; #{e}\"\n end\n end", "def get_date_in_exception\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/error/dateInException'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\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 BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _context.response.status_code == 444\r\n raise ExceptionWithDateException.new(\r\n 'date in exception',\r\n _context\r\n )\r\n end\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) unless\r\n _context.response.raw_body.nil? ||\r\n _context.response.raw_body.to_s.strip.empty?\r\n decoded\r\n end", "def create\n @daily_data_delivery_exception = DailyDataDeliveryException.new(params[:daily_data_delivery_exception])\n\n respond_to do |format|\n if @daily_data_delivery_exception.save\n format.html { redirect_to @daily_data_delivery_exception, notice: 'Daily data delivery exception was successfully created.' }\n format.json { render json: @daily_data_delivery_exception, status: :created, location: @daily_data_delivery_exception }\n else\n format.html { render action: \"new\" }\n format.json { render json: @daily_data_delivery_exception.errors, status: :unprocessable_entity }\n end\n end\n end", "def failed_body\n %{\n responseEnvelope.ack=FAILURE&responseEnvelope.timestamp=2010-07-27T17%3a46%3a58&responseEnvelope.version=1.0&errorList.error(0).errorId=580028&errorList.error(0).message=A+URL+supplied+is+malformed&errorList.error(0).parameter=returnUrl&errorList.error(1).errorId=580029&errorList.error(1).message=A+required+parameter+was+not+provided&errorList.error(1).parameter=returnUrl&errorList.error(2).errorId=580028&errorList.error(2).message=A+URL+supplied+is+malformed&errorList.error(2).parameter=cancelUrl&errorList.error(3).errorId=580029&errorList.error(3).message=A+required+parameter+was+not+provided&errorList.error(3).parameter=cancelUrl&errorList.error(4).errorId=580029&errorList.error(4).message=A+required+parameter+was+not+provided&errorList.error(4).parameter=memo&errorList.error(5).errorId=580022&errorList.error(5).message=Invalid+parameter&errorList.error(5).parameter=memo&errorList.error(6).errorId=580022&errorList.error(6).message=Invalid+parameter&errorList.error(6).parameter=senderEmail&errorList.error(7).errorId=580029&errorList.error(7).message=A+required+parameter+was+not+provided&errorList.error(7).parameter=senderEmail&errorList.error(8).errorId=580029&errorList.error(8).message=A+required+parameter+was+not+provided&errorList.error(8).parameter=senderFirstname&errorList.error(9).errorId=580029&errorList.error(9).message=A+required+parameter+was+not+provided&errorList.error(9).parameter=senderLastname\n }\n end", "def exception_handler; end", "def handle_failure(queue, name, request, exception, execution_time)\n event = LogStash::Event.new\n apply_metadata(event, name, request)\n\n event.tag(\"_http_request_failure\")\n\n # This is also in the metadata, but we send it anyone because we want this\n # persisted by default, whereas metadata isn't. People don't like mysterious errors\n event[\"http_request_failure\"] = {\n \"request\" => structure_request(request),\n \"name\" => name,\n \"error\" => exception.to_s,\n \"backtrace\" => exception.backtrace,\n \"runtime_seconds\" => execution_time\n }\n\n queue << event\n rescue StandardError, java.lang.Exception => e\n @logger.error? && @logger.error(\"Cannot read URL or send the error as an event!\",\n :exception => e,\n :exception_message => e.message,\n :exception_backtrace => e.backtrace,\n :name => name,\n :url => request\n )\n end", "def report_failure(id, exception, input_variables)\n # Submit error state to Camunda using\n # POST /external-task/{id}/failure\n Camunda::ExternalTask.new(id: id).failure(exception, input_variables)\n end", "def handle_failure(queue, name, request, exception, execution_time)\n event = LogStash::Event.new\n apply_metadata(event, name, request)\n\n event.tag(\"_http_request_failure\")\n\n # This is also in the metadata, but we send it anyone because we want this\n # persisted by default, whereas metadata isn't. People don't like mysterious errors\n event.set(\"http_request_failure\", {\n \"request\" => structure_request(request),\n \"name\" => name,\n \"error\" => exception.to_s,\n \"backtrace\" => exception.backtrace,\n \"runtime_seconds\" => execution_time\n })\n\n queue << event\n rescue StandardError, java.lang.Exception => e\n @logger.error? && @logger.error(\"Cannot read URL or send the error as an event!\",\n :exception => e,\n :exception_message => e.message,\n :exception_backtrace => e.backtrace,\n :name => name,\n :url => request\n )\n end", "def handle_failure(queue, request, exception, execution_time)\n event = LogStash::Event.new\n apply_metadata(event, request)\n\n event.tag(\"_sdee_failure\")\n\n # This is also in the metadata, but we send it anyone because we want this\n # persisted by default, whereas metadata isn't. People don't like mysterious errors\n event.set(\"[sdee_failure]\", {\n \"request\" => structure_request(request),\n \"error\" => exception.to_s,\n \"backtrace\" => exception.backtrace,\n \"runtime_seconds\" => execution_time\n })\n\n queue << event\n rescue StandardError, java.lang.Exception => e\n @logger.error? && @logger.error(\"Cannot read URL or send the error as an event!\",\n :exception => e,\n :exception_message => e.message,\n :exception_backtrace => e.backtrace,\n :url => request\n )\n end", "def wrapped_exception; end", "def handle_exception(exception)\n end", "def exception_handler(ex)\n \nend", "def server_error(exception)\n # Whatever code that handles the exception\n\n ExceptionNotifier.notify_exception(exception,\n :env => request.env, :data => {:message => \"was doing something wrong\"})\n end", "def pass_exception\n throw :next_exception_handler\n end", "def handle_request_exception(exception)\n # puts \"ERROR: #{exception}\\n\" + exception.backtrace.join(\"\\n\")\n handle_error_response(exception.kind_of?(CAHTTPError) ? JSON.parse(exception.response) : {})\n end", "def log_error(e)\n msg = {\n error_class: e.class.to_s,\n message: e.to_s,\n url: env['REQUEST_URI'].to_s,\n method: env['REQUEST_METHOD'].to_s,\n payload: env['rack.request.form_hash'].inspect.to_s\n }\n notify_error(e, msg)\n end", "def internal_error(exception)\n data = error('internal_error', 'We have been notified.', format_exception(exception))\n [500, hdrs(content_length: data_size(data)), [data]]\n end", "def handle_exception(e, key, opts)\n if e.is_a? Errors::ProxyError\n response = e.response || default_response(opts)\n log_message = e.log_message || ''\n log_message += \"; #{e.wrapped_exception.class} #{e.wrapped_exception.message}\" if e.wrapped_exception\n log_message += \"; url: #{e.url}\" if e.url\n log_message += \"; status: #{e.status}\" if e.status\n else\n response = default_response(opts)\n log_message = \"#{e.class} #{e.message}\"\n end\n log_message += \"\\nAssociated key: #{key}\"\n if e.is_a?(Errors::ProxyError)\n log_message += \"; uid: #{e.uid}\" if e.uid\n log_message += \". Response body: #{e.body}\" if e.body\n end\n log_message += \"\\n\" + e.backtrace.join(\"\\n \")\n Rails.logger.error(log_message)\n response\n end", "def handle_exception datagram, e\n # stub\n end", "def postEntityEmail( entity_id, email_address, email_description)\n params = Hash.new\n params['entity_id'] = entity_id\n params['email_address'] = email_address\n params['email_description'] = email_description\n return doCurl(\"post\",\"/entity/email\",params)\n end", "def exception_occured(exception)\n @exception = exception\n mail subject: \"Exception Occured During Running\"\n end", "def work_exception(job_handle, data = nil)\n send_client :work_exception, job_handle, data\n\n job = worker_queue.dequeue job_handle\n job.status = \"Exception\"\n job.result = data\n job.save\n \n end", "def new\n @daily_data_delivery_exception = DailyDataDeliveryException.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @daily_data_delivery_exception }\n end\n end", "def exception_data(deliverer = nil)\n if deliverer\n write_inheritable_attribute(:exception_data, deliverer)\n else\n read_inheritable_attribute(:exception_data)\n end\n end", "def exception_data(deliverer = nil)\n if deliverer\n write_inheritable_attribute(:exception_data, deliverer)\n else\n read_inheritable_attribute(:exception_data)\n end\n end", "def handle_receiving_exception(e)\n end", "def parse(exception)\n exception_data = ExceptionData.new\n exception_data.exception_backtrace = exception.backtrace\n exception_data.exception_message = exception.message\n exception_data.exception_class = exception.class.to_s\n exception_data\n end", "def handle_failure(queue, name, request, exception, execution_time)\n event = LogStash::Event.new\n apply_metadata(event, name, request)\n\n event.tag(\"_http_request_failure\")\n\n # This is also in the metadata, but we send it anyone because we want this\n # persisted by default, whereas metadata isn't. People don't like mysterious errors\n event.set(\"http_request_failure\", {\n \"request\" => structure_request(request),\n \"name\" => name,\n \"error\" => exception.to_s,\n \"backtrace\" => exception.backtrace,\n \"runtime_seconds\" => execution_time\n })\n\n queue << event\n rescue StandardError, java.lang.Exception => e\n @logger.error? && @logger.error(\"Cannot read URL or send the error as an event!\",\n :exception => e,\n :exception_message => e.message,\n :exception_backtrace => e.backtrace,\n :name => name)\n\n # If we are running in debug mode we can display more information about the\n # specific request which could give more details about the connection.\n @logger.debug? && @logger.debug(\"Cannot read URL or send the error as an event!\",\n :exception => e,\n :exception_message => e.message,\n :exception_backtrace => e.backtrace,\n :name => name,\n :url => request)\n end", "def exc_msg_and_response(exc, response = T.unsafe(nil)); end", "def handle_candlepin_server_error ex\n log_exception(ex)\n errors _(\"An error has occurred in the Entitlement Server.\")\n redirect_back\n end", "def raise(exception); end", "def post_fail_message; end", "def postContractPaymentFailure( contract_id, failure_reason, payment_date, amount, currency, response)\n params = Hash.new\n params['contract_id'] = contract_id\n params['failure_reason'] = failure_reason\n params['payment_date'] = payment_date\n params['amount'] = amount\n params['currency'] = currency\n params['response'] = response\n return doCurl(\"post\",\"/contract/payment/failure\",params)\n end", "def exceptions\n end", "def webhook_error(code, body, payload, transaction, stack)\n @code = code\n @body = body\n @payload = payload\n @transaction = transaction\n @stack = stack\n mail(:to => stack.seller_email, :subject => \"Payly: Webhook error on #{stack.product_name}\")\n end", "def pass_it_on(exception, env, request = {:params => {}}, params = {}, session = {}, verbose = false)\n begin\n case self.class.exception_notifiable_pass_through\n when :hoptoad then\n HoptoadNotifier.notify(exception, sen_hoptoad_request_data(env, request, params, session))\n logger.info(\"[PASS-IT-ON] HOPTOAD NOTIFIED\") if verbose\n else\n logger.info(\"[PASS-IT-ON] NO\") if verbose\n #Do Nothing\n end\n rescue\n #Do Nothing\n logger.info(\"[PASS-IT-ON] FAILED\") if verbose\n end\n end", "def report_exception_to_project_106_server(data)\n\n # Append api_key to data\n data = append_access_token_to_data(data)\n\n # If handler == node then request data will be pass to nodejs to make api call\n # If handler == ruby then request data will be directly pass through ruby api call\n handler = \"node\"\n begin\n # benchmarking code\n # Benchmark.bm do |bm|\n\n if handler == \"node\"\n # bm.report(\"Node\") do\n\n # before = get_memory_usage\n # report_log \"BEFORE: \" + before.to_s\n\n\n # Pass request data to node_handler.js which will make api call to project-106-server\n # Stringifing data\n jdata = data.to_json\n # Get node_handler path\n node_handler = File.join(File.dirname(__FILE__), \"node_handler.js\")\n report_log \"[Project-106] Calling NODE script to send data to project-106 server\"\n `node #{node_handler} #{Shellwords.escape(jdata)}`\n\n # after = get_memory_usage\n # report_log \"AFTER: \" + (after).to_s\n # report_log \"Node Memory Usage: \" + (after-before).to_s\n\n # end\n else\n # bm.report(\"Ruby\") do\n\n # before = get_memory_usage\n # report_log \"BEFORE: \" + before.to_s\n\n # Ruby api call to pass request data to project-106-server\n report_log \"[Project-106] Calling RUBY script to send data to project-106 server\"\n url = URI.parse('http://localhost:3000/api/v1/error_reports')\n resp = Net::HTTP.post_form(url, data)\n report_log \"[Project-106] Exception Reported to Project-106 server\"\n # after = get_memory_usage\n # report_log \"AFTER: \" + (after).to_s\n # report_log \"Ruby Memory Usage: \" + (after-before).to_s\n\n # end\n end\n\n # end\n rescue => e\n report_log \"[Project-106] Error reporting exception to Project-106: #{e}\"\n end\n end", "def handle(exception, controller, request, params, current_user = nil)\n Exceptional.log! \"Handling #{exception.message}\", 'info'\n begin\n e = parse(exception)\n # Additional data for Rails Exceptions\n e.framework = \"rails\"\n e.controller_name = controller.controller_name\n e.action_name = controller.action_name\n e.application_root = Exceptional.application_root?\n e.occurred_at = Time.now.strftime(\"%Y%m%d %H:%M:%S %Z\")\n e.environment = request.env.to_hash\n e.url = \"#{request.protocol}#{request.host}#{request.request_uri}\"\n e.environment = safe_environment(request)\n e.session = safe_session(request.session)\n e.parameters = sanitize_hash(params.to_hash)\n\n # Add info about current user if configured to do so \n add_user_data(e, current_user) if(Exceptional.send_user_data? && !current_user.nil?)\n\n post(e)\n rescue Exception => exception\n Exceptional.log! \"Error preparing exception data.\"\n Exceptional.log! exception.message\n Exceptional.log! exception.backtrace.join(\"\\n\"), 'debug'\n end\n end", "def catch_exceptions; end", "def exception\n @context[:exception]\n end", "def parsing_error(data, exception)\n $stderr.puts \"parsing error:\\n#{exception.message}\"\n end", "def report_exception\n uri = URI.parse(SLACK_URL + '/chat.postMessage')\n params = { 'channel' => self.class.channel, 'token' => self.class.token, 'text' => text }\n Net::HTTP.post_form(uri, params)\n end", "def create\n @trace_exception = TraceException.new(trace_exception_params)\n\n respond_to do |format|\n if @trace_exception.save\n format.html { redirect_to @trace_exception, notice: 'Trace exception was successfully created.' }\n format.json { render :show, status: :created, location: @trace_exception }\n else\n format.html { render :new }\n format.json { render json: @trace_exception.errors, status: :unprocessable_entity }\n end\n end\n end", "def postEntityEmployee( entity_id, title, forename, surname, job_title, description, email, phone_number)\n params = Hash.new\n params['entity_id'] = entity_id\n params['title'] = title\n params['forename'] = forename\n params['surname'] = surname\n params['job_title'] = job_title\n params['description'] = description\n params['email'] = email\n params['phone_number'] = phone_number\n return doCurl(\"post\",\"/entity/employee\",params)\n end", "def after_exception(e)\n logger.error \"Error processing request\", e.message, e\n after(500)\n end", "def report_internal_error(exception, original_error = nil)\n return if skip_reporting_internal_error(exception)\n\n failsafe_message = ''\n log_error(\n '[Rollbar] Reporting internal error encountered while sending data to Rollbar.'\n )\n\n configuration.execute_hook(:on_report_internal_error, exception)\n\n failsafe_message = 'build_item in exception_data'\n item = build_item('error', nil, exception, { :internal => true }, nil)\n\n failsafe_message = 'error in process_item'\n process_item(item)\n\n failsafe_message = 'error logging instance link'\n log_instance_link(item['data'])\n rescue StandardError => e\n send_failsafe(failsafe_message, e, original_error)\n log_error(item ? \"[Rollbar] Item: #{item}\" : \"[Rollbar] Exception: #{exception}\")\n end", "def http_error(e)\n msg = e.message\n if e.is_a?(RestClient::Exception)\n msg = e.response.body if e.response.is_a?(RestClient::Response)\n end\n msg\n end", "def exceptions; end", "def handle_generic_error ex\n log_exception(ex)\n errors _(\"An unexpected error has occurred, details have been logged.\")\n redirect_back\n end", "def render_error(exception)\n # use the exception_notifier gem to send out an e-mail\n # to the notification list specified in config/environment.rb\n ExceptionNotifier.notify_exception(exception, env: request.env,\n data: {\n user: current_user,\n course: @course,\n assessment: @assessment,\n submission: @submission\n })\n\n respond_to do |format|\n format.html do\n # stack traces are only shown to instructors and administrators\n # by leaving @error undefined, students and CAs do not see stack traces\n if !current_user.nil? && (current_user.instructor? || current_user.administrator?)\n @error = exception\n\n # Generate course id and assessment id objects\n @course_name = params[:course_name] ||\n (params[:controller] == \"courses\" ? params[:name] : nil)\n if @course_name\n @assessment_name = params[:assessment_name] ||\n (params[:controller] == \"assessments\" ? params[:name] : nil)\n\n end\n end\n\n render \"home/error_500\"\n end\n format.json { head :internal_server_error }\n format.js { head :internal_server_error }\n end\n end", "def after_exception(e)\n end", "def log_data_invalid_error(data, exception)\n open(OPERATION_IMPORT_LOG, 'a') do |file|\n\n file.puts \"==== DATA INVALID ====\"\n file.puts \"Skipping Invoice #{data[:invoice_num]} of company #{data[:company]}\"\n file.puts \"Reason - #{exception.message}\"\n end\n end", "def record_invalid(exception)\n render json: exception.record.errors, status: :unprocessable_entity\n end" ]
[ "0.7420021", "0.70168144", "0.6793968", "0.66256076", "0.65499425", "0.64644957", "0.615147", "0.6138807", "0.6109887", "0.60761017", "0.6075355", "0.6073567", "0.60699695", "0.6021474", "0.5934792", "0.584824", "0.5830682", "0.5824113", "0.58181214", "0.5808992", "0.5808762", "0.5806329", "0.5804628", "0.5799882", "0.5799343", "0.5782852", "0.5751982", "0.57437396", "0.5734718", "0.5714192", "0.56987834", "0.5695012", "0.5639953", "0.5639953", "0.5639953", "0.5639953", "0.5639953", "0.5633921", "0.56253016", "0.56224453", "0.56130606", "0.56126386", "0.5611486", "0.56076086", "0.55834717", "0.5571066", "0.55460817", "0.5539377", "0.5536084", "0.5523921", "0.5522246", "0.5522038", "0.55061376", "0.54933184", "0.54688835", "0.5465613", "0.54648846", "0.5464079", "0.5448357", "0.54412025", "0.54409516", "0.5434904", "0.5433865", "0.5432538", "0.54208094", "0.54173523", "0.5412656", "0.53986204", "0.5397583", "0.53907907", "0.53867865", "0.53867865", "0.5384875", "0.538434", "0.5373947", "0.5373563", "0.536705", "0.5363923", "0.53621936", "0.5362078", "0.5355575", "0.5354034", "0.5352895", "0.5351622", "0.5350789", "0.5347589", "0.53385097", "0.5333223", "0.53321916", "0.5326737", "0.53244436", "0.5321089", "0.532104", "0.5317339", "0.5310222", "0.5308058", "0.53066695", "0.53053886", "0.5300305", "0.52971953" ]
0.7065451
1
This (ironic) method sanitizes a hash by removing unjsonable objects from the passed in hash. needed as active_support's fails in some cases with a cyclical reference error.
def sanitize_hash(hash) return {} if hash.nil? Hash.from_xml(hash.to_xml)['hash'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sanitize_hash(hash)\n Hash[hash.collect { |k, v| [k.to_s, v.is_a?(Hash) ? sanitize_hash(v) : v] }]\n end", "def clean_hash(hash)\n hash.each do |key, value|\n if value == ''\n hash[key] = nil\n elsif value.is_a?(Array)\n value.each do |item|\n clean_hash(item) if item.is_a?(Hash)\n end\n elsif [DateTime, Time].include?(value.class)\n hash[key] = convert_date(value)\n elsif value.is_a?(Hash)\n clean_hash(value)\n end\n end\n end", "def strip_hash( hash, cloned=true )\n\t\tnewhash = cloned ? hash.dup : hash\n\t\tnewhash.default = nil if newhash.default_proc\n\t\tnewhash.each_key {|key|\n\t\t\tcase newhash[ key ]\n\t\t\twhen Hash\n\t\t\t\tnewhash[ key ] = strip_hash( newhash[key], false )\n\n\t\t\twhen Proc, Method, UnboundMethod, IO\n\t\t\t\tself.log.warning \"Stripping unserializable object from session \" \\\n\t\t\t\t\t\"hash: %p\" % newhash[ key ]\n\t\t\t\tnewhash[ key ] = \"[Can't serialize a %s]\" % newhash[ key ].class\n\t\t\tend\n\t\t}\n\n\t\treturn newhash\n\tend", "def strip_out_unsupported!(hash)\n hash.each do |key, value|\n delete_key = false\n # delete fhir_comments and primitive extensions\n if key == 'fhir_comments' || key.start_with?('_')\n delete_key = true\n elsif value.is_a?(Array)\n value.each do |thing|\n strip_out_unsupported!(thing) if thing.is_a?(Hash)\n end\n elsif value.is_a?(Hash)\n strip_out_unsupported!(value)\n delete_key = value.empty?\n end\n hash.delete(key) if delete_key\n end\n end", "def remove_empties_from_hash(old_hash)\n new_hash = {}\n old_hash.each do |key, value|\n next if value.nil? || value == '' || value == [] || value == {}\n new_hash[key] = value.is_a?(Hash) ? remove_empties_from_hash(value) : value\n end\n \n return new_hash\n end", "def clean_hash hash\n hash ||= {}\n hash = hash.map do |k,v|\n if v.is_a? Hash\n [k,clean_hash(v)]\n else\n [k,v]\n end\n end\n hash = Hash[hash]\n Hash[hash.select do |k,v|\n if v.is_a? Hash\n v.size > 0\n else\n v.present?\n end\n end]\n end", "def _to_h_scrub(h)\n h_scrub = h.dup\n [:observable_dictionary_c_array, :element_observable_c_array, :asn_c_array, :collection_c_array].each do |key|\n h_scrub.delete(key) if h_scrub.has_key? key && h_scrub[key].blank?\n end\n return h_scrub\n end", "def _squish(hash)\n hash = _flatten(hash)\n hash.each_with_object({}) do |(k, v), ret|\n k = k.gsub(/extensions|com|instructure|canvas/, '').gsub(/_+/, '_').gsub(/^_/, '').downcase\n ret[k] = v\n end\nend", "def prune!(hash)\n hash.delete_if do |key, value|\n if is_liu_id? key, value\n fix_liu_id! value\n end\n\n prune!(value) if value.is_a?(Hash)\n value.nil? || (value.respond_to?(:empty?) && value.empty?)\n end\n end", "def unaltered(hash)\n hash\n end", "def sanitize_json(json)\n IndexerCommonConfig.do_not_index.each do |k, v|\n if json[\"jsonmodel_type\"] == k\n # subrec is a reference used to navigate inside of the JSON as specified by the v[:location] to find the part of the tree to sanitize\n subrec = json\n\n v[:location].each do |l|\n unless subrec.nil?\n subrec = subrec[l]\n end\n end\n\n unless subrec.nil?\n subrec[v[:to_clean]] = []\n end\n end\n end\n\n return json\n end", "def sanitize_hash\n @hash_of_merged_data.map { |key,values|\n values.map! {|value| to_float_or_int(value) }\n values.uniq!\n values.sort!\n { key => values }\n }.reduce(:merge)\n end", "def scrub_hash(record)\n raise NotImplementedError\n end", "def to_sanitize\n Sanitize.new(to_hash)\n end", "def remove_empties(h)\n h.delete_if do |_k, v|\n v == '∅∅∅'\n end\n\n h.each_pair do |_k, v|\n remove_empties(v) if v.is_a?(Hash)\n end\n\n h.delete_if do |_k, v|\n v.is_a?(Hash) && v.empty?\n end\n end", "def sanitize_keys(hash)\n new_hash = Hash.new\n hash.each do |key,value|\n sanitized_key = key.downcase.tr(\" \", \"_\")\n\n if value.is_a? Hash\n new_hash[sanitized_key] = sanitize_keys(value)\n else\n new_hash[sanitized_key] = value\n end\n end\n return new_hash\n end", "def normalize(key, hash)\n token, *dangling = hash[key]\n unmatched(key, hash, dangling) unless dangling.empty?\n\n token.gsub!(/^[^[:alnum:]]+|[^[:alnum:]]+$/, '')\n\n hash[key] = token\n hash\n end", "def untaint_values( hash )\n\t\tnewhash = {}\n\n\t\thash.each do |key,val|\n\t\t\tcase val\n\t\t\twhen Hash\n\t\t\t\tnewhash[ key ] = untaint_values( hash[key] )\n\n\t\t\twhen NilClass, TrueClass, FalseClass, Numeric, Symbol\n\t\t\t\tnewhash[ key ] = val\n\n\t\t\twhen Arrow::Path\n\t\t\t\t# Arrow::Logger[ self ].debug \"Untainting %p\" % val\n\t\t\t\tval.untaint\n\t\t\t\tnewhash[ key ] = val\n\n\t\t\twhen Array\n\t\t\t\t# Arrow::Logger[ self ].debug \"Untainting array %p\" % val\n\t\t\t\tnewval = val.collect do |v|\n\t\t\t\t\tcase v\n\t\t\t\t\twhen NilClass, TrueClass, FalseClass, Numeric, Symbol\n\t\t\t\t\t\tv\n\t\t\t\t\telse\n\t\t\t\t\t\tv.dup.untaint\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tnewhash[ key ] = newval\n\n\t\t\telse\n\t\t\t\t# Arrow::Logger[ self ].debug \"Untainting %p\" % val\n\t\t\t\tnewval = val.dup\n\t\t\t\tnewval.untaint\n\t\t\t\tnewhash[ key ] = newval\n\t\t\tend\n\t\tend\n\n\t\treturn newhash\n\tend", "def deep_clean(data)\r\n proc = Proc.new { |k, v|\r\n if v.kind_of?(Hash) && !v.empty?\r\n v.delete_if(&proc)\r\n nil\r\n end\r\n v.nil? || v.empty?\r\n }\r\n hash.delete_if(&proc)\r\n end", "def clean_unwanted_keys(hash)\r\n ignored_keys = [:only_path, :use_route]\r\n hash.dup.delete_if{|key,value| ignored_keys.include?(key)}\r\n end", "def normalize_hash(hash)\n normalized_hash = {}\n hash.each do |k, v|\n case k \n when \"error\"\n raise FacebookError.new(\"#{v['type']} - #{v['message']}\")\n when \"id\"\n if (v == v.to_i.to_s)\n normalized_hash[k.to_sym] = v.to_i \n else\n normalized_hash[k.to_sym] = v \n end\n when /_time$/\n normalized_hash[k.to_sym] = Time.parse(v)\n else\n data = extract_data(v)\n case data\n when Hash\n normalized_hash[k.to_sym] = normalize_hash(data)\n when Array\n normalized_hash[k.to_sym] = normalize_array(data)\n else\n normalized_hash[k.to_sym] = data\n end\n end\n end\n normalized_hash\n end", "def preprocess_concept_hash(concept_hash)\n end", "def scrub_date(hash)\n scrubbed_hash = {}\n hash.each do |key, value|\n scrubbed_hash[key.gsub(/[a-z]/, '')] = value\n end\n scrubbed_hash\n end", "def sanitize_params(params = params)\n params = walk_hash(params) if params\n end", "def sanitize_params(params = params)\n params = walk_hash(params) if params\n end", "def remove_excluded_attributes!(hash)\n hash.each do |attr, val|\n if attr.in?(EXCLUDED_ENTITY_ATTRIBUTES)\n hash.delete(attr)\n elsif val.is_a? Array\n val.each {|v| remove_excluded_attributes!(v) if v.is_a?(Hash) }\n elsif val.is_a? Hash\n remove_excluded_attributes!(val)\n end\n end\n end", "def sanitize_for_dynamo(content)\n if content.is_a?(Array)\n content.delete_if do |e|\n sanitize_for_dynamo(e)\n bad_dynamo_value(e)\n end\n elsif content.is_a?(Hash)\n content.delete_if do |_k, v|\n sanitize_for_dynamo(v)\n bad_dynamo_value(v)\n end\n end\n end", "def clean_dynamic_values(hash)\n hash[:value].delete(:params) if hash.has_key?(:value) && hash[:value].is_a?(Array)\n hash\n end", "def sanitize_fields_hash\n @sanitize_fields_hash ||= extract_configuration(:sanitize_fields, configuration, [])\n end", "def product_params_sanitizer(hash)\n\t hash[:typ_subcategory_id] = hash.delete :typ_subcategory\n\t hash[:typ_subcategory_id] = hash[:typ_subcategory_id][:id]\n\t hash[:typ_category_id] = hash.delete :typ_category\n\t hash[:typ_category_id] = hash[:typ_category_id][:id]\n\t return hash\n \tend", "def normalize_keys(hash)\n hash.each{|k, v|\n hash.delete(k) unless @@valid_types.include?(v.class)\n if k.is_a?(String)\n hash.delete(k)\n hash[k.gsub(/\\-/, \"_\").to_sym] = v\n elsif !k.is_a?(Symbol) # elsunless\n hash.delete(k)\n end\n }\n return hash\nend", "def normalize(obj)\n if obj.is_a?(Hash)\n obj.inject({}) { |h, (k, v)| normalize_hash(h, k, v); h }\n else\n obj\n end\n end", "def _sanitize(thing)\n # This really needs to go into a class\n if thing.kind_of? V8::Array or thing.respond_to? :to_ary\n thing.map do |item|\n _sanitize item\n end\n elsif thing.respond_to? :keys\n Hash[\n thing.keys.map do |key|\n [key, _sanitize(thing[key])]\n end]\n else\n thing\n end\n end", "def clean(data)\n data.inject({}) do |hash, (key, val)| \n hash[key] = val.is_a?(Array) ? val.map { |v| clean v } : (val.is_a?(Hash) ? clean(val) : val.try(:strip))\n hash\n end\n end", "def normalize(hash)\n hash.symbolize_keys if hash\n end", "def unescape_hash( hash )\n hash.each_pair {\n |k, v|\n hash[k] = unescape( hash[k] ) if hash[k].is_a?( String )\n hash[k] = unescape_hash( v ) if v.is_a? Hash\n }\n\n return hash\n end", "def scrub_options_hash(options_hash)\n options_hash.each do |key,value|\n options_hash[key] = hash_to_callback(value)\n end\n options_hash\n end", "def cleanup_data(data)\n return data unless data.is_a?(Hash) && data.has_key?('collection')\n data['collection'].each do |item|\n item.each_pair do |k,v|\n # Purge whitespace within values\n v.is_a?(::String) ? v.strip! : v\n\n # Parse JSON values\n if v.is_a?(Array)\n v.map! do |e|\n e = safe_parse_json(e)\n end\n else\n item[k] = safe_parse_json(v)\n end\n end\n end\n data\n end", "def escape_hash( hash )\n hash.each_pair {\n |k, v|\n hash[k] = escape( hash[k] ) if hash[k].is_a?( String )\n hash[k] = escape_hash( v ) if v.is_a? Hash\n }\n\n return hash\n end", "def sanitize_response_keys(response)\n if response.is_a?(Hash)\n response.inject({}) { |result, (key, value)| result[underscorize(key).to_sym] = sanitize_response_keys(value); result }\n elsif response.is_a?(Array)\n response.collect { |result| sanitize_response_keys(result) }\n else\n response\n end\n end", "def sanitize_response_keys(response)\n if response.is_a?(Hash)\n response.inject({}) { |result, (key, value)| result[underscorize(key).to_sym] = sanitize_response_keys(value); result }\n elsif response.is_a?(Array)\n response.collect { |result| sanitize_response_keys(result) }\n else\n response\n end\n end", "def sanitize_response_keys(response)\n if response.is_a?(Hash)\n response.inject({}) { |result, (key, value)| result[underscorize(key).to_sym] = sanitize_response_keys(value); result }\n elsif response.is_a?(Array)\n response.collect { |result| sanitize_response_keys(result) }\n else\n response\n end\n end", "def sanitize_response_keys(response)\n if response.is_a?(Hash)\n response.inject({}) { |result, (key, value)| result[underscorize(key).to_sym] = sanitize_response_keys(value); result }\n elsif response.is_a?(Array)\n response.collect { |result| sanitize_response_keys(result) }\n else\n response\n end\n end", "def sanitize_keys(hash, keys_to_sanitize)\n hash.each_with_object({}) do |(k, v), h|\n k = k.to_s.downcase\n if keys_to_sanitize.include?(k)\n h[k] = SANITIZED_VALUE\n else\n h[k] = v\n end\n end\n end", "def _process_hashed(hashed)\n hashed.each_pair do |key, value|\n if value.equal?(Utils::DeletedMarker)\n hashed.delete(key)\n elsif Utils.hashable?(value)\n _process_hashed(value.to_hash).freeze\n end\n end\n\n hashed\n end", "def normalize_hash(hash)\n normalized_hash = {}\n hash.each do |k, v|\n case k\n when /_time$/\n normalized_hash[k.downcase.to_sym] = Time.parse(v)\n else\n data = extract_data(v)\n normalized_hash[k.downcase.to_sym] = case data\n when Hash\n normalize_hash(data)\n when Array\n normalize_array(data)\n else\n data\n end\n end\n end\n normalized_hash\n end", "def strip_params_before_orm(hash)\n new_hash = hash.dup\n new_hash.delete(\"route_properties\")\n new_hash.delete(\"data_object\")\n\n return new_hash\n end", "def clean_values(hash)\n hash.map {|h| {h[0] => clean_li_listsings(h[1])} }\n end", "def normalize_hash(h)\n h.map do |k,v|\n v = v.strip if v.respond_to?(:strip)\n v = v.gsub(/[^[[:ascii:]]]/, \"\") if v.respond_to?(:gsub)\n [k, v]\n end.to_h\n end", "def deep_munge(hash)\r\nhash.each do |k, v|\r\ncase v\r\nwhen Array\r\nv.grep(Hash) { |x| deep_munge(x) }\r\nv.compact!\r\nhash[k] = nil if v.empty?\r\nwhen Hash\r\ndeep_munge(v)\r\nend\r\nend\r\nhash\r\nend", "def sanitize_options(opts)\n opts = opts.to_hsh rescue opts.to_h\n \n HashWithIndifferentAccess.new(opts)\n end", "def normalize(key, hsh)\n hsh[key].gsub!(/^[^A-Za-z0-9]+/, '')\n hsh[key].gsub!(/[^A-Za-z0-9]+$/, '')\n hsh\n end", "def postprocess_healthchecks(value)\n value.is_a?(Hash) ? value.prune : value\n end", "def coerce_symbolized_hash(hash, recursive = false)\n hash = not_nil_hash!(hash)\n symbolized = {}\n hash.each_pair{|k,v| \n if recursive and v.kind_of?(Hash)\n v = coerce_symbolized_hash(v)\n end\n symbolized[coerce_name(k)] = v\n }\n symbolized\n end", "def sanitize(template)\n begin\n if template =~ /\\A\".+\"\\Z/m\n # Case 1\n sanitize_with_json(template)\n else\n # Case 2\n sanitize_with_regexp(template)\n end\n rescue JSON::ParserError\n # Case 3\n template\n end\n end", "def clean_up(attr_values_hash_of_hash)\n\t\tattr_values = Hash.new\n\t\tattr_values_hash_of_hash.each do |bad_key,good_hash|\n\t\t\tattr_values.merge!(good_hash)\n\t\tend\n\t\treturn attr_values\n\tend", "def deep_compact!(hsh)\n raise TypeError unless hsh.is_a? Hash\n\n hsh.each do |_, v|\n deep_compact!(v) if v.is_a? Hash\n end.reject! { |_, v| v.nil? || (v.respond_to?(:empty?) && v.empty?) }\n end", "def to_strongly_typed_hash(cli_hash)\n nil if cli_hash.nil?\n cli_hash.each do |key, value|\n case value\n when \"__undefined__\"\n cli_hash[key] = nil\n when true\n cli_hash[key] = true\n when false\n cli_hash[key] = false\n when Hash\n cli_hash[key] = to_strongly_typed_hash(value)\n end\n end\n cli_hash\n end", "def normalize(key, hsh)\n hsh[key].gsub!(/^[^[:alnum:]]+/, '')\n hsh[key].gsub!(/[^[:alnum:]]+$/, '')\n end", "def cleanup!(content)\n content.each do |key, value| \n cleanup!(value) if value.is_a? Hash\n content.delete(key) if value.blank?\n end\n end", "def unhashie(hash)\n tmp_hash = {}\n hash.each do |key, value|\n tmp_hash[key.to_sym] = value\n end\n\n tmp_hash\n end", "def clean(data:, ignores: [], only: [])\n raise TypeError, \"Expected type `Hash` but received `#{data.inspect}`\" if\n !data.is_a?(Hash)\n new_data = @data.dup\n ignores = Array(ignores).map(&:to_sym)\n only = Array(only).map(&:to_sym)\n data.each do |k, v|\n k = k.to_sym\n next if ignores.include?(k)\n next if !only.empty? && !only.include?(k)\n if self.respond_to?(k)\n new_data[k] = v\n @dirty.delete(k)\n end\n end\n @data = freezer(new_data)\n self\n end", "def clean_document(hash)\n hash.delete_if do |_k, v|\n begin\n v.nil? || v.empty?\n rescue\n false\n end\n end\n end", "def dehash(hash, depth); end", "def clean_document(hash)\n hash.delete_if do |_k, v|\n v.blank? && v != false\n end\n end", "def desymbolize(hash)\n new_hash = Hash.new\n hash.each do |k, v|\n new_hash[k.to_s] = v\n end\n new_hash\n end", "def convert_hash(hash)\n raise ArgumentError, \"#{hash.inspect} is not a Hash\" unless Hash === hash\n\n hash.keys.each do |key|\n hash[(key.to_sym rescue key) || key] = convert hash.delete(key)\n end\n\n hash.keys.all? do |k|\n Symbol === k or raise ArgumentError, \"keys must be Symbols, #{k.inspect} is not\"\n end\n hash\n end", "def clean_attribute(value)\n if value.kind_of?(Hash)\n value.delete_if { |key, value| clean_attribute(value) }.empty?\n elsif value.kind_of?(Array)\n value.delete_if { |value| clean_attribute(value) }.empty?\n else\n value.to_s.strip.empty?\n end\n end", "def compact_hash(hash)\n hash.delete_if { |key, value| value.blank? }\n end", "def smart_hash(h)\n h = Hash[h.map{|k,v| [k, v.is_a?(Hash) ? smart_hash(v) : v]}]\n h.instance_eval do\n def method_missing(name, *args, &block)\n self[name.to_s]\n end\n end\n h\nend", "def not_nil_hash!(hash)\n not_nil!(hash)\n unless hash.kind_of?(Hash)\n coercion_error!(\"Hash expected, #{hash.class} received\")\n end\n hash\n end", "def clean_char_encoding!(hash)\n # Bail if we're not in ruby 1.9\n return unless \"\".respond_to? :encoding\n\n source_encoding = \"UTF-8\"\n if hash[\"ctx_enc\"] == \"info:ofi/enc:ISO-8859-1\"\n hash.delete(\"ctx_enc\")\n source_encoding = \"ISO-8859-1\"\n end\n\n hash.each_pair do |key, values|\n # get a list of all terminal values, whether wrapped\n # in arrays or not. We're going to mutate them.\n [values].flatten.compact.each do |v|\n v.force_encoding(source_encoding)\n if source_encoding == \"UTF-8\"\n v.scrub!\n else\n # transcode, replacing any bad chars.\n v.encode!(\"UTF-8\", invalid: :replace, undef: :replace)\n end\n end\n end\n end", "def symbolize! hash\n hash.symbolize_keys!\n hash.values.select{|v| v.is_a? Hash}.each{|h| symbolize!(h)}\n end", "def resolve_unsafe(hash, options = EMPTY_HASH)\n result = {}\n\n hash.each do |key, value|\n k = @transform_key.(key)\n type = @name_key_map[k]\n\n if type\n begin\n result[k] = type.call_unsafe(value)\n rescue ConstraintError => e\n raise SchemaError.new(type.name, value, e.result)\n rescue CoercionError => e\n raise SchemaError.new(type.name, value, e.message)\n end\n elsif strict?\n raise unexpected_keys(hash.keys)\n end\n end\n\n resolve_missing_keys(result, options) if result.size < keys.size\n\n result\n end", "def clean_frictionless_json(in_str)\n return in_str unless in_str.include?('{') && in_str.include?('}')\n\n first_brace = in_str.index('{')\n last_brace = in_str.rindex('}')\n in_str[first_brace..last_brace]\n end", "def untaint_values( obj )\n\t\tself.log.debug \"Untainting a result %s\" % [ obj.class.name ]\n\t\treturn obj unless obj.tainted?\n\t\tnewobj = nil\n\n\t\tcase obj\n\t\twhen Hash\n\t\t\tnewobj = {}\n\t\t\tobj.each do |key,val|\n\t\t\t\tnewobj[ key ] = untaint_values( val )\n\t\t\tend\n\n\t\twhen Array\n\t\t\t# Arrow::Logger[ self ].debug \"Untainting array %p\" % val\n\t\t\tnewobj = obj.collect {|v| v.dup.untaint}\n\n\t\telse\n\t\t\t# Arrow::Logger[ self ].debug \"Untainting %p\" % val\n\t\t\tnewobj = obj.dup\n\t\t\tnewobj.untaint\n\t\tend\n\n\t\treturn newobj\n\tend", "def clean_dict(original_dict)\n original_dict.each_with_object({}) do |(k, v), memo|\n memo[k.to_i] = clean_node(v)\n end\n end", "def convert\n old = @hashes\n @hashes = Hash.new\n\n puts 'Warning: old JSON format detected, converting.'\n old.each {|i| add_hash(i[:id], i[:deletehash], 'unknown') }\n save\n end", "def to_safe_hashes(hashes)\n hashes.map do |item|\n item.transform_keys(&:to_s)\n .transform_values do |v|\n if v.is_a? Symbol\n v.to_s\n else\n v\n end\n end\n end\n end", "def jsonify(hash)\n deep_reduce(hash) do |k, v, h|\n if v.is_a?(String)\n if v.encoding == ::Encoding::ASCII_8BIT\n # Only keep binary values less than a certain size. Sizes larger than this\n # are almost always file uploads and data we do not want to log.\n if v.length < BINARY_LIMIT_THRESHOLD\n # Attempt to safely encode the data to UTF-8\n encoded_value = encode_string(v)\n if !encoded_value.nil?\n h[k] = encoded_value\n end\n end\n elsif v.encoding != ::Encoding::UTF_8\n h[k] = encode_string(v)\n else\n h[k] = v\n end\n elsif is_a_primitive_type?(v)\n # Keep all other primitive types\n h[k] = v\n end\n end\n end", "def customise(hash)\n # was: { :attributes => { :id => #<value> } }\n # now: { :attributes => { :vebra_id => #<value> } }\n if hash[:attributes] && hash[:attributes][:id]\n hash[:vebra_ref] = hash[:attributes].delete(:id)\n end\n\n # was: { :price_attributes => { :value => #<value>, ... } }\n # now: { :price_attributes => { ... }, :price => #<value> }\n if hash[:price_attributes]\n hash[:price] = hash[:price_attributes].delete(:value)\n end\n\n # was: { :type => [#<value>, #<value>] } or: { :type => #<value> }\n # now: { :property_type => #<value> }\n if hash[:type]\n hash[:property_type] = hash.delete(:type)\n hash[:property_type] = hash[:property_type].first if hash[:property_type].respond_to?(:each)\n end\n\n # was: { :reference => { :agents => #<value> } }\n # now: { :agent_reference => #<value> }\n if hash[:reference] && hash[:reference].size == 1 && hash[:reference].keys.first == :agents\n reference = hash.delete(:reference)\n hash[:agent_reference] = reference.delete(:agents)\n end\n\n # was: { :area => [ #<area - imperial>, #<area - metric> ] }\n # now: { :area => { :imperial => #<imperial>, :metric => #<metric> } }\n if area = hash[:area]\n hash[:area] = {}\n area.each do |a|\n hash[:area][a.delete(:measure).to_sym] = a\n end\n end\n\n # was: { :bullets => [ { :value => #<value> }, { :value => #<value> } ] }\n # now: { :bullets => [ #<value>, #<value> ] }\n if hash[:bullets]\n hash[:bullets].map! { |b| b[:value] }\n end\n\n # was: { :paragraphs => [ #<paragraph - type a, #<paragraph - type b> ] }\n # now: { :type_a => [ #<paragraph> ], :type_b => [ #<paragraph> ] }\n if paragraphs = hash.delete(:paragraphs)\n # extract each paragraph type into separate collections\n hash[:rooms] = paragraphs.select { |p| p[:type] == 0; }\n hash[:energy_reports] = paragraphs.select { |p| p[:type] == 1; }\n hash[:disclaimers] = paragraphs.select { |p| p[:type] == 2; }\n\n %w( rooms energy_reports disclaimers ).map(&:to_sym).each do |paragraph_type|\n hash[paragraph_type].each { |p| p[:vebra_ref] = p.delete(:id); p.delete(:type) }\n end\n\n hash[:rooms].each do |room|\n room[:room_type] = room[:name].gsub(/\\s?[\\d+]$/, '').downcase.gsub(/\\s/, '_')\n end\n end\n\n # was: { :files => [ #<file - type a>, #<file - type b> ] }\n # now: { :files => { :type_a => [ #<file> ], :type_b => [ #<file> ] } }\n if files = hash.delete(:files)\n # extract each file type into separate collections\n hash[:files] = {\n :images => files.select { |f| f[:type] == 0 },\n :maps => files.select { |f| f[:type] == 1 },\n :floorplans => files.select { |f| f[:type] == 2 },\n :tours => files.select { |f| f[:type] == 3 },\n :ehouses => files.select { |f| f[:type] == 4 },\n :ipixes => files.select { |f| f[:type] == 5 },\n :pdfs => files.select { |f| f[:type] == 7 },\n :urls => files.select { |f| f[:type] == 8 },\n :energy_certificates => files.select { |f| f[:type] == 9 },\n :info_packs => files.select { |f| f[:type] == 10 }\n }\n\n %w( images maps floorplans tours ehouses ipixes pdfs urls energy_certificates info_packs ).map(&:to_sym).each do |file_type|\n hash[:files][file_type].each { |f| f[:vebra_ref] = f.delete(:id); f.delete(:type) }\n end\n end\n\n # was: { :hip => { :energy_performance => #<energy performance> } }\n # now: { :energy_performance => #<energy performance> }\n if hip = hash.delete(:hip)\n hash[:energy_performance] = hip[:energy_performance]\n end\n\n # was: { :street => #<street>, :town => #<town>, ... }\n # now: { :address => { :street => #<street>, :town => #<town>, ... } }\n if !hash[:address] && hash[:street] && hash[:town] && hash[:county] && hash[:postcode]\n hash[:address] = {\n :street => hash.delete(:street),\n :town => hash.delete(:town),\n :county => hash.delete(:county),\n :postcode => hash.delete(:postcode)\n }\n end\n\n # was: { :attributes => { :database => 1 }, :web_status => ['For Sale', 'To Let'] }\n # now: { :attributes => { :database => 1 }, :web_status => 'For Sale', :grouping => :sales }\n if type_index(hash)\n hash[:group] = case type_index(hash)\n when 0 then :sales\n when 1 then :lettings\n end\n\n if hash[:status]\n hash[:status] = hash[:status][type_index(hash)]\n end\n end\n\n # was: { :garden/parking => nil } or: { :garden/parking => 0 }\n # now: { :garden/parking => false }\n [ :parking, :garden ].each do |key|\n if hash.keys.include?(key)\n hash[key] = !hash[key].nil? && hash[key].to_i != 0\n end\n end\n\n hash\n end", "def strip_nulls!(hash)\n hash.each_key do |key|\n case value = hash[key]\n when Hash\n strip_nulls!(value)\n hash.delete(key) if value.empty?\n when nil then hash.delete(key)\n end\n end\n\n hash\n end", "def clean_values(h)\n return nil if h.empty?\n return h[\"$t\"] if h.has_key?(\"$t\")\n\n h.each do |k, v|\n if v.is_a?(Array)\n v.map! { |e| clean_values(e) }\n else\n h[k] = clean_values(v)\n end\n end\n end", "def fix_attributes\n fix_encoding\n strip_attributes\n content_manipulation\n sanitize_attributes\n default_attribute_values\n fix_url\n calculate_unique_hash\n end", "def sanitize!(conditions)\n conditions.reject {|key, value| !ALLOWED_KEYS.include?(key) }\n end", "def sanitize_keys(value)\n if value.is_a?(Hash)\n value.map { |k, v|\n k = k.to_s.downcase.tr('^a-z0-9_', '_').to_sym\n v = sanitize_keys(v)\n [k, v]\n }.to_h\n elsif value.is_a?(Array) && (value.size > 1)\n value.map { |v| sanitize_keys(v) }\n elsif value.is_a?(Array)\n sanitize_keys(value.first)\n elsif value.is_a?(String) && value.include?(FileFormat::FILE_FORMAT_SEP)\n value.split(FileFormat::FILE_FORMAT_SEP).compact_blank\n else\n value\n end\n end", "def canonicalize_json_ignore_id(body)\n canonicalize_json(body, :transform => lambda do |x|\n # Need to use strings, not symbols here\n assert x.key?('data')\n assert x['data'].has_key?('id')\n x['data'].delete('id')\n x\n end)\n end", "def fix_malformed_json(malformed_json)\n return malformed_json.gsub(/([a-z][a-zA-Z0-9_]+):(?!\\s)/, '\"\\1\":')\n end", "def sanitize_nested_attributes(mapping)\n key = mapping.keys.first\n klass = mapping[key]\n add_step do |attrs|\n if attrs.has_key?(key)\n attrs[key].compact!\n attrs[key].map! { |val| klass.sanitize_attributes(val) }\n end\n attrs\n end\n end", "def sanitize_associations\n sanitize_association('chapters', Chapter.fields_to_sanitize)\n sanitize_association('series', Series.fields_to_sanitize)\n end", "def replace(hash)\n # #marshal_load requires symbol keys: http://apidock.com/ruby/v1_9_3_125/OpenStruct/marshal_load\n marshal_load(hash.inject({}) { |h, (k,v)| h[k.to_sym] = v; h })\n self\n end", "def filter_hash!(hsh)\n [[:timestamp, ->(t) { t.to_f }]].each do |k, f|\n hsh[k] = f.call(hsh[k])\n end\n hsh\n end", "def remove_unnecessary_data(info_hash) \n just_character_data = info_hash[\"results\"].flatten\nend", "def massageHash(h,top)\n resourceType = nil\n \n # if this is a FHIR class, convert to a hash\n if is_fhir_class?(h.class.name)\n resourceType = h.class.name.demodulize\n h = Marshal.load(Marshal.dump(h.attributes))\n end\n \n if h.is_a? Hash\n # remove \"_id\" attributes\n h.delete(\"_id\")\n # loop through all the entries in the hash\n h.each do |key,value|\n # massage entries that are also hashes...\n if value.is_a? Hash\n h[key] = massageHash(value,false)\n # massage entries that are arrays...\n elsif value.is_a? Array\n # replace each item in the array...\n value.map! do |item|\n if item.is_a? Hash\n next massageHash(item,false) # .. with a massaged hash\n # serialize FHIR children correctly\n elsif is_fhir_class?(item.class.name)\n next massageHash(item,false) # .. with a hash representation of an object\n else\n next item # .. or with the item itself (probably primitive data type)\n end\n end\n # after massaging the array, remove empty arrays\n if value.empty?\n h.delete(key)\n end\n # remove empty attributes\n elsif value.nil?\n h.delete(key)\n # massage entires that are FHIR classes...\n elsif is_fhir_class?(value.class.name)\n h[key] = massageHash(value,false)\n else\n #puts \"Ignoring '#{key}' inside '#{value.class.name}' of type '#{value.class.name}'\"\n end\n \n # add W3C namespace to <div/> tags\n # if key == 'div'\n # i = (h[key] =~ /^<div>/)\n # j = (h[key] =~ /^<div/)\n # if i==0\n # # replace the <div/> tag w/ one with the namespace\n # h[key] = '<div xmlns=\"http://www.w3.org/1999/xhtml\">' + value[5..value.length]\n # elsif i!=0 and j!=0\n # # there is no div tag at all -- add the full <div/> tag w/ namespace\n # h[key] = '<div xmlns=\"http://www.w3.org/1999/xhtml\">' + value + '</div>'\n # end\n # end\n \n end \n end\n \n # if this is a FHIR class, add the 'resourceType' attribute\n if top and !resourceType.nil?\n h['resourceType'] = resourceType\n end\n \n fix_all_keys(h)\n end", "def remove_non_strings(array)\n array.delete_if do |i|\n i.instance_of?(String) == false\n end\n array.each do |i|\n if i.instance_of?(Hash) == true\n array.delete(i)\n end\n end\n return array\nend", "def strip_empty_entries(hash)\n return hash unless hash.is_a?(Hash)\n\n hash.inject({}) do |m, (k, v)|\n m[k] = strip_empty_entries(v) unless v&.empty?\n m.delete(k) if m[k].nil? || m[k].empty?\n m\n end\nend", "def sanitize!; end", "def sanitize_config(configuration={})\n if configuration.is_a?(OpenStruct)\n configuration = configuration.send(:table)\n end\n\n config = configuration.reject do |key,value|\n !(%w(stdout stderr stdin logger).map(&:to_sym).include?(key))\n end\n\n config\n end", "def safeguarded_json\n # Make sure this is actually JSON\n hash = JSON.parse(params[:json])\n\n # Refuse to handle more than 12 chickens at once. What are you, a factory farmer??\n raise \"Too many birds\" if hash.size > 12\n\n return params[:json]\n end", "def underscorize_keys(hash)\n return unless hash.is_a?(Hash)\n hash.keys.each do |k|\n key = k.to_s.underscore.to_sym\n hash[key] = hash[k]\n hash.delete(k) if key != k\n end\n hash\n end" ]
[ "0.79140526", "0.71279997", "0.7099988", "0.68443954", "0.6835184", "0.6672898", "0.6653759", "0.65036935", "0.64968705", "0.6486022", "0.6478653", "0.6443675", "0.64241505", "0.627339", "0.6265209", "0.6256599", "0.6246022", "0.62126154", "0.6212128", "0.620482", "0.6188663", "0.61755675", "0.6171526", "0.61597914", "0.6135093", "0.61343145", "0.61323506", "0.6116599", "0.60936934", "0.607779", "0.6063348", "0.6043035", "0.604035", "0.60399705", "0.6032563", "0.6023799", "0.5977418", "0.59634095", "0.5958049", "0.5956838", "0.5956838", "0.5956838", "0.5956838", "0.5942743", "0.5929358", "0.5917041", "0.5903324", "0.5877796", "0.58709776", "0.5863446", "0.5826333", "0.58181345", "0.57934666", "0.5775267", "0.57603693", "0.5696417", "0.56920856", "0.56916106", "0.56877124", "0.5686903", "0.5678056", "0.56671023", "0.56665635", "0.5663665", "0.5640076", "0.56399405", "0.56321037", "0.56040436", "0.55916846", "0.5590272", "0.5590221", "0.5583229", "0.5578005", "0.55700934", "0.55511063", "0.55371636", "0.55063903", "0.54900527", "0.54874474", "0.54854125", "0.54755193", "0.5472031", "0.54674333", "0.54578376", "0.544756", "0.5443578", "0.5439646", "0.54354376", "0.54330105", "0.54329544", "0.5431438", "0.5403453", "0.5400893", "0.5397773", "0.5387025", "0.53748405", "0.5369428", "0.53679067", "0.5367894", "0.53609514" ]
0.68806356
3
OBTENIR L'ADRESSE EMAIL DE VAUREAL
def get_the_email_of_a_townhal_from_its_webpage doc = Nokogiri::HTML(open("http://annuaire-des-mairies.com/95/vaureal.html")) email = doc.xpath('/html/body/div/main/section[2]/div/table/tbody/tr[4]/td[2]') puts email end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mail\n \n end", "def email; @email; end", "def enviar\n Email.enviar\n end", "def email; end", "def email; end", "def email; end", "def email; end", "def email\n mail.first\n end", "def email\n mail.first\n end", "def envio_email\n mail(to: destinatario.email, subject: \"Precio de la Almendra a fecha #{Date.today.strftime('%d-%m-%Y')}\")\n end", "def email\n @email \n end", "def email\n return unless @user.loa3?\n\n value_for('emails')&.first\n end", "def inbound_email; end", "def inbound_email; end", "def get_activate_email\n end", "def email\n end", "def acceptance_email ucr\n extract_variables ucr\n\n mail to: @user.email\n end", "def email\n\t\t@email\n\tend", "def email\n\t\t@email\n\tend", "def article_email( title, author, content )\n @user_emails = []\n @users = User.all\n @users.each do |user|\n if user.newletter\n @user_emails << user.email\n end\n\n end\n\n @user_emails.each do |user_email|\n @greeting = \"Newest Article: #{title}\n By: #{author},\n\n #{content}\n \"\n\n mail to: user_email, bcc: \"[email protected]\", subject: title\n end\n\n end", "def email\n @invoice = Factura.find(params[:id])\n @company = @invoice.company\n end", "def email=(v)\n @email = alma_string v\n end", "def mailfrom(from_addr); end", "def town_mail\n\turl_array = get_townhall_urls \n\t url_array.each do |townhall_url| #/ pour chaque URL d'une ville du Val d'Oise, on associe l'adresse mail de la mairie\n\tget_townhall_email(townhall_url)\n\tend\nend", "def get_townhall_email\n\tcity_95 = Nokogiri::HTML(open(\"https://www.annuaire-des-mairies.com/95/avernes.html\"))\n\tp city_95.css(\"/html/body/div/main/section[2]/div/table/tbody/tr[4]/td[2]\").text\n#trouve l’adresse mail de la ville avernes:\n#clic droit sur le mail puis inspecter\n#puis dans l’inspecteur, click droit : copy Xpath\nend", "def congratulation_email(user)\n @user = user\n mail to: @user.email, subject: \"[IDEANOTE] 환영합니다.\"\n end", "def proms_mailing_list_email\n \"#{gadz_tabagns}#{gadz_ans}@gadz.org\"\n end", "def email\n @viatico = Viatico.find(params[:id])\n @company = @viatico.company\n end", "def getemail (adresse)\n\tpage = Nokogiri::HTML(open(adresse))\n\treturn page.css('td.style27 p.Style22 font')[6].text\nend", "def get_email(deputy_page_url)\n email = ''\n\n page = Nokogiri::HTML(open(deputy_page_url))\n\n page.css('a[@href ^=\"mailto:\"]').each do |element|\n email << element.text\n break\n end\n\n email\nend", "def email\n\t\treturn @email\n\tend", "def envio_email\n @desticoor = @queja.programa.coordinador.id\n @coordinadorp = Coordinador.find(@desticoor)\n \n QuejaMailer.registro_queja_coordinador(@queja, @coordinadorp,\"Notificación de Queja\").deliver\n QuejaMailer.registro_queja_instructor(@queja,current_user.email, \"Notificación de Queja\" ).deliver\n end", "def email_address\n authentications.emails.active.first.uid rescue nil\n end", "def get_email (ville_names)\n\n # Loop on each cities in the array to get the email\n for n in 0...ville_names.length\n\n # get each link to the depute\n page_url_ville = \"https://www.annuaire-des-mairies.com/95/#{ville_names[n]}.html\"\n\n ville_page = Nokogiri::HTML(open(page_url_ville))\n\n # If any bug when trying to get any email\n begin\n\n # Put each email in an array \"ville_email_array\"\n @ville_email_array << ville_page.xpath(\"//html/body/div/main/section[2]/div/table/tbody/tr[4]/td[2]/text()\").to_s\n rescue => e\n\n @ville_email_array << \" \"\n end\n end\n\n # This value as to be returned.\n # If not this not show email in the json file for the function save_as_json\n return @ville_email_array\n end", "def email\n params['email']\n end", "def email\n\t\tnil\n\tend", "def email\n\t\tnil\n\tend", "def account_activation(pengguna)\n @pengguna = pengguna\n mail to: pengguna.email, subject: \"Aktivasi akun Anda di Aplikasi Web Bimas Katolik\"\n end", "def get_townhall_email(townhall_url)\n # Retourne l’e-mail d'une mairie à partir de l'URL de la page particulière de cette mairie, si cet e-mail a pu être trouvé,\n # renvoie nil sinon\n townhall_email = nil\n page = PageOfHtmlDocument.new(townhall_url).page # Ouvre et parse la page HTML dont on donne l'URL et la stocke dans la variable locale page\n if !page.nil? && page.instance_of?(Nokogiri::HTML::Document)\n #title = page.xpath('/html/head/title').text\n #puts \"Je vais scrapper la page intitulée \\\"#{title}\\\" (\\\"#{townhall_url}\\\").\"\n townhall_email = page.xpath(\"/html/body/div[1]/main/section[2]/div/table/tbody/tr[4]/td[2]\").text\n end\n townhall_email\n end", "def evento_mail(email, titulo , contenido)\n @contenido = contenido\n @titulo = titulo\n @email = email\n mail(to: email , subject: 'Nuevo Evento')\n end", "def contact_email\n @contact = Contact.last\n mail to: \"[email protected], [email protected]\"\n end", "def article_email\n UserMailer.article_email\n end", "def email\n return @email\n end", "def email\n return @email\n end", "def notifica(comentario)\n @comentario = comentario \n mail :to => comentario.comentable.user.email,\n :reply_to => comentario.user.email,\n :bcc => comentario.comentable.comentarios.map{|c| c.user.email}.uniq,\n :subject => \"[MBAcentrum.com] Nuevo comentario sobre #{comentario.comentable}\"\n \n end", "def email\n multi_email.primary_email_record.try(:email)\n end", "def email\n @email ||= select { |type,value| type == :email }.map do |(type,value)|\n value\n end\n end", "def me_user_email\n email = Email.find_primary(me).take if auth?\n email.email || ''\n end", "def user_email\n msg['email'] || entry['email'] || reject['email']\n end", "def contacts_gmail_email(contacts)\n @hash_contactos = Hash.new\n \t\t@contact_email = []\n contacts.each {|lista|\n lista.each {|key,value|\n if (key == :email)\n @contact_email << value\n end\n }\n }\n return @contact_email\n\tend", "def get_email(x)\n lien = x.css('td[1]/a/@href').text\n page = Nokogiri::HTML(URI.open(\"http://www2.assemblee-nationale.fr#{lien}\"))\n email = page.css('.deputes-liste-attributs > dd:nth-child(8) > ul:nth-child(1) > li:nth-child(2) > a:nth-child(1)').text\nend", "def email_address_link user\n \"<a href=\\\"mailto:#{user.email}\\\">#{user.name} <#{user.email}></a>\"\n end", "def from_email\n EmailAddress.find(:all).first\n end", "def micorreo(parametros)\n @nombre = parametros[:nombre]\n @email = parametros[:email]\n @asunto = parametros[:asunto]\n @mensaje = parametros[:mensaje]\n\n mail to: \"[email protected]\", :subject => \"PQRS CES\" \n\n end", "def email_address\n @data['emailAddress']\n end", "def primary_email\n if self[\"gd$email\"]\n _email = self[\"gd$email\"].find { |e| e.primary == \"true\" }\n _email ? _email.address : nil\n else\n nil # no emails at all\n end\n end", "def sandbox_email_address; end", "def sandbox_email_address; end", "def email_address\n \"CoursAvenue <#{token}@#{CoursAvenue::Application::MANDRILL_REPLY_TO_DOMAIN}>\"\n end", "def confirma_reserva(reserva)\n @reserva = reserva\n mail to: reserva.Cliente.email\n end", "def send_create_mail\n user = self\n if user.mail?\n Mail.deliver do\n from 'Joinville Eau Vive <[email protected]>'\n to user.mail(true)\n subject '[JEV] Création de compte sur jevck.com'\n body Erubis::Eruby.new(File.read(File.dirname(__FILE__) + '/../views/mail_registration.erb')).result(:user => user)\n self.charset = 'UTF-8'\n end\n end\n end", "def subscription_email(client)\n cursor = parse \"BEGIN msf.acm_utils.manage_tocs(:publication, :cno, :action, :email, :cur_status, :status_dt, :r_str); end;\"\n cursor.bind_param ':cno', client.to_s\n cursor.bind_param ':email', nil, String, 64\n cursor.bind_param ':action', 'STATUS'\n exec cursor do\n cursor[':email'].blank? ? nil : cursor[':email']\n end\n end", "def get_user_email\n useremail[:value]\n end", "def mailing\n @mail = Prefabmail.find(params[:mail][:message])\n @rent = Rent.find_by_id(params[:id])\n if params[:mail][:to] == \"v\"\n @email = @rent.kunstvoorwerp.user.email\n else\n @email = @rent.user.email\n end\n\n @mail.content = replace_prefab_mail_vars(@mail, @rent)\n end", "def reserva_confirmation(himalaya)\n @himalaya = himalaya\n mail to: himalaya.email,subject:\"conformation reserva de himalaya\"\n end", "def user_email\n @gapi.user_email\n end", "def contact_email\n contact['email_address']\n end", "def activation_needed_email(user)\n @user = user\n @url = \"http://0.0.0.0:3000/users/#{user.activation_token}/activate\"\n\n mail to: @user.email, subject: \"[적어적어]마! 이메일 인증해라\"\n end", "def send_one_email_to(name, mail)\n email = @gmail.compose do\n to mail\n subject \"Apprentissage entre pairs + gratuité + code = The Hacking Project\"\n html_part do\n content_type 'text/html; charset=UTF-8'\n body get_the_email_html(name) #TODO faire pour toutes les villes du tableau -> suppose de lire les colonnes du tableau dans une boucle (ajouter un délai)\n end\n end\nemail.deliver!\nend", "def email\n return Contact.get_default_email self.id\n end", "def email_list\n end", "def recepcion\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\", :subject =>\"nuestro primer correo\"\n end", "def email\n candidate_sheet.candidate_email.to_s\n end", "def email\n result_record = default_email_record\n default_email_record.email if result_record\n end", "def email\n result_record = default_email_record\n default_email_record.email if result_record\n end", "def contacto\n @greeting = \"Hi\"\n\n #@email = 'email al cual envias' #<- email al cual enviaras\n #@alias = '' #<- nombre de quien envia ejem 'Carlos Acosta Del Rio'\n #@reply = '' #<- a quien contestaran\n \n\n mail :to => @email, :subject => \"Contacto De Su Sitio SIC\", :from => \"\\\"\" + @alias + \"\\\" \", :reply_to => @reply\n end", "def selecionar_email_consulta(email_consulta)\n email_filtro_consulta_select.select(email_consulta)\n end", "def determine_email\n return email[-7..-1] == \"uga.edu\" # this should be a constant\n end", "def email\n if @data.attribute_names.include?(:cmupreferredmail)\n @email ||= @data[:cmupreferredmail].last\n else\n @email ||= @data[:mail].last\n end\n end", "def contact_email\n return @contact_email\n end", "def email\n mentee_user ? mentee_user.email : nil\n end", "def send_email_line()\n #define a variable gmail.\n gmail = Gmail.connect(\"email\",\"password\")\n #define a variable email with a loop.\n email = gmail.deliver do\n to ws\n subject \"Présentation The hacking poject\"\n html_part do\n content_type'text/html; charset=UTF8'\n body send_email_text\n end\n end\n #show email acount loggin.\n puts gmail.logged_in?\n #desconnecte after work.\n gmail.logout\nend", "def send_to_alum(email)\n @email = email\n mail(:from => email.user_email, :to => email.alum_email, :subject => email.subject)\n end", "def cuenta_activacion(maestro)\n @maestro = maestro \n mail to: maestro.correo, subject: \"Activa tu cuenta de profesor\"\n end", "def mailboxer_email(_object)\n email\n end", "def notice_from_objective_auth\n\n @auth = User.find(params[:auth_id])\n user_mail = User.find(params[:user_id]).email\n @url = params[:url]\n mail(to: user_mail, subject:'承認されました。')\n \n end", "def mailboxer_email(object)\n email\n end", "def mailboxer_email(object)\n email\n end", "def email\n find_by_type('email')\n end", "def email_address\n raw_info['email_addresses'] && raw_info['email_addresses'].first\n end", "def email\n if self.alternate_email.blank?\n if self.alumni?\n \"#{self.username}@alumni.calvin.edu\"\n else\n \"#{self.username}@students.calvin.edu\"\n end\n else\n self.alternate_email\n end\n end", "def email_link\n \"<a href='mailto:#{contact_email}'>Contact</a>\"\n end", "def emails_full\n format_entities('gd$email')\n end", "def appellant_email\n hearing.appellant_recipient&.email_address\n end", "def email\n \"#{andrew_id}@andrew.cmu.edu\"\n end", "def enviado\n MailConfirm.enviado\n end", "def email_address\n get_attribute(Yoti::Attribute::EMAIL_ADDRESS)\n end", "def email_from_infos\n user_infos.map(&:email).try(:first)\n end", "def enviar_informes(competencia, root_url)\n \n @root_url = root_url.to_s.gsub(/\\/+$/, '')\n @competencia = competencia\n @destinos = Mantenedor.mail_evento.collect {|d| d.valor}.join(', ')\n puts \"Esto llego aca !\" + competencia.tipocompetencia.to_s\n #Recibo destinos desde el mantenedor \n mail(:to => @destinos, :subject => \"New Models | Envio Detalle de Competencias - #{competencia.id.to_s}\") \n end", "def email_address\n return @email_address\n end", "def email_address\n return @email_address\n end" ]
[ "0.6946293", "0.678043", "0.6742999", "0.66691005", "0.66691005", "0.66691005", "0.66691005", "0.66582733", "0.66582733", "0.6616943", "0.64505464", "0.64341134", "0.6428584", "0.6428584", "0.63659495", "0.63554114", "0.6318685", "0.63108355", "0.63108355", "0.6309078", "0.6282451", "0.62627584", "0.62317336", "0.6228909", "0.62200546", "0.620199", "0.61911136", "0.6183559", "0.6181007", "0.6176024", "0.61705136", "0.6167915", "0.61647266", "0.6151213", "0.61503816", "0.61472845", "0.61472845", "0.6135777", "0.6129377", "0.6128714", "0.61228013", "0.6120012", "0.6113512", "0.6113512", "0.6108034", "0.610641", "0.6101759", "0.6101315", "0.6101023", "0.60991746", "0.60983074", "0.6098246", "0.6096602", "0.60854584", "0.60852146", "0.6082543", "0.6068211", "0.6068211", "0.605698", "0.6055092", "0.6053455", "0.6043535", "0.60404825", "0.6032043", "0.6026081", "0.60241526", "0.60120463", "0.6004223", "0.6002276", "0.6001815", "0.59931284", "0.5992329", "0.5988803", "0.59853375", "0.59853375", "0.59818417", "0.5979582", "0.5975898", "0.5970532", "0.59684265", "0.5964849", "0.596394", "0.5957781", "0.5955286", "0.59524244", "0.59492916", "0.59463716", "0.59463716", "0.5944745", "0.5944339", "0.5942791", "0.59415776", "0.59402436", "0.5933738", "0.5932723", "0.59247845", "0.59205294", "0.5916463", "0.5907128", "0.5906252", "0.5906252" ]
0.0
-1
OBTENIR TOUTES LES URL DE VILLES DU VAL D'OISE
def get_all_the_urls_of_val_doise_townhalls doc = Nokogiri::HTML(open("http://annuaire-des-mairies.com/val-d-oise.html")) puts doc.xpath('//a[@class = "lientxt"]/@href') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url\n end", "def get_link\n page = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/val-d-oise.html\"))\n faux_liens_villes =[]\n page.xpath('//*[@class=\"lientxt\"]').each do |lien|\n faux_liens_villes << lien.values[1]\n end\n liens_villes = faux_liens_villes.map{ |el| \"http://annuaire-des-mairies.com\" + el[1..-1]}\n return liens_villes\n end", "def url\n end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def link() url; end", "def link() url; end", "def url\n \[email protected]_s\n end", "def set_url(quantity)\n if @type == 'mercadolivre'\n url_aux = @url.remove(@url_mercado_livre)\n \"https://api.mercadolibre.com/sites/MLB/search?nickname=#{url_aux}&offset=#{quantity}\"\n else\n url_aux = if @url.ends_with?('/')\n @url\n else\n \"#{@url}/\"\n end\n \"#{url_aux}api/catalog_system/pub/products/search?_from=#{quantity}&_to=#{quantity + 49}\"\n end\n end", "def url\n @url\n end", "def url=(_); end", "def website_url; website end", "def url\n @url\n end", "def url\n @url\n end", "def base_url\n urlpage = \"http://annuaire-des-mairies.com/val-d-oise.html\"\n doc = Nokogiri::HTML(open(urlpage))\nend", "def url(value)\n @url = value\n end", "def url\n ''\n end", "def get_url\n @url\n end", "def url=(_arg0); end", "def url=(_arg0); end", "def url=(_arg0); end", "def url=(_arg0); end", "def url=(_arg0); end", "def url=(_arg0); end", "def url=(_arg0); end", "def get_url\n nokogiri_object = Nokogiri::HTML(open(\"https://www.nosdeputes.fr/deputes\"))\n web_object = nokogiri_object.xpath('//tr/td/a') #.xpath = cherche plus precisement\n array = []\n web_object.each {|link| array << link[\"href\"]}\n # ajoute le reste de l'url contenant les noms à l'url de base\n array.map! {|url| url = \"https://www.nosdeputes.fr\" + url}\n return array\nend", "def get_url\n page = Nokogiri::HTML(open(\"http://www2.assemblee-nationale.fr/deputes/liste/alphabetique\"))\n url_deputy = page.css(\"ul.col3 a\")\nend", "def url\n @url.to_s\n end", "def ciao\n redirect_to '/' && return if params[:url].blank?\n @ua = {:action => UserAction.id_for('external_url'), :data => {:source => params[:source]}}\n url = Base64.decode64(params[:url])\n url = \"http://#{url}\" unless url.match(/https?:\\/\\//) != nil\n redirect_to url\n end", "def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend", "def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend", "def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend", "def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend", "def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend", "def url\n data['url']\n end", "def modifier_lien\n if params[:lien] != \"\" \n @lien = Lien.find(params[:id])\n @donnee_url = OpenGraph.fetch(params[:lien])\n \n @url_lien = params[:lien]\n element = @url_lien.split(\".\")\n tab = @url_lien.split(\"//\")\n if tab[0] == \"http:\"\n @url = @url_lien\n else\n @url = \"http://\"+@url_lien\n end\n name = \"/images_liens/thumb#{Time.now.to_i}.jpg\"\n if @donnee_url\n\t titre = @donnee_url.title\n\t desc = @donnee_url.description\n\t image = @donnee_url.image\n image_or = Magick::Image.read(image)[0]\n image = image_or.crop_resized!(297, 195, Magick::NorthGravity)\n image.write(\"#{RAILS_ROOT}/public\"+name) do self.quality = 100 end\n else\n\t begin\n uri =URI(@url)\n #htmlcontent = #Net::HTTP.get(uri)\n #soup = BeautifulSoup.new(htmlcontent)\n hdrs = {\"User-Agent\"=>\"Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1\", \"Accept-Charset\"=>\"utf-8\", \"Accept\"=>\"text/html\"}\n my_html = \"\"\n \n open(@url, hdrs).each{|s| my_html << s}\n doc = Hpricot(my_html)\n desc = HTMLEntities.new.decode(doc.search(\"meta[@name*=description]\").map {|e| e.get_attribute(\"content\") }.to_s)#soup.find('meta', {'name' => 'description'})['content']\n titre = HTMLEntities.new.decode(doc.at(\"html/head/title\").inner_html)#soup.html.head.title.string\n\t rescue\n titre = \"\"\n flash[:error] = \"Ce lien est certainement plein de joie mais malheureusement, le format n'est pas conforme à la Boite à Joie, peut être existe t-il un autre lien qui vous rende joyeux ?\"\n redirect_to (:controller => 'liens', :action => \"new\", :p => \"home\")\n return 0\n end\n \n #desc = \"\"\n\t name = \"http://api.url2png.com/v3/P4F280C28BB8E7/#{Digest::MD5.hexdigest('S94BC47B3A5190+'+@url)}/297x195/#{@url}\"#\"https://www.apercite.fr/api/apercite/800x600/oui/oui/#{@url}\"\n end\n \n \n respond_to do |format|\n if Lien.update(params[:id], :titre_lien =>titre, :description_lien => desc, :url_lien => params[:lien], :image_lien => name)\n format.html { redirect_to(:controller => 'auteurs', :action => 'new', :id => params[:idauteur], :p => \"user\", :idlien => params[:id], :auteur => params[:auteur][:pseudo_auteur]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"new\", :p => \"home\" }\n format.xml { render :xml => @lien.errors, :status => :unprocessable_entity }\n end\n end\n else\n flash[:notice] = \"Désolé monsieur ou madame !!\"\n redirect_to :back\n end\n end", "def get_all_the_urls_of_val_doise_townhalls()\n urls_town = []\n doc = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/val-d-oise.html\"))\n doc.css('a.lientxt').each do |x|\n lien_page_mairie = x['href']\n lien_page_mairie.slice!(0)\n lien_page_mairie = \"http://annuaire-des-mairies.com\" + lien_page_mairie\n urls_town.push(lien_page_mairie)\n end\n return urls_town\nend", "def get_all_the_urls_of_val_doise_townhalls (web_list)\npage = Nokogiri::HTML(RestClient.get(web_list))#recupere le code html du site\npage.css(\"a.lientxt\").each do |note|\nnote['href'] = note['href'][1..-1]#donne les urls de chaque commune en retirant le premier caractaire c-a-d \".\"\nweb_page = \"http://annuaire-des-mairies.com\" + note['href']\nputs web_page\nget_the_email_of_a_townhal_from_its_webpage(web_page)#rappel la fonction get_the_email_of_a_townhal_from_its_webpage pour recuperer les adresses emails grace aux liens (fonctions recurssive)\nend\nend", "def url\n raise\n end", "def url\n super\n end", "def url\n @url ||= params['url']\n end", "def get(url); end", "def original_url; end", "def fetch_movies_url\n # Visiter le site imdb: https://www.imdb.com/chart/top\n raw_html = URI.open(IMDB_TOP_CHART_URL).read\n # Utiliser nokogiri pour parser le fichier html recu\n html_doc = Nokogiri::HTML(raw_html)\n urls = []\n\n # Rechercher avec nokogiri les urls des 5 premiers films\n html_doc.search('.titleColumn a').first(5).each do |link|\n # Stocker dans un tableau\n urls << \"https://www.imdb.com#{link.attribute('href').value}\"\n end\n\n urls\nend", "def set_url\n @url = Url.get_from_short(params[:id])\n end", "def geturl() \n\t\treturn self.response.geturl()\n end", "def url_content\n urn\n end", "def url\n self[:url].blank? ? \"/\" : self[:url]\n end", "def to_s; @url; end", "def url\n\t\tagencia_paquete_path(self)\n\tend", "def url\n dnb_session_no = @session_no ||= 1\n session_time = dnb_session_no == 2 ? \"12:15\" : \"08:15\"\n \"http://www.dnbnord.pl/pl/tabela-kursow-walut-dla-kredytow/go:godzina=#{session_time}\"\n end", "def url\n uri.to_s\n end", "def get_all_the_urls_of_val_doise_townhalls\n\n\n page1 = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/val-d-oise.html\")) #ouvre la page ciblée\n $get_llinks = page1.css('a[href*=\"95\"]').map{|link| link[\"href\"]} #definie un array \"get_llinks\" cible la balise avec href 95 et prend toutes les fin d'url\n\n\nend", "def get_all_the_urls_of_val_doise_townhalls\n\n\n page1 = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/val-d-oise.html\")) #ouvre la page ciblée\n $get_llinks = page1.css('a[href*=\"95\"]').map{|link| link[\"href\"]} #definie un array \"get_llinks\" cible la balise avec href 95 et prend toutes les fin d'url\n\n\nend", "def url\n send(\"url_#{page.env}\")\n end", "def get_all_the_urls_of_val_doise_townhalls(url)\n page = Nokogiri::HTML(open(url))\n urls = []\n source = \"http://annuaire-des-mairies.com/\"\n news_links = page.css(\"a\").select{|link| link['class'] == \"lientxt\"}\n news_links.each do |link|\n lien = link['href']\n nv_link = lien.byteslice(2,lien.length)\n nv_link = source + nv_link\n urls << nv_link\n end\n return urls\nend", "def url; (page.url rescue ''); end", "def url; (page.url rescue ''); end", "def set_url\n # @url = Url.find(params[:id])\n end", "def url_server\n\t\t\tunless @links_to_visit.empty?\n\t\t\t\t@url = @links_to_visit.pop\n\t\t\tend\n\t\tend", "def get_all_the_urls_of_val_doise_townhalls\n mairie_val_d_oise = Array.new\n page = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/val-d-oise.html\"))\n links = page.css('a.lientxt')\n links.each do |mairie|\n mairie_val_d_oise << mairie['href']\n end\n return mairie_val_d_oise\nend", "def url\n if derivative\n derivative_url || regular_url\n elsif version\n version_url\n else\n regular_url\n end\n end", "def get_all_the_urls_of_val_doise_townhalls(page_url)\n doc = Nokogiri::HTML(open(page_url))\n urls = []\n#on recupere le css a[class=lientxt]\n get_urls = doc.css(\"a[class=lientxt]\")\n get_urls.each{|link| urls.push(\"http://annuaire-des-mairies.com\"+link['href'][1...link['href'].length])}\n urls\nend", "def href; end", "def show\n @url = @oi.urls.new\n end", "def my_url\n url 'my'\n end", "def url\n \"#{@client.site_url}/#{id}\"\n end", "def url\n puts url\n \"article/#{url}\"\n puts \"right\"\n end", "def URI(url); end", "def val_doise_website\n page = Nokogiri::HTML(open('https://www.annuaire-des-mairies.com/val-d-oise.html'))\n return page\nend", "def get_url_cities_array(page)\r\n url_cities_array = []\r\n urls = page.xpath('//*[@class=\"lientxt\"]/@href') \r\n urls.each do |url|\r\n url_cities_array << (\"https://www.annuaire-des-mairies.com\" + url.text[1..-1]) # rajout à partir du deuxième caractère pour éviter d'ajouter le point \r\n print \".\" # affichage pour simuler le chargement\r\n end\r\n return url_cities_array\r\nend", "def url() read_attribute_w_fallbacks( :url, :auto_url ); end", "def original_url\n url\n end", "def get_all_the_urls_of_val_doise_townhalls(page_url)\n tab = []\n doc = Nokogiri::HTML(open(page_url))\n tab_lien = doc.css(\"a\").select{|link| link['class']==\"lientxt\"}\n lien =\"http://annuaire-des-mairies.com/\"\n tab_lien.each{|link| tab.push(lien+link['href'])}\n tab\nend", "def url\n uri\n end", "def url\n uri\n end", "def baseurl; end", "def p_url\n Rails.application.routes.url_helpers.rent_url(id, host: PUBLIC_URL)\n end", "def url\n if super=~/ticketmaster.com/\n return \"http://ticketsus.at/tourfilter?CTY=37&DURL=#{super}\"\n else\n return super\n end\n end", "def url\n response[\"url\"]\n end", "def url\n uri.to_s\n end", "def gets_urls\n page = Nokogiri::HTML(URI.open('http://www2.assemblee-nationale.fr/deputes/liste/alphabetique'))\n urls = []\n\n page.css('div.col-container > ul > li > a').each do |fetch|\n urls.push('http://www2.assemblee-nationale.fr' + fetch['href'])\n end\n\n urls\nend", "def to(url); end", "def ui_url\n\t\t\thref\n\t\t\t\t.gsub(\"api/v1/companies\", \"foretak\")\n\t\t\t\t.gsub(\"sales\", \"handel/salg\")\n\t\tend" ]
[ "0.6703674", "0.6689681", "0.6644348", "0.664131", "0.664131", "0.664131", "0.664131", "0.664131", "0.664131", "0.664131", "0.664131", "0.664131", "0.664131", "0.664131", "0.664131", "0.664131", "0.664131", "0.664131", "0.664131", "0.664131", "0.664131", "0.664131", "0.6612163", "0.6612163", "0.65815014", "0.6577909", "0.65730584", "0.6559665", "0.6556623", "0.6510407", "0.6510407", "0.64715207", "0.64534634", "0.6403655", "0.6387607", "0.63797987", "0.63797987", "0.63797987", "0.63797987", "0.63797987", "0.63797987", "0.63797987", "0.63575226", "0.63240826", "0.62802863", "0.6249929", "0.62198967", "0.62198967", "0.62198967", "0.62198967", "0.62198967", "0.6207078", "0.61914164", "0.6181615", "0.6159359", "0.61440647", "0.6138627", "0.6130789", "0.6108565", "0.61015207", "0.6101285", "0.61010504", "0.6095673", "0.6083041", "0.60802853", "0.60787916", "0.6069131", "0.6066155", "0.6061624", "0.60593194", "0.60593194", "0.6051834", "0.6048263", "0.60450625", "0.60450625", "0.6038033", "0.60164255", "0.60144776", "0.60101575", "0.6007624", "0.5997783", "0.59913844", "0.59805983", "0.59798664", "0.5972227", "0.59523207", "0.59425396", "0.5941559", "0.5939871", "0.592735", "0.59241676", "0.59237045", "0.59237045", "0.5916314", "0.5915963", "0.5913393", "0.5905907", "0.5905265", "0.5904623", "0.5903202", "0.59013647" ]
0.0
-1
Title: Find Maximum and Minimum Values of a List v1
def min(list) list.min end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min_max(list)\n list.minmax\nend", "def min_max(list)\n [list.min, list.max]\nend", "def min_max(lst)\n p '--- Jan-06-2017 problem ---'\n # you can also do lst.minmax\n [lst.min, lst.max]\nend", "def min_max(lst)\n return lst.minmax\nend", "def min_max(lst)\n lst.minmax\nend", "def min_max(lst)\n lst.minmax\nend", "def min_max(lst)\n lst.minmax\nend", "def min_max(lst)\n lst.minmax\nend", "def min_max(lst)\n lst.sort!\n [lst.first, lst.last]\nend", "def min_max(lst)\n x = lst.sort\n m = []\n m.push(x.first)\n m.push(x.last)\n m\nend", "def minmax(v)\n\tv = v.sort\n\treturn v.first, v.last\nend", "def minmax_by list, &block\n list.minmax_by(&block)\nend", "def min_max(lst)\n return [lst[0], lst[0]] if lst.size < 2\n sorted = lst.sort { |a, b| a - b }\n [sorted.first, sorted.last]\nend", "def find_minmax\n loc1, loc2 = self.find_minmax_locator\n [loc1 && loc1.value, loc2 && loc2.value]\n end", "def min_max(nums)\n\treturn [nums.min, nums.max,]\nend", "def find_minmax(populations)\n min, max = nil, nil\n\n populations.each do |s, p|\n if min == nil or p < min\n min = p\n end\n\n if max == nil or p > max\n max = p\n end\n end\n\n [min, max]\nend", "def min_max(numbers)\n numbers.minmax { |a, b| a <=> b }\nend", "def minmax(&block)\n un_defined = MaglevUndefined\n mino = un_defined\n maxo = un_defined\n if block_given?\n self.each { |o|\n\tif mino._equal?(un_defined)\n\t mino = o\n\t maxo = o\n\telse\n\t c = block.call(o, mino) \n\t if c._equal?(nil)\n\t raise ArgumentError, \"comparison of #{o.class} with #{mino} failed\"\n\t end\n\t if c < 0\n\t mino = o\n\t end\n\t c = block.call(o, maxo) \n\t if c._equal?(nil)\n\t raise ArgumentError, \"comparison of #{o.class} with #{maxo} failed\"\n\t end\n\t if c > 0\n\t maxo = o\n\t end\n\tend\n } \n else\n self.each { |o|\n\tif mino._equal?(un_defined)\n\t mino = o\n\t maxo = o\n\telse \n\t c = o <=> mino\n\t if c._equal?(nil)\n\t raise ArgumentError, \"comparison of #{o.class} with #{mino} failed\"\n\t end\n\t if c < 0\n\t mino = o\n\t end\n\t c = o <=> maxo\n\t if c._equal?(nil)\n\t raise ArgumentError, \"comparison of #{o.class} with #{maxo} failed\"\n\t end\n\t if c > 0\n\t maxo = o\n\t end\n\tend\n } \n end\n mino._equal?(un_defined) ? [ nil, nil] : [ mino, maxo ]\n end", "def test_0740_minmax_by\n @@log.debug \"test_0740_minmax_by starts\" if @@log.debug?\n assert_respond_to(@list, :minmax_by, \"test_0740_minmax_by_respond\")\n # Type check\n enum = @list.minmax_by\n result = enum.is_a? Enumerator\n assert(result,\"test_0740_minmax_by_class\") \n # Search by item\n result = @list.minmax_by {|item|\n case\n when item == @dad\n 9999\n when item == @cab\n 0\n else\n 1\n end\n }\n assert_equal(result, [@cab, @dad], \"740_minmax_by_res01\")\n # Search by length of first name (note first found for max)\n result = @list.minmax_by {|item| item.first.length }\n assert_equal(result, [@bsb, @cab], \"740_minmax_by_res02\")\n #\n @@log.debug \"test_0740_minmax_by ends\" if @@log.debug?\n end", "def get_max_score(list)\n max = list[0].value\n list.each do |l|\n max = l.value if l.value > max\n end\n return max\n end", "def restrict(value, range)\n [[value, range.first].max, range.last].min\n end", "def my_min_2(list) \n min = list.first \n list.each {|num| min = num if min > num }\n min\nend", "def maxmin(num)\n\tnum = [4, 3981, 4829, 53, 38]\n\tnum.sort.last \n\tnum.sort.first \nend", "def minmax\n [min, unbounded? ? INFINITY : max]\n end", "def test_0730_minmax\n @@log.debug \"test_0730_minmax starts\" if @@log.debug?\n assert_respond_to(@list, :minmax, \"test_0730_minmax_respond\")\n # Basic, no block.\n result = @list.minmax\n assert_equal(result, [@bsb, @aen], \"test_0730_minmax_natural\")\n # Basic, block check.\n result = @list.minmax {|a,b| a.first <=> b.first}\n assert_equal(result, [@aen, @dad], \"test_0730_minmax_first\")\n @@log.debug \"test_0730_minmax ends\" if @@log.debug?\n end", "def my_min_2(list)\n min = list.first\n list.each do |num|\n if num < min \n min = num\n end\n end\n min\nend", "def my_min2(list)\n min = list[0]\n list.each do |el|\n min = el if el < min\n end\n min\nend", "def my_min2(list)\n result = list.first\n list.each do |el|\n result = el if el < result\n end\n result\n\nend", "def my_min(list)\n\n min = nil\n\n list.each do |ele|\n min ||= ele\n list.each do |ele2|\n if ele2 < min\n min = ele2\n end\n end\n end\n\n min\nend", "def my_min(list)\r\n smaller_ele = []\r\n list.each do |ele1|\r\n list.each do |ele2|\r\n smaller_ele << [ele1,ele2].min \r\n end\r\n end\r\n return smaller_ele.min\r\nend", "def my_min_2(list)\n min = nil\n\n list.each do |num|\n min = num if min.nil? || num < min\n end\n\n min\nend", "def max list = @alt\n values = self[list]\n values.reduce(0){ |memo,v| (v>memo ? v : memo) }\n end", "def my_min2(list)\n min = 0\n list.each do |el|\n min = el if el < min\n end\n min\nend", "def my_min_better(list)\n min = list.first\n list.each do |el|\n min = el if el < min\n end\n min\nend", "def my_min(list)\n min = list.first \n\n list.each do |el|\n if el < min \n min = el \n end\n end\n min\nend", "def my_min_3(list)\n subs = []\n\n list.each_index do |i|\n list.each_index do |j|\n unless i > j\n subs << list[i..j]\n end\n end\n end\n\n subs.map do |sub|\n sub.reduce(:+)\n end.max\nend", "def my_min_ii(list)\n min = list.first\n list.each do |el|\n min = el if el < min\n end\n min\nend", "def min\n empty? ? Float::INFINITY : @list.head.value[1]\n end", "def min\n empty? ? Float::INFINITY : @list.head.value[1]\n end", "def my_min(list)\n min = 0\n list.each do |ele|\n list.each do |ele2|\n min = ele if ele < ele2 && ele < min\n end\n end\n min\nend", "def max\n empty? ? -Float::INFINITY : @list.head.value[2]\n end", "def max \n @list.reduce(0){ |memo,v| (v>memo ? v : memo) }\n end", "def check_list_linear(array)\n min = array.first\n array.each do |num|\n min = num if num < min\n end\n min\n end", "def max_min\n tab_x = Array.new\n tab_y = Array.new \n @tab_point.each do |point|\n tab_x.push(point.x)\n tab_y.push(point.y)\n end\n\n [tab_x.min, tab_y.min, tab_x.max, tab_y.max]\n end", "def getMinMax(array,pos)\n minimum = 1000000\n maximum = -1000000\n for player in array\n if player[4] == pos\n minimum = [player[player.length-1],minimum].min\n maximum = [player[player.length-1],maximum].max\n end\n end\n return [minimum,maximum]\nend", "def my_min(list)\n minimum_num = [] \n list.each do |num1| \n minimum_num = num1 if list.all? {|ele| ele >= num1}\n end\n minimum_num\nend", "def get_relative_min_max(array)\n min = 1.00000000000000000\n max = 0.00000000000000000\n arr = []\n test = array.map.with_index do |val, id|\n # relative_minimum = min\n # relative_maximum = max\n\n if val < min \n min = val \n elsif val > max\n max = val\n elsif val == min && val == max \n min = val - 0.00000000000000001\n max = val\n end\n \n r = scale(val, min, max, -160, -20)\n d = scale(val, min, max, 300, 500)\n n = scale(val, min, max, 20, 100)\n\n \n {\n average: val,\n rel_min: min,\n rel_max: max,\n scaled_dist: d,\n scaled_rad: r,\n scaled_noise: n \n # scaled_dist: scale(val, min, max, 20, 600),\n # scaled_rad: scale(val, min, max, -160, 100) \n } \n end\n end", "def my_min(list)\n min = list[0]\n\n list.each do |ele| \n case min <=> ele\n when 1\n min = ele\n when 0\n next\n when -1\n min = min \n end\n end\n\n min\nend", "def logical_minmax\n return @basic_die.minmax unless @rerolls || @maps\n return minmax_mappings(@basic_die.all_values) unless @rerolls\n\n min_result, max_result = logical_rerolls_minmax\n return minmax_mappings((min_result..max_result)) if @maps\n\n [min_result, max_result]\n end", "def my_min(list)\n min = list[0]\n (0...list.length).each do |i| \n min = list[i] if list[i] < min\n end\n min\nend", "def my_min_2(list) # n\n min_value = list.first\n i = 0\n while i < list.length\n min_value = list[i] if list[i] < min_value\n i += 1\n end\n min_value\nend", "def max\n temp = @first\n maxValue = -999999\n while !temp.nil?\n if temp.value > maxValue\n maxValue = temp.value\n end\n temp = temp.next\n end\n maxValue\n end", "def max\r\n temp = @first\r\n maxValue = -999999\r\n while !temp.nil?\r\n if temp.value > maxValue\r\n maxValue = temp.value\r\n end\r\n temp = temp.next\r\n end\r\n maxValue\r\n end", "def my_min(list)\n min = list[0]\n (1...list.length).each do |i| \n min = list[i] if list[i] < min \n end\n min\nend", "def check_min_max(candidates)\n elements_matched = []\n\n valid_attributes = []\n valid = []\n\n error = nil\n sub_errors = []\n\n sort_candidates(candidates, valid, valid_attributes)\n\n msg = \"\"\n\n error = check_min(valid, valid_attributes,\n elements_matched, error, sub_errors, msg)\n\n error = check_max(valid, error, sub_errors, msg)\n\n if !error.nil?\n # set the error\n @validation_item.add_error(error)\n end\n\n # map ValidationItem[] to Element[]\n valid_elements = valid.map {|can| can.valid_elements.first }\n return valid_elements\n end", "def my_min_linear(list)\n smallest_number = list.first\n \n list.each do |num|\n smallest_number = num if num < smallest_number\n end\n\n smallest_number\nend", "def miniMaxSum(arr)\n minimum = arr.sum\n maximum = 0\n arr.collect do |number|\n sum = arr.sum - number\n minimum = [minimum, sum].min\n maximum = [maximum, sum].max\n end\n puts minimum.to_s + \" \" + maximum.to_s\nend", "def min() end", "def max\r\n temp = @first\r\n maxValue = -99999\r\n while !temp.nil?\r\n if temp.value > maxValue\r\n maxValue = temp.value\r\n end\r\n temp = temp.next\r\n end\r\n return maxValue\r\n end", "def my_min(list)\n\n # phase 1\n # min = list.first\n # list.each_with_index do |ele_1, i_1|\n # list.each_with_index do |ele_2, i_2|\n # if i_2 != i_1\n # if min > ele_2\n # min = ele_2\n # end\n # end\n # end\n # end\n # min\n\n # phase 2\n min = list.first\n list[1..-1].each do |ele|\n if min > ele\n min = ele\n end\n end\n min\nend", "def my_min2(int_list)\n min = 0\n\n int_list.each do |int|\n min = int if int < min\n end\n\n min\nend", "def my_min1(int_list)\n int_list.each do |int1|\n return int1 if int_list.all? { |int2| int2 >= int1 }\n end\nend", "def min_max(m1, m2)\n self.min(m2).max(m1)\n end", "def minmax_index ; raise 'not implemented'; end", "def my_better_min(list)\n min = list[0] #1\n\n list.each_with_index do |ele_1, i| #n\n if ele_1 < min # 1 *n\n min = ele_1 #1 *n\n end\n end\n\n min #1\n # (i...list.length).each do |j|\n # if list[i] list[j]\nend", "def max\n temp = @first\n maxValue = -999999\n while !temp.nil?\n if temp.value > maxValue\n maxValue = temp.value\n end\n temp = temp.next\n end\n return maxValue\n end", "def maxAndMinArray(array)\n max = 0;\n min = 0;\n array.each do\n |n|\n if n > max\n max = n\n end\n\n if ((n < min) || (min == 0))\n min = n\n end\n end\n puts \"Le maximum est #{max} et le minimum est #{min}.\"\nend", "def set_min_max_price_values\n price_facet_rows = @products.facet(:price).rows.sort_by{|row| row.value}\n @min_price = price_facet_rows.first.try(:value) || 0\n @max_price = price_facet_rows.last.try(:value) || 1000\n end", "def stock_picker2(array) \n max_diff = 0\n min = array[0]\n\n array.each_with_index do |val, idx|\n diff = val - min\n max_diff = diff if diff > max_diff\n min = val if val < min\n end\n\n max_diff\nend", "def max\r\n\ttemp = @first\r\n\tmaxValue = nil\r\n\tif !temp.nil? then\r\n\t\tmaxValue = temp.value\r\n\t\ttemp = temp.next\r\n\tend\r\n\twhile !temp.nil?\r\n\t\tif temp.value > maxValue then\r\n\t\t\tmaxValue = temp.value\r\n\t\tend\r\n\t\ttemp = temp.next\r\n\tend\r\n\treturn maxValue\r\n end", "def minmax(arr)\n\n if arr.length <= 1\n return arr\n elsif arr.length == 2\n smallest = nil\n largest = nil\n if arr[0] > arr[1]\n smallest = arr[1]\n largest = arr[0]\n else\n smallest = arr[0]\n largest = arr[1]\n end\n return [smallest, largest]\n else\n m = arr.length / 2\n small1, large1 = minmax(arr[0...m])\n small2, large2 = minmax(arr[m..-1])\n return [[small1, small2].min, [large1, large2].max]\n end\n\nend", "def my_min2(list)\n smallest_number = list.first\n list.each do |num|\n smallest_number = num if num <= smallest_number\n end\n smallest_number\nend", "def set_max_min(grouplisthash)\n @maxscore.each do |scorekey, val|\n @chromhash.each do |chrnum, chrom|\n chrom.snp_list.snps.each do |snp|\n snp.results.each do |groupname, res|\n if groupname !~ /:/\n currgroup = grouplisthash[GroupList.get_default_name].grouphash[groupname]\n else\n namepcs = groupname.split /:/\n currgroup = grouplisthash[namepcs[1]].grouphash[groupname]\n end\n\n if (scorekey =~ /beta/i and currgroup.has_beta?) or scorekey !~ /beta/i\n if res.values[scorekey] !~ /\\d/\n next\n end\n if res.values[scorekey].to_f > @maxscore[scorekey].to_f\n @maxscore[scorekey] = res.values[scorekey]\n end\n if res.values[scorekey].to_f < @minscore[scorekey].to_f\n @minscore[scorekey] = res.values[scorekey]\n end\n end\n end\n end\n end\n end\n end", "def my_min(list)\n list.each do |el|\n equal_or_smaller = []\n list.each do |el2|\n equal_or_smaller << el2 if el2 < el\n end\n return el if equal_or_smaller.empty?\n end\nend", "def max_range(array)\r\n\r\n array.max - array.min # max and min methods used\r\nend", "def test_0230_max\n @@log.debug \"test_0230_max starts\" if @@log.debug?\n assert_respond_to(@list, :max, \"test_0230_max_respond\")\n # Basic max for a field (assumes all objects implement <=>)\n # See the test for .min for a surprising resultusing this coding\n # technique.\n assert_equal(\"Newman\", @list.max.last, \"test_0230_max_basic\")\n # Basic max for an object\n lastmax = @list.max {|a,b| a.last <=> b.last }\n assert_equal(@aen, lastmax, \"test_0230_max_block\")\n @@log.debug \"test_0230_max ends\" if @@log.debug?\n end", "def better_my_min\n min = self.first\n self.each do |el|\n min = el if el < min\n end\n min\n end", "def my_min(list)\n i = 0\n min = list[0]\n while i < list.length - 1\n if list[i + 1] < min\n min = list[i + 1]\n end\n i += 1\n end\n min\nend", "def mini_max\nend", "def min(list)\n tiny = list[0]\n list.each do |n|\n if n < tiny\n tiny = n\n end\n end\n puts tiny\nend", "def my_min(list)\r\n smallest = 0\r\n \r\n list.each_with_index do |ele1, idx1|\r\n list.each_with_index do |ele2, idx2|\r\n if idx2 > idx1 \r\n if ele1 < smallest\r\n smallest = ele1\r\n end\r\n if ele2 < smallest\r\n smallest = ele2\r\n end\r\n end\r\n end\r\n end\r\n\r\n smallest\r\nend", "def max(&block)\n flag = true # 1st element?\n result = nil\n self.each{|*val|\n val = val.__svalue\n if flag\n # 1st element\n result = val\n flag = false\n else\n if block\n result = val if block.call(val, result) > 0\n else\n result = val if (val <=> result) > 0\n end\n end\n }\n result\n end", "def my_min_2(list)\n smallest = 0\n list.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def get_bounds\n [ @min, @max ]\n end", "def best_profit( array )\n\n max = 0\n min = nil\n \n array.each do | current |\n min = current if min.nil? || current < min\n max = current - min if ( current - min > max)\n\n puts \"min is #{ min }\"\n end\n\n max\nend", "def min_value_and_index\n [min, min_index]\n end", "def min; end", "def min; end", "def my_min(list)\r\n smallest = list.first\r\n list.each do |ele|\r\n smallest = ele if ele < smallest\r\n end\r\n return smallest\r\nend", "def clamp(x , min_or_max={})\n [[x, min_or_max[:max]].compact.min, min_or_max[:min]].compact.max\n end", "def find_min_max_values(schedule)\n\n # validate schedule\n if schedule.to_ScheduleRuleset.is_initialized\n schedule = schedule.to_ScheduleRuleset.get\n\n # gather profiles\n profiles = []\n defaultProfile = schedule.to_ScheduleRuleset.get.defaultDaySchedule\n profiles << defaultProfile\n rules = schedule.scheduleRules\n rules.each do |rule|\n profiles << rule.daySchedule\n end\n\n # test profiles\n min = nil\n max = nil\n profiles.each do |profile|\n profile.values.each do |value|\n if min.nil?\n min = value\n else\n if min > value then min = value end\n end\n if max.nil?\n max = value\n else\n if max < value then max = value end\n end\n end\n end\n result = {\"min\" => min, \"max\" => max} # this doesn't include summer and winter design day\n elsif schedule.to_ScheduleConstant.is_initialized\n schedule = schedule.to_ScheduleConstant.get\n const_val = schedule.value\n result = {\"min\" => const_val, \"max\" => const_val}\n else\n result = nil\n end\n\n return result\n\n end", "def find_first_geq(list, item, min, max)\n # puts \"list=#{list} item=#{item} min=#{min} max=#{max}\"\n if max <= min\n return list[min] >= item ? min : -1\n end\n\n pivot = min+(max-min)/2\n if list[pivot] >= item\n find_first_geq(list, item, min, pivot)\n else\n find_first_geq(list, item, pivot+1, max)\n end\nend", "def my_min(list)\n smallest_num = nil\n list.each do |num|\n if smallest_num == nil || smallest_num > num\n smallest_num = num\n end\n end\n smallest_num\nend", "def calculate_auto_bounds\n return [ 0, 0, 0, 0 ] if @markers.length == 0\n \n max_lat, max_lng = @markers.first.point\n min_lat, min_lng = @markers.first.point\n \n @markers.slice(1, @markers.length).each do |marker|\n if marker.point[0] < min_lat then min_lat = marker.point[0] end\n if marker.point[0] > max_lat then max_lat = marker.point[0] end\n if marker.point[1] < min_lng then min_lng = marker.point[1] end\n if marker.point[1] > max_lng then max_lng = marker.point[1] end\n end\n \n return [ min_lat, min_lng, max_lat, max_lng ]\n end", "def max\r\n temp = @first\r\n maxValue = -99999\r\n\r\n while !temp.nil?\r\n if temp.value > maxValue then\r\n maxValue = temp.value \r\n end \r\n temp = temp.next\r\n end \r\n maxValue\r\nend", "def testMinMax\n assert_raise( RangeError ) {\n dm = DotManager.new( 1, 100, 90, 0, 50 )\n }\n assert_raise( RangeError ) {\n dm = DotManager.new( 1, 10, 90, 20, 19 )\n }\n end", "def my_min(list)\n smallest = list.first\n list.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def item_max() @item_max end", "def test_0250_min\n @@log.debug \"test_0250_min starts\" if @@log.debug?\n assert_respond_to(@list, :min, \"test_0250_min_respond\")\n # This is subtle, and the result is suprising at first.\n # This coding style assumes that all objects implement <=>.\n # However, the .ndata member of Person is _not_ included in a Person's\n # <=> algorithm. This method returns .ndata for the .min of all\n # Person's in the collection, as determined by <=>.\n # Because of this, it is probably not a great coding technique. :-)\n assert_equal(3, @list.min.ndata, \"test_0250_min_basic\")\n # Basic min for an object\n lastmin = @list.min {|a,b| a.last <=> b.last }\n assert_equal(@bsb, lastmin, \"test_0250_min_block\")\n @@log.debug \"test_0250_min ends\" if @@log.debug?\n end", "def min_min_max(array)\n min = array.min\n max = array.max\n missing = (min + 1..max - 1).detect { |x| !array.include?(x) }\n [min, missing, max]\nend" ]
[ "0.801312", "0.79702216", "0.79634297", "0.78428304", "0.7840437", "0.7840437", "0.7840437", "0.7840437", "0.7362018", "0.73410064", "0.71319", "0.7084207", "0.70274186", "0.6978622", "0.69427073", "0.68854713", "0.6854826", "0.67132264", "0.6705786", "0.6683675", "0.66757643", "0.66479397", "0.6636751", "0.66198325", "0.6611921", "0.66002077", "0.6590093", "0.65891254", "0.6566345", "0.65650666", "0.6526851", "0.64975727", "0.64708954", "0.64538044", "0.6431873", "0.64284265", "0.63781375", "0.6361764", "0.6361764", "0.63612366", "0.635273", "0.634515", "0.6329987", "0.6325818", "0.63251144", "0.6307391", "0.6280572", "0.62804675", "0.62732947", "0.62611365", "0.6241212", "0.6226909", "0.62266505", "0.62166524", "0.61843646", "0.618062", "0.61452687", "0.6141838", "0.6136771", "0.6133765", "0.611409", "0.6104039", "0.60972595", "0.6096702", "0.60945046", "0.6074793", "0.6065144", "0.6053164", "0.60505694", "0.6044391", "0.6035435", "0.60282236", "0.6020736", "0.6016336", "0.60140747", "0.6007984", "0.60063946", "0.6001711", "0.5999629", "0.5998193", "0.5994077", "0.59764487", "0.5973515", "0.5970646", "0.5968973", "0.5964428", "0.5962792", "0.5962792", "0.5954228", "0.5953245", "0.594726", "0.59462225", "0.5945748", "0.5930557", "0.5928304", "0.5897182", "0.5887766", "0.58868355", "0.5871687", "0.58714896" ]
0.6654643
21
Lists all users for a company
def index @company = Company.find(params[:company_id]) @users = @company.users.where("role > 0").paginate(:page => params[:page], :per_page => 15) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @company_users = CompanyUser.all\n end", "def index\n @users = User.where(company_id: current_user.company_id)\n end", "def index\n \n @company = Company.find(params[:company_id])\n if !can?(:manage, @company)\n raise CanCan::AccessDenied.new(\"Usted no puede administrar otra compañia\", :manage, @company)\n end\n \n if current_user.super_admin == true\n @users = User.where(:company_id => params[:company_id])\n else\n @users = User.where(:company_id => current_user.company_id)\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n index! {\n @users = current_company.users\n }\n end", "def index\n if current_user.admin?\n @companies = Company.all.order(:name).page(params[:page]).per(10)\n else\n @companies = current_user.company\n end\n end", "def index\n params[:q] = {} if params[:q].blank?\n params[:q][:company_id_eq] = current_user.company_id\n @q = User.search(params[:q])\n @users = @q.result(:distinct => true).paginate(:page => params[:page])\n end", "def index\n @companies = NewCompany.where(user: current_user)\n end", "def index\n\t @contentPageHeading = 'My Companies'\n\t @companies = current_user.companies\n\t @user_companies = UserCompany.where(:user_id => current_user.id)\n\t # @public_companies = Array.new\n\t # for user_company in @user_companies\n\t # \t@public_companies.push(user_company,Company.find(user_company.pc_id))\n\t # end\n\t\t# @public_companies = Company.find(:all, :order => 'name', :conditions => 'id IN (SELECT pc_id FROM user_companies WHERE user_id = '+current_user.id.to_s+')')\n end", "def index\n if current_company.users.include?(current_user)\n @employees = current_company.employees\n else\n redirect_to root_path\n end\n end", "def index\n if !current_user\n @companies = Company.all.limit(5)\n else\n if current_user.role == 'user'\n @companies = Company.all.limit(5)\n else\n @companies = Company.where(user: current_user)\n end\n end\n end", "def list\n @users = User.where(organization: false)\n\n render \"list\"\n end", "def list_org\n @users = User.where(organization: true)\n\n render \"list_org\"\n end", "def users\n company_ids = [self.id]\n company_ids += advisor_company_ids if advised?\n\n user_ids = UserAffiliation.where(:company_id.in => company_ids).with_access.only(:user_id).map(&:user_id)\n User.where(:id.in => user_ids).order_by(created_at: :asc)\n end", "def list\n # ask the user_repository for a list of all the users\n users = @user_repository.all\n # pass that list to the view to display\n @view.list_users(users)\n end", "def index\n if current_user.nil?\n redirect_to root_path\n else \n puts '233r'\n end\n @companies = Company.all\n end", "def index\n @companies = Company.all\n @users = User.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def users_list(options = {})\n if block_given?\n Pagination::Cursor.new(self, :users_list, options).each do |page|\n yield page\n end\n else\n get(\"users\", options)\n end\n end", "def index\n @pagetitle = \"compros\"\n \n @companies = Company.where(user_id: current_user.id).order(\"name\")\n @path = 'compros'\n end", "def index\n @cms_users = User.all\n end", "def list_all_users\n\n end", "def list\n @all_users = User.find(:all)\n end", "def index\n @companions = current_user.companions.uniq\n end", "def list_users\n @users = User.find(:all)\n end", "def index\n @users = User.find_all_with_authorization(current_user)\n end", "def list\n\t\t# retrieve all users\n @users = User.find(:all)\n end", "def index\n\t\tif current_user.user_role.code == 'admin'\n\t\t\t@companies = Company.all\n\t\telse\n\t\t\t@companies = current_user.created_companies\n\t\tend\n\t\tmake_breadcrumbs\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @companies }\n\t\tend\n\tend", "def index\n # Available only for admin and project manager\n if current_user.admin? || current_user.manager?\n @companies = Company.all\n else\n redirect_to projects_path, :alert => \"Access denied.\" and return\n end\n end", "def index\n @users = User.find(:all, :conditions => [\"company = ?\", session[:company].id])\n p 'users index'; y session #debug\n @thiscompany = Company.find(session[:company_id])\n puts \"\\n\\n\\n @thiscompany.id = \" + @thiscompany.id.to_s ##debug\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @cas_users = CasUser.all\n end", "def index\n @corporate_users = User.get_all_users(current_user).where.not(id: current_user.id)\n @corporate_users = @corporate_users.paginate(:page => params[:page],:per_page => 10).order('id DESC')\n end", "def index\n @company_owners = CompanyOwner.all\n end", "def list_users\n http_get(:uri=>\"/users\", :fields=>x_cookie)\n end", "def managed_users\n @manager = scoped_company.users.find(params[:id])\n @managed_users = @manager.employees.not_disabled.includes(:teams)\n @list_truncate_limit = 30\n @datatable = UserDirectoryDatatable.new(view_context, @company)\n render layout: false\n end", "def all_users(**args)\n params = parameters(args) do\n optional_params\n end\n request(:get, 'users', params)\n end", "def index\n @users = UserService.all_users\n end", "def index\n @competition_users = Competition.all\n end", "def index\n @companies = current_user.companies.paginate(:page => 1, :page => params[:page], :order => \"name DESC\")\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def list_users\n self.class.get('/users')\n end", "def index\n # current_user.companies.\n @incidents = Incident.all\n end", "def index\n @users = User.all.order(created_at: :desc)\n @reports = User.find_by_sql(top_salary_report_sql)\n @company = Company.find_by_subdomain(Apartment::Tenant.current)\n end", "def index\n @lcb_manager_users = LcbManagerUser.all\n end", "def show\n @company_user = CompanyUser.find(params[:id])\n end", "def list\n # ask the repo for a list of all the users\n users = @repo.all\n # pass that list to the view to display\n @view.list_users(users)\n end", "def index\n @companies = Company.order(:name).page(params[:page]).per(10)\n end", "def index\n @account_users = AccountUser.account_users_for(current_user.id)\n end", "def index\n @account_companies = Account::Company.all\n end", "def index\r\n\t\t@user = User.find(session[:login_id])\r\n\t\t# @jobs = Job.all\r\n\t\t# @companies = Company.all\r\n\tend", "def list_users\n BrickFTP::API::User.all\n end", "def list_users\n BrickFTP::API::User.all\n end", "def index\n \t@all_users = User.all\n end", "def index\n @user_company_mappings = UserCompanyMapping.all\n end", "def all_users()\n @endpoint = \"/users.json?limit=100\"\n setup_get\n res = @http.request(@req)\n return JSON.load(res.body)[\"users\"].sort_by { |user| user[\"lastname\"] }\n end", "def index\n @users = UserService.getAllUserList\n end", "def view_all_users\n # !! get all user so can interact after viewing them? all_users\n # User.select(:username).each_with_index {|user, index| puts \"#{index+1}. #{user.username}\"}\n #??????\n User.select(:username).each {|user| puts user.username}\n end", "def index\n @companies = Company.paginate(page: params[:page]).per_page(10) # pagination (gem 'will_paginate')\n end", "def index\n @title = 'Admin'\n #@users = User.where(:company_id => current_user.company_id)\n \n #respond_with @users\n respond_to do |format|\n format.html\n format.json { render json: UsersDatatable.new(view_context, current_user.company_id) }\n end\n end", "def index\n @credit_companies = CreditCompany.all.page(params[:page]).per(10)\n end", "def users\n @page_title = _('Users for calendar %{calendar_name}') % {:calendar_name => @calendar}\n @users = @calendar.users.order :lastname, :firstname\n end", "def index\n @auth_users = AuthUser.all\n end", "def index\n @company_names = CompanyName.all\n end", "def index\n\t\t@companies = Company.all\n\tend", "def index\n\t\t@companies = Company.all\n\tend", "def list\n get('users')['users']\n end", "def current_organization_users\n endpoint = '/api/org/users'\n @logger.debug(\"Getting organization users (GET #{endpoint})\") if @debug\n get(endpoint)\n end", "def index\n @users = User.all\n @user = retrieve_authenticated_user\n end", "def index\n @all_users = User.all\n\trender \"list_users\"\n end", "def index\n @companies = Company.all\n end", "def index\n @companies = Company.all\n end", "def index\n @companies = Company.all\n end", "def index\n @companies = Company.all\n end", "def index\n @companies = Company.all\n end", "def index\n @companies = Company.all\n end", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\tif session[:role] == \"admin\"\n\t\t\t@companies = Company.all\n\t\telse\n\t\t\t@companies = Company.where({approved: true})\n\t\tend\n\tend", "def index\n @users = User.all\n end", "def index\n @project_users = ProjectUser.all\n end", "def index\n @companies = Company.all\n\n end", "def index\n @sys_users = Sys::User.all\n end", "def list_users_by_account(accountId, options={}) path = \"/api/v2/accounts/#{accountId}/users\"\n get(path, options, AvaTax::VERSION) end", "def list_users\n tp @users, :real_name, :slack_id, :user_name => {:display_method => :name}\n end", "def index\n if current_user.admin?\n @users = User.all.paginate(:page => params[:page])\n else\n @users = User.where(unidade_id: current_user.unidade_id).paginate(:page => params[:page])\n end\n end", "def html_index\n\t\t@users = User.all\n\tend", "def index\n @user_users = User::User.all\n end", "def index\n @companies = current_user.companies.all\n flash[:notice] = t('flash.actions.index.notice') if @companies.empty?\n respond_with(@companies)\n end", "def index\n @users = User.fetch_all_customers\n end", "def list_users_for_all_tenants(args = {}) \n get(\"/users.json/global\", args)\nend", "def list_users_for_all_tenants(args = {}) \n get(\"/users.json/global\", args)\nend", "def list_users\n \t#p params[:search]\n \tif params[:search].nil?\n \t\t@users= User.all\n \telse\n \t\t@users= User.search_users(params)#this function from model\n \tend\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def get_all\n @user_repository.get_all_users\n end", "def index\n #@complaint_users = ComplaintUser.all\n @complaint_users = ComplaintUser.where([\"user_id = ?\", current_user.id]).order(\"created_at DESC\")\n end", "def index\n @salesforceusers = Salesforceuser.all\n end", "def index\n if (!@isLogin)\n return\n end\n @users = User.all\n end" ]
[ "0.82247216", "0.811345", "0.7907444", "0.779224", "0.75096136", "0.7375409", "0.7359756", "0.72433573", "0.6918483", "0.6904895", "0.6834567", "0.6797787", "0.67897624", "0.67888176", "0.6784727", "0.6761954", "0.67603844", "0.6714364", "0.67131984", "0.6708775", "0.6696818", "0.6689596", "0.6673449", "0.6659228", "0.6648044", "0.6620803", "0.66186285", "0.6596552", "0.65811", "0.65803766", "0.6572353", "0.6560156", "0.6535768", "0.6514528", "0.65102047", "0.64979446", "0.64804494", "0.6471303", "0.646996", "0.645806", "0.6452434", "0.6450943", "0.6443493", "0.64377964", "0.6405188", "0.6393753", "0.63918746", "0.6389153", "0.6389153", "0.6384443", "0.6383007", "0.6373797", "0.6369682", "0.6369042", "0.6361232", "0.63611174", "0.63576657", "0.63562316", "0.6348974", "0.63489705", "0.6348324", "0.6348324", "0.6347672", "0.6347525", "0.6343828", "0.6330005", "0.63117325", "0.63117325", "0.63117325", "0.63117325", "0.63117325", "0.63117325", "0.6298434", "0.6298434", "0.6298434", "0.6298434", "0.6298434", "0.6298434", "0.6295555", "0.6291383", "0.62839556", "0.62810194", "0.6277745", "0.6277181", "0.6274103", "0.6273036", "0.62686265", "0.6265535", "0.6260606", "0.62598956", "0.625652", "0.625652", "0.6250308", "0.62474716", "0.62474716", "0.62474716", "0.62426656", "0.6237189", "0.6229251", "0.6228355" ]
0.7502657
5
Edit an user in a company
def edit @company = Company.find( params[:company_id] ) @user = @company.users.find( params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @company_user = CompanyUser.find(params[:id])\n\n respond_to do |format|\n if @company_user.update_attributes(params[:company_user])\n format.html { redirect_to(@company_user, :notice => 'Company user was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company_user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit\n @company = Company.find_by_uuid(current_user.company.uuid)\n end", "def update\n @user = User.find(params[:id])\n# puts \"\\n\\n\\n @thiscompany.id = \" + @thiscompany.id.to_s ##debug\n y session #debug\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @company_user_info = CompanyUserInfo.find(params[:id])\n\n if @company_user_info.update_attributes(params[:company_user_info])\n flash[:notice] = \"更新成功~\"\n redirect_to @company_user_info\n else\n flash.now[:error] = \"更新失败~\"\n render action: \"edit\"\n end\n end", "def update\n @company = current_user.companies.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n flash[:notice] = 'Company was successfully updated.'\n format.html { redirect_to(@company) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_user_company\n @user_company = current_company.user_companies.find(params[:id])\n end", "def update\n @company = Company.find_by_uuid(current_user.company.uuid)\n if @company.update(company_params)\n flash[:success] = t('messages.default_success')\n redirect_to dashboard_url\n else\n flash[:error] = t('messages.default_error')\n render :edit\n end\n end", "def update\n @company = Company.find(params[:company_id])\n if !can?(:manage, @company)\n raise CanCan::AccessDenied.new(\"Usted no puede administrar otra compañia\", :manage, @company)\n end\n @user = User.find(params[:id])\n @roles = Role.all\n if !params.has_key?(:password_only)\n role_ids = params[:role_ids] if params[:role_ids]\n role_ids ||= []\n @user.role_ids = role_ids\n end\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n if params.has_key?(:password_only)\n format.html { redirect_to show_user_profile_path(@company, @user), notice: 'El perfil fue editado exitosamente.' }\n format.json { head :no_content }\n else \n format.html { redirect_to company_user_path(@company, @user), notice: 'El usuario fue editado exitosamente.' }\n format.json { head :no_content }\n end\n else\n if !params.has_key?(:password_only)\n format.html { render action: \"edit\" }\n else\n format.html { render action: \"edit_password\" }\n end\n \n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @all_users = User.all\n if @company.check_for_atleast_one_admin(params[:company]['company_admins_attributes'].collect{|i| i[1]}.flatten)\n respond_to do |format|\n if @company.update_attributes(company_params)\n format.html { redirect_to @company, flash: {:success => 'Company was successfully updated.'} }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n # @user = User.find(params[:id]) -- not needed bc of correct_user\n end", "def edit\n set_user\n end", "def edit\n # @user = User.find(params[:id])\n # already in correct_user\n end", "def edit_account\n @user = User.find(current_user.id)\n end", "def edit\n logger.debug '> Users: edit.'\n @account = current_user\n @orgs = Organizations.new.list(params).orgs\n @acc = Accounts.new.find_by_email(session[:email])\n @orgs\n end", "def edit\n # set attrib \n @arrAttrib = returnAttrib(false)\n\n @user = User.find(params[:id])\n\n # ensure email and token are valid\n @AccountUser = User.where(\"id = ? and code_tx = ?\", params[:id], params[:token]).first\n \n if @AccountUser.nil?\n #invalid user\n #show them what went wrong...\n @user = nil\n flash[:error_message] = \"<strong>Error:</strong> Invalid Access!\"\n end \n end", "def edit\n @user = User.find(params[:id])\n # @user は編集対象のユーザー\n # current_user はログインしているユーザー \n\n end", "def edit_user(edited_user)\n user = User.find(edited_user.email)\n user.attributes = edited_user.attributes\n user.save!\n end", "def edit\n @company = Company.find(params[:id])\n end", "def edit\n \n @user = User.find(params[:id])\n \n end", "def edit\r\n \t@user = current_user\r\n end", "def create_company_data\n @user = User.find(params[:user_id])\n @current_company = @user.companies.find_by({:selected => true})\n @company = @user.companies.find(params[:id])\n\n if @company.update_attributes(company_data_params)\n flash[:success] = \"Datos actualizados\"\n\n redirect_to user_company_path(@user,@company)\n else\n flash[:danger] = \"No se pudo editar!\"\n render 'new'\n end\n end", "def edit\n # find the user we want to edit by id\n # this will send the @user to the edit page with a form\n @user = User.find(params[:id])\n end", "def edit\n @company = current_user.companies.find(params[:company_id])\n @memberships = @company.company_memberships.all\n end", "def edit\n @user = User.find(current_user.id)\n \n binding.pry\n \n end", "def edit\n\t@user = User.find(params[:id])\n\t@title = \"Edit user\"\n end", "def update_user\n end", "def edit\n @user = current_user\n end", "def edit\n # return an HTML form for editing a specific user\n @user = User.find(params[:id])\n end", "def edit_current_user\n end", "def edit\n @userToEdit = User.find(params[:id])\n end", "def edit\n # @user is already set by correct_user\n # @user = User.find(params[:id])\n end", "def update\n load_user\n build_user\n assign_roles\n save_user or render :edit\n end", "def edit_user\n if (@user = find_user(params[:id]))\n @all_roles = Role.find_all.select { |r| r.name != UserEngine.config(:guest_role_name) }\n case request.method\n when :get\n when :post\n @user.attributes = params[:user].delete_if { |k,v| not LoginEngine.config(:changeable_fields).include?(k) }\n if @user.save\n flash.now[:notice] = \"Details for user '#{@user.login}' have been updated\"\n else\n flash.now[:warning] = \"Details could not be updated!\"\n end\n end\n else\n redirect_back_or_default :action => 'list'\n end\n end", "def edit\n # this finds the current user\n @user = User.find params[:id]\n end", "def edit\n @user = @current_user\n end", "def edit\n\t\tthe_user_id = params[\"id\"]\n \t@user = User.find_by(:id => the_user_id)\n\tend", "def update\n @company = Company.find(params[:id])\n\n if @company.update_attributes(params[:company])\n flash[:success] = @company.name + \" was successfully updated.\"\n redirect_to crm_path\n else\n @title = \"Edit \" + @company.name\n render 'edit'\n end\n end", "def update\n # Button press on edit page\n\n # Read the user and update the attributes (don't save at this point)\n @user = User.find(params[:id])\n render_error h \"Der Spezialbenutzer #{@user.username} kann nicht editiert werden.\" and return if @user.special?\n @user.attributes=params[:user] if params[:user]\n\n # Subpages\n select_person and return if params['select_person']\n\n if params['commit']\n # 'Save' button\n render 'edit' and return if [email protected]\n\n flash[:notice] = \"Der Benutzer #{@user.username} wurde gespeichert.\"\n redirect_to_origin(default=@user)\n return\n end\n\n render 'edit'\n end", "def edit\n \t@user = current_user\n end", "def update\n if @user.update(user_params)\n redirect_to company_group_user_path(@user.group.company_id, @user.group_id, @user), notice: '正常に更新しました'\n render :show, status: :ok, location: @user\n else\n render :edit\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def edit\n # finds user with id of params[:id]\n @user = User.find params[:id]\n end", "def update\n # authorize @company\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to admin_company_path(@company), notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @user = User.find(params[:id])\n @user.update(user_params)\n end", "def edit\n # @user = User.find(params[:id]) <-- not needed; @user defined in correct_user\n end", "def edit\n @user = User.find(params[:user_id])\n end", "def edit\n @user = User.find(params[:user_id])\n end", "def edit\n @company = Company.find( params[:company_id])\n @training = Training.find( params[:training_id])\n @course = Course.find( params[:id])\n #ALL USERS EXCEPT ROOT (role != 0) AND INACTIVE USERS state == 0\n @users = @company.users.find( :all, :conditions => [\"role != ? AND state == ?\", ROOT, STATE[:active]])\n end", "def edit\n @page_title = 'Edit user'\n @user = User.find(params[:id])\n end", "def edit\n @user = current_user\n end", "def edit\n @user = current_user\n end", "def edit\n @user = current_user\n end", "def edit\n @user = current_user\n end", "def edit\n @user = current_user\n end", "def edit\n @user = current_user\n end", "def edit\n @user = current_user\n end", "def edit\n @user = current_user\n end", "def edit\n @user = current_user\n end", "def edit\n @user = current_user\n end", "def edit\n @user = current_user\n end", "def edit\n redirect_to root_url and return unless current_user\n @user = current_user\n end", "def edit\n\t\t@user = User.find(params[:id])\n\tend", "def edit\n\t\t@user = User.find(params[:id])\n\tend", "def edit\n\t\t@user = User.find(params[:id])\n\tend", "def edit\n\t\t@user = User.find(params[:id])\n\tend", "def edit\n\t\t@user = User.new\n\t\t@organizations = Organization.order(label: :asc) if is_admin?\n\tend", "def edit\n @title = \"Edit user\"\n @user = User.find(params[:id])\n\n end", "def edit\n @user = User.find(params[:id])\n authorize! :update, @user \n end", "def edit\n \t@user = User.find params[:id]\n end", "def edit\n # Listing 9.14: Finding the correct user is now handled by the correct_user before_action.\n end", "def edit\n\t\t@roaster = Roaster.find(session[:roaster_id])\n\t\tif admin?\n\t\t\t@company = Company.find(params[:id])\n\t\telsif @roaster.company_id == params[:id]\n\t\t\t@company = Company.find(params[:id])\n\t\telse\n\t\t\tredirect_to beanformed_companies_path\n\t\tend\n\tend", "def update\n if params[:person][:company_name]\n params[:person][:company] = Company.find_or_create_by_name(params[:person][:company_name])\n params[:person].delete(:company_name)\n end\n @person = Person.find(params[:id])\n\n authorize! :edit, @person\n \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 edit\n @user= User.find_by_id(current_user.id)\n end", "def edit\n # find the user by the user id in the route params\n # (this will likely be moved to its own before method)\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n # loads user from the database\n @user = User.find(params[:id])\n end", "def update\n @customer_company.updated_user_id = current_user.id\n respond_to do |format|\n if @customer_company.update(customer_company_params)\n format.html { redirect_to @customer_company, notice: t(\"controllers.update_success\") }\n format.json { render :show, status: :ok, location: @customer_company }\n else\n @customer_companies_options = CustomerCompany.where(active: true, consortium: true).map{|m| [ m.company_customer , m.id ] }\n format.html { render :edit }\n format.json { render json: @customer_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @user = User.find params[:id]\n end", "def update\n @user = current_org.users.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'user was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # @user = User.find(params[:id])\n @user = current_user # makes our views \"cleaner\" and more consistent\n params[:user][:existing_identity_attrs] ||= {}\n unless configatron.user_can_change_login\n params[:user].delete(:login)\n @user_login_is_readonly = true\n end\n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = \"Account updated!\"\n format.html { redirect_to account_url }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_user\n @user = current_company.users.find_by_id(params[:id]) || []\n end", "def edit\n\t\t@user = User.find(params(:id))\n\tend", "def edit\n @user = User.find(params[:id])\n\n deny_wrong_user if !current_user?(@user)\n end", "def edit\n @user = User.shod(params[:id])\n authorize! :update, @user\n end", "def update\n authorize @user\n if @user.update_attributes(user_params)\n redirect_to core_user_path(@user)\n else\n render :edit\n end\n end", "def edit\n @user = User.find(session[:user_id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def update\n @company = Company.find(params[:id])\n\n params[:company][:projects_attributes][\"0\"].merge!(:user_id => current_user.id)\n respond_to do |format|\n if @company.update_attributes(params[:company])\n\tformat.html { redirect_to(@company, :notice => 'Company was successfully updated.') }\n\tformat.xml { head :ok }\n else\n\tformat.html { render :action => \"edit\" }\n\tformat.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit\n\t@user = User.find(params[:id])\nend", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end" ]
[ "0.7603888", "0.75932544", "0.7527632", "0.7317906", "0.73035336", "0.7278403", "0.72636235", "0.71981966", "0.7087932", "0.70656914", "0.706439", "0.7012036", "0.7008186", "0.6981034", "0.695699", "0.695428", "0.6936021", "0.690873", "0.69051397", "0.6896162", "0.68728524", "0.6868416", "0.6865402", "0.6832525", "0.68312156", "0.68213177", "0.6819031", "0.68185914", "0.6808824", "0.68022865", "0.67991537", "0.67942244", "0.6792491", "0.6777529", "0.6765467", "0.67645395", "0.6760768", "0.67553276", "0.67485356", "0.673883", "0.67325366", "0.6721285", "0.6721236", "0.67084795", "0.6707685", "0.6707685", "0.6700525", "0.6699478", "0.6664893", "0.6664893", "0.6664893", "0.6664893", "0.6664893", "0.6664893", "0.6664893", "0.6664893", "0.6664893", "0.6664893", "0.6664893", "0.6662463", "0.6659977", "0.6659977", "0.6659977", "0.6659977", "0.66528594", "0.6640705", "0.66383916", "0.66364247", "0.66263694", "0.66227525", "0.6617691", "0.6615268", "0.66105723", "0.6605577", "0.6605577", "0.66055477", "0.66044074", "0.6599462", "0.6595025", "0.6594407", "0.6586872", "0.6581293", "0.65806746", "0.65787715", "0.6576621", "0.65757096", "0.65739906", "0.6572393", "0.65723246", "0.6556512", "0.6556512", "0.6556512", "0.6556512", "0.6556512", "0.6556512", "0.6556512", "0.6556512", "0.6556512", "0.6556512", "0.6556512" ]
0.8547386
0
Prepares to creates a new user in a company
def new @company = Company.find( params[:company_id]) @user = @company.users.build @roles = ROLE end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @user = User.new(params[:user])\n @user.company = current_company\n create!\n end", "def create\n @company = Company.new\n @company.name = params[:new_company][:name]\n @company.slug = @company.name.parameterize\n @company.state = COMPANY_STATE[:unchecked]\n @user = User.new\n if @company.save\n @user = @company.users.build\n @user.email = params[:new_company][:email]\n @user.name = t(:root)\n @user.state = STATE[:unchecked]\n @user.role = ROOT\n @user.password_digest = 0\n @user.locale = I18n.locale\n if @user.save\n UserMailer.verification_email(@user).deliver\n flash[:success] = t(:company_account_created)\n redirect_to company_signin_path @company.id\n else\n @company.destroy\n render 'new'\n end\n else\n render 'new'\n end\n end", "def create\n @user = User.create(user_params_with_password)\n @user.company = current_user.company\n if @user.save\n flash[:success] = t('messages.default_success')\n redirect_to users_path\n else\n render :new\n end\n end", "def create\n @user = User.new(params[:user])\n if params[:reservation].nil?\n @company = Company.new(params[:company])\n else\n\t # user has been invited, company already exists\n\t @company = Company.find(params[:company][:id])\n\t @user.company = @company\n\t Reservation.find_by_token(params[:reservation][:token]).delete\n\t end\n\n respond_to do |format|\n if @user.save\n\t if params[:reservation].nil?\n\t\t # set company owner\n\t @company.owner = @user\n\t @company.save\n\t @company.create_default_infos\n\t @user.company = @company\n\t end\n\t @user.save\n format.html { redirect_to :users, notice: 'Registration successful.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user_params = sign_up_params\n @user = User.new(user_params)\n if user_params[:password] == \"\" || user_params[:password_confirmation] == \"\"\n puts \"NO PASSWORD ERROR\"\n flash[:error] = \"Need a password to sign up\"\n redirect_to '/signin'\n return \n end\n if params[:company_serial]\n company = Company.find_by(company_token: params[:company_serial])\n if company\n @user.company_id = company.id\n if company.company_name == \"IVA\"\n @user.admin = true\n end\n else\n flash[:alert] = \"The serial key provided was invalid.\"\n redirect_to '/signin'\n end\n else\n flash[:alert] = \"A company serial key must be provided to register.\"\n redirect_to '/signin'\n end\n \n if @user == \"\"\n flash[:alert] = \"Please provide a password to register with.\"\n redirect_to '/signin'\n else\n @user.save\n begin\n sign_in @user\n rescue \n flash[:error] = \"Email already in use\"\n redirect_to '/signin' and return \n end\n if [email protected]\n Apartment::Tenant.switch(Company.find(@user.company_id).company_name.gsub(/'/,'').gsub(/\\s/,''))\n end\n redirect_to \"/pearlception\" and return\n end\n \n end", "def create\n @user = User.new(user_params)\n @user.company_id = current_user.company_id\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'Usuario creado exitosamente.' }\n format.json { render action: 'show', status: :created, location: @user }\n else\n format.html { render action: 'new' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.find(params[:company_id])\n if !can?(:manage, @company)\n raise CanCan::AccessDenied.new(\"Usted no puede administrar otra compañia\", :manage, @company)\n end\n @user = User.new(params[:user])\n @roles = Role.all\n role_ids = params[:role_ids] if params[:role_ids] \n role_ids ||= []\n @user.role_ids = role_ids\n @user.company_id = @company.id\n \n if !current_user.super_admin\n @user.super_admin = false\n end\n \n respond_to do |format|\n if @user.save\n format.html { redirect_to company_users_path(@company), notice: 'El usuario fue creado exitosamente.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company_user = CompanyUser.new(params[:company_user])\n @company = Company.find(params[:company_user][:company_id])\n \n @users_left_i = getUser().users_left\n @users_left = getUser().print_users_left\n @users_left_class = getUser().users_left_class\n \n # Check package limits\n if(@users_left_i <= 0 and @users_left_i > -1000)\n flash[:error] = \"You have created the most users you can within your package. Please select another package to create more users.\"\n redirect_to(\"/pricing\")\n else\n if(params[:company_user][:user_id] and params[:company_user][:user_id] != \"\")\n # Check if user already exists for the company\n @alr_user = CompanyUser.find(:first, :conditions => {:company_id => @company.id, :user_id => params[:company_user][:user_id]})\n\n if(@alr_user)\n err_alr = true\n end\n end\n\n if(err_alr)\n flash[:error] = \"This user is already part of the company\"\n redirect_to \"/company_users/new/#{@company.id}\"\n elsif @company_user.save\n redirect_to(@company_user, :notice => 'Company user was successfully created.')\n else\n render :action => \"new\"\n end\n end\n end", "def create\n @company = Company.new(params[:company])\n \n if current_user\n\t @company.user_id = current_user.id\n end\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to(@company, :notice => 'Company was successfully created.') }\n format.xml { render :xml => @company, :status => :created, :location => @company }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @company_user_info = current_user.build_company_user_info(params[:company_user_info])\n\n if @company_user_info.save\n flash[:notice] = \"你已经成功申请了企业用户,请耐心等待\"\n redirect_to current_user\n else\n flash.now[:error] = \"申请失败,请重新填写\"\n render action: \"new\"\n end\n end", "def create\n @roles = ROLE\n @company = Company.find( params[:company_id])\n role = params[:user][:role]\n params[:user].delete(:role)\n @user = @company.users.build( params[:user])\n @user.role = Integer role\n @user.state = -1\n @user.password_digest = 0\n if @user.save\n UserMailer.verification_email(@user).deliver\n redirect_to backoffice_company_user_path @company.id, @user\n else\n render 'new'\n end\n end", "def create\n @company = Company.new(params[:company])\n @company.owner = User.find(session[:user_id])\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render json: @company, status: :created, location: @company }\n else\n format.html { render action: \"new\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n @thiscompany = Company.find(session[:company_id])\n puts \"\\n\\n\\n @thiscompany.id = \" + @thiscompany.id.to_s ##debug\n y session #debug\n\n respond_to do |format|\n if @user.save\n flash[:notice] = 'User was successfully created.'\n format.html { redirect_to(@user) }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = Company.find(params[:company_id]).groups.find(params[:group_id]).users.new(user_params)\n\n if @user.save\n redirect_to company_group_user_path(@user.group.company_id, @user.group_id, @user), notice: '正常に作成しました'\n render :show, status: :created, location: @user\n else\n render :new\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def new\n @company = Company.new\n @user = User.new(:user_roles => [UserRole[:company_admin]])\n @user.build_person\n end", "def create_new_company\n puts \"Please enter your company name:\"\n company_name = gets.strip\n\n prompt = TTY::Prompt.new\n puts \"Please provide a username and password.\"\n username = prompt.ask(\"Username:\")\n\n password = prompt.mask(\"Password:\")\n\n company = Company.create({ :name => company_name, :password => password, :username => username })\n end", "def create\n\t\tbuild_resource(sign_up_params)\n\t\t@company = Company.new\n\t\t# companies params\n\n\t\[email protected]_name = params[ :company_name ]\n\t\[email protected]_first_name = params[ :contact_first_name ]\n\t\[email protected]_last_name = params[ :contact_last_name ]\n\t\[email protected]_last_m_name = params[ :contact_last_m_name ]\n\t\[email protected]_employement = params[ :contact_employement ]\t\n\t\[email protected] = params[ :website ]\n\t\[email protected]_date = params[ :foundation_date ]\n\t\[email protected] = params[ :rfc ]\n\n\t\t# we company type value, since enum is an int and we get a string...\n\t\tif params[ :category ] == \"matriz\"\n\t\t\[email protected] = 0\n\t\telse\n\t\t\[email protected] = 1\n\t\tend\n\n\n\t\tif @company .save\n\t\t\tresource.roleable = @company\n\t\t\tresource.save\n\n\t\t\tyield resource if block_given?\n\t\t\tif resource.persisted?\n\t\t\t\tif resource.active_for_authentication?\n\t\t\t\t\tset_flash_message! :notice, :signed_up\n\t\t\t\t\tsign_up(resource_name, resource)\n\t\t\t\t\trespond_with resource, location: after_sign_up_path_for(resource)\n\t\t\t\telse\n\t\t\t\t\tset_flash_message! :notice, :\"signed_up_but_#{resource.inactive_message}\"\n\t\t\t\t\texpire_data_after_sign_in!\n\t\t\t\t\trespond_with resource, location: after_inactive_sign_up_path_for(resource)\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tclean_up_passwords resource\n\t\t\t\tset_minimum_password_length\n\t\t\t\trespond_with resource\n\t\t\tend\n\t\telse\n\t\t\trender :new\n\t\tend\n\tend", "def create_user\n user = User.where(email: user_email)\n if user.blank? # new user\n @user = create_new_user\n church = nil\n if affiliation.blank?\n church = create_affiliation_from_church\n else\n church = Affiliation.find(self.affiliation)\n end\n @user.affiliation = church\n church.users << @user\n @user.save\n\n guest = Role.find_by_name(\"Guest\").id \n @user.role_ids=[guest]\n self.user_id = @user.id\n end\n end", "def create\n\t\t@company = Company.new(company_params)\n\t\t# for admin to add a company\n\t\tif admin? && @company.save\n\t\t\tflash[:success] = \"#{@company.name} was successfully saved!\"\n\t\t\tredirect_to beanformed_company_beans_path(@company.id)\n\t\t# for all users; new companies come in as approved : false\n\t\telsif @company.save\n\t\t\tflash[:success] = \"Thanks for registering #{@company.name}! You will be notified when you are approved!\"\n\t\t\t@roaster = Roaster.find(session[:roaster_id])\n\t\t\[email protected]({company_id: @company.id, phone: params[:company][:phone], role: \"pending\"})\n\t\t\tredirect_to new_beanformed_company_path\n\t\telse\n\t\t\tflash[:error] = \"Please fill out all fields.\"\n\t\t\tredirect_to new_beanformed_company_path\n\t\tend\n\tend", "def create\n @user = User.new(user_params)\n if @user.role == 'renter'\n @user.company_id == 24\n @user.title == 'renter'\n elsif @user.role = 'realtor'\n @user.company_id == 25\n @user.title == 'realtor'\n end\n @user.company_id = user_params[:company_id] if logged_in?\n @user.role = user_params[:role] if logged_in?\n @user.title = user_params[:title] if logged_in?\n @user.save\n respond_to do |format|\n if @user.save and !logged_in?\n log_in @user\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n elsif @user.save and logged_in?\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new, notce: 'User was not created, please try again.' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @company_user = CompanyUser.new\n @company = Company.find(params[:company_id])\n @company_user[:company_id] = @company[:id]\n \n # Check package limits\n @users_left_i = getUser().users_left\n @users_left = getUser().print_users_left\n @users_left_class = getUser().users_left_class\n end", "def create_company\n company = Company.create!()\n company\n end", "def create_user(obj, type)\n @logger.info(\"Creating user for #{type} #{obj.name}\")\n user = SugarCRM::User.new\n user.user_name = (type == 'agent') ? obj.emerchantpay_agent_id : obj.emerchantpay_iso_id\n user.user_name ||= \"EMP\"\n user.last_name = obj.name\n user.type_c = type\n #user.email1 = obj.email_address || \"[email protected]\"\n user.email1 = '[email protected]'\n user.status = 'Inactive'\n user.system_generated_password = false\n user.save!\n obj.assigned_user_id = user.id\n obj.save!\n \n populate_user_pool(user, type)\n end", "def create\n @company = current_user.companies.build(company_params)\n\n if @company.save\n flash[:success] = \"Saved!\"\n redirect_to companies_path\n else\n render 'new'\n end\n end", "def create\n @company = Company.new(params[:company])\n @user = User.new(params[:user])\n @employer = Employer.new\n @user.profileable = @employer\n @employer.company = @company\n if @company.save\n if @user.save\n @employer.save\n sign_in(:user, @user)\n redirect_to root_path\n\n end\n end\n end", "def create_member\n @company = current_user.company\n @user = User.new(user_params)\n @user.company_id = current_user.company_id if @user.company_id.blank?\n @user.type_id = params[:user_type_id]\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created }\n else\n format.html { \n @agencies = @company.agencies\n flash[:alert] = @user.errors.full_messages.join(\"<br>\")\n render action: 'new' \n }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n begin\n @temporary_user = TemporaryUser.new(temporary_user_params)\n @temporary_user.country_name = @temporary_user.client_company.country_name\n @user = User.new(temporary_user_params)\n @user.country_name = @temporary_user.country_name\n respond_to do |format|\n if @temporary_user.save && @user.save\n @user.client_company.update(number_of_users: @user.client_company.number_of_users + 1)\n format.html {redirect_to users_path, notice: 'User is successfully created.'}\n format.json {render :show, status: :created, location: @temporary_user}\n else\n format.html {render :new}\n format.json {render json: @temporary_user.errors, status: :unprocessable_entity}\n end\n end\n rescue => e\n @temporary_user.errors.add(:base, e.message)\n render :action => 'new'\n end\n\n end", "def create\n @company = Company.new(company_params)\n # Must attach current user to company\n # @company.user_id << @current_user\n # @company.users = []\n # unless params[:user][:user_ids].nil?\n # params[:user][:user_ids].each do |user_id|\n # @company.users << User.find(user_id) unless user_id.empty?\n # end\n # end\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Gallery was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_user\n @user = User.new(user_params)\n @user.role = :user\n if @user.save\n correct_cs_entries @user\n correct_ci_entries @user\n render 'objects/user.json'\n else\n @msg = \"Error in generating user\"\n @details = @user.errors\n render \"objects/msg.json\", status: :bad_request\n end\n end", "def sign_up_params\n params.require(:user).permit(:company_name, :email, :password, :name)\n end", "def create\n @company = Company.new(company_params)\n\n render status: \\\n current_user.save_company(@company) ? :created : :unprocessable_entity\n end", "def new\n session[:signup_params] ||= {}\n @user = User.new(session[:signup_params])\n @user.signup_current_step = session[:signup_step]\t\n# @company = @user.build_company\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def create\n @user = User.new(user_to_be_created)\n\n error = @user.validate_user?\n\n if error.nil? && @user.save\n handler_notice('Usuário cadastrado com sucesso!', login_path)\n else\n handler_notice_error(error, new_user_path)\n end\n end", "def create_employee_user\n email = self.work_email\n user = User.new(email: self.work_email, password: 'appsimpact@#123', role: 'employee')\n user.save\n self.user_id = user.id\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n @company.company_admins.create(:user_id => current_user.id, :company_id => @company.id, :user_role => 'admin')\n format.html { redirect_to @company, flash: {:success => 'Company was successfully created.'} }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n respond_to do |format|\n if @company.save\n # User becomes company admin\n current_user.update_attribute(:company_id, @company.id)\n current_user.update_attribute(:company_admin, true)\n # Send email notifications to Admins and current user\n ExampleMailer.create_company_admin(@company).deliver\n ExampleMailer.create_company(@company).deliver\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n @company.user = current_user\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to companies_path, notice: 'Компания успешно создана' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def find_or_create_user(username, company, phone)\n\n #find the user (if not, create)\n @user = nil\n if username.empty?\n false #if there's no username, don't create.\n else\n #add on dummy email @\n username << '@appfolio.com'\n\n #find the user\n @user = User.where(email: username).take\n if @user.nil?\n @user = User.new(:email => username,\n :password => 'appfolio_dummy',\n :password_confirmation => 'appfolio_dummy',\n :company_name => company,\n :phone_number => phone\n )\n @user.save\n\n end\n\n @user\n\n end\n\n end", "def create\n @new_company = NewCompany.new(new_company_params)\n @new_company.user = current_user\n\n respond_to do |format|\n if @new_company.save\n format.html { redirect_to new_requesit_path, notice: 'Вы успешно добавили компанию!' }\n format.json { render :show, status: :created, location: @new_company }\n else\n format.html { render :new }\n format.json { render json: @new_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def setup_user(input)\n # Create user\n ctx[:model] = User::CreationService.create(input[:params], otp_timestamp: ctx[:otp_timestamp])\n ctx[:model] ? Success(ctx[:model]) : Failure(ErrorService.bad_request_fail(message: 'Error setting up user'))\n end", "def create_patron_user\n\t branch = Nimbos::Branch.where(patron_id: self.id).first\n\t role = Nimbos::Role.find_or_create_by(name: \"admin\")\n\t user = self.users.new\n\t user.name = self.contact_name\n\t user.surname = self.contact_surname\n\t user.email = self.email\n\t user.language = self.language\n\t user.locale = self.locale\n\t user.mail_encoding = self.mail_encoding\n\t user.time_zone = self.time_zone\n\t user.branch_id = branch.id\n\t user.password = self.password\n\t user.password_confirmation = self.password\n\t user.firstuser = true\n\t user.role_ids = [role.id]\n\t user.save!\n\t #user.add_role :admin\n\t end", "def create_user\n # provide the interface asking for name, destination and duration\n # then, create and store the User object\n end", "def signup(params)\n if self.is_client?\n user = self.employees.create!(name: params[:name],last_name: params[:last_name],\n email: params[:email],password: params[:password],password_confirmation: params[:password_confirmation])\n GroupsUser.create!(user_id: user.id,group_id: params[:group_id])\n user\n else\n user = self.clients.create!(name: params[:name],email: params[:email],password: params[:password],\n password_confirmation: params[:password_confirmation])\n end\n end", "def create\n\t params[:user][:login] = params[:user][:email_work] if params[:user][:login].blank?\n user = params[:user]\n @user = User.create(user)\n @user.valid? ? after_save(user) : error_responds(@user)\n end", "def create\n @corporate_user, password = User.create_corp_user(corporate_user_params)\n respond_to do |format|\n if @corporate_user.save\n admin_email = User.where(id: @corporate_user.parent_id).first.email\n InviteUser.corporate_user_confirmation(@corporate_user,admin_email,password).deliver\n format.html { redirect_to corporate_users_path, notice: \"#{APP_MSG['corporate_user']['create']}\" }\n format.json { render :show, status: :created, location: corporate_user_path }\n else\n format.html { render :new }\n format.json { render json: @corporate_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_user_create\n @user = User.create_user(user_params, current_user.account_id) # New User\n begin\n @user.save!\n @users = User.get_all(current_user.account_id)\n flash[:success] = \"User was created successfully!\"\n rescue => e\n flash[:alert] = \"User creation failed!\"\n end \n end", "def create\n begin\n \n detail = @@data_util.hash_data_to_upper_case( params[:company], ['description'])\n\n detail[:mypclient_id] = session[:client_id]\n detail[:createdby] = session[:username]\n detail[:isactive] = 1\n\n @company = Company.new(detail)\n if @company.save\n @@request_result[:success] = true\n @@request_result[:notice] = 'New company successfully created.'\n else\n @@request_result[:errormsg] = @company.errors.full_messages[0]\n end\n rescue Exception => e\n @@request_result[:errormsg] = e.message\n end\n render json: @@request_result\n end", "def create\n @company = Company.find(params[:company_id])\n project_params = params[:project]\n manager = @company.users.find(project_params[:user_id])\n \n generate_employees manager, project_params\n \n @project = Project.new(project_params)\n @project.manager = manager\n @project.last_updater = current_member\n @project.company = @company\n\n if(@project.valid?)\n begin\n Project.transaction do\n @project.save!\n project_role = Role.find_by_name(\"project_manager\")\n # if the user have just one project\n if(manager.projects && manager.projects.size == 1)\n manager.roles << project_role\n end \n end\n redirect_to(company_project_path(:id=>@project.id, :company_id =>@company.id), :notice => 'Project was successfully created.')\n rescue Exception=>e\n logger.error e.message\n logger.error e.backtrace\n @company_id = params[:company_id]\n @employees = User.cb_all_by_company_id(@company_id)\n render :action => \"new\"\n end\n else\n @company_id = params[:company_id]\n @employees = User.cb_all_by_company_id(@company_id)\n render :action => \"new\"\n end\n end", "def create\n @company = Company.create!(company_params)\n end", "def create\n @company = Company.new(params[:company])\n @profile = Profile.new\n\n respond_to do |format|\n if @company.save\n @profile.company = @company\n @profile.user = current_user\n @profile.save\n\n @role = Role.new\n @role.name = @company.name + \"_admin\"\n @role.client_id = CLIENT_ID\n @role.save\n\n @resource = Resource.new \n @resource.name = \"^/companies/\" + @company.id.to_s + \"($|/.*$)\" \n @resource.client_id = CLIENT_ID\n @resource.save\n\n @role.add_to_resource(@resource)\n @role.add_to_subject(Subject.find(current_user.preallowed_id)) \n \n flash[:notice] = 'Company was successfully created.'\n format.html { redirect_to(@company) }\n format.xml { render :xml => @company, :status => :created, :location => @company }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@company = Company.new(params[:company].merge({:by_user_id => current_user.id}))\n\t\tmake_breadcrumbs\n\n\t\trespond_to do |format|\n\t\t\tif @company.save\n\t\t\t\tformat.html { redirect_to @company, notice: t('app.companies.created') }\n\t\t\t\tformat.json { render json: @company, status: :created, location: @company }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @company.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create_skeleton\n email = params[:user][:email]\n\n if email.present? && user_already_exists(email)\n flash[:error] = \"This email already has a user\"\n render action: 'new_skeleton'\n else\n @user = User.create_unfinished(email, params[:user][:registration_attributes][:ticket_type_old], params[:user][:name])\n @user.company = params[:user][:company]\n @user.save!(:validate => false)\n\n flash[:notice] = \"Skeleton user created - creation link is #{user_from_reference_url(@user.registration.unique_reference)}\"\n redirect_to new_skeleton_user_path\n\n end\n end", "def create\n \n \n if params[:project_id]\n @project_main = Project.find_by_id(params[:project_id])\n elsif params[:company_id]\n @company = Company.find_by_id(params[:company_id])\n else\n @companies = Company.find(:all, :conditions=> \"deleted is null\").sort_by {|u| u.name.downcase}\n end\n \n @project = Project.new(params[:project])\n\n if !params[:user_id].blank?\n @user = User.find(params[:user_id])\n else\n @users = User.find( :all , :conditions => [\"deleted is null AND role % :rol = 0 \", {:rol => Role.find_by_name(\"CLIENT\").getidd}]).sort_by {|u| u.name.downcase}\n end\n\n respond_to do |format|\n if @project.save\n flash[:notice] = 'Project was successfully created.'\n format.html { redirect_to(@project) }\n format.xml { render :xml => @project, :status => :created, :location => @project }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end", "def user_create\n # Users.destroy_all\n name_input = @prompt.ask(\"What is your name?\")\n username_input = @prompt.ask(\"What is your desired Username?\")\n location_input = @prompt.ask(\"What is your location? example: \\\"NY\\\"\")\n password_input = @prompt.ask(\"What is your password?\")\n @user = User.create(name: name_input, state: location_input, password: password_input, username: username_input)\n puts \"Congratulations! You created an account!\"\n user_menu_runner\n # Initialize user menu methods here\n end", "def set_user_company\n @user_company = current_company.user_companies.find(params[:id])\n end", "def create\n super\n acc = Account.create!(:company_name => params[:account][:company_name]) unless flash.blank?\n # Set admin and account_id for User \n resource.update_attributes!({:account_id => acc.id, :is_admin => true, :status => SettingsConfig::ENABLED}) unless flash.blank?\n end", "def create\r\n @company = current_user.build_company(params[:company])\r\n respond_to do |format|\r\n if @company.save\r\n expire_fragment \"yellowpage\"\r\n expire_fragment \"users_center_#{session[:user_id]}\"\r\n flash[:notice] = '公司成功创建,恭喜你创建完成了!'\r\n format.html { redirect_to :action=>\"show\",:id=>@company.id}\r\n else\r\n flash[:notice] = '公司创建失败了,再次创建试试看?'\r\n format.html { redirect_to :action=>\"new\"}\r\n end\r\n end\r\n end", "def create\n @user = User.new(SiteConfig.default_user_attributes.merge( user_params || {} ) )\n # Наличие пароля не обязательно при создании, необходимо так же сделать кнопочки чтобы администратор мог инициировать смену пароля пользователем через email, sms\n\n unless @user.persisted?\n @user.creation_reason = :manager\n @user.build_account\n end\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to edit_admin_user_path(@user, :tab => params[:tab]), :notice => 'Пользователь был успешно создан.' }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end", "def create_account\n set_user\n set_payer\n set_user_sport\n save_account\n end", "def create_user_account\n User.create!(email: self.email, password: self.customer)\n # user = User.new do |u|\n # u.email = email\n # u.password = customer\n # u.save\n # end\n end", "def createUser(nickname) \n usr = User.new(nickname)\n backend_addUser(usr) \n end", "def create\n @user = User.new(params[:user])\n @user.company_id = current_user.company_id\n\n password = @user.password.nil? ? @user.generate_password : false\n \n if @user.save && params.has_key?(:multiselect_user_grouping_ids)\n @user.update_groupings(params[:user][:grouping_ids])\n @user.notify_account(password) if password\n params.has_key?(:multiselect_user_role_ids) ? @user.update_roles(params[:user][:role_ids]) : @user.add_employee_role\n gflash :success => \"User created.\"\n else\n @user.errors[:base] << \"You must assign the user to one or more groups.\" unless params.has_key?(:user_groupings)\n @assigned_groups = current_user.root_grouping.id\n end\n \n respond_with(@user)\n end", "def create_skeleton\n email = params[:user][:email]\n\n if email.present? && user_already_exists(email)\n flash[:error] = \"This email already has a user\"\n render action: 'new_skeleton'\n else\n @user = User.create_unfinished(email, params[:user][:registration_attributes][:ticket_type_old], params[:user][:first_name], params[:user][:last_name])\n @user.company = params[:user][:company]\n @user.save!(:validate => false)\n\n flash[:notice] = \"Skeleton user created - creation link is #{user_from_reference_url(@user.registration.unique_reference)}\"\n redirect_to new_skeleton_user_path\n\n end\n end", "def user_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation, :role, :title, :company_id, company_ids:[])\n end", "def cria_user\n return if user.present?\n User.create(email: self.end_email, password: '123123', password_confirmation: '123123',\n tb_empregado_id: self.id, e_admin: self.e_admin || false).encrypted_password\n end", "def comp_user_params\n params.require(:comp_user).permit(:company_id, :user_id)\n end", "def add_initial_user\n initial_user = Member.where(:email => \"[email protected]\").first\n \n unless initial_user\n # Create an initial position.\n position = Position.new\n position.name = \"Administrator\"\n position.pos_type = \"Administrator\"\n position.save\n \n # Create an initial division.\n division = Division.new\n division.name = \"Administrator\"\n division.save\n \n # Find initial position and division created.\n # Id´s will be used to crete initial user.\n position = Position.where(:name => \"Administrator\").first\n division = Division.where(:name => \"Administrator\").first\n \n # Create an initial user with position and divison created above.\n member = Member.new\n member.name = \"Administrator\"\n member.email = \"[email protected]\"\n member.password = \"administrator\"\n member.major = \"NONE\"\n member.grad_year = 9999\n member.member_since = 9999\n member.hometown = \"NONE\"\n member.position_id = position.id\n member.division_id = division.id\n member.save\n end\n end", "def create\n @az_company = AzCompany.new(params[:az_company])\n #admin = AzUser.find_by_login('admin')\n user = @az_company.ceo\n #@az_company.ceo = admin\n ret = @az_company.save\n if ret\n\n if Integer(params[:az_company][:wo_ceo_co_create]) != 1\n @az_company.add_employee(user) \n end\n\n if Integer(params[:az_company][:create_default_content_co_create]) == 1\n @az_company.create_default_content\n end\n end\n respond_to do |format|\n if ret\n flash[:notice] = 'AzCompany was successfully created.'\n format.html { redirect_to(@az_company) }\n format.xml { render :xml => @az_company, :status => :created, :location => @az_company }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @az_company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_user(attributes)\n BrickFTP::API::User.create(attributes)\n end", "def create_user(attributes)\n BrickFTP::API::User.create(attributes)\n end", "def create\n=begin\n rezzcard_user_params = User.get_rezzcard_user_params(params[:user])\n user_params = User.get_compass_user_params(params[:user])\n user_params[\"username\"] = user_params[\"email\"]\n=end\n @users = User.new(user_params)\n if @users.save\n flash[:notice] = I18n.t('admin.users.new.success', :name => @users.email)\n redirect_to :action => :index\n else\n render :action => :new\n end\n end", "def create(config, name, user_guid)\n\n token = @client.token\n\n user_setup_obj = UsersSetup.new(config)\n admin_token = user_setup_obj.get_admin_token\n\n # elevate user just to create organization\n @client.token = admin_token\n\n new_org = @client.organization\n new_org.name = name\n if new_org.create!\n org_guid = new_org.guid\n users_obj = Users.new(admin_token, @client.target)\n users_obj.add_user_to_org_with_role(org_guid, user_guid, ['owner', 'billing'])\n\n # then put token back to the initial one\n @client.token = token\n org_guid\n end\n\n end", "def create\n @company = Company.new(params[:company])\n @company.introducer_id = -1\n if [99,1,2,3].include?(current_user.role_id) then #管理员\n \[email protected]_id = current_user.company.id\n end\n\n respond_to do |format|\n if @company.save\n flash[:notice] = 'Company was successfully created.'\n format.html { redirect_to(@company) }\n format.xml { render :xml => @company, :status => :created, :location => @company }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n user = User.new(first_name: params[:first_name],\n phone_no: params[:phone_no],\n email: params[:email],\n password: params[:password],\n role: params[:role],\n archived_by: false)\n if user.save\n # if owner tries to create any clerk,it will create a cart for the clerk and redirects to owner's homepage.\n if (@current_user && @current_user.role == \"owner\")\n if (user.role == \"clerk\")\n cart = Cart.new(user_id: user.id)\n cart.save\n end\n redirect_to \"/dashboard\"\n else\n # if any customers creates account, customer's id will be stored in cookie and cart will be created.\n session[:current_user_id] = user.id\n cart = Cart.new(user_id: user.id)\n cart.save\n redirect_to categories_path\n end\n else\n flash[:error] = user.errors.full_messages.join(\", \")\n redirect_to \"/users/new\"\n end\n end", "def createNewUser(userName, initialGroup, userEmail, fname, lname, password)\n\n password = password.encrypt\n user = {\"login\" => userName,\n \"group0\" => initialGroup,\n \"email\" => userEmail,\n \"fname\" => fname,\n \"lname\" => lname,\n \"password\" => password,\n \"orga\" => \"0\"}\n saveUser(userName, user)\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.json { render :show, status: :created, location: @company }\n SignUpNotifier.registrated(@company).deliver\n else\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t\t\t@user = User.create!(create_user_params)\n\t\t\tend", "def create_user\n return @user.send_confirmation_instructions if @user\n\n @user = User.create!(new_agent_params.slice(:email, :name, :password, :password_confirmation))\n end", "def create\n fname = \"#{self.class.name}.#{__method__}\"\n super\n user=User.find_by_email(reg_params[:email])\n pars={}\n unless user.nil?\n pars[:name]=params[:user][:name]\n pars[:role]=params[:user][:role]\n user.update(pars) \n else\n user=User.new(params[:user])\n end\n LOG.debug(fname) {\"************************ current_user=#{user.inspect}\"}\n end", "def create_company_data\n @user = User.find(params[:user_id])\n @current_company = @user.companies.find_by({:selected => true})\n @company = @user.companies.find(params[:id])\n\n if @company.update_attributes(company_data_params)\n flash[:success] = \"Datos actualizados\"\n\n redirect_to user_company_path(@user,@company)\n else\n flash[:danger] = \"No se pudo editar!\"\n render 'new'\n end\n end", "def create\n @user = User.new(params[:user])\n @user.organisation_id = @curr_user.organisation_id\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_path, :notice => 'User was successfully created.' }\n format.json { render :json => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @customer_company = CustomerCompany.new(customer_company_params)\n @customer_company.created_user_id = current_user.id\n respond_to do |format|\n if @customer_company.save\n format.html { redirect_to @customer_company, notice: t(\"controllers.create_success\") }\n format.json { render :show, status: :created, location: @customer_company }\n else\n @customer_companies_options = CustomerCompany.where(active: true, consortium: true).map{|m| [ m.company_customer , m.id ] }\n format.html { render :new }\n format.json { render json: @customer_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_user(field_hash)\n field_hash[:id] = \"user/new\"\n payload = compose(field_hash)\n resp = @site['user/new/edit'].post payload\n new_id = resp.match(/User\\s*(\\d+)/)\n if new_id.class == MatchData\n new_user = new_id[1]\n else\n new_user = resp\n end\n new_user # return the new user id or the full REST response\n end", "def create\n if @company = Company.find(entity_id_from_params(:company))\n respond_to do |format|\n current_user.account.companies << @company\n format.html { redirect_to root_path, notice: 'Company was successfully created.' }\n format.json\n end\n end\n end", "def set_create_user_fields\n user_id = AuditModule.get_current_user.uid\n self.created_by = user_id\n self.updated_by = user_id\n end", "def new_user_record_from(user_data)\n user = User.new(email: user_data[:email], name: user_data[:name], password: \"temporal_password\")\n user\n end", "def create\n @company = Company.new(company_params)\n if current_user\n current_user.companies << @company\n end\n @company.save\n flash[:safe] = %Q[#{t(\"company_created\")} #{view_context.link_to(t(\"create_new_open_jobs\"), administration_company_path(@company))}.]\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :internal_server_error }\n end\n end\n end", "def create_new_user\n username = find_username\n @user = User.new(\n email: auth_email,\n username: username,\n password: Devise.friendly_token[0, 20]\n )\n @user.skip_confirmation!\n @user.save!\n\n @user\n end", "def add_creative_project_user\n creative_project_role = CreativeProjectRole.create( creative_project_id: self.id, \n role: 'project manager'\n )\n \n creative_project_user = CreativeProjectUser.create( user_id: self.user_id, \n creative_project_role_id: creative_project_role.id, \n creative_project_id: self.id,\n approved_by_project_manager: true,\n approved_by_user: true\n ) \n end", "def create_user(options = {})\n\t\trecord = Factory.build(:user,options)\n\t\trecord.save\n\t\trecord\n\tend", "def create_user(options = {})\n\t\trecord = Factory.build(:user,options)\n\t\trecord.save\n\t\trecord\n\tend", "def create\n return request_sreg unless params[:user][:identity_url].blank? || !params[:commit].eql?('Load from OpenID')\n logout_keeping_session! unless logged_in? && current_user.is_administrator?\n @object = User.new(params[:user])\n # Add attributes not available to mass-assign\n login = params[:user][:login]\n identity_url = params[:user][:identity_url]\n @object.login = (login.blank? ? nil : login)\n @object.identity_url = (identity_url.blank? ? nil : identity_url)\n success = @object && @object.valid?\n @object.save! if success\n # the normal case of user signup\n @object.register! if success && params[:activate].to_i != 1\n # special case for administrators creating accounts\n if success && params[:activate].to_i == 1 && (logged_in? && current_user.is_administrator?)\n @object.activate!\n create_change_log_entry(@object.id, nil, 'activate', 'Automatic user activation on create.')\n end\n respond_to do |format|\n if success && @object.errors.empty?\n if logged_in? && current_user.is_administrator?\n flash[:notice] = 'The account has been created!'\n create_change_log_entry\n format.html { redirect_to(users_path) }\n format.xml { render :xml => @object, :status => :created, :location => @object }\n else\n flash[:notice] = 'Your account has been created! Please check your email, to complete the activation process.'\n create_change_log_entry(@object.id, @object.id)\n format.html { redirect_to(login_path) }\n format.xml { render :xml => @object, :status => :created, :location => @object }\n end\n else\n flash.now[:error] = \"We couldn't set up your account, sorry. Please try again, or contact the site administrator.\"\n format.html { render :action => 'new', :template => 'users/form' }\n format.xml { render :xml => @object.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n if params[:commit] == 'Client'\n @user.toggle(:is_client)\n elsif params[:commit] == 'Counselor'\n @user.is_client = false\n end \n\n if @user.save\n log_in @user\n session[:user_id] = @user.id\n flash[:success] = \"Welcome to Openly! Please visit your Account section to complete your profile.\"\n redirect_to @user\n else\n render 'new'\n end\n end", "def create_local\n uuid = @data[:id]\n\n log_event \"[I] Creating local user #{uuid}\"\n\n @entity = User.new(uuid: uuid)\n @entity.agent = Agent.named(@data.dig(:meta, :agent_name).to_s)\n\n apply_for_create\n\n @entity.save\n @entity\n end", "def create\n @company = current_user.companies.build(params[:company])\n flash[:notice] = t('flash.actions.create.notice', :resource_name => Company.model_name.human) if @company.save\n respond_with(@company, :location => companies_path)\n end", "def create_user(**data)\n create_object(type: 'User', data: { enabled: true }.merge(data))\n end", "def createNewUser(linkedInInfo)\n user = User.new do |u|\n u.firstName = getValueFromLinkedInInfo(linkedInInfo, 'firstName')\n u.lastName = getValueFromLinkedInInfo(linkedInInfo, 'lastName')\n u.location = getValueFromLinkedInInfo(linkedInInfo, 'location')\n u.industry = getValueFromLinkedInInfo(linkedInInfo, 'industry')\n u.numConnections = getValueFromLinkedInInfo(linkedInInfo, 'numConnections')\n u.position = getValueFromLinkedInInfo(linkedInInfo, 'title')\n u.company = getValueFromLinkedInInfo(linkedInInfo, 'company')\n u.reportedCount = 0\n u.linkedInId = getValueFromLinkedInInfo(linkedInInfo, 'id')\n u.emailAddress = getValueFromLinkedInInfo(linkedInInfo, 'emailAddress')\n end\n user.save\n return user\n end", "def create\n @employer = Employer.new(user_params)\n @employer.company = @company\n\n respond_to do |format|\n if @employer.save\n format.html { redirect_to admin_company_employers_url(@company), notice: 'Employer was successfully created.' }\n format.json { render :show, status: :created, location: @employer }\n else\n format.html { render :new }\n format.json { render json: @employer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n\n # Ensure the email addres is not a duplicate\n # If blank? returns true, then there is no user in the\n # database that has the same email as the user being created\n if User.where(email_address: @user.email_address).blank?\n if @user.save\n init_recur_plates @user # Setup recurring plate entry\n log_in @user # log in user right after sign up\n flash[:success] = 'Welcome to the LatePlate-o-Tron 3000!'\n redirect_to user_url(@user) # handle successful signup\n else\n render 'new'\n end\n # Make the user retry if the email is already being used\n elsif !User.where(email_address: @user.email_address).blank?\n flash[:danger] = 'A user with this email address already exists!'\n redirect_to root_url\n end\n end", "def create_user\n \t@user = User.new(user_params)\n @user.username = @user.name.split.sum\n \[email protected]_id = current_user.facility_id\n \[email protected] = 'medinternational.dev'[email protected]_s + \"@gmail.com\"\n \[email protected] = \"english\"\n \[email protected] = \"password\"\n @user.role = Role.find_by_name(\"bmet_tech\")\n \trespond_to do |format|\n \t\tif @user.save\n \t\t\tformat.html { redirect_to settings_path, notice: 'User successfully created'}\n \t\t\tformat.json { redirect_to settings_path, notice: 'User successfully created'}\n \t\telse\n \t\t\tformat.html {redirect_to settings_path, notice: 'Failed to create user'}\n \t\t\tformat.json { render json: @user.errors, status: :unprocessable_entity}\n \t\tend\n \tend\n end" ]
[ "0.81098706", "0.80224335", "0.746584", "0.743986", "0.73469734", "0.73166806", "0.7283389", "0.72600806", "0.71121275", "0.7093118", "0.70498973", "0.6916142", "0.68976027", "0.6865414", "0.68131405", "0.67821765", "0.6724665", "0.6698569", "0.66943014", "0.668133", "0.66785604", "0.66721445", "0.66330457", "0.6624812", "0.66205597", "0.6605545", "0.6601022", "0.6568581", "0.65470535", "0.6515851", "0.6514659", "0.6490819", "0.64871734", "0.64757645", "0.6462228", "0.64585286", "0.64489055", "0.6427703", "0.64210707", "0.641954", "0.63970816", "0.63951796", "0.63903475", "0.63759214", "0.6368526", "0.6354288", "0.63366586", "0.63347626", "0.6333266", "0.632012", "0.63000536", "0.6299387", "0.6297822", "0.62939537", "0.62917286", "0.62782645", "0.6262953", "0.6259682", "0.625465", "0.6253797", "0.62406313", "0.6233877", "0.62283826", "0.62246394", "0.6220483", "0.62121457", "0.62050515", "0.6200538", "0.61802554", "0.6180181", "0.6174297", "0.6172841", "0.61684364", "0.6166041", "0.6165648", "0.6155215", "0.6147235", "0.6132719", "0.61284393", "0.6125884", "0.6119635", "0.6119349", "0.61185783", "0.6117349", "0.61168766", "0.61113596", "0.6106653", "0.6101108", "0.6098682", "0.60979086", "0.60979086", "0.6097391", "0.6088855", "0.6080815", "0.6079687", "0.60782605", "0.6076744", "0.6075635", "0.6065955", "0.60643435" ]
0.6559135
28
Creates a new user for a company
def create @roles = ROLE @company = Company.find( params[:company_id]) role = params[:user][:role] params[:user].delete(:role) @user = @company.users.build( params[:user]) @user.role = Integer role @user.state = -1 @user.password_digest = 0 if @user.save UserMailer.verification_email(@user).deliver redirect_to backoffice_company_user_path @company.id, @user else render 'new' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @company = Company.new\n @company.name = params[:new_company][:name]\n @company.slug = @company.name.parameterize\n @company.state = COMPANY_STATE[:unchecked]\n @user = User.new\n if @company.save\n @user = @company.users.build\n @user.email = params[:new_company][:email]\n @user.name = t(:root)\n @user.state = STATE[:unchecked]\n @user.role = ROOT\n @user.password_digest = 0\n @user.locale = I18n.locale\n if @user.save\n UserMailer.verification_email(@user).deliver\n flash[:success] = t(:company_account_created)\n redirect_to company_signin_path @company.id\n else\n @company.destroy\n render 'new'\n end\n else\n render 'new'\n end\n end", "def create\n @user = User.new(params[:user])\n @user.company = current_company\n create!\n end", "def create\n @user = User.create(user_params_with_password)\n @user.company = current_user.company\n if @user.save\n flash[:success] = t('messages.default_success')\n redirect_to users_path\n else\n render :new\n end\n end", "def create\n @user = User.new(user_params)\n @user.company_id = current_user.company_id\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'Usuario creado exitosamente.' }\n format.json { render action: 'show', status: :created, location: @user }\n else\n format.html { render action: 'new' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user_params = sign_up_params\n @user = User.new(user_params)\n if user_params[:password] == \"\" || user_params[:password_confirmation] == \"\"\n puts \"NO PASSWORD ERROR\"\n flash[:error] = \"Need a password to sign up\"\n redirect_to '/signin'\n return \n end\n if params[:company_serial]\n company = Company.find_by(company_token: params[:company_serial])\n if company\n @user.company_id = company.id\n if company.company_name == \"IVA\"\n @user.admin = true\n end\n else\n flash[:alert] = \"The serial key provided was invalid.\"\n redirect_to '/signin'\n end\n else\n flash[:alert] = \"A company serial key must be provided to register.\"\n redirect_to '/signin'\n end\n \n if @user == \"\"\n flash[:alert] = \"Please provide a password to register with.\"\n redirect_to '/signin'\n else\n @user.save\n begin\n sign_in @user\n rescue \n flash[:error] = \"Email already in use\"\n redirect_to '/signin' and return \n end\n if [email protected]\n Apartment::Tenant.switch(Company.find(@user.company_id).company_name.gsub(/'/,'').gsub(/\\s/,''))\n end\n redirect_to \"/pearlception\" and return\n end\n \n end", "def create\n @company = Company.new(params[:company])\n \n if current_user\n\t @company.user_id = current_user.id\n end\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to(@company, :notice => 'Company was successfully created.') }\n format.xml { render :xml => @company, :status => :created, :location => @company }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @company_user_info = current_user.build_company_user_info(params[:company_user_info])\n\n if @company_user_info.save\n flash[:notice] = \"你已经成功申请了企业用户,请耐心等待\"\n redirect_to current_user\n else\n flash.now[:error] = \"申请失败,请重新填写\"\n render action: \"new\"\n end\n end", "def create\n @company = Company.find(params[:company_id])\n if !can?(:manage, @company)\n raise CanCan::AccessDenied.new(\"Usted no puede administrar otra compañia\", :manage, @company)\n end\n @user = User.new(params[:user])\n @roles = Role.all\n role_ids = params[:role_ids] if params[:role_ids] \n role_ids ||= []\n @user.role_ids = role_ids\n @user.company_id = @company.id\n \n if !current_user.super_admin\n @user.super_admin = false\n end\n \n respond_to do |format|\n if @user.save\n format.html { redirect_to company_users_path(@company), notice: 'El usuario fue creado exitosamente.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = current_user.companies.build(company_params)\n\n if @company.save\n flash[:success] = \"Saved!\"\n redirect_to companies_path\n else\n render 'new'\n end\n end", "def create\n @user = User.new(params[:user])\n if params[:reservation].nil?\n @company = Company.new(params[:company])\n else\n\t # user has been invited, company already exists\n\t @company = Company.find(params[:company][:id])\n\t @user.company = @company\n\t Reservation.find_by_token(params[:reservation][:token]).delete\n\t end\n\n respond_to do |format|\n if @user.save\n\t if params[:reservation].nil?\n\t\t # set company owner\n\t @company.owner = @user\n\t @company.save\n\t @company.create_default_infos\n\t @user.company = @company\n\t end\n\t @user.save\n format.html { redirect_to :users, notice: 'Registration successful.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(params[:company])\n @company.owner = User.find(session[:user_id])\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render json: @company, status: :created, location: @company }\n else\n format.html { render action: \"new\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_company\n company = Company.create!()\n company\n end", "def create\n\t\t@company = Company.new(company_params)\n\t\t# for admin to add a company\n\t\tif admin? && @company.save\n\t\t\tflash[:success] = \"#{@company.name} was successfully saved!\"\n\t\t\tredirect_to beanformed_company_beans_path(@company.id)\n\t\t# for all users; new companies come in as approved : false\n\t\telsif @company.save\n\t\t\tflash[:success] = \"Thanks for registering #{@company.name}! You will be notified when you are approved!\"\n\t\t\t@roaster = Roaster.find(session[:roaster_id])\n\t\t\[email protected]({company_id: @company.id, phone: params[:company][:phone], role: \"pending\"})\n\t\t\tredirect_to new_beanformed_company_path\n\t\telse\n\t\t\tflash[:error] = \"Please fill out all fields.\"\n\t\t\tredirect_to new_beanformed_company_path\n\t\tend\n\tend", "def create\n @user = Company.find(params[:company_id]).groups.find(params[:group_id]).users.new(user_params)\n\n if @user.save\n redirect_to company_group_user_path(@user.group.company_id, @user.group_id, @user), notice: '正常に作成しました'\n render :show, status: :created, location: @user\n else\n render :new\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def new\n @company = Company.new\n @user = User.new(:user_roles => [UserRole[:company_admin]])\n @user.build_person\n end", "def create\n @company = Company.new(company_params)\n @company.user = current_user\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to companies_path, notice: 'Компания успешно создана' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_new_company\n puts \"Please enter your company name:\"\n company_name = gets.strip\n\n prompt = TTY::Prompt.new\n puts \"Please provide a username and password.\"\n username = prompt.ask(\"Username:\")\n\n password = prompt.mask(\"Password:\")\n\n company = Company.create({ :name => company_name, :password => password, :username => username })\n end", "def create\n @user = User.new(params[:user])\n @thiscompany = Company.find(session[:company_id])\n puts \"\\n\\n\\n @thiscompany.id = \" + @thiscompany.id.to_s ##debug\n y session #debug\n\n respond_to do |format|\n if @user.save\n flash[:notice] = 'User was successfully created.'\n format.html { redirect_to(@user) }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(params[:company])\n @user = User.new(params[:user])\n @employer = Employer.new\n @user.profileable = @employer\n @employer.company = @company\n if @company.save\n if @user.save\n @employer.save\n sign_in(:user, @user)\n redirect_to root_path\n\n end\n end\n end", "def create\n @company = Company.new(company_params)\n respond_to do |format|\n if @company.save\n # User becomes company admin\n current_user.update_attribute(:company_id, @company.id)\n current_user.update_attribute(:company_admin, true)\n # Send email notifications to Admins and current user\n ExampleMailer.create_company_admin(@company).deliver\n ExampleMailer.create_company(@company).deliver\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_employee_user\n email = self.work_email\n user = User.new(email: self.work_email, password: 'appsimpact@#123', role: 'employee')\n user.save\n self.user_id = user.id\n end", "def create\n @new_company = NewCompany.new(new_company_params)\n @new_company.user = current_user\n\n respond_to do |format|\n if @new_company.save\n format.html { redirect_to new_requesit_path, notice: 'Вы успешно добавили компанию!' }\n format.json { render :show, status: :created, location: @new_company }\n else\n format.html { render :new }\n format.json { render json: @new_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_user\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n post(\"users.json\", params)\n end", "def create\n @company = Company.create!(company_params)\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n @company.company_admins.create(:user_id => current_user.id, :company_id => @company.id, :user_role => 'admin')\n format.html { redirect_to @company, flash: {:success => 'Company was successfully created.'} }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n\n render status: \\\n current_user.save_company(@company) ? :created : :unprocessable_entity\n end", "def create\n @company_user = CompanyUser.new(params[:company_user])\n @company = Company.find(params[:company_user][:company_id])\n \n @users_left_i = getUser().users_left\n @users_left = getUser().print_users_left\n @users_left_class = getUser().users_left_class\n \n # Check package limits\n if(@users_left_i <= 0 and @users_left_i > -1000)\n flash[:error] = \"You have created the most users you can within your package. Please select another package to create more users.\"\n redirect_to(\"/pricing\")\n else\n if(params[:company_user][:user_id] and params[:company_user][:user_id] != \"\")\n # Check if user already exists for the company\n @alr_user = CompanyUser.find(:first, :conditions => {:company_id => @company.id, :user_id => params[:company_user][:user_id]})\n\n if(@alr_user)\n err_alr = true\n end\n end\n\n if(err_alr)\n flash[:error] = \"This user is already part of the company\"\n redirect_to \"/company_users/new/#{@company.id}\"\n elsif @company_user.save\n redirect_to(@company_user, :notice => 'Company user was successfully created.')\n else\n render :action => \"new\"\n end\n end\n end", "def create_user(options = {})\n post \"/users\", options\n end", "def new_user_create\n @user = User.create_user(user_params, current_user.account_id) # New User\n begin\n @user.save!\n @users = User.get_all(current_user.account_id)\n flash[:success] = \"User was created successfully!\"\n rescue => e\n flash[:alert] = \"User creation failed!\"\n end \n end", "def create_user(attributes)\n BrickFTP::API::User.create(attributes)\n end", "def create_user(attributes)\n BrickFTP::API::User.create(attributes)\n end", "def create\n @user = User.new(user_to_be_created)\n\n error = @user.validate_user?\n\n if error.nil? && @user.save\n handler_notice('Usuário cadastrado com sucesso!', login_path)\n else\n handler_notice_error(error, new_user_path)\n end\n end", "def create_user\n User.create name: \"test\", email: \"[email protected]\", password: \"123456\"\n end", "def create_account_user(options = {})\n post('accountuser?_method=PUT', options)\n end", "def new\n @company = Company.find( params[:company_id])\n @user = @company.users.build\n @roles = ROLE\n end", "def create_user\n User.create name: 'test', email: '[email protected]', password: '123456'\n end", "def create_user\n params = {\n client_id: @client_id,\n email: @email\n }\n @user = User.using_client_shard(client: @client).create!(params)\n end", "def create_user(obj, type)\n @logger.info(\"Creating user for #{type} #{obj.name}\")\n user = SugarCRM::User.new\n user.user_name = (type == 'agent') ? obj.emerchantpay_agent_id : obj.emerchantpay_iso_id\n user.user_name ||= \"EMP\"\n user.last_name = obj.name\n user.type_c = type\n #user.email1 = obj.email_address || \"[email protected]\"\n user.email1 = '[email protected]'\n user.status = 'Inactive'\n user.system_generated_password = false\n user.save!\n obj.assigned_user_id = user.id\n obj.save!\n \n populate_user_pool(user, type)\n end", "def create_user(email, pass, login = nil, id = nil, cui = nil)\n send_req({\n act: :user_create,\n cloudflare_email: email,\n cloudflare_pass: pass,\n cloudflare_username: login,\n unique_id: id,\n clobber_unique_id: cui\n })\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.json { render :show, status: :created, location: @company }\n SignUpNotifier.registrated(@company).deliver\n else\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n begin\n \n detail = @@data_util.hash_data_to_upper_case( params[:company], ['description'])\n\n detail[:mypclient_id] = session[:client_id]\n detail[:createdby] = session[:username]\n detail[:isactive] = 1\n\n @company = Company.new(detail)\n if @company.save\n @@request_result[:success] = true\n @@request_result[:notice] = 'New company successfully created.'\n else\n @@request_result[:errormsg] = @company.errors.full_messages[0]\n end\n rescue Exception => e\n @@request_result[:errormsg] = e.message\n end\n render json: @@request_result\n end", "def create\n @company = Company.new(company_params)\n if @company.save\n flash[:success] = \"Company was successfully created.\"\n redirect_to companies_url\n else\n flash[:error] = @company.errors.full_messages.join(\" and \")\n redirect_to new_company_url(@company)\n end\n end", "def create\n @company = current_user.companies.build(params[:company])\n flash[:notice] = t('flash.actions.create.notice', :resource_name => Company.model_name.human) if @company.save\n respond_with(@company, :location => companies_path)\n end", "def create\n @account_company = Account::Company.new(account_company_params)\n\n respond_to do |format|\n if @account_company.save\n format.html { redirect_to @account_company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @account_company }\n else\n format.html { render :new }\n format.json { render json: @account_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n if current_user\n current_user.companies << @company\n end\n @company.save\n flash[:safe] = %Q[#{t(\"company_created\")} #{view_context.link_to(t(\"create_new_open_jobs\"), administration_company_path(@company))}.]\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :internal_server_error }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n if @company.save\n redirect_to @company, notice: \"Company was successfully created.\"\n else\n render :new, status: :unprocessable_entity\n end\n end", "def create\n\t\tbuild_resource(sign_up_params)\n\t\t@company = Company.new\n\t\t# companies params\n\n\t\[email protected]_name = params[ :company_name ]\n\t\[email protected]_first_name = params[ :contact_first_name ]\n\t\[email protected]_last_name = params[ :contact_last_name ]\n\t\[email protected]_last_m_name = params[ :contact_last_m_name ]\n\t\[email protected]_employement = params[ :contact_employement ]\t\n\t\[email protected] = params[ :website ]\n\t\[email protected]_date = params[ :foundation_date ]\n\t\[email protected] = params[ :rfc ]\n\n\t\t# we company type value, since enum is an int and we get a string...\n\t\tif params[ :category ] == \"matriz\"\n\t\t\[email protected] = 0\n\t\telse\n\t\t\[email protected] = 1\n\t\tend\n\n\n\t\tif @company .save\n\t\t\tresource.roleable = @company\n\t\t\tresource.save\n\n\t\t\tyield resource if block_given?\n\t\t\tif resource.persisted?\n\t\t\t\tif resource.active_for_authentication?\n\t\t\t\t\tset_flash_message! :notice, :signed_up\n\t\t\t\t\tsign_up(resource_name, resource)\n\t\t\t\t\trespond_with resource, location: after_sign_up_path_for(resource)\n\t\t\t\telse\n\t\t\t\t\tset_flash_message! :notice, :\"signed_up_but_#{resource.inactive_message}\"\n\t\t\t\t\texpire_data_after_sign_in!\n\t\t\t\t\trespond_with resource, location: after_inactive_sign_up_path_for(resource)\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tclean_up_passwords resource\n\t\t\t\tset_minimum_password_length\n\t\t\t\trespond_with resource\n\t\t\tend\n\t\telse\n\t\t\trender :new\n\t\tend\n\tend", "def sign_up_params\n params.require(:user).permit(:company_name, :email, :password, :name)\n end", "def create\n \n @company = Company.new(params[:company])\n \n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Empresa foi criada com sucesso.' }\n format.json { render json: @company, status: :created, location: @company }\n else\n format.html { render action: \"new\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @employer = Employer.new(user_params)\n @employer.company = @company\n\n respond_to do |format|\n if @employer.save\n format.html { redirect_to admin_company_employers_url(@company), notice: 'Employer was successfully created.' }\n format.json { render :show, status: :created, location: @employer }\n else\n format.html { render :new }\n format.json { render json: @employer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # binding.pry\n @company = Company.new(params[:company])\n if @company.save\n UpdateMailer.update_email(@company, current_user, action_name).deliver\n flash[:notice] = 'Company was successfully created.'\n end\n respond_with(@company)\n end", "def create_user(email = nil, login = nil, password = nil, first_name = nil, last_name = nil)\n if password == nil\n password = @pointconfig[\"generic_user_password\"]\n end\n\n res = query(\"principal-update\", \n \"email\" => email,\n \"login\" => login, \n \"password\" => password,\n \"first-name\" => first_name,\n \"last-name\" => last_name,\n \"send-email\" => false,\n \"has-children\" => 0, \n \"type\" => \"user\")\n\n puts \"ACS: user created\"\n return res.body\n end", "def create\n if @company = Company.find(entity_id_from_params(:company))\n respond_to do |format|\n current_user.account.companies << @company\n format.html { redirect_to root_path, notice: 'Company was successfully created.' }\n format.json\n end\n end\n end", "def create\n\t\t\t\t@user = User.create!(create_user_params)\n\t\t\tend", "def create\n user = User.new(user_params)\n if user.save\n auth_token = AuthenticateUser.new(user.email, user.password)\n .call\n # send email using welcome template\n UserMailer.welcome_email(user).deliver_now\n response = { message: Message.account_created, token: auth_token }\n json_response(response, :created)\n else\n json_response(user.errors, :unprocessable_entity)\n end\n end", "def create_new_user\n username = find_username\n @user = User.new(\n email: auth_email,\n username: username,\n password: Devise.friendly_token[0, 20]\n )\n @user.skip_confirmation!\n @user.save!\n\n @user\n end", "def create_user(body)\n post 'create_user', body\n end", "def create_user(options = {})\n post :create, {:user => { :name => 'quire', :point_value => \"2\", :login => 'quire', :email => '[email protected]',\n :password => 'quire', :password_confirmation => 'quire' }.merge(options)}, {:user_id => \"1\"}\n end", "def create_user(options = {})\n\t\trecord = Factory.build(:user,options)\n\t\trecord.save\n\t\trecord\n\tend", "def create_user(options = {})\n\t\trecord = Factory.build(:user,options)\n\t\trecord.save\n\t\trecord\n\tend", "def create\n\t\t@company = Company.new(params[:company].merge({:by_user_id => current_user.id}))\n\t\tmake_breadcrumbs\n\n\t\trespond_to do |format|\n\t\t\tif @company.save\n\t\t\t\tformat.html { redirect_to @company, notice: t('app.companies.created') }\n\t\t\t\tformat.json { render json: @company, status: :created, location: @company }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @company.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create_user\n User.create name: 'test', email: '[email protected]', password: '123456'\n end", "def create_user(options={})\n\t\t\tUser.create({\n\t\t\t\tusername: \"user example\",\n\t\t\t\temail: \"[email protected]\",\n\t\t\t\tpassword: \"password\",\n\t\t\t\tpassword_confirmation: \"password\"\n\t\t\t}.merge(options))\n\t\tend", "def create_member\n @company = current_user.company\n @user = User.new(user_params)\n @user.company_id = current_user.company_id if @user.company_id.blank?\n @user.type_id = params[:user_type_id]\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created }\n else\n format.html { \n @agencies = @company.agencies\n flash[:alert] = @user.errors.full_messages.join(\"<br>\")\n render action: 'new' \n }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_user\n user = User.where(email: user_email)\n if user.blank? # new user\n @user = create_new_user\n church = nil\n if affiliation.blank?\n church = create_affiliation_from_church\n else\n church = Affiliation.find(self.affiliation)\n end\n @user.affiliation = church\n church.users << @user\n @user.save\n\n guest = Role.find_by_name(\"Guest\").id \n @user.role_ids=[guest]\n self.user_id = @user.id\n end\n end", "def create\n @user = User.new(user_params)\n\n # save was requested by either current_user or else must be a new registration\n if @user.save(current_user)\n redirect_to users_path\n else\n render('new', status: :unprocessable_entity)\n end\n end", "def create_user_account\n User.create!(email: self.email, password: self.customer)\n # user = User.new do |u|\n # u.email = email\n # u.password = customer\n # u.save\n # end\n end", "def create\n @company = Company.new(company_params)\n\n \n if @company.save\n redirect_to companies_path, notice: 'Company was successfully created.' \n else\n format.html { render :new }\n end\n end", "def create_user(user_hash={})\n @user = User.new(user_hash)\n @user.save\n end", "def create_user(user_hash={})\n @user = User.new(user_hash)\n @user.save\n end", "def create(options = {})\n params.required(:login, :email, :password).accepts(:first_name, :last_name, :group_id).validate!(options)\n request(:post, '/users.json', default_params(options))\n end", "def create_user(**args)\n params = parameters(args) do\n required_params :name, :email, :active_flag\n optional_params :name, :email, :active_flag\n end\n request(:post, 'users', params)\n end", "def create\n # Note this is different to the usual situation where anybody can create\n # an account. Here, only administrators can create accounts for others;\n # and doing so does not log them out.\n unless current_user.admin?\n flash[:error] = \"Users can only be created by administrators.\"\n redirect_to (request.env[\"HTTP_REFERER\"] || root_path) and return\n end\n \n @user = User.new(params[:user])\n success = @user && @user.save\n if success && @user.errors.empty?\n # Protects against session fixation attacks, causes request forgery\n # protection if visitor resubmits an earlier form using back\n # button. Uncomment if you understand the tradeoffs.\n # reset session\n redirect_to users_path\n flash[:notice] = \"The account #{ERB::Util.h @user.login} has been setup for #{ERB::Util.h @user.name}.\"\n else\n flash.now[:error] = \"We couldn't set up that account, sorry.\"\n render :action => 'new'\n end\n end", "def create_user\n fake_password = Faker::Internet.password\n params = {\n user: {\n username: Faker::Internet.user_name,\n email: Faker::Internet.email,\n password: fake_password,\n password_confirmation: fake_password\n }\n }\n post signup_post_url, { params: params }\n params[:user]\n end", "def create_user(attributes)\n post(\"/v1/users\", attributes)\n end", "def create\n @corporate_user, password = User.create_corp_user(corporate_user_params)\n respond_to do |format|\n if @corporate_user.save\n admin_email = User.where(id: @corporate_user.parent_id).first.email\n InviteUser.corporate_user_confirmation(@corporate_user,admin_email,password).deliver\n format.html { redirect_to corporate_users_path, notice: \"#{APP_MSG['corporate_user']['create']}\" }\n format.json { render :show, status: :created, location: corporate_user_path }\n else\n format.html { render :new }\n format.json { render json: @corporate_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(config, name, user_guid)\n\n token = @client.token\n\n user_setup_obj = UsersSetup.new(config)\n admin_token = user_setup_obj.get_admin_token\n\n # elevate user just to create organization\n @client.token = admin_token\n\n new_org = @client.organization\n new_org.name = name\n if new_org.create!\n org_guid = new_org.guid\n users_obj = Users.new(admin_token, @client.target)\n users_obj.add_user_to_org_with_role(org_guid, user_guid, ['owner', 'billing'])\n\n # then put token back to the initial one\n @client.token = token\n org_guid\n end\n\n end", "def create\n @user = User.new(user_params)\n if @user.role == 'renter'\n @user.company_id == 24\n @user.title == 'renter'\n elsif @user.role = 'realtor'\n @user.company_id == 25\n @user.title == 'realtor'\n end\n @user.company_id = user_params[:company_id] if logged_in?\n @user.role = user_params[:role] if logged_in?\n @user.title = user_params[:title] if logged_in?\n @user.save\n respond_to do |format|\n if @user.save and !logged_in?\n log_in @user\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n elsif @user.save and logged_in?\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new, notce: 'User was not created, please try again.' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_user\n User.new({\n email: 'hoge@hoge',\n password: 'hoge',\n password_confirmation: 'hoge'\n })\n end", "def create\n @company = Company.new(company_params)\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def signup(params)\n if self.is_client?\n user = self.employees.create!(name: params[:name],last_name: params[:last_name],\n email: params[:email],password: params[:password],password_confirmation: params[:password_confirmation])\n GroupsUser.create!(user_id: user.id,group_id: params[:group_id])\n user\n else\n user = self.clients.create!(name: params[:name],email: params[:email],password: params[:password],\n password_confirmation: params[:password_confirmation])\n end\n end", "def create\n @user = User.new(params[:user])\n @user.email = @user.username + '@' + @user.domain.domain\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @company = current_user.build_company(params[:company])\r\n respond_to do |format|\r\n if @company.save\r\n expire_fragment \"yellowpage\"\r\n expire_fragment \"users_center_#{session[:user_id]}\"\r\n flash[:notice] = '公司成功创建,恭喜你创建完成了!'\r\n format.html { redirect_to :action=>\"show\",:id=>@company.id}\r\n else\r\n flash[:notice] = '公司创建失败了,再次创建试试看?'\r\n format.html { redirect_to :action=>\"new\"}\r\n end\r\n end\r\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n # Must attach current user to company\n # @company.user_id << @current_user\n # @company.users = []\n # unless params[:user][:user_ids].nil?\n # params[:user][:user_ids].each do |user_id|\n # @company.users << User.find(user_id) unless user_id.empty?\n # end\n # end\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Gallery was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render json: @company, status: :created, location: @company }\n else\n format.html { render action: \"new\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render json: @company, status: :created, location: @company }\n else\n format.html { render action: \"new\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render json: @company, status: :created, location: @company }\n else\n format.html { render action: \"new\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render json: @company, status: :created, location: @company }\n else\n format.html { render action: \"new\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render json: @company, status: :created, location: @company }\n else\n format.html { render action: \"new\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_user(username, password, full_name, email)\n representation = form_encoded({ \"user[name]\" => username,\n \"user[password]\" => password,\n \"user[full_name]\" => full_name,\n \"user[email]\" => email }) \n puts representation\n begin\n response = open(@service_root + '/users', :method => :post, \n :body => representation)\n puts \"User #{username} created at #{response.meta['location']}\"\n rescue OpenURI::HTTPError => e\n response_code = e.io.status[0].to_i\n if response_code == \"409\" # Conflict\n puts \"Sorry, there's already a user called #{username}.\"\n else\n raise e\n end\n end\n end", "def create\n\t\t@company = Company.new(company_params)\n\t\tif @company.save\n\t\t\tflash[:notice] = \"Successfully created company!\"\n\t\t\tredirect_to company_path(@company)\n\t\telse\n\t\t\tflash[:alert] = \"Error creating new company!\"\n\t\t\trender :new\n\t\tend\n\tend", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render json: @company, status: :created, location: @company }\n else\n format.html { render action: \"new\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_user(name)\n User.create(name: name)\nend", "def create\n @tyc_company = Tyc::Company.new(tyc_company_params)\n\n respond_to do |format|\n if @tyc_company.save\n format.html { redirect_to @tyc_company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @tyc_company }\n else\n format.html { render :new }\n format.json { render json: @tyc_company.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.8462471", "0.84425944", "0.80941796", "0.77406055", "0.76298815", "0.75353724", "0.7533703", "0.74848634", "0.7469614", "0.7467515", "0.72764736", "0.72478795", "0.7225255", "0.72136354", "0.717133", "0.7121461", "0.7118365", "0.7101472", "0.70867646", "0.7075002", "0.7035042", "0.6996905", "0.69949585", "0.6991973", "0.69808984", "0.6980406", "0.6970902", "0.6965081", "0.69503236", "0.6948361", "0.69481987", "0.69260913", "0.68881375", "0.68799454", "0.68705493", "0.68536574", "0.6839365", "0.68265647", "0.681796", "0.68179065", "0.6806668", "0.6802077", "0.67995155", "0.6796788", "0.6786359", "0.67854995", "0.6783293", "0.67804337", "0.67746687", "0.6774394", "0.6752134", "0.6747438", "0.6745868", "0.67307293", "0.671939", "0.67086834", "0.66903806", "0.6689584", "0.66891944", "0.66891944", "0.66841483", "0.66803813", "0.66785216", "0.6672991", "0.66673565", "0.6660347", "0.6659493", "0.66572213", "0.6653554", "0.6653554", "0.6645593", "0.66358626", "0.66274774", "0.6623666", "0.6609038", "0.6606818", "0.6603973", "0.6601842", "0.66005147", "0.6594899", "0.6590525", "0.6590447", "0.65897936", "0.65896946", "0.65896946", "0.65896946", "0.65896946", "0.65896946", "0.65889454", "0.658094", "0.65741134", "0.65741134", "0.65741134", "0.65741134", "0.6573802", "0.65721005", "0.65700877", "0.65637815", "0.65616834", "0.6560463" ]
0.7423909
10
If the file is less than MAXIMUM_NAME_LENGTH, it doesn't need to be split, and the prefix can be blank.
def split? file.bytesize > MAXIMUM_NAME_LENGTH end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assert_filename_length!(filename)\n name = relative_name = filename.to_s.sub(File.expand_path(@options[:spec_directory]), \"\")\n assert false, \"Filename #{name} must no more than #{256 - GEMFILE_PREFIX_LENGTH} characters long\" if name.size > (256 - GEMFILE_PREFIX_LENGTH)\n\n if name.size <= 100 then\n prefix = \"\"\n else\n parts = name.split(/\\//)\n newname = parts.pop\n nxt = \"\"\n\n loop do\n nxt = parts.pop\n break if newname.size + 1 + nxt.size > 100\n newname = nxt + \"/\" + newname\n end\n\n prefix = (parts + [nxt]).join \"/\"\n name = newname\n\n assert false, \"base name (#{name}) of #{relative_name} must no more than 100 characters long\" if name.size > 100\n assert false, \"prefix (#{prefix}) of #{relative_name} must no more than #{155 - GEMFILE_PREFIX_LENGTH} characters long\" if prefix.size > (155 - GEMFILE_PREFIX_LENGTH)\n end\n return nil\n end", "def prefixes(max_length:)\n names = %w()\n (names.select { |name| name.length <= max_length }.map { |name| str(name) }.reduce(:|) || str('1')).as(:prefix)\n end", "def valid_filename?(name)\n name.length.positive?\nend", "def check_name_length\n unless self.name.length >= 4\n errors[:name] << \"Name is too short, must be 4+ characters\"\n end\n end", "def trim_filename(filename)\n filename_length = filename.length\n \n #trim 'n' splice if necessary\n if filename_length > MAX_FILENAME_LENGTH\n filename = filename.to_s[0..MAX_FILENAME_LENGTH] + '...' + filename.to_s[(filename_length - FILENAME_TAIL_LENGTH)..filename_length]\n end\n \n return filename\nend", "def full_name\n if @prefix != \"\"\n File.join(@prefix, @name)\n else\n @name\n end\n end", "def file_prefix\n raise NotImplementedError\n end", "def prefix_valid?(prefix)\n NC_REGEXP.match(prefix.to_s) || prefix.to_s.empty?\n end", "def prefix_valid?(prefix)\n NC_REGEXP.match(prefix) || prefix.to_s.empty?\n end", "def prefix_limit\n limit = ideal_prefix_limit\n \n # extend the limit if the text after the substring is too short\n unless @options[:prefix] || full_text_after_substring_uses_ideal_suffix_limit?\n limit += ideal_suffix_limit - full_text_after_substring.unpack( \"U*\" ).size\n end\n \n limit\n end", "def full_text_before_substring_uses_ideal_prefix_limit?\n full_text_before_substring.unpack( \"U*\" ).size >= ideal_prefix_limit\n end", "def parse_name\n name = ''\n content = file_content\n\n s = content.index(NAME_START_DELIMITER)\n e = content.index(NAME_END_DELIMITER)\n\n unless s.nil?\n s += NAME_START_DELIMITER.size\n name = content[s..e-1].strip\n end\n\n return name\n end", "def strip_filename_prefix(filename, prefix)\n f = filename.rpartition(File.basename(filename))\n f[1] = strip_prefix(f[1], prefix)\n f.join\n end", "def has_middle_name\n @full_name.split(' ').length >= 3\n end", "def test_String_004_prefix\n \n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_String_004_prefix\")\n puts2(\"#######################\")\n \n sMyFile = \"some_long_filename.log\"\n puts2(\"\\nReturn the file name without its extension for: \" + sMyFile)\n sMyFilePrefix = sMyFile.prefix(\".\")\n puts2(\"File name: \" + sMyFilePrefix)\n #\n sMyEmailAddress = \"[email protected]\"\n puts2(\"\\nReturn the user account of the Email address: \" + sMyEmailAddress)\n sMyUserAccount = sMyEmailAddress.prefix(\"@\")\n puts2(\"User account: \" + sMyUserAccount)\n \n sMyString = \"This is a test\"\n puts2(\"\\nReturn the first word in the string: \" + sMyString)\n sMyFirstWord = sMyString.prefix(\" \")\n puts2(\"First word: \" + sMyFirstWord)\n \n sMyString = \" String with leading & trailing white space \"\n puts2(\"\\nReturn the first word of the String: \" + sMyString)\n sMyFirstWord = sMyString.prefix(\" \")\n puts2(\"First word: \" + sMyFirstWord)\n \n sMyString = \" No delimiter specified \"\n puts2(\"\\nReturn the whole String if: \" + sMyString)\n sMyFirstWord = sMyString.prefix(\"\")\n puts2(\"String: \" + sMyFirstWord)\n \n sMyString = \" Multiple delimiter-characters that are in the specified string \"\n puts2(\"\\nReturn the first word of the String: \" + sMyString)\n sMyFirstWord = sMyString.prefix(\" #\")\n puts2(\"First word: \" + sMyFirstWord)\n \n sMyString = \" Delimiter character is NOT in the string \"\n puts2(\"\\nReturn the whole String if: \" + sMyString)\n sMyFirstWord = sMyString.prefix(\".\")\n puts2(\"String: \" + sMyFirstWord)\n \n end", "def name\n chunk_name = nil\n File.open(@file_name) do |file|\n file.seek(@offset, IO::SEEK_CUR)\n chunk_name = file.read(4)\n end\n puts \"[WARNING] - Doesn't look like a valid chunk name: #{chunk_name}\" if @warnings && !(chunk_name =~ /^[\\w ]{4}$/)\n chunk_name\n end", "def getIncompleteName(firstAtom = [])\n name = \"\"\n parent = findParentString(firstAtom)\n name = getHydroPfix(parent.length)\n prefix = getPrefix(parent)\n name = prefix + name unless prefix == nil\n name\n end", "def fix_contig_name(name)\n if nil != name.gsub!(/_leftover.*$/,'')\n return name\n elsif name =~ /(.*)_\\d+$/\n return $1\n else \n return name\n end\n end", "def short_name\n name.size > 35 ? \"#{name[0..35]}...\" : name\n end", "def prefix_key\n if @struct.prefix_key.size > 0\n @struct.prefix_key[0..-1 - options[:prefix_delimiter].size]\n else\n \"\"\n end\n end", "def add_filename_prefix(filename, prefix)\n filename = filename.rpartition(File.basename(filename))\n filename[1] = \"#{prefix}#{filename[1]}\"\n filename.join\n end", "def load_prefix(sections)\n return if sections.empty? || sections.first.length < 3\n\n raise \"invalid prefix\" unless sections.second.to_s&.length >= 4\n\n sections.shift\n end", "def name_prefix\n unless @name_prefix\n @name_prefix = collect_first(&:name_prefix)\n end\n return @name_prefix\n end", "def validate_image_name\n name = upload_original_name.to_s\n name = name.sub(/^[a-zA-Z]:/, \"\")\n name = name.sub(%r{^.*[/\\\\]}, \"\")\n # name = '(uploaded at %s)' % Time.now.web_time if name.empty?\n name = name.truncate(120)\n return unless name.present? && User.current &&\n User.current.keep_filenames != \"toss\"\n\n self.original_name = name\n end", "def starts_with?(f, prefix)\n\treturn false if prefix.size > f.size\n\tf1 = f[0 .. prefix.size-1]\n\treturn f1 == prefix\nend", "def valid_filename(filename, prefix)\n return false if filename == nil\n\n match = filename.match(/[\\w.\\- ]+\\.xml/)\n if match == nil || match.to_s != filename\n return false\n end\n\n if prefix != nil\n if !filename.start_with?(prefix + \"-\")\n return false\n end\n end\n true\n end", "def name_too_long\n name.length > Account::DISPLAY_NAME_LIMIT\n end", "def valid_new_filename(file)\n new_file = file\n counter = 0\n while File.exist?(new_file) do\n counter += 1\n ext = File.extname(file)\n basename = file.split(ext).first\n new_file = \"#{basename}_#{counter}#{ext}\"\n end\n new_file\n end", "def starts_with?(prefix)\n prefix = prefix.to_s\n self[0, prefix.length] == prefix\n end", "def cleanse_name\n return if self.name.nil?\n self.name = self.name.strip\n self.name = nil if self.name.length == 0\n end", "def full_name_format\n valid_full_name = true\n\n if !self.name.nil?\n # Must contains white space\n valid_full_name = false if (/^(.*\\s+.*)+$/i =~ self.name).nil?\n # Must be alpha\n valid_full_name = false if(/^[A-Z]+$/i =~ self.name.remove(' ')).nil?\n else\n valid_full_name = false\n end\n\n if !valid_full_name\n self.errors.add(:name, 'deve ser Completo')\n raise ActiveRecord::Rollback\n end\n end", "def valid_name(full_name)\n names = full_name.split\n\n if names.size < 2 ||\n (names[-1].size < 3 || names[-1][-1] == \".\") ||\n names.select {|name| name.size == 1}.count > 0 ||\n names.select {|name| name[0] == name[0].downcase}.count > 0 ||\n (names.size > 2 && names[0].size == 2 && names[1].size > 2 && names[0][-1] == \".\")\n return false\n end\n\n names\nend", "def get_name(prefix)\n if(md = prefix.match(/(?u:^[<'](\\w+)[>']$)/))\n md[1]\n else\n nil\n end\n end", "def sanitize_name\n if ['Gene List', 'Cluster'].include?(self.file_type)\n self.name.strip!\n end\n end", "def split_name\n\t\t@full_name.split('')\n\tend", "def base_part_of(file_name)\n name = File.basename(file_name)\n name.gsub(/[^\\w._-]/, '')\n end", "def base_part_of(file_name)\n name = File.basename(file_name)\n name.gsub(/[^\\w._-]/, '')\n end", "def full_name_length(length)\n \n full = \"#{self.name} #{self.last_name}\"\n \n if full.length <= length.to_i\n full\n else\n full[0,length.to_i]+\"...\"\n end\n end", "def get_trunc_name name\n name[0..3].downcase\n end", "def prefix\n match(/Prefix\\s+:\\s+([^\\s])/)\n end", "def valid_file_name\n (@file_name.match(/((\\d)|([a-zA-Z])|(_))*.log/).to_s == @file_name)\n end", "def prefix=(value)\n value += '/' if value != '' and value[-1] != '/'\n @prefix = value\n end", "def valid_queue_name?(name)\n name =~ /^[a-z0-9][a-z0-9\\-]{1,}[^-]$/ && name.length < 64\n end", "def normalize_name(name, prefixes); end", "def clean_name\n return name.split(':').pop\n end", "def first_name\n super || (name and name.split.first)\n end", "def validate_name(value)\n return false if(value.to_s.length >= MAX_NAME_LENGTH)\n return true\n end", "def truncate!\n self.name = name[LENGTH_RANGE] if name && name.size > MAX_LENGTH\n self.scope = scope[LENGTH_RANGE] if scope && scope.size > MAX_LENGTH\n end", "def set_prefix_key(key)\n check_return_code(\n if key\n key += options[:prefix_delimiter]\n raise ArgumentError, \"Max prefix key + prefix delimiter size is #{Lib::MEMCACHED_PREFIX_KEY_MAX_SIZE - 1}\" unless\n key.size < Lib::MEMCACHED_PREFIX_KEY_MAX_SIZE\n Lib.memcached_callback_set(@struct, Lib::MEMCACHED_CALLBACK_PREFIX_KEY, key)\n else\n Lib.memcached_callback_set(@struct, Lib::MEMCACHED_CALLBACK_PREFIX_KEY, \"\")\n end\n )\n end", "def is_valid_name(name)\n return false if name.split.length < 2\n name == format_name(name)\nend", "def name\n file.partition(base).last.gsub(/[_\\/]/, \" \").strip\n end", "def validate_name(value)\n return false if(value.to_s.length >= MAX_NAME_LENGTH)\n return true\n end", "def correctly_named?(file)\n chunks = file.basename.to_s.split('.')\n\n return true if name_checks_out?(chunks)\n\n raise Aur::Exception::LintBadName\n end", "def longest_prefix(name)\n @symbols.longest_prefix(to_name(name))\n end", "def short_name\n short = name[0..30]\n if name.length > 30\n short += '...'\n end\n short\n end", "def prefix\n ''\n end", "def prefix(path=nil)\n return ''\n end", "def valid_pcb_prefix?\n PartNumber.valid_prefix?(self.pcb_prefix)\n end", "def create_first_name(name)\n name.split[1]\n end", "def has_prefix?\n prefix.present?\n end", "def first_name\n name ? name.split(' ',2)[0] : ''\n end", "def first_name\n name ? name.split(' ',2)[0] : ''\n end", "def create_filename(prev_name)\n prev_name[/\\d+$/] ? prev_name.next : prev_name + '02'\n end", "def determine_name_parts(name)\n @first_name = name[0..name.index(\" \")].strip.downcase\n @last_name = name[name.index(\" \")..name.length].strip.downcase\n end", "def prefix\n nil\n end", "def sanitize_file_name_as_name\n sanitized_name_array = name.split('.')\n sanitized_name_array.pop if sanitized_name_array.length > 1\n self.name = sanitized_name_array.join('.').tr('-_', ' ').split.map(&:capitalize)*' '\n end", "def path_to_name(path, prefix='')\n #return nil if file.to_s.index(/[.]/) # TODO: rejection filter\n path = path.to_s\n path = path.sub(prefix.to_s.chomp('/') + '/', '')\n #path = path.gsub('/', '_')\n path\n end", "def error_for_new_doc_name(filename, extension)\n full_file_name = filename + \".\" + extension\n if !(1..20).cover?(filename.size)\n return \"File name must be between 1 and 20 characters\"\n elsif find_by_name(full_file_name)\n return \"File name must be unique\"\n elsif (filename =~ /(^[A-Za-z][A-Za-z0-9_]+)$/).nil?\n return \"Invalid file name. File must begin with an alpha character. The rest of the file name can only contain alphanumeric characters and underscores\"\n end\n nil\nend", "def get_valid_file_name(iFileName)\n if (defined?(prohibited_file_names_chars) != nil)\n return iFileName.gsub(/[#{Regexp.escape(prohibited_file_names_chars)}]/, '_')\n else\n return iFileName\n end\n end", "def initialize(full_name)\n parts = full_name.split\n @first_name = parts.first\n @last_name = parts.size > 1 ? parts.last : ''\n end", "def chunk(file_name, prefix, chunksize = 1_073_741_824)\n File.open(file_name\"r\") do |f|\n until f.eof?\n File.open(\"#{prefix}_#{\"%05d\"%(f.pos/chunksize)}.txt\",\"w\") do |fc|\n fc << f.read(chunksize)\n end\n end\n end\nend", "def normalize_path(name, prefix)\n prefix.present? ? \"#{prefix}/#{name}\" : name\n end", "def normalize_path(name, prefix)\n prefix.present? ? \"#{prefix}/#{name}\" : name\n end", "def test_name_length_threshold\n @test_name_length_threshold || DEFAULT_TEST_NAME_LENGTH_THRESHOLD\n end", "def name_truncated\n if self.lastname.present?\n return \"#{self.firstname} #{self.lastname[0]}\"\n else\n return self.firstname\n end\n end", "def name_with_middle; end", "def split_prefix\n [$1, $2, $3] if @prefix =~ PREFIX_PAT\n end", "def valid_pcba_prefix?\n PartNumber.valid_prefix?(self.pcba_prefix)\n end", "def remove_excess_whitespace_from_name\n self.name = name&.split&.join(' ')\n end", "def longest_prefix(str, pos= 0, len= -1, match_prefix= false)\n end", "def basename(delimiter = '/', start = nil)\n return nil if is_placeholder_directory? \n \n prefix = self.key\n unless start.nil?\n prefix = prefix.gsub(start,'')\n end\n \n arr = prefix.split(delimiter)\n if arr.length == 1\n arr[0]\n else\n nil\n end\n end", "def valid?\n prefix = File.expand_path(root_path)\n prefix == File.expand_path(@file)[0...prefix.size]\n end", "def get_correct_name(file_name, user_address)\n ext = File.extname(file_name) # get file extension\n base_name = File.basename(file_name, ext) # get file name without extension\n name = base_name + ext.downcase # get full file name\n index = 1\n\n while File.exist?(storage_path(name, user_address)) # if the file with such a name already exists in this directory\n name = base_name + ' (' + index.to_s + ')' + ext.downcase # add an index after its base name\n index = index + 1\n end\n\n name\n end", "def maybe_prefix(cluster_name, name)\n if cluster_name && cluster_name.length > 0\n \"#{cluster_name}-\" + name\n else\n name\n end\n end", "def test_String_006_remove_prefix\n \n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_String_006_remove_prefix\")\n puts2(\"#######################\")\n \n sMyFile = \"some_long_filename.log\"\n puts2(\"\\nReturn the file extension for: \" + sMyFile)\n sMyFilePrefix = sMyFile.remove_prefix(\".\")\n puts2(\"File name: \" + sMyFilePrefix)\n #\n sMyEmailAddress = \"[email protected]\"\n puts2(\"\\nReturn the Domain Name of the Email address: \" + sMyEmailAddress)\n sMyUserAccount = sMyEmailAddress.remove_prefix(\"@\")\n puts2(\"User account: \" + sMyUserAccount)\n \n sMyString = \"This is a test\"\n puts2(\"\\nReturn the string with the first word removed: \" + sMyString)\n sMyFirstWord = sMyString.remove_prefix(\" \")\n puts2(\"First word: \" + sMyFirstWord)\n \n sMyString = \" String with leading & trailing white space \"\n puts2(\"\\nReturn the first word of the String: \" + sMyString)\n sMyFirstWord = sMyString.remove_prefix(\" \")\n puts2(\"First word: \" + sMyFirstWord)\n \n sMyString = \" No delimiter specified \"\n puts2(\"\\nReturn the whole String if: \" + sMyString)\n sMyFirstWord = sMyString.remove_prefix(\"\")\n puts2(\"String: \" + sMyFirstWord)\n \n sMyString = \" Multiple delimiter-characters that are in the specified string \"\n puts2(\"\\nReturn the string with the first word removed: \" + sMyString)\n sMyFirstWord = sMyString.remove_prefix(\" #\")\n puts2(\"First word: \" + sMyFirstWord)\n \n sMyString = \" Delimiter character is NOT in the string \"\n puts2(\"\\nReturn the whole String if: \" + sMyString)\n sMyFirstWord = sMyString.remove_prefix(\".\")\n puts2(\"String: \" + sMyFirstWord)\n \n end", "def split_name_for_automatic_splitting\n temp = name\n if temp\n if temp.match /\\A[A-Z]{3}[a-z]/\n temp = temp[2..-1]\n end\n (temp && temp.split(/([A-Z]?[a-z]+)/).map(&:downcase) || []).reject do |part|\n part.size < 3\n end\n else\n []\n end\n end", "def create_last_name(name)\n name.split[0]\n end", "def test_name_min_length\n appellation = @valid_appellation_1\n min_len = Appellation::NAME_MIN_LENGTH\n \n #name too short\n appellation.name = \"a\" * (min_len-1)\n assert !appellation.valid?, \"#{appellation.name} should raise a minimum length error\"\n #format the error message\n correct_error_message = sprintf(@error_messages[:too_short], min_len)\n appellation.errors.on(:name).each do |errormsg|\n if errormsg != @cantbeblankmsg\n assert_equal correct_error_message, errormsg\n else\n assert_equal @cantbeblankmsg, errormsg\n end\n end\n \n #name is exactly minimum length\n appellation.name = \"a\" * min_len\n assert appellation.valid?, \"#{appellation.name} should be just long enough to pass\"\n end", "def prefix=(value)\n @prefix = value\n end", "def valid?\n return false if [email protected]? && @name.to_s.length > 250\n true\n end", "def first_name_last_initial\n if name.split.count > 1\n first_name + ' ' + last_name[0].upcase + '.'\n else\n first_name\n end\n end", "def clean_filename\n if filename.present?\n cleaned_filename = cleaned_basename = basename.gsub(/[^a-z0-9\\-_]/i, '-')\n cleaned_filename = \"#{cleaned_basename}.#{extension.downcase}\" if extension\n self.filename = cleaned_filename\n end\n end", "def normalize_name(name, prefixes) #:nodoc:\n\t prefixes = prefixes.presence\n\t parts = name.to_s.split('/')\n\t parts.shift if parts.first.empty?\n\t name = parts.pop\n\n\t # return here if name is just like \"show\"\n\t return name, prefixes || [\"\"] if parts.empty?\n\n\t # otherwise, change prefixes\n\t parts = parts.join('/')\n\t prefixes = prefixes ? prefixes.map { |p| \"#{p}/#{parts}\" } : [parts]\n\n\t # for input \"my/show\", [\"users\", \"application\"]\n\t # it would become\n\t # \"show\", [\"users/my\", \"application/my\"]\n\t return name, prefixes\n\t end", "def prefix=(prefix) @prefix = prefix end", "def name_is_valid?\n return false unless not_nil_and_string(self.name)\n return self.name.length > 0\n end", "def name_is_valid?\n return false unless not_nil_and_string(self.name)\n return self.name.length > 0\n end", "def full_name_24_length\n full = \"#{self.name} #{self.last_name}\"\n full[0,24]\n end", "def build_prefix\n @prefix = @str[@i_last_real_word...@i]\n end", "def first_name\n # self.name.split[0] atau\n \tself.name.split.first\n end", "def trimmed_names \n trimmed_names = []\n raw_names.each do |name|\n article_trim_strings.each do |trim| #Remove all trim words from name\n name = !name.index(trim).nil? ? name.sub(trim, \"\") : name\n end\n name = name.strip\n if(name.length > 5)\n\ttrimmed_names << name #Add trimmed name to the list\n end\n end\n trimmed_names\n end" ]
[ "0.62801874", "0.61738354", "0.6038905", "0.59972364", "0.59335655", "0.58515567", "0.5817975", "0.5807052", "0.57970977", "0.5760169", "0.5739213", "0.5707985", "0.57073635", "0.5681748", "0.56787884", "0.5671423", "0.55563974", "0.5538413", "0.55242306", "0.55077857", "0.5506303", "0.5480983", "0.54808867", "0.54625446", "0.5459966", "0.54397833", "0.54273975", "0.54124975", "0.53961813", "0.5389906", "0.5382237", "0.5379541", "0.5368648", "0.5363195", "0.5335487", "0.5325701", "0.5325701", "0.5317141", "0.53144336", "0.52984464", "0.52980113", "0.5292694", "0.5277304", "0.5275263", "0.5265685", "0.5256703", "0.52507955", "0.524755", "0.5245686", "0.52414304", "0.52402425", "0.5236544", "0.52136314", "0.5199179", "0.5192492", "0.51878595", "0.51781", "0.51766616", "0.5170488", "0.51696134", "0.5168867", "0.5168867", "0.5153405", "0.5152902", "0.51525086", "0.5146933", "0.514496", "0.51437366", "0.5143539", "0.5136131", "0.5135576", "0.5134049", "0.5133405", "0.5132925", "0.5131179", "0.51221234", "0.5104505", "0.51001316", "0.50978327", "0.509754", "0.50880826", "0.50874525", "0.50844806", "0.5083498", "0.50782365", "0.50779885", "0.5077843", "0.50671005", "0.50624245", "0.506225", "0.50605446", "0.5060503", "0.5060209", "0.5056428", "0.5034764", "0.5034764", "0.50323516", "0.5026688", "0.5013788", "0.500473" ]
0.6401034
0
It gets the scripts used by the module
def page_script(context={}) ['/slider/js/jquery.nivo.slider.pack.js'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scripts\n SCRIPTS\n end", "def scripts\n @scripts\n end", "def scripts\n Dir.glob(File.join(script_dir, \"*.rb\")).inject([]) do |a, e|\n Kernel.load(e)\n a + [initialize_script(e)]\n end\n end", "def scripts\n @parts.values.map(&:script).compact\n end", "def loadScripts\n load \"su2dslib/preferences.rb\"\n load \"su2dslib/exportbase.rb\"\n load \"su2dslib/interface.rb\"\n load \"su2dslib/numeric.rb\"\n load \"su2dslib/material.rb\"\n load \"su2dslib/radiance_entities.rb\"\n load \"su2dslib/radiancescene.rb\"\n load \"su2dslib/location.rb\"\n load \"su2dslib/resultsgrid.rb\"\nend", "def scripts\n @scripts ||= @options[:scripts].try(:to_sym)\n end", "def imported_scripts\r\n @imported_scripts ||= []\r\n end", "def script\n @script ||= (Dir.glob(root+'/**/parts.js').first || Dir.glob(root+'/**/parts.js.coffee').first)\n end", "def scripts\n #Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if offline\n script(:src => '//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js')\n script do\n rawtext(%{window.jQuery || document.write('<script src=\"#{js_urls(:lib).first}\"><\\\\/script>')})\n end\n #TODO should just be \"defer\" without attribute, but erector doesn't really do that\n js_urls(:app).each do |url|\n script(:defer => 'defer', :src => url) \n end\n \n #removed google analytics tag\n \n #Prompt IE 6 users to install Chrome Frame. Remove this if you want to support IE 6. \n # chromium.org/developers/how-tos/chrome-frame-getting-started\n comment('[if IE 7 ]') do\n script(:src => '//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.3/CFInstall.min.js')\n script do\n rawtext(%{window.attachEvent('onload',function(){CFInstall.check({mode:'overlay'})})})\n end\n end\n \n yield if block_given?\n end", "def scripts\n @content_for_scripts.to_s\n end", "def scripts\n script_tag(fancyviews.included_scripts.map do |name, js|\n \"\\n/* -- #{name} -- */\\n\" + js\n end.join)\n end", "def load_scripts\n $log.info(\"ScriptManager.initilize\") { \"Loading scripts.\" }\n\n noload = Bot::Conf[:core][:noload]\n\n Dir.glob(\"scripts/*.rb\").each do |file|\n\n unless noload == nil\n # I realize we are pulling the name out twice. Deal with it.\n next if noload.keys.include? file.match(\"scripts/(.+).rb\")[1].to_sym\n end\n\n $log.debug(\"ScriptManager.initilize\") { \"Loading #{file}\" }\n load_file file\n\n end\n end", "def load_scripts\n $log.info('ScriptManager.initilize') { 'Loading scripts.' }\n\n noload = Bot::Conf[:core][:noload]\n\n Dir.glob(\"#{SCRIPTS_PATH}/*.rb\").each do |file|\n\n unless noload == nil\n # I realize we are pulling the name out twice. Deal with it.\n next if noload.keys.include? file.match(\"#{SCRIPTS_PATH}/(.+).rb\")[1].to_sym\n end\n\n $log.debug(\"ScriptManager.initilize\") { \"Loading #{file}\" }\n load_file file\n\n end\n end", "def page_script(context={}, page)\n \n scripts = []\n\n # Front-end custom resources\n unless page.admin_page\n if template=ContentManagerSystem::Template.find_by_name('javascript_resources') && \n !template.text.empty?\n scripts.concat(template.text.split(','))\n end \n if template=ContentManagerSystem::Template.find_by_name('javascript_app') && \n !template.text.empty?\n scripts << '/js/app.js'\n end\n end\n \n return scripts\n\n end", "def load_scripts!\n scripts_dir = File.expand_path @config['blur']['scripts_dir']\n script_file_paths = Dir.glob File.join scripts_dir, '*.rb'\n\n # Sort the script file paths by file name so they load by alphabetical\n # order.\n #\n # This will make it possible to create a script called '10_database.rb'\n # which will be loaded before '20_settings.rb' and non-numeric prefixes\n # will be loaded after that.\n script_file_paths = script_file_paths.sort do |a, b|\n File.basename(a) <=> File.basename(b)\n end\n\n script_file_paths.each { |script_path| load_script_file script_path }\n\n initialize_superscripts\n\n emit :scripts_loaded\n end", "def script_contents\n @script_contents ||= File.read(File.join(SCRIPT_ROOT, \"#{@name}.lua\"))\n end", "def script_list\n Dir['script/*'].map{|f| File.basename(f, '.*')}\nend", "def urls\n URI.extract(self.script)\n end", "def list_all_scripts\n scripts = []\n\n Hook.hooks(event_instance.class).each_value do |klass|\n scripts.concat(list_scripts(klass))\n end\n\n scripts\n end", "def lookup_scripts\n scripts = [\n [ 'backup', 'EBS PostgreSQL backup' ],\n [ 'create_stripe' , 'Create PostgreSQL EBS stripe volume' ],\n [ 'dump_import', 'PostgreSQL dump import'],\n [ 'dump_export', 'PostgreSQL dump export'],\n [ 'freeze_backups', 'DB PostgreSQL Freeze' ],\n [ 'monitor_add', 'PostgreSQL Add DB monitoring' ],\n [ 'promote', 'DB EBS PostgreSQL promote to master' ],\n [ 'restore', 'PostgreSQL restore and become' ],\n [ 'slave_init', 'DB EBS PostgreSQL slave init -' ],\n [ 'grow_volume', 'DB EBS PostgreSQL slave init and grow stripe volume' ],\n [ 'terminate', 'PostgreSQL TERMINATE SERVER' ],\n [ 'unfreeze_backups', 'DB PostgreSQL Unfreeze' ]\n ]\n \n st = ServerTemplate.find(resource_id(s_one.server_template_href))\n load_script_table(st,scripts)\n # hardwired script! (this is an 'anyscript' that users typically use to setup the master dns)\n # This a special version of the register that uses MASTER_DB_DNSID instead of a test DNSID\n # This is identical to \"DB register master\" However it is not part of the template.\n load_script('master_init', RightScript.new('href' => \"/api/acct/2901/right_scripts/195053\"))\n raise \"Did not find script\" unless script_to_run?('master_init')\n end", "def get_gem_scripts\n unless gmaps4rails_pipeline_enabled?\n @js_array << '/javascripts/gmaps4rails/gmaps4rails.base.js' unless scripts == :api\n @js_array << case map_provider\n when \"yandex\" then '/javascripts/gmaps4rails/gmaps4rails.yandex.js'\n when \"openlayers\" then '/javascripts/gmaps4rails/gmaps4rails.openlayers.js'\n when \"mapquest\" then '/javascripts/gmaps4rails/gmaps4rails.mapquest.js'\n when \"bing\" then '/javascripts/gmaps4rails/gmaps4rails.bing.js'\n else '/javascripts/gmaps4rails/gmaps4rails.googlemaps.js'\n end\n end\n end", "def script; end", "def script; end", "def included_modules() end", "def modules; end", "def modules; end", "def modules; end", "def lookup_scripts\n scripts = [\n [ 'firewall_enable', 'rs_utils::setup_firewall' ],\n [ 'firewall_rule' , 'rs_utils::setup_firewall_rule' ]\n# [ 'firewall_close' , '::do_firewall_close' ],\n# [ 'firewall_open' , '::do_firewall_open' ],\n# [ 'firewall_request_close' , '::do_firewall_request_close' ],\n# [ 'firewall_request_open' , '::do_firewall_request_open' ]\n ]\n \n st = ServerTemplate.find(resource_id(s_one.server_template_href))\n load_script_table(st,scripts)\n end", "def script_path\n @script_paths ||= Pathname.new(source_dir).join(data['script_path'] || './scripts').to_s\n end", "def script_load(script); end", "def page_script(context={})\n \n [\"/htmleditor/js/jquery.wysiwyg.js\",\n \"/htmleditor/js/ysd.editor.js\",\n \"/htmleditor/js/controls/wysiwyg.colorpicker.js\",\n \"/htmleditor/js/controls/wysiwyg.cssWrap.js\",\n \"/htmleditor/js/controls/wysiwyg.image.js\",\n \"/htmleditor/js/controls/wysiwyg.link.js\",\n \"/htmleditor/js/controls/wysiwyg.table.js\",\n ] \n \n end", "def script(name)\n @loaded_recipes ||= []\n require name\n @loaded_recipes << name\n end", "def get_vendor_scripts\n case map_provider\n when \"yandex\" then @js_array << YANDEX\n when \"openlayers\" then @js_array << OPENLAYERS\n when \"mapquest\" then @js_array << \"#{MAPQUEST}?key=#{provider_key}\"\n when \"bing\" then @js_array << BING\n else #case googlemaps which is the default\n @js_array << \"#{GOOGLE}&sensor=false&client=#{client}&key=#{provider_key}&libraries=geometry#{google_libraries}&#{google_map_i18n}\"\n @js_array << \"#{GOOGLE_EXT}tags/infobox/1.1.9/src/infobox_packed.js\" if custom_infowindow_class\n @js_array << \"#{GOOGLE_EXT}tags/markerclustererplus/2.0.14/src/markerclusterer_packed.js\" if do_clustering\n @js_array << \"#{GOOGLE_EXT}trunk/richmarker/src/richmarker-compiled.js\" if rich_marker\n end\n end", "def find_scripts(dir)\n scripts = []\n\n dir = File.expand_path(dir)\n Dir.glob(File.join(dir, \"**/*.rb\")).reject{|f| f[\"/spec/\"] || f[\"/specs/\"] || f[\"/test/\"] || f[\"/tests/\"]}.map do |script_file|\n scripts << script_file\n end\n\n scripts\n end", "def script\n @source\n end", "def base_script\n base_language.standard_script\n end", "def script(name)\n @loaded_recipes ||= []\n self.load name\n @loaded_recipes << script\n end", "def included_modules; end", "def pinned_scripts; end", "def build_all_external_scripts\n html = \"\"\n result = Mokio::ExternalScript.all\n unless result.blank?\n result.each do |position|\n html = build_common(position)\n end\n end\n html.html_safe\n end", "def script_settings_files_def\nend", "def script\n\t\tputs \"You should extend script()\"\n\tend", "def script_aliases\n end", "def actual_injection\n files_to_page\n set_vars(@default_vars + @custom_vars)\n all_scripts(@default_scripts + @custom_scripts)\n end", "def whereami() [__FILE__] end", "def js_dependencies_array\n if scripts != :none\n get_vendor_scripts\n get_gem_scripts\n end\n @js_array\n end", "def included_modules\n end", "def elb_lookup_scripts\n scripts = [\n [ 'connect', 'ELB connect' ],\n [ 'disconnect', 'ELB disconnect' ]\n ]\n st = ServerTemplate.find(resource_id(@servers.first.server_template_href))\n load_script_table(st,scripts)\n end", "def find_admin_js\n layout = \"#{TRUSTY_CMS_ROOT}/app/views/layouts/application.html.haml\"\n js_regexp = /javascript_include_tag %w\\((.*)\\), :cache => 'admin\\/all/\n files = File.open(layout) { |f| f.read.match(js_regexp)[1].split }\n files.collect { |f| f.split('/').last + '.js' }\n end", "def initialize(scripts)\n @scripts = []\n initialize_scripts(scripts)\n @run_before = @scripts.select{ |script| script.run == :before }\n @run_after = @scripts.select{ |script| script.run == :after }\n end", "def load_script(file); end", "def list_script\n ret = @uri.listscript\n render plain: ret[:message]\n end", "def plugin_script\n @plugin_script ||= File.join(RAILS_ROOT, 'script', 'plugin')\n end", "def mysql_lookup_scripts\n scripts = [\n [ 'setup_block_device', 'db_mysql::setup_block_device' ],\n [ 'do_backup', 'db_mysql::do_backup' ],\n [ 'do_restore', 'db_mysql::do_restore' ],\n [ 'do_backup_s3', 'db_mysql::do_backup_s3' ],\n [ 'do_backup_ebs', 'db_mysql::do_backup_ebs' ],\n [ 'do_backup_cloud_files', 'db_mysql::do_backup_cloud_files' ],\n [ 'do_restore_s3', 'db_mysql::do_restore_s3' ],\n [ 'do_restore_ebs', 'db_mysql::do_restore_ebs' ],\n [ 'do_restore_cloud_files', 'db_mysql::do_restore_cloud_files' ],\n [ 'do_restore_cloud_files', 'db_mysql::do_restore_cloud_files' ],\n [ 'do_force_reset', 'db_mysql::do_force_reset' ]\n ]\n raise \"FATAL: Need 1 MySQL servers in the deployment\" unless @servers.size == 1\n \n st = ServerTemplate.find(resource_id(s_one.server_template_href))\n load_script_table(st,scripts)\n end", "def load_rmxp_scripts\n ban1 = 'config'\n ban2 = 'boot'\n ban3 = '_'\n load_data('Data/Scripts.rxdata').each do |script|\n # @type [String]\n name = script[1].force_encoding(Encoding::UTF_8)\n next if name.downcase.start_with?(ban1, ban2, ban3)\n eval(Zlib::Inflate.inflate(script[2]).force_encoding(Encoding::UTF_8), $global_binding, name)\n GC.start\n end\n end", "def post_scripts\n @post_scripts ||= user_data_as_array('post_script')\n @post_scripts\n end", "def hook_script_name; end", "def script\n @script || JavascriptObject.global_script\n end", "def scripts_dir\n File.join(root_path, 'scripts')\n end", "def get_dependency_script(controller, location)\n\t\tscript = \"$(function(){\n\t\t\tAppController.config.#{controller}.#{location}();\n\t\t});\"\n\tend", "def include_default_scripts\n includes = []\n\n includes << javascript_include_tag(:application) if assets_exists? \"application.js\"\n\n default_asset_paths.each do |path|\n if assets_exists? \"#{path}.js\"\n includes << javascript_include_tag(path)\n end\n end\n \n includes << content_for(:scripts)\n includes.join(\"\\n\").html_safe\n end", "def components_js\n Dir[src_path.join('components', '**', '*.js').to_s]\n end", "def extended_modules; end", "def mergeScripts\n result = Builtins.maplist(@pre) do |p|\n p = Builtins.add(p, \"type\", \"pre-scripts\")\n deep_copy(p)\n end\n result = Convert.convert(\n Builtins.union(result, Builtins.maplist(@post) do |p|\n p = Builtins.add(p, \"type\", \"post-scripts\")\n deep_copy(p)\n end),\n :from => \"list\",\n :to => \"list <map>\"\n )\n result = Convert.convert(\n Builtins.union(result, Builtins.maplist(@chroot) do |p|\n p = Builtins.add(p, \"type\", \"chroot-scripts\")\n deep_copy(p)\n end),\n :from => \"list\",\n :to => \"list <map>\"\n )\n result = Convert.convert(\n Builtins.union(result, Builtins.maplist(@init) do |p|\n p = Builtins.add(p, \"type\", \"init-scripts\")\n deep_copy(p)\n end),\n :from => \"list\",\n :to => \"list <map>\"\n )\n result = Convert.convert(\n Builtins.union(result, Builtins.maplist(@postpart) do |p|\n p = Builtins.add(p, \"type\", \"postpartitioning-scripts\")\n deep_copy(p)\n end),\n :from => \"list\",\n :to => \"list <map>\"\n )\n deep_copy(result)\n end", "def module_items()\n main = main_item\n @items.select do |i|\n i.identifier =~ js_re and\n i.identifier !~ test_re and\n i.identifier != '/js/all/' and\n i.identifier != '/js/main/'\n end\n end", "def load_all\n scripts.each do |name, script|\n redis.script 'load', script.content\n end\n end", "def js_files\n [\n vue_lib_js, mixins_js, filters_js, components_js,\n pages_js, config_js\n ].flatten!\n end", "def scripts binding=nil\n # some scripts may work with the selected_files and not want to be called\n # with filenames.\n write_selected_files\n\n unless binding\n title = 'Select a script'\n # script_path = '~/.config/cetus/scripts'\n script_path = File.join(CONFIG_PATH, 'cetus', 'scripts')\n binding = `find #{script_path} -type f | fzf --prompt=\"#{title} :\"`.chomp\n return if binding.nil? || binding == ''\n end\n unless File.exist? binding\n @log.warn \"Unable to find #{binding}\"\n return\n end\n\n # TODO: check if binding is a file and executable\n # xargs only seems to take the first file\n # cf = current_or_selected_files.join('\\0')\n # cf = Shellwords.join(current_or_selected_files)\n # This was getting called repeatedly even if script used selected_files\n # current_or_selected_files.each do |file|\n # system %( #{binding} \"#{file}\" )\n # end\n\n # 2019-04-08 - to avoid confusion, we pass name of file under cursor\n # script may ignore this and use selected_files\n\n # reset clears the screen, we don't want that. just unhide cursor and echo keys TODO\n partial_reset_terminal\n @log.info \"Calling #{binding}.\"\n system %( #{binding} \"#{current_file}\" )\n\n # system %(echo \"#{cf}\" | xargs #{binding})\n pause\n setup_terminal\n visual_block_clear\n refresh\nend", "def add_scripts(scripts, chart_scripts)\n s = ''\n scripts.map do |script|\n s += %(\n <script src=\"assets/#{script}\"></script>)\n end\n chart_scripts.map do |script|\n s += %(\n <script src=\"#{script}\"></script>)\n end\n s\nend", "def run_init_script; end", "def script\n @elements.map { |e|\n (e && !e.hidden? && !e.readonly? && e.respond_to?(:script))? e.script : ''\n }.join(\"\")\n end", "def load_scripts(scripts_file)\n scripts_text=\"\"\n \n if File.exist?(scripts_file)\n scripts_text = open(scripts_file).read\n else\n STDERR.puts(\"Can not open #{scripts_file}\")\n STDERR.flush\n return\n end\n \n one_location=ENV['ONE_LOCATION']\n\n if one_location == nil \n tm_commands_location = \"/usr/lib/one/tm_commands/\"\n else\n tm_commands_location = one_location + \"/lib/tm_commands/\"\n end\n \n scripts_text.each_line {|line|\n case line\n when /^\\s*(#.*)?$/\n # skip empty or commented lines\n next\n when /^\\s*(\\w+)\\s*=\\s*(.*)\\s*$/\n command = $1.strip.upcase\n path = $2.strip\n\n # Prepend default location for tm commands if the path does not\n # start with /\n path = tm_commands_location+path if path[0]!=?/\n \n self[command] = path\n else\n STDERR.puts(\"Can not parse line: #{line}\")\n end\n }\n end", "def initialize\n @scripts, @script_info = {}, []\n\n unless Dir.exists? \"scripts\"\n raise \"Scripts directory does not exist.\"\n end\n end", "def tools\n @tools ||= TOOLS\n end", "def script\n @script ||= Script.new(self)\n end", "def script\n attributes[:customization_script]\n end", "def javascripts_from_plugins\n Dir.glob(\"vendor/plugins/*/assets/javascripts/*.js\").select{|s| !s.include? \"vendor/plugins/alchemy\"}.inject(\"\") do |acc, s|\n filename = File.basename(s)\n plugin = s.split(\"/\")[2]\n acc << javascript_include_tag(filename, :plugin => plugin)\n end\n end", "def enumerate_scripts\n Dir.glob(\"**/*\").\n reject { |f| File.directory?(f) }.\n select { |f| File.extname(f) == \".rb\" }.\n map do |filename|\n stat = File.stat(filename)\n\n OpenStruct.new(\n id: SecureRandom.uuid,\n path: filename,\n absolute_path: File.expand_path(filename),\n virtual_url: \"#{ROOT_URL}/#{filename}\",\n size: stat.size,\n last_modified_time: stat.mtime\n )\n end\n end", "def runInitScript \n \"runInitScript\" \n end", "def target_script\n target_language.standard_script\n end", "def load_bot_code\n load_special_tasks\n files = Dir[\"#{File.expand_path('./lib', @options[:current_dir])}/**/*\"]\n files.each do |file|\n require_relative file.sub(/\\.rb$/, '') if file.end_with? '.rb'\n end\n end", "def all_plugins; end", "def view_source\n File.read(@script)\n end", "def plugins; end", "def plugins; end", "def plugins; end", "def plugins; end", "def display_scripts scripts, start, samples = false\n if scripts.empty?\n para \"You have no programs.\"\n else\n scripts[start,5].each do |script|\n stack :margin_left => 8, :margin_top => 4 do\n flow do\n britelink \"icon-file.png\", script[:name], script[:mtime] do\n load_file script\n end\n unless script[:sample]\n # if it is not a sample file\n para link(ins(\"x\")){\n if confirm(\"Do you really want to delete \\\"#{script[:name]}\\\"?\")\n delete script\n end\n }, width: 20, margin: [20, 5, 0, 0]\n end\n end\n if script[:desc]\n para script[:desc], :stroke => \"#777\", :size => 9,\n :font => \"Lacuna Regular\", :margin => 0, :margin_left => 18,\n :margin_right => 140\n end\n end\n end\n m = samples ? :sample_scripts : :home_scripts\n home_arrows m, start, scripts.length\n end\n end", "def get_all_data\n Hash[*File.read(\"#{@path}scripts/data\").split(/[, \\n]+/)]\n end", "def parse_scripts(string_snippet = nil)\n insert_includes\n insert_globals\n insert_variables\n handle_loops\n insert_urls\n execute_functions\n end", "def plugins ; @plugins ; end", "def load_plugins; end", "def autoloaders; end", "def all_scripts(scripts_array)\n scripts_array.each do |script|\n run_script script\n end\n end", "def load_assets\n\n # class method call to include js files\n Asset.include_local_library [:application, :pageFormAdmin, \"ckeditor/init\"]\n\n # class method call to include css files\n Asset.include_css [\"mcms_pages/pages\", \"mcms_pages/page_form\", \"mcms_pages/tabs\"]\n\n end", "def modules_for_helpers(args); end", "def list\n @manage_sieve.print_scripts\n end", "def script(script_file)\n load script_file\n\n self\n end", "def read_javascripts\n js = @javascript_list.map do |filename|\n case filename\n when :jquery\n File.read(File.join(Slidize::javascript_directory, \"jquery-1.5.min.js\"))\n else\n File.read(File.join(@theme_path, filename))\n end\n end\n js.join(\"\\n\")\n end", "def generate_script\n init = Nyaplot.generate_init_code\n path = File.expand_path(\"../templates/static_script.erb\", __FILE__)\n template = File.read(path)\n ERB.new(template).result(binding)\n end", "def referenced_modules\n # TODO: check content type before scanning\n content.scan(/\\s*(include|extend)\\s+([A-Za-z0-9_\\.]*)/).map { |_, m| m }.uniq\n end" ]
[ "0.81957114", "0.7738012", "0.7325212", "0.7304881", "0.72063977", "0.7092024", "0.6963241", "0.68474567", "0.67867285", "0.67793906", "0.6725386", "0.66881883", "0.6634246", "0.66061234", "0.6577076", "0.6534488", "0.64334214", "0.63696814", "0.6358962", "0.63219583", "0.6295526", "0.62498236", "0.62498236", "0.61946774", "0.61810386", "0.61810386", "0.61810386", "0.6171737", "0.6147261", "0.6125758", "0.61200696", "0.61092734", "0.61079353", "0.6101172", "0.60919964", "0.6053983", "0.6046269", "0.6038991", "0.60260063", "0.60199016", "0.59367275", "0.59203565", "0.5902748", "0.58798087", "0.58415943", "0.58415383", "0.58297336", "0.58086514", "0.5803412", "0.5801367", "0.57932246", "0.5792926", "0.5786721", "0.57862765", "0.5783782", "0.5782862", "0.57767814", "0.57538843", "0.57484883", "0.57173944", "0.5711239", "0.57066905", "0.5705999", "0.5705999", "0.56932074", "0.5692427", "0.56868887", "0.56845933", "0.5675391", "0.5670947", "0.5669319", "0.5663696", "0.5652948", "0.5644509", "0.56433856", "0.562268", "0.56173766", "0.560463", "0.56019795", "0.5601049", "0.5591319", "0.55745196", "0.5573212", "0.5572511", "0.5572511", "0.5572511", "0.5572511", "0.55618095", "0.5560557", "0.5556909", "0.5555121", "0.55542344", "0.5551707", "0.55504656", "0.55460006", "0.5535816", "0.55349004", "0.5532857", "0.5532282", "0.55298734", "0.5524409" ]
0.0
-1
I worked on this challenge [Jon Chen with Jack Huang ]. Your Solution Below
def leap_year?(year) return (year % 4 == 0 && year % 100 !=0) || year % 400 == 0 ? true : false #if (year % 4 == 0 && year % 100 !=0) || year % 400 == 0 # true #else # false #end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution4(input)\n end", "def solution(s, p, q)\r\n # write your code in Ruby 2.2\r\n # A -1\r\n # C -2\r\n # G -3\r\n # T -4\r\n # s - string with n charactekrs\r\n #cagccta\r\n #0123345\r\n #p,q - not empty arrays\r\n #\r\n #p[0]=2 q[0]=4 gcc 322 => 2\r\n #p[1]=5 q[1]=5 t 4 => 4\r\n \r\n \r\n arr = Array.new(q.count)\r\n \r\n \r\n\r\n \r\n arr.each_with_index{|el, i|\r\n \r\n ss = s[p[i]..q[i]]\r\n \r\n if ss.index('A') \r\n n = 1\r\n elsif ss.index('C')\r\n n=2\r\n elsif ss.index('G')\r\n n=3\r\n else \r\n n=4\r\n end\r\n \r\n arr[i] = n\r\n \r\n }\r\n \r\n \r\n \r\n arr\r\n \r\nend", "def solution(s, p, q)\n # write your code in Ruby 2.2\n g = s.length + 1\n a = (s.length + 1)**3\n c = (s.length + 1)**2\n tmp = []\n res = []\n tmp.push 0\n o = 0\n s.split('').each do |i|\n o += if i == 'T'\n 1\n elsif i == 'G'\n g\n elsif i == 'C'\n c\n else\n a\nend\n tmp.push o\n end\n (0...p.length).each do |k|\n o = tmp[q[k] + 1] - tmp[p[k]]\n if o >= a\n res.push 1\n elsif o >= c\n res.push 2\n elsif o >= g\n res.push 3\n else\n res.push 4\n end\n end\n res\nend", "def challenge; end", "def isLucky(n)\r\nhalf1 = []\r\nhalf2 = []\r\nn_string = n.to_s\r\n\r\n\r\nfirsthalf = (n_string.length / 2) - 1\r\nsecondhalfstart = (n_string.length / 2)\r\nsecondhalfend = (n_string.length - 1)\r\n(0..firsthalf).each do |idx|\r\n half1 << n_string[idx].to_i\r\nend\r\n\r\n(secondhalfstart..secondhalfend).each do |idx|\r\n half2 << n_string[idx].to_i\r\nend\r\n\r\nreturn true if half1.inject(:+) == half2.inject(:+)\r\nreturn false\r\nend", "def solution(n)\n # write your code in Ruby 2.2\n a = n.to_s(2)\n arr = []\n if a[-1] == '1'\n arr = a.split('1')\n else\n arr = a.split('1')\n arr.pop\n end\n if arr.max.nil?\n 0\n else\n arr.max.length\n end\nend", "def input_string\n result = \"73167176531330624919225119674426574742355349194934\"\n result += \"96983520312774506326239578318016984801869478851843\"\n result += \"85861560789112949495459501737958331952853208805511\"\n result += \"12540698747158523863050715693290963295227443043557\"\n result += \"66896648950445244523161731856403098711121722383113\"\n result += \"62229893423380308135336276614282806444486645238749\"\n result += \"30358907296290491560440772390713810515859307960866\"\n result += \"70172427121883998797908792274921901699720888093776\"\n result += \"65727333001053367881220235421809751254540594752243\"\n result += \"52584907711670556013604839586446706324415722155397\"\n result += \"53697817977846174064955149290862569321978468622482\"\n result += \"83972241375657056057490261407972968652414535100474\"\n result += \"82166370484403199890008895243450658541227588666881\"\n result += \"16427171479924442928230863465674813919123162824586\"\n result += \"17866458359124566529476545682848912883142607690042\"\n result += \"24219022671055626321111109370544217506941658960408\"\n result += \"07198403850962455444362981230987879927244284909188\"\n result += \"84580156166097919133875499200524063689912560717606\"\n result += \"05886116467109405077541002256983155200055935729725\"\n result += \"71636269561882670428252483600823257530420752963450\"\n\n result\nend", "def solution(a)\n number = a.to_s.chars\n first_arrays = []\n (number.length/2).times do\n first_arrays << number.shift\n first_arrays << number.rotate(number.length-1).shift\n number.pop\n end\n ( first_arrays + number ).join(\"\").to_i\nend", "def is_happy(n)\n i = 0\n r = false\n destination = []\n while r == false\n n.to_s.split(\"\").each do |x|\n destination << ((x.to_i * x.to_i))\n end\n i = i + 1\n n = destination.inject(&:+)\n r = true if n == 1\n destination = []\n break if i == 1000\n end\n if r == true\n p r\n else\n p false\n end\nend", "def problem_57\n ret,n,d = 0,1,1\n 1000.times do |i|\n n,d = (n+2*d),(n+d)\n ret += 1 if n.to_s.length > d.to_s.length\n end\n ret\nend", "def solution(number)\nn = 0..number\na = []\nfor i in n\n if i % 3 == 0 || i % 5 == 0\n a = a.push(i)\n end\n end\ns = 0\n# a.pop\na.each {|x| s += x}\ns\nend", "def solve(s)\n answer = \"\"\n (0...s.length - 1).each do |idx|\n if s[idx] != s[idx + 1]\n answer += s[idx]\n end\n if idx == s.length - 2 && s[idx] == s[idx + 1]\n answer += s[idx]\n end\n end\n return answer\nend", "def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\n end\t\r\n return 1 if a.inject(:+) ==n*(n+1)/2;\r\nend", "def isLucky(n)\n sum, sum2 = 0, 0\n arr = n.to_s.split(\"\")\n \n first_half = arr.take(arr.size / 2) \n second_half = arr.drop((arr.size / 2))\n first_half.each { |x| sum += x.to_i }\n second_half.each {|x| sum2 += x.to_i}\n \n sum == sum2\nend", "def solution(a)\r\n # write your code in Ruby 2.2\r\n #trangular\r\n # a[0] = 10\r\n # a[2] = 5\r\n # a[4] = 8\r\n # 10 + 5 > 8\r\n # 5 + 8 > 10\r\n #8 + 10 > 5\r\n \r\n \r\n l=a.count\r\n \r\n i=0\r\n while(i<l) do\r\n j=i+1\r\n while(j<l) do\r\n k=j+1\r\n \r\n \r\n while(k<l) do\r\n if((a[i] + a[j] > a[k]) && (a[j] +a[k] > a[i]) && (a[k] + a[i] >a[j]))\r\n return 1\r\n end\r\n k+=1 \r\n end \r\n \r\n j+=1 \r\n end\r\n i+=1\r\n end\r\n \r\n return 0\r\n \r\nend", "def decodeHalfway(input)\n sum = 0\n\n # Only have to loop through half the array since the numbers are being compared halfway around\n # Multiply each matching character by 2 to compensate for not looping through its pair\n input.chars[0..input.length/2 - 1].each_with_index do |char, i|\n sum += 2*char.to_i if char == input[i + input.length/2]\n end\n sum\nend", "def solution(a, b)\n if a.length > b.length\n return (b + a + b).to_s\n else\n return (a + b + a).to_s\n end\nend", "def isLucky(n)\n new_array = n.to_s.split(\"\")\n new_length = new_array.length\n\n a, b = [], []\n\n (0...new_length / 2).each { |x| a.push(new_array[x].to_i) }\n (new_length / 2...new_length).each { |y| b.push(new_array[y].to_i) }\n\n if a.inject(:+) == b.inject(:+)\n return true\n else\n false\n end\n\nend", "def solution(s)\n if s.length.odd?\n center = s.length / 2\n if s[0...center] == s[center + 1..s.length].reverse\n return center \n end\n end\n -1\nend", "def detective(incoming)\n#Declare an empty string to find ordinal number of the given string and return it at the end\n\tincoming_ord = 0\n# If the incoming is not empty run the following code:\n\tif incoming.length!=0\n# using .ord find ordinal number of given string\n\t\t for i in 0...incoming.length \n\t\t incoming_ord+= incoming[i].ord \n\t\t end\n\tputs incoming.swapcase\n\tputs incoming.prepend(\"Hi \")\n\tputs incoming.chop!\n\tputs incoming.delete(\"aeiou\")\n\tputs incoming.count(\"a\")\n\tp incoming.squeeze\n\tputs incoming.upcase\n\tp incoming.center(40,\" \" )\n puts incoming.replace(\"Johny\")\n\n #if the incoming is empty print the following code\n else \n\tputs\"It's an empty string\"\n end \n\treturn puts\" The ordinal number for the original string is #{incoming_ord}\"\nend", "def solution(a)\n return 1 if a.empty?\n a.sort!\n return 1 if a.first > 1\n return a.first + 1 if a.length <2\n (0..(a.length)).each do |index|\n return a[index] + 1 if a[index] + 1 != a[index + 1]\n end\n return a.last + 1\nend", "def solution(n)\n n.to_s(2).reverse.to_i.to_s.split('1').map(&:length).max || 0\nend", "def isLucky(n)\n a = n.to_s.split(\"\")\n full = a.count - 1\n half = a.count/2 - 1\n \n total_1 = 0\n total_2 = 0\n \n for i in 0..full\n if i > half\n total_2 += a[i].to_i\n else\n total_1 += a[i].to_i\n end\n end\n \n if total_1 == total_2\n true\n else\n false\n end\nend", "def answer\n composition = 1\n array = ['2,3,4,5']\n puts array\n array.split(',')\n #@inputArray = array\n #array.map!{|x| x.to_i}\n puts array\n #lastEvenIndex = last_even(array)\n #array.each_index {|x| composition*=array[x] if (array[x]%7).zero?}\n #array[lastEvenIndex] = composition\n #@modifiedArray = array\nend", "def solution(a)\n # write your code in Ruby 2.2\n n = a.length\n \n counter = Array.new(n+1, 0)\n \n a.each do |x|\n counter[x-1] += 1\n end\n \n return counter.index { |x| x == 0 } + 1\nend", "def solution(n)\n n.to_s.split(//).inject(1) { |a,d| a + d.to_i }\nend", "def theLoveLetterMystery(s)\n chars = s.chars\n size = chars.length\n sum = 0\n ((size+1)/2..(size -1)).each do |i|\n num = chars[i].ord\n target_num = chars[size-1-i].ord\n sum += (num - target_num).abs\n end\n sum\nend", "def icecreamParlor(m, arr)\n # Complete this function\n res = []\n arr.each_index do |i|\n if i + 1 !=nil\n j = i + 1\n while j <= arr.length - 1\n if arr[i]+arr[j] == m\n res.push([i+1,j+1])\n end\n j+=1\n end\n end\n end\n res\nend", "def solution(a)\n # write your code in Ruby 2.2\n\n # sort a\n a = a.sort\n odd = 0\n\n # loop over the array\n (0..(a.length-1)).step(2) do |i|\n if((i+1 >= a.length) || ((i+1 < a.length) && (a[i] != a[i+1])))\n odd = a[i]\n break\n end\n end\n\n odd\nend", "def solution(a)\n ans = 0\n for i in 1 .. (a.length - 1)\n ans += a[i]\n end \n ans\nend", "def strong_num(n)\n array = n.to_s.chars.map(&:to_i)\n sumarray = []\n array.each do |number|\n sum = (1..number).inject(:*) || 1\n sumarray << sum\n end\n sumarray.sum == n ? \"STRONG!!!!\" : \"Not Strong !!\"\nend", "def hackerrankInString(str)\n expected_chars = %w[h a c k e r r a n k]\n input_chars = str.chars\n\n str.chars.each do |char|\n # Thought so, apparently not: Edge case: there should be no more chars after the last 'k' in hackerrank.\n # break if expected_chars.empty?\n\n input_chars.shift\n expected_chars.shift if char == expected_chars[0]\n end\n\n expected_chars.empty? && input_chars.empty? ? 'YES' : 'NO'\nend", "def solution(a)\n n = a.size\n passing_cars = 0\n\n suffix_sums = Array.new(n + 1, 0)\n\n a.reverse.each_with_index do |elem, i|\n suffix_sums[i + 1] = suffix_sums[i] + elem\n end\n suffix_sums.reverse!\n\n a.each_with_index do |car, i|\n if car == 0\n passing_cars += suffix_sums[i]\n end\n end\n\n passing_cars > 1_000_000_000 ? -1 : passing_cars\nend", "def solve(str)\n idx = 0\n count = 0\n\n substr_1 = ''\n substr_2 = ''\n\n loop do\n substr_1 = str[0..idx]\n substr_2 = str[(idx + 1)..-1]\n\n substr_1.to_i.odd? ? count += 1 : nil \n substr_2.to_i.odd? ? count += 1 : nil \n \n idx += 1\n break if idx >= str.length\n end\n count\nend", "def solve(input)\n data = input.chars\n buckets = []\n current = []\n data.each_with_index do |c, i|\n n = data[i + 1]\n current << c\n unless n == c\n buckets << current\n current = []\n end\n break if n.nil?\n end\n\n ret = ''\n buckets.each do |b|\n ret += b.count.to_s\n ret += b.first\n end\n ret\nend", "def dominant_octopus(fish)\n #sorted = []\n return fish if fish.length < 2\n pivot = fish.first\n left = fish[1..-1].select { |feesh| feesh.length <= pivot.length }\n #p left\n right = fish[1..-1].select { |feesh| feesh.length > pivot.length }\n\n dominant_octopus(left) + [pivot] + dominant_octopus(right)\n \n\n\nend", "def problem_76a\n num = 100\n solve = lambda do |a,off,max|\n n = 0\n while a[off] < max && (a.length-off) >= 2 \n a[off] += a.pop\n n += 1\n n += solve.call(a.dup,off+1,a[off]) if a.length - off > 1\n end\n n\n end\n puts 1 + solve.call([1] * num, 0,num-1)\nend", "def challenge3\t\n\tputs \"Enter a string:\"\n\t# arr = gets.chomp.split(\"\")\n\t# len = arr.length-1\n\t# new_arr = []\n\n\t# for i in 0..len\n\t# \tnew_arr.push(arr[len-i])\n\t# end\n\t# puts \"#{new_arr.join}\"\n\n\tword = gets.chomp.split(\"\")\n\treverse_word = []\n\n\tword.each do |letters|\n\t\treverse_word.unshift(letters)\n\tend\n\n\tputs \"Your reversed word is: #{reverse_word.join.to_s}\"\n\n\nend", "def solution(a)\n # write your code in Ruby 2.2\n numbers = Array(1..(a.size + 1))\n res = numbers - a\n res[0]\nend", "def solutions(a)\r\n\r\n ary = a.sort\r\n ary.each_with_index do |num, index|\r\n if ary[index+1] != num + 1 && index != ary.length-1\r\n return num + 1\r\n end\r\n end\r\n\r\nend", "def solution(a)\r\n a.each do |num|\r\n if (a.count(num) % 2) != 0\r\n return num\r\n end\r\n end\r\nend", "def solve(s)\n answer = \"\"\n arr = s.split('')\n hash = Hash.new(0)\n arr.each_with_index do |el, idx|\n if el.to_i >= 1\n if arr[idx + 1] == \"(\"\n el.to_i.times do \n if arr[idx + 2].to_i >= 1\n if arr[idx + 3] == \"(\"\n arr[idx + 2].to_i.times do \n answer += (arr[(idx + 4)...arr.index(\")\")].join(''))\n end\n end\n end\n answer += (arr[(idx + 2)...arr.index(\")\")].join(''))\n end\n \n # hash[arr[idx + 1]] += 1\n end\n end\n \n end\n return answer\nend", "def solution(roman)\n split = roman.split(\"\")\n last_value = 0\n split.reduce(0) do |final, char|\n current = CONVERSION[char.upcase]\n binding.pry\n if current >= last_value\n final += current\n else\n final -= current\n end\n binding.pry\n last_value = current\n final\n end\nend", "def solution(n)\n\t(1..n).map(&:to_s).map(&:chars).join.chars.map(&:to_i).reduce(:+)\nend", "def solution\n (2..(9**5 * 6)).select do |n|\n n.to_s.split(//).map do |d|\n d.to_i ** 5\n end.reduce(:+) == n\n end.reduce(:+)\nend", "def solution(a)\n # write your code in Ruby 2.2\n permutation = Array(1..a.size)\n # puts permutation\n return 1 if permutation - a == []\n 0\nend", "def solution(a)\n # write your code in Ruby 2.2\n \n is_perm = 0\n \n n = a.length\n b = [0]*n\n \n \n a.each do |v|\n break if v > n \n break if b[v] == 1 \n b[v] = 1\n end\n \n sum = b.inject(:+)\n if sum == n\n is_perm = 1\n end\n \n is_perm\nend", "def num_decodings(s)\n\n decode = ('A'..'Z').to_a\n number_of_prev_ended_singly = 1\n\n ways_count = 1\n number_of_prev_ended_singly = 1\n\n s.chars[1..-1].each_with_index do |ch, idx|\n if s[idx - 1].to_i == 1 ||\n s[idx - 1] == 2.to_i && ch.to_i.between?(1,6)\n\n numbers_added_this_time = ways_count - number_of_prev_ended_singly\n ways_count += numbers_added_this_time\n number_of_prev_ended_singly = numbers_added_this_time\n else\n number_of_prev_ended_singly = 0\n end\n end\n\n ways_count\n\nend", "def f(n)\n # your code here\n result = []\n possibles = (2..n).flat_map{ |s| [*2..n].combination(s).map(&:join).to_a }\n p possibles\n possibles.each do |i|\n x = 0\n temp_arr = []\n temp = i.split('').map { |j| j.to_i }\n p temp\n while x < temp.length do \n if i[x + 1] != i[x] + 1 || i[x + 1] == nil\n temp_arr << i[x]\n end\n x += 1\n end\n result << temp_arr\n end\n result.length\nend", "def solution(a)\n # write your code in Ruby 2.2\n binding.pry\n trips = Hash.new {|h,k| h[k]=0}\n start = 0\n ending = 0\n min = nil\n a.each_with_index do |trip,i|\n ending = i\n\n if trips[trip] == 0\n min = ending - start\n end\n trips[trip] += 1\n\n while start < ending\n break if trips[a[start]] - 1 == 0\n trips[start] -= 1\n start += 1\n min = ending - start if ending-start < min\n end\n end\n min\nend", "def solve(nums)\n count = 0\n nums.each do |num|\n if num.to_s.length % 2 != 0\n count += 1\n end\n end\n return count\nend", "def solution(n)\n x = (n**0.5).floor\n (1..x).reduce(0) { |s, i| n % i == 0 ? s += (i * i == n ? 1 : 2) : s }\nend", "def solution(string)\n # lowers = string.scan(/[a-z]+[A-Z]/).join\n uppers = string.scan(/[A-Z][^A-Z]+/).join(' ')\n # lowers + \" \" + uppers\n # require 'pry'; binding.pry\n\nend", "def luhns(a)\n\tb = a.to_s[0..-2].reverse.split(\"\").to_a.map{|v|v.to_i}\n\t(b.each_index{|i|i.even? ? b[i]=b[i]*2>9?b[i]*2-9:b[i]*2:i=i}.inject(:+)+a)%10==0\nend", "def solution(a)\n n = a.size\n return 0 unless n > 2\n a.sort!\n\n (2..n - 1).each do |i|\n return 1 if a[i - 2] + a[i - 1] > a[i]\n end\n\n return 0\nend", "def solution(a)\n length = a.length\n sum = (length + 1) * (length + 1 + 1) / 2\n\n sum - a.inject(0) { |acc, e| acc += e }\nend", "def minimumBribes(q)\n bribes = 0\n q.reverse.each_with_index do |n, i|\n if q[i] - (i + 1) > 2\n bribes = \"Too chaotic\"\n break\n end\n j = [0, q[i] - 2].max\n while j < i\n if q[j] > q[i]\n bribes += 1\n end\n j += 1\n end\n end\n puts bribes\nend", "def minimumBribes(q)\n bribe_count = 0\n # q.each_with_index do |person,i|\n i = q.size-1\n while i >= 0 do\n person = q[i]\n position = i+1\n offset = person - position\n\n if offset > 2\n puts \"Too chaotic\"\n return\n else\n j=[0,person-2].max\n while j < i do\n if q[j] > person\n bribe_count += 1\n else\n # break if j+1 == person\n end\n j+=1\n end\n end\n i-=1\n end\n puts bribe_count\nend", "def captcha(input)\n sum = 0\n 0.upto(input.length - 1) do |i|\n sum += input[i].to_i if input[i] == input[(i+1) % input.length]\n end\n sum\nend", "def solution(a)\n # write your code in Ruby 2.2\n sum = a.inject(:+)\n acc = 0\n\n min = 99999999\n a[0..-2].each do |n|\n sum -= n\n acc += n\n\n min = [(acc - sum).abs, min].min\n end\n min\nend", "def goodVsEvil(good, evil)\n # good_power, evil_power = 0, 0\n # good.split.each_with_index do |num, i|\n # if i < 3\n # good_power += num.to_i * (i + 1)\n # elsif i < 5\n # good_power += num.to_i * i\n # elsif i == 5\n # good_power += num.to_i * 2 * i\n # end\n # end\n god = good.split.each_with_index.inject(0) do |sum, (num, i)|\n if i < 3\n sum + num.to_i * (i + 1)\n elsif i < 5\n sum + num.to_i * i\n elsif i == 5\n sum + num.to_i * 2 * i\n end\n end\n \n \n evl = evil.split.each_with_index.inject(0) do |sum, (num, i)|\n case i\n when 0\n sum + num.to_i * (i + 1)\n when 1, 2, 3\n sum + num.to_i * 2\n when 4\n sum + num.to_i * (i - 1)\n when 5\n sum + num.to_i * i\n when 6\n sum + num.to_i * (i + 4) \n end\n end\n \n if evl > god\n str = \"Evil eradicates all trace of Good\"\n elsif evl < god\n str = \"Good triumphs over Evil\"\n else\n str = \"No victor on this battle field\"\n end\n \n \"Battle Result: #{str}\"\nend", "def is_happy(n)\n return false if n < 10 && n % 2 == 0\n return false if n < 1 \n return true if n == 1\n \n sum = 0\n\n nsplit = n.to_s.split(\"\")\n nsplit.each do |i|\n sum += (i.to_i * i.to_i)\n end\n\n return is_happy(sum)\n \nend", "def solve_cipher(string, n)\n\n#Split each element of the string to get and array and return an array where each element is x (to operate with each element)\n string.split('').map do |x|\n#Create a new variable that will be the new index for each element.\n new_index = x.ord + n\n \n#Define the new index value with if conditional statements.\n\n#The value for whitespace is its value -26 as it is not included in the alphanumerical rules defined above\nif x == ' '\n new_index = ' '.ord - 26\nend\n\n\n#Declare the values of the index where it is above z's\nif new_index > 'z'.ord\n new_index = 'a'.ord + new_index - 'z'.ord - 1\nend\n\n#Declare the values of the index where it is beyond a's\nif new_index < 'a'.ord\n new_index = 'z'.ord - ('a'.ord - new_index) + 1\nend\n \n #Make the function return the list of numbers converted into letters \n new_index.chr\n\nend.join\n\nend", "def solution(digits)\n\tstop = digits.length - 4\n\tgo = 0\n\tlargest_number = 0\n\tindex = 0\n\n\twhile go < stop\n\t\ttest = \"\"\n\t\textra_index = index\n\t\t5.times do \n\t\t\ttest += digits[extra_index].to_s\n\t\t\textra_index += 1 \n\t\tend\n\t\tif test.to_i > largest_number\n\t\t\tlargest_number = test.to_i\n\t\tend \n\t\tindex += 1\n\t\tgo += 1 \n\tend \n\tlargest_number\nend", "def apply_solution array\n\n # Reverse the String to iterate right to left JUST because is easier :P\n index = find_small_neighbors array.reverse!\n \n return \"no answer\" unless index\n\n # Find rightmost successor to pivot in the suffix\n sec_index = array.index(array.slice(0..index).select{ |num| num > array[index] }.sort.first)\n # Swap with pivot\n array[index], array[sec_index] = array[sec_index], array[index]\n\n # Reverse the suffix REVERT rathern than sort\n solution = array.slice!(0..index-1).sort.join.reverse\n solution << array.join\n return solution.reverse\nend", "def isLucky(n)\n n = n.to_s.split('').map(&:to_i)\n n.shift(n.size/2).reduce(:+) == n.reduce(:+)\nend", "def scoobydoo(villian, villians)\n letters = ('a'..'z').to_a\n numbers = (0..25).to_a\n letters_to_numbers = letters.zip(numbers).to_h\n numbers_to_letters = numbers.zip(letters).to_h\n\n villians_downcase = villians.map { |v| v.downcase.delete(' ') }\n villians_hash = (villians_downcase).zip(villians).to_h\n\n s = villian.reverse.chars.rotate(5)\n new = []\n (0...s.size).each do |i|\n if i.even?\n new[i] = s[i]\n else\n num = (letters_to_numbers.fetch(s[i]) + 5) % 26\n new[i] = numbers_to_letters.fetch(num)\n end\n end\n\n villians_hash.fetch(new.join)\n\nend", "def solution(a)\n return 0 if a.length < 3\n a.sort!\n\n for i in 0..(a.length - 3)\n return 1 if a[i] + a[i + 1] > a[i + 2]\n end\n return 0\nend", "def solution1(seeds)\n turn_map = {}\n seeds.each_with_index { |n, turn| turn_map[n] = [1, turn + 1, turn + 1] }\n last_number = seeds.last\n\n ((seeds.length+1)..2020).each do |turn|\n last_stats = turn_map[last_number]\n if last_stats[TIMES_SPOKEN] == 1\n zero = turn_map[0] || [0, turn, turn]\n zero[TIMES_SPOKEN] += 1\n zero[FIRST_SPOKEN] = zero[LAST_SPOKEN]\n zero[LAST_SPOKEN] = turn\n \n turn_map[0] = zero\n last_number = 0\n else\n age = last_stats[LAST_SPOKEN] - last_stats[FIRST_SPOKEN]\n\n num = turn_map[age] || [0, turn, turn]\n num[TIMES_SPOKEN] += 1\n num[FIRST_SPOKEN] = num[LAST_SPOKEN]\n num[LAST_SPOKEN] = turn\n \n turn_map[age] = num\n last_number = age\n end\n end\n\n last_number\nend", "def solution(k, a)\n count = 0\n current = 0\n a.each { |length| \n current += length\n if current >= k\n current = 0\n count += 1\n end\n }\n count\nend", "def solution(a)\n # write your code in Ruby 2.2\n a.sort!\n min =1\n a.each{|x|\n if (x==min)\n min = min+1\n end\n }\n return min\nend", "def solve_two_vs_three_vs_five\n return if @arr[1].nil? || @arr[6].nil?\n\n #p \"1,6: #{@arr[1]},#{@arr[6]}\"\n\n @words.filter{|x| x.length == 5 && @hash[x].nil?}.each{|w|\n if @arr[1].chars.all?{|c| w.chars.include?(c)}\n solved(3, w)\n elsif w.chars.all?{|c2| @arr[6].chars.include?(c2)}\n solved(5, w)\n else\n solved(2, w)\n end\n }\n end", "def solution(digits)\n result = 0\n digits.size.times do |n|\n new_number = digits[n...(n + 5)].to_i\n result = new_number if new_number > result\n end\n result\nend", "def day_2_part_2\n noun = 0\n verb = 0\n\n while noun < 100\n while verb < 100\n if compute(noun, verb) == 19690720\n return (100 * noun) + verb\n end\n verb += 1\n end\n noun += 1\n verb = 0\n end\nend", "def iq_test(numbers)\n numbers = numbers.split(\" \")\n even_array = []\n odd_array = []\n numbers.each do |num|\n \tif num.to_i.even?\n \t\teven_array.push(num)\n \telse\n \t\todd_array.push(num)\n \tend\n end \n if even_array.size > odd_array.size\n \tnumbers.index(odd_array[0]) + 1\n else\n \tnumbers.index(even_array[0]) + 1\n end \nend", "def correct(element)\n result = nil\n element.downto(0).each do |j|\n i = element - j\n if j == element && j % 3 == 0\n result = Array.new(j, 5)\n elsif i % 5 == 0 && j % 3 == 0\n result = Array.new(j, 5) + Array.new(i, 3)\n elsif i == element && i % 5 == 0\n result = Array.new(i, 3)\n end\n\n break if result\n end\n\n if result.nil?\n puts -1\n else\n puts result.join()\n end\nend", "def solution(n)\n # write your code in Ruby 2.2\n a = Math.sqrt(n).floor\n a -= 1 while n % a != 0\n b = n / a\n (a + b) * 2\nend", "def solution(number)\n sum = 0\n Array(1..number-1).each do |i|\n if i % 3 == 0 || i % 5 == 0\n sum += i\n end\n end\n sum\nend", "def main\n max = 10 ** 9 + 7\n all = 1\n zero = 1\n nine = 1\n zn = 1\n N.times.each do\n all = all * 10 % max\n zero = zero * 9 % max\n nine = nine * 9 % max\n zn = zn * 8 % max\n end\n return (all - zero - nine + zn) % max\nend", "def is_armstrong(n)\n n_str=n.to_s()\n char_list=n_str.split(//)\n int_list=char_list.map {|x| (x.to_i())**(n_str.length()) }\n mysum = int_list.reduce(0) { |sum, num| sum + num }\n return (mysum==n)\nend", "def hard(input)\n to = input / 10\n houses = Array.new(to, 0)\n (1..to).each do |n|\n count = 0\n n.step(by: n, to: to - 1) do |i|\n houses[i] += 11 * n\n count += 1\n break if count == 50\n end\n end\n houses.index { |count| count >= input }\nend", "def decent_number(n)\n\tleft = 0\n\tright = 0\n\t(n+1).times do |i|\n\t\tleft = n - i \n\t\tright = n - left\n\t#\tputs \"#{left}%3 = #{left%3} | #{right}%5 = #{right%5}\"\n\t\tbreak if left % 3 == 0 && right % 5 == 0\n\tend\n\t#puts \"**l = #{left} r = #{right}\"\n\n\tif left % 3 == 0 && right % 5 == 0\n\t\tfives = \"5\"*left\n\t\tthrees = \"3\"*right\n\t\tputs fives+threes\n\telse\n\t\tputs -1\n\tend\nend", "def solution(x, a)\r\n # write your code in Ruby 2.2\r\n arr=[];\r\n i=0;\r\n l=a.count\r\n \r\n while(arr.count<=x)\r\n \r\n if(arr[i].nil?)\r\n arr << i\r\n end\r\n \r\n i+=1\r\n end\r\n i\r\nend", "def solution(n)\n (1..n).to_a.join.chars.map(&:to_i).sum\nend", "def ReduceRoman(myroman)\n lesschar = 0;\n newroman = \"\"\n puts \"orig roman = #{myroman}\"\n\n for i in 0...myroman.to_s.length-1 do\n count = 0\n j=i\n basechar = myroman[i]\n \n while ( $numbers[myroman[j]] == $numbers[myroman[j+1]]) do\n count = count + 1\n j = j+1\n end\n \n if(count == 4)\n case basechar\n when 'I'\n \n when 'V'\n \n when 'L'\n \n when 'C'\n \n when 'D'\n\n when 'M'\n \n end\n\n else\n for k in 0..count do\n newroman[k]=basechar\n end\n end\n\n end\n puts \"new roman is #{newroman}\"\n return lesschar\nend", "def funny string\n arr = string.chars\n count = 0\n arr.each_with_index do |x,xi|\n if xi > 0\n s1 = (x.ord - arr[xi-1].ord).abs\n s2 = (arr[-(xi+1)].ord - arr[-xi].ord).abs\n s1 == s2 ? count +=1 : break\n end\n end\n puts count == arr.size-1 ? 'Funny' : 'Not Funny'\nend", "def problem18(r) \n h = r.length\n sum = 0\n for i in 0..h-1 \n \n end\nend", "def get_birth_number(birthdate)\n\n# 2 use array syntax to access each element (number) in the birthdate, convert each one to an integer, and add them all together \nnumber = birthdate[0].to_i + birthdate[1].to_i + birthdate[2].to_i + birthdate[3].to_i + birthdate[4].to_i + birthdate[5].to_i + birthdate[6].to_i + birthdate[7].to_i\nputs \"1. The Number is currently #{number}\"\n\n# 3. convert the number back to a string so you can use array syntax again, and then follow step 3 to add the two numbers together \nnumber = number.to_s\nnumber = number[0].to_i + number[1].to_i\nputs \"2. The Number is currently #{number}\"\n\n# 4. use an if statement to determine if the number is greater than 9; if it is, reduce again\nif number > 9 \n number = number.to_s\n number = number[0].to_i + number[1].to_i\nend \n puts \"3. The number is #{number}\"\nreturn number\nend", "def hipsterfy(str)\n finalArray = []\n alphabet = (\"a\"..\"z\").to_a\n wordArray = str.split(\" \")\n wordArray.each do |word|\n firstSeen = false\n reversed = word.split(\"\").reverse\n finalWord = []\n reversed.each do |letter|\n if firstSeen == true || letter != \"a\" && letter != \"e\" && letter != \"i\" && letter != \"o\" && letter != \"u\"\n finalWord.push(letter)\n\n elsif firstSeen == false && letter == \"a\" || letter == \"e\" || letter == \"i\" || letter == \"o\" || letter == \"u\"\n # don't add here\n firstSeen = true\n end\n end\n \n newString = \"\"\n finalWord.reverse.each do |element|\n newString += String(element)\n end\n finalArray.push(newString)\n \n end\n \n \n \n # print finalArray\n finalString = \"\"\n \n finalArray.each_with_index do |word, index|\n if index != finalArray.length - 1\n finalString += word + \" \"\n else\n finalString += word\n end\n end\n \n \n \n \n \n \n return finalString\n \n \n\n \nend", "def odds_and_evens(string, return_odds)\n# Creates new method with two arguments, 'string' and 'return_odds' boolean.\n\n to_return = \"\"\n# Creates new variable and assigns it an empty string.\n\n string.size.times do |index|\n# First applies the .size method to the string to calculate the size of the string and return the resulting number. E.g. if the string is \"Rare\", .size will applied to the string returns 4 because \"Rare\" has 4 letters.\n\n# Second applies the .times to the number returned after calculating the string size. E.g. if the string is \"Rare\", .times will execute the following loop x4 times.\n\n# Third the \"| index |\" means do for each indexed character the following steps. A string has an index, e.g. [[0, r], [1, a], [2, r], [3, e]], where the first character is the index number and the second is the corresponding character. Note '0' is considered an even number for coding purposes.\n\n next if return_odds && index.even?\n # First iteration iterates over index[0], i.e. \"r'.\n # => next if false && r.even?\n # => next if false && true\n # => next if false\n # => therefore tells ruby don't skip \"r\" and instead move on to complete next step using the return value of index[0].\n\n # Second iteration iterates over index[1], i.e. 'a'.\n # => next if false && a.even?\n # => next if false && false\n # => next if false\n # => therefore tells ruby don't skip \"a\" and instead move on to complete next step using the return value of index[1].\n\n # Third iteration iterates over index[2], i.e. the second letter \"r\".\n # => next if false && r.even?\n # => next if false && true\n # => next if false\n # => therefore tells ruby don't skip \"r\" and instead move on to complete next step using the return value of index[2].\n\n # Fourth iteration iterates over index[3], i.e. \"e\".\n # => next if false && e.even?\n # => next if false && false\n # => next if false\n # => therefore tells ruby don't skip \"e\" and instead move on to complete next step using the return value of index[2].\n\n puts index\n\n # First iteration puts value of index[0] to screen.\n\n # Second iteration puts value of index[1] to screen.\n\n # Third iteration puts value of index[2] to screen.\n\n # Fourth iteration puts value of index[3] to screen.\n\n next if !return_odds && index.odd?\n # First iteration continues to iterate this step over index[0], i.e. \"r\".\n # => next if true && r.odd?\n # => next if true && false\n # => next if false\n # => therefore tells ruby don't skip \"r\" and instead move on to complete the next steps using index[0] as return value.\n\n # Second iteration continues to iterate this step over index[1], i.e. \"a\".\n # => next if true && a.odd?\n # => next if true && true\n # => next if true\n # => therefore tells ruby to skip \"a\" and ignore the next steps.\n\n # Third iteration continues to iterate this step over index[2], i.e. \"r\".\n # => next if true && r.odd?\n # => next if true && false\n # => next if false\n # => therefore tells ruby don't skip \"r\" and instead move on to complete the next steps using index[2] as return value.\n\n # Second iteration continues to iterate this step over index[3], i.e. \"e\".\n # => next if true && e.odd?\n # => next if true && true\n # => next if true\n # => therefore tells ruby to skip \"e\" and ignore the next steps.\n\n puts \"#{index}+x\"\n\n # First iteration puts value of \"index[0]+x\" to screen, i.e. \"0+x\".\n\n # Third iteration puts value of \"index[2]+x\" to screen, i.e. \"2+x\".\n\n to_return << string[index]\n # First iteration continues to iterate this step over index[0], i.e. \"r\".\n # => \"\" << string[0]\n # => \"\" << \"r\"\n # => to_return = \"r\"\n # In other words, ruby adds the current return value, index[0] (i.e. \"r\"), to the variable \"to_return\".\n\n # Second iteration continues to iterate this step over index[2], i.e. \"r\".\n # => \"r\" << string[2]\n # => \"r\" << \"r\"\n # => to_return = \"rr\"\n # In other words, ruby adds the current return value, index[2] (i.e. \"r\"), to the variable \"to_return\".\n\n end\n\n to_return\n# Return the final value of to_return after iterating each character in the chosen string. This does not get returned until the above loop has completed.\n\nend", "def solution a\n a.sort!\n until a.empty?\n answer = a.pop\n return answer if a.pop != answer\n end\nend", "def check_exam(arr1,arr2)\n result = 0\n arr1.each_with_index do |item, index|\n if arr1[index] == arr2[index]\n result += 4\n elsif arr2[index] == \"\"\n result += 0\n elsif arr1[index] != arr2[index]\n result -= 1\n end\n end\n result = 0 if result <= 0\n p result\nend", "def solution(a)\n counter = Hash.new(0)\n a.each do |elem|\n counter[elem] += 1\n end\n\n (1..a.size).each do |number|\n return 0 if counter[number] != 1\n end\n\n 1\nend", "def solution(a)\n s= a.sort\n 0.step(s.size - 1).inject(0) do |result, x|\n z= x+2\n (x+1).step(s.size - 1).inject(result) do |acc, y|\n z+=1 while z < s.size && s[x] + s[y] > s[z]\n acc += z-y-1\n end\n end\nend", "def jewels_and_stones(j,s)\n\n if (s == nil || s.length < 1 || j == nil || j.length < 1)\n return 0\n end\n\n hash = Hash.new\n\n j.each_char do |char|\n hash[char] = 1\n end\n\n count = 0\n s.each_char do |char|\n if (hash[s[char]] == 1)\n count = count + 1\n end\n end\n return count\n\nend", "def solveProblem lst\n big = -1\n numbers = {}\n half = lst.length / 2\n lst.each do |i|\n if numbers.has_key?(i) then\n numbers[i] += 1\n else\n numbers[i] = 1\n end\n if numbers[i] > half then return i end\n end\n return big\nend", "def problem_104\n all = [\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\"]\n k = 2\n low_fn0,low_fn1 = 1,1\n hi_fn0,hi_fn1 = 1,1\n loop do\n k += 1\n low_fn0,low_fn1 =(low_fn0 + low_fn1) % 10_000_000_000, low_fn0\n hi_fn0, hi_fn1 = hi_fn0 + hi_fn1, hi_fn0\n if hi_fn0 > 1_000_000_000_000_000_000\n hi_fn0 /= 10\n hi_fn1 /= 10\n end\n front = false\n next unless k > 300\n hi = hi_fn0.to_s[0,9].split(//)\n if (hi & all).length == 9\n puts \"front #{k}\" \n front = true\n end\n if (low = low_fn0.to_s).length >= 9\n low = low[-9,9].split(//)\n if (low & all).length == 9\n puts \"back #{k}\" \n return k if front\n end\n end\n end\nend", "def happy? n\n visited = []\n until n == 1 || visited.include?(n)\n visited << n\n n = n.to_s.chars.map{ |x| x.to_i * x.to_i }.inject{ |sum, x| sum + x }\n end\n n == 1\nend", "def pirates_say_arrrrrrrrr(string)\n r_indexes = []\n string.split(\"\").each_with_index{|letter, index| r_indexes << index if letter.downcase == \"r\"}\n plusoneindex = r_indexes.map{|index| index + 1}\n answer = \"\"\n plusoneindex.map{|index| string.split(\"\")[index]}.join\n\nend", "def find_shortest_seq(n)\n new_num = n/2\n i = 0\n arr = []; arr[i] = 1\n\n while(arr[i] < new_num)\n n1 = arr[i] * 2\n n2 = arr[i] + 1\n\n i += 1\n if(n1 < new_num)\n arr[i] = n1\n else\n arr[i] = n2\n end \n end\n puts arr.to_s\n if(arr[i] == n)\n puts arr.to_s\n puts i \n elsif n == (arr[i] * 2)\n arr[i + 1] = arr[i] * 2\n puts arr.to_s\n puts i + 1\n else\n arr[i + 1] = arr[i] * 2\n i += 1\n arr[i + 1] = arr[i] + 1\n puts arr.to_s\n puts i\n end \n \nend", "def reverberate(sent)\n new_arr = []\n words_arr = sent.split(\" \")\n vowels = \"aeiouAEIOU\"\n words_arr.each do |word|\n capt = false\n if word.capitalize == word\n capt = true\n end\n if word.length < 3\n new_arr << capt ? word.capitalize : word #new_arr << capt ? word.capitalize : word\n elsif vowels.include?(word[-1])\n new_arr << (capt ? (word * 2).capitalize : word * 2)\n elsif !vowels.include?(word[-1])\n rev_index = word.chars.reverse.index { |char| vowels.include?(char) }\n i = word.length - 1 - rev_index\n new_arr << (capt ? (word + word[i..-1]).capitalize : word + word[i..-1])\n end\n end\n new_arr.join(\" \")\nend" ]
[ "0.63289225", "0.6205202", "0.61149555", "0.60662645", "0.60597146", "0.599806", "0.59800804", "0.5943953", "0.5919818", "0.5904032", "0.5893192", "0.58537364", "0.5829291", "0.58226335", "0.5813042", "0.57859313", "0.5765567", "0.57462376", "0.5719892", "0.57193565", "0.5703567", "0.5697488", "0.5687112", "0.56819016", "0.5669593", "0.5668854", "0.5661734", "0.56613576", "0.56590676", "0.5657957", "0.5653879", "0.5638069", "0.56377244", "0.5629963", "0.562726", "0.5627006", "0.56141", "0.5610457", "0.5606867", "0.5597517", "0.5593305", "0.55920774", "0.55893064", "0.5587015", "0.5582745", "0.558269", "0.5578958", "0.5575101", "0.5572584", "0.5566746", "0.5565887", "0.55453914", "0.5544233", "0.55391115", "0.5537758", "0.55343586", "0.5532281", "0.55285513", "0.5525407", "0.55251485", "0.5523185", "0.55172807", "0.5513713", "0.5513452", "0.5508505", "0.55071753", "0.5500398", "0.5500242", "0.54994804", "0.5493485", "0.5475634", "0.5463057", "0.5462766", "0.5459822", "0.545537", "0.5452154", "0.54488355", "0.54479176", "0.54437405", "0.54432917", "0.54414594", "0.5437043", "0.5436745", "0.54352784", "0.54343134", "0.54314727", "0.54311264", "0.54301375", "0.54262966", "0.5425832", "0.54255813", "0.5417718", "0.5414729", "0.54124695", "0.54050994", "0.5397763", "0.5396603", "0.5395743", "0.5389864", "0.53821826", "0.538183" ]
0.0
-1
Shows the version of the Incline library.
def run STDOUT.puts "Incline v#{Incline::VERSION}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_elf_version\n\t\t\tver_str = \"#{@elf_version}\"\n\t\t\tver_str += \" (current)\" if @elf_version == 1\n\t\t\tputs \" Version: #{ver_str}\"\n\t\tend", "def version\n \"\\e[36mThis program is currently in version number: #{v_num}\\e[0m\"\n end", "def show_file_version\n\t\t\tputs \" Version: #{@elf_version.to_h}\"\n\t\tend", "def version\n puts \"v0.3\"\n end", "def show_version\n puts format('JRubyArt version %s', JRubyArt::VERSION)\n end", "def version\n @version_helper.to_s\n end", "def version\n @version_helper.to_s\n end", "def version\n puts \"Version 1.1\"\nend", "def output_version\n puts \"#{File.basename(__FILE__)} version #{VERSION}\"\n end", "def display_version\n @colour.help FORGEN_VERSION_NUMBER\nend", "def version\n \"Version: #{VERSION.split[1]} Created on: \" +\n \"#{REVISION_DATE.split[1]} by #{AUTHOR}\"\n end", "def version\n \"Version: #{VERSION.split[1]} Created on: \" +\n \"#{REVISION_DATE.split[1]} by #{AUTHOR}\"\n end", "def version\n \"Version: #{VERSION.split[1]} Created on: \" +\n \"#{REVISION_DATE.split[1]} by #{AUTHOR}\"\n end", "def version(version)\n @io.puts \"v#{version}\"\n @io.puts\n end", "def show_version\n abort \"#{option_parser.program_name} v#{VERSION} on #{RUBY_DESCRIPTION}\"\n end", "def versionString()\n\t\t\t\treturn \"#{major}.#{minor}.#{build}\"\n\t\t\tend", "def version\n Airplay.configuration.load\n v = Airplay::CLI::VERSION\n puts <<-EOS\n\n i@@@@@@@@@@@@@@@@@@@@@@@@@\n i80000000000000000000000000000\n i80000000000000000000000000000000G\n i8000000000000000000000000000000000000\n i80000000000000000000000000000000000000000\n @00000 @0000000000000000000000000000000000000@ 000000@\n @0000008 @000000000000000000000000000000000@ 80000000@\n @001 @00000000000000000000000000000@ 100@\n @001 @0000000000000000000000000@ 100@\n @001 80000000000000000000008 t00@\n @001 8000000000000000008 t00@\n @001 800000000000008 t00@\n @001 G000000000G t00@\n @001 G00000G t00@\n @001 L0L t00@\n @001 t00@\n @001 air t00@\n @001 #{v} t00@\n @001 t00@\n @001 t00@\n @001 100@\n @00000000000000000000000000000000000000000000000000000G000@\n @000000000000000000000000000000000000000000000000000000000@\n\n EOS\n end", "def print_version_info()\n puts \"Versão: \" + $version_info[:version].to_s + \" \" + $version_info[:date].to_s\n puts \"-----\"\nend", "def version\n build_string\n end", "def ver\n if v = version\n str = +\"#{program_name} #{[v].join('.')}\"\n str << \" (#{v})\" if v = release\n str\n end\n end", "def display_version(arg=nil)\n set_or_return(\n :display_version,\n arg,\n :kind_of => [ String ]\n )\n end", "def version(version)\n @io.puts \"*v#{version}*\"\n @io.puts\n # Hacking in the overview file\n if File.exist?('OVERVIEW.md')\n @io.puts IO.read('OVERVIEW.md')\n @io.puts\n end\n end", "def show_version\n puts \"iTunes version: #{@iTunes.version}\"\n @logger.info \"iTunes version: #{@iTunes.version}\"\n end", "def version\n VERSION\n end", "def version\n VERSION\n end", "def version\n VERSION\n end", "def version\n VERSION\n end", "def version\n VERSION\n end", "def print_version()\n puts\n string = get_version()\n puts string\n puts\n return\nend", "def version\n api_execute('/version', :get).body\n end", "def version\n @version\n end", "def option_version_tail\n block = proc { puts \"#{FRAMEWORK_TITLE}\"; exit }\n @cl_parser.on_tail('-v', '--version', 'Show version information', &block)\n end", "def version\n cmd(COMMANDS[:version], 2)\n end", "def version(sender)\n v = ::Vdoc2Org::VERSION\n puts \"version: #{v}\"\n v\n end", "def version\n @version ||= version_hex.to_s(16).chars.entries.join('.')\n end", "def version\n self.class.name + ' ' + VERSION\n end", "def cli_version\n Utils.call_executable('-v')\n end", "def API_version(options={})\n return \"#{@major}.#{@minor}\"\n end", "def current_version\n @version\n end", "def print_version()\n (version,packager,name) = get_version()\n puts name+\" v. \"+version+\" \"+packager\nend", "def version\n echo_rosh_command\n\n @version ||= adapter.current_version\n end", "def version_number\n \"#{self.major}.#{self.minor}\"\n end", "def head\n\tversion\n end", "def version\n VersionInfo.new(command(\"Browser.getVersion\"))\n end", "def major_version; end", "def print_version\n puts VERSION\n \n exit\n end", "def output_version\n puts \"#{File.basename($0)} version #{BM_VERSION}\"\n end", "def version\n options['version']\n end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version\n \"0.2.0\"\n end", "def version()\n $stderr.puts WOL_VERSION\n $stderr.puts 'Written by Kevin R. Bullock.'\n $stderr.puts\n $stderr.puts 'Copyright (C) 2004 Kevin R. Bullock.'\n $stderr.puts 'This is free software; see the source for copying conditions. There is NO'\n $stderr.puts 'warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.'\n end", "def version\n exec('--version').match(/^Ledger (.*),/)[1]\n end", "def version\n super.to_s\n end", "def version\n super.to_s\n end", "def version\n [@major_version, @minor_version].join('.')\n end", "def version\n case @version\n when Module\n \"#{@version::Major}.#{@version::Minor}.#{@version::Release}\"\n when Proc # not sure about this\n @version.call\n when NilClass\n 'unknown'\n else\n @version\n end\n end", "def print_version()\n (version,packager,name) = get_version()\n puts name+\" v. \"+version+\" \"+packager\n exit\nend", "def getVersion()\n return \"client \" + CLIENT_VERSION + \", API v2, converter \" + @helper.getConverterVersion()\n end", "def getVersion()\n return \"client \" + CLIENT_VERSION + \", API v2, converter \" + @helper.getConverterVersion()\n end", "def getVersion()\n return \"client \" + CLIENT_VERSION + \", API v2, converter \" + @helper.getConverterVersion()\n end", "def getVersion()\n return \"client \" + CLIENT_VERSION + \", API v2, converter \" + @helper.getConverterVersion()\n end", "def getVersion()\n return \"client \" + CLIENT_VERSION + \", API v2, converter \" + @helper.getConverterVersion()\n end", "def getVersion()\n return \"client \" + CLIENT_VERSION + \", API v2, converter \" + @helper.getConverterVersion()\n end", "def getVersion()\n return \"client \" + CLIENT_VERSION + \", API v2, converter \" + @helper.getConverterVersion()\n end", "def __print_version\n puts \"redmine_cli version #{VERSION}\"\n end", "def client_version\n ClientVersion\n end", "def version\n 1\n end", "def version\n \"rs_reenroll #{right_link_version} - RightLink's reenroller (c) 2014 RightScale\"\n end", "def version_number\n @version\n end", "def version\n @version ||= '1.0'\n end", "def get_version\n\t\tend", "def major ; version.major ; end", "def major_version\n @version_helper.major\n end", "def major_version\n @version_helper.major\n end", "def major_version\n @version_helper.major\n end", "def version\n\t\t\tbegin\n\t\t\t\tv = \"#{GVB.major_version}.#{GVB.minor_version}.#{GVB.patch_version}\"\n\t\t\trescue\n\t\t\t\tv = File.read(\".gvb_version\") if File.exists?(\".gvb_version\")\n\t\t\tend\n\t\t\t# If we got a version then use it to construct a link to the github tag of the same\n\t\t\tif v\n\t\t\t\tl = link_to v, \"https://github.com/machiavellian/machiavelli/releases/tag/v#{v}\", target: \"blank\" if v\n\t\t\t\treturn \"version #{l} \".html_safe\n\t\t\tend\n\t\tend", "def get_version()\n\t\tend", "def current_version\n version_number rev\n end", "def version\n self.class.get(\"/get/version\")\n end" ]
[ "0.728596", "0.71393687", "0.69819623", "0.6916425", "0.6847606", "0.68432933", "0.68432933", "0.67912877", "0.6788635", "0.6624198", "0.6591315", "0.6591315", "0.6589628", "0.6533484", "0.65255636", "0.6522047", "0.65111256", "0.65068704", "0.64834726", "0.64754045", "0.647144", "0.6471215", "0.64651304", "0.645212", "0.64497536", "0.643368", "0.643368", "0.643368", "0.6412091", "0.6402629", "0.63922", "0.6389867", "0.6389044", "0.6385046", "0.632774", "0.6292466", "0.6290286", "0.62733835", "0.6265652", "0.625471", "0.6234241", "0.62311155", "0.6230494", "0.6219812", "0.61959475", "0.6195361", "0.6194206", "0.61924887", "0.61745816", "0.61745816", "0.61745816", "0.61745816", "0.61745816", "0.61745816", "0.61745816", "0.61745816", "0.61745816", "0.61745816", "0.61745816", "0.61745816", "0.61745816", "0.61745816", "0.61745816", "0.61745816", "0.61745816", "0.61745816", "0.61745816", "0.61745816", "0.61745816", "0.61745816", "0.61745816", "0.61718714", "0.6165858", "0.6153899", "0.61518115", "0.61518115", "0.61305", "0.61195636", "0.6117102", "0.61098886", "0.61098886", "0.61098886", "0.61098886", "0.61098886", "0.61098886", "0.61098886", "0.6109262", "0.6108737", "0.6103368", "0.60969746", "0.6087538", "0.608722", "0.60811096", "0.6070581", "0.6067102", "0.6067102", "0.6067102", "0.60616165", "0.6060591", "0.6052553", "0.60240364" ]
0.0
-1
Returns a sorted object of genres and the number of albums in each genre.
def genre_ranking ranked_albums = SortCollection.sort_albums('genre') render json: ranked_albums.sort_by(&:last).reverse.to_h, status: 200 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def movies_genres_count\n @genres = Genre.joins(:movie).\n select('genre.genre_id, genre.name as name, count(*) as count').\n group('genre.genre_id').\n order('count DESC')\n end", "def genres\n @songs.collect { |song| song.genre }.uniq\n end", "def genres\n @songs.collect do |song|\n song.genre\n end.uniq\n end", "def genres\n songs.collect do |song|\n song.genre\n end\n .uniq #does not return duplicate genres if the artist has more than one song of a particular genre (artist has many genres through songs)\n end", "def genres\n songs.collect{|song| song.genre}.uniq\n end", "def genres\n @songs.collect{|song| song.genre }.uniq\n end", "def genres\n songs.map{|song|song.genre}.uniq\n end", "def genres\n self.songs.collect {|song| (song.genre) }.uniq\n end", "def songs_by_album\n return @count_by_album if @count_by_album\n\n return get_base_relation(true, false)\n .group('albums.id')\n .order('albums.name')\n .pluck('albums.id' , 'albums.name' , 'count(*)')\n\n end", "def genres\n self.songs.map { |song| song.genre }.uniq\n end", "def list_genres\n sorted_list = Genre.all.sort_by {|artist| artist.name}\n sorted_list.each_with_index do |genre, idx|\n puts \"#{(idx + 1).to_s}. #{genre.name}\"\n end\n end", "def genres\n self.songs.collect {|song| song.genre}.uniq\n end", "def genres \n songs.collect {|song| song.genre}.uniq \n\n end", "def genres \n songs.collect{ |s| s.genre }.uniq #returns collection of genres for all of the artist's songs/ does not return duplicate genres/ collects genres\n end", "def genre_count(hash)\n\thash.group_by { |k, v| v[:genre] }.map { |k, v| { k => v.count } }\nend", "def genres\r\n self.songs.collect do |song|\r\n song.genre\r\n end\r\n end", "def genres\n\t\[email protected] {|g| g.genre}\n\tend", "def genres\n songs.map {|song| song.genre }\n end", "def list_genres\n Genre.all.uniq.sort { |genre1, genre2| genre1.name <=> genre2.name}.each.with_index(1) do |genre, i|\n puts \"#{i}. #{genre.name}\"\n end\n end", "def genres\n songs.map do |song| song.genre end\n end", "def genres\n @songs.collect {|s| s.genre}\n end", "def genres\n songs.map {|song| song.genre}\n end", "def genres\n self.songs.collect do |song|\n song.genre\n end\n end", "def genres\n self.songs.collect do |song|\n song.genre\n end\n end", "def genres\n self.songs.collect do |song|\n song.genre\n end\n end", "def genres\n self.songs.collect do |song|\n song.genre\n end\n end", "def genres\n self.songs.collect do |song|\n song.genre\n end\n end", "def bookGenre\n\t\tarr =[]\n\t\tcurrent_user.reads.each do |f|\n\t\t\tarr.push(Book.find_by_id(f.book_id).genre)\n\t\tend\n\t\th = Hash.new(0)\n\t\t\tarr.each do |word|\n\t\t\th[word] += 1\n\t\tend\n\t\tgenre = h.sort_by{|word,count| count}\n\t\tgenre = genre.reverse # Hash highest the genre picked the most\n\n\t\tarr2 =[]\n\t\tgenre.each do |key,value|\n\t\t\tarr2.push(key)\n\t\tend\n\t\tif(arr2.size > 1)\n\t\t\t@popGenre = arr2.at(0)\n\t\telse\n\t\t\t@popGenre = \"Adventure\"\n\t\tend\n\tend", "def genres\n Song.all.collect{|song|song.genre}\n end", "def genres\n self.songs.map do |artist_song|\n artist_song.genre\n end\n end", "def genres\n songs.map{|song| song.genre} # giving back all the genres under that particular artist. artists can have nmany genres and calling of theirmany genres.\n # Song.all.map{|ind_song| ind_song.genre} #giving back all the different genres from the collection of song array. giving back all the genres of the songs\n # binding.pry\n end", "def genres\n self.songs.map {|x| x.genre}\n end", "def genres #How to shorten? \n array = []\n songs.each do |song_instance|\n array << song_instance.genre \n end\n array.uniq\n end", "def list_songs_by_genre\n puts \"Please enter the name of a genre:\"\n input = gets.chomp\n if genre = Genre.find_by_name(input)\n sort_by_name = genre.songs.sort_by do |genre|\n genre.name\n end\n sort_by_name.each.with_index(1) do |genre, i|\n puts \"#{i}. #{genre.artist.name} - #{genre.name}\"\n end\n end\n end", "def genres\n songs.map do |song|\n song.genre\n end\nend", "def better_tracks_query\n albums = self.albums.select(\"albums.*, COUNT(*) AS tracks_count\")\n .joins(:tracks).group(\"albums.id\")\n\n album_counts = {}\n albums.each do |album|\n album_counts[album.title] = album.tracks_count\n end\n\n album_counts\n end", "def genres\n self.songs.map do |song|\n song.genre\n end.uniq\n #unduped.uniq #uniq only works on an array\n end", "def genre_count(term)\n #count the genres in object.get_genres\n genres = Hash.new(0)\n object.get_genres(term).each do |genre|\n case\n when genre.include?(\"rap\")\n genres[:rap]+=1\n when genre.include?(\"pop\")\n genres[:pop]+=1\n when genre.include?(\"country\")\n genres[:country]+=1\n when genre.include?(\"indie\")\n genres[:indie]+=1\n when genre.include?(\"hip\")\n genres[\"hip hop\"]+=1\n when genre.include?(\"rock\")\n genres[:rock]+=1\n when genre.include?(\"jazz\")\n genres[:jazz]+=1\n when genre.include?(\"instrumental\")\n genres[:instrumental]+=1\n when genre.include?(\"r&b\")\n genres[\"r&b\"]+=1\n else\n genres[:misc] +=1\n end\n end\n genres\n end", "def list_genres\n Genre.all.sort{|a, b| a.name <=> b.name}.each_with_index do |g, i|\n puts \"#{i+1}. #{g.name}\"\n # ex: expect($stdout).to receive(:puts).with(\"2. dance\")\n end\n end", "def genres\n self.songs.collect {|song| song.genre}\nend", "def genres\n to_array search_by_itemprop 'genre'\n end", "def genres\n @new_array_of_genres = []\n @songs.each do |song| #iterate through each song to find the genre\n if @new_array_of_genres.include?(song.genre) #does not return duplicate genres\n nil\n else\n @new_array_of_genres << song.genre #collects genres through its songs\n end\n end\n @new_array_of_genres #returns a collection of genres for all of the artists songs\n end", "def marshall_genre_data( unsorted_genres )\n return [] unless unsorted_genres\n \n # filter out unspecified genre facets\n unsorted_genres = unsorted_genres.select {|value, count| value != '<unspecified>' } \n \n sorted_genres = unsorted_genres.sort {|a,b| a[0] <=> b[0]} \n sorted_genres.map { |pair| \n existing_constraints = session[:constraints].select { |constraint| constraint[:fieldx] == \"genre\" and constraint[:value] == pair[0] }\n { :value => pair[0], :count => pair[1], :exists => (existing_constraints.size>0) }\n }\n end", "def genre(hash)\n\thash.group_by { |k, v| v[:genre] }\nend", "def genres\n self.songs.collect do |song| #call the artist class on the songs method and collect the song\n song.genre #then call the genre on the song\n end\n end", "def popularity_list\n @movies.values.sort { |movie1, movie2| popularity(movie2.movie_id) <=> popularity(movie1.movie_id) }.map(&:movie_id)\n end", "def list_genre\n genre = gets.chomp\n Genre.all.each do |a|\n if a.name == genre\n a.songs.collect { |s| puts \"#{s.artist.name} - #{s.name} - #{s.genre.name}\" }\n end\n end\n end", "def popular_stocks\n #pluck to pull a column of values from a table\n @stocks = Stock.pluck(:symbol)\n # stock_counts is setting a new hash ready to accept new keys with default value 0\n @stock_counts = Hash.new 0\n @stocks.each do |stock|\n @stock_counts[stock] += 1\n end\n # @sorted_counts is a 2d array, each element of outer array has 2 elements pos 0 & 1\n @sorted_counts = @stock_counts.sort{|a,b| b[1] <=> a[1]}\n render \"popular_stocks\"\n end", "def popularity_list\r\n\t\tif @mov_pop_ar_hs.nil?\r\n\t\t\tputs \"data has not been loaded\"\r\n\t\t\treturn[]\r\n\t\telse\r\n\t\t\tmovie_avg_pop={}\r\n\t\t\tcount = 0\r\n\t\t\twhile count < @mov_pop_ar_hs.length\r\n\t\t\t\tmovie_avg_pop[count]=popularity(count)\r\n\t\t\t\tcount = count + 1\r\n\t\t\tend\r\n\t\t\t#sort from highest to lowest\r\n\r\n\t\t\treturn movie_avg_pop.sort_by {|movie, pop| pop}.reverse\r\n\t\tend\r\n\tend", "def top_five_artists(db, genre_name)\n db.execute \"SELECT artists.name, COUNT(*) as c\n FROM tracks\n JOIN albums ON albums.id = tracks.album_id\n JOIN artists ON artists.id = albums.artist_id\n JOIN genres ON tracks.genre.id = genres.id\n WHERE genres.name = '#{genre_name}'\n GROUP BY artists.name\n ORDER BY c DESC\n LIMIT 5\n \" # TODO: return list of top 5 rock artists\nend", "def genre_array\n Genre.list.each { |genre| @available_genres << genre.kind }\n end", "def list_albums\n output = ''\n @albums.sort.each { |a|\n output += a + \"\\n\"\n #puts a\n }\n return output\n end", "def freqs\n items = []\n if self.commo_item_ids\n self.commo_item_ids.each { |i| items << CommoItem.find(i) }\n end\n items.sort\n end", "def genre_names\n genres.map {|genre| genre.name}\n #create empty array\n #@movie.genres\n #call genres, because @movie is the instance itself already\n #run map to get each name of each genre instance\n #return map\n end", "def index\n if params[:genre].blank?\n\t\t\t@albums = Album.all.order(\"created_at DESC\")\n\t\telse\n\t\t\t@genre_id = Genre.find_by(name: params[:genre]).id\n\t\t\t@albums = Album.where(:genre_id => @genre_id).order(\"created_at DESC\")\n\t\tend\n end", "def genres\n document[\"genre\"].collect {|gender| gender[\"$\"]} rescue nil\n end", "def year_ranking\n ranked_albums = SortCollection.sort_albums('year')\n render json: ranked_albums.sort_by(&:last).reverse[0...5].to_h, status: 200\n end", "def genres_hash\n search_by_itemprop_hash 'genre'\n end", "def sort_by_popularity\n @song_data = @song_data.sort_by {|x| [-x[:plays], x[:index]] }\n end", "def album_count\n return @albums.length\n end", "def list_songs\n temp = Song.all.sort{|songA, songB| songA.name <=> songB.name} #sorting lab, refactor with .with_index(offset=1)?\n counter = 1\n temp.each do |song|\n puts \"#{counter}. #{song.artist.name} - #{song.name} - #{song.genre.name}\"\n counter += 1\n end\n end", "def genres\n return @metadata[:genres]\n end", "def count_people_ordered_most_popular_books(count_of_popular_books)\n most_popular_books = most_popular\n people = Array.new\n most_popular_books[0..count_of_popular_books].each do |book|\n @readers.each do |name, value|\n value.orders.detect do |order|\n# p \"order.book=\"+order.book.to_s\n# p \"book=\"+book.title.to_s\n p \"Book.class= \"+order.book.class.to_s\n people << value if book == order.book\n end\n end \n end\n return people.size #maybe a good idea return all people?\n end", "def songs_count\n value = 0\n packs.each do |pack|\n value += pack.songs.count\n end\n value += songs.count\n end", "def genres\n all_genres = []\n Song.all.each do |x|\n if x.artist == self\n all_genres << x.genre\n end\n end\nall_genres\nend", "def sort_grosstotal\n BoxOffice::Movie.all.map( &:to_s ).sort {|a,b| b.grosstotal <=> a.grosstotal}.each.with_index(1) do |movie, index|\n puts \"#{movie.title}\"\n end\n end", "def plays_genres\n genres = Array.new\n self.genres.each do |genre|\n genres << genre.printable\n end\n genres.uniq\n end", "def artists\n songs.collect do |song|\n song.artist\n end\n .uniq #does not return duplicate artists if the genre has more than one song by a particular artist (genre has many artists through songs)\n end", "def popularity_list\n @movie_list.values.sort{|a,b| b.popularity <=> a.popularity}\n end", "def list_songs\n # print songs out in alphabetical order with index\n # 'each.with_index' allows for index to start at 1\n Song.all.uniq.sort { |title1, title2| title1.name <=> title2.name }.each.with_index(1) do |song, i|\n puts \"#{i}. #{song.artist.name} - #{song.name} - #{song.genre.name}\"\n end\n end", "def popular_book\n books = Hash.new(0)\n @orders.each { |order| books[order.book_name] += 1 } \n book = books.max_by{ |key, value| value }.first\n end", "def print_album album\n puts 'Album Artist is ' + album.artist.to_s\n puts 'Album Title is ' + album.title.to_s\n puts 'Genre is ' + album.genre.to_s\n puts $genre_names[album.genre]\n print_tracks(album.tracks)\nend", "def print_album album\n\n # print out all the albums fields/attributes\n # Complete the missing code.\n\n\tputs 'Genre is ' + album.genre.to_s\n\tputs $genre_names[album.genre]\n\t# print out the tracks\n\nend", "def sort_album\n @ole.SortAlbum\n end", "def release_groups\n return @artist_data[\"release-groups\"].sort_by { |hash| hash[\"first-release-date\"]}\n end", "def popularity_list\n averageRatingMoviesHash = {}\n @ratedMoviesHash.each {|movie, ratings| averageRatingMoviesHash[movie] = average(ratings) * (2 ** (@ratedMoviesHash[\"#{movie}\"].length / (@allUsersHash.keys.length).to_f)) - 1}\n ratedMoviesArray = averageRatingMoviesHash.sort_by { |movie, aveRating| -aveRating }\n popularityList = []\n ratedMoviesArray.each {|item| popularityList.push(item[0].to_i)} \n return popularityList\n\tend", "def who_ordered_best_book\n\t\tbooks = Hash.new(0)\n\t @orders.each { |order| books[order.book.title] += 1 }\n\t books = books.sort_by(&:last).take(3).map(&:first)\n\t readers = []\n\t @orders.each { |order| readers << order.name if books.include? order.book.title }\n\t readers.uniq.size\n\t end", "def get_genre_list\n @genre_names = Genre.select('name')\n end", "def genre_list\n {\"1\" => 'シーバス', \"2\" => 'バス', \"3\" => \"青物\",\n \"4\" => \"フラットフィッシュ\", \"6\" => \"アジ\"}\n end", "def albums\n @albums ||= response.albums.uniq(&:name)\n end", "def list_songs_by_genre\n puts \"Please enter the name of a genre:\"\n input = gets.strip #accepts user input.\n\n if genre = Genre.find_by_name(input)\n genre.songs.sort{|a, b| a.name <=> b.name}.each_with_index do |s, i|\n puts \"#{i+1}. #{s.artist.name} - #{s.name}\"\n # expect($stdout).to receive(:puts).with(\"Please enter the name of a genre:\")\n #expect($stdout).to receive(:puts).with(\"1. Real Estate - It's Real\")\n end\n end\n end", "def search_albums_by_genre albums\r\n print_album_genres(albums)\r\n puts('Select Album ID')\r\n id = read_integer_in_range('Enter number: ', 0, albums.count-1 )\r\n\r\n print_album_title_and_tracks(albums[id])\r\n return albums[id] \r\nend", "def print_album album\r\n\tputs album.title\r\n\tputs album.artist\r\n\tputs 'Genre is ' + album.genre.to_s\r\n\tputs $genre_names[album.genre]\r\n\tprint_tracks(album.tracks)\r\nend", "def three_genres\n genres.limit(3).pluck(:name)\n end", "def number_of_albums()\n return albums.length\n end", "def number_of_albums()\n return albums.length\n end", "def frequencies_of(option)\n frequencies = Hash.new(0)\n if option == :artists\n artists.each do |artist|\n frequencies[artist] += 1\n end\n frequencies\n elsif option == :genres\n genres.each do |genre|\n frequencies[genre] += 1\n end\n frequencies\n elsif option == :tracks\n tracks.each do |track|\n frequencies[track] += 1\n end\n frequencies\n end\n end", "def get_genres\n \tRails.cache.fetch(\"tmdb/genres_list\", expires_in: 24.hours) do\n \t\taction = \"genre/movie/list\"\n \t\targument = \"&language=en-US\"\n\t\t\tresponse = call_api(action, argument)\n\t\t\t@result = Hash.new\n\t\t\tresponse[\"genres\"].each do |genre|\n\t\t\t\t@result[genre[\"id\"]] = genre[\"name\"]\n\t\t\tend\n\t\t\t@result\n\t\tend\n\tend", "def grams\n @frequencies.keys\n end", "def genres\n Genre.all.select{|genre| genre.book == self }\n end", "def popularities\n result = {}\n @courses.each do |cl|\n result[cl.name] = Hash.new(0)\n end\n @students.each do |student|\n student.each_with_index do |course_choice, i|\n result[course_choice.name][i] += 1\n end\n end\n result\n end", "def genre; end", "def genre; end", "def list_songs\n self.sorted_list_songs.each_with_index do |song, idx|\n puts \"#{(idx + 1).to_s}. #{song.artist.name} - #{song.name} - #{song.genre.name}\"\n end\n end", "def genres\n # look for a local variable called songs\n # look for a method on self. called songs => self.songs\n # looks up the parent chain\n self.songs.map do |song|\n song.genre\n end\n end", "def top_albums \n lfm_path = \"artist.topAlbums&artist=#{@name}\"\n lfm_data = LastFm::fetch_data(lfm_path)\n return Album.create_from_hash(Hash.from_xml(lfm_data)['lfm']['topalbums']['album'])\n end", "def popularity_list\n @popularity_list=@movie_index.sort_by { |x| -x[1].size }.col(0) if @popularity_list.nil?\n @popularity_list\n end", "def genre\n @ole.Genre\n end", "def collection_object_count_by_classification(scope = nil)\n\n return [] if scope.nil?\n specimen_data = {}\n lot_data = {}\n\n total_index = {}\n\n scope.each do |n|\n a = ::Queries::CollectionObject::Filter.new(project_id: sessions_current_project_id, taxon_name_id: n.id, descendants: true, collection_object_type: 'Specimen').all\n b = ::Queries::CollectionObject::Filter.new(project_id: sessions_current_project_id, taxon_name_id: n.id, descendants: true, collection_object_type: 'Lot').all\n\n ts = CollectionObject.where(id: a).calculate(:sum, :total)\n tl = CollectionObject.where(id: b).calculate(:sum, :total)\n\n if (ts > 0) || (tl > 0)\n lot_data[n.cached] = tl\n specimen_data[n.cached] = ts\n total_index[n.cached] = ts + tl\n end\n\n end\n\n # We only need to sort 1 pile!\n specimen_data = specimen_data.sort{|a,b| total_index[b[0]] <=> total_index[a[0]] }.to_h\n\n return {\n total_index:,\n data: [\n { name: 'Specimen', data: specimen_data},\n { name: 'Lot', data: lot_data}\n ]\n }\n end", "def initialize(name, artist, genre)\n @name=name\n @artist=artist\n @genre=genre\n @@artists << self.artist\n @@genres << self.genre\n @@count+=1\n # @@count +=self\n end" ]
[ "0.69131875", "0.68326956", "0.6804614", "0.6798646", "0.67868227", "0.6784776", "0.67323387", "0.6715794", "0.67088675", "0.6705654", "0.6697351", "0.66789454", "0.6668431", "0.6651489", "0.6648197", "0.6564751", "0.65614504", "0.65325636", "0.65294313", "0.6522338", "0.6519251", "0.6512402", "0.646528", "0.646528", "0.646528", "0.646528", "0.646528", "0.6420329", "0.6381475", "0.6381009", "0.6375011", "0.631704", "0.6283491", "0.628195", "0.61632836", "0.6133647", "0.61323994", "0.61212313", "0.6040314", "0.6010196", "0.59943765", "0.5937528", "0.58923376", "0.58718944", "0.5867562", "0.5826758", "0.5795802", "0.57437617", "0.5732035", "0.57088095", "0.5690853", "0.56814677", "0.567589", "0.5653613", "0.5642342", "0.56411606", "0.56223834", "0.562115", "0.5618274", "0.56134444", "0.56077987", "0.5601898", "0.55901164", "0.5588899", "0.5578521", "0.55656654", "0.5549607", "0.55379426", "0.5524582", "0.5521275", "0.5518703", "0.55178654", "0.55044365", "0.5499996", "0.54956573", "0.5476093", "0.54729396", "0.5470834", "0.54509056", "0.5449096", "0.5437109", "0.54187685", "0.54050106", "0.5403712", "0.5399567", "0.5399567", "0.5396077", "0.5383196", "0.537016", "0.5357262", "0.5353878", "0.53537047", "0.53537047", "0.5343114", "0.5327679", "0.5317059", "0.5310403", "0.5306923", "0.5298166", "0.52927524" ]
0.697417
0
Returns a sorted object of the top five years with the most number of albums.
def year_ranking ranked_albums = SortCollection.sort_albums('year') render json: ranked_albums.sort_by(&:last).reverse[0...5].to_h, status: 200 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def most_popular_group_per_year\n sql = <<-SQL\n -- SELECT year, category FROM guests GROUP BY year, category ORDER BY count(category), year DESC\n SELECT DISTINCT year, category, count(category) FROM guests GROUP BY year, category ORDER BY count(category) DESC\n SQL\n DB[:conn].execute(sql)\nend", "def year_with_most_guests\n sql = <<-SQL\n SELECT year FROM guests GROUP BY year\n ORDER BY count(*) DESC LIMIT 1;\n SQL\n DB[:conn].execute(sql)[0][0]\nend", "def ordered_year_count\n \tFishCount.for_year(Date.today.year).order(count_date: :desc)\n end", "def most_popular_group_per_year\n sql = <<-SQL\n WITH mp AS (\n SELECT show_year,\n guest_group,\n COUNT(id) as group_count\n FROM guest_appearances\n GROUP BY guest_group, show_year)\n SELECT show_year, guest_group, MAX(group_count) as frequency\n FROM mp\n GROUP BY show_year;\n SQL\n DB[:conn].execute(sql).each {|record| puts \"#{record[0]}: #{record[1]}, #{record[2]}.\"}\nend", "def calculate_most_common_year\n self.calculate_plays_by_year.sort_by{ |year, times_played| times_played }.last\n end", "def year_with_most_guests\n sql = <<-SQL\n SELECT show_year, count(id) AS guest_count\n FROM guest_appearances\n GROUP BY show_year\n ORDER BY guest_count DESC\n LIMIT 1;\n SQL\n mg = DB[:conn].execute(sql)[0]\n puts \"#{mg[0]}: #{mg[1]} guests.\"\nend", "def find_most_played_songs\n top_songs_with_play_count_pair = self.lib.songs.reject do |song|\n #this line is describing records it will get rid of\n (!song.metadata.has_key?('play_count')) or (song.metadata['play_count'] == nil)\n end\n\n top_songs_played_sorted = top_songs_with_play_count_pair.sort do |a, b| \n b.metadata['play_count'].to_i <=> a.metadata['play_count'].to_i\n end\n\n top_songs_played = top_songs_played_sorted.first(5)\n song_names_of_top_played = top_songs_played.collect {|song| song.metadata['name']} \n end", "def top_five_artists(db, genre_name)\n db.execute \"SELECT artists.name, COUNT(*) as c\n FROM tracks\n JOIN albums ON albums.id = tracks.album_id\n JOIN artists ON artists.id = albums.artist_id\n JOIN genres ON tracks.genre.id = genres.id\n WHERE genres.name = '#{genre_name}'\n GROUP BY artists.name\n ORDER BY c DESC\n LIMIT 5\n \" # TODO: return list of top 5 rock artists\nend", "def top_albums \n lfm_path = \"artist.topAlbums&artist=#{@name}\"\n lfm_data = LastFm::fetch_data(lfm_path)\n return Album.create_from_hash(Hash.from_xml(lfm_data)['lfm']['topalbums']['album'])\n end", "def most_popular_profession_by_year\n sql = <<-SQL\n SELECT year, occupation FROM guests GROUP BY year, occupation ORDER BY count(occupation) DESC\n SQL\n DB[:conn].execute(sql)\nend", "def popular_group_by_year\n sql = <<-SQL\n SELECT year, guest_group, MAX(num)\n FROM (\n SELECT year, guest_group, COUNT(*) AS num\n FROM guests\n GROUP BY year, guest_group\n )\n GROUP BY year;\n SQL\n DB[:conn].execute(sql)\nend", "def top_5_leagues\n league_names = []\n leagues = UserLeague.all.collect{|league| league.league_id}\n most_common_value = leagues.uniq.sort_by{ |i| leagues.count( i ) }.reverse[0..4]\n most_common_value.each do |league|\n league_names << get_league_name_by_id(League.find(league).api_league_id)\n end\n league_names\nend", "def top_5_teams\n team_names = []\n teams = UserTeam.all.collect{|team| team.team_id}\n most_common_value = teams.uniq.sort_by{ |i| teams.count( i ) }.reverse[0..4]\n most_common_value.each do |team|\n team_names << get_team_name_by_id(Team.find(team).api_team_id)\n end\n team_names\nend", "def birthdayCakeCandles(ar)\n ar.sort!\n biggest = ar[-1]\n ar.count(biggest)\nend", "def topAlbums(artist)\n\tartistinfo = HTTParty.get(\"http://ws.audioscrobbler.com/2.0/?method=artist.gettopalbums&artist=#{artist}&api_key=#{API_KEY}&format=json\")\n\treturn artistinfo\nend", "def top_songs(n = 3)\n top_list = @tracks.sort_by {|s| s.play_count}.reverse\n return top_list[0..n-1].compact\n end", "def count_people_ordered_most_popular_books(count_of_popular_books)\n most_popular_books = most_popular\n people = Array.new\n most_popular_books[0..count_of_popular_books].each do |book|\n @readers.each do |name, value|\n value.orders.detect do |order|\n# p \"order.book=\"+order.book.to_s\n# p \"book=\"+book.title.to_s\n p \"Book.class= \"+order.book.class.to_s\n people << value if book == order.book\n end\n end \n end\n return people.size #maybe a good idea return all people?\n end", "def most_popular_profession_per_year\n sql = <<-SQL\n WITH mp AS (\n SELECT show_year,\n guest_occupation,\n \tCOUNT(id) as occupation_count\n FROM guest_appearances\n GROUP BY guest_occupation, show_year)\n SELECT show_year, guest_occupation, MAX(occupation_count) as frequency\n FROM mp\n GROUP BY show_year;\n SQL\n DB[:conn].execute(sql).each {|record| puts \"#{record[0]}: #{record[1]}, #{record[2]}.\"}\nend", "def most_popular_for_year\n limit = set_limit\n @names = Year.most_popular_for_year(params[:year], limit)\n render json: @names, each_serializer: YearNameSerializer, :callback => params[:callback]\n end", "def top_books\n if orders.empty?\n puts \"There are not orders...\"\n else\n @orders.group_by(&:book).values.max_by(&:size).first.book\n end\n end", "def most_popular\n @books.sort_by {|book| book.rate}\n end", "def season_with_most_games\n seasons = @games.group_by { |game| game.season }\n seasons.max_by { |season, games| games.count }.first\n end", "def top_students(grade_hash, number_of_students)\n sorted_hash = averages(grade_hash).sort_by {|name, grade| grade}\n #reverse! takes the items in an array and reverses them without making a new array\n sorted_hash.reverse!\n top_array = []\n sorted_hash.each do |key, value|\n top_array << key\n end\n top_array.take(number_of_students)\nend", "def book_with_most_bookmarks\n books.max_by { |book| book.bookmarks.size }\n end", "def get_most_radlibs_created(num_users = 5)\n get_most_generic_for_users(DOCS[:most_prolific], num_users)\n end", "def top_students(grade_hash, number_of_students)\nsorted_hash = averages(grade_hash).sort_by {|name, grade| grade}\nsorted_hash.reverse!\ntop_array = []\nsorted_hash.each do |k, v|\n top_array << k\nend\ntop_array.take(number_of_students)\nend", "def genre_ranking\n ranked_albums = SortCollection.sort_albums('genre')\n render json: ranked_albums.sort_by(&:last).reverse.to_h, status: 200\n end", "def top_albums(artist)\n get(:standard, {:method => \"artist.getTopAlbums\", :artist => artist})\n end", "def top_5\n count = @sentence.blips.group(:body).distinct.count\n percent = count.each {|k, v| count[k] = v / @sentence.blips_count.to_f }\n statistics = percent.sort_by { |k, v| v }.reverse[0..4].flatten.each { |k, v| puts \"#{k}: #{v}\" }\n end", "def top_readers\n readers_with_duplicates = []\n self.articles.each { |article| readers_with_duplicates << article.readers }\n\n readers_with_duplicates.flatten!\n readers = readers_with_duplicates.uniq\n frequency = Hash.new(0)\n readers_with_duplicates.each { |r| frequency[r] += 1 }\n array = frequency.sort_by { |key, value| value }\n return [array[-1], array[-2], array[-3]]\n\n end", "def top_ten\n sorted = @person_array.sort { |a, b| a.awesomeness <=> b.awesomeness }\n sorted.reverse!\n return sorted[0..9] if sorted.size >= 10\n return sorted\n end", "def popular_profession_by_year\n sql = <<-SQL\n SELECT year, google_knowledge_occupation, MAX(num)\n FROM (\n SELECT year, google_knowledge_occupation, COUNT(*) AS num\n FROM guests\n GROUP BY year, google_knowledge_occupation\n )\n GROUP BY year;\n SQL\n DB[:conn].execute(sql)\nend", "def getTop10AwesomePeeps\n @persons.sort!\n return @persons[-10..-1]\n end", "def top_students(grade_hash, number_of_students)\n averages(grade_hash)\n .sort_by { |key, value| value }.reverse\n .map { |key, value| key}\n .take(number_of_students)\nend", "def top_students(grade_hash, number_of_students)\n averages(grade_hash)\n .sort_by { |key, value| value}.reverse\n .map { |key, value| key }\n .take(number_of_students)\nend", "def top_students(grade_hash, number_of_students)\n averages = averages(grade_hash)\n\n result = averages.sort_by do |key, value|\n value\n end\n\n students = result.map do |key, value|\n key\n end\n\n non_reversed = students.last(number_of_students)\n\n reversed = non_reversed.reverse\nend", "def top_students(grade_hash, number_of_students)\n averages(grade_hash).sort_by { |k, v| v}.reverse.map{ |k, v| k }.take(number_of_students)\nend", "def fetch_newest_album!\n req = @fetcher.call('get', 'https://pupper.bandcamp.com/album/' + @@album_slug)\n doc = Nokogiri::HTML(req.body)\n\n @@album_id = album_id_from_doc(doc)\n @@album_date = date_published_from_doc(doc)\n end", "def top_students(grade_hash, number_of_students)\n scores = averages(grade_hash)\n shortlist = scores.sort_by{|k,v| v}.reverse.take(number_of_students)\n names = shortlist.map{|k,v| k}\nend", "def top_albums(tag)\n get(:standard, {:method => \"tag.getTopAlbums\", :tag => tag})\n end", "def most_popular_venue\n venues = @games.group_by { |game| game.venue}\n venues.max_by { |venue, games| games.count }.first\n end", "def authors_top\n\t\t\[email protected]('musicthoughts.top_authors($1)', [20])\n\t\tend", "def top_three_recipes \n a = recipes.sort_by do |i| \n i.rating \n end \n a[-3..-1]\n end", "def songs_by_album\n return @count_by_album if @count_by_album\n\n return get_base_relation(true, false)\n .group('albums.id')\n .order('albums.name')\n .pluck('albums.id' , 'albums.name' , 'count(*)')\n\n end", "def top_five\n order = params[:order].try(:downcase)\n ascending = order == 'asc'\n\n @foos = Foo.order(:foo_date).reverse_order.to_a.take(5)\n @foos.reverse! if ascending\n\n render json: @foos\n end", "def find_most_popular(array)\n url_hash = {}\n \n array.each do |url|\n if url_hash[url]\n url_hash[url] += 1\n else\n url_hash[url] = 1\n end\n end\n \n max_url = url_hash.max_by(1) do |url, count|\n count\n end\n \n return max_url[0][0]\nend", "def calculate_most_viewed_pages\n pages_with_frequency = calculate_page_frequency\n pages_with_frequency.sort_by { |_key, value| value }.reverse.to_h\n end", "def call()\n Population.left_joins(:logz).group(:year).count(\"the_logz.year\").sort_by{|k, v| v}.reverse\n end", "def how_orders_of_three_most_popular_books\n books_count.each {|title, times| puts \"The most popular books, '#{title}', ordered #{times}\" if times == books_count.values.max }\n end", "def top_three_recipes\n recipe_cards.max_by(3) {|recipe_cards| recipe_cards.rating}\n end", "def who_ordered_best_book\n\t\tbooks = Hash.new(0)\n\t @orders.each { |order| books[order.book.title] += 1 }\n\t books = books.sort_by(&:last).take(3).map(&:first)\n\t readers = []\n\t @orders.each { |order| readers << order.name if books.include? order.book.title }\n\t readers.uniq.size\n\t end", "def findTopMovies(actor, top_number=100) \r\n movie_array = []\r\n\r\n actor.film_actor_hash.each_key {|key| movie_array.push(key)}\r\n\r\n return movie_array.take(top_number)\r\nend", "def filter_articles(articles)\n include PopularitySearch\n #this isn't fair to more recent articles\n popularity_cutoff = 300\n articles.each do |article|\n article[:twitter_pop] = twitter_popularity(article[:url])\n end\n articles.select do |article|\n article[:twitter_pop] > popularity_cutoff\n end\n articles = articles.sort_by{|article| article[:twitter_pop]}.reverse\n return articles[0..2] #only pick the top 3 if there's more than 3\nend", "def year_with_maximum_population(data)\n # Get a calenader with unique years\n calendar = data.flatten.uniq.sort\n delta_memo = Hash.new(0)\n\n # Save the delta for each year\n data.each_with_index do |person, i|\n delta_memo[person[0]] += 1\n delta_memo[person[1]] -= 1\n end\n\n # Associate calendar year with delta\n calendar.each_with_index do |year, i|\n calendar[i] = [year, delta_memo[year]]\n end\n\n max_pop_year = calendar[0][0]\n current_population = 0\n max_population = 0\n\n # Running sum of max population\n # Set year on max_population\n calendar.each do |year|\n current_population += year[1]\n\n if current_population > max_population\n max_population = current_population\n max_pop_year = year[0]\n end\n end\n\n max_pop_year\nend", "def top_3\n freq_hash = each_with_object(Hash.new(0)) { |v, h| h[v] += 1 }\n freq_hash.sort_by { |k, v| -v }.first(3).map(&:first)\n end", "def sort_by_year(array)\n array.sort! { |a, b| a.year <=> b.year }\n end", "def most_successfull(nth, year, file)\n filepath = File.dirname(__FILE__) + file\n csv_options = {col_sep:',',quote_char:'\"', encoding: \"ISO8859-1\"}\n\n films = []\n date = CSV.foreach(filepath, csv_options) do |row|\n films << { name: row[0], year: row[1].to_i, earnings: row[2].to_i }\n end\n\n\n films_before_year = films.select { |film| film[:year] < year }\n film_before_year_best_sales = films_before_year.sort_by { |film| - film[:earnings]}\n film_most_successfull = film_before_year_best_sales.take(nth)\nend", "def top_10 (matches)\n matches.sort_by! { |match| match['score'] }.reverse[:10]\nend", "def top_users(limit = 10)\n @users.sort_by{|user_id,user| -user.score}.first(limit).map do |t|\n {\n :id => t.first,\n :score => t.last.score,\n :common_tracks_count => t.last.common_tracks_count,\n :total_tracks_count => t.last.total_tracks_count\n }\n end\n end", "def sort_popular_jobs\n Application.group(:job).count.sort_by do |job|\n job[1]\n end.reverse\n end", "def sort_by_most_recently_popular(sources)\n\t\tsorted = sources.sort_by do |source|\n\t\t\t(ONE_VOTE * source.rating) + source.created_at.to_i\n\t\tend.reverse\n\tend", "def guest_with_most_appearances(db)\n db.execute(\n \"SELECT guest_name, COUNT(appearance_date) \n FROM guests \n GROUP BY guest_name \n ORDER BY COUNT(appearance_date) DESC \n LIMIT 1\")\nend", "def release_groups\n return @artist_data[\"release-groups\"].sort_by { |hash| hash[\"first-release-date\"]}\n end", "def most_common_nationalities_list\n nationalities_hash = self.players.group_by{\n |player| player.nationality\n }\n count_hash={}\n nationalities_string = nationalities_hash.map do |nationality, players|\n # puts \"Number of players from \" + nationality + \": \" + players.count.to_s\n count_hash[nationality]=players.count\n end\n count_hash.sort_by {|nationality, num| num}.reverse\n end", "def top_students(grade_hash, number_of_students)\n outArray = []\n grade_hash.each do |name, scores|\n sum, n = 0, 0\n scores.each do |x|\n n += 1\n sum += x\n end\n outArray.push([sum/n, name])\n end\n final_answer = []\n outArray.sort.reverse[0...number_of_students].each do |grade,name|\n final_answer.push(name)\n end\n return final_answer\nend", "def get_most_popular_radlibs(num_radlibs = 5)\n get_most_generic_for_radlibs(DOCS[:most_popular_radlibs], num_radlibs)\n end", "def sort_by_popularity\n @song_data = @song_data.sort_by {|x| [-x[:plays], x[:index]] }\n end", "def year_with_maximum_population(data)\n memo = {}\n\n data.each do |p1|\n current_birth_year = p1[0]\n next if memo[current_birth_year]\n\n count = 0\n # Person is alive in that year if they were born before the current year\n # and they died after the current year\n data.each do |p2|\n if p2[0] <= current_birth_year && current_birth_year <= p2[1]\n count +=1\n end\n end\n\n memo[current_birth_year] = count\n end\n\n year_of_max = nil\n current_population = 0\n memo.each do |k, v|\n if v > current_population\n current_population = v\n year_of_max = k\n end\n end\n\n year_of_max\nend", "def rank_top_teams # DO NOT USE THIS METHOD, outdated, slow\n @top_teams = {}\n @top_teams = Score.in_challenge(self.id).teams_in_all_divisions.limit(5).\n order(\"sum_points DESC, MAX(#{Score.table_name}.\n earned_at) DESC\").sum(:points) \n return @top_teams\n end", "def sort(companies)\n companies.sort_by do |company|\n -company.size\n end \nend", "def season_with_fewest_games\n seasons = @games.group_by { |game| game.season }\n seasons.min_by { |season, games| games.count }.first\n end", "def artist_years\n self.artists.reduce(0) do |accumulator, artist|\n accumulator += artist.years_active\n end\n end", "def year\n Spotify.album_year(pointer)\n end", "def number_of_albums()\n return albums.length\n end", "def number_of_albums()\n return albums.length\n end", "def ordered_by_qualifications (collection)\n collection.sort_by {|x| [x[:years_of_experience], x[:github_points]]}.reverse!\nend", "def top_ten_list(category)\n # Select all of category from work instances\n work_by_category = Work.all.select { |work| work.category.downcase == \"#{category}\" }\n # Return max by vote count for top 10\n return work_by_category.max_by(10) { |work| work.votes.length }\n end", "def top_10_fans\n users_array = UserTeam.all.collect{|user| user.user_id}\n most_common_value = users_array.uniq.sort_by{ |i| users_array.count( i ) }.reverse\n biggest_fans = most_common_value.map {|user| User.find(user).name}[0..9]\n users_teams_count = most_common_value.map {|user| User.find(user).teams.count}[0..9]\n counter = 0\n return_hash = {}\n until counter == biggest_fans.length do\n return_hash[biggest_fans[counter].to_s] = users_teams_count[counter].to_s\n counter += 1\n end\n return_hash\nend", "def show_most_popular\n @card_sets = CardSet.order(\"impressions_count DESC\")[0..19]\n end", "def contributors_top\n\t\t\[email protected]('musicthoughts.top_contributors($1)', [20])\n\t\tend", "def this_year(limit: 5, markdown: false, rank: :top) \r\n \r\n build_table sort_coins('year', limit: limit, rank: rank), markdown: markdown\r\n\r\n end", "def top_three_recipes\n recipes_sorted_by_rating.reverse[0..2]\n end", "def get_top_games\n game_count = {}\n self.subscriptions.each do |subscription|\n game_id = Channel.find(subscription.channel_id).game_id\n game_count[game_id] ||= 0\n game_count[game_id] += 1\n end\n game_count.sort_by {|key, value| value}.reverse.to_h.keys\n end", "def sorted\n @@all = @@all.sort_by(&:year)\n end", "def top_three_recipes\n self.find_user_recipe_cards.sort_by{|rcard| rcard.rating}.reverse![0..2]\n end", "def birthdayCakeCandles(ar)\n max = ar.max\n count = ar.count{|x| x == max}\nend", "def least_popular_for_year\n limit = set_limit\n @names = Year.least_popular_for_year(params[:year], limit)\n render json: @names, each_serializer: YearNameSerializer, :callback => params[:callback]\n end", "def popular_book\n books = Hash.new(0)\n @orders.each { |order| books[order.book_name] += 1 } \n book = books.max_by{ |key, value| value }.first\n end", "def album_count\n return @albums.length\n end", "def tag_with_highest_count\n Tag.order(count: :desc).first\n end", "def top_albums(user, options={})\n get(:standard, {:method => \"user.getTopAlbums\", :user => user}.merge(options))\n end", "def sort_games\n games.order(:score).limit(5)\n end", "def personal_top_three\n scores.max([scores.length, 3].min)\n end", "def top_5\n company_impressions = Impression.where(\n \"created_at > ? AND created_at < ? AND action_name = ? AND controller_name = ?\",\n 1.weeks.ago.to_date.at_beginning_of_day,\n Date.today.tomorrow.at_beginning_of_day,\n 'stat_show',\n 'companies'\n )\n\n company_ids = company_impressions.map{ |si| si.impressionable_id }\n company_id_counts = Hash.new(0)\n company_ids.each{|si| company_id_counts[si] += 1}\n company_id_counts.sort_by {|key, value| value}\n\n # Order company_id_counts by count\n sortable = company_id_counts.map{|k, v| [v, k]}\n sortable.sort!.reverse!\n\n companies = sortable.map{ |count, id| Company.find(id) }\n\n ok_companies = []\n companies.each do |s|\n if s.all_departments.map(&:id).include? current_user.department_id\n ok_companies.push(s)\n end\n end\n\n ok_companies.each { |s| s.stat_count = company_id_counts[s.id] }\n\n respond_with ok_companies[0..4]\n end", "def list_albums\n output = ''\n @albums.sort.each { |a|\n output += a + \"\\n\"\n #puts a\n }\n return output\n end", "def sort_by_most_recently_popular(experiences)\n\t\tsorted = experiences.sort_by do |experience|\n\t\t\t(ONE_VOTE * experience.rating) + experience.created_at.to_i\n\t\tend.reverse\n\tend", "def top_students(grade_hash, number_of_students)\n grade_hash.transform_values{|score| score.reduce(0,:+)/(score.length)}.sort_by {|student,score| score}.reverse.to_h.keys.first(number_of_students)\nend", "def longest_review\n Review.order_reviews.select do |r|\n r.album == self\n end[-1]\n end", "def get_top_by_tag(tags, options={})\n api_response = @api_client.make_api_request(:GET, \"artist/byTag/top\", {:tags => tags}, options)\n @api_client.artist_digestor.nested_list_from_xml(api_response.content.tagged_results, :tagged_item, :tagged_results)\n end", "def most_popular_for_year_and_gender\n limit = set_limit\n @names = Year.most_popular_for_year_and_gender(params[:year], params[:gender], limit)\n render json: @names, each_serializer: YearNameSerializer, :callback => params[:callback]\n end" ]
[ "0.67089105", "0.661556", "0.64398545", "0.64351267", "0.6414816", "0.6402951", "0.635556", "0.63263845", "0.6281088", "0.6226375", "0.6107117", "0.60529023", "0.6019344", "0.59689695", "0.5922062", "0.5911997", "0.58832455", "0.5883013", "0.5873894", "0.5871405", "0.58676356", "0.5848595", "0.5800567", "0.5799991", "0.57521635", "0.57425267", "0.5738196", "0.57353574", "0.5730706", "0.5716119", "0.57111937", "0.5687807", "0.56808966", "0.56626445", "0.56327766", "0.56262946", "0.5621311", "0.55986756", "0.55942243", "0.5579468", "0.5569022", "0.5549521", "0.55291563", "0.5526958", "0.55112845", "0.55091846", "0.55031234", "0.5497411", "0.5496415", "0.54853326", "0.5483825", "0.54615384", "0.5455287", "0.54462767", "0.54448044", "0.5439317", "0.54349893", "0.54275984", "0.5423646", "0.54234445", "0.54202694", "0.54196686", "0.54165155", "0.5411548", "0.5408365", "0.5406815", "0.54016083", "0.5396584", "0.5390741", "0.53862125", "0.53637344", "0.535952", "0.5350081", "0.5346458", "0.5346458", "0.5339603", "0.5331677", "0.532367", "0.53223985", "0.5318631", "0.53108776", "0.5309813", "0.530514", "0.5296845", "0.52926517", "0.52913165", "0.5288934", "0.527811", "0.5268005", "0.52676684", "0.52665496", "0.5263997", "0.5263842", "0.5262685", "0.52623725", "0.5259406", "0.5258639", "0.5257061", "0.52414596", "0.522154" ]
0.69608057
0
before_filter :api_graph, only: [:select_friend, :publishing_post]
def start destroy_session_customer end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def before_filter; end", "def run_filters\n set_user\n authorize\n end", "def friend_request\n\nend", "def facebook\n\n end", "def facebook\n end", "def index\n # byebug\n if params[:requester] == \"sent\"\n @friend_requests = current_user.friend_requests_as_requester\n else\n @friend_requests = current_user.friend_requests_as_requested\n end\n filter_friend_requests\n end", "def index\n \n if params[:my_feed]\n @friend_ids = current_user.friends.pluck(:id)\n @posts = Post.where(\"user_id IN (?) OR user_id = ?\", @friend_ids, current_user.id).order(created_at: :desc)\n else\n @posts = Post.order(created_at: :desc)\n end\n\n @post = Post.new\n @friend_request = FriendRequest.new\n @comment = Comment.new\n end", "def connection_filter\n if params[:name].present?\n @friends = current_user.friends.by_name(params[:name]) + current_user.inverse_friends.by_name(params[:name])\n @friends.delete(current_user)\n end\n @friends = @friends.paginate(:page => params[:page], :per_page => 10)\n end", "def before_request\n end", "def filter_redirect; end", "def filter_redirect; end", "def facebook_actions\n self.publish_on_facebook\n self.notify_friends\n\n if Rails.env.production? and LevelUserLink.count % 1000 == 0\n FacebookFeedService.delay.publish_level_count(LevelUserLink.count)\n end\n end", "def after_filter; end", "def logged_in_to_facebook_and_app_authorized\n if ensure_application_is_installed_by_facebook_user \n # filter_parameter_logging :fb_sig_friends # commenting out for now because it fails sometimes\n end\n end", "def private_filter\n post = Post.find(params[:id])\n if post.nil?\n flash[:error] = \"Post not found\"\n redirect_to home_url\n end\n\n if !post.has_access(current_user)\n flash[:error] = \"Post is private\"\n redirect_to home_url\n end\n end", "def index\n #redirect_to \"/gossips/9\" and return\n\n # TODO: move handling facebook requests from here\n Rails.logger.debug(\"dbg:1 #{params[:request_ids]}, clasa: #{params[:request_ids].class}\")\n if params[:request_ids]\n rid = params[:request_ids].split(\",\").last\n Rails.logger.debug(\"dbg:1 #{rid}, clasa: #{rid.class}\") \n \n\n if !user_signed_in?\n facebookRequest = FacebookRequest.where(rid: rid).first \n else\n facebookRequest = FacebookRequest.where(rid: rid, to_user_id: current_user.uid).first\n facebookRequest.click_date = Time.now\n facebookRequest.app_request_type = params[:app_request_type]\n facebookRequest.ref = params[:ref]\n facebookRequest.save\n end\n\n path = File.join(SITE_URL, facebookRequest.url)\n # URI.join(SITE_URL, facebookRequest.url)\n redirect_to path and return\n end\n\n if !user_signed_in? \n redirect_to \"/welcome\" and return\n end\n\n refresh_notifications\n\n @gossips = current_user.gossips_feed.order(\"created_at desc\") .page(params[:page]).per_page(10)\n @gossips.each do |g|\n g.last_comments = Comment.where(\"gossip_id = ?\", g.id).order(\"created_at desc\").limit(COMMENTS_PER_GOSSIP).reverse\n\n end\n\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @gossips }\n # end\n end", "def show\n# @friendslist = Friendslist.find(params[:id])\n\n \n\n @friendslist = Array.new \n # if session[\"fb_access_token\"].present?\n\n @user = User.find(params[:id])\n\n graph = Koala::Facebook::GraphAPI.new(session[\"fb_access_token\"])\n @friendslist = graph.get_connections('me', \"friends\",:fields =>\"name,gender,email,relationship_status\")\n \n# graph.put_connections(\"me\", \"notes\", :subject => \"eShopVite\", :message => \"Message from eShopVite to register\")\n\n\n # if current_user\n # graph = Koala::Facebook::GraphAPI.new(@token)\n # @friendslist = graph.get_connections(\"me\", \"friends\")\n # end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @friendslist }\n end\n end", "def block_friend\n end", "def filters\n end", "def facebook\n handle_auth \"facebook\"\n end", "def index # Home\n posts = Post.where(is_public: true).or(Post.where(user: current_user.friends)).or(Post.where(user: current_user))\n posts = posts.order(\"created_at DESC\")\n\n posts = add_image_and_user_to_post(posts)\n\n render json: posts, status: :ok\n end", "def facebook\n handle_oauth\n end", "def filter_object\n # redirect_to(root_url, :notice => \"Do not have permission\") and return\n end", "def feed\n \n # Retrieve postings that match the given conditions\n @postings = getPostings(params)\n @writeability = true\n if params.has_key?(:group_id) && !current_user.is_member_of?(params[:group_id])\n @writeability = false\n end\n \n respond_to do |format|\n format.js\n end\n \n end", "def filter\n params.merge!(user_id: session[:user_id])\n case params[:filter_select]\n when gender_and_location_filter\n @posts = Post.filter_by_gender(post_filter_params).filter_by_location(post_filter_params)\n when pace_filter\n @posts = Post.filter_by_pace(post_filter_params)\n when age_filter\n @posts = Post.filter_by_age(post_filter_params)\n when time_filter\n @posts = Post.filter_by_time(post_filter_params)\n when commitment_filter\n @posts = Post.filter_by_commitment(post_filter_params)\n end\n\n render json: @posts, each_serializer: PostSerializer\n end", "def index\n @posts = Post.all.where('tipo = ?','url').order('points DESC')\n Contribution.current_user = current_api_user\n render json: @posts.as_json(except: [:post_id, :contribution_id, :updated_at], :methods => [:author, :liked])\n end", "def before_filter\n if current_user\n true\n end\n end", "def reject_friend_request\n if remove_any_connection_between(params['user_id'], params['friend_id'])\n render_json :entry => {}\n end\n end", "def before_action \n end", "def filter_self\n if @user && !current_user.can_edit?(@user)\n respond_to do |format|\n format.html {\n render :nothing => true, :status => 403\n }\n format.json {\n render :json => {:status => 'failure'}, :status => 403\n }\n end\n end\n end", "def on_pre_request( request )\n end", "def index\n if logged_in?\n @friend_id = params[:friend_id]\n\n @user = facebook_data_about '/me'\n @likes = facebook_data_about '/me/likes', :as => \"data\"\n @friends = facebook_data_about '/me/friends', :as => \"data\"\n\n if @friend_id\n @friend_id = params[:friend_id]\n @friend = facebook_data_about \"/#{@friend_id}\"\n @friends_likes = facebook_data_about \"/#{@friend_id}/likes\", :as => \"data\"\n end\n\n if @friends_likes\n @intersection = intersection_of(@likes, @friends_likes)\n end\n end\n end", "def index\n @user = current_user\n @setting = @user.setting\n\n # @oauth = Koala::Facebook::OAuth.new(Rails.application.secrets.omniauth_provider_key.to_s, Rails.application.secrets.omniauth_provider_secret.to_s, \"/auth/facebook/callback\")\n #oauth = Koala::Facebook::OAuth.new(Rails.application.secrets.omniauth_provider_key.to_s, Rails.application.secrets.omniauth_provider_secret.to_s, \"/auth/:provider/callback_update\")\n #new_access_info = oauth.exchange_access_token_info#.auth.credentials.token\n #auth = request.env[\"omniauth.auth\"]\n # logger.info \"\\n AUTH!!!\\n\" + new_access_info.to_yaml + \"\\n \"\n # @oauth.get_user_info_from_cookies(cookies)\n # logger.info \"\\n AUTH : \" + @oauth.to_yaml\n # auth = request.env[\"omniauth.auth\"]\n #logger.info \"\\n auth!!!!!\\n\" +auth.to_yaml\n \n # @facebook_cookies ||= Koala::Facebook::OAuth.new(Rails.application.secrets.omniauth_provider_key.to_s, Rails.application.secrets.omniauth_provider_secret.to_s).get_user_info_from_cookie(cookies)\n#logger.info \"\\nFAEBOK COOK: \" + @facebook_cookies.to_yaml + \"\\n\"\n # Movie.sync_facebook(@user) \n # import_from_facebook\n #@graph = Koala::Facebook::API.new(session[:fb_access_token], Rails.application.secrets.omniauth_provider_secret.to_s)\n #friends = @graph.get_connections(\"me\", \"friends\")\n #logger.info \"\\n FRIENDS: \" + friends.to_yaml\n render action: :show\n end", "def filters; end", "def filters; end", "def show\n @user = User.find(params[:id])\n\t\n #respond_to do |format|\n # format.html # show.html.erb\n # format.json { render json: @user }\n #ends\n \n if params[:Remove]\n\t @friend = Friend.find_by_id(((params[\"Remove\"]).first)[0])\n\t Friend.remove(@friend, current_user)\n\t redirect_to user_path(params[:id])\n end\n \n if params[:Accept]\n\t @friendreq = Friendrequest.find_by_id(((params[\"Accept\"]).first)[0])\n\t @sendinguser = User.find_by_username(@friendreq.futurefriend)\n\t Friend.add(@sendinguser, current_user)\n\t Friendrequest.remove(@friendreq)\n\t redirect_to user_path(params[:id])\n\t #Friendrequest.send(@friendreq)\n\t #redirect_to user_path(params[:id])\n\tend\n\n if params[:Decline]\n\t @friendreq = Friendrequest.find_by_id(((params[\"Decline\"]).first)[0])\n\t Friendrequest.remove(@friendreq)\n\t redirect_to user_path(params[:id])\n\tend\t\n\t\t\n if params[:clear_button]\n\t @posts = Post.find(:all, :conditions => { :wall_id => current_user.id })\n\t @posts.each do |apost|\n\t\tPost.destroy(apost.id)\n\t end\n\t redirect_to user_profile_path(@user)\n\tend\n\t\n end", "def index\n @user = current_user\n \n @friend_requests = Friend.where(:friend_id => @user.id, :friend_confirm => false)\n @friend_requests.each do |friend|\n friend_user = User.find_by_id(friend.user_id)\n friend.name = friend_user.name\n auth = Authorization.find_by_user_id_and_provider(friend_user.id, \"facebook\")\n friend.facebook_id = auth.uid\n friend.username = friend_user.username\n friend.picture = \"http://graph.facebook.com/\" + friend.facebook_id + \"/picture\" \n end\n \n @friends = @user.friends\n @friends.each do |friend|\n if friend.friend_confirm == true\n friend_user = User.find_by_id(friend.friend_id)\n friend.name = friend_user.name\n auth = Authorization.find_by_user_id_and_provider(friend_user.id, \"facebook\")\n friend.facebook_id = auth.uid\n friend.picture = \"http://graph.facebook.com/\" + friend.facebook_id + \"/picture\" \n friend.friend_user_id = friend_user.id \n end\n end\n puts @friends.to_yaml\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 whitelist\n if cannot_access_api?\n render json: [], status: :unauthorized\n end\n end", "def show\n @filter = current_user.filters.find(params[:id])\n # @filters = current_user.filters.all\n respond_to do |format|\n format.html\n format.json { render json: @filter }\n end\n end", "def feed\n user = User.find(params[:id])\n following_ids = \"SELECT followed_id FROM relationships\n WHERE follower_id = :user_id\"\n microposts = Micropost.where(\"user_id IN (#{following_ids})\n OR user_id = :user_id\", user_id: params[:id])\n microposts_json = microposts_as_json(microposts.paginate(page: params[:page]))\n next_page = microposts.paginate(page: params[:page]).next_page\n @package = { next_page: next_page,\n microposts: microposts_json,\n is_current_user: (user == current_user) }\n render json: @package\n end", "def show\n @user = User.find(params[:id])\n if @user.facebook\n @friends = @user.facebook.get_connections(\"me\", \"friends\")\n @friends.each do |face| \n id = face[\"id\"]\n if FacebookFriend.where(:facebook_id => id, :user_id => current_user.id).exists?\n else\n name = face[\"name\"]\n friend = FacebookFriend.new(:name => name, :facebook_id => id, :user_id => current_user.id)\n friend.save\n end\n end\n @facefriends = FacebookFriend.where(:user_id => current_user.id).asc(:name)\n #would be nice if this was kept to just the exists clause, OC, check contact.rb clear_delete method\n @facefriends = @facefriends.any_of({ :contact_id.exists => false }, { :contact_id => \"\" }) \n end\n #@friends.sort_by{|e| e[\"name\"]}\n \n if @user.linkedin\n @connections = @user.linkedin.connections\n @connections = @connections.all\n @connections.each do |connection|\n\tid = connection.id\n if LinkedinConnection.where(:linkedin_id => id, :user_id => current_user.id).exists?\n else\n name = connection.first_name + \" \" + connection.last_name\n if connection.id != \"private\"\n connection = LinkedinConnection.new(:name => name, :linkedin_id => id, :user_id => current_user.id)\n connection.save\n end\n end\n end\n @linkedin = LinkedinConnection.where(:user_id => current_user.id).asc(:name)\n @linkedin = @linkedin.any_of({ :contact_id.exists => false }, { :contact_id => \"\" }) \n end\n \n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render_for_api :user, :json => @user }\n end\n end", "def authorize_create\n wall_owner = User.find(params[:post][:wall_id])\n unless is_friend?(wall_owner) or own_wall?(wall_owner)\n redirect_to user_path(wall_owner)\n end\n end", "def show\n @query_filter = @account.filters.find(params[:id])\n \n @updates = Update.find_with_ferret(@query_filter.query, {:limit => 200, :sort => Ferret::Search::SortField.new(:message_id, :type => :integer, :reverse => true)})\n @query_filter_name = @query_filter.filter_name\n @members = @account.friends\n @updates.delete_if {|msg| [email protected]?(msg.sender)}\n @members = @updates.group_by(&:sender).keys\n \n # if (@account.last_group_id != @query_filter.id)\n # @account.last_group_id = params[:id]\n # @account.save\n # end\n \n respond_to do |format|\n format.html {render :layout => false} # show.html.erb\n format.xml { render :xml => @query_filter }\n end\n end", "def facebook_request\n redirect_to facebook_authenticate_url\n end", "def friends\n #get friends page\n #get json from friends page\n #parse\n []\n end", "def apply_filter\n end", "def index\n if current_user.profile.blank?\n redirect_to update_profile_url ,:alert => \"Please fill in required fields.\" \n end\n #all values loaded from load_user filter\n @user = current_user\n @associated_providers = current_user.authentications.map{|authentication| authentication.provider}\n @not_yet_associated_providers = SUPPORTED_PROVIDER - @associated_providers\n \n # this is for feed\n @following_ids = @user.all_following.map{|user| user.id}\n \n @following_ids << current_user.id\n \n\n @feeds = ActivityFeed.where(\"user_id in (?)\",@following_ids).order(\"created_at DESC\").paginate(:per_page => 20,:page => params[:page])\n\n \n end", "def index\n @graph = Koala::Facebook::API.new(session[:access_token])\n #@display = @graph.get_object(\"me\")[\"education\"]\n\n if @user.univ_id.nil?\n @user.update_univ!('1')\n end\n\n #if there's no course list, OCR the schedule\n if @user.course_list.nil?\n @body = 'upload'\n #@display = @graph.get_connections(\"me\", \"albums\")\n #if the user has a course list, match with their friends\n else\n @friends = @user.match_friends_course_lists @graph.get_connections('me', 'friends').map { |a| a[\"id\"]}\n @body = 'results'\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @frontends }\n end\n end", "def index\n # p 'in users, BookingsController'\n @conversations = Conversation.where(user_id: @user.id)\n # p @conversations\n if @conversations\n conversations_serializer = parse_json @conversations\n json_response \"Indexed user's conversations successfully\", true, {conversations: conversations_serializer}, :ok\n else\n json_response \"Cannot find conversations for user\", false, {}, :not_found\n end\n # @flat = Flat.order(created_at: :desc)\n # @flat = policy_scope(Flat).order(created_at: :desc)\n\n # authorize @cars\n end", "def index\n @posts = Post.friends_posts(current_user).paginate(page: params[:page], per_page: 5)\n new_comment\n end", "def index\n get_posts_with_filter\n end", "def query\n respond_to do |format|\n format.html{ redirect_to root_path }\n format.json{\n render :json => @filter.run(params)\n }\n end\n end", "def post_like_dislike_filter\n\n unless logged_in?\n redirect_to login_path\n flash[:danger] = \"You must be logged in to like/dislike a post\"\n end\n\n end", "def facebook\n handle_redirect('devise.facebook_data', 'Facebook')\n end", "def filter\n super\n end", "def on_pre_request( request ); end", "def show\r\n \r\n\t\t@user = User.find(params[:id])\r\n @microposts = @user.microposts.paginate(page: params[:page])\r\n\r\n \r\n #nur für currentuser...\r\n if @user == current_user\r\n @interests = Array.new\r\n @user.interests.each do |i|\r\n @interests.push(i.hobby)\r\n end\r\n #frage nach aktuellem user ob in gruppe, aber nur wenn user.group == nil...\r\n fbuser = FbGraph::User.fetch(@user.uid, :access_token => @user.oauth_token)\r\n #Teste ob User in FB Gruppe\r\n group = fbuser.groups\r\n @test = group\r\n\r\n # @group_attribute = false\r\n # current_user.group = false\r\n group.each do |x|\r\n if x.name == 'Connectify'\r\n @group_attribute = true\r\n current_user.group = true\r\n break\r\n else\r\n @group_attribute = false\r\n current_user.group = false\r\n end\r\n end\r\n\r\n current_user.save\r\n\r\n else\r\n begin\r\n #user nicht current_user\r\n @exist = UserVisit.where(user_id: @user.id).where(visitor_id: current_user.id).first\r\n if @exist.nil?\r\n @user.user_visits.build(:visitor_id => current_user.id).save!\r\n end\r\n\r\n\r\n #user oauth abgelaufen\r\n if ((Time.now <=> (Time.parse(@user.oauth_expires_at)+(60*60))) == 1)\r\n #do something\r\n \r\n\r\n else #user oauth noch nicht abgelaufen\r\n #Zuerst schauen ob CurrentUser in Gruppe\r\n if current_user.group == false || current_user.group == nil\r\n #frage nach aktuellem user ob in gruppe, aber nur wenn user.group == nil...\r\n fbcurrent_user = FbGraph::User.fetch(current_user.uid, :access_token => current_user.oauth_token)\r\n #Teste ob User in FB Gruppe\r\n group = fbcurrent_user.groups\r\n\r\n group.each do |x|\r\n if x.name == 'Connectify'\r\n current_user.group = true\r\n break\r\n else\r\n current_user.group = false\r\n end\r\n end\r\n\r\n if fbcurrent_user.groups.empty?\r\n current_user.group = false\r\n \r\n end\r\n current_user.save\r\n end\r\n \r\n fbuser = FbGraph::User.fetch(@user.uid, :access_token => @user.oauth_token)\r\n \r\n fbuser.groups.each do |x|\r\n if x.name == 'Connectify'\r\n @user.group = true\r\n break\r\n else\r\n @user.group = false\r\n end\r\n end\r\n\r\n if fbuser.groups.empty?\r\n @user.group = false\r\n end\r\n @user.save\r\n\r\n\r\n end #end user oauth abgelaufen\r\n\r\n rescue FbGraph::Unauthorized => e\r\n case e.message\r\n when /Duplicate status message/\r\n \r\n # handle dup code\r\n when /Error validating access token/\r\n \r\n # handle bad credentials\r\n else\r\n raise e\r\n end\r\n end #end rescue\r\n end # end current oder other user\r\n\r\n\r\n\r\n end", "def authorize\n end", "def authorize\n end", "def set_friendship\n end", "def setup #Because setup is called by a before_filter, the authorization with be checked every time a vote is submitted.\n @topic = Topic.find(params[:topic_id])\n @post = @topic.posts.find(params[:post_id])\n authorize! :create, Vote, message: \"You need to be a user to do that.\" #the setup method has authorize so that only Bloccit members can vote\n\n @vote = @post.votes.where(user_id: current_user.id).first\n end", "def global_filter; end", "def index\n\n @supress_social_bar = true\n @bare = true\n\n ## per user\n if (user_signed_in?)\n @user = current_user\n #@snippets = @user.snippets #constrain to my snippets\n end\n\n #filter by user\n if (params[:user].present?)\n @filter_user = User.where(email: params[:user]).first\n if @filter_user\n @snippets = Snippet.where(user_id: @filter_user.id)\n else\n @snippets = []\n end\n end\n\n\n @snippets = @snippets || Snippet.all\n @snippets = @snippets.order_by([['votes.point', :desc]]) if @snippets.respond_to? :order_by\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snippets }\n end\n end", "def add_filter\n @filter = true \n end", "def show\n Contribution.current_user = current_api_user\n render json: @post.as_json(except: [:post_id, :contribution_id, :updated_at], :methods => [:author, :liked])\n end", "def filter_parameters; end", "def filter_parameters; end", "def requests_sent\n friends = Friend.where(user_id: params[:user_id], accepted: false)\n\t render json:friends\n end", "def index\n case params[:filter].to_s\n when 'my'\n authorize Group.new(:owner_id => current_user.id), :update?\n @groups = Group.where(:owner_id => current_user.id)\n else\n authorize Group.new, :update?\n @groups = Group.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n end\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 join\n @filter.profile_request(current_profile)\n respond_to do |format|\n format.html do\n# flash[:notice] = \"Your request to join #{@profile.name}'s #{@filter.name} filter has been sent.\"\n redirect_to profile_home_path(@profile.url_name)\n end\n format.json { head :no_content }\n end\n end", "def filter\n do_authorize_class\n\n filter_response, opts = Settings.api_response.response_advanced(\n api_filter_params,\n Access::ByPermission.dataset_items(current_user, dataset_id: params[:dataset_id]),\n DatasetItem,\n DatasetItem.filter_settings(:reverse_order)\n )\n\n respond_filter(filter_response, opts)\n end", "def index\n if params[:filter]\n case params[:filter]\n when \"by_me\"\n requests = Request.where(:user_id => current_user.id)\n when \"recent\"\n requests = Request.limit_5\n when \"for_me\"\n requests = []\n current_user.followers.each do |f|\n f.parent.requests.each do |r|\n requests << r\n end\n end\n requests = Request.in(:user_id => current_user.following.map {|f| f.user_id})\n end\n else\n #TODO: change this to paginate\n requests = Request.limit_5\n end\n\n render json: requests\n end", "def friend_requests\n friends = current_user.friends.where accepted: false\n profiles = friends.map{ |friend| Profile.find(friend.profile_id)}\n render json: profiles\n end", "def requests_received\n friends = Friend.where(friend_id: params[:user_id], accepted: false)\n\t render json:friends\n end", "def enforce_viewing_context_for_show_requests \n end", "def before_filter(&block)\n @before_filter = block\n end", "def index\n #@pagy, @eg_posts = pagy(EgPost.all, items: 2)\n @pagy, @eg_posts = pagy(EgPost.published.order(created_at: \"DESC\"), items: 2)\n authorize @eg_posts\n end", "def add_friend\n # byebug\n #we get user_id from jwt!\n user = User.find(decode_jwt(cookies.signed[:jwt])[\"user_id\"])\n #we get friend_id from frontend\n if !Block.where(blocker_id: user.id, blockee_id:follow_params[:user2]).empty?\n return render json: {error: \"There was a problem! (Ya been blocked!)\"}\n end\n\n followee = User.find(follow_params[:user2])\n #insert the one way relation in db!\n friend_request = Follow.new(follower_id: user.id, followee_id: followee.id)\n if friend_request.save\n render json: {friend_request: followee} \n else\n render json: {error: \"There was a problem!\"}\n end\n end", "def show\n @news = News.find_by_fb_obj_url(params[:id])\n\n if @news == nil\n # ealin: prevent Notice, FAQ, feedback-record not showing\n @news = News.find(params[:id])\n end\n @tags = Tag.all\n @areas = Area.all\n\n if @news.area_string != nil\n news_areas = @news.area_string.split(\"/\")\n else\n news_areas = Array.new\n news_areas[0] = 'All_area'\n end\n\n news_tags = Array.new\n @news.tags.each_with_index do |tag, index|\n news_tags[index] = tag.name\n end\n\n @suggest_news = News.find_by_tags('rank', :none, nil, news_areas, news_tags,Time.now).paginate :page => 1, :per_page => 8\n\n # check login status,\n # prevent direct link to news page => cause exception: current_facebook_user is nil\n check_logged_in(false)\n\n if (current_facebook_user != nil && session[:id] != nil)\n user = User.find(session[:id])\n if (!user.watches.include?(@news))\n @news.watches.push(user)\n news_rank_action(user, @news, :watch)\n else\n news_rank_action(nil, @news, :watch)\n end\n else\n news_rank_action(nil, @news, :watch)\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @news }\n end\n end", "def set_filter_to_newsfeed\n params[:filter] = 'newsfeed'\n @filter = 'newsfeed'\n end", "def publish_on_fb\n\t \tbegin\n\t\t \tme = FbGraph::User.me(oauth_token)\n\t\t \tme.feed!(\n\t\t \t\t:message => \"\",\n\t\t \t\t:picture => \"indirizzo immagine\",\n\t\t \t\t:link => \"indirizzo applicazione\",\n\t\t \t\t:name => \"\",\n\t\t \t\t:description => \"\"\n\t\t \t)\n\t\trescue Exception\n\t\t\t# Condivisione non andata a buon fine.\n\t\tend\n \tend", "def filter\n end", "def index\n if params.key? :filter\n @stories = Story.joins(:followers).order( 'stories.created_at DESC' ).where( :followers => { :user_id => current_user.id } ).paginate( :page => params[:page], :per_page => 10 )\n else\n @stories = Story.order( 'stories.created_at DESC' ).paginate( page: params[ :page ], per_page: 10 )\n end\n end", "def my_network\n case params[:type]\n when 'trusted'\n @items = @person.trusted_friends_items(params[:filter_type]).sort_by{|i| i.item_type.downcase}\n @events = current_user.trusted_network_activity.page(params[:page]).per_page(25)\n else\n @items = @person.personal_network_items(params[:filter_type]).sort_by{|i| i.item_type.downcase}\n @events = current_user.network_activity.page(params[:page]).per_page(25)\n end\n end", "def index \n\n @posts = Post.find(@user_id)\n\n # Get Params\n params_title = params[:title]\n params_category = params[:category] #ADASDSA\n \n # Retorna el post dependiendo el filtro\n return category_title_filter if params_category && params_title\n return title_filter if params_title \n return category_filter if params_category \n \n # Si no se hay parametros para filtrar retorna todos los posts\n render json: @posts, status: :ok, each_serializer: PostListSerializer\n end", "def index\n @user = current_user\n @friends = Friendship.includes(:friend)\n .where(:user_id => current_user.id).paginate(:conditions => {:ignore => false},\n :page => params[:page], :order => 'created_at DESC')\n\n @primary = @user\n\n # Links for pagination\n page = if params[:page]\n params[:page].to_i\n else\n page = 1\n end\n\n @page_left = nil\n @page_right = nil\n\n if @primary.friends.count > User.per_page\n if page == 1\n @page_right = page + 1\n elsif @friends.count < (User.per_page * page)\n @page_left = page - 1\n else\n @page_right = page + 1\n @page_left = page - 1\n end\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @friends }\n end\n end", "def facebook\n callback\n end", "def friends_only\n friends = @photo.author.friends\n\n unless @photo.author == current_user ||\n friends.include?(current_user)\n flash[:danger] = \"Friends Only!\"\n redirect_to root_path\n end\n end", "def show\n render json: @social_networking\n end", "def all\n post_owners = [current_user.id] + Friendship.where(:user2_id => current_user, :approved => true).pluck(:user1_id)\n @posts = Post.where('owner_id' => post_owners).order(created_at: :desc).page(params[:page]).per_page(POSTS_PER_PAGE)\n end", "def filter\n do_authorize_class\n get_project_if_exists\n do_authorize_instance(:show, @project) unless @project.nil?\n\n filter_response, opts = Settings.api_response.response_advanced(\n api_filter_params,\n list_permissions,\n Site,\n Site.filter_settings\n )\n respond_filter(filter_response, opts)\n end", "def index \n if not current_user.nil? and current_user != :false\n \n # wenn ich von post_in_feed komme das remind_me neu setzen das ist die\n # erinnerung nach ablauf der 7 tages frist\n unless params[:user].nil?\n unless params[:user][:remind_me].nil?\n current_user.remind_me = params[:user][:remind_me]\n current_user.reminded = false\n current_user.save\n end\n\n end\n \n # wenn ich von edit_tag oder aehnlichem komme und abgebrochen wurde\n if params[:delete_file] == \"true\"\n current_user.delete_unposted_file\n end\n\n @posts = Post.find(:all,:order => \"created_at DESC\")\n \n @posts.reject! do |p|\n current_user.has_rated_for(p.id)\n end\n params[:id] = current_user.id\n end\n \n end", "def privacy\n end", "def privacy\n end", "def api_only; end", "def api_only; end", "def api_only; end", "def index\n retrieve_and_develop_all_friendships\n end", "def filter_params\n\t\treturn params[:voter].permit(:name_for_filter, :election_id_for_filter)\n\tend" ]
[ "0.6621977", "0.6478562", "0.6444629", "0.61583775", "0.60956776", "0.6083649", "0.5988819", "0.59180707", "0.59009945", "0.5853174", "0.5853174", "0.58523977", "0.58179545", "0.5807644", "0.5803052", "0.58006835", "0.5798421", "0.57695115", "0.5751335", "0.5750977", "0.57150817", "0.5693668", "0.56881446", "0.5676605", "0.565803", "0.5650569", "0.5649288", "0.5634414", "0.5601426", "0.55955845", "0.55884874", "0.5582702", "0.5581996", "0.55704755", "0.55704755", "0.5561064", "0.55579275", "0.55557436", "0.55505556", "0.5546358", "0.5544679", "0.5529914", "0.5528878", "0.5518492", "0.5507587", "0.55039465", "0.5502381", "0.55023104", "0.5502147", "0.548406", "0.5483283", "0.5478213", "0.54750407", "0.54737025", "0.5464883", "0.54592174", "0.5453875", "0.54476076", "0.54475427", "0.54475427", "0.5436644", "0.54365313", "0.54305893", "0.5428372", "0.5415472", "0.5403879", "0.5384432", "0.5384432", "0.5383059", "0.538281", "0.53808576", "0.5376765", "0.5374856", "0.5370768", "0.5370203", "0.53693235", "0.5366868", "0.53662", "0.5358916", "0.5354633", "0.5351647", "0.5350959", "0.5348634", "0.5346601", "0.5345401", "0.5343312", "0.5338432", "0.5333242", "0.5329463", "0.5327479", "0.5324305", "0.5323059", "0.5321782", "0.531812", "0.53180724", "0.53180724", "0.5313138", "0.5313138", "0.5313138", "0.5308289", "0.5307205" ]
0.0
-1
options[:private] defaults to false if private is true, then the time remaining for the internal time limit is returned otherwise the time remaining for the public time limit is returned
def time_remaining(options = {}) options[:private] ||= false if options[:private] [duration - seconds_since_started, 0].max else [PUBLIC_TIME_LIMIT - seconds_since_started, 0].max end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_time_remaining\n\n end", "def time_remaining\n\n end", "def time_remaining\n end", "def timeout_in\n if self.admin?\n 10.minutes\n else\n 15.minutes\n end\n end", "def wait_time\n if rate_limit_remaining < 50\n [rate_limit_reset - Time.zone.now, 0.001].sort.last\n else\n 3600.0 / rate_limiting\n end\n end", "def timeout_in\n if user.admin? # should this not be 'self.admin?' ?\n 1.year\n else\n 2.days\n end\n end", "def timeout_in\n if admin?\n 1.hour\n else\n 3.days\n end\n end", "def timeout_in\n if admin?\n 1.hour\n else\n 3.days\n end\n end", "def timeout_in\n if admin?\n 1.hour\n else\n 3.days\n end\n end", "def timelimit\n 15.minutes\n end", "def seconds_to_expire(options = {})\n if options.has_key?(:until)\n case options[:until]\n when 'midnight', :midnight\n secs = ((Time.now + 1.day).midnight - Time.now).to_i \n else\n secs = (options[:until] - Time.now).to_i\n end\n raise \":until(#{options[:until].inspect}) is less than Time.now by #{secs}\" if secs <= 0\n return secs\n elsif options.has_key?(:for)\n return options[:for]\n else\n 0\n end\n end", "def calculate_remaining_time\n expiry_time = expires_at.to_i\n current_time = DateTime.now.to_i\n if current_time < expiry_time\n message = ActiveSupport::Duration.build(expiry_time - current_time).parts\n duration = ''\n duration += \"#{message[:days]} day/s \" if message[:days] > 0\n duration += \"#{message[:hours]} hour/s \" if message[:hours] > 0\n duration += \"#{message[:minutes]} minute/s\" if message[:minutes] > 0\n duration\n end\n end", "def timeout\n @options[:timeout]\n end", "def request_timeout(type, options); end", "def limit\n @timeout\n end", "def timeout_in\n\t if self.role=='admin'\n\t 7.days\n\t else\n\t 2.days\n\t end\n\tend", "def overall_time(options = {})\n options[:precision] ||= 2\n if answer && time_started\n if options[:precision] != :default\n (answer.created_at - time_started).round(options[:precision])\n else\n (answer.created_at - time_started)\n end\n end\n end", "def server_timing; end", "def remaining_time()\n return @total_time_units - @done_time_units\n end", "def remaining_hours\n \n end", "def server_timelimit\n @connection.opt[:timelimit]\n end", "def while_time_remaining; end", "def durations; end", "def get_time_tutor_can_help\n start_time = self.student_requests.where(status:\"active\").first.start_time\n if(Time.now-start_time)/60>30 #if a tutor has been working longer than 30 min\n return Time.now.in_time_zone + 60*30\n end\n return start_time + 60*30\n end", "def timeout_in_minutes\n data[:timeout_in_minutes]\n end", "def time_remaining\n member.last_backup_job.time_remaining rescue 0\n end", "def timedout?(last_access); end", "def time_limit\n [2, problem.time_limit].min\n end", "def timeout_in\n 15.minutes\n end", "def time_duration(mytime, start_time, end_time)\n # implement this\n return 9999999\n end", "def timeout_seconds\n return 1200\n end", "def get_time_required\n 0 # number of minutes\n end", "def total_time; end", "def timeout_in\n 30.days\n end", "def ttl_duration\n 900\n end", "def expires_in(seconds, options = {})\n response.cache_control.merge!(\n max_age: seconds,\n public: options.delete(:public),\n must_revalidate: options.delete(:must_revalidate),\n stale_while_revalidate: options.delete(:stale_while_revalidate),\n stale_if_error: options.delete(:stale_if_error),\n )\n options.delete(:private)\n\n response.cache_control[:extras] = options.map { |k, v| \"#{k}=#{v}\" }\n response.date = Time.now unless response.date?\n end", "def get_time_length \n send_cmd(\"get_time_length\")\n end", "def used\n return 0 if max.zero?\n\n obj = redis.hgetall(key)\n timestamp = obj['timestamp']\n amount = obj['amount']\n if timestamp && amount\n time_passed = Time.now.to_f - timestamp.to_i / 1000.0\n drift = max * time_passed / period\n last_amount = [amount.to_f, max].min\n [(last_amount - drift).ceil, 0].max\n else\n 0\n end\n end", "def rate_limit_remaining\n connection.rate_limit_remaining\n end", "def expires_in\n options[:expires_in]\n end", "def used\n limit - remaining\n end", "def timeout( seconds=nil )\n\t\tif seconds\n\t\t\treturn self.clone( :timeout => seconds )\n\t\telse\n\t\t\treturn @options[:timeout]\n\t\tend\n\tend", "def get_otp_remaining_time\n (Time.now.utc.to_i / 30 + 1) * 30 - Time.now.utc.to_i\n end", "def _timeout_in\n 1.minute\n end", "def edit_time_left(item)\n diff = Time.now - item.updated_at\n expire_rate = APP_CONFIG[:edit_expiration_in_minutes].to_i\n return expire_rate > 0 ? expire_rate - (diff.to_i / 60) : nil\n end", "def update_timeout_status(timeout, start_time, time_left)\n if timeout\n current_time = Time.new.to_i\n p \"current time = #{current_time}\"\n diff = current_time - start_time\n p \"curr - start = #{diff}\"\n time_out_length = 300\n if diff >= time_out_length\n timeout = false\n return timeout\n else\n time_left = time_out_length - diff\n return time_left\n end\n end\nend", "def rate_limited?(thing, rate_limit_time = nil, increment: 1)\n key = resolve_key thing\n limit_hash = @bucket[key]\n\n # First case: limit_hash doesn't exist yet\n unless limit_hash\n @bucket[key] = {\n last_time: Time.now,\n set_time: Time.now,\n count: increment\n }\n\n return false\n end\n\n # Define the time at which we're being rate limited once so it doesn't get inaccurate\n rate_limit_time ||= Time.now\n\n if @limit && (limit_hash[:count] + increment) > @limit\n # Second case: Count is over the limit and the time has not run out yet\n return (limit_hash[:set_time] + @time_span) - rate_limit_time if @time_span && rate_limit_time < (limit_hash[:set_time] + @time_span)\n\n # Third case: Count is over the limit but the time has run out\n # Don't return anything here because there may still be delay-based limiting\n limit_hash[:set_time] = rate_limit_time\n limit_hash[:count] = 0\n end\n\n if @delay && rate_limit_time < (limit_hash[:last_time] + @delay)\n # Fourth case: we're being delayed\n (limit_hash[:last_time] + @delay) - rate_limit_time\n else\n # Fifth case: no rate limiting at all! Increment the count, set the last_time, and return false\n limit_hash[:last_time] = rate_limit_time\n limit_hash[:count] += increment\n false\n end\n end", "def expires_in(seconds, options = {})\n cache_control = []\n if seconds == 0\n cache_control << \"no-cache\"\n else\n cache_control << \"max-age=#{seconds}\"\n end\n if options[:public]\n cache_control << \"public\"\n else\n cache_control << \"private\"\n end\n\n # This allows for additional headers to be passed through like 'max-stale' => 5.hours\n cache_control += options.symbolize_keys.reject{|k,v| k == :public || k == :private }.map{ |k,v| v == true ? k.to_s : \"#{k.to_s}=#{v.to_s}\"}\n\n header \"Cache-Control\", cache_control.join(', ')\n end", "def timeout\n options[:timeout] || super\n end", "def get_queue_time\r\n @account = current_user\r\n # if the user is not logged in, give arbitrary time\r\n if @account == nil then\r\n if Rails.env.development? then\r\n return 140\r\n else\r\n return 0\r\n end\r\n end\r\n @userRequest = @account.queue_request\r\n # if there is no actual queue request, give arbitrary time\r\n if @userRequest == nil then\r\n if Rails.env.development? then\r\n return 140\r\n else\r\n return 0\r\n end \r\n end\r\n # Compare request end time to now\r\n @now = DateTime.current().getutc()\r\n if @now <= @userRequest.end_time then\r\n # Return time left in seconds\r\n return @userRequest.end_time.to_i - @now.to_i\r\n else\r\n return 0\r\n end \r\n end", "def timeout\n @options[:timeout] || Settings.TIMEOUT_DOWNLOAD || 20\n end", "def cache_age_tolerance_in_seconds\n 0\n end", "def time_remaining( address )\n address = encode( address )\n get(\"/timeremaining/#{address}\")\n end", "def time_until_unlock\n return 0 unless access_locked?\n return ((User.unlock_in - (Time.current - locked_at)) / 60).round\n end", "def request_timeout()\n @req_timeout\n end", "def http_timeout; end", "def timeout\n return @timeout\n end", "def ttl\n max_age - age if max_age\n end", "def timeout\n if stop_time.nil?\n nil\n else\n timeout = stop_time - current_time\n timeout < 0 ? 0 : timeout\n end\n end", "def remaining_time\n # calculate how old is the feedback\n created_at = self.created_at.to_time\n diff_seconds = (Time.now - created_at).round\n remaining = TEN_MINUTES - diff_seconds\n\n remaining.to_s\n end", "def rate_limit\n options[:rate_limit]\n end", "def estimatedEndServerTime \n \"estimatedEndServerTime\" \n end", "def timeout_seconds\n transport_options.timeout_seconds\n end", "def max_tp\r\n return 100\r\n end", "def duration\n 30\n end", "def timed_event_remaining_time(event_id = @event_id, map_id = @map_id)\n return ($user_data.dig(:tjn_events, map_id, event_id)&.first || current_time) - current_time\n end", "def take_time\n if self.completed?\n (complete_on - started_on) if complete_on && started_on\n end\n end", "def time_spent\n return nil if self.finished_at.nil?\n# if self.completed?\n self.finished_at - self.started_at\n# else\n# Time.now - self.started_at\n# end\n end", "def get_membership_duration\n Time.zone.now - created_at\n end", "def total_spent_hours(options = {})\n conditions = options[:user] ? \"#{TimeEntry.table_name}.user_id = #{options[:user].id}\" : \"1=1\"\n @total_spent_hours ||= self_and_descendants.sum(\"#{TimeEntry.table_name}.hours\",\n :joins => \"LEFT JOIN #{TimeEntry.table_name} ON #{TimeEntry.table_name}.issue_id = #{Issue.table_name}.id\",\n :conditions => conditions).to_f || 0.0\n end", "def time_remaining\n return 0 if finished_at\n backup_source_jobs.map(&:time_remaining).sum\n end", "def duration\n (@stop_time.nil? ? Time.now : @stop_time) - @start_time\n end", "def global_timeout\n data.global_timeout\n end", "def rate_limited_exceeded?\n limit = get_json( \"#{ GITHUB_API_URL }/rate_limit\" )[ 'rate' ][ 'remaining' ]\n limit == 0 ? true : false\nend", "def max_time_played\n options = {\n :select => 'sum(instances.duration) as field',\n :order => 'field DESC'\n }\n\n render_users params[:name], options\n end", "def seconds_remaining\n ends_at ? (ends_at - started_at).round : 0\n end", "def usage_interval\n\n end", "def estimate_at_completion_duration\n return planned_duration - earned_schedule\n end", "def total_wait\n if cart.delivers\n if !cart.delivery_duration.blank?\n response = estimated_wait + cart.delivery_duration\n else\n response = estimated_wait + 20\n end\n else\n response = estimated_wait\n end\n\n return response\n end", "def get_timeout(call_type)\n case call_type\n when READ\n @config.read_timeout\n else\n @config.write_timeout\n end\n end", "def lifetime_in_minutes\n return @lifetime_in_minutes\n end", "def time_tolerance_seconds\n 600\n end", "def time_management\n @personal_best = current_user.reports.map(&:time_management).max.round(2) rescue 0\n @personal_best = \"#{@personal_best}% Questions Attended\"\n learning_curve 'time_management'\n data_presenter 'time_management'\n end", "def end_time\n return @start_time + @seconds_to_expiry\n end", "def check_for_rate_limits\n rate_limit_remaining < 10\n end", "def remaining\n (Time.now - @last_scrape).to_i \n end", "def limit\n self.class.get(\"/get/speedlimit\").to_i\n end", "def time\n request :public, :get, :time\n end", "def time_elapsed\n if !self.finished.blank?\n ((self.finished - self.started) / 60).to_i\n end\n end", "def remaining_str()\n return \"expired\" if isover?\n\n diff = (@end_time - Time.now).floor\n diff, seconds = diff.divmod 60\n diff, minutes = diff.divmod 60\n diff, hours = diff.divmod 24\n days = diff\n\n str = ''\n str += \"#{days}d\" if days != 0\n str += \"#{hours}h\" if hours != 0\n str += \"#{minutes}m\" if minutes != 0\n str += \"#{seconds}s\" if seconds != 0\n \"#{str} remaining\"\n end", "def clock_out_time\n \treturn nil if self.is_in_progress?\n \tself.updated_at.strftime(\"%H:%M %p\")\n end", "def http_timeout=(_arg0); end", "def ttl; Qpid::Messaging::Duration.new @message_impl.getTtl.getMilliseconds; end", "def check_duration\n calculate_duration if self.duration != get_duration\n end", "def describe\n case @limit\n when 0\n \".never\"\n when 1\n \".once\"\n when 2\n \".twice\"\n else\n \".times(#{@limit})\"\n end\n end", "def trial_days_remaining\n days_elapsed = (Time.now.to_i - self.trial_started_at.to_i) / 60 / 60 / 24\n remaining = APP_CONFIG['trial_length'] - days_elapsed\n remaining = 0 if remaining < 0\n remaining\n end", "def results(stop,start)\n hours = stop.hour - start.hour\n mins = stop.min - start.min\n secs = stop.sec - start.sec\n (mins = mins + 60) && (hours = hours - 1) if mins < 0\n (secs = secs + 60) && (mins = mins - 1) if secs < 0\n puts \"Done in #{hours}:#{mins}:#{secs}\"\n puts \"Got: #{Group.count} groups, #{Category.count} categories, #{Product.count} products\"\n end", "def get_duration()\n puts \"The task will take #{(@date_end - @date_start).to_i} days\"\n end", "def time_limit\n frm.div(:class=>\"tier2\").table(:index=>0)[3][0].text\n end", "def total_time\n minutes_to_human_readable_time(entries.internal.sum(:duration) + expected_remaining_work * 60)\n end" ]
[ "0.665115", "0.63891006", "0.6376292", "0.62636495", "0.60847634", "0.6076463", "0.5918858", "0.5918858", "0.5918858", "0.58558226", "0.576455", "0.5757509", "0.5723271", "0.56893677", "0.56843686", "0.5651579", "0.56058913", "0.5568223", "0.5559217", "0.5508746", "0.55055106", "0.5501269", "0.5462198", "0.54590815", "0.5457258", "0.5425066", "0.5419094", "0.5403471", "0.540108", "0.53983235", "0.5396018", "0.5387198", "0.53825283", "0.53806895", "0.53744674", "0.5346665", "0.5334607", "0.532437", "0.532354", "0.5316968", "0.5294079", "0.52901584", "0.52886975", "0.5286346", "0.5284175", "0.52833045", "0.52657104", "0.52645993", "0.5260183", "0.52596426", "0.52549213", "0.52292454", "0.5229004", "0.52185696", "0.52097464", "0.5200562", "0.5197884", "0.5197712", "0.5184175", "0.51801044", "0.51790905", "0.5178543", "0.5178038", "0.5176316", "0.51654476", "0.51615274", "0.5158516", "0.5133555", "0.5132074", "0.5131466", "0.51185876", "0.5111428", "0.5107109", "0.510395", "0.51007414", "0.50981545", "0.50969553", "0.5090278", "0.5088354", "0.50872976", "0.5083606", "0.508069", "0.5076508", "0.50667536", "0.5057842", "0.5053697", "0.5049234", "0.5044787", "0.50381315", "0.5036161", "0.5035163", "0.50307965", "0.502817", "0.5019854", "0.5016659", "0.5014448", "0.50126696", "0.5011817", "0.5005723", "0.50033855" ]
0.8575459
0
answers are valued as 0 if they are left blank def answer_value if has_answer? answer.value else 0 end end answers should not take the beta timer into account, since we didn't plan it this way, will have to resort to calculating the user's answer from their question_stats (this method is super convoluted)
def answer_choice most_recent_answer = question_stats.selections.order('question_stats.created_at DESC').limit(1).first # unanswered question, default to 0 return false if most_recent_answer.blank? # chose combo, so choose the combo if most_recent_answer.combo? return 'Combo' if most_recent_answer.selected? return false # the person did not select anything so return 0 end # choose good, so must find the bundle the user selected if most_recent_answer.good? last_time_chose_combo = question_stats.combo.order('question_stats.created_at DESC').limit(1).first # only look at goods chosen after the last time a combo was chosen candidates = if last_time_chose_combo.blank? question_stats.good.order('question_stats.created_at DESC') else question_stats.good.created_after(last_time_chose_combo.created_at).order('question_stats.created_at DESC') end # find value of the last time each good was selected (but not necessarily true) selected_goods = {} candidates.each do |candidate| selected_good = candidate.good_number if selected_goods[selected_good].blank? selected_goods[selected_good] = candidate end end # the actual goods that were selected and whose values are true chosen_good_numbers = [] selected_goods.each do |k,v| chosen_good_numbers.push(k) if v.selected? end return false if chosen_good_numbers.empty? return chosen_good_numbers.sort end # should never be reached, sanity check raise Exception.new('Something went wrong with this method, fix it') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluation\n responses = self.user_survey_responses\n correct_answers = 0.0\n responses.each do |response|\n answer = Answer.find(response.answer_id)\n correct_answers += 1 if answer.correct\n end\n if self.grade.nil?\n self.grade = Grade.create score: 0, gradable: self, user_id: self.user_id\n end\n if (responses.size != 0) then\n evaluation = (correct_answers/responses.size)*10\n #self.update_attributes result: evaluation\n if evaluation != grade.score\n self.grade.update_attributes score: evaluation\n end\n return evaluation\n else\n #self.update_attributes result: 0.0\n if grade.score != 0\n self.grade.update_attributes score: 0, gradable: self\n end\n return 0.0\n end\n end", "def optimal_answer?\n \tanswer_value == optimal_value\n end", "def questionAnswer(question)\n answer = questionAnswerRaw(question)\n \n answer = \"No Answer\" if answer == nil\n return answer\nend", "def score_value_for(assessment_indicator:)\n assessment\n .scores\n .find_by(assessment_indicator: assessment_indicator)\n &.value || 0\n end", "def fitness_question1(fitness_answer1)\n if fitness_answer1 == \"3 or more times per week\"\n @fitness_score1 = 0\n elsif fitness_answer1 == \"1 - 2 times per week\"\n @fitness_score1 = 1\n elsif fitness_answer1 == \"never\"\n @fitness_score1 = 2\n end\n @fitness_score1\nend", "def find_answer_value(given_questionnaire = nil)\n if answer.present?\n answer.find_value\n else\n \"\"\n end\n end", "def mcq_experience_on(answered, attempt_no)\n total = score(answered)\n options = prompts.first.specific.choices.size\n\n if (options == 0 || attempt_no == 0)\n return 0\n elsif (total >= 1.0 && attempt_no == 1)\n return self.exercise.experience\n else\n return self.exercise.experience * total / options / attempt_no\n end\n end", "def create_answer\n current_stat_id = nil\n factorIds = []\n badFactors = []\n if params[:form_fields] != nil\n params[:form_fields].each do |field|\n current_stat_id = field[1][:statistic_id].to_i\n af = AnsweredFactor.where(factor_id: field[1][:factor_id],\n statistic_id: current_stat_id,\n month: params[:month],\n year: params[:year],\n user_id: current_user.id).first_or_create\n\n af[:amount] = field[1][:value]\n af.save\n\n if af.amount == nil\n badFactors.push(af)\n af.delete\n else\n factorIds.push([af.id, current_stat_id])\n end\n end\n if badFactors.count == 0\n userFactors = rearrangeFactors(factorIds)\n updateAnswer(userFactors,{:month=>params[:month],:year=>params[:year]})\n current_user.score += Mission.getScore(current_user)\n current_user.effective_score += Mission.getScore(current_user)\n current_user.save\n end\n end\n if badFactors.count == 0 and factorIds.count != 0\n redirect_to statistics_path\n else\n redirect_to emissions_template_path, alert: \"Factor cannot be left blank.\"\n end\n end", "def evaluate\n if attack?\n evaluate_attack\n elsif skill?\n evaluate_skill\n else\n @value = 0\n end\n if @value > 0\n @value + rand(nil)\n end\n end", "def correct_answer\n @correct_answer ||= question.correct\n end", "def evaluate_answer(answer)\n question = answer.question.actable\n question.max_time_limit = answer.submission.assessment.course.programming_max_time_limit\n assessment = answer.submission.assessment\n evaluation_result = evaluate_package(assessment.course.title, question, answer)\n build_result(question, evaluation_result,\n graded_test_case_types: assessment.graded_test_case_types)\n end", "def unanswered\n answers.blank?\n end", "def score(answered)\n score = 0\n answered.each do |a|\n score += a.value\n end\n # TODO: Decide whether safeguarding against negative scoring is worth it\n if (score < 0)\n score = 0\n end\n return score\n end", "def yourAnswer()\n if $strAnswer.length == 1\n $arrUserAnswers[$intQuestionOnScreen - 1, 1] = $radioChoice\n else\n $arrUserAnswers[$intQuestionOnScreen - 1] = ($option_one.to_s + $option_two.to_s + $option_three.to_s + $option_four.to_s).gsub(\"0\", \"\")\n end\nend", "def wrong_answer\n @score -= 1\n end", "def calculate_average(correct_answers, total_answers)\n #this is an average. uses floats to get decimals, *100 because thats what a percentage is, and converts to an integer. '%.2f' % to round the float off to 2 decimal places\n if Helper.check_for_zero?(total_answers) == true\n puts \"You haven't taken any quizzes!!!\"\n return -1\n else\n average = (correct_answers.to_f * 100) / (total_answers.to_f * 100)\n average = average * 100\n return average.to_i\n end\n\n end", "def evaluate_answer(key,answer,options)\n correct = false\n if options['q_struct'][key].eval != \"no\"\n new_value = options['q_struct'][key].eval\n if new_value.match(/^get|^set/)\n if new_value.match(/^get/)\n new_value = eval\"[#{new_value}]\"\n answer = new_value.join\n options['q_struct'][key].value = answer\n else\n options['q_struct'][key].value = answer\n eval\"[#{new_value}]\"\n end\n correct = true\n else\n correct = eval\"[#{new_value}]\"\n if correct == true\n options['q_struct'][key].value = answer\n end\n end\n else\n correct = true\n end\n answer = answer.to_s\n if options['verbose'] == true\n handle_output(options,\"Information:\\tSetting parameter #{key} to #{answer}\")\n end\n return correct\nend", "def answer\n # TODO: サマリ更新ロジックをモデルに移動\n @question = Question.find(params[:id])\n @user = current_user\n @summary = Summary.find_by_user_id_and_question_id(@user[:id], @question[:id])\n @score = @user.scores.build(:question => @question, :summary_id => @summary[:id], :user_answer => params[:answer].to_i, :answer_date => Time.current)\n\n if @question.answer == @score[:user_answer]\n @correct = true\n @score.correct = true\n @summary.attributes = { :total => @summary[:total] + 1, :right => @summary[:right] + 1 }\n else\n @correct = false\n @score.correct = false\n @summary.attributes = { :total => @summary[:total] + 1 }\n end \n @summary.save!\n @score.save!\n end", "def bayesian_rank\n\n #this is an ad hoc value, which basically represents the minimum number of \n #votes we think an Idea should have before it's even considered relevant. \n #eventually this value will come from the admin screen\n @magic_number_of_votes = 0.5\n\n @return_value = ((@magic_number_of_votes*Idea.average_rank_of_all_ideas.to_f)+(self.count_of_users_ranked*self.average_rank.to_f))/(@magic_number_of_votes+self.count_of_users_ranked)\n\n if @return_value == 0\n return 10\n else\n return @return_value.round(2)\n end\n\nend", "def score\n seconds_passed = Time.now.to_i - Integer(time_for_last_correct_answer || 0)\n wrong_answers = nr_of_answers - nr_of_correct_answers\n # Scores grow linearly with number of correct answers, but\n # geometrically with number of wrong answers. That's a way to\n # ensure that more attention is paid to problem areas.\n x = Integer(nr_of_correct_answers - wrong_answers ** 1.5)\n if x < 0\n x # Time is not a factor when the score is negative.\n else\n 10_000_000 * x / (seconds_passed + 500_000)\n end\n end", "def correct_mcq(correct_choice_id, wrong_choice_id = nil, value = 1.0)\n if correct_choice_id.nil? || !correct_choice_id.is_a?(Integer)\n puts \"Invalid Choice ID\"\n return false\n end\n \n exercise_version_id = self.id\n correct_choice = Choice.find(correct_choice_id)\n wrong_choice = nil \n if wrong_choice_id.nil?\n all_choices = Choice.where(multiple_choice_prompt: correct_choice.multiple_choice_prompt)\n all_choices.each do |c|\n wrong_choice = c if c.value == 1.0 \n end\n binding.pry\n end \n wrong_choice ||= wrong_choice_id ? Choice.find(wrong_choice_id) : nil \n \n if correct_choice.multiple_choice_prompt_id != wrong_choice.multiple_choice_prompt_id\n puts \"Choices are not from the same question\"\n return false\n end\n correct_choice.reset_value(value)\n wrong_choice.reset_value(0.0) if wrong_choice\n \n attempts.each do |attempt|\n delta = 0.0\n if correct_choice_id == attempt.prompt_answers[0].specific.choices[0].id && attempt.score <= 0.0\n delta = value\n elsif wrong_choice && wrong_choice.id == attempt.prompt_answers[0].specific.choices[0].id && attempt.score > 0.0\n delta = -1.0 * value\n end\n binding.pry\n puts attempt.id,\"\\n DELTA: \\n\", delta\n if attempt.workout_score\n multiplier = ExerciseWorkout.find_by(exercise: exercise, workout: attempt.workout_score.workout).points\n if attempt.active_score\n attempt.active_score.rescore(delta * multiplier)\n end\n else\n multiplier = 10.0\n end\n attempt.rescore(delta * multiplier)\n end\n return true\n end", "def correct_answer\n new_question\n @label_quess.text = \"That's correct!\"\n @label_quess.textColor = UIColor.blueColor \n # return @scores = 0 if @scores > 10000 \n # @scores += 1\n return @correct = 0 if @correct > 10000\n @correct +=1\n @label_corect.text = \" ✓: \" + @correct.to_s \n\n end", "def evaluated_or_graded_answers(question)\n answers.select { |a| a.question_id == question.id && (a.evaluated? || a.graded?) }\n end", "def value\n update 0\n @value ? @value : 0.0\n end", "def max_mcq_score\n if self.exercise.is_mcq?\n sum = 0.0\n self.prompts.each do |question_prompt|\n question_prompt.specific.choices.each do |choice|\n sum += choice.value if choice.value > 0.0\n end\n end\n puts \"MAX MCQ SCORE\",sum,\"MAX MCQ SCORE\"\n return sum\n end\n end", "def incorrect_answer(button_index)\n @label_quess.text = \"Guess once more!\"\n @label_quess.textColor = UIColor.alloc.initWithRed(0.8,green: 0.6,blue: 0.73, alpha:1.0) \n @buttons[button_index].removeFromSuperview\n # return @scores = 0 if @scores < -10000\n # @scores -= 1\n return @incorrect = 0 if @incorrect > 10000\n @incorrect +=1\n @label_incorect.text = \" ✗: \" + @incorrect.to_s+\" \" \n @label_incorect.textAlignment = NSTextAlignmentRight\n end", "def set_incorrect_answer\r\n set_question_and_answer\r\n @answer.correct = 0\r\n save_answer_and_render\r\n end", "def questionAnswer(question)\n answer = questionAnswerRaw(question)\n \n answer = \"No Answer\" if answer == nil\n truncate answer, 30\nend", "def points\n self.answer_votes.sum(:value).to_i\n end", "def calculate_score(data)\n# Rails.logger.info(\">>>>>>> calculate_fn: #{self.calculate_fn}\")\n# Rails.logger.info(\">>>>>>> data: #{YAML::dump(data)}\")\n return 0 if self.calculate_fn.blank?\n return 0 if data.nil? || data.empty?\n tags = self.prompts.collect{|p| p.tag }\n\n ## at least until we convert stuff\n md = { }\n self.prompts.each do |p|\n md[p.tag] = (data[p.tag] || data[(p.position-1).to_s] || data[p.position-1] || 0).to_i\n end\n\n parser = Fabulator::Expr::Parser.new\n context = Fabulator::Expr::Context.new\n context.merge_data(md)\n parsed = parser.parse(self.calculate_fn, context)\n raw = parsed.run(context).first.to([Fabulator::FAB_NS, 'numeric']).value.to_f \n\n# Rails.logger.info(\">>> score >>> #{raw}\")\n if !self.minimum.nil?\n if self.inclusive_minimum?\n return self.floor if raw <= self.minimum\n else\n return self.floor if raw < self.minimum\n end\n end\n if !self.maximum.nil?\n if self.inclusive_maximum?\n return self.ceiling if raw >= self.maximum\n else\n return self.ceiling if raw > self.maximum\n end\n end\n return raw\n end", "def validate_answer(answer)\n end", "def beta_question?\n !display_timer?\n end", "def food_question2(food_answer2)\n if food_answer2 == \"never\"\n @food_score2 = 0\n elsif food_answer2 == \"1 - 3 days per week\"\n @food_score2 = 1\n elsif food_answer2 == \"4 or more days per week\"\n @food_score2 = 2\n end\n @food_score2\nend", "def calculate_score\n #set default user score value to 0 in the database but to prevent any errors and remove database dependencies i am including this line in the model as well\n score || 0\n self.games.each do |game|\n score+=game.points\n end\n score\n end", "def verify_answer(question, current_player)\n\n if question.answer == question.actual_answer\n result = \"won round\"\n current_player.score += 1\n else\n result = \"lost round\"\n current_player.score -= 1\n end\n\n result\n\nend", "def update\n if @submission.Scores == \"Not submitted\"\n\t\t\t# end time\n\t\t\tdate=DateTime.now\n\t\t\t@assessment = Assessment.find(@submission.assessment_id)\n\t\t\t# if within time limit\n\t\t\tif date.to_time < @submission.SubmittedAt.to_time + @assessment.Duration.minutes + 5.seconds\n\t\t\t\tparms = {\"Duration\"=>(([email protected]_time)).to_i}\n\t\t\t\tscores = []\n\t\t\t\tanswers = []\n\t\t\t\t@questions = Question.where(assessment_id: @submission.assessment_id).order(:id)\n\t\t\t\t@assessment = Assessment.find(@submission.assessment_id)\n\t\t\t\t# if assessment exists\n\t\t\t\tif @assessment\n\t\t\t\t\tuser = User.find(@assessment.user_id)\n\t\t\t\t\t@creator = user.Fname + \" \" + user.Lname\n\t\t\t\tend\n\t\t\t\t# for every question of the assessment\n\t\t\t\tfor question in @questions\n\t\t\t\t\tcase question.Type\n\t\t\t\t\t# if multiple choice\n\t\t\t\t\twhen \"MCQ\"\n\t\t\t\t\t\tanswer = params[(\"MCQRadios-\"[email protected](question).to_s).to_sym]\n\t\t\t\t\t\tqScore=0\n\t\t\t\t\t\t# if there was an answer\n\t\t\t\t\t\tif answer != nil\n\t\t\t\t\t\t\t# get the percentage value of that answer\n\t\t\t\t\t\t\tvalue = question.Answer[question.Answer.index(answer)+answer.length+1..question.Answer.index(answer)+question.Answer[question.Answer.index(answer)..].index(\"%\")-1].to_i\n\t\t\t\t\t\t\t# set the quesiton score\n\t\t\t\t\t\t\tqScore=question.Points*value/100\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# if negatime marking was active apply it\n\t\t\t\t\t\tif qScore == 0 && question.Options.include?(\"NEG1\") && answer != nil\n\t\t\t\t\t\t\tqScore -= question.Options[5..].to_i\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# add score and answer to their respective array\n\t\t\t\t\t\tscores << qScore\n\t\t\t\t\t\tanswers << answer\n\t\t\t\t\t# if multiple answer\n\t\t\t\t\twhen \"MA\"\n\t\t\t\t\t\tanswer = params[(\"MACheckboxes-\"[email protected](question).to_s).to_sym]\n\t\t\t\t\t\tqScore=0\n\t\t\t\t\t\twrong = false\n\t\t\t\t\t\t# if there was an answer\n\t\t\t\t\t\tif answer != nil\n\t\t\t\t\t\t\t# for each selected answer\n\t\t\t\t\t\t\tfor check in answer\n\t\t\t\t\t\t\t\t# check if wrong answer was chosen\n\t\t\t\t\t\t\t\tif wrong == false\n\t\t\t\t\t\t\t\t\tvalue = question.Answer[question.Answer.index(check)+check.length+1..question.Answer.index(check)+question.Answer[question.Answer.index(check)..].index(\"%\")-1].to_i\n\t\t\t\t\t\t\t\t\t# if answer was wrong\n\t\t\t\t\t\t\t\t\tif value == 0\n\t\t\t\t\t\t\t\t\t\twrong = true\n\t\t\t\t\t\t\t\t\t\tqScore = 0\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t# update question score\n\t\t\t\t\t\t\t\t\tqScore+=question.Points*value/100\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t# fix the score for questions with no partial marking\n\t\t\t\t\t\t\tif question.Answer.scan(/(?=100)/).count != 0\n\t\t\t\t\t\t\t\tqScore /= question.Answer.scan(/(?=100)/).count\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# if partial marking was not active and the answer is not complete\n\t\t\t\t\t\tif question.Options.include?(\"PAR0\") && qScore != question.Points\n\t\t\t\t\t\t\tqScore = 0\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# if negatime marking was active apply it\n\t\t\t\t\t\tif qScore == 0 && question.Options.include?(\"NEG1\") && answer != nil\n\t\t\t\t\t\t\tqScore -= question.Options[5..question.Options.index(\"P\")-1].to_i\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# add score and answer to their respective array\n\t\t\t\t\t\tanswers << answer\n\t\t\t\t\t\tscores << qScore\n\t\t\t\t\t# if fill the blank\n\t\t\t\t\twhen \"FTB\"\n\t\t\t\t\t\tanswer = params[(\"FTBAnswer-\"[email protected](question).to_s).to_sym]\n\t\t\t\t\t\tanswerCopy = answer\n\t\t\t\t\t\ttargetAnswer = question.Answer[question.Answer.index(\"〔\")+1..question.Answer.index(\"〕\")-1]\n\t\t\t\t\t\tqScore=0\n\t\t\t\t\t\t# if there was an answer\n\t\t\t\t\t\tif answer != nil\n\t\t\t\t\t\t\t#if the answer is not case sensitive act accordingly\n\t\t\t\t\t\t\tif question.Options.include?(\"CAS0\")\n\t\t\t\t\t\t\t\ttargetAnswer = targetAnswer.upcase\n\t\t\t\t\t\t\t\tanswerCopy = answerCopy.upcase\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t#if multiple spaces are allowed act accordingly\n\t\t\t\t\t\t\tif question.Options.include?(\"MUL1\")\n\t\t\t\t\t\t\t\tanswerCopy = answer.squeeze().strip\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t#if answers that contain the correct answer are allowed act accordingly\n\t\t\t\t\t\t\tif question.Options.include?(\"CON1\")\n\t\t\t\t\t\t\t\tif answerCopy.include?(targetAnswer)\n\t\t\t\t\t\t\t\t\tqScore = question.Points\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tif answerCopy == targetAnswer\n\t\t\t\t\t\t\t\t\tqScore = question.Points\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# if negatime marking was active apply it\n\t\t\t\t\t\tif qScore == 0 && question.Options.include?(\"NEG1\") && answerCopy != nil\n\t\t\t\t\t\t\tqScore -= question.Options[5..].to_i\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# add score and answer to their respective array\n\t\t\t\t\t\tscores << qScore\n\t\t\t\t\t\tanswers << answer\n\t\t\t\t\t# if true false\n\t\t\t\t\twhen \"TF\"\n\t\t\t\t\t\tanswer = params[(\"TFRadio-\"[email protected](question).to_s).to_sym]\n\t\t\t\t\t\tqScore=0\n\t\t\t\t\t\t# if there was an answer\n\t\t\t\t\t\tif answer != nil\n\t\t\t\t\t\t\t# if the answer was correct\n\t\t\t\t\t\t\tif question.Answer.include?(answer)\n\t\t\t\t\t\t\t\tqScore = question.Points\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# if negatime marking was active apply it\n\t\t\t\t\t\tif qScore == 0 && question.Options.include?(\"NEG1\") && answer != nil\n\t\t\t\t\t\t\tqScore -= question.Options[5..].to_i\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# add score and answer to their respective array\n\t\t\t\t\t\tscores << qScore\n\t\t\t\t\t\tanswers << answer\n\t\t\t\t\t# if regular expression\n\t\t\t\t\twhen \"REG\"\n\t\t\t\t\t\tanswer = params[(\"REGAnswer-\"[email protected](question).to_s).to_sym]\n\t\t\t\t\t\tregex = Regexp.new question.Answer[question.Answer.index(\"〔\")+1..question.Answer.index(\"〕\")-1]\n\t\t\t\t\t\tqScore=0\n\t\t\t\t\t\t# if there was an answer\n\t\t\t\t\t\tif answer != nil\n\t\t\t\t\t\t\t# if the answer was correct\n\t\t\t\t\t\t\tif !(answer =~ regex).nil?\n\t\t\t\t\t\t\t\tqScore = question.Points\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# if negatime marking was active apply it\n\t\t\t\t\t\tif qScore == 0 && question.Options.include?(\"NEG1\") && answer != nil\n\t\t\t\t\t\t\tqScore -= question.Options[5..].to_i\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# add score and answer to their respective array\n\t\t\t\t\t\tscores << qScore\n\t\t\t\t\t\tanswers << answer\n\t\t\t\t\t# if formula\n\t\t\t\t\twhen \"FRM\"\n\t\t\t\t\t\tvalues = eval(params[(\"FRMvalues-\"[email protected](question).to_s).to_sym])\n\t\t\t\t\t\tformula = question.Answer[question.Answer.index(\"〔\")+1..question.Answer.index(\"〕\")-1]\n\t\t\t\t\t\t# calculate the correct answer with the student variable values\n\t\t\t\t\t\tfor val in values\n\t\t\t\t\t\t\tkey, value = val\n\t\t\t\t\t\t\tformula = formula.gsub(\"[\" + key.upcase + \"]\",value.to_s)\n\t\t\t\t\t\t\tformula = formula.gsub(\"[\" + key.downcase + \"]\",value.to_s)\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# round it\n\t\t\t\t\t\ttargetAnswer = eval(formula+\".to_f\").round(2)\n\t\t\t\t\t\tanswer = params[(\"FRMAnswer-\"[email protected](question).to_s).to_sym]\n\t\t\t\t\t\tqScore=0\n\t\t\t\t\t\t# if there was an answer\n\t\t\t\t\t\tif answer != nil\n\t\t\t\t\t\t\t# if answer error was allowed act accordingly\n\t\t\t\t\t\t\tif question.Options.include?(\"RAN1\")\n\t\t\t\t\t\t\t\trange = question.Options[question.Options.index(\"RAN1\")+5..].to_f\n\t\t\t\t\t\t\t\t# if within range\n\t\t\t\t\t\t\t\tif answer.to_f >= targetAnswer-range && answer.to_f <= targetAnswer+range\n\t\t\t\t\t\t\t\t\tqScore = question.Points\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t# if answer mathces\n\t\t\t\t\t\t\t\tif answer.to_f == targetAnswer\n\t\t\t\t\t\t\t\t\tqScore = question.Points\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# if negatime marking was active apply it\n\t\t\t\t\t\tif qScore == 0 && question.Options.include?(\"NEG1\") && answer != nil\n\t\t\t\t\t\t\tqScore -= question.Options[5..].to_i\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# add score and answer to their respective array\n\t\t\t\t\t\tscores << qScore\n\t\t\t\t\t\tanswers << answer\n\t\t\t\t\tend\n\t\t\t\t\t# set the scores and answers parameters\n\t\t\t\t\tparms[\"Scores\"] = scores\n\t\t\t\t\tparms[\"Answers\"] = answers\n\t\t\t\tend\n\t\t\t\trespond_to do |format|\n\t\t\t\t\tif @submission.update(parms)\n\t\t\t\t\t\[email protected]_submission_results(@assessment, @questions, @creator)\n\t\t\t\t\t\tformat.html { redirect_to \"/submissions/received\" }\n\t\t\t\t\t\tformat.json { redirect_to \"/submissions/received\" }\n\t\t\t\t\telse\n\t\t\t\t\t\tformat.html { render :edit, status: :unprocessable_entity }\n\t\t\t\t\t\tformat.json { render json: @submission.errors, status: :unprocessable_entity }\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tredirect_to root_url\n\t\t\tend\n\t\telse\n\t\t\tredirect_to \"/submissions/duplicate\", :error => 'Failed to record the submission.'\n\t\tend\n end", "def food_question1(food_answer1)\n if food_answer1 == \"never\"\n @food_score1 = 0\n elsif food_answer1 == \"1 - 3 days per week\"\n @food_score1 = 1\n elsif food_answer1 == \"4 or more days per week\"\n @food_score1 = 2\n end\n @food_score1\nend", "def create\n @answer = Answer.new(answer_params)\n\n @answer.question_id = flash[:question]\n @answer.student = current_student\n\n respond_to do |format|\n if @answer.save\n @question = @answer.question\n\n @answer.res1 = 0\n @answer.res2 = 0\n @answer.res3 = 0\n @answer.res4 = 0\n @answer.res5 = 0\n\n if @answer.ans1 == @question.ans1\n @answer.res1 = 1\n end\n if @answer.ans2 == @question.ans2\n @answer.res2 = 1\n end\n if @answer.ans3 == @question.ans3\n @answer.res3 = 1\n end\n if @answer.ans4 == @question.ans4\n @answer.res4 = 1\n end\n if @answer.ans5 == @question.ans5\n @answer.res5 = 1\n end\n\n @answer.total_res = @answer.res1 + @answer.res2 + @answer.res3 + @answer.res4 + @answer.res5\n @answer.save\n\n format.html { redirect_to @answer, notice: 'Answer was successfully created.' }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def success\n (correct_answers_count*100.0/answers_count).round.to_i if answers_count > 0\n end", "def calculate_goal_value_for(assessment_indicator:)\n return 0 if assessment.clean_slate?\n\n score = score_value_for(assessment_indicator: assessment_indicator)\n return score <= 3 ? 4 : 5 if is_5_year?\n return score if score == 5\n return score + 1\n end", "def answer\n if answered?\n answers.last.answer\n else\n [{:answer => \"not answered\"}]\n end\n end", "def ungraded_answers(submission)\n submission.reload.current_answers.select { |a| a.attempting? || a.submitted? }\n end", "def verify_answer\n @question = Question.find(@params[\"id\"])\n if @question.answer == @params[\"opt\"]\n @message = \"Parabéns você acertou!\"\n # incrementa o score\n \n ## DEVIA ESTAR DENTRO DE UM METODO MAS NAO ROLOU >>\n # ID STATICO ATE IMPLEMENTAR O LOGIN\n system_user_id = '113770868853085.84'\n time_control = Time.now.strftime('%Y-%m-%d %I:%M:%S') \n @user_score = UserScore.find(:conditions => {:user_id => system_user_id}).first\n if @user_score == nil\n @user_score = UserScore.new({:score => 1, :user_id => system_user_id, :time_control => time_control})\n else\n # Atualiza o score\n @user_score.score = @user_score.score + 1\n # Atualiza o time_control\n @user_score.time_control = time_control\n end\n ## <<< DEVIA ESTAR DENTRO DE UM METODO MAS NAO ROLOU >>\n\n # Salva o score\n @user_score.save\n\n @correct = true\n else\n @message = \"Opa Resposta errada.\"\n @correct = false\n end\n render :action => :verify_answer, :back => url_for(:action => :question_rand)\n end", "def create_answers_if\n if self.type.name == 'satisfaction-100'\n 5.times do |n|\n Answer.create(question: self, value: (n*25).to_s + \"%\")\n end\n end\n if self.type.name == 'free-text'\n Answer.create(question: self, value: \"textarea\")\n end\n end", "def scoring(answer)\n# everytime someone chooses a certain letter than 1 will be added on to their behind the senses score \n if answer == \"a\"\n @@action += 1\n elsif answer == \"b\"\n @@romance += 1\n elsif answer == \"c\"\n @@horror += 1\n elsif answer == \"d\"\n @@family += 1\n elsif answer == \"e\"\n @@comedy += 1\n else\n return \"nothing\"\n end\n\nend", "def value\n return @value if @value\n\n return @value = 900 if royal_flush?\n return @value = 800 + high_card_bonus if straight_flush?\n return @value = 700 + high_card_bonus if four_of_a_kind?\n return @value = 600 + high_card_bonus if full_house?\n return @value = 500 + high_card_bonus if flush?\n return @value = 400 + high_card_bonus if straight?\n return @value = 300 + high_card_bonus if three_of_a_kind?\n return @value = 200 + high_card_bonus if two_pairs?\n return @value = 100 + high_card_bonus if pair?\n @value = self.cards.map {|card| card.value}.inject(:+)\n end", "def prompt_player_for_answer(question)\n\n puts \"\"\n puts question.text_of_question\n puts \"\"\n\n question.answer = gets.chomp.to_f.round(2)\n\nend", "def answer_value_params\n params.require(:answer_value).permit(:score)\n end", "def score\n return 0 unless valid?\n 100 * card_value_decimal * 15 ** 5\n end", "def evaluate_answers\n self.answers.each do |a|\n q = a.question\n a.correct = (a.answer_mask == q.answer_mask)\n a.save(:validate=>false)\n end\n end", "def first_answer( )\n @first_answer\n ensure\n @first_answer = nil\n end", "def default_value(options)\n # Return early if the values for the given slot don't exist\n return nil if @values[options[:slot]].nil?\n\n value = 0.00\n slotval = @values[options[:slot]]\n\n slotval.each_pair do |range, values|\n if range.include? options[:level]\n if values.is_a? Array\n # It's an array, meaning the first value is for non-Hunters, and the second value is for Hunters\n value = (options[:class] == 'Hunter') ? values[1] : values[0]\n else\n value = values\n end\n end\n end\n\n value\n end", "def validate_answer(result, right_answer, status, start_time, time)\r\n case result\r\n when right_answer\r\n # Get the stop time stamp to calculate the score, the faster to get the answer, the more bounds score is earned.\r\n answer_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)\r\n time_used = (answer_time - start_time).round(1)\r\n # Basic socre for each corrent answer is 500\r\n total_score = 500 + (time - time_used) * 10\r\n # Update the score and pass back to the loop\r\n status[0] += total_score\r\n status[1] += 1\r\n puts \"\\n\\n Hooray!!! You got it!!\"\r\n\r\n else\r\n puts \"\\n\\nSorry, not correct answer or time expired!\\nIt's fine. Let's keep going\"\r\n status[2] += 1\r\n end\r\n enter_to_continue\r\n end", "def result\n @result || :no_answer\n end", "def result\n @result || :no_answer\n end", "def ask_q\n @current_ans = generate_q\n end", "def total_score\n score || 0 #pos - neg\n end", "def fitness_question2(fitness_answer2)\n if fitness_answer2 == \"I work really hard and sweat A LOT.\"\n @fitness_score2 = 0\n elsif fitness_answer2 == \"I work pretty hard but take a lot of breaks.\"\n @fitness_score2 = 1\n elsif fitness_answer2 == \"I don't sweat.\"\n @fitness_score2 = 2\n end\n @fitness_score2\nend", "def update_answers\n last_user_answers.each do |lua|\n lua.correct= (lua.response.to_f == self.response.to_f)\n lua.save!\n end\n end", "def zero?; end", "def zero?; end", "def mark_answer(response)\n correct_answers.include?(response) ? 100 : 0\n end", "def answer=(value)\n @children['answer'][:value] = value\n end", "def set_defaults\n self.current_score ||= 0\n self.highest_score ||= 0\n self.total_correct ||= 0\n self.total_worth_credit ||= 0\n end", "def update_w_ans!(answer)\n\t\t# answer.points = points_for(answer.correct)\n\t\t\n\t\tanswer.points = points_for(answer, self.quiz_instance.quiz.quiz_type)\n\t\tanswer.save\n\n\t\tself.problem_stat = stat.update_w_ans!(answer)\n\t\t\n\t\tself.remaining = remaining - 1\n\t\tchange_problem\n\t\tsave\n\tend", "def correct_ratio\n all = stats.where(\"answer_id >= 0\").size.to_f\n all > 0 ? correct_count.to_f/all : 0\n end", "def answers=(value)\n @answers = value\n end", "def update\n @user = User.find(params[:id])\n average = 0\n \n if @user.update_attributes(user_params)\n flash[:success] = \"Profile updated\"\n \n # QUESTION ONE: HUNGER FOR WISDOM\n if @user.current_one == 1 \n @user.increment(:one_counter, 1)\n @user.save\n @user.increment(:total_one, 1)\n average = (@user.total_one / @user.one_counter)\n @user.update_attribute :question_one_new, average\n end\n if @user.current_one == 2\n @user.increment(:one_counter, 1)\n @user.save\n @user.increment(:total_one, 2)\n average = (@user.total_one / @user.one_counter)\n @user.update_attribute :question_one_new, average\n end\n if @user.current_one == 3 \n @user.increment(:one_counter, 1)\n @user.save\n @user.increment(:total_one, 3)\n average = (@user.total_one / @user.one_counter)\n @user.update_attribute :question_one_new, average\n end\n if @user.current_one == 4\n @user.increment(:one_counter, 1)\n @user.save\n @user.increment(:total_one, 4)\n average = (@user.total_one / @user.one_counter)\n @user.update_attribute :question_one_new, average\n end\n if @user.current_one == 5\n @user.increment(:one_counter, 1)\n @user.save\n @user.increment(:total_one, 5)\n average = (@user.total_one / @user.one_counter)\n @user.update_attribute :question_one_new, average\n end\n \n # QUESTION TWO: EXPECT THE BEST\n average1 = 0\n if @user.current_two == 1 \n @user.increment(:two_counter, 1)\n @user.save\n @user.increment(:total_two, 1)\n average1 = (@user.total_two / @user.two_counter)\n @user.update_attribute :question_two, average1\n end\n if @user.current_two == 2\n @user.increment(:two_counter, 1)\n @user.save\n @user.increment(:total_two, 2)\n average1 = (@user.total_two / @user.two_counter)\n @user.update_attribute :question_two, average1\n end\n if @user.current_two == 3 \n @user.increment(:two_counter, 1)\n @user.save\n @user.increment(:total_two, 3)\n average1 = (@user.total_two / @user.two_counter)\n @user.update_attribute :question_two, average1\n end\n if @user.current_two == 4\n @user.increment(:two_counter, 1)\n @user.save\n @user.increment(:total_two, 4)\n average1 = (@user.total_two / @user.two_counter)\n @user.update_attribute :question_two, average1\n end\n if @user.current_two == 5\n @user.increment(:two_counter, 1)\n @user.save\n @user.increment(:total_two, 5)\n average1 = (@user.total_two / @user.two_counter)\n @user.update_attribute :question_two, average1\n end\n \n # QUESTION THREE: ACCEPT RESPONSIBILITY\n average2 = 0\n if @user.current_three == 1 \n @user.increment(:three_counter, 1)\n @user.save\n @user.increment(:total_three, 1)\n average2 = (@user.total_three / @user.three_counter)\n @user.update_attribute :question_three, average2\n end\n if @user.current_three == 2\n @user.increment(:three_counter, 1)\n @user.save\n @user.increment(:total_three, 2)\n average2 = (@user.total_three / @user.three_counter)\n @user.update_attribute :question_three, average2\n end\n if @user.current_three == 3 \n @user.increment(:three_counter, 1)\n @user.save\n @user.increment(:total_three, 3)\n average2 = (@user.total_three / @user.three_counter)\n @user.update_attribute :question_three, average2\n end\n if @user.current_three == 4\n @user.increment(:three_counter, 1)\n @user.save\n @user.increment(:total_three, 4)\n average2 = (@user.total_three / @user.three_counter)\n @user.update_attribute :question_three, average2\n end\n if @user.current_three == 5\n @user.increment(:three_counter, 1)\n @user.save\n @user.increment(:total_three, 5)\n average2 = (@user.total_three / @user.three_counter)\n @user.update_attribute :question_three, average2\n end\n \n # QUESTION FOUR: RESPOND WITH COURAGE\n average3 = 0\n if @user.current_four == 1 \n @user.increment(:four_counter, 1)\n @user.save\n @user.increment(:total_four, 1)\n average3 = (@user.total_four / @user.four_counter)\n @user.update_attribute :question_four, average3\n end\n if @user.current_four == 2\n @user.increment(:four_counter, 1)\n @user.save\n @user.increment(:total_four, 2)\n average3 = (@user.total_four / @user.four_counter)\n @user.update_attribute :question_four, average3\n end\n if @user.current_four == 3 \n @user.increment(:four_counter, 1)\n @user.save\n @user.increment(:total_four, 3)\n average3 = (@user.total_four / @user.four_counter)\n @user.update_attribute :question_four, average3\n end\n if @user.current_four == 4\n @user.increment(:four_counter, 1)\n @user.save\n @user.increment(:total_four, 4)\n average3 = (@user.total_four / @user.four_counter)\n @user.update_attribute :question_four, average3\n end\n if @user.current_four == 5\n @user.increment(:four_counter, 1)\n @user.save\n @user.increment(:total_four, 5)\n average3 = (@user.total_four / @user.four_counter)\n @user.update_attribute :question_four, average3\n end\n \n # QUESTION FIVE: THANK OTHERS FIRST\n average4 = 0\n if @user.current_five == 1 \n @user.increment(:five_counter, 1)\n @user.save\n @user.increment(:total_five, 1)\n average4 = (@user.total_five / @user.five_counter)\n @user.update_attribute :question_five, average4\n end\n if @user.current_five == 2\n @user.increment(:five_counter, 1)\n @user.save\n @user.increment(:total_five, 2)\n average4 = (@user.total_five / @user.five_counter)\n @user.update_attribute :question_five, average4\n end\n if @user.current_five == 3 \n @user.increment(:five_counter, 1)\n @user.save\n @user.increment(:total_five, 3)\n average4 = (@user.total_five / @user.five_counter)\n @user.update_attribute :question_five, average4\n end\n if @user.current_five == 4\n @user.increment(:five_counter, 1)\n @user.save\n @user.increment(:total_five, 4)\n average4 = (@user.total_five / @user.five_counter)\n @user.update_attribute :question_five, average4\n end\n if @user.current_five == 5\n @user.increment(:five_counter, 1)\n @user.save\n @user.increment(:total_five, 5)\n average4 = (@user.total_five / @user.five_counter)\n @user.update_attribute :question_five, average4\n flash[:success] = \"Team member's scores were added! Please select 'Next Employee' below to continue\"\n end\n \n \n \n # ADD ADMIN AND SECOND_TIER UPDATES HERE\n if @user.role == 0 \n @user.update_attribute :admin, true\n end\n if @user.role == 3 || @user.role == 4 || @user.role == 5\n @user.update_attribute :second_tier, true\n @user.update_attribute :admin, false\n end\n if @user.role == 1 || @user.role == 2\n @user.update_attribute :admin, false\n @user.update_attribute :second_tier, false\n end\n \n #flash[:success] = \"Profile updated\"\n redirect_to :back\n else\n render 'edit'\n end\n end", "def answer?\n return @answer\n end", "def process_answer(params)\n channel_id = params[:channel_id]\n return process_final(params) if $redis.exists(\"final_category:#{channel_id}\")\n user_id = params[:user_id]\n user_nick = params[\"user_name\"]\n key = \"current_question:#{channel_id}\"\n current_question = $redis.get(key)\n reply = \"\"\n if current_question.nil?\n reply = trebek_me if !$redis.exists(\"shush:answer:#{channel_id}\")\n else\n current_question = JSON.parse(current_question)\n current_answer = current_question[\"answer\"]\n user_answer = params[:text]\n answered_key = \"user_answer:#{channel_id}:#{current_question[\"id\"]}:#{user_id}\"\n if $redis.exists(answered_key)\n reply = \"@#{user_nick}, you had your chance. Let someone else answer.\"\n elsif params[\"timestamp\"].to_f > current_question[\"expiration\"]\n if is_correct_answer?(current_answer, user_answer)\n reply = \"@#{user_nick}: That is correct, but time's up! Remember, you only have #{ENV[\"SECONDS_TO_ANSWER\"]} seconds to answer.\"\n else\n reply = \"@#{user_nick}: Time's up! Remember, you have #{ENV[\"SECONDS_TO_ANSWER\"]} seconds to answer. The correct answer is `#{current_question[\"answer\"]}`.\"\n end\n mark_question_as_answered(channel_id)\n elsif is_question_format?(user_answer) && is_correct_answer?(current_answer, user_answer)\n score = update_score(user_id, current_question[\"value\"])\n reply = \"@#{user_nick}: That is correct. #{trebek_right_score} #{currency_format(score)}.\"\n check_final_jeopardy_valid(channel_id)\n mark_question_as_answered(channel_id)\n elsif is_correct_answer?(current_answer, user_answer)\n score = update_score(user_id, (current_question[\"value\"] * -1))\n reply = \"@#{user_nick}: That is correct, but responses have to be in the form of a question. Your total score is #{currency_format(score)}.\"\n $redis.setex(answered_key, ENV[\"SECONDS_TO_ANSWER\"], \"true\")\n check_final_jeopardy_valid(channel_id)\n else\n score = update_score(user_id, (current_question[\"value\"] * -1))\n reply = \"@#{user_nick}: #{trebek_wrong} #{trebek_wrong_score} #{currency_format(score)}.\"\n $redis.setex(answered_key, ENV[\"SECONDS_TO_ANSWER\"], \"true\")\n end\n end\n reply\nend", "def one_question_score(last_n=nil)\n answers = survey_questions.map(&:survey_answers).flatten\n answers = answers[last_n * -1, last_n] if last_n && answers.size >= last_n\n count = answers.size.to_f\n positive = answers.select{|a| [9,10].include?(a.answer.to_f) }.size.to_f\n negative = answers.select{|a| (1..6).include?(a.answer.to_f) }.size.to_f\n ((positive/count)-(negative/count)) * 100\n end", "def food_question3(food_answer3)\n if food_answer3 == \"none\"\n @food_score3 = 0\n elsif food_answer3 == \"1 meal\"\n @food_score3 = 1\n elsif food_answer3 == \"2+ meals\"\n @food_score3 = 2\n end\n @food_score3\nend", "def score\n # an answer has a reference to a score. we simply can return\n # the score of that choice (which is defined by the teacher)\n choice.score\n end", "def update\n unless @submission.evaluated.blank?\n respond_to do |format|\n format.html { redirect_to test_submission_path(@test, @submission), info: \"Evaluated!\" }\n end\n return\n end\n\n unless Time.now > @timeout + 5.seconds\n @submission.answers_of_questions.each do |user_answer|\n user_answer.update(choice: submission_params.fetch(user_answer.answer_id.to_s, \"false\"))\n end\n end\n if Time.now > @timeout || params[:evaluate]\n @test.questions.each do |question|\n crrct = get_result(question)\n @submission.increment!(:point, question.point) if crrct\n @submission.question_evaluations.create({question_id: question.id, value: crrct})\n end\n @submission.update(evaluated: true)\n respond_to do |format|\n format.html { redirect_to test_submission_path(@test, @submission) }\n end\n else\n respond_to do |format|\n format.html { redirect_to submissions_path, success: 'Submission was successfully saved.' }\n end\n end\n\n end", "def default_values\n \tself.total_worth ||= 0\n \tend", "def evaluate_answer(answer)\n question = answer.question.actable\n answer_text_array = answer.normalized_answer_text.downcase.gsub(/([^a-z ])/, ' ').split(' ')\n answer_text_lemma_array = []\n answer_text_array.each { |a| answer_text_lemma_array.push(WordNet::Synset.morphy_all(a).first || a) }\n\n hash_lifted_word_points = hash_compre_lifted_word(question)\n hash_keyword_solutions = hash_compre_keyword(question)\n\n lifted_word_status = find_compre_lifted_word_in_answer(answer_text_lemma_array, hash_lifted_word_points)\n keyword_status = find_compre_keyword_in_answer(answer_text_lemma_array, lifted_word_status, hash_keyword_solutions)\n\n answer_text_lemma_status = {\n 'compre_lifted_word': lifted_word_status,\n 'compre_keyword': keyword_status\n }\n\n answer_grade = grade_for(question, answer_text_lemma_status)\n\n [\n correctness_for(question, answer_grade),\n answer_grade,\n explanations_for(question, answer_grade, answer_text_array, answer_text_lemma_status)\n ]\n end", "def reward\n -queue.sum.to_f if feasible?\n end", "def answers_count\n\n\n self.answers_count_yeses + self.answers_count_noes\n\n\n end", "def scale_criterion_question(count, answer = nil, questionnaire_min, questionnaire_max)\n if size.nil? || size.blank?\n cols = '70'\n rows = '1'\n else\n cols = size.split(',')[0]\n rows = size.split(',')[1]\n end\n html = '<input id=\"responses_' + count.to_s + '_score\" name=\"responses[' + count.to_s + '][score]\" type=\"hidden\"'\n html += 'value=\"' + answer.answer.to_s + '\"' unless answer.nil?\n html += '><table><tr><td width=\"10%\"></td>'\n\n (questionnaire_min..questionnaire_max).each do |j|\n html += '<td width=\"10%\"><label>' + j.to_s + '</label></td>'\n end\n\n html += '<td width=\"10%\"></td></tr><tr><td width=\"10%\">'\n html += min_label unless min_label.nil?\n html += '</td>'\n\n (questionnaire_min..questionnaire_max).each do |j|\n html += '<td width=\"10%\"><input type=\"radio\" id=\"' + j.to_s + '\" value=\"' + j.to_s + '\" name=\"Radio_' + id.to_s + '\"'\n html += 'checked=\"checked\"' if (!answer.nil? && answer.answer == j) || (answer.nil? && questionnaire_min == j)\n html += '></td>'\n end\n html += '<script>jQuery(\"input[name=Radio_' + id.to_s + ']:radio\").change(function() {'\n html += 'var response_score = jQuery(\"#responses_' + count.to_s + '_score\");'\n html += 'var checked_value = jQuery(\"input[name=Radio_' + id.to_s + ']:checked\").val();'\n html += 'response_score.val(checked_value);});</script><td width=\"10%\">'\n html += max_label unless max_label.nil?\n html += '</td><td width=\"10%\"></td></tr></table>'\n html += '<textarea cols=' + cols + ' rows=' + rows + ' id=\"responses_' + count.to_s + '_comments\"' \\\n ' name=\"responses[' + count.to_s + '][comment]\" class=\"tinymce\">'\n html += answer.comments if !answer.nil? && !answer.comments.nil?\n html += '</textarea>'\n end", "def true_point_value\n\t\ttotal = 0\n\t\ttotal += points_scored\n\t\ttotal += field_goals_made * season.field_goals_made_point_value\n\t\ttotal -= field_goals_attempted * season.field_goals_attempted_point_value\n\t\ttotal += free_throws_made * season.free_throws_made_point_value\n\t\ttotal -= free_throws_attempted * season.free_throws_attempted_point_value\n\t\ttotal += three_pointers_made * season.three_pointers_made_point_value\n\t\ttotal += assists * season.assists_point_value\n\t\ttotal += total_rebounds * season.total_rebounds_point_value\n\t\ttotal += steals * season.steals_point_value\n\t\ttotal += blocks * season.blocks_point_value\n\t\ttotal -= turnovers * season.turnovers_point_value\n\t\ttotal\n\tend", "def has_answers?\n answer_count > 0\n end", "def question_results\n result = params[:result]\n @result = result\n game_id = params[:game_id]\n subject = params[:subject_title]\n @current_game = Game.find(game_id)\n @current_game.save!\n\n if @current_game.active? && @current_game.players_turn?(current_user.id)\n @current_game.game_stat.apply_question_result(subject, result)\n applied_result = current_user.apply_question_results(subject, result)\n check_question_result(applied_result)\n if @current_game.normal_round?\n @bonus = params[:bonus]\n @current_game.bonus = @bonus\n game_result = @current_game.apply_to_normal_round(subject, current_user.id, @result)\n if game_result == Game::TIE\n @current_game.update_attributes(game_status: Game::ACTIVE, bonus: Game::BONUS_FALSE)\n @current_game.save\n wager = @current_game.get_wagerable_trophies(current_user.id).first\n prize = @current_game.get_winnable_trophies(current_user.id).first\n @challenge = Challenge.create_challenge(@current_game.id, current_user.id, @current_game.opponent_id(current_user.id), wager, prize)\n @challenge.save\n redirect_to game_ask_question_path and return\n end\n if @current_game.finished?\n current_user.apply_game_result(@current_game.id)\n @current_game.opponent(current_user.id).apply_game_result(@current_game.id)\n notify_game_outcome(@current_game)\n back_to_index and return\n elsif @current_game.players_turn?(current_user.id)\n back_to_game(@current_game.id)\n else\n check_new_game\n back_to_index and return\n end\n elsif @current_game.challenge_round?\n @challenge = Challenge::get_ongoing_challenge_by_game(@current_game.id)\n if @challenge\n if @challenge.valid_challenge?\n challenge_result = @challenge.apply_question_result(current_user.id, result, @current_game.bonus)\n if challenge_result == Challenge::RESULT_OPPONENT_TURN\n @current_game.increase_turn_count\n @current_game.end_round(current_user.id)\n back_to_index and return\n elsif challenge_result == Challenge::RESULT_TIE && current_user.id == @challenge.opponent_id\n @current_game.bonus = Game::BONUS_TRUE\n @current_game.save!\n ask_another_question(@current_game.id)\n elsif challenge_result == Challenge::RESULT_WINNER\n @current_game.apply_challenge_results(challenge_result, @challenge.challenger_id, @challenge.winner_id, @challenge.wager, @challenge.prize)\n notify_challenge_outcome(@challenge)\n @current_game.end_challenge(@challenge)\n @current_game.increase_turn_count\n @current_game.end_round(current_user.id)\n if @current_game.finished?\n notify_game_outcome(@current_game)\n end\n back_to_index and return\n else\n ask_another_question(@current_game.id)\n end\n else\n redirect_to game_challenge_path(:game_id => @current_game.id)\n end\n else\n redirect_to game_challenge_path(:game_id => @current_game.id)\n end\n end\n else\n back_to_index\n end\n end", "def answer_for(options, q, default = nil)\n options[:answers][q] ? options[:answers][q] : default\n end", "def grade\n @question = self.question\n #only grade if they've responded\n if self.responded == true\n self.correct = (response == self.question.solution) \n self.blank = self.response == nil\n end\n self.save\n end", "def score\n @score || calculate_score\n end", "def value\n return self.upvote ? 1 : -1\n end", "def nochoice?\n multi? ? (@value.empty?) : (@value == 0)\n end", "def verify_answer?(question, answer)\n case question[:type]\n when :add\n question[:first_num] + question[:second_num] == answer\n when :subtract\n question[:first_num] - question[:second_num] == answer\n when :multiply\n question[:first_num] * question[:second_num] == answer\n when :divide\n question[:first_num] / question[:second_num] == answer\n end\nend", "def verify_answer(answer)\n if answer == @total.to_s\n puts \"Right!\".green\n @current_player.get_point\n else\n puts \"Wrong! The correct answer is #{@total}.\".red\n @current_player.lose_life\n end\n end", "def update!(**args)\n @answers_value_gender = args[:answers_value_gender] if args.key?(:answers_value_gender)\n @num_answers = args[:num_answers] if args.key?(:num_answers)\n end", "def ask_for_answer(curr_question, answer_hash, correct, colorized_ans = nil)\n fifty = $game_session.fifty_fifty == 0 ? \"#{$game_session.fifty_fifty}\".colorize(:red) : \"#{$game_session.fifty_fifty}\"\n phone = $game_session.phone_a_friend == 0 ? \"#{$game_session.phone_a_friend}\".colorize(:red) : \"#{$game_session.phone_a_friend}\"\n puts \" Current bear-bucks: #{$game_session.current_total_score} 50/50: #{fifty} Phone-a-friend: #{phone}\"\n puts\n print \"Enter your answer: \"\n # user_input = gets.chomp\n user_input = get_answer(curr_question)\n\n # Check for use of gameshow helpers\n if (user_input.downcase.start_with?(\"fifty\") || user_input.start_with?(\"50\"))\n if $game_session.fifty_fifty == 0\n no_helper_usage(\"fifty-fifty\", curr_question, answer_hash, correct, colorized_ans)\n else\n colorized_ans = fifty_fifty(answer_hash, correct)\n print_question(curr_question)\n puts colorized_ans\n ask_for_answer(curr_question, answer_hash, correct, colorized_ans)\n end\n elsif (user_input.downcase.start_with?(\"phone\"))\n if $game_session.phone_a_friend == 0\n no_helper_usage(\"phone-a-friend\", curr_question, answer_hash, correct, colorized_ans)\n else\n phone_a_friend(curr_question, answer_hash, colorized_ans)\n ask_for_answer(curr_question, answer_hash, correct, colorized_ans)\n end\n # Else check answer for correctness\n else\n check_answer(curr_question, answer_hash, user_input)\n sleep(3) if !$TEST_MODE\n system \"clear\"\n end\nend", "def incorrect_answer(text)\n answer = Answer.new(text, false)\n @errorReporter.register answer\n @test.last_question.add_answer answer\nend", "def validate_answer(answer)\n answer == @result\n end", "def calc_attr_value(experiments)\n results = []\n \n experiments.each do |exp|\n \n results << result(exp[:assay])\n end\n \n if results.size >0 \n positive = results.count {|statement| statement.to_s.include?(\"Positive\") == true}\n negative = results.count {|statement| statement.to_s.include?(\"Negative\") == true}\n \n if(positive >= negative)\n return \"TRUE\"\n elsif(negative > positive)\n return \"FALSE\"\n else\n return \"?\"\n end\n else\n return \"?\"\n end\n end", "def score_calc\n\t\tif self.saturday.blank?\n\t\t\tscore = 0\n\t\telse\n\t\t\tscore = self.saturday + self.hobby + self.major + self.sleep + self.music\t\n\t\tend\n\t\treturn score\n\tend", "def reset_stats\n self.actual_rounds = 0\n self.points = 0\n self.average = 0.0\n self.total_correct = 0\n self.total_errors = 0\n self.rank = 0\n \n # total quizzes\n total_quizzes = 0\n self.quiz_team.round_teams.each do |round_team|\n total_quizzes += 1 if round_team.round.complete? and round_team.round.from_prelims?\n end\n self.total_rounds = total_quizzes\n end", "def up_vote\n answer = Academy::Answer.find(params[:answer])\n vote = Academy::Vote.where(:user_id => current_user.id, :answer_id => answer.id)\n \n if vote.empty?\n answer.vote_up\n vote = Academy::Vote.new(:vote => 1, :user_id => current_user.id, :answer_id => answer.id)\n vote.save\n elsif vote.first.vote == -1\n answer.vote_up_from_down\n Academy::Vote.update_votes( current_user.id, answer.id, 1)\n end\n redirect_to answer.question\n end", "def update\n answer = current_user.answers.create!(quiz: @quiz, correctness: (params[:answer].to_i > 0) )\n\n respond_to do |format|\n format.html { redirect_to topic_quiz_path(@quiz, @quiz.topic), notice: 'Your answer is saved.' }\n format.json { render :show, status: :ok, location: topic_quiz_path(@quiz, @quiz.topic) }\n end\n end", "def update\n \t@answer1 = params[:input1]\n \t@answer2 = params[:input2]\n \t@answer3 = params[:input3]\n \t@answer4 = params[:input4]\n \t@answer5 = params[:input5]\n\n \t@user = current_user\n \t@score = @user.score\n \t@quizscore = 0\n \t@quiz = Quiz.find(params[:id])\n @perfects = 0\n @quiztotal = @user.quizzes_taken + 1\n \t\n\n if @quiz.check1 == @quiz.answer1\n @score = @score + 1 \n @quizscore = @quizscore + 1\n end\n if @quiz.check2 == @quiz.answer2\n @score = @score + 1\n @quizscore = @quizscore + 1\n end\n if @quiz.check3 == @quiz.answer3\n @score = @score + 1\n @quizscore = @quizscore + 1\n end\n if @quiz.check4 == @quiz.answer4\n @score = @score + 1\n @quizscore = @quizscore + 1\n end\n if @quiz.check5 == @quiz.answer5\n @score = @score + 1\n @quizscore = @quizscore + 1\n end\n\n if @quizscore == 5\n @perfects = @perfects + 1\n @user.update_attributes(perfect_scores: @perfects)\n end\n \n #Allows users to submit their quizzes for gradsing and logs the event\n if current_user.is_admin != true \n @log = Log.new\n @log.update_attributes(score: @quizscore, userid: @user.id, quizid: @quiz.id, user: @user.email,\n quiz: @quiz.name, last_sign_in_ip: @user.current_sign_in_ip, event: \"Quiz Taken\") \t\n @user.update_attributes(score: @score, quizzes_taken: @quiztotal)\n\n if @quiz.update_attributes(check1: @answer1, check2: @answer2, check3: @answer3, check4: @answer4, check5: @answer5)\n redirect_to root_path\n flash[:success] = \"You got \" + @quizscore.to_s + \"/5 correct!\"\n end\n end\n\n \n if current_user.is_admin?\n #Declares required variables for admins to update quizzes\n @name = params[:name]\n @question1 = params[:question1]\n @question2 = params[:question2]\n @question3 = params[:question3]\n @question4 = params[:question4]\n @question5 = params[:question5]\n @ans1 = params[:answer1]\n @ans2 = params[:answer2]\n @ans3 = params[:answer3]\n @ans4 = params[:answer4]\n @ans5 = params[:answer5]\n @dis11 = params[:distract11]\n @dis12 = params[:distract12]\n @dis13 = params[:distract13]\n @dis21 = params[:distract21] \n @dis22 = params[:distract22]\n @dis23 = params[:distract23]\n @dis31 = params[:distract31]\n @dis32 = params[:distract32]\n @dis33 = params[:distract33]\n @dis41 = params[:distract41]\n @dis42 = params[:distract42]\n @dis43 = params[:distract43]\n @dis51 = params[:distract51]\n @dis52 = params[:distract52]\n @dis53 = params[:distract53]\n\n #Updates quiz parameters for new questions answers and distractors\n @quiz.update_attributes(name: @name, question1: @question1, question2: @question2, question3: @question3, question4: @question4,\n question5: @question5, answer1: @ans1, answer2: @ans2, answer3: @ans3, answer4: @ans3, answer5: @ans5, distract11: @dis11, distract12: @dis12,\n distract13: @dis13, distract21: @dis21, distract22: @dis22, distract23: @dis23, distract31: @dis31, distract32: @dis32, distract33: @dis33,\n distract41: @dis41, distract42: @dis42, distract43: @dis43, distract51: @dis51, distract52: @dis52, distract53: @dis53)\n\n @log = Log.new\n @log.update_attributes(updated_by: @user.email, quizid: @quiz.id, event: \"Quiz Updated\", \n last_sign_in_ip: @user.current_sign_in_ip)\n\n redirect_to admin_panel_quizzes_path\n \n \n end\n end", "def handle_yes_no_question\n answer = %w[Yes No].sample\n @user.session[:last_answer] = answer\n say answer\n end" ]
[ "0.60921997", "0.5995304", "0.5922094", "0.5890159", "0.58310676", "0.5801553", "0.5778569", "0.5728722", "0.5722945", "0.5717269", "0.5703468", "0.56971025", "0.56855345", "0.567465", "0.5656992", "0.56567484", "0.5651316", "0.5649905", "0.5641304", "0.5634704", "0.5615481", "0.5609085", "0.5605298", "0.5604196", "0.5573845", "0.55720747", "0.55686194", "0.5557666", "0.55408615", "0.5525981", "0.5512927", "0.55044365", "0.5497131", "0.5496177", "0.5493393", "0.54905623", "0.54772705", "0.54605466", "0.541208", "0.5410149", "0.53796166", "0.53795624", "0.5379331", "0.5365096", "0.53636754", "0.5358603", "0.5342562", "0.53252584", "0.5321427", "0.53096956", "0.5302689", "0.52978176", "0.52938163", "0.528817", "0.528817", "0.5288081", "0.5286433", "0.52809733", "0.5269501", "0.5267622", "0.5267622", "0.5264425", "0.52592283", "0.525345", "0.5248607", "0.5244082", "0.52426696", "0.5234865", "0.5227526", "0.5224531", "0.5224292", "0.5213698", "0.52101237", "0.5202065", "0.5200864", "0.5197901", "0.51971126", "0.51961404", "0.51842093", "0.51840436", "0.51811594", "0.5177606", "0.516656", "0.51656294", "0.51638633", "0.51617324", "0.5160693", "0.51585823", "0.5158163", "0.51537484", "0.5146209", "0.51458937", "0.51456875", "0.5143877", "0.5143425", "0.5132211", "0.5122048", "0.5120784", "0.5120265", "0.5115031" ]
0.51271373
96
optimal_answer should not take into account the beta timer
def optimal_answer? answer_value == optimal_value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def best_option\n ab_test_options.reject { |opt| opt.value_times_rate.nan? }.max_by(&:value_times_rate)\n end", "def reward\n -queue.sum.to_f if feasible?\n end", "def who_is_beta\n fairness = fairness_level_comparison\n if fairness < 0\n -1\n elsif fairness > 0\n 1\n else\n 0\n end\n end", "def combo_optimal?\n optimal_value == combo_witheffect\n end", "def validate_answer(result, right_answer, status, start_time, time)\r\n case result\r\n when right_answer\r\n # Get the stop time stamp to calculate the score, the faster to get the answer, the more bounds score is earned.\r\n answer_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)\r\n time_used = (answer_time - start_time).round(1)\r\n # Basic socre for each corrent answer is 500\r\n total_score = 500 + (time - time_used) * 10\r\n # Update the score and pass back to the loop\r\n status[0] += total_score\r\n status[1] += 1\r\n puts \"\\n\\n Hooray!!! You got it!!\"\r\n\r\n else\r\n puts \"\\n\\nSorry, not correct answer or time expired!\\nIt's fine. Let's keep going\"\r\n status[2] += 1\r\n end\r\n enter_to_continue\r\n end", "def find_optimal(rootCode,goalCode)\n\tfindHops(rootCode, goalCode, \n\t\tlambda{|flight,oldweight| \n\t\t\toldweight + (flight.date.date.to_i + (flight.flightDuration).seconds - @date.date.to_i)/1200 + 100 + flight.seatprice/5 \n\t\t\t# oldweight + (number of hours between arrival and departure + 100 (per hop))*3 + seatprice/5 (~25-250)\n\t\t\t})\nend", "def update!(**args)\n @optimal_trials = args[:optimal_trials] if args.key?(:optimal_trials)\n end", "def solve\n a = Time.new\n for i in 0..@itemsSize - 1\n @table[0][i] = 0\n end\n \n for i in 1..@itemsSize - 1\n price = @problem.prices[i-1]\n weight = @problem.weights[i-1]\n for w in 1..@weights - 1\n if weight <= w\n if (price + @table[w - weight][i - 1]) > @table[w][i -1]\n @table [w][i]= price + @table[w - weight][i - 1]\n else\n @table[w][i] = @table[w][i - 1]\n end\n else\n @table[w][i] = @table[w][i - 1]\n end\n end\n end\n \n \n prev_item = 0\n for i in 1..@itemsSize - 1\n curr_item = @table[@weights - 1][i]\n if prev_item < curr_item\n @best_configuration.push(1)\n else\n @best_configuration.push(0)\n end\n prev_item = curr_item\n end\n \n @best_fitness = @table[@weights - 1][@itemsSize - 1]\n \n b = Time.new\n @time = b-a\n end", "def set_ponderated_best\n total_time = 0\n result_considered = 0\n result_collected = @best_results.count\n everage_time = 0\n\n # If no results, no action performed\n if result_collected > 0\n # If total best results collected >= (bests_to_be_ignored + max_results)\n # excludes first @bests_to_be_ignored results\n if result_collected >= (@bests_to_be_ignored + @max_results)\n @best_results.each_with_index do |mir, index|\n total_time += mir.get_timing_instance.to_hundreds if index >= @bests_to_be_ignored\n end\n result_considered = @max_results\n else\n @best_results.each do |mir|\n total_time += mir.get_timing_instance.to_hundreds\n end\n result_considered = result_collected\n end\n everage_time = (total_time / result_considered).round(0)\n end\n @ponderated_time = Timing.new(everage_time)\n end", "def heuristic_breaker(n=8)\n worst_example = []\n interval = 0\n 10.times do\n an_opt = get_opt(n).first\n# apx = an_opt.improved_heuristic\n apx = an_opt.sort.find_apx_interval4\n o = diff(an_opt.find_interval)\n a = diff( apx.find_interval)\n \n if a.to_f / o > interval\n interval = a.to_f / o\n worst_example = [an_opt, apx, interval]\n end\n end\n worst_example\nend", "def minmax_technique\n possible_solutions = []\n @set.each { |solution|\n possible_solutions << solution if evaluate(@guess, solution) == @feedback_to_evaluation\n }\n @set = possible_solutions\n @guess = @set.sample\n @set.delete(@guess)\n return @guess\n end", "def beta_question?\n !display_timer?\n end", "def answer_yin_or_yang(game_key)\n available_combos = self.class.available_combos(game_key)\n estimates = estimates(available_combos)\n min_value = estimates.min.first\n max_value = estimates.max.first\n\n if (max_value - min_value) <= REWARD_DIFF_TOLERANCE\n self.class.random_decision\n else\n take_decision(estimates, available_combos)\n end\n end", "def compute_best_score(team, pilots, pilot_contests)\n combination = []\n total = 0.0\n total_possible = 0\n puts 'compute_score TBD'\nend", "def update_best\n if @best_price < @ep.max\n @best_price = @ep.max\n res_i = @ep.index(@best_price)\n @best_weight = @bw[res_i]\n @best_baggage = in_bag(@cg[res_i])\n end\n end", "def simulatedAnnealing(is,cS,cC,bSolution,bCost,temp,final_temp,alpha)\n #membuat array untuk menampung setiap solusi\n solusiTemp = {}\n solusiBestSolution = {}\n solusiBestCost= {}\n j=1 #insisialisasi\n while temp > final_temp do\n\n for i in 1..100\n #memunculkan bilangan random untuk perbandingan sekarang dengan yang baru\n x11 = fungsiRandom()\n x22 = fungsiRandom()\n nS = [x11,x22] #state baru\n nC = cost(nS) #perhitungan fungsi dari state baru\n end\n if nC < cC then #membandingkan costBaru dengan costSekarang\n cS = nS\n cC = nC\n if cC < bCost then #jika costBaru lebih kecil dari costSekarang maka bandingkan dengan bestCost\n bSolution = cS\n bCost = cC\n end\n else #jika tidak maka diliat nilai probab\n #ilitasnya lalu bandignkan dengan nilai random(0,1)\n if (prob(nC,cC,temp) > fungsiRandom01()) then\n cS = nS\n cC = nC\n end\n #menampung solusi\n solusiTemp[j] = temp\n solusiBestSolution[j] = bSolution\n solusiBestCost[j] = bCost\n end\n j = j+1\n temp = temp * alpha #Menghitung penentu iterasi temperatur\n end\n xx = solusiTemp[solusiTemp.length]\n y = bSolution\n z = bCost\n #mengembalikan nilai solusi\n return solusiTemp,solusiBestSolution,solusiBestCost,xx,y,z\n\nend", "def solved(ans)\n\n end", "def find_quality_of_answer(text, typos, attempt, answer_time)\n if typos < text.size / 3.0\n quality = 5 - attempt\n quality = [quality - 1, 3].max if answer_time.to_f > 30.0\n else\n quality = [(text.size / typos).floor, 2].min\n end\n quality\n end", "def optimize_start_get_answerers *args\n sleep(5)\n \n # A solution for when nelder mead reaches a negative number\n args.each do |a|\n if a < 0\n return 999999999999\n end\n end\n \n mlt_parsed_partial_config = {\n 'mlt.mindf' => args[0].to_i,\n 'mlt.minwl' => args[1].to_i,\n 'mlt.maxqt' => args[2].to_i,\n 'titleBoost' => args[3],\n 'tagsBoost' => args[4]\n }\n \n # Use this to optimize get questions\n body_query_answerer_parsed_partial_config = {\n #'mindf' => args[5].to_i,\n #'bodyboost' => args[6]\n }\n \n # Use this to optimize get answerers\n body_query_question_parsed_partial_config = {\n 'mindf' => args[5].to_i,\n 'bodyboost' => args[6]\n }\n \n update_engine_config mlt_parsed_partial_config, body_query_answerer_parsed_partial_config, body_query_question_parsed_partial_config\n (number_of_good_questions, number_of_bad_questions) = start_get_answerers(@questions)\n number_of_questions = number_of_good_questions + number_of_bad_questions\n puts\n puts \"##############################################\"\n puts\n puts \"#{Time.now} Result for config #{mlt_parsed_partial_config} AND #{body_query_answerer_parsed_partial_config} AND #{body_query_question_parsed_partial_config} is: #{number_of_bad_questions} / #{number_of_questions}\"\n puts\n puts \"##############################################\"\n puts\n \n open('results.txt', 'a') { |f|\n f << \"#{Time.now} Result for config #{mlt_parsed_partial_config} AND #{body_query_answerer_parsed_partial_config} AND #{body_query_question_parsed_partial_config} is: #{number_of_bad_questions} / #{number_of_questions} \\n\"\n }\n \n return number_of_bad_questions\n end", "def ideal_hit_time\n while (hit_limit.nil? || (hit_limit - hit_count) <= 0) do\n update_rate_limit_status\n # + 1.0 to account for clock skew between computers\n sleep_until(@will_reset_at + 1.0) if (hit_limit == 0)\n end\n blather(\"hits_remaining = #{hit_limit - hit_count}, seconds_remaining = #{will_reset_at - Time.zone.now}\")\n # ideal_time ramps from updated_at to will_reset_at as\n # hit_count goes from 0 to hit_limit.\n linear_intepolate(hit_count, 0, hit_limit, updated_at, will_reset_at)\n end", "def max_descent_speed; end", "def max_ascent_speed; end", "def compute_best\n best = @population.max_by { |x| x.fitness(@target) }\n @finished = true if best.fitness(@target) == @perfect_score\n best.phrase\n end", "def compute_best\n best = @population.max_by { |x| x.fitness(@target) }\n @finished = true if best.fitness(@target) == @perfect_score\n best.phrase\n end", "def valid_solution2 co_support\n # Randomgenerator\n rnd = Random.new\n\n # current plan to slove\n plan = SemesterPlan.find(params[:id])\n\n # prioritys for slots and user\n # sorts slots by user availability\n # sorts user by slot availibiluity\n slot_priority_origin = plan.get_slot_priority\n user_priority_origin = plan.get_user_priority\n\n\n # empty slots to empty solution_slots at each itteration begin\n empty_slots = []\n if co_support\n empty_slots = eval(plan.solution)\n else\n 20.times do |n|\n empty_slots << {index: n, user: nil, co: nil, slot: nil}\n end\n end\n\n # break variable\n done = false\n\n # availabilty which will be max accepted\n if co_support\n availability = 2\n else\n availability = 1\n end\n\n # saves itterations\n i = 0\n\n # iteration border for availibility to increase to 2\n i_av_2 = 400\n\n # iteration_border for interrupt\n i_max = 800\n\n # saves the solution\n solution_slots = []\n\n # until all slots are valid taken\n start = Time.now\n begin\n # counter for open slots\n slots = 20\n\n # clear solution\n solution_slots = empty_slots.clone\n\n # clone prioritys and shift-plans\n slot_priority = slot_priority_origin.clone\n user_priority = user_priority_origin.clone\n shifts = User.supporter_amount_of_shifts(20, User.where(planable: true, inactive: false))\n\n # set break variable to false\n done = false\n\n # repeat until plan invalid or complete plan valid\n while slot_priority.length != 0 && !done\n\n # random wheel for all slot prioritys\n roulette = calc_roulette slot_priority\n\n\n # random float\n random = rnd.rand\n slot = nil\n\n # take random slot\n roulette.each do |roul|\n if roul[:value] > random\n slot = slot_priority[roul[:index]]\n break\n end\n end\n\n # saves the found user\n found_user = nil\n # return all user with given availbility in current slot\n users = TimeSlot.find(slot[:slot]).get_users availability\n\n # if at least 1 user found\n if users.length != 0\n\n # break conditions\n found = false\n nothing = true\n\n # tests all slots\n user_priority.each do |pr_user|\n if !found\n\n # tests all available users\n users.each do |slot_user|\n\n # if user is found and in earlier iterations no user was found for this slot\n if (pr_user[:user] == slot_user && !found) &&(co_support && solution_slots.detect {|s| s[:index] == slot[:index]}[:user] !=slot_user || !co_support)\n\n\n # saves user for slot\n if co_support\n solution_slots.detect {|s| s[:index] == slot[:index]}[:co] = slot_user\n solution_slots.detect {|s| s[:index] == slot[:index]}[:slot] = slot[:slot]\n else\n solution_slots.detect {|s| s[:index] == slot[:index]}[:user] = slot_user\n solution_slots.detect {|s| s[:index] == slot[:index]}[:slot] = slot[:slot]\n end\n\n\n\n # set\n found = true\n found_user = pr_user\n\n # update shifts\n shifts = User.reduce_shifts found_user[:user], shifts\n\n # remove user from slot_priority and delete user from user_priority\n # if all shifts are given\n shifts.each do |s|\n if s[:user] == found_user[:user]\n if s[:shifts] == 0\n slot_priority = SemesterPlan.kill_user_in_slot_priority found_user[:user], slot_priority\n user_priority.delete(found_user)\n end\n end\n end\n\n # delete slot and sort\n slot_priority.delete(slot)\n slot_priority.sort_by! {|item|\n item[:priority] * -1\n }\n # removes slot from user_priority and sort\n user_priority = SemesterPlan.kill_slot_in_user_priority slot[:slot], user_priority\n user_priority.sort_by! {|item|\n item[:priority] * -1\n }\n\n # decrement slots and set nothing to false for next iteration\n slots -= 1\n nothing = false\n break\n end\n end\n end\n end\n\n # break if no slot was found\n if nothing == true\n done = true\n end\n # break if no user was found\n else\n done = true\n end\n end\n # break if iteration max is reached\n if Time.now - start > 10\n done = true\n\n # increment aǘailbility\n elsif Time.now - start > 2\n if availability != 2\n availability = 2\n else\n #availability = 1\n end\n end\n\n # increment iteration\n i += 1\n end while slots > 0 && Time.now - start <=10\n\n # update solution and return it additionally (r)\n solution_slots\n\n end", "def alpha_beta_timed(state, time, min_depth = 3)\n result = alpha_beta_r(state, 1)\n# puts \"Calculated to depth 1\"\n begin\n timeout(time) do\n depth = min_depth\n loop do\n result = alpha_beta_r(state, depth)\n# puts \"Calculated to depth #{depth}\"\n depth += 1\n end \n end\n rescue TimeoutError\n end\n return result\n end", "def optimize\n\t\t@bio = Bio.where(:user_id => current_user.id).last \n\t\t@player_pool = params[:player_pool]\n\n\t\t#Call Python or R function to run linear programming optimiziation and return optimal team\n\t\t#Step is skipped for now\n\n\t\t# store team in database\n\t\t# enter transaction into database\n\n\t\trender(\"sports/optimize/\", :notice => \"Successfully optmized one team\")\n\tend", "def calculate_optimal_k\n k=0\n @k_optimal = Array.new(@size)\n (3..@size).each{|n|\n k+=1 while(cost(n,k)<cost(n,k+1))\n @k_optimal[n]=k\n }\n end", "def best_result(triplet)\n triplet.max\nend", "def plan_next_step(used_strategy)\n options = {}\n case used_strategy\n when :agressive\n\n # attack a company if success rate is high enough\n attackable_companies = Company.all.delete_if { |c| chance_of_success_against(c, :hack) < 50.0 }\n if attackable_companies.present?\n company_with_highest_success_rate = attackable_companies.sort_by! { |c| chance_of_success_against(c, :hack) }.first\n options = {\n user_id: id,\n target_id: company_with_highest_success_rate.id,\n target_type: \"Company\",\n type_id: Action::TYPE_ATTACK_COMPANY,\n completed_at: time_to_attack(company_with_highest_success_rate, :hack)\n }\n\n # counter-attack last attacker (if his attack is still unavenged)\n elsif successful_attacks_in_last_24_hours > 0 && !counterattack_successful?\n last_attacker = Action.where([\"type_id = ? OR type_id = ?\", Action::TYPE_ATTACK_USER, Action::TYPE_ATTACK_USER_DDOS]).where(target_id: id, target_type: \"User\", completed: true, success: true).where(\"completed_at >= ?\", DateTime.now-24.hours).order(\"completed_at DESC\").first.try(:user)\n if last_attacker.present? && \n (can_attack?(last_attacker, :hack) || can_attack?(last_attacker, :ddos)) && \n (chance_of_success_against(last_attacker, :hack) >= 50.0 || chance_of_success_against(last_attacker, :ddos) >= 50.0)\n\n # determine attack type based on success rate and possible reward\n options = {\n user_id: id,\n target_id: last_attacker.id,\n target_type: \"User\"\n }\n\n # assume that last attacker is rich if he controls a company\n if last_attacker.companies.present?\n options[:type_id] = Action::TYPE_ATTACK_USER\n options[:completed_at] = DateTime.now + time_to_attack(last_attacker, :hack).seconds\n\n elsif chance_of_success_against(last_attacker, :hack) > chance_of_success_against(last_attacker, :ddos)\n options[:type_id] = Action::TYPE_ATTACK_USER\n options[:completed_at] = DateTime.now + time_to_attack(last_attacker, :hack).seconds\n\n elsif chance_of_success_against(last_attacker, :hack) <= chance_of_success_against(last_attacker, :ddos)\n options[:type_id] = Action::TYPE_ATTACK_USER_DDOS\n options[:completed_at] = DateTime.now + time_to_attack(last_attacker, :ddos).seconds\n end\n\n # buy or evolve attack skills\n else\n options = buy_or_evolve_attack\n end\n else\n options = buy_or_evolve_attack\n end\n when :defensive\n options = buy_or_evolve_defense\n\n when :moderate\n options = if (hacking_ratio <= botnet_ratio && hacking_ratio <= defense_ratio) ||\n (botnet_ratio <= hacking_ratio && botnet_ratio <= defense_ratio)\n buy_or_evolve_attack\n elsif defense_ratio <= botnet_ratio && defense_ratio <= hacking_ratio\n buy_or_evolve_defense\n end\n end\n\n if options.present?\n if options[:accept_job_id].present? && Job.acceptable.where(id: options[:accept_job_id]).first.present?\nRails.logger.info(\"---> AI: i accept job# #{options[:accept_job_id]}\")\n Job.acceptable.where(id: options[:accept_job_id]).first.accept_by(self)\n else\n result = Action.create(options)\nRails.logger.info(\"---> AI: i perform #{result.readable_type}\")\n result\n end\n end\n end", "def solution(a, b, k)\n return (b / k) - ((a - 1) / k)\nend", "def detect_result(dealer_tot, player_tot)\n\n if player_tot > MAX_VALUE\n :player_busted\n elsif dealer_tot > MAX_VALUE\n :dealer_busted\n elsif dealer_tot < player_tot\n :player\n elsif dealer_tot > player_tot\n :dealer\n else\n :tie\n end\nend", "def tbs_evaluate\n #if attack?\n # @effect_preview = tbs_evaluate_attack\n # @targets = @effect_preview.keys\n #elsif item? #no item use for ai controlled unit\n if item? #no item use.. \n @effect_preview = {}\n @targets = []\n else \n @effect_preview = tbs_evaluate_skill\n @targets = @effect_preview.keys\n end\n return if @targets.empty?\n #rate the action regarding the battler strategy\n tbs_tactic_rate \n end", "def runoff(voters)\n\n def find_winner(voters, tallies=nil)\n if tallies\n min = tallies.values.min\n tallies.keep_if { |candidate, v| v == min }\n voters.each { |voter| voter.reject! {|vote| tallies.include? vote }}\n return nil if voters.length == 0\n end\n new_tallies = Hash.new(0)\n voters[0].each {|candidate| new_tallies[candidate] = 0 }\n voters.each_with_object(new_tallies) { |voter, nt| nt[voter[0]] += 1 }\n total_votes = new_tallies.values.reduce(:+);\n new_tallies.each { |candidate, v|\n return candidate if v / total_votes.to_f > 0.5\n }\n return find_winner(voters, new_tallies)\n end\n\n find_winner(voters)\n\nend", "def incomplete_beta_function(x, alp, bet)\n return if x < 0.0\n return 1.0 if x > 1.0\n\n tiny = 1.0E-50\n\n if x > ((alp + 1.0)/(alp + bet + 2.0))\n return 1.0 - incomplete_beta_function(1.0 - x, bet, alp)\n end\n\n # To avoid overflow problems, the implementation applies the logarithm properties\n # to calculate in a faster and safer way the values.\n lbet_ab = (Math.lgamma(alp)[0] + Math.lgamma(bet)[0] - Math.lgamma(alp + bet)[0]).freeze\n front = (Math.exp(Math.log(x) * alp + Math.log(1.0 - x) * bet - lbet_ab) / alp.to_f).freeze\n\n # This is the non-log version of the left part of the formula (before the continuous fraction)\n # down_left = alp * self.beta_function(alp, bet)\n # upper_left = (x ** alp) * ((1.0 - x) ** bet)\n # front = upper_left/down_left\n\n f, c, d = 1.0, 1.0, 0.0\n\n returned_value = nil\n\n # Let's do more iterations than the proposed implementation (200 iters)\n (0..500).each do |number|\n m = number/2\n\n numerator = if number == 0\n 1.0\n elsif number % 2 == 0\n (m * (bet - m) * x)/((alp + 2.0 * m - 1.0)* (alp + 2.0 * m))\n else\n top = -((alp + m) * (alp + bet + m) * x)\n down = ((alp + 2.0 * m) * (alp + 2.0 * m + 1.0))\n\n top/down\n end\n\n d = 1.0 + numerator * d\n d = tiny if d.abs < tiny\n d = 1.0 / d\n\n c = 1.0 + numerator / c\n c = tiny if c.abs < tiny\n\n cd = (c*d).freeze\n f = f * cd\n\n if (1.0 - cd).abs < 1.0E-10\n returned_value = front * (f - 1.0)\n break\n end\n end\n\n returned_value\n end", "def local_search(problem, max_iterations, max_unimprove_iterations, max_time, \n max_unimprove_time, mut_rate, report_time_interval = 2)\n best = greedy_solve(problem)[:solution]\n best_find_time = 0\n iter = 1\n unimprove_iter = 1\n unimprove_start_time = Time.now\n last_improve_time = Time.now\n start_time = Time.now\n last_rep_time = Time.now\n while ((!max_iterations || iter <= max_iterations) and \n (!max_unimprove_iterations || unimprove_iter <= max_unimprove_iterations) and\n (!max_time || (Time.now - start_time).to_i <= max_time) and \n (!max_unimprove_time || (Time.now - last_improve_time).to_i <= max_unimprove_time)) do\n nxt = mutate(best, problem.path_funcs.length, mut_rate) \n if objective_function(nxt, problem.path_funcs) > objective_function(best, problem.path_funcs) \n unimprove_start_time = Time.now\n last_improve_time = Time.now\n unimprove_iter = 1\n best = nxt\n best_find_time = Time.now - start_time\n else\n unimprove_iter += 1\n end\n iter += 1\n if (Time.now - last_rep_time).to_i >= report_time_interval\n msg = \"Iteration = #{iter}, Obj = #{objective_function(best, problem.path_funcs)}, \"\n msg += \"Elapsed Time = #{Time.now - start_time}\"\n puts msg\n last_rep_time = Time.now\n end\n end\n {:solution => best, :objective_func => objective_function(best, problem.path_funcs), \n :elapsed_time => Time.now - start_time, :best_find_time => best_find_time}\n end", "def solved?\n self.fittest.fitness >= 1.0\n end", "def final_solution(first, last, budget)\n best_cost = -1\n best_time = 0\n final_vertex = @vertex_array[last]\n final_vertex.valid_options.each do |ct_array|\n if ct_array[0] > best_cost && ct_array[0] <= budget\n best_cost = ct_array[0]\n best_time = ct_array[1]\n end\n end\n print \"\\nVertex #{@vertex_array[first].name} to vertex #{@vertex_array[last].name} has cost/time options:\\n\"\n count = 1\n print \" (Cost, Time)\\n\"\n @vertex_array[last].valid_options.each do |option|\n print \"#{count}\\t(#{option[0]}, #{option[1]})\\n\"\n count += 1\n end\n if best_cost == -1\n puts \"No solution found with budget #{budget}\"\n else\n print \"\\nBest solution found within budget of #{@budget} was:\\n Cost #{best_cost}\\n Time #{best_time}\\n\"\n true_path = get_path(@vertex_array[last].final_path, best_cost, best_time)\n print \"Path: \"\n count = 0\n while count < true_path.size - 1\n print \"#{true_path[count]} -> \"\n count += 1\n end\n puts true_path[count]\n end\n end", "def tbs_tactic_rate\n tactic = GTBS_Tactics::All_AI_Tactics[ (battler.ai_tactic or 'default') ]\n value = 0\n if @effect_preview.keys.size == 0\n self.rating = value\n return\n end\n \n for target, effect in @effect_preview\n hit_chance, dmg_eval, mp, rate_states, rate_counter = effect\n damage, ref, ally = dmg_eval\n damage_frac = damage / ref.to_f\n dmg_rate = (mp ? tactic.mp_damage : tactic.hp_damage) \n target_rate = [0.01, ((subject.view_range.to_f/$game_map.distance(subject, target)) * target.tgr)].max\n \n if ally\n pained_ally = (target.hp / target.mhp.to_f < 0.33) ? 1.0 + tactic.team_rate : 1.0\n death_unlike = (damage_frac > 0.83) ? [damage_frac*(1.0+tactic.team_rate), 1.0].max : 1.0\n dmg_rate = tactic.hp_heal if damage < 0\n value -= (hit_chance / 100.0) * damage_frac * dmg_rate * death_unlike * pained_ally * target_rate\n value += rate_states * tactic.state * tactic.team_rate * pained_ally * target_rate\n else\n n_ally = 1.0\n #if tactic team enabled, add value if target can be attacked by other allies\n if tactic.team\n for bat in subject.friends\n if @other_bat_attack[bat] & target.positions != []\n n_ally += tactic.team_rate\n end\n end\n end\n if tactic.force_approach\n value += 10\n end\n \n #check 83% because variance add 20%\n death_like = (damage_frac > 0.83) ? [damage_frac*tactic.death_like, 1.0].max : 1.0\n value += n_ally * (hit_chance / 100.0 * damage / ref.to_f * dmg_rate) * death_like * target_rate\n value += rate_states * tactic.state * target_rate\n #don't care of counter if unit will die\n rate_counter *= (1.0 - damage_frac) / 0.17 if (damage_frac > 0.83)\n end\n value -= rate_counter * tactic.counter\n value -= tactic.mp_save * battler.skill_mp_cost(item) / [battler.mmp.to_f, 1.0].max if skill?\n end\n \n #modify rating\n if value > 0\n unless tactic.team \n value += (@move_pos == battler.pos) ? tactic.position : -tactic.position / 4 * rate_pos_safe\n end\n value = (value * ai_rating)\n self.rating += (value * tactic.predictable / 100).to_i\n else\n self.rating = 0\n end\n end", "def isWinner(possible_solution, maxc, minben)\r\n\r\n (0...@optionSize).each do |idx|\r\n calcWeightAndValue(possible_solution)\r\n\r\n if (@sum_weight <= maxc && @sum_value >= minben )\r\n return true\r\n end\r\n\r\n end\r\n\r\n false\r\n\r\n end", "def evaluate_answer(answer)\n question = answer.question.actable\n question.max_time_limit = answer.submission.assessment.course.programming_max_time_limit\n assessment = answer.submission.assessment\n evaluation_result = evaluate_package(assessment.course.title, question, answer)\n build_result(question, evaluation_result,\n graded_test_case_types: assessment.graded_test_case_types)\n end", "def default_v_score ; raise 'not implemented'; end", "def masterwork_prob_bonus; 0; end", "def needs_beta_approval?\n fairness_level_comparison < 0\n end", "def getMoneySpent(keyboards, drives, budget)\n #\n # Write your code here.\n #\n highest_combination = -1\n keyboards.each do |keyboard|\n drives.each do |drive|\n sum = keyboard + drive\n highest_combination = sum if sum <= budget && sum > highest_combination\n end\n end\n highest_combination;\nend", "def ask_q\n @current_ans = generate_q\n end", "def test_rosenbrock_banana\n NArray.srand(567) # must use NArray's generator, not Ruby's\n\n a = 0.5\n b = 100.0\n smooth = 0.1\n\n alpha = NArray[1.0, 1.0]\n beta = NArray[1.0, 1.0]\n\n problem = CrossEntropy::BetaProblem.new(alpha, beta)\n problem.num_samples = 1000\n problem.num_elite = 10\n problem.max_iters = 10\n\n problem.to_score_sample { |x| (a - x[0])**2 + b * (x[1] - x[0]**2)**2 }\n\n problem.to_update do |new_alpha, new_beta|\n smooth_alpha = smooth * new_alpha + (1 - smooth) * problem.param_alpha\n smooth_beta = smooth * new_beta + (1 - smooth) * problem.param_beta\n [smooth_alpha, smooth_beta]\n end\n\n problem.solve\n\n estimates = problem.param_alpha / (problem.param_alpha + problem.param_beta)\n assert_narray_close NArray[0.5, 0.25], estimates\n assert problem.num_iters <= problem.max_iters\n end", "def strategy\n temp = {}\n #format temp[L1:L2:L3] = index\n current_user.reports.each do |report|\n l1 = (report.l1_attended.to_f/(report.l1_total.to_f.nonzero? || 1 ))*100\n l2 = (report.l2_attended.to_f/(report.l2_total.to_f.nonzero? || 1 ))*100\n l3 = (report.l3_attended.to_f/(report.l3_total.to_f.nonzero? || 1 ))*100\n temp[\"#{l1}:#{l2}:#{l3}\"] = (report.l1_attended.to_f/report.l1_total.to_f)*100 + (report.l2_attended.to_f/report.l2_total.to_f)*10 + (report.l3_attended.to_f/report.l3_total.to_f)\n end\n best = temp.max[0]\n @personal_best = \"L1 : \" + best.split(\":\")[0].to_s + \"% \" + \"L2 : \" + best.split(\":\")[1].to_s + \"% \" + \"L3 : \" + best.split(\":\")[2].to_s + \"% \"\n learning_curve_strategy\n data_presenter_new 'attended'\n end", "def has_stopping_criterion_been_met?(best_fit)\n return false if @optimal_func_val.nil?\n\n answer =\n if @is_high_fit\n best_fit >= @optimal_func_val\n else\n best_fit <= @optimal_func_val\n end\n answer\n end", "def max_product_quadratic(data)\n winner = data[0]*data[1]\n (0..data.length-2).each do |i|\n (i+1..data.length-1).each do |j|\n winner = data[i]*data[j] if data[i]*data[j] > winner\n end\n end\n return winner\nend", "def test_max_accuracy\n result=Array.new\n at=Activity_tracker.new do |id|\n result[id]=Time.now-result[id]\n end\n 10.times do |i|\n result[i]=Time.now\n at.active i\n sleep at.tick_time\n end\n sleep at.timeout+at.tick_time\n accuracy=result.max-at.timeout\n expected_accuracy=at.tick_time-\n at.timeout%at.tresholds\n assert((accuracy-expected_accuracy).abs>0.02, 'bad accuracy: '+accuracy.to_s)\n end", "def incomplete_beta(x,a,b)\n IncompleteBeta.evaluate(a,b,x)*beta(a,b)\n #Math::IncompleteBeta.axpy(1.0, 0.0, a,b,x)\n end", "def time_to_solve\n 1.hour\n end", "def quality_global_pheromone_at_time(value_of_objective)\n\t# where q = [time=10, cost= 10_000, quality=0.0005]\n\t((1 - GLOBAL_EVAPORATION_RATE) * pheromone_at_t_minus_1) + quality_changed_pheromone(value_of_objective)\nend", "def exact_regularized_beta(x,a,b)\n return 1 if x==1\n m=a.to_i\n n=(b+a-1).to_i\n (m..n).inject(0) {|sum,j|\n sum+(binomial_coefficient(n,j)* x**j * (1-x)**(n-j))\n }\n\n end", "def optimum_epl max = 1700, tolerance = 0.1\n last_epl = false\n epl = nil\n 10.times do |i|\n epl = generate_epl(tolerance)\n \n # Exit loop \n # 28 == basic string length from generate_epl\n if epl.length > max || (epl.length == last_epl.length if last_epl && epl.length != 29)\n return last_epl \n else \n last_epl = epl\n tolerance = tolerance / 10.0 #DECREASE SIMPLIFICATION BY FACTOR OF TEN\n end \n end\n epl\n end", "def optimum_epl max = 1700, tolerance = 0.1\n last_epl = false\n epl = nil\n 10.times do |i|\n epl = generate_epl(tolerance)\n \n # Exit loop \n # 28 == basic string length from generate_epl\n if epl.length > max || (epl.length == last_epl.length if last_epl && epl.length != 29)\n return last_epl \n else \n last_epl = epl\n tolerance = tolerance / 10.0 #DECREASE SIMPLIFICATION BY FACTOR OF TEN\n end \n end\n epl\n end", "def best_answer\n\n answer = self.answers.order('up - down DESC').first\n\n #verifica se melhor resposta tem algum voto\n #se nao houver nenhum voto nao fica como melhor resposta\n if !answer.nil? && (( answer.up == 0 && answer.down == 0) || self.answers.first == answer || self.answers.count == 1 )\n answer = nil\n end\n\n return answer\n end", "def fantasy_improved\n @start_year = params[:start_year]\n @end_year = params[:end_year]\n @min_at_bats = params[:min_at_bats]\n\n if @end_year >= @start_year\n startstats = BattingStatistic.by_year(@start_year, @min_at_bats)\n start_points = fantasy_points(startstats)\n \n endstats = BattingStatistic.by_year(@end_year, @min_at_bats)\n end_points = fantasy_points(endstats)\n\n # Build hash of improvement scores - hash includes\n # player_id, improvement score. This is a brute force search,\n # we could implement something better later.\n @improvements = {} \n \n end_points.each do |player, points|\n if start_points[player].present?\n @improvements[player] = points - start_points[player]\n end\n end\n\n # Sort the improvement hash and label the winner\n if @improvements.present?\n @improvements = @improvements.sort_by {|k,v| v}.reverse\n \n rlimit = @improvements.count < 5 ? (@improvements.count - 1) : 4 \n @results = @improvements[0..rlimit]\n else\n @results = nil\n end\n \n else\n flash[:alert] = \"End year must be greater than or equal to start year.\"\n redirect_to search_index_path(tab: 'tab3')\n end\n end", "def buy_power_3 d0, d1, s0, s1\n next_condition = @battery - (d0 - s0) - (d1 - s1) # 未来の条件式\n crnt_condition = @battery - (d0 - s0) # 現在の条件式\n result = 0.0 # 結果値\n\n if crnt_condition < @target # 現時点で目標値よりバッテリー残量が少ないとき\n if next_condition < @target # 次の時刻でも目標値が達成できないとき\n # 達成できなくなる分の電力を買っておく\n if @target - next_condition > 500.0 # 15分に受け取れる電力量は500wと想定する\n result = 500.0\n else\n result = @target - next_condition\n end\n # 買った分で最大容量を超えてしまったときは超えないようにする\n next_battery = crnt_condition + result # 次の時刻でのバッテリー残量予測\n result = next_battery > @max_strage ? result - (next_battery - @max_strage) : result\n else # 次の時刻では目標値が達成できるとき\n # 買わない 売るかどうかは保留したほうがいい?ただし0にはしないようにする\n result = 1.0 if crnt_condition == 0.0\n sell_power_2\n end\n else # 現時点では目標値は達成しているとき\n if next_condition < @target # 次の時刻で目標値が達成できない\n # 達成できなくなる分の電力を買っておく\n if @target - next_condition > 500.0 # 15分に受け取れる電力量は500wと想定する\n result = 500.0\n else\n result = @target - next_condition\n end\n next_battery = crnt_condition + result # 次の時刻でのバッテリー残量予測\n result = next_battery > @max_strage ? result - (next_battery - @max_strage) : result\n else # 次の時刻でも目標値が達成できるとき\n # Don't buy power.\n # むしろ売る\n sell_power_2\n end\n end\n @battery = crnt_condition + result # バッテリー残量の状態遷移\n @battery = @max_strage if @battery > @max_strage\n return result\n end", "def my_bet\n case @play\n when 1 then return @min_bet\n when 2 then \n if @stack > 10 * @min_bet\n @min_bet\n end\n when 3 then\n if @stack > 5 * @min_bet\n @min_bet\n end\n when 4 then @min_bet + ((1/2) * @min_bet)\n when 5 then @min_bet + ( 2 * @min_bet)\n when 6 then @stack\n end\n end", "def best_score(a_of_g)\n best_score = a_of_g.flatten.return_objects_with(:attempts, 0).max_attribute(:adjusted_goodness)\n end", "def has_met_requirement?\n yeas >= required_votes\n end", "def correct_mcq(correct_choice_id, wrong_choice_id = nil, value = 1.0)\n if correct_choice_id.nil? || !correct_choice_id.is_a?(Integer)\n puts \"Invalid Choice ID\"\n return false\n end\n \n exercise_version_id = self.id\n correct_choice = Choice.find(correct_choice_id)\n wrong_choice = nil \n if wrong_choice_id.nil?\n all_choices = Choice.where(multiple_choice_prompt: correct_choice.multiple_choice_prompt)\n all_choices.each do |c|\n wrong_choice = c if c.value == 1.0 \n end\n binding.pry\n end \n wrong_choice ||= wrong_choice_id ? Choice.find(wrong_choice_id) : nil \n \n if correct_choice.multiple_choice_prompt_id != wrong_choice.multiple_choice_prompt_id\n puts \"Choices are not from the same question\"\n return false\n end\n correct_choice.reset_value(value)\n wrong_choice.reset_value(0.0) if wrong_choice\n \n attempts.each do |attempt|\n delta = 0.0\n if correct_choice_id == attempt.prompt_answers[0].specific.choices[0].id && attempt.score <= 0.0\n delta = value\n elsif wrong_choice && wrong_choice.id == attempt.prompt_answers[0].specific.choices[0].id && attempt.score > 0.0\n delta = -1.0 * value\n end\n binding.pry\n puts attempt.id,\"\\n DELTA: \\n\", delta\n if attempt.workout_score\n multiplier = ExerciseWorkout.find_by(exercise: exercise, workout: attempt.workout_score.workout).points\n if attempt.active_score\n attempt.active_score.rescore(delta * multiplier)\n end\n else\n multiplier = 10.0\n end\n attempt.rescore(delta * multiplier)\n end\n return true\n end", "def seconds_for_expedition\n possible_votes / 3 + 1\n end", "def compare_solutions(count = 5, n_min = 1, n_max = 300)\n arr = generate(count, n_min, n_max)\n if solve(arr) != solve_opt(arr)\n puts \"\\nFAILED\"\n puts 'data: ' + arr.to_s\n puts 'solution: ' + solve(arr).to_s\n puts 'optimized solution: ' + solve_opt(arr).to_s\n end\nend", "def slow_solution(a)\n m = 0\n a.size.times do |i|\n a[i] = a[i].abs\n m = [a[i], m].max\n end\n maxsum = a.sum # sum of absolute val of all nums in array\n # maxsum = a.map(&:abs).sum <- Ruby shortcut\n\n # If dp = 1 at an index, it means some combo of elements in a add up to that index\n dp = [0] * (maxsum + 1)\n dp[0] = 1\n\n a.size.times do |j|\n maxsum.downto(0).each do |possible_sum|\n puts \"a[j]: #{a[j]}, possible sum: #{possible_sum}\"\n if (dp[possible_sum] == 1) and (possible_sum + a[j] <= maxsum)\n\n # if possible_sum + new element a[j] is possible sum, dp = 1!\n dp[possible_sum + a[j]] = 1\n puts \"Mark #{possible_sum + a[j]} as possible sum in dp\"\n end\n end\n puts \"row: #{j}, a[j]: #{a[j]}, dp: #{dp}\"\n puts\n end\n\n min_q_minus_p = maxsum\n\n # Divide array a into 2 parts, where P = sum of part 1 and Q = sum of part 2,\n # P + Q = maxsum, and P <= maxsum / 2 <= Q.\n # We want largest possible P to get smallest possible Q-P.\n\n # loop from 0 to maxsum / 2, covering every possible P, Q division\n (maxsum / 2 + 1).times do |possible_half_sum|\n # puts \"possible_half_sum: #{possible_half_sum}\"\n if dp[possible_half_sum] == 1 # means P or Q = possible_half_sum\n q_minus_p = maxsum - 2 * possible_half_sum\n # puts \"Q - P: #{q_minus_p}\"\n min_q_minus_p = [min_q_minus_p, q_minus_p].min\n # puts \"min Q - P: #{min_q_minus_p}\"\n end\n end\n\n min_q_minus_p\nend", "def solution(a)\n return 0 if a.count <= 1\n \n max_profit = 0\n min_price = a.first\n a[1..-1].each { |price|\n max_profit = [max_profit, price - min_price].max\n min_price = [min_price, price].min\n }\n max_profit\nend", "def optimize(params)\n plan = SemesterPlan.find(params[:id])\n users = User.users_of_plan_pure plan\n empty_hours = false\n if users.any?\n users.each do |user|\n if user.hours == 0 || user.hours == nil\n empty_hours = true\n end\n\n end\n\n end\n if !empty_hours\n case params[\"optimisation\"][\"kind\"]\n when \"0\"\n if plan.solution.nil?\n empty_slots = []\n plan.time_slots.each_with_index do |n, index|\n empty_slots << {index: index, user: nil, co: nil, slot: n.id}\n end\n plan.update(solution: empty_slots)\n end\n flash[:success] = \" Manuelle Planerstellung eingeleitet\"\n redirect_to valid_path User.find(params[:id]), show_new: true\n when \"1\"\n flash[:success] = \" Gültiger Plan wurde erstellt.\"\n sol = valid_solution2(false)\n plan.update(solution: \"#{mutate_pairs(plan, sol)}\")\n\n if feasible plan.solution\n plan.update(solution: \"#{valid_solution2(true)}\")\n end\n redirect_to valid_path User.find(params[:id]), show_new: true\n when \"2\"\n plan.update(solution: \"#{heuristic (plan)}\")\n if feasible plan.solution\n plan.update(solution: \"#{valid_solution2 true}\")\n end\n flash[:success] = \" 2 verlinkt!\"\n redirect_to valid_path User.find(params[:id]), show_new: true\n end\n else\n flash[:danger] = \"Abbruch: Ein Nutzer hat keine Stunden eingetragen!\"\n redirect_to semester_plan_path plan\n\n end\n end", "def optimize\n operand\n end", "def regularized_beta(x,a,b)\n return 1 if x==1\n IncompleteBeta.evaluate(a,b,x)\n end", "def benchhelpdesk\n if @helpdesk_flag == 'Y'\n @benchhelpdesk = @benchsubtotal2 * @framework_rates['M138']\n else\n 0\n end\n end", "def optimize\n operand\n end", "def score\n seconds_passed = Time.now.to_i - Integer(time_for_last_correct_answer || 0)\n wrong_answers = nr_of_answers - nr_of_correct_answers\n # Scores grow linearly with number of correct answers, but\n # geometrically with number of wrong answers. That's a way to\n # ensure that more attention is paid to problem areas.\n x = Integer(nr_of_correct_answers - wrong_answers ** 1.5)\n if x < 0\n x # Time is not a factor when the score is negative.\n else\n 10_000_000 * x / (seconds_passed + 500_000)\n end\n end", "def plan\n 0\n end", "def switch_best\n Answer.transaction do\n self.question.answers.best.update_all(best: false) unless self.best?\n self.update!(best: !best)\n end \n end", "def condition(i, j)\n # first solved the two equations for just i and j\n 500_000 - 1000*i - 1000*j + i*j == 0\nend", "def beta\n return @beta\n end", "def fittest\n min\n end", "def solve(ingredients, part_two: false)\n score = 0\n max = 0\n\n (0..100).each do |i|\n (0..100 - i).each do |j|\n (0..100 - i - j).each do |k|\n l = 100 - i - j - k\n capacity = calculate_total(ingredients, \"capacity\", i, j, k, l)\n durability = calculate_total(ingredients, \"durability\", i, j, k, l)\n flavor = calculate_total(ingredients, \"flavor\", i, j, k, l)\n texture = calculate_total(ingredients, \"texture\", i, j, k, l)\n calories = calculate_total(ingredients, \"calories\", i, j, k, l)\n\n next if part_two && calories != 500\n next if capacity <= 0 || durability <= 0 || flavor <= 0 || texture <= 0\n\n score = capacity * durability * flavor * texture\n max = score if score > max\n end\n end\n end\n max\nend", "def get_ponderated_best\n # Maybe better trace if no results collected\n # @best_results.exists? ? Timing.new() : @ponderated_time\n @ponderated_time\n end", "def accept_booking(pending)\n# if length of pending = 3\n# if pending.length == 3\n# if pending[0] + pending[2] > pending[1]\n# puts pending[0] + pending[2]\n# return pending[0] + pending[2]\n# else\n# puts pending[1]\n# end\n# end\n\n # totals_so_far store the answer to the problem at position i\n # imagining that the array was only of length i\n totals_so_far = Array.new pending.length\n\n if (i == 0)\n totals_so_far[i] = pending[i]\n end\n\n if (i == 1)\n totals_so_far[i] = max(pending[i], pending[i-1])\n end\n\n for i in pending\n pending[i]\n\n #Choose this one, or not choose it\n # I can't take i-1 and I get the max of everything before it.\n choose_this_one_max = pending[i] + totals_so_far[i-2]\n\n not_choose_this_one_max = totals_so_far[i-1]\n\n pending[i] = max(choose_this_one_max, not_choose_this_one_max)\n\n end\n\n totals_so_far[-1]\nend", "def reset\n correct = course.responses.correct.interval(self.index_no).since(self.updated_at).size\n incorrect = course.responses.incorrect.interval(self.index_no).since(self.updated_at).size\n \n return false if self.index_no < 2\n \n actual = 100.0 * (incorrect) / (correct + incorrect)\n target = 100.0 - course.accuracy_target\n \n case\n when actual > target\n update_attribute :minutes, ( self.minutes * (target+actual)/(2*actual) ).to_i\n when actual < target\n update_attribute :minutes, ( self.minutes * (3*target-actual)/(2*target) ).to_i\n else\n return false\n end\n end", "def max_mcq_score\n if self.exercise.is_mcq?\n sum = 0.0\n self.prompts.each do |question_prompt|\n question_prompt.specific.choices.each do |choice|\n sum += choice.value if choice.value > 0.0\n end\n end\n puts \"MAX MCQ SCORE\",sum,\"MAX MCQ SCORE\"\n return sum\n end\n end", "def alpha_beta(state, maxdepth = 10, alpha = -INFINITY, beta = INFINITY)\n return state.value, nil if (maxdepth == 0) or state.final?\n\n best_operation = nil\n state.each_successor do | new_state, operation |\n val = -alpha_beta(new_state, maxdepth - 1, -beta, -alpha)[0]\n\n return beta, nil if (val >= beta)\n if (val > alpha)\n alpha = val\n best_operation = operation\n end \n end\n\n return alpha, best_operation\n end", "def wrong_answer\n @score -= 1\n end", "def can_double_bet\n return 1 unless @bankroll < @bet\n return nil\n end", "def check(best, results)\n\t\tmag = best * @threshold\n\t\tamount = 0\n\n\t\tresults.each do |value|\n\t\t\tif value <= mag\n\t\t\t\tamount += 1\n\t\t\tend\n\t\tend\n\n\t\tif amount < @k\n\t\t\treturn false\n\t\telse\n\t\t\treturn true\n\t\tend\n\tend", "def max_score\n problem.weight\n end", "def alpha_beta_r(state, maxdepth = 10, alpha = -INFINITY, beta = INFINITY)\n return state.value, nil if (maxdepth == 0) or state.final?\n best_operation = nil\n successor_states = []\n state.each_successor do | *cs | successor_states << cs end\n \n successor_states.sort_by{rand}.each do | new_state, operation |\n val = -alpha_beta_r(new_state, maxdepth - 1, -beta, -alpha)[0]\n\n return beta, nil if (val >= beta)\n if (val > alpha)\n alpha = val\n best_operation = operation\n end \n end\n\n return alpha, best_operation\n end", "def variance_at_completion\n budget_at_completion - estimate_at_completion_cost\n end", "def time_global_pheromone_at_time(value_of_objective)\n\t# where q = [time=10, cost= 10_000, quality=0.0005]\n\t((1 - GLOBAL_EVAPORATION_RATE) * pheromone_at_t_minus_1) + time_changed_pheromone(value_of_objective)\nend", "def min_out\n @min_out ||= time_out.min\n end", "def solution\n 971 * (-61)\nend", "def native_kendalTauish_cost( pi )\n EpsSrraNative::rank_aggergate_upperW(@n){ |u,v| pi.pref(u,v) == @w[u][v] ? 0 : 1 } \n end", "def findBestIn(x, n, h, step, loops)\n #set initial\n best = trainAndValidate(x, n, h, step)\n for i in 2..loops\n trained = trainAndValidate(x, n, h, step)\n if trained.ann < best.ann\n best = trained\n end\n end\n best\nend", "def update_p_best\r\n return unless @fitness > p_best_fitness\r\n\r\n @p_best_fitness = @fitness\r\n @p_best_position = @position\r\n end", "def fitness_question1(fitness_answer1)\n if fitness_answer1 == \"3 or more times per week\"\n @fitness_score1 = 0\n elsif fitness_answer1 == \"1 - 2 times per week\"\n @fitness_score1 = 1\n elsif fitness_answer1 == \"never\"\n @fitness_score1 = 2\n end\n @fitness_score1\nend", "def calc_karps_algo_values\n 🛑 ::RuntimeError.new(\"| c{CurrencyMatrix}-> m{calc_karps_algo_values} already has warm cache |\") unless @cached_stats[:karp_vals].empty?\n (0...@len).∀ do |i|\n @cached_stats[:karp_vals] << self.karps_algorithm(i)\n end\n @cached_stats[:karp_vals]\n end", "def heuristic_score\n 0\n end" ]
[ "0.67106336", "0.59986466", "0.59981275", "0.59810185", "0.5925924", "0.58681947", "0.58633465", "0.5813265", "0.57892674", "0.5729053", "0.5719254", "0.5698671", "0.56877", "0.5663744", "0.5661667", "0.56558716", "0.5614015", "0.56001854", "0.5563458", "0.5551056", "0.55434805", "0.5507628", "0.5465466", "0.5465466", "0.54615974", "0.54562", "0.5452976", "0.54520047", "0.5445757", "0.5436141", "0.5418767", "0.5417565", "0.53827953", "0.53724223", "0.5365363", "0.535749", "0.535595", "0.5337723", "0.53370583", "0.5336543", "0.53339165", "0.5332128", "0.53295976", "0.532574", "0.5324047", "0.53205657", "0.53191435", "0.53162724", "0.53018653", "0.5300758", "0.5298989", "0.5298024", "0.5296225", "0.52821213", "0.528019", "0.52734613", "0.5272841", "0.52696806", "0.526655", "0.5263203", "0.52628976", "0.5261912", "0.52605355", "0.5245998", "0.5243931", "0.5243074", "0.5242103", "0.52392495", "0.5238813", "0.5233507", "0.5230898", "0.5228484", "0.52256346", "0.52216214", "0.52183425", "0.52079415", "0.5207035", "0.52048916", "0.5188363", "0.51827866", "0.51707304", "0.51681197", "0.51668566", "0.5166048", "0.5165796", "0.5162173", "0.5160919", "0.5160103", "0.51580715", "0.5147809", "0.5138894", "0.51349354", "0.51322025", "0.5129117", "0.51219827", "0.512083", "0.51196903", "0.5117267", "0.5115767", "0.51137376" ]
0.7185474
0
is the combo an optimal solution?
def combo_optimal? optimal_value == combo_witheffect end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_combinations\n\t\treturn @@valid_combinations\n\tend", "def affordable_combos\n self.option_prices\n combinations = @option_prices.select{|k,v| v <= to_cents(@budget)}.keys\n unless combinations.empty? then combinations else \"You can't afford anything...\" end\n end", "def combo_match(combo, battler)\n for id in Combo_Skill.keys\n if Combo_Skill[id][0] == combo and battler.combo_points >= Combo_Skill[id][2] and\n (Combo_List[battler.id] != nil and Combo_List[battler.id].include?(id))\n if not battler.learned_combo.include?(id) and Combo_Skill[id][1] == 1\n battler.combo_points -= Combo_Skill[id][2]\n battler.learned_combo << id\n return [New_Combo_Skill , id]\n elsif (battler.learned_combo.include?(id) and Combo_Skill[id][1] == 2) or\n Combo_Skill[id][1] == 3\n battler.combo_points -= Combo_Skill[id][2]\n return Combo_Skill[id][3].nil? ? id : [Combo_Skill[id][3] , id]\n elsif battler.learned_combo.include?(id) and Combo_Skill[id][1] == 1\n battler.combo_points -= Combo_Skill[id][2]\n return id\n end\n end\n end\n return nil\n end", "def choose_best_sum(t, k, ls)\n combos = []\n all_possib = ls.sort.combination(k).to_a\n # ls.sort.combination(k).to_a.map { |item| item.inject(:+) }.select { |sum| sum <= t}.max\n all_possib.size.times { |x| combos[x] = all_possib[x].inject(:+) }\n combos.empty? ? nil : combos.select{ |combo| combo <= t}.max\nend", "def get_original_combination\n nil\n end", "def option_combinations_valid?\n # TO DO - implement your real logic here\n true \n end", "def combos\n self.option_prices\n combinations = @option_prices.select{|k,v| v == to_cents(@budget)}.keys\n unless combinations.empty? then combinations else \"No exact price matches\" end\n end", "def switch\n #switch = min_switch\n #p switch.sort\n #switch.sort.take(@size / 2)\n solutions = []\n 1.upto(@products.size) do |min_prod|\n found = false\n @products.combination(min_prod).each do |comb|\n products_copy, guesses_copy = @products.dup, @guessed_order.dup\n products_copy.delete_values(*comb)\n guesses_copy.delete_values(*comb)\n if products_copy == guesses_copy\n found ||= true\n solutions << comb.sort\n end\n end\n return solutions.sort[0] if found\n end\n end", "def each_combination\n \n end", "def validate_comb(board_view, comb)\n comb.each_with_index do |value, idx|\n return false unless board_view[idx].include?(value)\n end\n true\nend", "def calculate_choices(cities, last_city, exclude, pheromone, c_heur, c_hist)\n #Checa todas as possibildiades para se escolher a proxima cidade.\n choices = []\n #passa por todas as cidades. coord pega as coordenadas de uma dada cidade, i a posicao dela no array de cidades. o i identifica qual cidade no array � \n cities.each_with_index do |coord, i|\n #checa se a cidade ja foi visitada. as cidades visitadas esta em exclude. A cidade analisada estar no vetor exclude? Se sim, sai dessa intera��o\n\tnext if exclude.include?(i)\n \n\t#Indentifica qual cidade esta sendo analisada\n\tprob = {:city=>i}\n \n #calcula o fator historico. O c hist mostra o quanto voce considera o historico. Historico o quanto que passaram naquela cidade, e se mede isso coma matriz de pheronio. Se passaram muito por ali de maniera frequente, maior o fator de historico pois o pheromonio ali estar� muito alto\n\tprob[:history] = pheromone[last_city][i] ** c_hist\n\t# Considera o vetor distancia \n\tprob[:distance] = euc_2d(cities[last_city], coord)\n # Calcula o faotr heuristico, isso e, o quanto que a distancia vai influir nessa decisao. Quanto maior a distancia, menor a chance de se escolher\n\tprob[:heuristic] = (1.0/prob[:distance]) ** c_heur\n # Calcula a probabilidade da escolha ser escolhida. Multiplica o fator de distancia e o fator heuristico\t\n\tprob[:prob] = prob[:history] * prob[:heuristic]\n # Adiciona a escolha no vetor de escolha\n\tchoices << prob\n end\n choices\nend", "def check_combinations\n # returns possible sums of combinations from open-tiles \n sums = []\n size = open_tiles.length\n while size > 0\n # ref: https://www.geeksforgeeks.org/ruby-array-combination-operation/\n combinations = open_tiles.combination(size).to_a\n combinations.each { |combos| sums.append(combos.inject(0){ |sum, tile| sum + tile.numberID})}\n size -= 1\n end\n sums.uniq!.sort!\n end", "def smart_choose(checks)\n checks.each do |i|\n i.each_cons(2) do |arr|\n if arr.same_values? # ir neuzimta?\n i.each do |cell|\n return cell if @game.empty_cell?(cell)\n end\n end \n end\n end\n nil\n end", "def getMoneySpent(keyboards, drives, budget)\n #\n # Write your code here.\n #\n highest_combination = -1\n keyboards.each do |keyboard|\n drives.each do |drive|\n sum = keyboard + drive\n highest_combination = sum if sum <= budget && sum > highest_combination\n end\n end\n highest_combination;\nend", "def test_combine_proper_working\n fictive_draw = %w(a b c d e f g)\n fictive_combinations = combine(fictive_draw)\n expected_combinations = 2**fictive_draw.size - 1\n assert_equal expected_combinations, fictive_combinations.length\n end", "def problem_106\n a = [1,2,3,4]\n a = [1,2,3,4,5,6,7]\n a = [1,2,3,4,5,6,7,8,9,10,11,12] \n \n num = 0\n seen = {}\n # Don't do length of 1, they are ordered\n # Because they are size ordered, and 2 smalls are bigger than a large\n 2.upto(a.length/2) do |n|\n puts \"n = #{n}\"\n a.combination(n) do |set_a|\n b = a - set_a\n break if b.length < n\n b.combination(n) do |set_b|\n key = [set_a,set_b].sort\n next if seen[key]\n seen[key] = true\n index = 0\n state = 0\n 0.upto(set_a.length-1) do |i|\n break unless set_b[i] && set_a[i]\n if set_a[i] < set_b[i]\n state -= 1\n else\n state += 1\n end\n end\n\n# print \"#{set_a.inspect} #{set_b.inspect} #{state}\"\n if state.abs <= (set_a.length - 2) ||\n (state < 0 && set_a.last > set_b.last) ||\n (state > 0 && set_a.first < set_b.first)\n# puts \" good\"\n num += 1\n else\n# puts \"\"\n end\n end\n end\n end\n num\nend", "def combinations(n)\n \n end", "def combination_score\n if five_of_a_kind?\n return 9000 \n elsif straight_flush? \n return 8000\n elsif four_of_a_kind? \n return 7000\n elsif full_house? \n return 6000\n elsif flush? \n return 5000\n elsif straight? \n return 4000\n elsif three_of_a_kind? \n return 3000\n elsif two_pair? \n return 2000\n elsif pair? \n return 1000\n else\n return 0\n end\n end", "def combo_check(board)\n WIN_COMBINATIONS_2.each do |combo|\n if board.taken?(combo[0]) && board.position(combo[0]) == board.position(combo[1]) && !board.taken?(combo[2])\n return combo[2].to_s\n elsif board.taken?(combo[1]) && board.position(combo[1]) == board.position(combo[2]) && !board.taken?(combo[0])\n return combo[0].to_s\n elsif board.taken?(combo[2]) && board.position(combo[0]) == board.position(combo[2]) && !board.taken?(combo[1])\n return combo[1].to_s\n end\n end\n nil\n end", "def combination_sum2(candidates, target)\n combination_sum(candidates.sort, target)\nend", "def combo_check(battler, attack, index)\n size = battler.combo_sequence.size\n for value in 0...index\n combo = combo_match(battler.combo_sequence[value..index], battler)\n return combo if combo != nil\n end\n battler.combo_points += attack[1]\n return nil\n end", "def solution_proximity_heuristic(amount,comb,coins)\n (amount-comb.sum)*min_size_heuristic(amount,comb,coins)\nend", "def stock(prices)\n\n all_choices = []\n\n prices.each_with_index do |buy, i1|\n prices.each_with_index do |sell, i2|\n next if i1 >= i2 \n all_choices << [buy, sell]\n end\n end\n\n best_choice = 0 # []\n\n all_choices.each do |combination| # [ [] ] \n buy_price, sell_price = combination\n profit = sell_price - buy_price\n if profit > best_choice[1] - best_choice[0]\n best_choice = [buy_price, sell_price]\n end\n end\n best_choice\nend", "def potential_combo(board, player_token)\n\n Game::WIN_COMBINATIONS.detect do |combination|\n if board.cells[combination[0]] == player_token && board.cells[combination[1]] == player_token\n !board.taken?(combination[2] + 1) ? (combination[2] + 1) : nil\n\n elsif board.cells[combination[0]] == player_token && board.cells[combination[2]] == player_token\n !board.taken?(combination[1] + 1) ? (combination[1] + 1) : nil\n\n elsif board.cells[combination[1]] == player_token && board.cells[combination[2]] == player_token\n !board.taken?(combination[0] + 1) ? (combination[0] + 1) : nil\n\n end # outer if\n end # do |combination|\n end", "def better_solution_to_multiples\n set.to_a.combination(2) do |number, number1|\n remainder = TOTAL - number - number1\n\n if set.include?(remainder)\n puts remainder * number * number1\n break\n end\n end\n end", "def best_seat_combination(input_num)\n all_sets = seat_combinations(input_num)\n hold_set = []\n hold_val = 0\n all_sets.each do |i|\n tv = total_value_of_set(i)\n if tv > hold_val\n hold_set = i\n hold_val= tv\n end\n end\n # just add the push to show the total value (might want it)\n hold_set.map{|x| x[0]+x[1].to_s}\n end", "def find_winning_combinations(board,player,opponent)\n Game::WIN_COMBINATIONS.reject do | combo |\n combo.count { | position | board.cells[position]==opponent } > 0\n end\n end", "def init_combos(calories)\n @combos = (0..MAX).to_a.combination(@count).to_a # all combinations of x numbers from 1..MAX\n .select { |combo| combo.reduce(:+) == MAX } # the combos which add to 100\n .flat_map { |arr| arr.permutation(@count).to_a } # permute those combos\n .select { |combo| !calories || calories(combo) == calories } # exact calorie count\n end", "def combinations(arr)\n \tsolution = []\n\tarr.each do |i|\n arr.each do |j|\n if (j > i)\n solution.push([i,j]) \t\n end\n end\n end\n return solution\nend", "def winning_combos\n [[0, 1, 2], [3, 4, 5], [6, 7, 8],\n [0, 3, 6], [1, 4, 7], [2, 5, 8],\n [0, 4, 8], [2, 4, 6]]\n end", "def make_change(value,coins)\n return nil if value < coins.min\n best = nil\n coins.each do |coin|\n if value < coin\n next\n elsif value == coin\n return [coin]\n else\n # Try finding a combination of coins that will sum to value - coin.\n # Then you can get a combination of coins for value by adding the\n # current coin.\n candidate = [coin] + make_change(value - coin, coins)\n \n if candidate != nil && (best.nil? || candidate.size < best.size)\n best = [coin] + make_change(value - coin, coins)\n end\n end\n end\n best\nend", "def generate_combos(n, item1, item2, item3, u1, u2, u3)\n used = []\n success = 0\n while (success < n)\n new_triplet = make_triplet(item1, item2, item3)\n if (triplet_included(new_triplet, used))\n # do nothing\n else\n success += 1\n used.push(new_triplet)\n end\n end\n end", "def comb_to_win\n s = Card_on_table.new\n g =Combinations.new(s.open_card)\n g.winner_comb\n print \"\\n Give me name of combinations you wonna see on the table.\\n You can choose of: \"\n $the_win_comb.each{|name,m| print name, ' '}\n comb = gets.chomp.to_sym\n puts \"Wait! I am working, trying to find combination : #{comb}!\"\n itr = 0\n time_1 = Time.now\n find_comb = $the_win_comb[comb]\n while find_comb == nil do\n itr+=1\n s = Card_on_table.new\n g =Combinations.new(s.open_card)\n g.winner_comb\n find_comb = $the_win_comb[comb]\n time_2 = Time.now\n end\n print 'Number of itterations - ',itr, ' Time of work,s - ',time_2-time_1\nend", "def combinations\n self.locations.product(self.criterias)\n end", "def opt_params_only_result\n combinations = []\n final_list = []\n final_comb = []\n opt_param_values = get_opt_params_and_values \n opt_params = get_opt_param_names\n \n opt_param_values.each do |k, v|\n v.each do |i|\n v[v.index(i)] = k.to_s + \"=\" + v[v.index(i)]\n end\n combinations << v\n end\n\n(1..combinations.size).each do |c|\n logger.info c.to_s\n final_list << combinations[c-1].combination(1).to_a\n arr = []\nend\n\n # final_list << combinations.each_index.flat_map{|i| combinations[0].product(*combinations[1..i])}\n final_list << progressive_product(combinations)\n final_list.each_index {|i| final_list[i].each {|k| final_comb << final_list[i][final_list[i].index(k)] }}\n final_comb.flatten(1)\n\nend", "def reduce_options(indexed_guessed_code)\n guessed_code = computer.transform_to_colors(indexed_guessed_code)\n guess_score = count_beads(guessed_code)\n score_sum = guess_score.inject(0, :+)\n computer.list_of_combinations.each_with_index do |code, index|\n colored_code = computer.transform_to_colors(code)\n code_score = count_beads(colored_code)\n new_score_sum = code_score.inject(0, :+)\n # puts \"guess score #{guess_score}, code score #{code_score}\"\n next if code_score[0] == 4\n if code == indexed_guessed_code\n computer.list_of_combinations.delete_at(index)\n elsif guess_score != code_score || new_score_sum <= score_sum\n # puts \"#{new_score_sum} <= #{score_sum}\"\n computer.list_of_combinations.delete_at(index)\n end\n end\n # p computer.list_of_combinations.length\n # p computer.list_of_combinations\n end", "def coin_combos(target_value, coin_values)\n coin_values.sort!\n _coin_combos(target_value, coin_values)\nend", "def choose(choices)\n choices.each { |choice|\n # avoid any duplicate positions\n if @free.delete( choice ) then\n callcc { |fk|\n @back << fk\n return choice\n }\n @free.unshift choice\n end\n }\n failure\n end", "def succ\n if @combo == nil or @combo == @set[-@num_elements..-1]\n return nil if (@num_elements +=1) > @set.length\n @combo = @set[0,@num_elements]\n else\n index = (1..@num_elements).find {|i| @combo[-i] < @set[-i]}\n @combo[-index, index] = @set[@map[@combo[-index]], index]\n end\n @combo\n end", "def make_smart_change(change_amount, available_coins)\n possible_answers = []\n while available_coins.length > 1 do\n possible_answers << make_change(change_amount, available_coins)\n \n #compare best answer\n # this_answer = make_smart_change(x,y)\n # if best_ans.length > this_answer\n # best_ans = this_answer\n # end\n next if available_coins.length == 1\n available_coins = available_coins[1..-1]\n end\n \n #pick shortest length array within possible_answers\n possible_answers.sort_by(&:length)[0]\n \nend", "def skittle_combos(skittles)\n skittles.combination(2).map(&:sort).uniq\nend", "def find_complements2(numbers, target_sum: 2020)\n numbers.combination(3).find { |x, y, z| x + y + z == target_sum }\nend", "def solve\n perms = (1..9).to_a.permutation.map {|p| p.join}\n prods = []\n\n perms.each do |p|\n (1..2).each do |len|\n a, b, c = p[0, len].to_i, p[len..4].to_i, p[5, 4].to_i\n prods << c if a * b == c\n end\n end\n \n prods.uniq.reduce( :+ )\n end", "def separate_meal_combo\n @item_search.collect! { |search| search = (search - @meal_combo)} unless @meal_combo.empty?\n end", "def computer_choice_acquisition\n if @proposed_code == []\n @choice_list = @colors.repeated_permutation(@code_length).to_a\n else\n @choice_list.select! do |item|\n result_pair = check_proposed_code(item)\n result_pair[0] == @iteration_correct_value_and_position && result_pair[1] == @iteration_correct_value_wrong_position\n end\n end\n @choice_list[0]\n end", "def winner(array)\n\n win_x_combo = nil\n win_o_combo = nil\n xs = []\n os = []\n\n def x_extractor_helper(array, index) \n array.select.with_index.select do |j, index| \n j == \"X\" || j == \" X \"\n end\n end\n\n def o_extractor_helper(array, index) \n array.select.with_index.select do |j, index| #// or each_with_index\n j == \"O\" || j == \" O \"\n end\n end\n\n def array_dividing_helper_method(array) # need to go a level deeper in array to access [\"a\", 1] ?!\n output_array = []\n array.each do | index0 |\n output_array << index0[1] # need output_array to be local variable??! \n end \n #end # OLD ending to array_dividing_helper_method\n return output_array\n end # ends array_dividing_helper_method\n\n\n xs = array_dividing_helper_method(x_extractor_helper(array, array))\n os = array_dividing_helper_method(o_extractor_helper(array, array))\n\n WIN_COMBINATIONS.each do |combo|\n #os.all? # Instead, try \"os contains WIN_COMBINATIONS[i][0] and WIN_COMBINATIONS[i][1] and [i][2] \"\n if ( ( xs.include?(combo[0]) ) && ( xs.include?(combo[1]) ) ) # was win_x_combo, not xs\n if ( xs.include?(combo[2]) )\n #puts \"Winning X Combo is #{combo} \"\n win_x_combo = combo\n #return combo\n else puts \"No x Win Combination. current combo is #{combo}\"\n end\n end\n end\n \n WIN_COMBINATIONS.each do |combo|\n if ( ( os.include?(combo[0]) ) && ( os.include?(combo[1]) ) ) \n if ( os.include?(combo[2]) )\n #puts \"Winning O Combo is #{combo} \"\n win_o_combo = combo\n #return combo\n #else puts \"No o Win Combination\"\n end\n end\n end \n\n\n if ( win_x_combo != nil )\n puts \" X Won!\"\n return \"X\"\n end\n\n if ( win_o_combo != nil )\n puts \" O Won!\"\n return \"O\"\n else puts (\"No winner\") and\n return nil\n end\n\n\nend", "def comb_select()\r\n\tmin_runner = 10\r\n\tmax_runner = 100\r\n\tgreater_than = 1000000\r\n\tcounter = 0\r\n\t\r\n\tfor runner in (min_runner..max_runner)\r\n\t\trun_f = factorial(runner)\r\n\t\tmin_select = (runner/4).to_i\r\n\t\tfor selection in (2..runner-1)\r\n\t\t\tdivider = factorial(selection) * factorial(runner - selection)\r\n\t\t\tcounter += 1 if run_f / divider > greater_than\r\n\t\tend\r\n\tend\r\n\treturn counter\r\nend", "def won?(board)\r\n sam_ex = []\r\n sam_oh = []\r\n i = 0\r\n board.each do |index|\r\n if index == \"X\"\r\n sam_ex.push(i)\r\n elsif index == \"O\"\r\n sam_oh.push(i)\r\n end\r\n i+=1\r\n end\r\n WIN_COMBINATIONS.each do |combination|\r\n if combination&sam_oh == combination || combination&sam_ex ==combination\r\n return combination\r\n end\r\n end\r\n nil\r\nend", "def validate_comb(board_view, comb)\n truths = comb.map.with_index do |value, idx|\n board_view[idx].include?(value)\n end\n truths.all? {|t| t}\nend", "def find_n_that_total(all, total, n)\n all.combination(n).each do |combo|\n if combo.sum == total\n # p combo\n return combo\n end\n end\nend", "def combination_sum2(candidates, target)\n result = []\n helper(candidates.sort, target, 0, 0, [], result)\n result\nend", "def combination_sum2(candidates, target)\n result = []\n helper(candidates.sort, target, 0, 0, [], result)\n result\nend", "def min_size_heuristic(amount,comb,coins)\n rem = amount-comb.sum\n return Infinity if rem < 0\n comb.size+rem.to_f/(coins.select{|c|c<=rem&&c<=comb.max}.max) rescue comb.size\nend", "def problem_60a\n num_cut = 5\n# simple\n pairs = {}\n seen_primes = []\n num_primes = 0\n last = start = Time.now\n Primes.each do |p|\n next if p == 2\n b = p.to_s\n seen_primes.each_index do |sp_i|\n sp = seen_primes[sp_i]\n a = sp.to_s\n ai,bi = a.to_i,b.to_i\n ab = (a + b).to_i\n ba = (b + a).to_i\n\n if ba.prime? && ab.prime?\n # We have a pair that works both ways so add the peer to each prime\n pairs[ai] = aa = ((pairs[ai] || []) << bi).uniq\n pairs[bi] = bb = ((pairs[bi] || []) << ai).uniq\n next unless pairs[bi].length >= num_cut - 1 # bi is biggest of pair\n\n check = ([ai] + aa) & ([bi] + bb)\n if check.length >= num_cut\n puts \"Try #{check.inspect}\"\n perm = check.permutation(2).to_a\n new = perm.select do |x,y|\n (x.to_s + y.to_s).to_i.prime? && (x.to_s + y.to_s).to_i.prime?\n end\n if new.length == perm.length\n n = new.flatten.uniq\n sum = n.reduce(&:+)\n puts \"#{n.inspect} *** #{sum}\"\n return sum\n end\n end\n end\n end\n seen_primes << p\n end\n nil\nend", "def solve_num\n union_apple = [\"a\", \"b\", \"a\"] | [\"c\", \"c\"]\nend", "def try_two\n (5000..9999).map do |n|\n concat_product(n, 2)\n end.select {|cp| pandigital cp }\nend", "def possibilities(words = {})\n words.reduce(Hash.new([])) do |combos, (k,v)|\n 1.upto(v.length) do |i|\n combos[k] += v.combination(i).to_a.map {|combo| combo.sort }\n end\n combos[k].sort!\n combos\n end\nend", "def hard(input, amount)\n solutions = {}\n (2..input.length).each do |i|\n count = input.combination(i).select { |c| c.sum == amount }.length\n solutions[i] = count unless count.zero?\n end\n min_containers = solutions.keys.min\n solutions[min_containers]\nend", "def getMoneySpent(keyboards, drives, b)\n\n# pair_sum stores the possible pair prices\n pair_sum= []\n \n# The product method does the combining for us \n combinations = keyboards.product(drives)\n \n# Then we reduce(:+) each pair subarray and push it to the sum array if it's not above our budget\n combinations.each { |pair| pair_sum << pair.reduce(:+) if pair.reduce(:+) <= b } \n\n# Finally we return -1 if the sum array is empty, meaning all pairs are above budget.\n# Otherwise we return the max\n pair_sum.empty? ? -1 : pair_sum.max\nend", "def solution(a, b)\n a.size > b.size ? b+a+b : a+b+a\nend", "def combos(cards)\n cards.to_a.combination(3).to_a\n end", "def find_combinations(source, selection_size)\n\t#RubyProf.start\n\tcombinations = []\n\tlen = 2 ** source.size - 1\n\t(1..len).each do |number| # each number 1..n\n\t\tselection = []\n\t\t(0..source.size).each do |ix| # each bit\n\t\t\tif selection.size <= selection_size\n\t\t\t\tselection << source[ix] if number & ( 1 << ix ) > 0\n\t\t\tend\n\t\tend\n\t\tcombinations << selection if !selection.empty? && selection.size == selection_size\n\tend\n\t#puts RubyProf::FlatPrinter.new(RubyProf.stop).print(STDOUT)\n\tcombinations\nend", "def all_best_seat_combinations\n first=seat_point_chart[seat_point_chart.map{|x| x[2]}.each_with_index.max[1]]\n all_best = [[first[0]+first[1].to_s]]\n for i in 2..availableSeats.length\n all_best.push(best_seat_combination(i))\n end \n all_best\n end", "def print_all_combinations(selected_set, left_over_set)\ndebug(\"first #{selected_set} - left over #{left_over_set}\")\n left_over_set.each do |left_over|\n save(selected_set + [left_over])\n end\nend", "def find_poker_subsets\n # calls other poker subset methods\n update_hand_hash\n return 8 if find_straight_flush\n return 7 if find_quad\n return 6 if find_full_house\n return 5 if find_flush\n return 4 if find_straight\n return 3 if find_triple\n return 2 if find_two_pair\n return 1 if find_pair\n return 0 if find_high_card(@cards)\n end", "def assosi(minsupp = 2)\n # create 1-frequent-set\n c1 = Product.all.permutation(1).to_a\n l1 = c1.reject { |fi| trans_containing(fi) < minsupp}\n # find k-frequent-set, first elem is nil because k = 2\n l = [nil, l1]\n k = 2\n c = []\n while not(l[k-1].empty?)\n # find candidates\n b = l[k-1].flatten.to_set.to_a\n c = b.reduce([]) do |accu, extension|\n accu + l[k-1].reduce([]) do |accu2, canidate|\n if not(canidate.include?(extension)) then\n accu2 << (canidate + [extension])\n else\n accu2\n end\n end\n end\n # remove dubs\n c = c.collect {|e| e.to_set }.to_set.collect {|e| e.to_a }.to_a\n # select minsupps\n l[k] = c.reject { |canidate| trans_containing(canidate) < minsupp }\n k = k + 1\n end\n #first elem is nil; last elem is an empty list\n l.shift; l.pop\n low_fatten(l)\n end", "def five_hundred_and_twenty(_max_number = 1000)\n # Initialize values\n all_number_sets = [\n { 'o1' => 1, 'o2' => 1, 'o3' => 1 },\n { 'o1' => 1, 'e1' => 2 },\n { 'o1' => 3 }\n ]\n all_number_sets = [\n { 'o1' => 1, 'o2' => 1, 'o3' => 1, 'o4' => 1 },\n { 'o1' => 1, 'o2' => 1, 'e1' => 2 },\n { 'o1' => 3, 'o2' => 1 },\n { 'e1' => 2, 'e2' => 2 },\n { 'e1' => 4 }\n ]\n all_number_sets = [\n { 'o1' => 1, 'o2' => 1, 'o3' => 1, 'o4' => 1, 'o5' => 1 },\n { 'o1' => 1, 'o2' => 1, 'o3' => 1, 'e1' => 2 },\n { 'o1' => 1, 'e1' => 2, 'e2' => 2 },\n { 'o1' => 1, 'e1' => 4 }\n ]\n all_number_sets.each do |set|\n all_permutations = TaylorMath::Probability.npr(set.length, set.reduce(&:*))\n no_duplicate_permutations = all_permutations / TaylorMath::Probability.objects_factor(set)\n comb_with_zero = nil # TODO: Correct this value\n comb_without_zero = nil # TODO: Correct this value\n end\nend", "def won?(board)\n WIN_COMBINATIONS.each do |combo|\n if position_taken?(board,combo[0]) && position_taken?(board,combo[1]) && position_taken?(board,combo[2])\n if board[combo[0]] == board[combo[1]] && board[combo[1]] == board[combo[2]]\n return combo\n end\n end\n end\n return false\nend", "def won?\ntokens = [\"X\", \"O\"]\nwon = false\n@x_win = false\n@o_win = false\nwinning_combo = []\n\nWIN_COMBINATIONS.each do |combination|\n @x_win = combination.all?{|index| @board[index] == tokens[0]} if true\n @o_win = combination.all?{|index| @board[index] == tokens[1]} if true\n if @x_win || @o_win\n won = true\n winning_combo = combination\n end\nend\n\nif won #what should we return\n winning_combo\nelse\n false\nend\nend", "def compute_matching_product(among_products) among_products.select { |product| concern?(product, among_products) } end", "def deduce\n while true\n stuck, guess, count = true, nil, 0\n # fill in any spots determined by direct conflicts\n allowed = board.allowed_numbers\n (0..80).each do |index|\n if board.board[index].nil?\n numbers = bits_to_numbers(allowed[index])\n if numbers.size == 0\n return [] # Return nothing if no possibilitie E\n elsif numbers.size == 1\n board.board[index] = numbers[0]\n stuck = false\n break\n elsif stuck\n new_guesses = numbers.map { |n| [index, n] }\n guess, count = pickbetter(guess, count, new_guesses)\n end\n end\n end\n\n if !stuck\n allowed = board.allowed_numbers\n end\n needed = board.needed_numbers\n\n # fill in any spots determined by elimination of other locations.\n # For any given column, find which numbers it is missing,\n # And figure out which positions allow those numbers - if only\n # one position allows it, the number goes there.\n #\n # If more than one spot is available, add to the guesses.\n board.coordinate_systems.each do |axis|\n (0..8).each do |x|\n numbers = bits_to_numbers(needed[axis_index(x, axis)])\n numbers.each do |n|\n bit = 1 << n\n # spots =for this number & col, all positions that allow the needed\n # numbers\n spots = []\n\n (0..8).each do |y|\n index = board.index_for(x, y, axis)\n # if this position allows the needed number, add it to spots\n if allowed[index] & bit\n spots << index\n end\n end\n\n if spots.length == 0\n return []\n elsif spots.length == 1\n board.board[spots[0]] = n\n stuck = False\n break\n elsif stuck\n new_guesses = spots.map { |index| [index, n] }\n guess, count = pickbetter(guess, count, new_guesses)\n end\n end\n end\n end\n\n if stuck\n guess.shuffle! unless guess.nil?\n return guess\n end\n end\n end", "def win_possibilities(piece)\n\t\t[ [ [piece[0],piece[1]],[piece[0]+1,piece[1]],[piece[0]+2,piece[1]],[piece[0]+3,piece[1]] ],\n\t\t[ [piece[0]-1,piece[1]],[piece[0],piece[1]],[piece[0]+1,piece[1]],[piece[0]+2,piece[1]] ],\n\t\t[ [piece[0]-2,piece[1]],[piece[0]-1,piece[1]],[piece[0],piece[1]],[piece[0]+1,piece[1]] ],\n\t\t[ [piece[0]-3,piece[1]],[piece[0]-2,piece[1]],[piece[0]-1,piece[1]],[piece[0],piece[1]] ],\n\t\t[ [piece[0],piece[1]],[piece[0],piece[1]+1],[piece[0],piece[1]+2],[piece[0],piece[1]+3] ],\n\t\t[ [piece[0],piece[1]-1],[piece[0],piece[1]],[piece[0],piece[1]+1],[piece[0],piece[1]+2] ],\n\t\t[ [piece[0],piece[1]-2],[piece[0],piece[1]-1],[piece[0],piece[1]],[piece[0],piece[1]+1] ],\n\t\t[ [piece[0],piece[1]-3],[piece[0],piece[1]-2],[piece[0],piece[1]-1],[piece[0],piece[1]] ],\n\t\t[ [piece[0],piece[1]],[piece[0]+1,piece[1]+1],[piece[0]+2,piece[1]+2],[piece[0]+3,piece[1]+3] ],\n\t\t[ [piece[0]-1,piece[1]-1],[piece[0],piece[1]],[piece[0]+1,piece[1]+1],[piece[0]+2,piece[1]+2] ],\n\t\t[ [piece[0]-2,piece[1]-2],[piece[0]-1,piece[1]-1],[piece[0],piece[1]],[piece[0]+1,piece[1]+1] ],\n\t\t[ [piece[0]-3,piece[1]-3],[piece[0]-2,piece[1]-2],[piece[0]-1,piece[1]-1],[piece[0],piece[1]] ],\n\t\t[ [piece[0],piece[1]],[piece[0]+1,piece[1]-1],[piece[0]+2,piece[1]-2],[piece[0]+3,piece[1]-3] ],\n\t\t[ [piece[0]-1,piece[1]+1],[piece[0],piece[1]],[piece[0]+1,piece[1]-1],[piece[0]+2,piece[1]-2] ],\n\t\t[ [piece[0]-2,piece[1]+2],[piece[0]-1,piece[1]+1],[piece[0],piece[1]],[piece[0]+1,piece[1]-1] ],\n\t\t[ [piece[0]-3,piece[1]+3],[piece[0]-2,piece[1]+2],[piece[0]-1,piece[1]+1],[piece[0],piece[1]] ] ]\n\tend", "def mixed_combinations\n combination_generator.mixed_combinations\n end", "def possibilities(words)\n words.each do |word, translations|\n sorted = translations.sort\n words[word] = sorted.each_index.map {|i|\n sorted.combination(i+1).to_a\n }.flatten(1).sort\n end\nend", "def combicheck(ref_arr, result)\r\n found_combi = []\r\n not_found_combi = []\r\n ref_arr.each do |item|\r\n #p item\r\n if combifind_in(item, result)\r\n found_combi << item\r\n else\r\n not_found_combi << item\r\n end\r\n end\r\n if found_combi.size == ref_arr.size\r\n log \"Combicheck is ok\"\r\n return true\r\n else\r\n log \"Combicheck failed, NOT found #{not_found_combi.size}/#{ref_arr.size} combi, they are:\"\r\n not_found_combi.each{|e| puts e.join(\",\") }\r\n end\r\n return false\r\n end", "def combine(draw_input)\n letters_amount = Array(0..(draw_input.length-1))\n combinations = letters_amount.map{ |x| (letters_amount - [x]).map{ |z| draw_input[z] } }\n smaller_combinations = combinations.map { |e| combine(e) }.flatten(1) + [draw_input]\n smaller_combinations.uniq.reject(&:empty?)\nend", "def selection plan, solutions\n (sort_soluitons plan, solutions.shuffle.first(4)).first(2)\n end", "def uniq_combinations_by_piece\n joins = combinations.keys\n\n joins.each do |join|\n combinations[join].reject! do |comb|\n comb.uniq { |c| c[:piece] }.size < comb.size\n end\n end\n end", "def evaluate_combo(combo)\r\n score = 0\r\n\r\n # Cell 1\r\n if board.cells[combo[0]] == token\r\n score = 1\r\n elsif board.cells[combo[0]] == rival_token\r\n score = -1\r\n end\r\n\r\n # Cell 2: two in a row\r\n if board.cells[combo[1]] == token\r\n if score == 1\r\n score = 10\r\n elsif score == -1\r\n return 0\r\n else\r\n score = 1\r\n end\r\n elsif board.cells[combo[1]] == rival_token\r\n if score == -1\r\n score = -10\r\n elsif score == 1\r\n return 0\r\n else\r\n score = -1\r\n end\r\n end\r\n\r\n # Cell 3: three in a row\r\n if board.cells[combo[2]] == token\r\n if score > 0\r\n score *= 10\r\n elsif score < 0\r\n return 0\r\n else\r\n score = 1\r\n end\r\n elsif board.cells[combo[2]] == rival_token\r\n if score < 0\r\n score *= 10\r\n elsif score > 1\r\n return 0\r\n else\r\n score = -1\r\n end\r\n end\r\n\r\n score\r\n end", "def _pbNextComb(comb,length)\n i = comb.length-1\n begin\n valid = true\n for j in i...comb.length\n if j==i\n comb[j] += 1\n else\n comb[j] = comb[i]+(j-i)\n end\n if comb[j]>=length\n valid = false\n break\n end\n end\n return true if valid\n i -= 1\n end while i>=0\n return false\nend", "def reqd_and_opt_params_combination_results\n if @r_output.empty?\n @o_output\n elsif @o_output.empty?\n @r_output\n else\n @r_output.product(@o_output) if !(@r_output.empty? && @o_output.empty?) \n end \n end", "def print_combos(vector)\n \nend", "def won?\n WIN_COMBINATIONS.each do |combo|\n if combo.all? { |i| @board[i].downcase == \"x\"}\n return combo\n elsif combo.all? { |i| @board[i].downcase == \"o\"}\n return combo\n end\n end\n return false\nend", "def optimal_value_from_bundles_shown(bundles = bundles_shown)\n max = -99999 # really small number\n\n # go through single goods\n goods.keys.each do |k|\n if max < bundle([k])\n max = bundle([k])\n end\n end\n\n # go through bundles\n bundles.each do |b|\n if max < bundle(b)\n max = bundle(b)\n end\n end\n\n # go through combo\n if combo_seen?(bundles) && max < combo_witheffect\n max = combo_witheffect\n end\n\n max\n end", "def game_over?\n combinations = grab_combos\n result = check_combos(combinations)\n [result[0], result[1]]\n end", "def won?(board)\n WIN_COMBINATIONS.find do |combo_element|\n #here we are passing in the WIN_COMBO[1][0] INDEX LOCATION and saying find it on the board\n #so if were passing in WIN_COMBO[1](3,4,5) and looking at combo_element[0](3)\n #on the board we will be looking at board[index3]\n #we are then checking if all three combo elements are the same \"X/O\"\n board[combo_element[0]] == board[combo_element[1]] &&\n board[combo_element[1]] == board[combo_element[2]] &&\n position_taken?(board, combo_element[0]) #use [0] bc we've already compared [1]&&[2] to it\n end\nend", "def find_three_num_combos(nums)\n combos = []\n 0.upto(nums.size - 3) do |i1|\n 1.upto(nums.size - 2) do |i2|\n 2.upto(nums.size - 1) do |i3|\n combos << [nums[i1], nums[i2], nums[i3]] if i3 > i2 && i2 > i1\n end\n end\n end\n combos\nend", "def solve\n s = Hash[(1...1000).map { |i| [i, i * i] }]\n (1...1000).each do |c|\n (1...c).each do |b|\n (1..b).each do |a|\n return a * b * c if (a + b + c) == 1000 && (s[a] + s[b]) == s[c]\n end\n end\n end\nend", "def best_choice (board, combinations)\n # counts array will contain how many times each available cell index occurs\n # in the current winning combinations (if cell is taken, corresponding count is 0)\n # This approach results in a reasonable best choice almost all of the time.\n counts = [*0..8].map do |val|\n index_count = 0\n if !board.taken?(val+1)\n combinations.each { | combo| index_count += combo.count(val) }\n end\n index_count\n end\n # return the available index that shows up the most in the winning combinations (max). In the\n # situation where there are no more winning combinations, just return first empty cell index\n if counts.max > 0\n choice = counts.index(counts.max)\n else\n choice = [*0..8].find_index { |cell_index| !board.taken?(cell_index+1)}\n end\n choice\n end", "def score(combo)\n @ingredients.map { |arr| arr[0..arr.size-2] } # skip last element\n .map.with_index do |set, i|\n set.map { |val| val * combo[i] } # multiply ingredient values by # of teaspoons\n end.transpose.map { |x| x.reduce(:+) } # multiply elementwise: https://stackoverflow.com/a/2682983/\n .map { |num| [num, 0].max }.reduce(:*) # min of zero, multiply result\n end", "def win_combos \n row_wins = @board.map { |x| x - 1 }.each_slice(@n).to_a\n column_wins = @columns.flatten.map { |x| x - 1 }.each_slice(@n).to_a \n diagonal_wins = @diagonals.flatten.map { |x| x - 1 }.each_slice(@n).to_a \n win_combos = row_wins + column_wins + diagonal_wins\n end", "def pick_two (numbers, answer, solution)\n return if numbers.length < 2 # Terminate if unable to pick\n for i in 0..numbers.length-1\n for j in i+1..numbers.length-1\n remaining = numbers.clone #remaining elements\n b = remaining.delete_at(j) #delete j first so i is unaffected\n a = remaining.delete_at(i)\n # Since answer must be positive, we enforce a > b\n pick_op([a,b].max, [a,b].min, remaining, answer, solution)\n end\n end \nend", "def combination\n @combination ||= CombinationDetector.new(@cards).combination\n end", "def combos_in_tricking_style(tricker, style)\n # get all the combos using this trick\n combos = self.combos.uniq\n\n # remove my combos from this list\n combos.reject! { |c| c.tricker == tricker }\n \n # get the ids of the tricks I can do\n included_tricks = style.tricks.map(&:id)\n\n # (style-combo).count == style.count - combo.count\n # this hits the database twice. is there a better way?\n combos.reject! { |c| ((included_tricks-c.tricks.map(&:id)).count != (included_tricks.count - c.tricks.uniq.map(&:id).count)) }\n\n combos or []\n end", "def solve(ingredients, part_two: false)\n score = 0\n max = 0\n\n (0..100).each do |i|\n (0..100 - i).each do |j|\n (0..100 - i - j).each do |k|\n l = 100 - i - j - k\n capacity = calculate_total(ingredients, \"capacity\", i, j, k, l)\n durability = calculate_total(ingredients, \"durability\", i, j, k, l)\n flavor = calculate_total(ingredients, \"flavor\", i, j, k, l)\n texture = calculate_total(ingredients, \"texture\", i, j, k, l)\n calories = calculate_total(ingredients, \"calories\", i, j, k, l)\n\n next if part_two && calories != 500\n next if capacity <= 0 || durability <= 0 || flavor <= 0 || texture <= 0\n\n score = capacity * durability * flavor * texture\n max = score if score > max\n end\n end\n end\n max\nend", "def slow_solution(a)\n m = 0\n a.size.times do |i|\n a[i] = a[i].abs\n m = [a[i], m].max\n end\n maxsum = a.sum # sum of absolute val of all nums in array\n # maxsum = a.map(&:abs).sum <- Ruby shortcut\n\n # If dp = 1 at an index, it means some combo of elements in a add up to that index\n dp = [0] * (maxsum + 1)\n dp[0] = 1\n\n a.size.times do |j|\n maxsum.downto(0).each do |possible_sum|\n puts \"a[j]: #{a[j]}, possible sum: #{possible_sum}\"\n if (dp[possible_sum] == 1) and (possible_sum + a[j] <= maxsum)\n\n # if possible_sum + new element a[j] is possible sum, dp = 1!\n dp[possible_sum + a[j]] = 1\n puts \"Mark #{possible_sum + a[j]} as possible sum in dp\"\n end\n end\n puts \"row: #{j}, a[j]: #{a[j]}, dp: #{dp}\"\n puts\n end\n\n min_q_minus_p = maxsum\n\n # Divide array a into 2 parts, where P = sum of part 1 and Q = sum of part 2,\n # P + Q = maxsum, and P <= maxsum / 2 <= Q.\n # We want largest possible P to get smallest possible Q-P.\n\n # loop from 0 to maxsum / 2, covering every possible P, Q division\n (maxsum / 2 + 1).times do |possible_half_sum|\n # puts \"possible_half_sum: #{possible_half_sum}\"\n if dp[possible_half_sum] == 1 # means P or Q = possible_half_sum\n q_minus_p = maxsum - 2 * possible_half_sum\n # puts \"Q - P: #{q_minus_p}\"\n min_q_minus_p = [min_q_minus_p, q_minus_p].min\n # puts \"min Q - P: #{min_q_minus_p}\"\n end\n end\n\n min_q_minus_p\nend", "def won?(board)\nWIN_COMBINATIONS.each do |combination|\n combination.all? do |occupied|\n if position_taken?(board, occupied) == true\n if board[combination[0]] == board[combination[1]] && board[combination[0]] == board[combination[2]]\n return combination\n end\n end\n end\nend\n return false\nend", "def combinations(array)\n combination_array = []\n array.each_with_index do |ele1, idx1|\n array.each_with_index do |ele2, idx2|\n combination_array << [ele1, ele2] if idx2 > idx1\n end\n end\n\n combination_array\nend", "def given(array = [])\n i = cur_val = 0\n until array[i].nil?\n cur_val += array[i] * VALS[i]\n i += 1 \n end\n return [array] if cur_val == GOAL_VAL\n combos = []\n if VALS[i] > 1\n (0..((GOAL_VAL - cur_val) / VALS[i])).each do |num_coins|\n combos += given( array + [num_coins] )\n end\n return combos\n else\n return [array + [GOAL_VAL - cur_val] ]\n end\nend", "def solve_again_with_more_issues(array, sum)\n array.combination(2).find_all do |one, two|\n one + two == sum\n end.size\nend" ]
[ "0.6434189", "0.6362694", "0.6347652", "0.62968034", "0.6276907", "0.6273075", "0.6244529", "0.6214982", "0.617353", "0.6166048", "0.61658174", "0.61523706", "0.61380625", "0.61331844", "0.61323303", "0.61092186", "0.60968673", "0.6094347", "0.6080268", "0.6071504", "0.60671365", "0.6065777", "0.6061658", "0.60502964", "0.60337263", "0.6032799", "0.60124475", "0.5990685", "0.5986186", "0.59819406", "0.59663993", "0.5956502", "0.593479", "0.59313124", "0.5906632", "0.5875113", "0.58692473", "0.58663875", "0.58550376", "0.5849022", "0.5827592", "0.5827534", "0.58239037", "0.5815328", "0.5813115", "0.5804596", "0.58037", "0.5800768", "0.579805", "0.57926774", "0.57884127", "0.57884127", "0.57835054", "0.57819116", "0.5778664", "0.57736707", "0.57633275", "0.5760486", "0.5755378", "0.5728749", "0.57276165", "0.5721786", "0.5719286", "0.57109857", "0.5710109", "0.5703148", "0.56885", "0.568103", "0.56697685", "0.5667158", "0.5664963", "0.56586057", "0.56535125", "0.56329286", "0.56300616", "0.56252635", "0.56243336", "0.5622119", "0.56129706", "0.56129164", "0.56081367", "0.5608121", "0.5596375", "0.5591813", "0.55894655", "0.5579627", "0.55759877", "0.5574847", "0.5569235", "0.5567547", "0.55668783", "0.55658996", "0.5562709", "0.5560482", "0.5559681", "0.5558026", "0.5557736", "0.5554363", "0.5554315", "0.555356" ]
0.7086058
0
======= Methods for stats =========
def beta_question? !display_timer? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stats; end", "def stats; end", "def stats\n end", "def stats\n end", "def stats\n \n end", "def stats\n ## TODO:\n end", "def statistics; end", "def quick_stats\n\tend", "def statistics\n super\n end", "def statistics\n super\n end", "def statistics\n super\n end", "def statistics\n super\n end", "def statistics\n super\n end", "def statistics\n super\n end", "def statistics\n super\n end", "def statistics\n super\n end", "def statistics\n super\n end", "def statistics\n super\n end", "def statistics\n super\n end", "def statistics\n super\n end", "def stat() end", "def stats\n\t\t@counts\n\tend", "def stat\n end", "def stats\n @stats ||= Stats.new(self)\n end", "def stats\n DEFAULT_STATS.dup\n end", "def stats\n stats_cache.stats\n end", "def stats\n {}\n end", "def goaltending_stats(stats)\n\nend", "def stats\n self[:stats]\n end", "def stats\n stats64 || stats32\n end", "def stats\n @data.info\n end", "def show_stat\n \t\tputs \"=============Statistics============\"\n \t\tputs \"Score: #{get_score}\"\n \t\tputs \"Total time: \" + \"%0.2f\" %(@end_time - @start_time + @save_time) + \" seconds\"\n \t\tputs \"Number of sets found: #{@number_of_correct}\"\n \t\tputs \"#{@number_of_hint}/#{@total_hint} hints used\"\n \tend", "def stats\n puts 'You have ' + self.health.to_s + ' health remaining and have ' + self.denarii.to_s + ' denarii to your name.'\n end", "def statistic\n\t @ksstat\n\t end", "def global_statistics\n super\n end", "def get_stats()\n val = [@dex, @str, @int, @lck]\n end", "def stats(*arg)\n @data.stats(*arg)\n end", "def stats\n @data.with { |c| c.stats }\n end", "def stats\n\t\[email protected]\n\tend", "def get_stats\n\t\[email protected]_stats\n\tend", "def measure; end", "def statistics\n @statistics ||= []\n end", "def stats\n @stats ||= query\n end", "def stats\n @stats ||= query\n end", "def calculate_stats()\r\n\t\t# Best\r\n\t\t@fittest_genome = @population.max\r\n\t\t@best_fitness = @fittest_genome.fitness\r\n\t\t# Worst\r\n\t\t@worst_fitness = @population.min.fitness\r\n\t\t# Total\r\n\t\t@total_fitness = @population.inject(0){|sum, g| sum + g.fitness}\r\n\t\t# Average\r\n\t\t@average_fitness = @total_fitness / @pop_size\r\n\tend", "def summary; end", "def summary; end", "def summary; end", "def summary; end", "def all_statistics\n super\n end", "def all_statistics\n super\n end", "def all_statistics\n super\n end", "def all_statistics\n super\n end", "def all_statistics\n super\n end", "def all_statistics\n super\n end", "def all_statistics\n super\n end", "def all_statistics\n super\n end", "def all_statistics\n super\n end", "def all_statistics\n super\n end", "def all_statistics\n super\n end", "def all_statistics\n super\n end", "def list_stats\r\n puts \"#{@name} Stats:\"\r\n puts \"Total HP: #{@hp}\"\r\n puts \"Class: #{@job}\"\r\n puts \"Total Strength: #{@strength}\"\r\n puts \"Total Speed: #{@speed}\"\r\n end", "def stats\n with { |c| c.stats }\n end", "def stats(g)\n puts \"Numero di stati U: #{@ude_counter['u']}\"\n puts \"Numero di stati D: #{@ude_counter['d']}\"\n puts \"Numero di stati E: #{@ude_counter['e']}\"\n puts \"---------------------\"\n puts \"Valore massimo della funzione di SG: #{max_sg_value}\"\n end", "def stats\n @additions ||= 0\n @deletions ||= 0\n @stats_row_one = {\n active_user_count: @active_user_count,\n pull_count: @pull_count,\n comment_count: @comment_count,\n qa_signoff_count: @qa_signoff_count\n }\n @stats_row_two = {\n avg_additions: @additions.round.to_i,\n avg_deletions: @deletions.round.to_i,\n net_additions: @net_additions\n }\n end", "def print_stats\n puts \"==================================================\"\n puts \"================= Statistics =====================\"\n puts \"==================================================\"\n \n calc_stats()\n \n puts \"Total Records = #{@total_rec_cnt}\"\n puts \"Well Formed Records = #{@well_formed_rec_cnt}\"\n puts \"Malformed Records = #{@malformed_rec_cnt}\"\n puts \"Unique Business Records = #{@biz_rec_cnt}\"\n puts \"Unique User Records = #{@user_rec_cnt}\"\n puts \"\"\n end", "def stats\n Stats.all.inject({}) do |acc_hash, keyval|\n key, val = keyval\n acc_hash.merge(key => val[self.name])\n end\n end", "def stats\n request :get, \"_stats\"\n end", "def stats\n request :get, \"_stats\"\n end", "def stats\n rooms = objs = scripts = characters = accounts = 0\n self.each do |val|\n case val\n when Room\n rooms += 1\n when Character\n characters += 1\n when GameObject\n objs += 1\n when Script\n scripts += 1\n when Account\n accounts += 1\n end\n end\n stats=<<EOD\n[COLOR Cyan]\n---* Database Statistics *---\n Rooms - #{rooms}\n Objects - #{objs}\n Scripts - #{scripts}\n Accounts - #{accounts}\n Characters - #{characters}\n Total Objects - #{rooms+objs+characters+accounts+scripts}\n Highest OID in use - #{@dbtop}\n---* *---\n[/COLOR]\nEOD\n end", "def stats\n\t\[email protected]([[@hero.name], [\"HP\", \"MP\"], [@hero.current_hp.to_s, @hero.current_mp.to_s]])\n\t\[email protected]\n\tend", "def exams_statistics\n end", "def summary\n \n end", "def stat\n each_with_object(Hash.new(0)) { |c, o| o[c] += 1 }\n end", "def stats\n {:money => @money , :life => @life, :fights => @fights, :respect => @respect, :state => @state.id, :substate => @state.state.id}\n end", "def measure\n\t\t1\n\tend", "def stats\n adapter.stats\n end", "def get_stats \n #health\n parts_health = self.parts.map{|part| part.health}\n health_total = get_total(parts_health)\n\n #speed\n parts_speed = self.parts.map{|part| part.speed}\n speed_total = get_total(parts_speed)\n\n #attack\n parts_attack = self.parts.map{|part| part.attack}\n attack_total = get_total(parts_attack)\n\n #defense\n parts_defense = self.parts.map{|part| part.defense}\n defense_total = get_total(parts_defense)\n\n #battery_life\n parts_battery_life = self.parts.map{|part| part.battery_life}\n battery_life_total = get_total(parts_battery_life)\n\n grand_total = health_total + speed_total + attack_total + defense_total + battery_life_total\n\n #Normalizing stats\n self.health = health_total / grand_total * 100\n self.speed = speed_total / grand_total * 100\n self.attack = attack_total / grand_total * 100\n self.defense = defense_total / grand_total * 100\n self.battery_life = battery_life_total / grand_total * 100\n self.save\n end", "def lines\n @stats ||= stats\n end", "def iiop_statistics\n super\n end", "def stats\n @stats = {}\n @stats[\"online\"] = \"Of course. That's how the internet works.\"\n @stats[\"requested_at\"] = Time.now\n @stats[\"total_tweets\"] = ActiveRecord::Base.connection.execute(\"explain select count(id) from tweets\").all_hashes.first[\"rows\"]\n @stats[\"total_users\"] = ActiveRecord::Base.connection.execute(\"explain select count(id) from users\").all_hashes.first[\"rows\"]\n @stats[\"number_collections\"] = ActiveRecord::Base.connection.execute(\"select count(id) from collections\").fetch_row.first\n @stats[\"researchers_active\"] = ActiveRecord::Base.connection.execute(\"select count(id) from researchers\").fetch_row.first\n @stats[\"scrape_count\"] = ActiveRecord::Base.connection.execute(\"select count(id) from scrapes\").fetch_row.first\n @stats[\"datasets_count\"] = ActiveRecord::Base.connection.execute(\"select count(id) from collections where single_dataset = 1\").fetch_row.first\n @stats[\"analysis_jobs_completed\"] = ActiveRecord::Base.connection.execute(\"select count(id) from analysis_metadatas\").fetch_row.first\n @stats[\"total_graphs\"] = ActiveRecord::Base.connection.execute(\"select count(id) from graphs\").all_hashes.first[\"rows\"]\n @stats[\"total_graph_points\"] = ActiveRecord::Base.connection.execute(\"select count(id) from graph_points\").all_hashes.first[\"rows\"]\n @stats[\"total_edges\"] = ActiveRecord::Base.connection.execute(\"select count(id) from edges\").fetch_row.first\n respond_to do |format|\n format.xml { render :xml => @stats.to_xml }\n format.json { render :json => @stats.to_json }\n end\n end", "def stat_total\n (self.health + self.hunger + self.happiness) / 3\n end", "def stat\n z.each_with_index.map do |_z_val, idx|\n stat_i(idx)\n end\n end", "def metrics\n with_stats_lock do\n @stats_hash.keys.map { |spec| spec.to_s }\n end\n end", "def setup_stats\r\n randomnums = Random.new\r\n $strength += randomnums.rand(1...100)\r\n $wealth += randomnums.rand(1...100)\r\nend", "def score; end", "def stats\n get_charts\n end", "def initialize\n # We start with an empty hash of stats\n @stats = {}\n end", "def stat\n x.each_with_index.map do |_x_val, idx|\n stat_i(idx)\n end\n end", "def memstats\n # initialize all counters\n rooms = objs = chars = accounts = scripts = strcount = strsize = ocount = 0\n\n # scan the ObjectSpace counting things\n ObjectSpace.each_object do |x|\n case x\n when String\n strcount += 1\n strsize += x.size\n when Character\n chars += 1\n when Account\n accounts += 1\n when Room\n rooms += 1\n when GameObject\n objs += 1\n when Script\n scripts += 1\n else\n ocount += 1\n end\n end\n\n # our report :\n # :NOTE: sprintf would be better\n memstats=<<EOD\n[COLOR Cyan]\n----* Memory Statistics *----\n Rooms - #{rooms}\n Objects - #{objs}\n Scripts - #{scripts}\n Accounts - #{accounts}\n Characters - #{chars}\n-----------------------------\n Strings - #{strcount}\n size - #{strsize} bytes\n Other - #{ocount}\n-----------------------------\n Total Objects - #{rooms+objs+chars+accounts+scripts+strcount+ocount}\n----* *----\n[/COLOR]\nEOD\n end", "def stats(stat_name)\n case stat_name\n when nil; @stats\n when :current_size; current_size\n else; @stats[stat_name]\n end\n end", "def stats\n [ride_distance, ride_time]\n end", "def summary\n end", "def summary\n end", "def display_stats\n draw \"Total hits: %d\" % @queue.total_hits\n draw \"Hits (past %isc): %d\" % [@queue.threshold, @queue.current_hits]\n draw \"High traffic alerts: %d\" % @queue.high_traffic_alerts\n draw_eol\n\n draw \"Total bytes: %s (Avg: ~%s)\" % [@queue.total_bytes.as_readable_bytes, @queue.avg_bytes.as_readable_bytes]\n draw \"Bytes (past %isc): %s \" % [@queue.threshold, @queue.current_bytes.as_readable_bytes]\n draw \"High traffic ended alerts: %s\" % @queue.end_of_high_traffic_alerts\n draw_eol\n end", "def overall_stats\n { kd: overall_KDR, wl: overall_WLR }\n end", "def http_statistics\n super\n end", "def addNumberStatsForSingleSettingOfVarianceVariable run_object , values\r\n statsGuy = run_object\r\n # note non use of index to lookup value...\r\n ppAndFile \"-----------\", \"Doing stats on runs runs just numbers #{values.inspect}\"\r\n ppAndFile \"download times %'iles'\", VaryParameter.getDuplesFromClientsAndPercentile(\"createClientDownloadTimes\", statsGuy).join(\" \")\r\n ppAndFile \"download total times %'iles'\", VaryParameter.getDuplesFromClientsAndPercentile(\"createClientTotalDownloadTimes\", statsGuy).join(\" \")\r\n ppAndFile \"death methods\", statsGuy.getDeathMethodsAveraged.sort.join(\" \")\r\n\r\n ppAndFile \"server upload [received] distinct seconds [instantaneous server upload per second] %'iles'\",\r\n VaryParameter.getDuplesFromClientsAndPercentile(\"allServerServedPointsPartial\", statsGuy).join(\" \")\r\n\r\n ppAndFile \" instantaneous tenth of second throughput %'iles'\",\r\n VaryParameter.getDuplesFromClientsAndPercentile(\"totalThroughPutPointsPartial\", statsGuy).join(\" \")\r\n\r\n ppAndFile \"upload bytes %'iles'\", VaryParameter.getDuplesFromClientsAndPercentile(\"createClientTotalUpload\", statsGuy).join(\" \")\r\n ppAndFile \"dht gets\", VaryParameter.getDuplesFromClientsAndPercentile(\"multipleDHTGets\", statsGuy).join(\" \")\r\n ppAndFile \"dht puts\", VaryParameter.getDuplesFromClientsAndPercentile(\"multipleDHTPuts\", statsGuy).join(\" \")\r\n ppAndFile \"dht removes\", VaryParameter.getDuplesFromClientsAndPercentile(\"multipleDHTRemoves\", statsGuy).join(\" \")\r\n ppAndFile \"percentiles of percent received from just peers (not origin)\", VaryParameter.getDuplesFromClientsAndPercentile(\r\n \"createPercentFromClients\", statsGuy).join(\" \") # ltodo graphs for percent dT\r\n\r\n ppAndFile \"client upload sum percentiles:\", VaryParameter.getDuplesFromClientsAndPercentile(\"createClientTotalUpload\", statsGuy).join(\" \")\r\n ppAndFile \" :totalBytesReceivedFromPeersAcrossAllRuns #{statsGuy.totalBytesReceivedFromPeersAcrossAllRuns}, :totalBytesUploadedByServerAcrossAllRuns #{statsGuy.totalBytesUploadedByServerAcrossAllRuns} :totalBytesServedFromPeersAcrossAllRuns #{statsGuy.totalBytesServedFromPeersAcrossAllRuns}\"\r\n @totalBytesReceivedFromPeersAcrossAllRuns.plus_equals(statsGuy.totalBytesReceivedFromPeersAcrossAllRuns)\r\n @totalBytesUploadedByServerAcrossAllRuns.plus_equals(statsGuy.totalBytesUploadedByServerAcrossAllRuns)\r\n @totalBytesServedFromPeersAcrossAllRuns.plus_equals(statsGuy.totalBytesServedFromPeersAcrossAllRuns)\r\n #ltodo note how many opendht's never came back\r\n #ltodo say how many did not make it, too...\r\n print \"wrote stats to #{@outputFile.path}\\n\"\r\n end", "def stats_for(stats_type, *args)\n\t\t\tbegin\n\t\t\t\tsend :\"stats_#{stats_type}\", *args \n\t\t\trescue NoMethodError => e\n\t\t\t\traise RuntimeError, \"Unable to calculate #{stats_type} stats\"\n\t\t\tend\n\t\tend", "def stats\n handle_fork\n _stats\n end", "def get_statistics\n raise 'Method unavailable for Synergy'\n end" ]
[ "0.90841573", "0.90841573", "0.88460314", "0.88460314", "0.86697096", "0.8660321", "0.86130625", "0.78728575", "0.78513896", "0.78513896", "0.78513896", "0.78513896", "0.78513896", "0.78513896", "0.78513896", "0.78513896", "0.78513896", "0.78513896", "0.78513896", "0.78513896", "0.7731786", "0.7731567", "0.75632775", "0.7489493", "0.7446967", "0.7443758", "0.73960197", "0.73834103", "0.73758644", "0.7256177", "0.7237644", "0.72079265", "0.7180959", "0.71711737", "0.7157386", "0.71489483", "0.71304345", "0.71156144", "0.7100585", "0.70744747", "0.7073072", "0.7049029", "0.70354706", "0.70354706", "0.7009545", "0.69783527", "0.69783527", "0.69783527", "0.69783527", "0.69647753", "0.69647753", "0.69647753", "0.69647753", "0.69647753", "0.69647753", "0.69647753", "0.69647753", "0.69647753", "0.69647753", "0.69647753", "0.69647753", "0.6960727", "0.6959192", "0.6935919", "0.6933195", "0.6838999", "0.6834964", "0.68235624", "0.68235624", "0.6784013", "0.67428136", "0.6705757", "0.670555", "0.66969436", "0.6693892", "0.66558737", "0.6651077", "0.66275686", "0.66208094", "0.66150486", "0.66083485", "0.66076446", "0.6601063", "0.6598735", "0.65839106", "0.6551073", "0.6549077", "0.6542537", "0.65379554", "0.65270257", "0.6511425", "0.65098536", "0.64943665", "0.64943665", "0.64806825", "0.6478767", "0.6464585", "0.6462585", "0.64558834", "0.6447192", "0.6444459" ]
0.0
-1
either good or combo (or blank)
def initial_selection first_good = question_stats.ascending.good_selected.first first_combo = question_stats.ascending.combo_selected.first if first_good || first_combo [first_good, first_combo].find_all{ |selection| !selection.nil? } .sort_by(&:created_at).first .stat_type end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chosen_baptized_at_home_parish?\n show_empty_radio == 1 || show_empty_radio == 2\n end", "def chosen_baptized_catholic?\n show_empty_radio == 2\n end", "def combo_optimal?\n optimal_value == combo_witheffect\n end", "def combo_validation(combo)\n combo.each do |word|\n next if %w[yin yang].include?(word)\n raise TypeError, 'Combo have to be an Array of yin or yang values'\n end\n end", "def validate\n#\tfirst check whether combo fields have been selected\n is_valid = true\n end", "def validate\n#\tfirst check whether combo fields have been selected\n is_valid = true\n end", "def scrapped_or_sold\n if (scrapped.blank? and sold.blank?)\n # Do nothing\n elsif !(scrapped.blank? ^ sold.blank?)\n errors.add(:base, \"Please indicate whether a computer has been scrapped or sold, not both.\")\n end\n end", "def validate\n # first check whether combo fields have been selected\n is_valid = true\n end", "def choice_a_battle\n use_item_in_battle\n end", "def wrong_and_option(wrong, option) #function to take input of wrong word and number of options.\n $wrong_word = wrong\n $no_option = option\n end", "def option_combinations_valid?\n # TO DO - implement your real logic here\n true \n end", "def battler_in_combination(battler)\n return true if battler.in_combination == 'Union'\n return true if battler.in_combination == 'Fusion'\n return true if battler.in_combination == 'Cooperation'\n return false\n end", "def validate_user_selection(input)\n VALID_CHOICES.each do |option, value|\n # test allows strings longer than valid keystrokes\n # requires start of input string is valid keystroke/strokes\n # strips leading or trailing spaces\n return option.to_s if input.downcase.strip.index(value.to_s) == 0\n end\n false\nend", "def combo_check(board)\n WIN_COMBINATIONS_2.each do |combo|\n if board.taken?(combo[0]) && board.position(combo[0]) == board.position(combo[1]) && !board.taken?(combo[2])\n return combo[2].to_s\n elsif board.taken?(combo[1]) && board.position(combo[1]) == board.position(combo[2]) && !board.taken?(combo[0])\n return combo[0].to_s\n elsif board.taken?(combo[2]) && board.position(combo[0]) == board.position(combo[2]) && !board.taken?(combo[1])\n return combo[1].to_s\n end\n end\n nil\n end", "def boardcase_is_empty?(choice_array)\n board.boardcase[choice_array[0]][choice_array[1]].content == \" \"\n end", "def selected?; false; end", "def selected?; false; end", "def validate \n # first check whether combo fields have been selected\n#\t is_valid = true\n#\t if is_valid\n#\t is_valid = ModelHelper::Validations.validate_combos([{:stock_type_code => self.stock_type_code}],self)\n#\t end\n#\t if is_valid\n#\t is_valid = set_stock_type\n#\t end\n#\n#\t if is_valid\n#\t is_valid = ModelHelper::Validations.validate_combos([{:location_code => self.location_code}],self)\n#\t end\n#\t if is_valid\n#\t is_valid = set_location\n#\t end\n#\n#\t #if is_valid\n#\t # is_valid = ModelHelper::Validations.validate_combos([{:party_name => self.party_name}],self)\n#\t #end\n#\t #if is_valid\n#\t # is_valid = set_party\n#\t #end\n#\n#\t if is_valid\n#\t is_valid = set_parties_role\n#\t end\n#\n#\t #if is_valid\n#\t # is_valid = set_current_location\n#\t #end\n#\n# if is_valid\n# is_valid = set_status\n# end\n\t \n end", "def filled_info(opponent)\n opponent.gamertag != \"\" && opponent.game != \"\" && opponent.bracket != \"\" && opponent.characters != \"\" && opponent.score != \"\"\n end", "def comboBox(combobox, completedString:completedString)\n completedString = completedString.downcase\n @resultsArray.find{|x| x.downcase.include? completedString}\n end", "def validate(choice)\n CHOICE_ABBR[choice]\nend", "def concrete?\n choices.nil?\n end", "def show_baptized_catholic_radio\n chosen_baptized_at_home_parish? && !baptized_at_home_parish\n end", "def check_win_or_lose\n \n if ( @wrong_guesses.length == 7 ) \n :lose\n elsif ( ! self.word_with_guesses.include?(\"-\") )\n :win\n else\n :play\n end\n\n end", "def valid_type? item_type\n [BATTLE_ITEMS, KEY_ITEMS, INGREDIENTS, TREASURES, CAR_PARTS, LEISURE].include?(item_type)\n end", "def pick_bingo_ball\n select_letter && select_number && call_bingo_value\n end", "def validateType\n active = @types_nr[glade.get_widget(\"cmbType\").get_active]\n if active == \"mysql\" || active == \"postgresql\" || active == \"mysqli\" || active == \"mssql\"\n @gui[:texIP].show\n @gui[:texUsername].show\n @gui[:texPassword].show\n @gui[:texPort].show\n @gui[:texDatabase].show\n\n @gui[:labIP].show\n @gui[:labUsername].show\n @gui[:labPassword].show\n @gui[:labPort].show\n @gui[:labDatabase].show\n\n @gui[:fcbLocation].hide\n @gui[:labLocation].hide\n @gui[:btnNewFile].hide\n elsif active == \"sqlite\" || active == \"access\" || active == \"sqlite3\"\n @gui[:texIP].hide\n @gui[:texUsername].hide\n @gui[:texPassword].hide\n @gui[:texPort].hide\n @gui[:texDatabase].hide\n\n @gui[:labIP].hide\n @gui[:labUsername].hide\n @gui[:labPassword].hide\n @gui[:labPort].hide\n @gui[:labDatabase].hide\n\n @gui[:fcbLocation].show\n @gui[:labLocation].show\n @gui[:btnNewFile].show\n end\n end", "def handle_selection(input)\n cases = ['A1','A2','A3','A4','A5','A6',\n 'B1','B2','B3','B4','B5','B6',\n 'C1','C2','C3','C4','C5','C6',\n 'D1','D2','D3','D4','D5','D6',\n 'E1','E2','E3','E4','E5','E6',\n 'F1','F2','F3','F4','F5','F6',\n 'G1','G2','G3','G4','G5','G6']\n\n if !cases.include?(input)\n puts \"Sorry I didn't understand. Which case ? (ex: a2, c3, b1)\"\n return false\n else\n coor = to_coordinate(input)\n x, y = coor[0], coor[1]\n cell = board.get_cell(x, y)\n\n if cell.color != ' '\n puts \"Case already played ! Select another one:\"\n return false\n elsif x != 0 && cell.down && cell.down.color == ' '\n puts \"You can't play there. It's gravity, sorry.\"\n return false\n end\n end\n return true\n end", "def invalid_player?(player_type)\r\n unless player_type =~ /invalid/\r\n if player_type == @p1_type\r\n puts \"\\n\"\r\n tab(12, \"Great!!!\")\r\n tab(5, \"X is a #{@p1_type} player.\", \"-\" * 31)\r\n elsif player_type == @p2_type\r\n puts \"\\n\"\r\n tab(10, \"Excellent!!!\")\r\n tab(5, \"O is a #{@p2_type} player.\", \"-\" * 31)\r\n end\r\n else\r\n puts \"\\n\"\r\n puts \" Invalid selection - try again!\"\r\n player_type == \"invalid_p1\" ? select_x : select_o\r\n end\r\n end", "def correct\n\t\tbet_items = self.bet_items\n\t\tcorrect = \" \"\n\t\tself.bet_items.each do |bet_item|\n\n\t\t\tif bet_item.active?\n\t\t\t\tcorrect = bet_item.name\n\t\t\tend\n\t\tend\n\n\t\treturn correct\n\tend", "def validate_item(input)\n case input\n when \"l\"\n return \"latte\"\n when \"s\"\n return \"scone\"\n when \"t\"\n return \"tea\"\n when \"d\"\n return \"done\"\n else\n return nil\n end\nend", "def get_winner(comp,user)\n if (comp == user) \n puts \"It was a tie!\"\n elsif (comp ==\"rock\" && user == \"scissors\") || (comp ==\"paper\" && user == \"rock\") || (comp ==\"scissors\" && user == \"paper\")\n puts \"The computer wins!\"\n elsif ( comp == \"scissors\" && user ==\"rock\") || (comp == \"rock\" && user ==\"paper\") || (comp == \"paper\" && user ==\"scissors\")\n puts \"You win!\"\n else \n \tputs \"You did not pick either of the choices! Let's try this again.\" \n \tplay_game\n end \nend", "def is_set?\n result = true\n result = false unless [email protected],@card2.color,@card3.color\n result = false unless [email protected],@card2.number,@card3.number\n result = false unless [email protected],@card2.symbol,@card3.symbol\n result = false unless [email protected],@card2.shading,@card3.shading\n @good_set = result\n result\n end", "def validate \n#\tfirst check whether combo fields have been selected\n is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:port_id => self.port_id}],self,nil,true)\n set_port if is_valid\n end\n\n\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:voyage_port_type_id => self.voyage_port_type_id}],self,nil,true)\n \n\n\t\nend", "def available_choices_for(component); @available_choices[component] + [:none]; end", "def check_choice(choice)\n @spaces[choice] == \" \" ? true : false \n end", "def check_prefecture\n if prefecture == \"--未選択--\"\n errors.add(:prefecture, \"選択して下さい\")\n end\n end", "def validate_user_choice\n input = gets.chomp\n if input ==\"exit\"\n exit_screen\n elsif input == \"buy\"\n ticketing_screen\n elsif input.to_i == 1\n concert_screen\n elsif input.to_i == 2\n # if user doesn't want to buy a ticket yet, they can look for other upcoming bands and/or concerts by typing bands.\n bands_screen\n else\n unrecognized_input\n end\n end", "def select_o\r\n print \" Please select the O player: \"\r\n p2 = gets.chomp\r\n case p2\r\n when \"1\" then @p2_type = \"human\"\r\n when \"2\" then @p2_type = \"perfect\"\r\n when \"3\" then @p2_type = \"random\"\r\n when \"4\" then @p2_type = \"sequential\"\r\n else @p2_type = \"invalid_p2\"\r\n end\r\n invalid_player?(@p2_type)\r\n end", "def selected?; end", "def selected?; end", "def winner(board)\n if winning_combo = won?(board)\n # winning_comobo = won?(board) # Erica\n # if winning_combo.present? # Erica\n board[winning_combo.first] \n end\nend", "def or_c\n end", "def winner\n $the_win_comb = { flash_straight: flash_straight, for_of_kind: four_of_kind, full_house: full_house,\n flush: flush, straight: straight, three: three, two_pair: two_pair,\n one_pair: one_pair, high_card: high_card }\n puts \"\\n The highest winner combinations and cards are - \"\n $the_win_comb.each { |comb, ans| return puts comb.upcase, $the_win_comb[comb], ' ' unless ans.nil?}\n end", "def validate \n#\tfirst check whether combo fields have been selected\n if(self.rmt_product_type_code.to_s.upcase == \"PRESORT\")\n self.treatment_type_code = \"PRESORT\"\n elsif self.rmt_product_type_code == \"orchard_run\"\n self.product_class_code = \"OR\"\n self.treatment_type_code = \"PRE_HARVEST\"\n else\n self.treatment_type_code = \"PACKHOUSE\"\n end\n\n #self.size_code = \"UNS\" if !self.size_code\n if !self.size_code\n self.size_code = \"UNS\" \n\t self.size_id = Size.find_by_size_code(self.size_code).id\t\t \n end\n \n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:ripe_point_code => self.ripe_point_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_ripe_point\n\t end\n\t \n\t\n\tif is_valid && self.rmt_product_type_code != \"orchard_run\" && self.rmt_product_type_code.to_s.upcase != \"PRESORT\"\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:size_code => self.size_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid && self.rmt_product_type_code != \"orchard_run\" && self.rmt_product_type_code.to_s.upcase != \"PRESORT\"\n\t\t is_valid = set_size\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:product_class_code => self.product_class_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_product_class\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:commodity_group_code => self.commodity_group_code},{:commodity_code => self.commodity_code},{:variety_code => self.variety_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_variety\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:treatment_code => self.treatment_code}],self) \n\tend\n\t\n\tif is_valid && self.rmt_product_type_code != \"orchard_run\" && self.rmt_product_type_code.to_s.upcase != \"PRESORT\"\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:bin_type => self.bin_type}],self) \n\tend\n\t\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_treatment\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend", "def color_valid\n color == \"blue\" || color == \"green\"\nend", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t #is_valid = ModelHelper::Validations.validate_combos([{:commodity_code => self.commodity_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t #is_valid = set_spray_program_result\n\t end\nend", "def winner\n no_combinations = true\n WIN_COMBINATIONS.each do |combination|\n if combination1 = @board[combination[0]] == \"X\" && @board[combination[1]] == \"X\" && @board[combination[2]] == \"X\"\n no_combinations = false\n return \"X\"\n elsif combination2 = @board[combination[0]] == \"O\" && @board[combination[1]] == \"O\" && @board[combination[2]] == \"O\"\n no_combinations = false\n return \"O\"\n end\n end\n if no_combinations == true\n return nil\n end\n end", "def wrong\n puts \"I'm sorry you need to pick one of the two options.\"\n play\n end", "def won?\n WIN_COMBINATIONS.each do |combo|\n if combo.all? { |i| @board[i].downcase == \"x\"}\n return combo\n elsif combo.all? { |i| @board[i].downcase == \"o\"}\n return combo\n end\n end\n return false\nend", "def good(str = '')\n show(\"Good for #{str}\")\n true\n end", "def wrong\n puts \"That isn't an option.\"\nend", "def set_battle()\n if ((@weapon == \"scissors\") && (@other_weapon == \"paper\")) || ((@weapon == \"rock\") && (@other_weapon == \"scissors\")) || ((@weapon == \"paper\") && (@other_weapon == \"rock\"))\n @battle_result = 1\n \n elsif ((@weapon == \"rock\") && (@other_weapon == \"paper\")) || ((@weapon == \"scissors\") && (@other_weapon == \"rock\")) || ((@weapon == \"paper\") && (@other_weapon == \"scissors\"))\n @battle_result = 2 \n\n else\n @weapon == @other_weapon \n @battle_result = 0\n end\n end", "def valid_tool?(dest, tool)\n dest_type = type(dest)\n case dest_type\n when ROCKY\n [CLIMB, TORCH].include? tool\n when WET\n [CLIMB, NONE].include? tool\n when NARROW\n [TORCH, NONE].include? tool\n end\nend", "def check_for_primary_option_type\n return if @product.variants.size <= 0\n if @product.option_types.primary.size <= 0\n raise \"No primary option type defined for product sku: #{@product.sku} name: #{@product.name}.\n A primary option type is required for the dropdown variants to be displayed correctly.\"\n end\n end", "def choice_a_menu\n item_id = @item_list[@index]\n return action_b if item_id.nil?\n return play_buzzer_se if item_id == 0\n play_decision_se\n show_shadow_frame\n # Prepare the choice info\n # Use option\n map_usable = proc { !GameData::Item[item_id].map_usable }\n # Give option\n giv_check = proc { $pokemon_party.pokemon_alive <= 0 || !GameData::Item[item_id].holdable }\n # Unregister / register\n if $bag.shortcuts.include?(item_id)\n reg_id = 14\n reg_meth = method(:unregister_item)\n else\n reg_id = 2\n reg_meth = method(:register_item)\n reg_check = map_usable\n end\n # Throw option\n thr_check = proc { !GameData::Item[item_id].limited }\n # Create the choice\n choices = PFM::Choice_Helper.new(Yuki::ChoiceWindow::But, true, 999)\n choices.register_choice(text_get(22, 0), on_validate: method(:use_item), disable_detect: map_usable)\n .register_choice(text_get(22, 3), on_validate: method(:give_item), disable_detect: giv_check)\n .register_choice(text_get(22, reg_id), on_validate: reg_meth, disable_detect: reg_check)\n .register_choice(text_get(22, 1), on_validate: method(:throw_item), disable_detect: thr_check)\n .register_choice(text_get(22, 7))\n # Show selection : item_name\n @base_ui.show_win_text(parse_text(22, 35, PFM::Text::ITEM2[0] => GameData::Item[item_id].exact_name))\n # Process the actual choice\n y = 200 - 16 * choices.size\n choices.display_choice(@viewport, 306, y, nil, on_update: method(:update_graphics), align_right: true)\n @base_ui.hide_win_text\n hide_shadow_frame\n end", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:carton_pack_product_code => self.carton_pack_product_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_carton_pack_product\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:pallet_format_product_code => self.pallet_format_product_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_pallet_format_product\n\t end\n\t \n\t if is_valid\n\t self.cpp_code = self.pallet_format_product_code + \"_\" + self.carton_pack_product_code + \"_\" + self.cartons_per_pallet.to_s \n\t end\nend", "def use_item\n\n if @inventory.empty?\n slow_type(\"\\nYou don't have anything in your inventory\")\n\n else\n print_inventory_items\n\n use_item = TTY::Prompt.new\n\n choices = []\n @options = []\n @inventory.each do |item_id|\n inventory_item = find_item_by_id(item_id)\n choices << { name: inventory_item.name, value: inventory_item.item_id }\n end\n\n item_id = use_item.select(slow_type(\"\\nWhat would you like to use?\"), choices)\n \n selected_item = find_item_by_id(item_id)\n \n use_on = TTY::Prompt.new\n\n choices = []\n @options = []\n current_cell_items.each do |item_id|\n item = find_item_by_id(item_id)\n choices << { name: item.name, value: item.item_id } unless @inventory.include?(item.item_id) || item.show_item == false\n end\n\n target_item = use_on.select(slow_type(\"\\nWhat would you like to use the #{selected_item.name} on?\"), choices)\n\n combo = @use_combos.find { |combo| combo[:item_id] == item_id && combo[:usage_location] == @current_room_id && combo[:target_id] == target_item}\n \n if combo.nil?\n slow_type(\"\\nYou cannot use these two items together\") \n \n else \n use_item_dependency(item_id)\n slow_type(combo[:message])\n\n if combo[:cell_to_unlock]\n find_room_by_id(combo[:cell_to_unlock]).isLocked = false\n game_complete if combo[:game_complete]\n\n elsif\n combo[:knocked_out]\n @guard_is_knocked_out = true\n end\n\n end\n end\n end", "def won? # shows winning combination\n WIN_COMBINATIONS.detect do |win_combo|\n if (@board[win_combo[0]]) == \"X\" && (@board[win_combo[1]]) == \"X\" && (@board[win_combo[2]]) == \"X\"\n return win_combo\n elsif (@board[win_combo[0]]) == \"O\" && (@board[win_combo[1]]) == \"O\" && (@board[win_combo[2]]) == \"O\"\n return win_combo\n end\n false\n end\nend", "def check_hard_soft_hand(a, b)\n if a == \"A\" && b == \"A\"\n \"Pair\"\n elsif a == \"A\" || b == \"A\"\n \"Soft\"\n elsif a == b\n \"Pair\"\n else\n \"Hard\"\n end\nend", "def ai_selection\n @acceptable_choices.sample\n end", "def grade_or_blank\n grade || \"None\"\n end", "def nochoice?\n multi? ? (@value.empty?) : (@value == 0)\n end", "def r_p_s\n puts \"Choose 'R'ock, 'P'aper, or 'S'cissors\\n\\n\"\n plyr = gets.strip.upcase.to_s\n puts plyr\n\n\n if (plyr == \"R\" || plyr == \"P\" || plyr == \"S\")\n\n\n puts \"Thanks\\n\"\n else\n puts \"Invalid! Try again.\\n\"\n\n end\nend", "def baptized_at_home_parish_no_checked\n chosen_baptized_at_home_parish? && !baptized_at_home_parish\n end", "def won?(board)\n WIN_COMBINATIONS.each do |combo|\n if (board[combo[0]] == board[combo[1]] && board[combo[0]] == board[combo[2]] && board[combo[0]] != \" \" && board[combo[0]] != \"\" && !board[combo[0]].nil?)\n return combo\n break\n end\n end\n return false\nend", "def won?\n\n WIN_COMBINATIONS.each do |current_combo|\n\n win_x = current_combo.all? { |position| @board[position] == \"X\" }\n win_o = current_combo.all? { |position| @board[position] == \"O\"}\n\n if win_x || win_o\n return current_combo\n\n end\n end\n false\n end", "def outDescription\n begin\n if (self.howout_before_type_cast == 0 || self.howout_before_type_cast == 1 || self.howout_before_type_cast > 7) then\n #description is enough, as these ways of getting out do\n # not relate to any fielders.\n howout\n elsif (self.howout_before_type_cast == 2) then\n #bowled out\n \"b #{self.bowler.name}\"\n elsif (self.howout_before_type_cast == 3) then\n if (self.bowler.name != self.fielder.name) then\n #caught by a different fielder to the bowler\n \"c #{self.fielder.name} b #{self.bowler.name}\"\n else\n #caught and bowled both by the bowler\n \"c & b #{self.bowler.name}\"\n end\n elsif (self.howout_before_type_cast == 4) then\n \"lbw b #{self.bowler.name}\"\n elsif (self.howout_before_type_cast == 5) then\n \"run out (#{self.fielder.name})\"\n else\n \"stumped #{self.fielder}\"\n end\n rescue NoMethodError\n #Something went wrong - perhaps the user entered an invalid\n #combination, such as Caught, but left the bowler field blank\n \"ERROR - PLEASE EDIT THIS INNINGS AND CORRECT IT\"\n end\n end", "def won?\n WIN_COMBINATIONS.detect do |combo|\n if combo.all? {|c| @board.cells[c] == \"X\"}\n @winner = \"X\"\n return combo\n elsif combo.all?{|c| @board.cells[c] == \"O\"}\n @winner = \"O\"\n return combo\n end\n end\n nil\n end", "def reason\n res = \"Selected correctly:\\n\\n\"\n res << make_list(@correct_choices, @points_per_choice.round(1))\n res << \"\\n\"\n res << \"Selected incorrectly:\\n\\n\"\n res << make_list(@incorrect_choices, -@points_per_choice.round(1))\n end", "def win?(first, second)\n first == 'rock' && second == 'scissor' ||\n first == 'paper' && second == 'rock' ||\n first == 'scissor' && second == 'paper'\nend", "def classify_player(chosen)\n if chosen == 'R' || chosen == 'r'\n return 'Rock'\n elsif chosen == 'P' || chosen == 'p'\n return 'Paper'\n elsif chosen == 'S' || chosen == 's'\n return 'Scissors'\n elsif chosen == 'y' || chosen == 'Y'\n output \"Great! Let's go!!!\"\n play_again(chosen)\n elsif chosen == 'n' || chosen == 'N'\n puts \"Goodbye!\"\n exit\n elsif chosen.to_s.empty?\n puts \"*****Please enter a valid option!*****\\n\"\n play_again(chosen)\n else puts \"*****Invalid option!*****\\n\"\n play_again(chosen)\n end\nend", "def opportunity_cost_or_offer_friendly(opportunity)\n if opportunity.cost_or_offer_option == 0\n 'Quiero poner un valor para el proyecto'\n else\n 'Quiero escuchar ofertas de los estudiantes'\n end\n end", "def formation_met? formation\npieces = [@board[formation[0]], @board[formation[1]], @board[formation[2]]]\npieces.uniq.length == 1 && (pieces[0] != PIECE[:blank])\nend", "def dorm \n dorm_selection == 'd' || dorm_selection == 's'\n end", "def clear_appeal_docket_if_not_appeal\n self.appeal_docket = nil if option_selected != \"appeal\"\n end", "def produce_food\n\n # if @type != \"corn\" || @type != \"wheat\"\n # \"Error Type! Please enter corn or wheat\"\n\n if @type == \"corn\"\n @area * Corn\n\n elsif @type == \"wheat\"\n @area * Wheat\n end\n end", "def info_show_profession_of_faith\n chosen_baptized_catholic? && !baptized_catholic\n end", "def won?\n WIN_COMBINATIONS.any? do |combo|\n @board.cells[combo[0]] == @board.cells[combo[1]] && @board.cells[combo[0]] == @board.cells[combo[2]] && @board.cells[combo[0]] != \" \"\n end\n end", "def suitable?(short = true)\n return(short ? confine_collection.valid? : confine_collection.summary)\n end", "def color_valid(color)\r\n color == \"blue\" || color == \"green\"\r\nend", "def negotiate_best_deal?\n nil\n end", "def game_over?\n combinations = grab_combos\n result = check_combos(combinations)\n [result[0], result[1]]\n end", "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 suitable?\n false\n end", "def suitable?\n false\n end", "def check_union(active)\n for battler in active.combination_battlers\n return true if cant_use_union(battler) and not active.multi_action_running\n end\n return false\n end", "def won?\r\n WIN_COMBINATIONS.each do |combination|\r\n occupied = true\r\n if @board[combination[0]] == \" \" || @board[combination[1]] == \" \" ||\r\n @board[combination[2]] == \" \"\r\n occupied = false\r\n end\r\n if occupied\r\n if @board[combination[0]] == @board[combination[1]] && \r\n @board[combination[1]] == @board[combination[2]]\r\n return combination\r\n end\r\n end\r\n end\r\n false\r\n end", "def classify_com(chosen)\n if chosen == 0\n return 'Rock'\n elsif chosen == 1\n return 'Paper'\n elsif chosen == 2\n return 'Scissors'\n end\nend", "def checked?; end", "def winner\n win_combo = won?\n if win_combo\n @board[win_combo[0]] # == 'X' || 'O'\n else\n nil\n end\n end", "def color_valid\n color == \"blue\" || color == \"green\"\n end", "def check_validity(choice)\n valid_options = ['pick up', 'use', 'display inventory', 'move']\n @valid_choices.include?(choice.to_sym) || valid_options.include?(choice)\n end", "def won?(board)\n if board.all? { |place| place == ' ' }\n return false\n end\n for combo in WIN_COMBINATIONS\n if combo.all? { |index| board[index] == 'X' }\n return combo\n elsif combo.all? { |index| board[index] == 'O' }\n return combo\n end\n end\n false\nend", "def baptized_catholic_no_checked\n chosen_baptized_catholic? && !baptized_catholic?\n end", "def check_win_or_lose\n \n if word_with_guesses == @word\n return :win\n elsif @wrong_guesses.length >= 7 \n return :lose\n else \n return :play\n end\n \n end", "def valid_input? (input)\n #if statement verifies valid input to continue\n if input == \"amex\"\n @selected_program = AMEX\n return true\n\n elsif input == \"chase\"\n @selected_program = CHASE\n return true\n\n elsif input == \"citi\"\n @selected_program = CITI\n return true\n end #ends if/else statement\n\n end", "def color_valid2(color)\n color == \"blue\" || color == \"green\"\nend", "def win?(first, second)\n (first == 'rock' && (second == 'scissors' || second == 'lizard')) ||\n (first == 'paper' && (second == 'rock' || second == 'spock')) ||\n (first == 'scissors' && (second == 'paper' || second == 'lizard')) ||\n (first == 'spock' && (second == 'scissors' || second == 'rock')) ||\n (first == 'lizard' && (second == 'spock' || second == 'paper'))\nend", "def hit_or_miss\n\t\t\treturn :win if value = svalue\n\t\t\treturn :miss if value = none_empty\n\t\tend" ]
[ "0.61969805", "0.60381025", "0.59591585", "0.5902734", "0.58157474", "0.58157474", "0.57889754", "0.57162756", "0.5617194", "0.55109763", "0.5507626", "0.547436", "0.54667026", "0.54625577", "0.5448462", "0.5435374", "0.5435374", "0.543265", "0.54262674", "0.53957635", "0.5372449", "0.53586555", "0.5335522", "0.53183246", "0.5314172", "0.5313995", "0.5310431", "0.5301704", "0.52948123", "0.52932936", "0.5288918", "0.52847874", "0.5284712", "0.5282887", "0.5282726", "0.5281537", "0.5269214", "0.52560216", "0.52546304", "0.52543974", "0.52543974", "0.5236915", "0.52277064", "0.52206814", "0.5220631", "0.52155066", "0.5213926", "0.51975095", "0.5195366", "0.51929754", "0.5180087", "0.51796174", "0.51775295", "0.5174875", "0.5161511", "0.5159966", "0.5149799", "0.5142066", "0.5136107", "0.51344573", "0.51307875", "0.5111015", "0.51103616", "0.5108287", "0.5103087", "0.51000893", "0.50972736", "0.50960153", "0.509269", "0.50863606", "0.50824744", "0.5081442", "0.5078247", "0.50707495", "0.5070292", "0.5069961", "0.50674003", "0.50666344", "0.5065546", "0.5065448", "0.5064971", "0.5063363", "0.5060049", "0.5059802", "0.50531757", "0.50531757", "0.5046698", "0.5046381", "0.50453115", "0.50445634", "0.50419194", "0.5039809", "0.50324655", "0.5032012", "0.50301963", "0.50294435", "0.50276065", "0.50265795", "0.5024797", "0.5021071" ]
0.5690404
8
options: precision: :default to not round the overall time
def overall_time(options = {}) options[:precision] ||= 2 if answer && time_started if options[:precision] != :default (answer.created_at - time_started).round(options[:precision]) else (answer.created_at - time_started) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_formatting_time_according_to_precision_coerced\n skip unless @connection # Avoids arunit2 suite run errors.\n @connection.create_table(:foos, force: true) do |t|\n t.time :start, precision: 0\n t.time :finish, precision: 4\n end\n time = ::Time.utc(2000, 1, 1, 12, 30, 0, 999999)\n Foo.create!(start: time, finish: time)\n assert foo = Foo.find_by(start: time)\n assert_equal 1, Foo.where(finish: time).count\n assert_equal time.to_s, foo.start.to_s\n assert_equal time.to_s, foo.finish.to_s\n assert_equal 000000, foo.start.usec\n assert_equal 999000, foo.finish.usec\n end", "def precision; end", "def conversion_precision; end", "def precision\n @values.fetch(:tp) / Float(@values.fetch(:tp) + @values.fetch(:fp))\n end", "def precision_timestamp\n Time.now.strftime(\"%Y%m%d%H%M%S%L\")\n end", "def apply_seconds_precision(value)\n return value unless ar_precision && value.respond_to?(:usec)\n\n number_of_insignificant_digits = 6 - ar_precision\n round_power = 10**number_of_insignificant_digits\n value.change(usec: value.usec / round_power * round_power)\n end", "def apply_seconds_precision(value)\n return value unless ar_precision && value.respond_to?(:usec)\n\n number_of_insignificant_digits = 6 - ar_precision\n round_power = 10**number_of_insignificant_digits\n value.change(usec: value.usec / round_power * round_power)\n end", "def ar_precision\n precision || 6\n end", "def ar_precision\n precision || 6\n end", "def display_in_time_periods(num,options={})\n format = options[:format] || '%.1f'\n precision = options[:precision]\n raise \"precision must be an integer\" if precision && precision.to_i != precision\n\n period = options[:period]\n case period\n when :seconds,:minutes,:hours,:days,:weeks,:months,:years \n t_unit = period.to_s.chomp('s')\n format_period(format % (num / TIME_IN_SECONDS[t_unit.to_sym] ), t_unit,options[:short])\n else\n text = []\n accounted = 0\n first = nil\n # makes the math eaiser ....\n precision -= 1 if precision\n [:year,:month,:week,:day,:hour,:minute,:second].each_with_index { |unit,i| \n p = TIME_IN_SECONDS[unit]\n n = (num - accounted)/ p \n if n > 1\n accounted += (n.floor)*p\n if precision\n first ||= i\n if i - first < precision\n n = n.floor.to_s\n elsif i - first == precision\n n = format % n\n else\n break\n end\n else\n n = n.floor\n end\n text << format_period(n, unit,options[:short])\n end\n }\n text*' '\n end \n end", "def conversion_precision=(_arg0); end", "def rounded_time\n time = hours + quarter_hours\n time += 1 if add_hour?\n time\n end", "def precision\n self['precision']\n end", "def set_precision(precision)\n @precision = precision\n end", "def round() end", "def precision\n min.precision || max.precision\n end", "def round(precision = nil)\n if precision\n magnitude = 10.0 ** precision\n (self * magnitude).round / magnitude\n else\n super()\n end\n end", "def precision=(val)\n self['precision'] = val\n end", "def total_time; end", "def get_precision(*params); raise('Stub or mock required.') end", "def round_prec(digits)\n #This is a stub, used for indexing\n end", "def round(precision = nil)\n\t\tif precision\n\t\t\tmagnitude = 10.0 ** precision\n\t\t\t(self * magnitude).round / magnitude\n\t\telse\n\t\t\tprecisionless_round\n\t\tend\n\tend", "def run_time\n ((Time.now - start_time) * 1000).round\n end", "def prec(*) end", "def microseconds() Float(self * (10 ** -6)) end", "def time_conversion_factor\n @time_conversion_factor ||= dut_version < '0.8.0' ? 1 : 1000\n end", "def precision(f)\n return (f * GeoRecord::SCALE).round.to_f / GeoRecord::SCALE\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 milliseconds() Float(self * (10 ** -3)) end", "def test_time_truncate_usec_on_assigment_default_precision\n time = Time.parse('2018-12-31T23:59:21.341867923')\n record = DateAndTimeTypes.new(my_time: time)\n\n assert_equal 23, record.my_time.hour\n assert_equal 59, record.my_time.min\n assert_equal 21, record.my_time.sec\n assert_equal 341_867, record.my_time.usec\n assert_equal 341_867_000, record.my_time.nsec\n end", "def round(rounding_mode = T.unsafe(nil), rounding_precision = T.unsafe(nil)); end", "def sec_fraction() time[3] end", "def time\n (1 + Time.now.to_i/10).ceil * 10\n end", "def nanoseconds; end", "def update!(**args)\n @precision = args[:precision] if args.key?(:precision)\n @seconds = args[:seconds] if args.key?(:seconds)\n end", "def round\n end", "def with_rounding_mode(mode); end", "def test_time_truncate_usec_on_assigment_precision_3\n time = Time.parse('2018-12-31T23:59:21.341867')\n record = DateAndTimeTypes.new(my_time_one: time)\n\n assert_equal 23, record.my_time_one.hour\n assert_equal 59, record.my_time_one.min\n assert_equal 21, record.my_time_one.sec\n assert_equal 341_000, record.my_time_one.usec\n assert_equal 341_000_000, record.my_time_one.nsec\n end", "def serialize_duration(value, precision)\n yrs = value.parts.fetch(:years, 0)\n mons = value.parts.fetch(:months, 0)\n days = value.parts.fetch(:days, 0)\n hrs = value.parts.fetch(:hours, 0)\n mins = value.parts.fetch(:minutes, 0)\n secs = value.parts.fetch(:seconds, 0).round(precision)\n\n \"#{yrs} years #{mons} mons #{days} days #{hrs} hours #{mins} minutes #{secs} seconds\"\n end", "def time_tolerance_seconds\n 600\n end", "def format(precision) # :nodoc:\r\n (precision == nil || precision == 0) ? \"%s\" : \"%.#{precision}f\"\r\n end", "def round_to(precision=0)\n mulitplier = 10.0 ** (precision)\n (((((self)*mulitplier).round).to_f)/mulitplier)\n end", "def compute_to_good_precision(w, precision, max_precision)\n\twhile true\n\t\tstart_time = Time.now\n\t\tresult = `./cylinder #{w} #{precision}`\n\t\tend_time = Time.now\n\t\treturn result if (end_time - start_time > 2 or precision >= max_precision)\n\t\tprecision = precision + 1\n\tend\nend", "def round_time(time, major = 15)\r\n time + 60 * -( time.min - ( ( time.min.to_f / major ).round * major ) )\r\n end", "def round_hours\n self.hours = self.hours.round_to_half\n self.impact = 'None' if self.hours == 0.0\n end", "def gametime\n \"#{self.gametime_maths/60} minutes\"\n end", "def time_unit\n return \"1sec\"\n end", "def as_point_in_time\n if time\n time\n elsif start_time\n start_time\n else\n end_time\n end\n end", "def prec_f() end", "def precision\n @precision = self.class::MAX_PRECISION unless @precision\n return @precision\n end", "def total_time=(_arg0); end", "def supports_datetime_with_precision?\n false\n end", "def supports_datetime_with_precision?\n false\n end", "def time_class; end", "def usec() end", "def restore_times; end", "def restore_times; end", "def build_timing; end", "def rounded_time_for_cache\n cache_every_num_mins = 5\n time = Time.now\n step = cache_every_num_mins * 60\n Time.at((time.to_r / step).round * step).utc.to_s\n end", "def roundTime(hash={})\n\t\t$_TAGHASH_[\"GSQ\"] = hash['value']\n\tend", "def get_time_required\n 1.0\n end", "def timestamp\n ((Time.now.to_f - StartTime)*1000).round\n end", "def secs\n Thread.current[:datet_mode] = :secs\n return self\n end", "def format(precise: false)\n return '-' if @ms.nil?\n\n return Kernel.format('%02d:%02d:%02d.%03d', hours, minutes, seconds, milliseconds) if precise\n Kernel.format('%02d:%02d:%02d', hours, minutes, seconds)\n end", "def prec_i() end", "def decimal_places; end", "def precision\n @precision ||= cells.map(&:to_f).map { |n| n.round(3) }.map { |n| n.to_s.split(\".\").last.gsub(/0+$/, \"\").length }.max\n end", "def litres(time)\n puts (time * 0.5).floor\nend", "def round_off(seconds = 60)\n Time.at((self.to_f / seconds).round * seconds)\n end", "def round(number, precision)\n ((number * 10**precision).round.to_f) / (10**precision)\n end", "def total_time\n minutes_to_human_readable_time(entries.internal.sum(:duration) + expected_remaining_work * 60)\n end", "def castTime(hash={})\n\t\troundTime(hash)\n\tend", "def test_datetime2_truncate_usec_on_assigment_default_precision\n time = Time.parse('2018-12-31T23:59:21.341867923')\n record = DateTime2Types.new(my_datetime: time)\n\n assert_equal 23, record.my_datetime.hour\n assert_equal 59, record.my_datetime.min\n assert_equal 21, record.my_datetime.sec\n assert_equal 341_867, record.my_datetime.usec\n assert_equal 341_867_000, record.my_datetime.nsec\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 timestamp\n @now = Vedeu.clock_time\n @time ||= 0.0\n @last ||= @now\n\n unless @last == @time\n @time += (@now - @last).round(4)\n @last = @now\n end\n\n \"[#{format('%7.4f', @time.to_s)}] \".rjust(7)\n end", "def round; self.dup.round!; end", "def angl(hrs, mnts)\n 0.5 * (60 * hrs - 11 * mnts)\nend", "def rounding_method; end", "def total_time(distance, mph)\n time = distance / mph \nend", "def test_datetime2_truncate_usec_on_assigment_precision_0\n time = Time.parse('2018-12-31T23:59:21.341867')\n record = DateTime2Types.new(my_datetime_alt: time)\n\n assert_equal 23, record.my_datetime_alt.hour\n assert_equal 59, record.my_datetime_alt.min\n assert_equal 21, record.my_datetime_alt.sec\n assert_equal 0, record.my_datetime_alt.usec\n assert_equal 0, record.my_datetime_alt.nsec\n end", "def test_duration\n assert_equal(@trip.duration, 61.0)\n end", "def pause_for_roundtime\n if $_api_current_rt > 0\n api_sleep $_api_current_rt + $rt_adjust\n end\nend", "def round_float(float, places); end", "def gmtoff() end", "def fract\n @fract ||= (@hour*3600+@min*60+@sec+@usec/1000000.0)/86400.0\n end", "def load_time\n \"#{(Time.now-@start_time).round(4)}s\"\n end", "def play_start_to_j\n play_start.to_f * 1000\n end", "def time; end", "def time; end", "def time; end", "def time; end", "def time; end", "def time; end", "def time; end", "def time; end", "def time; end", "def report_time time\n end", "def timechunk(sec)\n fail \"sec = #{sec}\" if sec < 1\n 1.send(find_unit(sec)).round\n end", "def now\r\n now = Time.now.to_f - @start_time\r\n now * 1000\r\n end", "def round(n, precision)\n factor = 10**precision.to_i\n (n * factor).round.to_f / factor\n end" ]
[ "0.73093843", "0.7188099", "0.6860276", "0.66314644", "0.6630745", "0.6592399", "0.6592399", "0.6496576", "0.6496576", "0.64288455", "0.6381482", "0.6341246", "0.6273279", "0.62551934", "0.62445325", "0.6232454", "0.622318", "0.6183247", "0.6175657", "0.6126549", "0.6117811", "0.6097409", "0.606661", "0.6059173", "0.6056111", "0.6008119", "0.59992415", "0.5998236", "0.59910405", "0.5928394", "0.59280944", "0.5921408", "0.5920215", "0.5914204", "0.59140617", "0.5911653", "0.590969", "0.59029555", "0.58779866", "0.5860272", "0.584365", "0.5828552", "0.580652", "0.5801189", "0.5779543", "0.57662207", "0.57602733", "0.57591707", "0.5756205", "0.5754596", "0.57513964", "0.5714272", "0.5714272", "0.57120645", "0.5706791", "0.5706621", "0.5706621", "0.5698056", "0.5656793", "0.5644944", "0.5643053", "0.5639711", "0.5636037", "0.5622549", "0.56097776", "0.56090224", "0.5602587", "0.5599139", "0.55969286", "0.5596171", "0.5592631", "0.5590177", "0.5569884", "0.5564431", "0.55483854", "0.5547808", "0.5546254", "0.55361146", "0.5521612", "0.5512529", "0.55108786", "0.550804", "0.5507385", "0.5500367", "0.5498843", "0.5493522", "0.54910904", "0.5489419", "0.5489419", "0.5489419", "0.5489419", "0.5489419", "0.5489419", "0.5489419", "0.5489419", "0.5489419", "0.54886544", "0.5482622", "0.54813737", "0.54791725" ]
0.7505495
0
duplicated logic from optimal_value, didn't want to change implementation of optimal_value because didn't write tests :(:(
def optimal_value_from_bundles_shown(bundles = bundles_shown) max = -99999 # really small number # go through single goods goods.keys.each do |k| if max < bundle([k]) max = bundle([k]) end end # go through bundles bundles.each do |b| if max < bundle(b) max = bundle(b) end end # go through combo if combo_seen?(bundles) && max < combo_witheffect max = combo_witheffect end max end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def optimal_answer?\n \tanswer_value == optimal_value\n end", "def optimize\n operand\n end", "def optimize\n operand\n end", "def optimize(weight)\r\n return 0 if weight <= 0\r\n\r\n best = nil\r\n $items.each do |item|\r\n c = optimize(weight - item.weight) + item.cost\r\n best = c if best.nil? || c < best\r\n end\r\n best\r\nend", "def update_best\n if @best_price < @ep.max\n @best_price = @ep.max\n res_i = @ep.index(@best_price)\n @best_weight = @bw[res_i]\n @best_baggage = in_bag(@cg[res_i])\n end\n end", "def solve\n a = Time.new\n for i in 0..@itemsSize - 1\n @table[0][i] = 0\n end\n \n for i in 1..@itemsSize - 1\n price = @problem.prices[i-1]\n weight = @problem.weights[i-1]\n for w in 1..@weights - 1\n if weight <= w\n if (price + @table[w - weight][i - 1]) > @table[w][i -1]\n @table [w][i]= price + @table[w - weight][i - 1]\n else\n @table[w][i] = @table[w][i - 1]\n end\n else\n @table[w][i] = @table[w][i - 1]\n end\n end\n end\n \n \n prev_item = 0\n for i in 1..@itemsSize - 1\n curr_item = @table[@weights - 1][i]\n if prev_item < curr_item\n @best_configuration.push(1)\n else\n @best_configuration.push(0)\n end\n prev_item = curr_item\n end\n \n @best_fitness = @table[@weights - 1][@itemsSize - 1]\n \n b = Time.new\n @time = b-a\n end", "def best_option\n ab_test_options.reject { |opt| opt.value_times_rate.nan? }.max_by(&:value_times_rate)\n end", "def find_optimal(rootCode,goalCode)\n\tfindHops(rootCode, goalCode, \n\t\tlambda{|flight,oldweight| \n\t\t\toldweight + (flight.date.date.to_i + (flight.flightDuration).seconds - @date.date.to_i)/1200 + 100 + flight.seatprice/5 \n\t\t\t# oldweight + (number of hours between arrival and departure + 100 (per hop))*3 + seatprice/5 (~25-250)\n\t\t\t})\nend", "def _reduce_522(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n\n result\nend", "def combo_optimal?\n optimal_value == combo_witheffect\n end", "def _reduce_436(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend", "def calcWeightAndValue(possible_solution)\r\n \r\n @sum_weight=0\r\n @sum_value=0\r\n \r\n (0...@optionSize).each do |idx|\r\n if possible_solution.m_Data[idx] \r\n\r\n @sum_weight += @itemWeight[idx].to_f\r\n @sum_value += @itemValue[idx].to_f\r\n\r\n end \r\n end\r\n \r\n end", "def _reduce_479(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend", "def _reduce_478(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend", "def _reduce_524(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n\n result\nend", "def compute_best\n best = @population.max_by { |x| x.fitness(@target) }\n @finished = true if best.fitness(@target) == @perfect_score\n best.phrase\n end", "def compute_best\n best = @population.max_by { |x| x.fitness(@target) }\n @finished = true if best.fitness(@target) == @perfect_score\n best.phrase\n end", "def best_result(triplet)\n triplet.max\nend", "def calcFitness(sgenome)\r\n \r\n calcWeightAndValue(sgenome)\r\n\r\n if (@sum_weight > @max_weight)\r\n # penalize overweight solutions \r\n @sum_value - (@penalty * (@sum_weight - @max_weight))\r\n else \r\n @sum_value\r\n end\r\n\r\n end", "def find_closest_value(target, item_count, acc_sum, k, multi)\n\tputs \"calling function\"\n\n #puts \"k = \" + k.to_s + \" acc_sum = \" + acc_sum.to_s + \" multi = \" + multi.to_s\n #puts \"k = \" + k.to_s + \" multi = \" + multi.to_s\n #item_count.each { |x| puts x }\n\n\n #checks current accumulated value with current max value to find the best match of given subset\n if acc_sum > $max_val\n $max_val = acc_sum\n #puts \"max value set \" + acc_sum.to_s\n #item_count.each { |x| puts x }\n $max_mul = item_count\n puts \"#{item_count}\"\n return item_count\n end\n\n #item_count contains the list of multipliers. is set here to the multiplier value\n item_count[k] = multi\n #item_count.insert(k, multi)\n puts multi.to_s\n #BASE CASE TO END RECURSION\n if multi == 0\n return 0\n end\n\n #If exact match found to target the max value is set and returns false to destroy whole recursive stack\n if acc_sum + $price[k] * item_count[k] == target\n $max_val = acc_sum + $price[k] * item_count[k]\n #item_count[k] = item_count[k] + 1\n puts \"max value set \" + $max_val.to_s\n $max_mul = item_count\n $max_mul.each { |x| puts x }\n return false\n\n#This step used to go deeper into the recursive stack only if more elements are present in the given set\n#And also checks if current value + old accumulated value doesnt exceed the target sum given\n elsif k + 1 < $n && acc_sum + $price[k] * item_count[k] <= target\n item_count = find_closest_value(target, item_count, acc_sum + $price[k] * item_count[k], k+1, (target-$price[k] * item_count[k])/$price[k+1])\n #used to destroy recursion when perfect match is found\n puts \"Next max value set \" + $max_val.to_s\n if item_count == false\n return false\n end\n end\n\n # if k+1 < $n && acc_sum + $price[k] * (item_count[k-1] - 1) + ((target - acc_sum) / $price[k + 1]) * $price[k + 1] <= target\n # item_count[k] = item_count[k] - 1\n # find_closest_value(target, item_count, acc_sum + $price[k] * item_count[k - 1], k+1, (target - acc_sum)/$price[k+1])\n # end\n\n # elsif\n temp = [0,0,0,0,0,0]\n #puts \"k last = \" + k.to_s\n #item_count.each { |x| puts x }\n #recursive call with multiplier reduced by 1 for the same element in the set\n find_closest_value(target, temp, acc_sum, k, multi - 1)\n # end\nend", "def calculate_subsolutions\n @subsolutions = Array.new(@items.size+1) { Array.new(@max_weight+1) }\n @subsolutions[0].map!{|value| 0}\n ([email protected]).each { |i|\n (0..@max_weight).each { |j|\n # case 1. Item i excluded, no additional weight added to knapsack\n value1 = @subsolutions[i-1][j]\n # case 2. Item i is included, requires adding item's weight to knapsack\n value2 = (@items[i-1].weight<=j) ? (@items[i-1].value + @subsolutions[i-1][j-@items[i-1].weight]) : -1\n # a total value stored in a knapsack, when i items and j max_knapsack_weight\n @subsolutions[i][j] = (value1>value2) ? value1 : value2\n }\n }\n @max_value = @subsolutions[@items.size][@max_weight]\n end", "def _reduce_501(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend", "def _reduce_501(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend", "def _reduce_501(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend", "def _reduce_501(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend", "def optimize3(weight, cost=0, items = $items)\r\n return cost if weight <= 0 || items.empty?\r\n # puts \"#{weight}\\t#{cost}\\t#{items.collect{|i| i.weight}.join(' ')}\"\r\n same_ratio = items.find_all { |i| i.ratio == items[0].ratio }\r\n global_best = nil\r\n same_ratio.size.times do |x|\r\n if weight % items[x].weight == 0\r\n return items[x].cost * (weight / items[x].weight) + cost\r\n end\r\n \r\n best = (x == 0) ? items[x].cost * (weight / items[x].weight + 1) + cost : nil\r\n \r\n (items - [items[x]]).each do |item|\r\n if x == 0\r\n c = optimize3(weight % items[x].weight, items[x].cost * (weight / items[x].weight) + cost, items - [items[x]])\r\n else\r\n c = optimize3(weight - items[x].weight, items[x].cost + cost, items)\r\n end\r\n best = c if (best.nil? || c < best)\r\n end\r\n global_best = best if best && (global_best.nil? || best < global_best)\r\n end\r\n global_best\r\nend", "def fitness\n return @fitness if @fitness\n\n cls = (options[:kappa]).times.map { |i| [] }\n @data.each_with_index { |g, i| cls[g].push i}\n\n p_b2 = cls.map { |c| penalty_before(c) }\n p_a2 = cls.map { |c| penalty_after(c) }\n\n impr2 = p_b2.zip(p_a2).map do |b,a|\n b > 0 ? ((b - a)/b) : 0\n end.inject(0,:+)\n\n @fitness = impr2\n end", "def solution_proximity_heuristic(amount,comb,coins)\n (amount-comb.sum)*min_size_heuristic(amount,comb,coins)\nend", "def knapsack0(weights, values, capacity) #C = 6 #W = [1,2,3] #V = [10, 4, 8]--equal-sized\n @knapsack = {}\n @capacity_cache = {}\n @value_cache = {}\n #First, store & cache weight-value pairs\n weights.each_index do |idx|\n @knapsack[weights[idx]] = values[idx] #{1: 10, 2: 4, 3: 8}\n @capacity_cache[weights[idx]] = [ values[idx] ] #{1: [10], 2: [4], 3: [8]}\n @value_cache[values[idx]] = [ weights[idx] ] #{10: [1], 4: [2], 8: [3]}\n end\n\n weight_keys = weights.sort #[1,2,3] #[23...]\n @min = weight_keys[0]\n #Check if any valid weights\n return 0 if capacity < @min #6 < 1 => false\n return @capacity_cache[@min].first if capacity == @min\n\n #set base case; value keyed to weights array # 10: [1] #92: [23]\n latest_value = @knapsack[@min]\n latest_weights = @value_cache[latest_value].dup\n #Combine valid weights' values w/ cached weight-value sets\n #Cache highest value set to current weight\n (@min + 1..capacity).each do |weight| #2 | 3 | 4 | 5 | 6\n #select possible keys\n valid_keys = weight_keys.select{|key| key <= weight && !latest_weights.include?(key)} #[1,2] | [1,2,3]\n\n (0...valid_keys.length).each do |i| #0 |, 1\n\n current_value_set = @capacity_cache[@min]\n (@min + 1..weight).each do |cap_weight|\n\n new_weight = valid_keys[i] + latest_weights.inject(:+) #2+1= 3|, 3+1+2= 6 |,|2+1+3= 6\n #can either:\n #Add a weight to the set,\n if new_weight <= weight #3 <= 2 => false | #3 <= 3 => true, 6 <= 3 => false ||| 6 <= 6 => true\n #set new value to weights array\n latest_sum = 0\n latest_weights.each {|wt| latest_sum += @knapsack[wt]} #=> 10 |||| 10+8\n latest_value = @knapsack[valid_keys[i]] + latest_sum #| 10+4= 14 ||| +4= 22\n @value_cache[latest_value] = latest_weights << valid_keys[i] #| 14: [1,2] ||| 22: [1,3,2]\n latest_weights = @value_cache[latest_value] #[1] | [1,2] | [1,3,2]\n #Replace a weight from the set,\n else\n smallest = @knapsack[valid_keys[i]] #4 |. 8\n weight_of_smallest = valid_keys[i] #2 |. 3\n latest_weights.each do |wt|\n #10 < 4 => false |. 10 < 8 => false, 4 < 8 but 1+3 <= 3 => false |\n #1+3 <= 4 => true |. 8 < 4 => false\n if @knapsack[wt] < smallest && #one weight's value is less\n latest_weights.inject(:+) - wt + valid_keys[i] <= capacity\n #and replacing it w/ new weight would be valid\n smallest = @knapsack[wt] #||4\n weight_of_smallest = wt #||2\n end\n end\n\n #or Do nothing\n if smallest != @knapsack[valid_keys[i]] #false |. false | true | false\n latest_weights.delete(weight_of_smallest)\n latest_weights.push(valid_keys[i]) #||[1,3]\n latest_value = latest_value - smallest + @knapsack[valid_keys[i]] #||14-4+8= 18\n @value_cache[latest_value] = latest_weights #18: [1,3]\n end\n end\n end\n end\n\n capacity_array = [] #[1] | [1,2] | [1,3] || [1,3,2]\n @value_cache[latest_value].each{ |wt| capacity_array.push(@knapsack[wt]) }\n @capacity_cache[weight] = capacity_array #2: [10] | 3: [10,4] | 4: [10, 8] | 5: [10, 8] | 6: [10, 8, 4]\n end\n p '----'\n p @capacity_cache[capacity]\n sum = @capacity_cache[capacity].inject(:+) #22\n sum\n end", "def test_ce_deBoer_2\n NArray.srand(567) # must use NArray's generator, not Ruby's\n\n # Cost matrix\n n = 5\n c = NArray[[0,1,3,5,6],\n [1,0,3,6,5],\n [3,3,0,2,2],\n [5,6,2,0,2],\n [6,5,2,2,0]]\n\n mp = CrossEntropy::MatrixProblem.new\n mp.pr = NArray.float(2, n).fill!(0.5)\n mp.pr[true,0] = NArray[0.0,1.0] # put vertex 0 in subset 1\n mp.num_samples = 50\n mp.num_elite = 5\n mp.max_iters = 10\n smooth = 0.4\n\n max_cut_score = proc do |sample|\n weight = 0\n for i in 0...n\n for j in 0...n\n weight += c[j,i] if sample[i] < sample[j]\n end\n end\n -weight # to be minimized\n end\n best_cut = NArray[1,1,0,0,0]\n assert_equal(-15, max_cut_score.call(NArray[1,0,0,0,0]))\n assert_equal(-28, max_cut_score.call(best_cut))\n\n mp.to_score_sample(&max_cut_score)\n\n mp.to_update do |pr_iter|\n smooth*pr_iter + (1 - smooth)*mp.pr\n end\n\n mp.for_stop_decision do\n #p mp.pr\n mp.num_iters >= mp.max_iters\n end\n\n mp.solve\n\n if best_cut != mp.most_likely_solution\n warn \"expected #{best_cut}; found #{mp.most_likely_solution}\" \n end\n assert mp.num_iters <= mp.max_iters\n end", "def _reduce_590(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def solve\n @sorted_things.each do |thing|\n break if (config_weight + thing.weight) > @instance.weight_capacity\n @config[thing.index] = 1\n end\n @best_price = config_price\n @best_config = @config.dup\n end", "def compute_for_one_variant(variant)\n weight = variant.weight\n # find weight range\n arr = JSON.parse(preferred_interval)\n # sort by inerval from smalles to biggest\n arr = arr.to_enum.sort_by {|x| x['int']}\n arr.each do |h|\n if weight.to_f < h['int'].to_f\n cost = h['cost'].to_f\n break\n end\n end\n # if not find range - maximum cost\n cost = arr.map {|x| x['cost']}.max.to_f unless cost\n cost\n end", "def maximize; end", "def _reduce_588(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def calculate_optimal_k\n k=0\n @k_optimal = Array.new(@size)\n (3..@size).each{|n|\n k+=1 while(cost(n,k)<cost(n,k+1))\n @k_optimal[n]=k\n }\n end", "def compute(object)\n @seller = self.calculable.seller if self.calculable && self.calculable.respond_to?(:seller)\n weight = object.weight(@seller)\n # find weight range\n arr = JSON.parse(preferred_interval)\n # sort by inerval from smalles to biggest\n arr = arr.to_enum.sort_by {|x| x['int']}\n arr.each do |h|\n if weight.to_f < h['int'].to_f\n cost = h['cost'].to_f\n break\n end\n end\n # if not find range - maximum cost\n cost = arr.map {|x| x['cost']}.max.to_f unless cost\n cost\n end", "def _reduce_585(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def findBestIn(x, n, h, step, loops)\n #set initial\n best = trainAndValidate(x, n, h, step)\n for i in 2..loops\n trained = trainAndValidate(x, n, h, step)\n if trained.ann < best.ann\n best = trained\n end\n end\n best\nend", "def h_value(current, goal)\n [(goal.i - current.i).abs, (goal.j - current.j).abs].max\n end", "def h_value(current, goal)\n [(goal.i - current.i).abs, (goal.j - current.j).abs].max\n end", "def update_p_best\r\n return unless @fitness > p_best_fitness\r\n\r\n @p_best_fitness = @fitness\r\n @p_best_position = @position\r\n end", "def fitness(s,val,wt,cap)\n v = 0\n w = 0\n for i in 0..s.length-1\n mult = s[i..i].to_i\n w += mult * wt[i]\n if w > cap\n return 0\n end\n v += mult * val[i]\n end\n return v\nend", "def _reduce_585(val, _values, result)\n result = [:dot, val[0][1]]\n\n result\nend", "def simulatedAnnealing(is,cS,cC,bSolution,bCost,temp,final_temp,alpha)\n #membuat array untuk menampung setiap solusi\n solusiTemp = {}\n solusiBestSolution = {}\n solusiBestCost= {}\n j=1 #insisialisasi\n while temp > final_temp do\n\n for i in 1..100\n #memunculkan bilangan random untuk perbandingan sekarang dengan yang baru\n x11 = fungsiRandom()\n x22 = fungsiRandom()\n nS = [x11,x22] #state baru\n nC = cost(nS) #perhitungan fungsi dari state baru\n end\n if nC < cC then #membandingkan costBaru dengan costSekarang\n cS = nS\n cC = nC\n if cC < bCost then #jika costBaru lebih kecil dari costSekarang maka bandingkan dengan bestCost\n bSolution = cS\n bCost = cC\n end\n else #jika tidak maka diliat nilai probab\n #ilitasnya lalu bandignkan dengan nilai random(0,1)\n if (prob(nC,cC,temp) > fungsiRandom01()) then\n cS = nS\n cC = nC\n end\n #menampung solusi\n solusiTemp[j] = temp\n solusiBestSolution[j] = bSolution\n solusiBestCost[j] = bCost\n end\n j = j+1\n temp = temp * alpha #Menghitung penentu iterasi temperatur\n end\n xx = solusiTemp[solusiTemp.length]\n y = bSolution\n z = bCost\n #mengembalikan nilai solusi\n return solusiTemp,solusiBestSolution,solusiBestCost,xx,y,z\n\nend", "def compute_best_score(team, pilots, pilot_contests)\n combination = []\n total = 0.0\n total_possible = 0\n puts 'compute_score TBD'\nend", "def minimize; end", "def lcs(arr)\n lcs_helper(arr)[:best_sum]\nend", "def fitness\n return @fitness if @fitness\n\n consumption_per_cluster = {}\n @data.each_with_index do |v, i|\n consumption_per_cluster[v] ||= 0\n # puts @prosumers[i].id, @real_consumption\n consumption_per_cluster[v] += (@real_consumption[@prosumers[i].id] || 0)\n end\n\n total_penalties_before = @initial_imballance.map do |imballance|\n penalty(imballance)\n end\n\n total_penalties_after = 0\n res = 0;\n\n consumption_per_cluster.each do |cluster, consumption |\n # puts \"DEBUG: #{cluster}, #{consumption}\"\n p = penalty((consumption || 0) - (@targets_per_cluster[cluster] || 0))\n res += 100 * (total_penalties_before[cluster] - p) / total_penalties_before[cluster] if total_penalties_before[cluster] > 0\n end\n\n\n\n\n @fitness = res\n\n end", "def check_for_optimal_move(mark_value)\n @board.all_valid_moves.each do |valid_move|\n @board.mark_square(valid_move[0],valid_move[1],mark_value)\n marked_square=[valid_move[0],valid_move[1]]\n if @board.winner?\n return mark_value\n elsif @board.tie?\n return 0\n else\n check_for_optimal_move(mark_value = -mark_value)\n end\n end\nend", "def _reduce_699(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def _reduce_693(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def get_opt_y(c, items, g, d)\n w_min = items.min_by { | x | x[:w] }[:w]\n ix = c-w_min\n\n opt = g[ix]\n opt_y = ix\n ((ix+1)..c).each do | y |\n if g[y] > opt then\n opt = g[y]\n opt_y = y\n end\n end\n\n opt_y\nend", "def _reduce_593(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def optimize\n right\n end", "def optimize\n right\n end", "def solution(n)\n\tval = 0.0\n\tval += 1.0 unless n[0].zero?\n\tval += 2.0 unless n[1].zero?\n\tval += 4.0 unless n[2].zero?\n\tval += 8.0 unless n[3].zero?\n val\n\t\nend", "def condition(i, j)\n # first solved the two equations for just i and j\n 500_000 - 1000*i - 1000*j + i*j == 0\nend", "def _reduce_589(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def value_anneal\n value_anneal_iteration(@iteration)\n end", "def h_value(current, goal)\n if @grid_heuristic[current.position].nil?\n [(goal.i - current.i).abs, (goal.j - current.j).abs].max\n else\n @grid_heuristic[current.position]\n end\n end", "def sor(n, a, b, x0, w, error, n_max)\n n = n - 1\n\n x = Array.new(n + 1)\n for k in (0..n_max)\n sumatoria = (1..n).inject(0) { |sum, j| sum + a[0][j] * x0[j] }\n x[0] = (1 - w) * x0[0] + w * (b[0] - sumatoria).fdiv(a[0][0])\n\n (1..n - 1).each do |i|\n sumatoria_1 = (0..i - 1).inject(0) { |sum, j| sum + a[i][j] * x[j] }\n sumatoria_2 = (i + 1..n).inject(0) { |sum, j| sum + a[i][j] * x0[j] }\n x[i] = (1 - w) * x0[i] + w * (b[i] - sumatoria_1 - sumatoria_2).fdiv(a[i][i])\n end\n\n sumatoria = (0..n - 1).inject(0) { |sum, j| sum + a[n][j] * x[j] }\n x[n] = (1 - w) * x0[n] + w * (b[n] - sumatoria).fdiv(a[n][n])\n\n resta = x.map.with_index { |xi, i| xi - x0[i] }\n modulo = Math::sqrt(resta.inject(0) { |sum, i| sum + i ** 2 })\n if modulo < error\n puts \"Una solucion aproximada es X = #{x}.\"\n return x\n end\n\n x0.replace(x)\n end\n\n puts \"Se alcanzo el numero maximo de iteraciones n_max pero no la tolerancia.\"\nend", "def get_cost_vector\n\t\t\tNMath.sqrt(((@tuneable_data - @goal_vector) ** 2).sum(0))\n\t\tend", "def reduce_solved\n before = 9*9*9\n after = entropy\n while before > after\n before = after\n reduce_line\n reduce_col\n reduce_grid\n after = entropy\n end\n self\n end", "def _reduce_699(val, _values, result)\n result = [:dot, val[0][1]]\n\n result\nend", "def default_v_score ; raise 'not implemented'; end", "def _reduce_595(val, _values, result)\n result = val[1]\n \n result\nend", "def _reduce_718(val, _values, result)\n result = val[1]\n \n result\nend", "def _reduce_597(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def calc_optimize_score(actor, compare_actor)\n score = 0\n total_score = 0\n \n score = compare_actor.maxhp - actor.maxhp\n if @mode.include?(MENU_CONFIG::OPTIMIZE_HP)\n score *= 2\n end\n total_score += score\n \n score = compare_actor.maxmp - actor.maxmp\n if @mode.include?(MENU_CONFIG::OPTIMIZE_MP)\n score *= 2\n end\n total_score += score\n \n score = compare_actor.atk - actor.atk\n if @mode.include?(MENU_CONFIG::OPTIMIZE_ATK)\n score *= 2\n end\n total_score += score\n \n score = compare_actor.def - actor.def\n if @mode.include?(MENU_CONFIG::OPTIMIZE_DEF)\n score *= 2\n end\n total_score += score\n \n score = compare_actor.spi - actor.spi\n if @mode.include?(MENU_CONFIG::OPTIMIZE_SPI)\n score *= 2\n end\n total_score += score\n \n score = compare_actor.agi - actor.agi\n if @mode.include?(MENU_CONFIG::OPTIMIZE_AGI)\n score *= 2\n end\n total_score += score\n \n score = compare_actor.eva - actor.eva\n if @mode.include?(MENU_CONFIG::OPTIMIZE_EVA)\n score *= 2\n end\n total_score += score\n \n score = compare_actor.hit - actor.hit\n if @mode.include?(MENU_CONFIG::OPTIMIZE_HIT)\n score *= 2\n end\n total_score += score\n \n score = compare_actor.cri - actor.cri\n if @mode.include?(MENU_CONFIG::OPTIMIZE_CRI)\n score *= 2\n end\n total_score += score\n \n return total_score\n end", "def solution(value)\n # enter your solution here\n value.round(2)\nend", "def _reduce_724(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def optimize\n right\n end", "def optimize\n right\n end", "def solved(ans)\n\n end", "def ukp5(ukpi, return_used_items = false)\n n = ukpi[:n]\n c = ukpi[:c]\n items = ukpi[:items].clone\n\n max_w = items.max_by { | i | i[:w] }[:w]\n g = Array.new(c+max_w+1, 0)\n d = Array.new(c+max_w+1, n-1)\n sort_items_by_profitability!(items)\n\n last_y_where_nonbest_item_was_used = 0\n items.each_with_index do | it, ix |\n wi = it[:w]\n pi = it[:p]\n if g[wi] < pi then\n g[wi] = pi\n d[wi] = ix\n last_y_where_nonbest_item_was_used = wi if wi > last_y_where_nonbest_item_was_used && ix != 0\n end\n end\n\n opt = 0\n (1..(c-1)).each do | y |\n next if g[y] <= opt\n break if last_y_where_nonbest_item_was_used < y\n\n opt = gy = g[y]\n dy = d[y]\n\n # this block is a copy-past of the loop bellow only for the best item\n bi = items[0]\n pb = bi[:p]\n wb = bi[:w]\n next_y = y + wb\n old_gny = g[next_y]\n new_gny = gy + pb\n if old_gny < new_gny then\n g[next_y] = new_gny\n d[next_y] = 0\n end\n\n (1..dy).each do | ix |\n it = items[ix]\n pi = it[:p]\n wi = it[:w]\n ny = y + wi\n ogny = g[ny]\n ngny = gy + pi\n if ogny < ngny then\n g[ny] = ngny\n d[ny] = ix\n last_y_where_nonbest_item_was_used = ny if ny > last_y_where_nonbest_item_was_used\n end\n end\n end\n\n if last_y_where_nonbest_item_was_used < c-1 then\n y_ = last_y_where_nonbest_item_was_used\n while d[y_] != 0 do\n y_ += 1\n end\n# puts \"Periodicity used - c: #{c}; last_y: #{y_}\"\n\n extra_capacity = c - y_\n c1, a1 = items[0][:p], items[0][:w]\n qt_best_item_used = Rational(extra_capacity, a1).ceil\n space_used_by_best_item = qt_best_item_used*a1\n profit_generated_by_best_item = qt_best_item_used*c1\n\n opt_y = get_opt_y(c-space_used_by_best_item, items, g, d)\n g[c] = g[opt_y] + profit_generated_by_best_item\n end\n\n opt = g[c] if opt < g[c]\n\n if return_used_items then\n g.slice!(c+1, max_w)\n d.slice!(c+1, max_w)\n opt_y = get_opt_y(c, items, g, d)\n get_used_items_for_y(opt_y, items, g, d)\n else\n opt\n end\nend", "def solve(ingredients, part_two: false)\n score = 0\n max = 0\n\n (0..100).each do |i|\n (0..100 - i).each do |j|\n (0..100 - i - j).each do |k|\n l = 100 - i - j - k\n capacity = calculate_total(ingredients, \"capacity\", i, j, k, l)\n durability = calculate_total(ingredients, \"durability\", i, j, k, l)\n flavor = calculate_total(ingredients, \"flavor\", i, j, k, l)\n texture = calculate_total(ingredients, \"texture\", i, j, k, l)\n calories = calculate_total(ingredients, \"calories\", i, j, k, l)\n\n next if part_two && calories != 500\n next if capacity <= 0 || durability <= 0 || flavor <= 0 || texture <= 0\n\n score = capacity * durability * flavor * texture\n max = score if score > max\n end\n end\n end\n max\nend", "def calc_fitness\n self.join.to_i(2)\n end", "def run\n solve\n { price: @best_price, config: @best_config }\n end", "def calculate_score boosts\n @score ||= (if @combinations.empty?\n 0 # Optimization.\n else\n # Note: Was @backend.score(@combinations) - indirection for maximum flexibility.\n @combinations.score + boosts.boost_for(@combinations)\n end)\n end", "def _reduce_595(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_711(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def _reduce_709(val, _values, result)\n result = nil\n \n result\nend", "def min_size_heuristic(amount,comb,coins)\n rem = amount-comb.sum\n return Infinity if rem < 0\n comb.size+rem.to_f/(coins.select{|c|c<=rem&&c<=comb.max}.max) rescue comb.size\nend", "def possible_points\n (self.evals.reduce(0) {|sum, eval| sum += eval.max_score.to_i; sum})\n end", "def _reduce_591(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def local_search(problem, max_iterations, max_unimprove_iterations, max_time, \n max_unimprove_time, mut_rate, report_time_interval = 2)\n best = greedy_solve(problem)[:solution]\n best_find_time = 0\n iter = 1\n unimprove_iter = 1\n unimprove_start_time = Time.now\n last_improve_time = Time.now\n start_time = Time.now\n last_rep_time = Time.now\n while ((!max_iterations || iter <= max_iterations) and \n (!max_unimprove_iterations || unimprove_iter <= max_unimprove_iterations) and\n (!max_time || (Time.now - start_time).to_i <= max_time) and \n (!max_unimprove_time || (Time.now - last_improve_time).to_i <= max_unimprove_time)) do\n nxt = mutate(best, problem.path_funcs.length, mut_rate) \n if objective_function(nxt, problem.path_funcs) > objective_function(best, problem.path_funcs) \n unimprove_start_time = Time.now\n last_improve_time = Time.now\n unimprove_iter = 1\n best = nxt\n best_find_time = Time.now - start_time\n else\n unimprove_iter += 1\n end\n iter += 1\n if (Time.now - last_rep_time).to_i >= report_time_interval\n msg = \"Iteration = #{iter}, Obj = #{objective_function(best, problem.path_funcs)}, \"\n msg += \"Elapsed Time = #{Time.now - start_time}\"\n puts msg\n last_rep_time = Time.now\n end\n end\n {:solution => best, :objective_func => objective_function(best, problem.path_funcs), \n :elapsed_time => Time.now - start_time, :best_find_time => best_find_time}\n end", "def max_product_quadratic(data)\n winner = data[0]*data[1]\n (0..data.length-2).each do |i|\n (i+1..data.length-1).each do |j|\n winner = data[i]*data[j] if data[i]*data[j] > winner\n end\n end\n return winner\nend", "def fitness\n return @fitness if @fitness\n last_token = @data[0]\n cost = 0\n @data[1..-1].each do |token|\n cost += @@costs[last_token][token]\n last_token = token\n end\n @fitness = -1 * cost\n return @fitness\n end", "def native_kendalTauish_cost( pi )\n EpsSrraNative::rank_aggergate_upperW(@n){ |u,v| pi.pref(u,v) == @w[u][v] ? 0 : 1 } \n end", "def _reduce_696(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def run\n solve(0)\n { price: @best_price, config: @best_config }\n end", "def calculate_subsolutions_space_efficient\n @subsolutions_1 = Array.new(@max_weight+1, 0)\n @subsolutions_2 = Array.new(@max_weight+1)\n\n ([email protected]).each { |i|\n puts i\n (0..@max_weight).each { |j|\n # case 1. Item i excluded, no additional weight added to knapsack\n value1 = @subsolutions_1[j]\n # case 2. Item i is included, requires adding item's weight to knapsack\n value2 = (@items[i-1].weight<=j) ? (@items[i-1].value + @subsolutions_1[j-@items[i-1].weight]) : -1\n # a total value stored in a knapsack, when i items and j max_knapsack_weight\n @subsolutions_2[j] = (value1>value2) ? value1 : value2\n }\n # move newly found subsolutions to subsolutions1\n (0..@subsolutions_2.size-1).each {|i| @subsolutions_1[i] = @subsolutions_2[i] }\n }\n @max_value = @subsolutions_2[@max_weight]\n end", "def fittest\n min\n end", "def _reduce_95(val, _values, result)\n result = new_assignable val[0]\n \n result\nend", "def objective_function(vector)\r\n return vector.inject(0.0) {|sum, x| sum + (x ** 2.0)} # Calculates fitness value. sums up vector[0]^2 + vector[1]^2 and that's the fitness\r\nend", "def fcn(flag,pars,derivs)\n chi2 = 0.0;\n @data_pts.each{|pt| \n val = @min_block.call(pt.vars,pars)\n chi2 += ((pt.value - val)/pt.error)**2\n } \n return chi2\n end", "def solution(a)\n return 0 if a.count <= 1\n \n max_profit = 0\n min_price = a.first\n a[1..-1].each { |price|\n max_profit = [max_profit, price - min_price].max\n min_price = [min_price, price].min\n }\n max_profit\nend", "def optimize\n left\n end", "def optimize\n left\n end", "def optimize\n left\n end" ]
[ "0.6443526", "0.6361533", "0.6303989", "0.6282974", "0.623631", "0.6221207", "0.6215177", "0.6184556", "0.6129297", "0.6116088", "0.6112406", "0.61082226", "0.61048883", "0.6087058", "0.6086935", "0.6037444", "0.6037444", "0.60132796", "0.5939835", "0.5935104", "0.5932229", "0.5929205", "0.5929205", "0.5929205", "0.5929205", "0.5901762", "0.58788013", "0.5875934", "0.5874444", "0.58659494", "0.5860603", "0.58482313", "0.5842684", "0.5823967", "0.58101755", "0.5808663", "0.5806554", "0.5798825", "0.5778504", "0.57636094", "0.57636094", "0.5751063", "0.57496005", "0.57469046", "0.5736768", "0.5731767", "0.57281697", "0.57256675", "0.57217366", "0.57082546", "0.5704524", "0.56873053", "0.56872714", "0.5681948", "0.5676217", "0.5676217", "0.567294", "0.56671363", "0.5661495", "0.565197", "0.56489646", "0.56400484", "0.56366086", "0.5633536", "0.5628439", "0.5628346", "0.5624487", "0.5620558", "0.56160873", "0.56043464", "0.5598416", "0.5597513", "0.55972666", "0.55972666", "0.55916", "0.5591354", "0.5577742", "0.557732", "0.557468", "0.5573047", "0.55606174", "0.5558505", "0.5550598", "0.55494744", "0.5548982", "0.5542164", "0.5536224", "0.5535923", "0.5534373", "0.5528953", "0.55245966", "0.55241996", "0.55227405", "0.55177945", "0.5516729", "0.5511261", "0.5506691", "0.55054265", "0.54960465", "0.54960465", "0.54960465" ]
0.0
-1
this method belongs in QuestionStat
def extract_bundles(statements) statements.map { |s| s.delete QuestionStat::STATEMENT_SHOWN_PREFIX }.uniq .map { |bundle_string| bundle_string.split(",").map(&:to_i).sort } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def question\n self.question\n end", "def question\n answer.question\n end", "def similar_questions\n\n end", "def questions\n \n end", "def info() quiz_question.info end", "def skier_quest; end", "def view_completed_question\n nil\n end", "def view_completed_question\n nil\n end", "def quiz\n end", "def question\n Question.find_by_id(self.question_id)\n end", "def question_title\n @title\n end", "def question\n puts \"#{@question}\"\n end", "def set_questionstatu\n @questionstatu = Questionstatu.find(params[:id])\n end", "def prapor_quest; end", "def question_count \n @by_question.count\n end", "def for_new_question\n @for_new_question ||= false\n end", "def questions\r\n return @questions \r\nend", "def formulate_question\n @category = @user.available_questions.sample.keys\n @category_instance = Category.all.select {|cat| cat.name == @category[0]}\n category_hash = @user.available_questions.select {|h| h.keys == @category}\n @country = category_hash[0].values[0].sample\n @country_instance = Country.all.select {|cou| cou.name == @country}\n pose_question\n end", "def ask\n \"@all Question '#{@question}'\"\n end", "def getQuestionObjName\r\n\t\t\treturn \"mfiforce__Question__c\"\r\n\t\tend", "def question_label\n \"#{self.id} - #{self.title}\"\n end", "def view_question_text\n nil\n end", "def view_question_text\n nil\n end", "def applies_to_questions\n self.dataset.questions.with_codes(self.codes)\n end", "def perform(user, questions)\n \n end", "def quest; end", "def mechanic_quest; end", "def faq\n\n end", "def inspect_question(q)\n index_question(q) unless q.tag.empty?\n ref_question(q)\n q.answers.each { |a| ref_answer(q, a) }\n end", "def ask_question\n\n end", "def therapist_quest; end", "def qv\n end", "def highline_question_type; nil; end", "def highline_question_type; nil; end", "def question\n Question.find_by_id(questions_id)\n end", "def faq\n end", "def faq\n end", "def show\n @questoes = Question.where(serial: @registry.serial).order(:numero)\n @etiologias = [\"CMP Primária\",\"CMP Isquêmica\",\"CMP Hipertensiva\",\"CMP Valvar\",\"CMP Hipertrófica\",\"CMP Alcoólica\",\"CMP Congênita\",\"Outras\",\"Chagásica\",\"Periparto\"]\n\n # Caso o cadastro seja enviado antes de realizar o questionário\n # é necessário atualizar o valor do score do Cadastro(@registry)\n if @questoes.size > 0\n score = 0\n @questoes.each do |questao|\n score += questao.resposta.to_i if questao.numero != 22\n end\n @registry.score = score\n @registry.save\n end\n end", "def render\n @question = Question.find(self.question_id)\n end", "def quiz_questions\n @questions = set_quiz.questions\n end", "def exams_statistics\n end", "def show\n @question = Question.find(params[:id])\n #if !(@question.accessible(current_user.id, current_user.institution_id))\n # respond_to do |format|\n # format.html { redirect_to action: \"index\" }\n # #format.json { render json: @question }\n # end\n # return\n #end\n @listed_tags = [\"concept_names\", \"academic_class\", \"chapter\", \"blooms_taxonomy\", \"subject\", \"course\", \"qsubtype\", \"specialCategory\", \"difficulty_level\"]\n @edit_copy = 'copy'\n if (@question.edit_access(current_user.id))\n @edit_copy = 'edit'\n end\n #@can_delete = @question.join(:quiz_question_instances).join(:quiz_targeted_groups)\n values = {}\n where = \"quiz_question_instances.question_id = :question_id\"\n values[:question_id] = params[:id]\n @used = nil #Quiz.select(\"quizzes.id,quizzes.name\").joins(:quiz_question_instances).select(\"quiz_question_instances.grade\").joins(:quiz_targeted_groups).select(\"published_on,published_by\").where(where,values).order('quizzes.timecreated DESC')\n respond_to do |format|\n format.html { render \"show_\"[email protected]}\n format.json { render json: @question }\n end\n end", "def ask_questionaire\n alert_reserved_and_exit if git.reserved_branch?\n announce\n ask_title\n ask_label\n ask_pivotal_ids if config.use_pivotal_tracker\n ask_jira_ids if config.use_jira\n end", "def set_question\n @course = Course.find(params[:course_id])\n @oh_time_slot = OhTimeSlot.find(params[:oh_time_slot_id])\n @oh_queue = OhQueue.find(params[:oh_queue_id])\n @question = Question.find(params[:id])\n end", "def q(t)\n \n end", "def validate_question params\n\n end", "def informational?; end", "def question\n @question ||= Question.find(question_id)\n end", "def take_quiz\n end", "def fence_quest; end", "def score_questions\n question_ids.each do |qid|\n set_is_ifat_qid(qid)\n next if base.ifat_only? && !ifat_qid?\n @current_data = ifat_qid? ? userdata : metadata\n type = (base.question_type(qid) || '').to_sym\n case type\n when :multiple_choice then score_multiple_choice_question(qid)\n else\n raise InvalidQuestionType, \"Question type '#{type}' scoring is not implmented.\"\n end\n end\n end", "def question_type_name(question)\n Questiontype.find(question.questiontype_id).name\n end", "def validate\n (1..25).each do |i|\n if resulthash[\"ans\"+i.to_s].blank?\n self.errors.add_to_base \"Question ##{i} cannot be left blank.\"\n end\n end\n super\n end", "def define_question_code(klass, position)\r\n \"@value==#{position.value}\"\r\n end", "def question(n)\n send \"question_#{n}\"\n end", "def questions\n @_questions ||= fetch_questions\n end", "def questions_count\n self.questions.count\n end", "def ask_question\n @game_id = params[:game_id]\n @current_game = Game.find(@game_id)\n @bonus = params[:bonus]\n unless @current_game.players_turn?(current_user.id)\n back_to_index and return\n end\n\n if @current_game.normal_round?\n subject_title = params[:subject]\n @subject = subject_title\n @questions = Question.questions_by_user_experience(current_user.experience_level, @subject)\n @question = @questions.sample\n elsif @current_game.challenge_round?\n @challenge = Challenge::get_ongoing_challenge_by_game(@current_game.id)\n if @challenge\n @question = Question.find(@challenge.get_question_id_by_counter)\n @subject = @question.subject_title\n elsif @challenge.nil?\n wager = params[:wager]\n prize = params[:prize]\n if wager && prize\n @challenge = Challenge.create_challenge(@current_game.id, current_user.id, @current_game.opponent_id(current_user.id), wager, prize)\n else\n redirect_to game_challenge_path(:game_id => @current_game.id)\n end\n end\n end\n if @question\n respond_to do |format|\n format.html\n format.xml { render :xml => @question }\n end\n end\n end", "def ask_q\n @current_ans = generate_q\n end", "def set_quest_stat\n @quest_stat = QuestStat.find(params[:id])\n end", "def question(player, question) \n output({\n :event => \"question\",\n :id => Events.generate_uuid,\n :timestamp => Events.timestamp,\n :playerid => player.uuid,\n :question => question.to_s,\n :answer => question.answer,\n :result => question.result,\n :duration => question.duration\n })\n end", "def getQuestionSetObjName\r\n\t\t\treturn \"mfiforce__Question_Set__c\"\r\n\t\tend", "def run_quiz\n self.questions_explanation\n self.display_questions\n self.skipped_questions_explanation\n self.skipped_questions\n self.answers_explanation\n self.display_results\n self.show_score\n end", "def show\n if current_user == nil\n redirect_to home_login_url\n else\n @question = Question.where(:id => params[:id])[0]\n @user = User.where(:id => @question.user_id).first\n if @user == nil\n @user = User.where(:id => 15).first\n end\n @categories = @question.categories\n \n @sample = Question.all.pop\n @samples = @sample.kludgy_related_similar()\n @different_samples = sample.kludgy_related_other()\n\n # @followed = current_user.followed_questions.where(:question_id => params[:id]).size != 0\n #@followed_user = current_user.followed_users.where(:followed_user_id => @question.user_id).size != 0\n\n # @num_events = 0\n # @question.challenges.each { |challenge|\n # @num_events += challenge.events.length\n # }\n puts 'do we play by the same rules brah?'\n @q = @question\n if @q.nil?\n @resp_id = nil\n else\n @resp_id = @q.id\n @responses = ResponseTemplate.where(:item_id => @q.producible_id).where(:parent_id => nil)\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end\n end", "def find_answer\nend", "def source_question\n self.dataset.questions.with_code(self.code)\n end", "def general_quests\n quests = UsersQuest.where(:assignee_id => @current_user.id,:is_accepted => true).where.not(:assignor_id => @current_user.id).pluck(:quest_id)\n @quests = Quest.where(:id => quests).order('due_date')\n end", "def set_quizzes_question\n @quizzes_question = @question = (@quiz ? @quiz.questions : Quizzes::Question).find(params[:id])\n @quiz = @question.quiz\n @group = @quiz.group\n end", "def feedback\n end", "def question?\n question_id.nil?\n end", "def unanswered_questions; questions_not_matching_query(answered_questions_query); end", "def ask\n @question = params[:question]\n end", "def questioning\n return text\n end", "def questioning\n return text\n end", "def question_type\n Exercise::Q_CODING\n end", "def show\n @question = Question.find(params[:id])\n @avatar = Avatar.find_by_user_id(@question.user_id)\n @user = User.find(@question.user_id)\n @answers = Question.findanswers(@question.id.to_s)\n @correctanswers = Question.findcorrectanswers(@question.id.to_s)\n @totalanswers = @answers.size + @correctanswers.size\n\t if current_user == @user\n @asker = true\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @question }\n end\n end", "def show\n # @answers = Answer.wheres(user_id: current_user.id)\n # time = Time.now\n @answers = current_user.answers\n # Question.where(operation_id: nil)\n # raise 'hi'\n # @oquestions = current_user.operation.questions\n end", "def save_questions(questionnaire_id)\n delete_questions questionnaire_id\n save_new_questions questionnaire_id\n \n if params[:question]\n for question_key in params[:question].keys\n begin\n if params[:question][question_key][:txt].strip.empty?\n # question text is empty, delete the question\n Question.delete(question_key)\n else\n if (@questionnaire.type == \"QuizQuestionnaire\")\n Question.update(question_key,:weight => 1, :txt => params[:question][question_key][:txt] )\n else\n Question.update(question_key, params[:question][question_key])\n end\n Question.update(question_key, params[:question][question_key])\n end\n rescue ActiveRecord::RecordNotFound \n end\n end\n end\n end", "def question\n @question = params[:question]\n @answer = %w[yes no].sample\n end", "def ragman_quest; end", "def ask\n @poll_centre = PollCentre.find(@question.poll_centre_id)\n if @poll_centre.has_current_question?\n #then error\n output_error = {\"error\" => \"There is a question currently in progress. Please wait for it to finish\"}\n respond_to do |format|\n format.json { render json: output_error.to_json, status: :bad_request }\n end\n elsif @question.is_asked?\n output_error = {\"error\" => \"Question already asked\"}\n respond_to do |format|\n format.json { render json: output_error.to_json, status: :bad_request }\n end\n else\n @question.started = true\n if @question.save\n channel_name = @poll_centre.title\n Pusher[\"#{channel_name}\"].trigger('question-start', {\n question_text: @question.text,\n option_a: @question.option_a,\n option_b: @question.option_b,\n option_c: @question.option_c,\n option_d: @question.option_d,\n question_id: @question.id\n })\n respond_to do |format|\n format.json { render json: @question, status: :ok }\n end\n else\n output_error = {\"error\" => \"Couldn't ask question. Please try again.\"}\n respond_to do |format|\n format.json { render json: output_error.to_json, status: :bad_request }\n end\n end\n end\n end", "def create_question\n question_hash = Adapter.quiz_api(difficulty) #use adapter method, with difficulty passes into the url as a variable, to gnerate a new list of questions.\n new_question = Question.new #make a new question instance\n new_question.save #save now so we can store the question's id in the answer by calling self.id\n new_question.content = question_hash['question'] #adding all necessary column data to this question object/row\n new_question.create_answers(question_hash)\n new_question.quiz_id = self.id\n new_question.save #send the newly created question to the database\n end", "def set_question \n @question = Question.find(params[:id])\n end", "def result_of_setting; end", "def hint(hint)\n @action = Action.find_by_class_assignment_id_and_user_id(\n @session[:assignment_id], @current_user.id)\n @action_problem = action.action_problems.find_by_problem_id_and_end_time(hint.problem.id, nil)\n @action_hint = @action_problem.action_hints.create(\n :hint_id => hint.id, \n :time => Time.now)\n\n #action_problem.hint_percentage = action_problem.action_hints.size / action_problem.problem.hints.size.to_f\n #action_problem.save!\n\n # Question level table\n log = QuestionLevelLog.find_by_class_assignment_id_and_user_id_and_problem_id(\n @session[:assignment_id], @current_user.id, hint.problem.id)\n unless log.nil?\n log.hint_count += 1\n log.bottom_hint = log.hint_count == @action_problem.problem.hints.size ? 1 : 0\n # If first response\n if log.first_action.nil?\n log.first_action = 1\n log.correct = 0\n log.first_response_time = @action_hint.time\n end\n log.save\n end\n end", "def suivre; end", "def after_create\n Stat.increment_counter(:reply_count, self.user.stat.id)\n \n if self.yes?\n Question.increment_counter(:yes_count, question.id)\n else\n Question.increment_counter(:no_count, question.id)\n end\n end", "def question(q, a)\n qu = Question.new(q,a)\n questions << qu\n @counter = 0 #Se inicializa el contador\n end", "def define_question_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}?; query_attribute('#{attr_name}'); end\", \"#{attr_name}?\"\n end", "def answer(data)\n @action = Action.find_by_class_assignment_id_and_user_id(\n @session[:assignment_id], @current_user.id)\n @action_problem = action.action_problems.find_by_problem_id_and_end_time(data[:problem].id, nil)\n @assignment_answer = AssignmentAnswer.create(\n :action_problem_id => @action_problem.id,\n :problem_id => data[:problem].id, \n :answer => data[:correct] || data[:incorrect], \n :correct => data.has_key?(:correct), \n :user_id => @current_user.id, \n :class_assignment_id => @session[:assignment_id], \n :time => Time.now)\n\n #action_problem.incorrect_answers += 1 if data.has_key?(:incorrect)\n #action_problem.first_assignment_answer_id = @assignment_answer.id if action_problem.first_assignment_answer_id.nil?\n #action_problem.save!\n\n if @assignment_answer.first_response? and @assignment_answer.problem.scaffold_id.nil?\n student_id = Student.find_by_user_id(@session[:user]).id\n sa = StudentAssignment.find_or_create_by_student_id_and_class_assignment_id(student_id, @session[:assignment_id])\n sa.increment(:correct_first_answers) if data[:correct] and -1 == @session[:hint_count]\n sa.increment(:all_first_answers)\n sa.save\n end\n # Question level table\n log = QuestionLevelLog.find_by_class_assignment_id_and_user_id_and_problem_id(\n @session[:assignment_id], @current_user.id, data[:problem].id)\n unless log.nil?\n # IF FIRST RESPONSE\n if log.first_action.nil?\n log.first_response_time = @assignment_answer.time\n # if request scaffold\n if @assignment_answer.answer.nil?\n log.first_action = 2\n log.correct = 0\n # if an answer\n else\n log.first_action = 0\n log.attempt_count += 1\n log.correct = @assignment_answer.correct? ? 1:0\n log.answer = @assignment_answer.answer\n if @assignment_answer.answer.class.to_s == \"HashWithIndifferentAccess\"\n log.answer_id = @assignment_answer.answer[:id] unless @assignment_answer.answer[:id].nil?\n log.input_text = @assignment_answer.answer[:body] unless @assignment_answer.answer[:body].nil?\n else\n log.input_text = @assignment_answer.answer\n end\n end\n # NOT THE FIRST RESPONSE\n else\n # if an answer\n unless @assignment_answer.answer.nil?\n log.attempt_count += 1\n end\n end\n log.save\n end\n end", "def context\n unless @instance_context\n @instance_context = InsightsQuestionnairesContext.new(@version , @params['questionnaire_sid'])\n end\n @instance_context\n end", "def update\n if @submission.Scores == \"Not submitted\"\n\t\t\t# end time\n\t\t\tdate=DateTime.now\n\t\t\t@assessment = Assessment.find(@submission.assessment_id)\n\t\t\t# if within time limit\n\t\t\tif date.to_time < @submission.SubmittedAt.to_time + @assessment.Duration.minutes + 5.seconds\n\t\t\t\tparms = {\"Duration\"=>(([email protected]_time)).to_i}\n\t\t\t\tscores = []\n\t\t\t\tanswers = []\n\t\t\t\t@questions = Question.where(assessment_id: @submission.assessment_id).order(:id)\n\t\t\t\t@assessment = Assessment.find(@submission.assessment_id)\n\t\t\t\t# if assessment exists\n\t\t\t\tif @assessment\n\t\t\t\t\tuser = User.find(@assessment.user_id)\n\t\t\t\t\t@creator = user.Fname + \" \" + user.Lname\n\t\t\t\tend\n\t\t\t\t# for every question of the assessment\n\t\t\t\tfor question in @questions\n\t\t\t\t\tcase question.Type\n\t\t\t\t\t# if multiple choice\n\t\t\t\t\twhen \"MCQ\"\n\t\t\t\t\t\tanswer = params[(\"MCQRadios-\"[email protected](question).to_s).to_sym]\n\t\t\t\t\t\tqScore=0\n\t\t\t\t\t\t# if there was an answer\n\t\t\t\t\t\tif answer != nil\n\t\t\t\t\t\t\t# get the percentage value of that answer\n\t\t\t\t\t\t\tvalue = question.Answer[question.Answer.index(answer)+answer.length+1..question.Answer.index(answer)+question.Answer[question.Answer.index(answer)..].index(\"%\")-1].to_i\n\t\t\t\t\t\t\t# set the quesiton score\n\t\t\t\t\t\t\tqScore=question.Points*value/100\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# if negatime marking was active apply it\n\t\t\t\t\t\tif qScore == 0 && question.Options.include?(\"NEG1\") && answer != nil\n\t\t\t\t\t\t\tqScore -= question.Options[5..].to_i\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# add score and answer to their respective array\n\t\t\t\t\t\tscores << qScore\n\t\t\t\t\t\tanswers << answer\n\t\t\t\t\t# if multiple answer\n\t\t\t\t\twhen \"MA\"\n\t\t\t\t\t\tanswer = params[(\"MACheckboxes-\"[email protected](question).to_s).to_sym]\n\t\t\t\t\t\tqScore=0\n\t\t\t\t\t\twrong = false\n\t\t\t\t\t\t# if there was an answer\n\t\t\t\t\t\tif answer != nil\n\t\t\t\t\t\t\t# for each selected answer\n\t\t\t\t\t\t\tfor check in answer\n\t\t\t\t\t\t\t\t# check if wrong answer was chosen\n\t\t\t\t\t\t\t\tif wrong == false\n\t\t\t\t\t\t\t\t\tvalue = question.Answer[question.Answer.index(check)+check.length+1..question.Answer.index(check)+question.Answer[question.Answer.index(check)..].index(\"%\")-1].to_i\n\t\t\t\t\t\t\t\t\t# if answer was wrong\n\t\t\t\t\t\t\t\t\tif value == 0\n\t\t\t\t\t\t\t\t\t\twrong = true\n\t\t\t\t\t\t\t\t\t\tqScore = 0\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t# update question score\n\t\t\t\t\t\t\t\t\tqScore+=question.Points*value/100\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t# fix the score for questions with no partial marking\n\t\t\t\t\t\t\tif question.Answer.scan(/(?=100)/).count != 0\n\t\t\t\t\t\t\t\tqScore /= question.Answer.scan(/(?=100)/).count\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# if partial marking was not active and the answer is not complete\n\t\t\t\t\t\tif question.Options.include?(\"PAR0\") && qScore != question.Points\n\t\t\t\t\t\t\tqScore = 0\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# if negatime marking was active apply it\n\t\t\t\t\t\tif qScore == 0 && question.Options.include?(\"NEG1\") && answer != nil\n\t\t\t\t\t\t\tqScore -= question.Options[5..question.Options.index(\"P\")-1].to_i\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# add score and answer to their respective array\n\t\t\t\t\t\tanswers << answer\n\t\t\t\t\t\tscores << qScore\n\t\t\t\t\t# if fill the blank\n\t\t\t\t\twhen \"FTB\"\n\t\t\t\t\t\tanswer = params[(\"FTBAnswer-\"[email protected](question).to_s).to_sym]\n\t\t\t\t\t\tanswerCopy = answer\n\t\t\t\t\t\ttargetAnswer = question.Answer[question.Answer.index(\"〔\")+1..question.Answer.index(\"〕\")-1]\n\t\t\t\t\t\tqScore=0\n\t\t\t\t\t\t# if there was an answer\n\t\t\t\t\t\tif answer != nil\n\t\t\t\t\t\t\t#if the answer is not case sensitive act accordingly\n\t\t\t\t\t\t\tif question.Options.include?(\"CAS0\")\n\t\t\t\t\t\t\t\ttargetAnswer = targetAnswer.upcase\n\t\t\t\t\t\t\t\tanswerCopy = answerCopy.upcase\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t#if multiple spaces are allowed act accordingly\n\t\t\t\t\t\t\tif question.Options.include?(\"MUL1\")\n\t\t\t\t\t\t\t\tanswerCopy = answer.squeeze().strip\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t#if answers that contain the correct answer are allowed act accordingly\n\t\t\t\t\t\t\tif question.Options.include?(\"CON1\")\n\t\t\t\t\t\t\t\tif answerCopy.include?(targetAnswer)\n\t\t\t\t\t\t\t\t\tqScore = question.Points\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tif answerCopy == targetAnswer\n\t\t\t\t\t\t\t\t\tqScore = question.Points\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# if negatime marking was active apply it\n\t\t\t\t\t\tif qScore == 0 && question.Options.include?(\"NEG1\") && answerCopy != nil\n\t\t\t\t\t\t\tqScore -= question.Options[5..].to_i\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# add score and answer to their respective array\n\t\t\t\t\t\tscores << qScore\n\t\t\t\t\t\tanswers << answer\n\t\t\t\t\t# if true false\n\t\t\t\t\twhen \"TF\"\n\t\t\t\t\t\tanswer = params[(\"TFRadio-\"[email protected](question).to_s).to_sym]\n\t\t\t\t\t\tqScore=0\n\t\t\t\t\t\t# if there was an answer\n\t\t\t\t\t\tif answer != nil\n\t\t\t\t\t\t\t# if the answer was correct\n\t\t\t\t\t\t\tif question.Answer.include?(answer)\n\t\t\t\t\t\t\t\tqScore = question.Points\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# if negatime marking was active apply it\n\t\t\t\t\t\tif qScore == 0 && question.Options.include?(\"NEG1\") && answer != nil\n\t\t\t\t\t\t\tqScore -= question.Options[5..].to_i\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# add score and answer to their respective array\n\t\t\t\t\t\tscores << qScore\n\t\t\t\t\t\tanswers << answer\n\t\t\t\t\t# if regular expression\n\t\t\t\t\twhen \"REG\"\n\t\t\t\t\t\tanswer = params[(\"REGAnswer-\"[email protected](question).to_s).to_sym]\n\t\t\t\t\t\tregex = Regexp.new question.Answer[question.Answer.index(\"〔\")+1..question.Answer.index(\"〕\")-1]\n\t\t\t\t\t\tqScore=0\n\t\t\t\t\t\t# if there was an answer\n\t\t\t\t\t\tif answer != nil\n\t\t\t\t\t\t\t# if the answer was correct\n\t\t\t\t\t\t\tif !(answer =~ regex).nil?\n\t\t\t\t\t\t\t\tqScore = question.Points\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# if negatime marking was active apply it\n\t\t\t\t\t\tif qScore == 0 && question.Options.include?(\"NEG1\") && answer != nil\n\t\t\t\t\t\t\tqScore -= question.Options[5..].to_i\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# add score and answer to their respective array\n\t\t\t\t\t\tscores << qScore\n\t\t\t\t\t\tanswers << answer\n\t\t\t\t\t# if formula\n\t\t\t\t\twhen \"FRM\"\n\t\t\t\t\t\tvalues = eval(params[(\"FRMvalues-\"[email protected](question).to_s).to_sym])\n\t\t\t\t\t\tformula = question.Answer[question.Answer.index(\"〔\")+1..question.Answer.index(\"〕\")-1]\n\t\t\t\t\t\t# calculate the correct answer with the student variable values\n\t\t\t\t\t\tfor val in values\n\t\t\t\t\t\t\tkey, value = val\n\t\t\t\t\t\t\tformula = formula.gsub(\"[\" + key.upcase + \"]\",value.to_s)\n\t\t\t\t\t\t\tformula = formula.gsub(\"[\" + key.downcase + \"]\",value.to_s)\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# round it\n\t\t\t\t\t\ttargetAnswer = eval(formula+\".to_f\").round(2)\n\t\t\t\t\t\tanswer = params[(\"FRMAnswer-\"[email protected](question).to_s).to_sym]\n\t\t\t\t\t\tqScore=0\n\t\t\t\t\t\t# if there was an answer\n\t\t\t\t\t\tif answer != nil\n\t\t\t\t\t\t\t# if answer error was allowed act accordingly\n\t\t\t\t\t\t\tif question.Options.include?(\"RAN1\")\n\t\t\t\t\t\t\t\trange = question.Options[question.Options.index(\"RAN1\")+5..].to_f\n\t\t\t\t\t\t\t\t# if within range\n\t\t\t\t\t\t\t\tif answer.to_f >= targetAnswer-range && answer.to_f <= targetAnswer+range\n\t\t\t\t\t\t\t\t\tqScore = question.Points\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t# if answer mathces\n\t\t\t\t\t\t\t\tif answer.to_f == targetAnswer\n\t\t\t\t\t\t\t\t\tqScore = question.Points\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# if negatime marking was active apply it\n\t\t\t\t\t\tif qScore == 0 && question.Options.include?(\"NEG1\") && answer != nil\n\t\t\t\t\t\t\tqScore -= question.Options[5..].to_i\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# add score and answer to their respective array\n\t\t\t\t\t\tscores << qScore\n\t\t\t\t\t\tanswers << answer\n\t\t\t\t\tend\n\t\t\t\t\t# set the scores and answers parameters\n\t\t\t\t\tparms[\"Scores\"] = scores\n\t\t\t\t\tparms[\"Answers\"] = answers\n\t\t\t\tend\n\t\t\t\trespond_to do |format|\n\t\t\t\t\tif @submission.update(parms)\n\t\t\t\t\t\[email protected]_submission_results(@assessment, @questions, @creator)\n\t\t\t\t\t\tformat.html { redirect_to \"/submissions/received\" }\n\t\t\t\t\t\tformat.json { redirect_to \"/submissions/received\" }\n\t\t\t\t\telse\n\t\t\t\t\t\tformat.html { render :edit, status: :unprocessable_entity }\n\t\t\t\t\t\tformat.json { render json: @submission.errors, status: :unprocessable_entity }\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tredirect_to root_url\n\t\t\tend\n\t\telse\n\t\t\tredirect_to \"/submissions/duplicate\", :error => 'Failed to record the submission.'\n\t\tend\n end", "def after_create\n self.user.stat.increment!(:question_count)\n end", "def who_we_are\r\n end", "def view_completed_question(count, answer,questionnaire_max)\n\t\thtml = '<big><b>Question '+count.to_s+\":</b> <I>\"+self.txt+\"</I></big><BR/><BR/>\"\n if !answer.answer.nil?\n\t\t html += '<TABLE CELLPADDING=\"5\"><TR><TD valign=\"top\"><B>Score:</B></TD><TD><FONT style=\"BACKGROUND-COLOR:gold\">'+answer.answer.to_s+'</FONT> out of <B>'+questionnaire_max.to_s+'</B></TD></TR>'\n else\n html += '<TABLE CELLPADDING=\"5\"><TR><TD valign=\"top\"><B>Score:</B></TD><TD><FONT style=\"BACKGROUND-COLOR:gold\">--</FONT> out of <B>'+questionnaire_max.to_s+'</B></TD></TR>'\n end\n\t\tif answer.comments != nil\n\t\t\thtml += '<TR><TD valign=\"top\"><B>Response:</B></TD><TD>' + answer.comments.gsub(\"<\", \"&lt;\").gsub(\">\", \"&gt;\").gsub(/\\n/, '<BR/>')\n\t\tend\n\t\thtml += '</TD></TR></TABLE><BR/>'\n\t\thtml.html_safe\n end", "def text\n raise \"text must be defined in any class that extends QuestionBase\"\n end", "def NPC_feedback\n\nend", "def current_question \n if current_user\n @n = 1\n while current_user.answers.where(id: @n).present?\n @n += 1\n end\n if current_user.answers.last # if a user has any answers \n @last_answered = current_user.answers.last\n @last_question = Discovery::Question.find(@last_answered.question)\n end\n end\n end", "def create_question(question_text,question_bank_id,tenant_id,question_type,explanation,direction_id,passage_id)\n question = Question.new\n question.question_text = question_text\n question.question_bank_id = question_bank_id\n question.tenant_id = tenant_id\n question.explanation = explanation\n question.question_type = question_type\n question.save\n question_attribute = create_question_attribute(question.id,\"\",question_bank_id,\"\",\"\",\"\",direction_id,passage_id,\"\",\"\",tenant_id)\n question_attribute.update_attribute(\"difficulty_id\",get_difficulty(\"not defined\"))\n unless question_type.nil? or question_type.blank?\n question_type = QuestionType.find_by_value(question_type)\n question_attribute.update_attribute(\"question_type_id\",question_type.id)\n end\n return question\n end", "def ask_question(num = @trivia[:cur_quest])\n self.say \"\\0036 #{@questions[num][:question]}\"\n STDOUT.puts \"\\n :#{@questions[@trivia[:cur_quest]][:answer]}: \\n\"\n end", "def calculated; end" ]
[ "0.6662839", "0.63939214", "0.6391877", "0.63903666", "0.63773966", "0.61284184", "0.60931486", "0.60931486", "0.60635823", "0.60184765", "0.59457606", "0.5907556", "0.58966506", "0.588058", "0.5865642", "0.58524114", "0.5822362", "0.58152485", "0.5787463", "0.5782533", "0.5760548", "0.57442766", "0.5743165", "0.57362205", "0.5720483", "0.5670292", "0.5638446", "0.56342274", "0.56212187", "0.5617851", "0.5610145", "0.5583387", "0.55815053", "0.55815053", "0.55733293", "0.5566215", "0.5566215", "0.5564972", "0.5551423", "0.55419004", "0.55332685", "0.5517226", "0.55111134", "0.55038905", "0.54978746", "0.54930484", "0.5486455", "0.54855627", "0.54823667", "0.5478541", "0.5462918", "0.54327786", "0.5423036", "0.54217035", "0.5417693", "0.54129004", "0.54108334", "0.540874", "0.5407229", "0.53917277", "0.5391678", "0.53780395", "0.53690684", "0.5368146", "0.5362189", "0.5359953", "0.5359744", "0.5359119", "0.5358346", "0.5351326", "0.5350141", "0.5340287", "0.5339105", "0.5339105", "0.5337828", "0.53326833", "0.5332023", "0.53232354", "0.5322213", "0.532102", "0.531548", "0.53104526", "0.53100926", "0.5308602", "0.53024703", "0.52980715", "0.5297095", "0.5292897", "0.52791107", "0.5278631", "0.5272617", "0.52690136", "0.5267527", "0.52657175", "0.52636653", "0.52619094", "0.52604955", "0.5255833", "0.52550054", "0.5246036", "0.5243537" ]
0.0
-1
Sets adapter const will append _adapter if needed
def adapter=(adapter_name) adapter_name = adapter_name.to_s adapter_name << '_adapter' unless adapter_name =~ /_adapter$/ adapter_const = adapter_name.pascalize @adapter = AutomationObject::Driver.const_get(adapter_const.to_s)::Driver end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adapter=(adapter)\n Adapter.use = adapter\n end", "def default_adapter=(adapter); end", "def default_adapter=(adapter); end", "def default_adapter=(adapter); end", "def set_adapter(adapter)\n @instance = adapter\n end", "def set_adapter\n @adapter = Adapter.find(params[:id])\n end", "def adapter=(v)\n cfg_set(:adapter, v)\n end", "def init_adapter\n self.adapter = adapter_string.constantize.new\n end", "def adapter=(v)\n cfg_set(:adapter, v)\n end", "def adapter adpt = default_adapter\n if adpt == default_adapter\n @adapter ||= adpt\n else\n @adapter = adpt\n end\n end", "def adapter\n return @adapter if @adapter\n self.use self.default_adapter\n @adapter\n end", "def adapter\n return @adapter if @adapter\n self.use self.default_adapter\n @adapter\n end", "def use(new_adapter)\n @adapter = load_adapter(new_adapter)\n end", "def use(new_adapter)\n @adapter = load_adapter(new_adapter)\n end", "def adapter\n @adapter ||= load_adapter\n end", "def adapter\n @adapter ||= adapter_class.new configuration\n end", "def register_adapter(type, adapter); end", "def force_adapter(adapter_class)\n @adapter_options[:force_adapter] = adapter_class\n self\n end", "def initialize(adapter); end", "def adapter\n @adapter\n end", "def init_adapter_from(context)\n self.adapter = adapter_class.new(context)\n end", "def default_adapter=(adapter)\n @default_adapter = resolve_adapter(adapter)\n end", "def initialize(adapter)\n @adapter = adapter\n end", "def initialize(adapter)\n self.adapter = adapter\n end", "def initialized_adapter\n adapter.new(adapter_options)\n end", "def adapter\n self.class.adapter\n end", "def initialize(adapter)\n @adapter = adapter\n end", "def register_adapter name, klass\n (@@adapters ||= {})[name] = klass\n end", "def adapters\n @__adapters__ ||= {}\n end", "def default_adapter=(adapter)\n @default_connection = nil\n @default_adapter = adapter\n end", "def adapter_initialize\n end", "def adapters\n @adapters ||= {}\n end", "def adapters\n @adapters ||= {}\n end", "def init_adapters(adapter_manager)\n end", "def use(adapter_klass, options = {})\n @options = options.symbolize_keys\n \n case adapter_klass\n when String, Symbol\n adapter_name = \"LiveValidations::Adapters::\" + adapter_klass.to_s.camelize\n self.current_adapter = adapter_name.constantize\n when Class\n self.current_adapter = adapter_klass\n end\n \n rescue NameError => e\n raise AdapterNotFound, \"The adapter `#{adapter_klass}' (#{adapter_name}) was not found.\"\n end", "def initialize_adapters\n adapters\n nil\n end", "def <<(adapter)\n @adapters << adapter\n end", "def adapter_class\n case Utilities.adapter\n when \"mysql2\"\n Adapters::Mysql2Adapter\n when \"postgresql\"\n Adapters::PostgreSQLAdapter\n when \"sqlite3\"\n Adapters::SQLite3Adapter\n when \"sqlserver\"\n Adapters::SQLServerAdapter\n end\n end", "def default_adapter_options=(_arg0); end", "def default_adapter_options=(_arg0); end", "def adapter\n unless @_adapter && @_adapter.valid?\n @_adapter = Cachetastic::Adapters.build(cache_klass)\n end\n @_adapter\n end", "def adapter_class\n @@adapters[configuration[:adapter]]\n end", "def default_adapter_options; end", "def default_adapter_options; end", "def do_adapter_specific_setup; end", "def http_adapter\n @adapter ||= set_http_adapter\n end", "def initialize_adapter\n # if no adapter has been initialized, use memory adapter\n config[:adapter] ||= Adapters::Memory\n\n extend config[:adapter]\n after_initialize if respond_to? :after_initialize\n end", "def register_adapter(key, klass)\n adapters[key] = klass\n end", "def adapter_class; raise_method_error(\"[#{self.class.name}] does not have `adapter_class` defined.\"); end", "def ambition_adapter=(klass)\n @@ambition_adapter ||= {}\n # should this be doing the same check for respond_to?(:name) like above?\n @@ambition_adapter[name] = klass\n end", "def add(adapter)\n adapters << adapter\n end", "def set_http_adapter( module_name='RestClientAdapter' )\n \n # what is happening here:\n # strips the Adapter portion of the module name to get at the client name\n # convention over configurationing to get the file name as it relates to files in http_client/adapter\n # require the hopefully found file\n # modify the RestAPI class to extend the Rest methods from the adapter\n # add the RestAPI to Aqua for easy access throughout the library\n \n @adapter = module_name\n mod = @adapter.gsub(/Adapter/, '')\n file_name = mod.underscore\n require File.dirname(__FILE__) + \"/adapters/#{file_name}\"\n RestAPI.adapter = \"CouchSpring::#{module_name}\".constantize\n extend(RestAPI)\n @adapter # return the adapter \n end", "def adapter(name, options = {}, &block)\n use(Adapters.const_get(name), options, &block)\n end", "def adapter\n if @adapter.nil?\n \n # initialize the adapter\n class_name = adapter_name.to_s.camelcase\n LOG.info \"Attempting to load adapter #{class_name}.\"\n a = init_adapter( class_name )\n if a.nil?\n LOG.warn \"Attempting to load adapter file.\"\n load_adapter( adapter_name )\n a = init_adapter( \"ActiveMessaging::Adapters::#{class_name}\")\n a = init_adapter( \"Adapters::#{class_name}\") if a.nil?\n a = init_adapter( class_name ) if a.nil?\n end\n \n # configure the adapter\n unless a.nil?\n begin\n a.configure(@options)\n rescue NoMethodError\n LOG.warn \"Adapter #{a.class} lacks a configure method.\"\n rescue ArgumentError => error\n LOG.error \"Bad arguments when configuring #{a.class}.\\n\\t#{error}\"\n end\n end\n \n if a.nil?\n raise BadConfigurationException, \"Adapter #{adapter_name.inspect} \" +\n \"unavailable.\\n\\tAdapter class #{class_name} does not appear to \" +\n \"be in the $LOAD_PATH:\\n\\t#{$LOAD_PATH.join(\"\\n\\t\\t\")}\"\n end\n @adapter = a \n end\n return @adapter\n end", "def engine_adapter=(name_or_adapter_or_class)\n self._engine_adapter = interpret_adapter(name_or_adapter_or_class)\n end", "def register_adapter( a )\n aname = a.name.split('::').last.downcase\n @@adapters[aname] = a\n end", "def initialize(implement_adapter_class)\n @adapter = implement_adapter_class.new\n end", "def set_adapter_scheme(scheme)\n @scheme = scheme\n @@adapters[scheme.to_sym] = self\n end", "def initialize(adapter)\n @adapter = Nunes::Adapter.wrap(adapter)\n end", "def adapter_options\n []\n end", "def set_show_adapter\n @show_adapter = ShowAdapter.find(params[:id])\n end", "def adapter_class\n ADAPTERS[Utilities.adapter]\n end", "def instance_adapter(adapter)\n adapter.bind_instances(self)\n end", "def adapter=(client)\n case client\n when :curb\n require 'curb'\n when :synchrony\n require 'em-synchrony'\n require 'em-synchrony/em-http'\n when :net_http\n require 'net/http'\n else\n raise ArgumentError, \":#{client} is not a valid HTTP client\"\n end\n\n @adapter = client\n end", "def faraday_adapter(adapter)\n @configuration[:faraday_adapter] = adapter\n end", "def adapter_name\n ADAPTER_NAME\n end", "def adapter_name\n ADAPTER_NAME\n end", "def adapter_name\n ADAPTER_NAME\n end", "def apply_adapter_name(config)\n db_adapter = config[:db_adapter] || config[:adapter]\n config.merge(:adapter => db_adapter)\n end", "def sf_adapter(adapter)\n @salesforce_adapter = adapter\n end", "def from(adapter, options = {})\n @loader.from(adapter, options)\n self\n end", "def default_adapter\n make_adapter @@manager.DefaultAdapter[0]\n end", "def load_adapter\n self.adapter_class =\n case framework\n when :rails then SimpleNavigation::Adapters::Rails\n when :sinatra then SimpleNavigation::Adapters::Sinatra\n when :padrino then SimpleNavigation::Adapters::Padrino\n when :nanoc then SimpleNavigation::Adapters::Nanoc\n end\n end", "def adapter_name\n self.class::ADAPTER_NAME\n end", "def adapter_name\n self.class::ADAPTER_NAME\n end", "def adapter_options\n []\n end", "def with(metadata_adapter: self.metadata_adapter, storage_adapter: self.storage_adapter)\n new_adapter = self.class.new(metadata_adapter: metadata_adapter, storage_adapter: storage_adapter, transaction: true, characterize: @characterize, queue: queue, handlers: handlers)\n return new_adapter unless block_given?\n yield new_adapter\n end", "def select_adapter\n adapter = @@internals[@table][:config][:adapter] || 'mysql'\n\n case adapter\n when nil\n raise \"Adapter Not Specified\"\n when \"mysql\"\n self.class.send :include, Shada::Data::MYSQL2\n when 'mongodb'\n self.class.send :include, Shada::Data::MongoDB\n when 'sqlite'\n self.class.send :include, Shada::Data::SQLite\n else\n raise \"Error\"\n end\n end", "def adapter_initialize\n opts = @opts\n @mutex = Mutex.new\n @sqls = opts[:sqls] || []\n @shared_adapter = false\n\n case db_type = opts[:host] \n when String, Symbol\n db_type = db_type.to_sym\n unless mod = Sequel.synchronize{SHARED_ADAPTER_MAP[db_type]}\n begin\n require \"sequel/adapters/shared/#{db_type}\"\n rescue LoadError\n else\n mod = Sequel.synchronize{SHARED_ADAPTER_MAP[db_type]}\n end\n end\n\n if mod\n @shared_adapter = true\n extend(mod::DatabaseMethods)\n extend_datasets(mod::DatasetMethods)\n if mod.respond_to?(:mock_adapter_setup)\n mod.mock_adapter_setup(self)\n end\n end\n end\n\n unless @shared_adapter\n extend UnmodifiedIdentifiers::DatabaseMethods\n extend_datasets UnmodifiedIdentifiers::DatasetMethods\n end\n\n self.autoid = opts[:autoid]\n self.columns = opts[:columns]\n self.fetch = opts[:fetch]\n self.numrows = opts[:numrows]\n extend(opts[:extend]) if opts[:extend]\n sqls\n end", "def adapter(adapter, options = {}, &block)\n case adapter\n when Symbol\n use(Adapters.const_get(adapter), options, &block)\n when Class\n use(adapter, options, &block)\n else\n raise ArgumentError, 'Adapter must be a Moneta store' unless adapter.respond_to?(:load) && adapter.respond_to?(:store)\n raise ArgumentError, 'No options allowed' unless options.empty?\n @proxies.unshift adapter\n nil\n end\n end", "def add_adapter(adapter)\n if adapter.send(:activate)\n valid_adapters << adapter\n adapter.send(:callbacks).each do |callback|\n Octo::Callbacks.send(callback, lambda { |opts|\n adapter.send(:perform, opts)\n })\n end\n end\n end", "def http_adapter=(new_http_adapter)\n if new_http_adapter.kind_of?(HTTPAdapter)\n @http_adapter = new_http_adapter\n else\n raise TypeError, \"Expected HTTPAdapter, got #{new_http_adapter.class}.\"\n end\n end", "def modify_adapter\n parent.with_open_session do |session|\n machine = session.machine\n yield machine.get_network_adapter(slot)\n end\n end", "def get_adapter\n \n unless @remote_adapter\n @remote_adapter = adapter_class(adapter).new(account)\n end\n \n @remote_adapter\n \n end", "def prepend\n adapters.unshift(adapter)\n end", "def __auto_detect_adapter\n case\n when defined?(::Patron)\n :patron\n when defined?(::Typhoeus)\n :typhoeus\n when defined?(::HTTPClient)\n :httpclient\n when defined?(::Net::HTTP::Persistent)\n :net_http_persistent\n else\n ::Faraday.default_adapter\n end\n end", "def initialize(app, adapter_options = {})\n super(app)\n @adapter_options = adapter_options\n end", "def adapter\n account.adapter\n end", "def adapter_params\n params[:adapter]\n end", "def adapter\n @adapter || Polski::Adapter::StringAdapter\n end", "def adapter\n configatron.blabber_mouth.adapter\n end", "def adapters\n @adapters ||=\n @nodes.transform_values do |convs|\n convs.map { |conv| Adapter.adapter_for(conv, @context) }\n end\n end", "def network_adapter(slot, type, *args)\n @network_adapters[slot] = [type, args]\n end", "def register\n ModelAdapter.adapters ||= []\n ModelAdapter.adapters << Kernel.const_get(self.to_s)\n end", "def setup_connection_adapter\n ActiveRecord::Base.establish_connection(self.to_hash)\n end", "def clear_adapter!\n @_adapter = nil\n end", "def reset_adapters\n @adapters = nil\n end", "def xapit_adapter\n @xapit_adapter ||= begin\n adapter_class = AbstractAdapter.subclasses.detect { |a| a.for_class?(self) }\n if adapter_class\n adapter_class.new(self)\n else\n raise \"Unable to find Xapit adapter for class #{self.name}\"\n end\n end\n end", "def []=(key, value)\n @adapter[key.to_s] = value\n end", "def load_adapter\n adapter_name = config.robot.adapter\n adapter_class = adapters[adapter_name.to_sym]\n\n unless adapter_class\n logger.fatal I18n.t(\"lita.robot.unknown_adapter\", adapter: adapter_name)\n abort\n end\n\n adapter_class.new(self)\n end" ]
[ "0.8613022", "0.8281996", "0.8281996", "0.8281996", "0.8104187", "0.7916334", "0.7856411", "0.78472745", "0.78142387", "0.7805477", "0.7603482", "0.76012754", "0.7584533", "0.7584533", "0.7579596", "0.75100416", "0.7499074", "0.7431436", "0.74038196", "0.73958945", "0.7333091", "0.7295442", "0.72860074", "0.72832334", "0.72448343", "0.7233815", "0.7232554", "0.706718", "0.7066651", "0.7015067", "0.70100933", "0.69787246", "0.6968719", "0.6938205", "0.6923262", "0.69102496", "0.68263924", "0.6795684", "0.67902523", "0.67902523", "0.6777413", "0.6769839", "0.67631763", "0.67631763", "0.67557704", "0.6708092", "0.6694907", "0.6681704", "0.66656315", "0.66580516", "0.662964", "0.6625229", "0.6606887", "0.6604619", "0.6597202", "0.6595108", "0.6581343", "0.6569337", "0.6558048", "0.6545712", "0.6536146", "0.652815", "0.6505957", "0.6465317", "0.64625543", "0.6456573", "0.6456573", "0.6456573", "0.6438579", "0.6430513", "0.6415663", "0.6398283", "0.63778573", "0.63748187", "0.63748187", "0.6374772", "0.6335451", "0.6317973", "0.63102055", "0.62685853", "0.622708", "0.62193745", "0.6184658", "0.6177326", "0.61628205", "0.6159171", "0.61537015", "0.6146252", "0.6133806", "0.6115642", "0.6111955", "0.6109022", "0.60997295", "0.6090694", "0.6086653", "0.6065283", "0.6063933", "0.60618204", "0.6061416", "0.60430145" ]
0.70868796
27
Constructs a new instance.
def initialize(config) super(config, SERVICE_INFO) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new()\n #This is a stub, used for indexing\n end", "def constructor; end", "def new\n \n end", "def new(*args)\n self.class.new(*args)\n end", "def new(*args)\n self.class.new(*args)\n end", "def new #:nodoc:\n end", "def construct\n end", "def initialize\n \n end", "def initialize() end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def new(opts = {})\n klass.new(opts)\n end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\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", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize()\n end", "def new\n self\n end", "def initialize\n end", "def new(*args)\n raise NoMethodError.new(\"You can not instaniate this class!\")\n end", "def new(*args) dup.initialize(*args) end", "def initialize()\n raise \"#{self.class.to_s} should not be instantiated directly.\"\n end", "def initialize\r\n\r\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n initialize!\n end", "def initialize\n initialize!\n end", "def initialize\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def new\n BaseObject.new(self)\n end", "def newInstance( params={} )\n model.new( params ).extend( InstanceMethods )\n end", "def initialize( * )\n super\n end", "def new(*args,&block)\n Base.new(*args,&block)\n end", "def initialize\n init\n end", "def initialize\n \n end", "def initialize\n \n end", "def new\n \n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def new\n new_with_value(nil)\n end", "def instantiate\n resource.new(data)\n end", "def new()\n trace(\"Instance #{index} created\")\n index += 1\n end" ]
[ "0.8045547", "0.8045547", "0.8045547", "0.8045547", "0.8045547", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.7991461", "0.785467", "0.7695489", "0.7688422", "0.7615257", "0.754397", "0.75422287", "0.7402954", "0.73675203", "0.7343034", "0.7343034", "0.7343034", "0.7343034", "0.7343034", "0.7343034", "0.7302681", "0.7258747", "0.7258747", "0.7258747", "0.7258747", "0.7258747", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71399224", "0.7129271", "0.71275824", "0.71158165", "0.7102901", "0.7093707", "0.70484614", "0.69906384", "0.69906384", "0.69906384", "0.69906384", "0.69906384", "0.69906384", "0.69906384", "0.6987927", "0.6987927", "0.697844", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.6961699", "0.6917308", "0.68943954", "0.68785733", "0.68759966", "0.686905", "0.686905", "0.68560094", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6851173", "0.6832223", "0.68299955" ]
0.0
-1
Constructs a new instance.
def initialize(config) super(config, SERVICE_INFO) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new()\n #This is a stub, used for indexing\n end", "def constructor; end", "def new\n \n end", "def new(*args)\n self.class.new(*args)\n end", "def new(*args)\n self.class.new(*args)\n end", "def new #:nodoc:\n end", "def construct\n end", "def initialize\n \n end", "def initialize() end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def new(opts = {})\n klass.new(opts)\n end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\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", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize()\n end", "def new\n self\n end", "def initialize\n end", "def new(*args)\n raise NoMethodError.new(\"You can not instaniate this class!\")\n end", "def new(*args) dup.initialize(*args) end", "def initialize()\n raise \"#{self.class.to_s} should not be instantiated directly.\"\n end", "def initialize\r\n\r\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n initialize!\n end", "def initialize\n initialize!\n end", "def initialize\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def new\n BaseObject.new(self)\n end", "def newInstance( params={} )\n model.new( params ).extend( InstanceMethods )\n end", "def initialize( * )\n super\n end", "def new(*args,&block)\n Base.new(*args,&block)\n end", "def initialize\n init\n end", "def initialize\n \n end", "def initialize\n \n end", "def new\n \n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def new\n new_with_value(nil)\n end", "def instantiate\n resource.new(data)\n end", "def new()\n trace(\"Instance #{index} created\")\n index += 1\n end" ]
[ "0.80456895", "0.80456895", "0.80456895", "0.80456895", "0.80456895", "0.8043627", "0.8043627", "0.8043627", "0.8043627", "0.8043627", "0.8043627", "0.8043627", "0.8043627", "0.8043627", "0.79921883", "0.7854048", "0.7695342", "0.76886445", "0.76153916", "0.754372", "0.75409234", "0.74029356", "0.7367339", "0.7343057", "0.7343057", "0.7343057", "0.7343057", "0.7343057", "0.7343057", "0.73030764", "0.7258721", "0.7258721", "0.7258721", "0.7258721", "0.7258721", "0.72416604", "0.72416604", "0.72416604", "0.72416604", "0.72416604", "0.72416604", "0.72416604", "0.72416604", "0.72416604", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.7139949", "0.71289563", "0.7127605", "0.7115569", "0.71032614", "0.7093564", "0.7048321", "0.6990373", "0.6990373", "0.6990373", "0.6990373", "0.6990373", "0.6990373", "0.6990373", "0.69875544", "0.69875544", "0.697815", "0.69634074", "0.69634074", "0.69634074", "0.69634074", "0.69634074", "0.69634074", "0.69634074", "0.69634074", "0.6960778", "0.6917359", "0.6894451", "0.68780726", "0.68758", "0.68689096", "0.68689096", "0.6855974", "0.6854572", "0.6854572", "0.6854572", "0.6854572", "0.6854572", "0.6854572", "0.6854572", "0.6854572", "0.6854572", "0.6854572", "0.68507713", "0.6832209", "0.6830385" ]
0.0
-1
Constructs a new instance.
def initialize(ruby_values = nil, struct_value = nil) super(self.class.binding_type, ruby_values, struct_value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new()\n #This is a stub, used for indexing\n end", "def constructor; end", "def new\n \n end", "def new(*args)\n self.class.new(*args)\n end", "def new(*args)\n self.class.new(*args)\n end", "def new #:nodoc:\n end", "def construct\n end", "def initialize\n \n end", "def initialize() end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def new(opts = {})\n klass.new(opts)\n end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\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", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize()\n end", "def new\n self\n end", "def initialize\n end", "def new(*args)\n raise NoMethodError.new(\"You can not instaniate this class!\")\n end", "def new(*args) dup.initialize(*args) end", "def initialize()\n raise \"#{self.class.to_s} should not be instantiated directly.\"\n end", "def initialize\r\n\r\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n initialize!\n end", "def initialize\n initialize!\n end", "def initialize\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def new\n BaseObject.new(self)\n end", "def newInstance( params={} )\n model.new( params ).extend( InstanceMethods )\n end", "def initialize( * )\n super\n end", "def new(*args,&block)\n Base.new(*args,&block)\n end", "def initialize\n init\n end", "def initialize\n \n end", "def initialize\n \n end", "def new\n \n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def new\n new_with_value(nil)\n end", "def instantiate\n resource.new(data)\n end", "def new()\n trace(\"Instance #{index} created\")\n index += 1\n end" ]
[ "0.8045547", "0.8045547", "0.8045547", "0.8045547", "0.8045547", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.7991461", "0.785467", "0.7695489", "0.7688422", "0.7615257", "0.754397", "0.75422287", "0.7402954", "0.73675203", "0.7343034", "0.7343034", "0.7343034", "0.7343034", "0.7343034", "0.7343034", "0.7302681", "0.7258747", "0.7258747", "0.7258747", "0.7258747", "0.7258747", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71399224", "0.7129271", "0.71275824", "0.71158165", "0.7102901", "0.7093707", "0.70484614", "0.69906384", "0.69906384", "0.69906384", "0.69906384", "0.69906384", "0.69906384", "0.69906384", "0.6987927", "0.6987927", "0.697844", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.6961699", "0.6917308", "0.68943954", "0.68785733", "0.68759966", "0.686905", "0.686905", "0.68560094", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6851173", "0.6832223", "0.68299955" ]
0.0
-1
Constructs a new instance.
def initialize(ruby_values = nil, struct_value = nil) super(self.class.binding_type, ruby_values, struct_value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new()\n #This is a stub, used for indexing\n end", "def constructor; end", "def new\n \n end", "def new(*args)\n self.class.new(*args)\n end", "def new(*args)\n self.class.new(*args)\n end", "def new #:nodoc:\n end", "def construct\n end", "def initialize\n \n end", "def initialize() end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def new(opts = {})\n klass.new(opts)\n end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\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", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize()\n end", "def new\n self\n end", "def initialize\n end", "def new(*args)\n raise NoMethodError.new(\"You can not instaniate this class!\")\n end", "def new(*args) dup.initialize(*args) end", "def initialize()\n raise \"#{self.class.to_s} should not be instantiated directly.\"\n end", "def initialize\r\n\r\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n initialize!\n end", "def initialize\n initialize!\n end", "def initialize\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def new\n BaseObject.new(self)\n end", "def newInstance( params={} )\n model.new( params ).extend( InstanceMethods )\n end", "def initialize( * )\n super\n end", "def new(*args,&block)\n Base.new(*args,&block)\n end", "def initialize\n init\n end", "def initialize\n \n end", "def initialize\n \n end", "def new\n \n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def new\n new_with_value(nil)\n end", "def instantiate\n resource.new(data)\n end", "def new()\n trace(\"Instance #{index} created\")\n index += 1\n end" ]
[ "0.8045547", "0.8045547", "0.8045547", "0.8045547", "0.8045547", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.7991461", "0.785467", "0.7695489", "0.7688422", "0.7615257", "0.754397", "0.75422287", "0.7402954", "0.73675203", "0.7343034", "0.7343034", "0.7343034", "0.7343034", "0.7343034", "0.7343034", "0.7302681", "0.7258747", "0.7258747", "0.7258747", "0.7258747", "0.7258747", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71399224", "0.7129271", "0.71275824", "0.71158165", "0.7102901", "0.7093707", "0.70484614", "0.69906384", "0.69906384", "0.69906384", "0.69906384", "0.69906384", "0.69906384", "0.69906384", "0.6987927", "0.6987927", "0.697844", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.6961699", "0.6917308", "0.68943954", "0.68785733", "0.68759966", "0.686905", "0.686905", "0.68560094", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6851173", "0.6832223", "0.68299955" ]
0.0
-1
Converts from a string value (perhaps off the wire) to an instance of this enum type.
def from_string(value) const_get(value) rescue NameError TestStatus.send(:new, 'UNKNOWN', value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_string(value)\n const_get(value)\n rescue NameError\n Type.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n Type.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n Type.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n TransferStatus.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n EmulationType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n UserAccountStatus.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n State.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n State.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n ReturnStatus.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n MessageStatus.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n MessageStatus.send(:new, 'UNKNOWN', value)\n end", "def enum(value)\n EnumValue.new(value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n UserRole.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n ResultType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n SourceType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n ConnectionState.send(:new, 'UNKNOWN', value)\n end", "def __enum(value)\n EnumValue.new(value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n MacAddressType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n HostBusAdapterType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n HostBusAdapterType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n Category.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n Category.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n LocationType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n UserPasswordStatus.send(:new, 'UNKNOWN', value)\n end", "def build_from_hash(value)\n constantValues = CageType.constants.select { |c| CageType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #CageType\" if constantValues.empty?\n value\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n NetworkProtocol.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n DeviceAccessType.send(:new, 'UNKNOWN', value)\n end", "def build_from_hash(value)\n constantValues = ExchangeStatus.constants.select { |c| ExchangeStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ExchangeStatus\" if constantValues.empty?\n value\n end", "def visit_enum(binding_type)\n #VAPI.log.debug \"VERBOSE: visit_enum called - #{self.input}\"\n enum_string = self.input.value\n if binding_type.binding_class\n self.result = binding_type.binding_class.from_string(enum_string)\n else\n #TODO: port this to ruby\n #self.result = Enum.new(enum_string)\n self.result = enum_string\n end\n end", "def build_from_hash(value)\n constValues = ErrorCode.constants.select{|c| ErrorCode.const_get(c).value == value}\n raise \"Invalid ENUM value #{value} for class #ErrorCode\" if constValues.length != 1\n @value = ErrorCode.const_get(constValues[0]).value\n self\n end", "def build_from_hash(value)\n constantValues = ExternalOrderItemSourceTypeEnumModel.constants.select { |c| ExternalOrderItemSourceTypeEnumModel::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ExternalOrderItemSourceTypeEnumModel\" if constantValues.empty?\n value\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackupRestoreProcessState.send(:new, 'UNKNOWN', value)\n end", "def build_from_hash(value)\n constantValues = BarcodeType.constants.select { |c| BarcodeType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #BarcodeType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = TransactionTypeEnumModel.constants.select { |c| TransactionTypeEnumModel::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #TransactionTypeEnumModel\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n constantValues = RequestType.constants.select { |c| RequestType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #RequestType\" if constantValues.empty?\n value\n end", "def enum(name)\n name = name.to_sym\n\n enum_info = ENUMS[name]\n if enum_info.nil?\n raise ArgumentError, sprintf('No enum found with name %s', name)\n end\n\n require_path = sprintf(ENUM_PATH, @path_version, enum_info.first)\n require require_path\n\n class_path = sprintf(ENUM_CLASS_PATH, @version, enum_info.last,\n enum_info.last)\n return class_for_path(class_path)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n DiskProvisioningType.send(:new, 'UNKNOWN', value)\n end", "def build_from_hash(value)\n constantValues = ChargeType.constants.select { |c| ChargeType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ChargeType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ContactType.constants.select { |c| ContactType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ContactType\" if constantValues.empty?\n value\n end", "def init(name, value, define_constant = false)\n @values ||= {}\n @symbols ||= []\n\n s = name.to_sym\n\n n = s.to_s\n n_lc = n.downcase\n raise ArgumentError.new(\"Key #{s} is not lower case\") if n != n_lc\n raise ArgumentError.new(\"Key #{s} already defined\") if @values.key? name\n\n val = value.to_i\n if @values.key? val\n # This is a new alias for an existing value\n enum_val = @values[val]\n enum_val.instance_eval { @aliases << s }\n else\n enum_val = new(s, val)\n @values[val] = enum_val\n end\n\n @values[s] = enum_val\n @symbols << s\n\n const_set s.to_s.upcase, enum_val if define_constant\n\n enum_val\n end", "def build_from_hash(value)\n constantValues = NewOrResale.constants.select { |c| NewOrResale::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #NewOrResale\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = CorporateType.constants.select { |c| CorporateType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #CorporateType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ObjectType.constants.select { |c| ObjectType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ObjectType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = MessageStatus.constants.select { |c| MessageStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #MessageStatus\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = BrokerAccountType.constants.select { |c| BrokerAccountType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #BrokerAccountType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ContentEncoding.constants.select { |c| ContentEncoding::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ContentEncoding\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ColorType.constants.select { |c| ColorType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ColorType\" if constantValues.empty?\n value\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n DNSServerMode.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n FirewallRulePolicy.send(:new, 'UNKNOWN', value)\n end", "def build_from_hash(value)\n constantValues = PropertyType.constants.select { |c| PropertyType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #PropertyType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = OperationStatus.constants.select { |c| OperationStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #OperationStatus\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = FrontendState.constants.select { |c| FrontendState::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #FrontendState\" if constantValues.empty?\n value\n end", "def new(value)\n\t\t\treturn @enumvalues[value] if @enumvalues.has_key? value\n\t\t\t_setup_enumvalue(value, value, allocate)\n\t\tend", "def build_from_hash(value)\n constantValues = TransactionType.constants.select { |c| TransactionType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #TransactionType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ConnectionStatus.constants.select { |c| ConnectionStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ConnectionStatus\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = OrderStatus.constants.select { |c| OrderStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #OrderStatus\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = AnnotationType.constants.select { |c| AnnotationType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #AnnotationType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = Channel.constants.select { |c| Channel::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #Channel\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = BroadcastResolution.constants.select { |c| BroadcastResolution::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #BroadcastResolution\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ReferenceTypeId.constants.select { |c| ReferenceTypeId::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ReferenceTypeId\" if constantValues.empty?\n value\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n ChecksumAlgorithm.send(:new, 'UNKNOWN', value)\n end", "def build_from_hash(value)\n constantValues = Chain.constants.select { |c| Chain::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #Chain\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ErrorCodeOmnichannelMachine.constants.select { |c| ErrorCodeOmnichannelMachine::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ErrorCodeOmnichannelMachine\" if constantValues.empty?\n value\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n IpAllocationScheme.send(:new, 'UNKNOWN', value)\n end", "def initialize(type)\n unless type.is_a?(GraphQL::EnumType)\n raise \"expected type to be a GraphQL::EnumType, but was #{type.class}\"\n end\n\n @type = type\n @values = {}\n\n all_values = type.values.keys\n\n all_values.each do |value|\n str = value.dup\n all_values.each do |v|\n str.define_singleton_method(\"#{v.downcase}?\") { false }\n end\n str.define_singleton_method(\"#{value.downcase}?\") { true }\n str.freeze\n const_set(value, str) if value =~ /^[A-Z]/\n @values[str] = str\n end\n\n @values.freeze\n end", "def parse_enum_if_enum(klass,property_name,value)\n type = klass.to_clr_type.get_property(classify(property_name.to_s)).property_type\n type.is_enum ? Enum.parse(type, classify(value.to_s)) : value\n end", "def parse_enum_if_enum(klass,property_name,value)\n type = klass.to_clr_type.get_property(classify(property_name.to_s)).property_type\n type.is_enum ? Enum.parse(type, classify(value.to_s)) : value\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n IpProtocol.send(:new, 'UNKNOWN', value)\n end", "def build_from_hash(value)\n constantValues = ResponseErrorCode.constants.select { |c| ResponseErrorCode::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ResponseErrorCode\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = CorrectCodeType.constants.select { |c| CorrectCodeType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #CorrectCodeType\" if constantValues.empty?\n value\n end", "def enum(value)\n @enum = value\n end", "def build_from_hash(value)\n constantValues = CurrencyCode.constants.select { |c| CurrencyCode::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #CurrencyCode\" if constantValues.empty?\n value\n end", "def get_string_enum\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/enum'\n _query_builder = APIHelper.append_url_with_query_parameters(\n _query_builder,\n 'type' => 'string'\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n _response.raw_body\n end", "def build_from_hash(value)\n constantValues = GSuiteBuiltinTranslation.constants.select{|c| GSuiteBuiltinTranslation::const_get(c) == value}\n raise \"Invalid ENUM value #{value} for class #GSuiteBuiltinTranslation\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ContentModuleType.constants.select { |c| ContentModuleType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ContentModuleType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = SchemaFieldMode.constants.select { |c| SchemaFieldMode::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #SchemaFieldMode\" if constantValues.empty?\n value\n end", "def from_string(string)\n from_bits(*Builder::FromString.new(string).bits)\n end", "def build_from_hash(value)\n constantValues = PaymentAccountSchemeName.constants.select { |c| PaymentAccountSchemeName::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #PaymentAccountSchemeName\" if constantValues.empty?\n value\n end", "def typecast_to_class(value)\n value.to_s.constantize\n rescue NameError\n nil\n end", "def build_from_hash(value)\n constantValues = LedColor.constants.select { |c| LedColor::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #LedColor\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = DaemonState.constants.select { |c| DaemonState::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #DaemonState\" if constantValues.empty?\n value\n end", "def visit_enum(binding_type)\n if not input.is_a? Enum\n # TODO: Verify if the value is instance of actual binding class\n report_error('vapi.bindings.typeconverter.unexpected.ruby.type',\n Enum, input.class)\n end\n self.result = binding_type.definition.new_value(input)\n end" ]
[ "0.7495569", "0.7495569", "0.74386185", "0.7192527", "0.70895386", "0.70895386", "0.70895386", "0.70895386", "0.70895386", "0.70895386", "0.70865124", "0.7032917", "0.7008576", "0.7008576", "0.6892211", "0.68670857", "0.68670857", "0.6845763", "0.67862046", "0.67834616", "0.6626145", "0.6623483", "0.6587726", "0.6570122", "0.6560128", "0.6560128", "0.6523066", "0.6523066", "0.6440003", "0.64347", "0.6383892", "0.631073", "0.62975895", "0.6289992", "0.6224352", "0.62070024", "0.61878854", "0.6153309", "0.61519605", "0.61021245", "0.6090049", "0.6090049", "0.6090049", "0.6090049", "0.6090049", "0.6090049", "0.6090049", "0.6090049", "0.6090049", "0.6090049", "0.6090049", "0.6070621", "0.6067047", "0.60586566", "0.60266054", "0.60249317", "0.60124695", "0.597689", "0.597451", "0.59738004", "0.597335", "0.5960258", "0.5954248", "0.59469056", "0.5926311", "0.5914334", "0.5911726", "0.59109616", "0.5890434", "0.58877355", "0.58855563", "0.5878038", "0.58727354", "0.58688056", "0.58618134", "0.58368", "0.5817062", "0.580678", "0.58009994", "0.579926", "0.579789", "0.5797573", "0.5793261", "0.5793261", "0.5786068", "0.57750267", "0.5770232", "0.5755376", "0.57473993", "0.5746361", "0.5738399", "0.5731196", "0.57240444", "0.5716732", "0.57119083", "0.5704418", "0.5703874", "0.5679791", "0.5655619" ]
0.67317176
21
Constructs a new instance.
def initialize(value, unknown = nil) super(self.class.binding_type, value, unknown) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new()\n #This is a stub, used for indexing\n end", "def constructor; end", "def new\n \n end", "def new(*args)\n self.class.new(*args)\n end", "def new(*args)\n self.class.new(*args)\n end", "def new #:nodoc:\n end", "def construct\n end", "def initialize\n \n end", "def initialize() end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def new(opts = {})\n klass.new(opts)\n end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\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", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize()\n end", "def new\n self\n end", "def initialize\n end", "def new(*args)\n raise NoMethodError.new(\"You can not instaniate this class!\")\n end", "def new(*args) dup.initialize(*args) end", "def initialize()\n raise \"#{self.class.to_s} should not be instantiated directly.\"\n end", "def initialize\r\n\r\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n initialize!\n end", "def initialize\n initialize!\n end", "def initialize\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def new\n BaseObject.new(self)\n end", "def newInstance( params={} )\n model.new( params ).extend( InstanceMethods )\n end", "def initialize( * )\n super\n end", "def new(*args,&block)\n Base.new(*args,&block)\n end", "def initialize\n init\n end", "def initialize\n \n end", "def initialize\n \n end", "def new\n \n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def new\n new_with_value(nil)\n end", "def instantiate\n resource.new(data)\n end", "def new()\n trace(\"Instance #{index} created\")\n index += 1\n end" ]
[ "0.80456895", "0.80456895", "0.80456895", "0.80456895", "0.80456895", "0.8043627", "0.8043627", "0.8043627", "0.8043627", "0.8043627", "0.8043627", "0.8043627", "0.8043627", "0.8043627", "0.79921883", "0.7854048", "0.7695342", "0.76886445", "0.76153916", "0.754372", "0.75409234", "0.74029356", "0.7367339", "0.7343057", "0.7343057", "0.7343057", "0.7343057", "0.7343057", "0.7343057", "0.73030764", "0.7258721", "0.7258721", "0.7258721", "0.7258721", "0.7258721", "0.72416604", "0.72416604", "0.72416604", "0.72416604", "0.72416604", "0.72416604", "0.72416604", "0.72416604", "0.72416604", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.7139949", "0.71289563", "0.7127605", "0.7115569", "0.71032614", "0.7093564", "0.7048321", "0.6990373", "0.6990373", "0.6990373", "0.6990373", "0.6990373", "0.6990373", "0.6990373", "0.69875544", "0.69875544", "0.697815", "0.69634074", "0.69634074", "0.69634074", "0.69634074", "0.69634074", "0.69634074", "0.69634074", "0.69634074", "0.6960778", "0.6917359", "0.6894451", "0.68780726", "0.68758", "0.68689096", "0.68689096", "0.6855974", "0.6854572", "0.6854572", "0.6854572", "0.6854572", "0.6854572", "0.6854572", "0.6854572", "0.6854572", "0.6854572", "0.6854572", "0.68507713", "0.6832209", "0.6830385" ]
0.0
-1
Converts from a string value (perhaps off the wire) to an instance of this enum type.
def from_string(value) const_get(value) rescue NameError MessageStatus.send(:new, 'UNKNOWN', value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_string(value)\n const_get(value)\n rescue NameError\n Type.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n Type.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n Type.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n TransferStatus.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n EmulationType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n UserAccountStatus.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n State.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n State.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n ReturnStatus.send(:new, 'UNKNOWN', value)\n end", "def enum(value)\n EnumValue.new(value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n UserRole.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n ResultType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n TestStatus.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n TestStatus.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n SourceType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n ConnectionState.send(:new, 'UNKNOWN', value)\n end", "def __enum(value)\n EnumValue.new(value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n MacAddressType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n HostBusAdapterType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n HostBusAdapterType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n Category.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n Category.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n LocationType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n UserPasswordStatus.send(:new, 'UNKNOWN', value)\n end", "def build_from_hash(value)\n constantValues = CageType.constants.select { |c| CageType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #CageType\" if constantValues.empty?\n value\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n NetworkProtocol.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n DeviceAccessType.send(:new, 'UNKNOWN', value)\n end", "def build_from_hash(value)\n constantValues = ExchangeStatus.constants.select { |c| ExchangeStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ExchangeStatus\" if constantValues.empty?\n value\n end", "def visit_enum(binding_type)\n #VAPI.log.debug \"VERBOSE: visit_enum called - #{self.input}\"\n enum_string = self.input.value\n if binding_type.binding_class\n self.result = binding_type.binding_class.from_string(enum_string)\n else\n #TODO: port this to ruby\n #self.result = Enum.new(enum_string)\n self.result = enum_string\n end\n end", "def build_from_hash(value)\n constValues = ErrorCode.constants.select{|c| ErrorCode.const_get(c).value == value}\n raise \"Invalid ENUM value #{value} for class #ErrorCode\" if constValues.length != 1\n @value = ErrorCode.const_get(constValues[0]).value\n self\n end", "def build_from_hash(value)\n constantValues = ExternalOrderItemSourceTypeEnumModel.constants.select { |c| ExternalOrderItemSourceTypeEnumModel::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ExternalOrderItemSourceTypeEnumModel\" if constantValues.empty?\n value\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackupRestoreProcessState.send(:new, 'UNKNOWN', value)\n end", "def build_from_hash(value)\n constantValues = BarcodeType.constants.select { |c| BarcodeType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #BarcodeType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = TransactionTypeEnumModel.constants.select { |c| TransactionTypeEnumModel::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #TransactionTypeEnumModel\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n constantValues = RequestType.constants.select { |c| RequestType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #RequestType\" if constantValues.empty?\n value\n end", "def enum(name)\n name = name.to_sym\n\n enum_info = ENUMS[name]\n if enum_info.nil?\n raise ArgumentError, sprintf('No enum found with name %s', name)\n end\n\n require_path = sprintf(ENUM_PATH, @path_version, enum_info.first)\n require require_path\n\n class_path = sprintf(ENUM_CLASS_PATH, @version, enum_info.last,\n enum_info.last)\n return class_for_path(class_path)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n DiskProvisioningType.send(:new, 'UNKNOWN', value)\n end", "def build_from_hash(value)\n constantValues = ChargeType.constants.select { |c| ChargeType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ChargeType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ContactType.constants.select { |c| ContactType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ContactType\" if constantValues.empty?\n value\n end", "def init(name, value, define_constant = false)\n @values ||= {}\n @symbols ||= []\n\n s = name.to_sym\n\n n = s.to_s\n n_lc = n.downcase\n raise ArgumentError.new(\"Key #{s} is not lower case\") if n != n_lc\n raise ArgumentError.new(\"Key #{s} already defined\") if @values.key? name\n\n val = value.to_i\n if @values.key? val\n # This is a new alias for an existing value\n enum_val = @values[val]\n enum_val.instance_eval { @aliases << s }\n else\n enum_val = new(s, val)\n @values[val] = enum_val\n end\n\n @values[s] = enum_val\n @symbols << s\n\n const_set s.to_s.upcase, enum_val if define_constant\n\n enum_val\n end", "def build_from_hash(value)\n constantValues = NewOrResale.constants.select { |c| NewOrResale::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #NewOrResale\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = MessageStatus.constants.select { |c| MessageStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #MessageStatus\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = CorporateType.constants.select { |c| CorporateType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #CorporateType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ObjectType.constants.select { |c| ObjectType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ObjectType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = BrokerAccountType.constants.select { |c| BrokerAccountType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #BrokerAccountType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ContentEncoding.constants.select { |c| ContentEncoding::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ContentEncoding\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ColorType.constants.select { |c| ColorType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ColorType\" if constantValues.empty?\n value\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n DNSServerMode.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n FirewallRulePolicy.send(:new, 'UNKNOWN', value)\n end", "def build_from_hash(value)\n constantValues = OperationStatus.constants.select { |c| OperationStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #OperationStatus\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = PropertyType.constants.select { |c| PropertyType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #PropertyType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = FrontendState.constants.select { |c| FrontendState::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #FrontendState\" if constantValues.empty?\n value\n end", "def new(value)\n\t\t\treturn @enumvalues[value] if @enumvalues.has_key? value\n\t\t\t_setup_enumvalue(value, value, allocate)\n\t\tend", "def build_from_hash(value)\n constantValues = TransactionType.constants.select { |c| TransactionType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #TransactionType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ConnectionStatus.constants.select { |c| ConnectionStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ConnectionStatus\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = OrderStatus.constants.select { |c| OrderStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #OrderStatus\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = AnnotationType.constants.select { |c| AnnotationType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #AnnotationType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = Channel.constants.select { |c| Channel::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #Channel\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = BroadcastResolution.constants.select { |c| BroadcastResolution::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #BroadcastResolution\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ReferenceTypeId.constants.select { |c| ReferenceTypeId::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ReferenceTypeId\" if constantValues.empty?\n value\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n ChecksumAlgorithm.send(:new, 'UNKNOWN', value)\n end", "def build_from_hash(value)\n constantValues = Chain.constants.select { |c| Chain::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #Chain\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ErrorCodeOmnichannelMachine.constants.select { |c| ErrorCodeOmnichannelMachine::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ErrorCodeOmnichannelMachine\" if constantValues.empty?\n value\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n IpAllocationScheme.send(:new, 'UNKNOWN', value)\n end", "def initialize(type)\n unless type.is_a?(GraphQL::EnumType)\n raise \"expected type to be a GraphQL::EnumType, but was #{type.class}\"\n end\n\n @type = type\n @values = {}\n\n all_values = type.values.keys\n\n all_values.each do |value|\n str = value.dup\n all_values.each do |v|\n str.define_singleton_method(\"#{v.downcase}?\") { false }\n end\n str.define_singleton_method(\"#{value.downcase}?\") { true }\n str.freeze\n const_set(value, str) if value =~ /^[A-Z]/\n @values[str] = str\n end\n\n @values.freeze\n end", "def parse_enum_if_enum(klass,property_name,value)\n type = klass.to_clr_type.get_property(classify(property_name.to_s)).property_type\n type.is_enum ? Enum.parse(type, classify(value.to_s)) : value\n end", "def parse_enum_if_enum(klass,property_name,value)\n type = klass.to_clr_type.get_property(classify(property_name.to_s)).property_type\n type.is_enum ? Enum.parse(type, classify(value.to_s)) : value\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n IpProtocol.send(:new, 'UNKNOWN', value)\n end", "def build_from_hash(value)\n constantValues = ResponseErrorCode.constants.select { |c| ResponseErrorCode::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ResponseErrorCode\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = CorrectCodeType.constants.select { |c| CorrectCodeType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #CorrectCodeType\" if constantValues.empty?\n value\n end", "def enum(value)\n @enum = value\n end", "def get_string_enum\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/enum'\n _query_builder = APIHelper.append_url_with_query_parameters(\n _query_builder,\n 'type' => 'string'\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n _response.raw_body\n end", "def build_from_hash(value)\n constantValues = CurrencyCode.constants.select { |c| CurrencyCode::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #CurrencyCode\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = GSuiteBuiltinTranslation.constants.select{|c| GSuiteBuiltinTranslation::const_get(c) == value}\n raise \"Invalid ENUM value #{value} for class #GSuiteBuiltinTranslation\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ContentModuleType.constants.select { |c| ContentModuleType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ContentModuleType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = SchemaFieldMode.constants.select { |c| SchemaFieldMode::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #SchemaFieldMode\" if constantValues.empty?\n value\n end", "def from_string(string)\n from_bits(*Builder::FromString.new(string).bits)\n end", "def build_from_hash(value)\n constantValues = PaymentAccountSchemeName.constants.select { |c| PaymentAccountSchemeName::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #PaymentAccountSchemeName\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = LedColor.constants.select { |c| LedColor::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #LedColor\" if constantValues.empty?\n value\n end", "def typecast_to_class(value)\n value.to_s.constantize\n rescue NameError\n nil\n end", "def build_from_hash(value)\n constantValues = DaemonState.constants.select { |c| DaemonState::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #DaemonState\" if constantValues.empty?\n value\n end", "def visit_enum(binding_type)\n if not input.is_a? Enum\n # TODO: Verify if the value is instance of actual binding class\n report_error('vapi.bindings.typeconverter.unexpected.ruby.type',\n Enum, input.class)\n end\n self.result = binding_type.definition.new_value(input)\n end" ]
[ "0.7493947", "0.7493947", "0.7436984", "0.7192308", "0.7087891", "0.7087891", "0.7087891", "0.7087891", "0.7087891", "0.7087891", "0.7085152", "0.7032823", "0.7008514", "0.7008514", "0.68929034", "0.684477", "0.6785868", "0.6783008", "0.67318434", "0.67318434", "0.662472", "0.6622807", "0.6586578", "0.65692025", "0.6558584", "0.6558584", "0.65226483", "0.65226483", "0.64392656", "0.64343524", "0.63828945", "0.6309026", "0.629687", "0.6290214", "0.62243366", "0.6206861", "0.6187289", "0.615336", "0.61515194", "0.6100904", "0.60892236", "0.60892236", "0.60892236", "0.60892236", "0.60892236", "0.60892236", "0.60892236", "0.60892236", "0.60892236", "0.60892236", "0.60892236", "0.6069717", "0.6066953", "0.6057812", "0.60257417", "0.60236806", "0.60129744", "0.5976285", "0.5973202", "0.59731096", "0.5972036", "0.59593856", "0.5953515", "0.5946986", "0.5924605", "0.591284", "0.59112847", "0.591025", "0.58901024", "0.5887028", "0.58845437", "0.58776456", "0.5872741", "0.5867786", "0.5861292", "0.58361304", "0.5816374", "0.5807206", "0.5800698", "0.5799446", "0.57976073", "0.57969695", "0.57934797", "0.57934797", "0.5784765", "0.5775434", "0.5770217", "0.57546335", "0.574751", "0.57471", "0.5737496", "0.57301253", "0.5722539", "0.57173336", "0.57116777", "0.57040775", "0.5700769", "0.5679229", "0.5654201" ]
0.68672293
16
Constructs a new instance.
def initialize(value, unknown = nil) super(self.class.binding_type, value, unknown) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new()\n #This is a stub, used for indexing\n end", "def constructor; end", "def new\n \n end", "def new(*args)\n self.class.new(*args)\n end", "def new(*args)\n self.class.new(*args)\n end", "def new #:nodoc:\n end", "def construct\n end", "def initialize\n \n end", "def initialize() end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def new(opts = {})\n klass.new(opts)\n end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\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", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize()\n end", "def new\n self\n end", "def initialize\n end", "def new(*args)\n raise NoMethodError.new(\"You can not instaniate this class!\")\n end", "def new(*args) dup.initialize(*args) end", "def initialize()\n raise \"#{self.class.to_s} should not be instantiated directly.\"\n end", "def initialize\r\n\r\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n initialize!\n end", "def initialize\n initialize!\n end", "def initialize\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def new\n BaseObject.new(self)\n end", "def newInstance( params={} )\n model.new( params ).extend( InstanceMethods )\n end", "def initialize( * )\n super\n end", "def new(*args,&block)\n Base.new(*args,&block)\n end", "def initialize\n init\n end", "def initialize\n \n end", "def initialize\n \n end", "def new\n \n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def new\n new_with_value(nil)\n end", "def instantiate\n resource.new(data)\n end", "def new()\n trace(\"Instance #{index} created\")\n index += 1\n end" ]
[ "0.8045547", "0.8045547", "0.8045547", "0.8045547", "0.8045547", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.7991461", "0.785467", "0.7695489", "0.7688422", "0.7615257", "0.754397", "0.75422287", "0.7402954", "0.73675203", "0.7343034", "0.7343034", "0.7343034", "0.7343034", "0.7343034", "0.7343034", "0.7302681", "0.7258747", "0.7258747", "0.7258747", "0.7258747", "0.7258747", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71399224", "0.7129271", "0.71275824", "0.71158165", "0.7102901", "0.7093707", "0.70484614", "0.69906384", "0.69906384", "0.69906384", "0.69906384", "0.69906384", "0.69906384", "0.69906384", "0.6987927", "0.6987927", "0.697844", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.6961699", "0.6917308", "0.68943954", "0.68785733", "0.68759966", "0.686905", "0.686905", "0.68560094", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6851173", "0.6832223", "0.68299955" ]
0.0
-1
Constructs a new instance.
def initialize(config) super(config, SERVICE_INFO) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new()\n #This is a stub, used for indexing\n end", "def constructor; end", "def new\n \n end", "def new(*args)\n self.class.new(*args)\n end", "def new(*args)\n self.class.new(*args)\n end", "def new #:nodoc:\n end", "def construct\n end", "def initialize\n \n end", "def initialize() end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def new(opts = {})\n klass.new(opts)\n end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\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", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize()\n end", "def new\n self\n end", "def initialize\n end", "def new(*args)\n raise NoMethodError.new(\"You can not instaniate this class!\")\n end", "def new(*args) dup.initialize(*args) end", "def initialize()\n raise \"#{self.class.to_s} should not be instantiated directly.\"\n end", "def initialize\r\n\r\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n initialize!\n end", "def initialize\n initialize!\n end", "def initialize\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def new\n BaseObject.new(self)\n end", "def newInstance( params={} )\n model.new( params ).extend( InstanceMethods )\n end", "def initialize( * )\n super\n end", "def new(*args,&block)\n Base.new(*args,&block)\n end", "def initialize\n init\n end", "def initialize\n \n end", "def initialize\n \n end", "def new\n \n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def new\n new_with_value(nil)\n end", "def instantiate\n resource.new(data)\n end", "def new()\n trace(\"Instance #{index} created\")\n index += 1\n end" ]
[ "0.8045547", "0.8045547", "0.8045547", "0.8045547", "0.8045547", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.7991461", "0.785467", "0.7695489", "0.7688422", "0.7615257", "0.754397", "0.75422287", "0.7402954", "0.73675203", "0.7343034", "0.7343034", "0.7343034", "0.7343034", "0.7343034", "0.7343034", "0.7302681", "0.7258747", "0.7258747", "0.7258747", "0.7258747", "0.7258747", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71399224", "0.7129271", "0.71275824", "0.71158165", "0.7102901", "0.7093707", "0.70484614", "0.69906384", "0.69906384", "0.69906384", "0.69906384", "0.69906384", "0.69906384", "0.69906384", "0.6987927", "0.6987927", "0.697844", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.6961699", "0.6917308", "0.68943954", "0.68785733", "0.68759966", "0.686905", "0.686905", "0.68560094", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6851173", "0.6832223", "0.68299955" ]
0.0
-1
Constructs a new instance.
def initialize(ruby_values = nil, struct_value = nil) super(self.class.binding_type, ruby_values, struct_value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new()\n #This is a stub, used for indexing\n end", "def constructor; end", "def new\n \n end", "def new(*args)\n self.class.new(*args)\n end", "def new(*args)\n self.class.new(*args)\n end", "def new #:nodoc:\n end", "def construct\n end", "def initialize\n \n end", "def initialize() end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def new(opts = {})\n klass.new(opts)\n end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\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", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize()\n end", "def new\n self\n end", "def initialize\n end", "def new(*args)\n raise NoMethodError.new(\"You can not instaniate this class!\")\n end", "def new(*args) dup.initialize(*args) end", "def initialize()\n raise \"#{self.class.to_s} should not be instantiated directly.\"\n end", "def initialize\r\n\r\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n initialize!\n end", "def initialize\n initialize!\n end", "def initialize\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def new\n BaseObject.new(self)\n end", "def newInstance( params={} )\n model.new( params ).extend( InstanceMethods )\n end", "def initialize( * )\n super\n end", "def new(*args,&block)\n Base.new(*args,&block)\n end", "def initialize\n init\n end", "def initialize\n \n end", "def initialize\n \n end", "def new\n \n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def new\n new_with_value(nil)\n end", "def instantiate\n resource.new(data)\n end", "def new()\n trace(\"Instance #{index} created\")\n index += 1\n end" ]
[ "0.80456895", "0.80456895", "0.80456895", "0.80456895", "0.80456895", "0.8043627", "0.8043627", "0.8043627", "0.8043627", "0.8043627", "0.8043627", "0.8043627", "0.8043627", "0.8043627", "0.79921883", "0.7854048", "0.7695342", "0.76886445", "0.76153916", "0.754372", "0.75409234", "0.74029356", "0.7367339", "0.7343057", "0.7343057", "0.7343057", "0.7343057", "0.7343057", "0.7343057", "0.73030764", "0.7258721", "0.7258721", "0.7258721", "0.7258721", "0.7258721", "0.72416604", "0.72416604", "0.72416604", "0.72416604", "0.72416604", "0.72416604", "0.72416604", "0.72416604", "0.72416604", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.7139949", "0.71289563", "0.7127605", "0.7115569", "0.71032614", "0.7093564", "0.7048321", "0.6990373", "0.6990373", "0.6990373", "0.6990373", "0.6990373", "0.6990373", "0.6990373", "0.69875544", "0.69875544", "0.697815", "0.69634074", "0.69634074", "0.69634074", "0.69634074", "0.69634074", "0.69634074", "0.69634074", "0.69634074", "0.6960778", "0.6917359", "0.6894451", "0.68780726", "0.68758", "0.68689096", "0.68689096", "0.6855974", "0.6854572", "0.6854572", "0.6854572", "0.6854572", "0.6854572", "0.6854572", "0.6854572", "0.6854572", "0.6854572", "0.6854572", "0.68507713", "0.6832209", "0.6830385" ]
0.0
-1
Constructs a new instance.
def initialize(ruby_values = nil, struct_value = nil) super(self.class.binding_type, ruby_values, struct_value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new()\n #This is a stub, used for indexing\n end", "def constructor; end", "def new\n \n end", "def new(*args)\n self.class.new(*args)\n end", "def new(*args)\n self.class.new(*args)\n end", "def new #:nodoc:\n end", "def construct\n end", "def initialize\n \n end", "def initialize() end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def new(opts = {})\n klass.new(opts)\n end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\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", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize()\n end", "def new\n self\n end", "def initialize\n end", "def new(*args)\n raise NoMethodError.new(\"You can not instaniate this class!\")\n end", "def new(*args) dup.initialize(*args) end", "def initialize()\n raise \"#{self.class.to_s} should not be instantiated directly.\"\n end", "def initialize\r\n\r\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n initialize!\n end", "def initialize\n initialize!\n end", "def initialize\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def new\n BaseObject.new(self)\n end", "def newInstance( params={} )\n model.new( params ).extend( InstanceMethods )\n end", "def initialize( * )\n super\n end", "def new(*args,&block)\n Base.new(*args,&block)\n end", "def initialize\n init\n end", "def initialize\n \n end", "def initialize\n \n end", "def new\n \n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def new\n new_with_value(nil)\n end", "def instantiate\n resource.new(data)\n end", "def new()\n trace(\"Instance #{index} created\")\n index += 1\n end" ]
[ "0.8045547", "0.8045547", "0.8045547", "0.8045547", "0.8045547", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.7991461", "0.785467", "0.7695489", "0.7688422", "0.7615257", "0.754397", "0.75422287", "0.7402954", "0.73675203", "0.7343034", "0.7343034", "0.7343034", "0.7343034", "0.7343034", "0.7343034", "0.7302681", "0.7258747", "0.7258747", "0.7258747", "0.7258747", "0.7258747", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71399224", "0.7129271", "0.71275824", "0.71158165", "0.7102901", "0.7093707", "0.70484614", "0.69906384", "0.69906384", "0.69906384", "0.69906384", "0.69906384", "0.69906384", "0.69906384", "0.6987927", "0.6987927", "0.697844", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.6961699", "0.6917308", "0.68943954", "0.68785733", "0.68759966", "0.686905", "0.686905", "0.68560094", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6851173", "0.6832223", "0.68299955" ]
0.0
-1
Constructs a new instance.
def initialize(ruby_values = nil, struct_value = nil) super(self.class.binding_type, ruby_values, struct_value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new()\n #This is a stub, used for indexing\n end", "def constructor; end", "def new\n \n end", "def new(*args)\n self.class.new(*args)\n end", "def new(*args)\n self.class.new(*args)\n end", "def new #:nodoc:\n end", "def construct\n end", "def initialize\n \n end", "def initialize() end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def new(opts = {})\n klass.new(opts)\n end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\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", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize()\n end", "def new\n self\n end", "def initialize\n end", "def new(*args)\n raise NoMethodError.new(\"You can not instaniate this class!\")\n end", "def new(*args) dup.initialize(*args) end", "def initialize()\n raise \"#{self.class.to_s} should not be instantiated directly.\"\n end", "def initialize\r\n\r\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n initialize!\n end", "def initialize\n initialize!\n end", "def initialize\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def new\n BaseObject.new(self)\n end", "def newInstance( params={} )\n model.new( params ).extend( InstanceMethods )\n end", "def initialize( * )\n super\n end", "def new(*args,&block)\n Base.new(*args,&block)\n end", "def initialize\n init\n end", "def initialize\n \n end", "def initialize\n \n end", "def new\n \n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def new\n new_with_value(nil)\n end", "def instantiate\n resource.new(data)\n end", "def new()\n trace(\"Instance #{index} created\")\n index += 1\n end" ]
[ "0.8045547", "0.8045547", "0.8045547", "0.8045547", "0.8045547", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.7991461", "0.785467", "0.7695489", "0.7688422", "0.7615257", "0.754397", "0.75422287", "0.7402954", "0.73675203", "0.7343034", "0.7343034", "0.7343034", "0.7343034", "0.7343034", "0.7343034", "0.7302681", "0.7258747", "0.7258747", "0.7258747", "0.7258747", "0.7258747", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71399224", "0.7129271", "0.71275824", "0.71158165", "0.7102901", "0.7093707", "0.70484614", "0.69906384", "0.69906384", "0.69906384", "0.69906384", "0.69906384", "0.69906384", "0.69906384", "0.6987927", "0.6987927", "0.697844", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.6961699", "0.6917308", "0.68943954", "0.68785733", "0.68759966", "0.686905", "0.686905", "0.68560094", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6851173", "0.6832223", "0.68299955" ]
0.0
-1
Converts from a string value (perhaps off the wire) to an instance of this enum type.
def from_string(value) const_get(value) rescue NameError DNSServerMode.send(:new, 'UNKNOWN', value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_string(value)\n const_get(value)\n rescue NameError\n Type.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n Type.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n Type.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n TransferStatus.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n EmulationType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n UserAccountStatus.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n State.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n State.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n ReturnStatus.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n MessageStatus.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n MessageStatus.send(:new, 'UNKNOWN', value)\n end", "def enum(value)\n EnumValue.new(value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n UserRole.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n ResultType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n TestStatus.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n TestStatus.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n SourceType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n ConnectionState.send(:new, 'UNKNOWN', value)\n end", "def __enum(value)\n EnumValue.new(value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n MacAddressType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n HostBusAdapterType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n HostBusAdapterType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n Category.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n Category.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n LocationType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n UserPasswordStatus.send(:new, 'UNKNOWN', value)\n end", "def build_from_hash(value)\n constantValues = CageType.constants.select { |c| CageType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #CageType\" if constantValues.empty?\n value\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n NetworkProtocol.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n DeviceAccessType.send(:new, 'UNKNOWN', value)\n end", "def build_from_hash(value)\n constantValues = ExchangeStatus.constants.select { |c| ExchangeStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ExchangeStatus\" if constantValues.empty?\n value\n end", "def visit_enum(binding_type)\n #VAPI.log.debug \"VERBOSE: visit_enum called - #{self.input}\"\n enum_string = self.input.value\n if binding_type.binding_class\n self.result = binding_type.binding_class.from_string(enum_string)\n else\n #TODO: port this to ruby\n #self.result = Enum.new(enum_string)\n self.result = enum_string\n end\n end", "def build_from_hash(value)\n constValues = ErrorCode.constants.select{|c| ErrorCode.const_get(c).value == value}\n raise \"Invalid ENUM value #{value} for class #ErrorCode\" if constValues.length != 1\n @value = ErrorCode.const_get(constValues[0]).value\n self\n end", "def build_from_hash(value)\n constantValues = ExternalOrderItemSourceTypeEnumModel.constants.select { |c| ExternalOrderItemSourceTypeEnumModel::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ExternalOrderItemSourceTypeEnumModel\" if constantValues.empty?\n value\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackupRestoreProcessState.send(:new, 'UNKNOWN', value)\n end", "def build_from_hash(value)\n constantValues = BarcodeType.constants.select { |c| BarcodeType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #BarcodeType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = TransactionTypeEnumModel.constants.select { |c| TransactionTypeEnumModel::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #TransactionTypeEnumModel\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n constantValues = RequestType.constants.select { |c| RequestType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #RequestType\" if constantValues.empty?\n value\n end", "def enum(name)\n name = name.to_sym\n\n enum_info = ENUMS[name]\n if enum_info.nil?\n raise ArgumentError, sprintf('No enum found with name %s', name)\n end\n\n require_path = sprintf(ENUM_PATH, @path_version, enum_info.first)\n require require_path\n\n class_path = sprintf(ENUM_CLASS_PATH, @version, enum_info.last,\n enum_info.last)\n return class_for_path(class_path)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n DiskProvisioningType.send(:new, 'UNKNOWN', value)\n end", "def build_from_hash(value)\n constantValues = ChargeType.constants.select { |c| ChargeType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ChargeType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ContactType.constants.select { |c| ContactType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ContactType\" if constantValues.empty?\n value\n end", "def init(name, value, define_constant = false)\n @values ||= {}\n @symbols ||= []\n\n s = name.to_sym\n\n n = s.to_s\n n_lc = n.downcase\n raise ArgumentError.new(\"Key #{s} is not lower case\") if n != n_lc\n raise ArgumentError.new(\"Key #{s} already defined\") if @values.key? name\n\n val = value.to_i\n if @values.key? val\n # This is a new alias for an existing value\n enum_val = @values[val]\n enum_val.instance_eval { @aliases << s }\n else\n enum_val = new(s, val)\n @values[val] = enum_val\n end\n\n @values[s] = enum_val\n @symbols << s\n\n const_set s.to_s.upcase, enum_val if define_constant\n\n enum_val\n end", "def build_from_hash(value)\n constantValues = NewOrResale.constants.select { |c| NewOrResale::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #NewOrResale\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = CorporateType.constants.select { |c| CorporateType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #CorporateType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ObjectType.constants.select { |c| ObjectType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ObjectType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = MessageStatus.constants.select { |c| MessageStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #MessageStatus\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = BrokerAccountType.constants.select { |c| BrokerAccountType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #BrokerAccountType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ContentEncoding.constants.select { |c| ContentEncoding::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ContentEncoding\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ColorType.constants.select { |c| ColorType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ColorType\" if constantValues.empty?\n value\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n FirewallRulePolicy.send(:new, 'UNKNOWN', value)\n end", "def build_from_hash(value)\n constantValues = PropertyType.constants.select { |c| PropertyType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #PropertyType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = OperationStatus.constants.select { |c| OperationStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #OperationStatus\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = FrontendState.constants.select { |c| FrontendState::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #FrontendState\" if constantValues.empty?\n value\n end", "def new(value)\n\t\t\treturn @enumvalues[value] if @enumvalues.has_key? value\n\t\t\t_setup_enumvalue(value, value, allocate)\n\t\tend", "def build_from_hash(value)\n constantValues = TransactionType.constants.select { |c| TransactionType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #TransactionType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ConnectionStatus.constants.select { |c| ConnectionStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ConnectionStatus\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = OrderStatus.constants.select { |c| OrderStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #OrderStatus\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = AnnotationType.constants.select { |c| AnnotationType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #AnnotationType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = Channel.constants.select { |c| Channel::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #Channel\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = BroadcastResolution.constants.select { |c| BroadcastResolution::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #BroadcastResolution\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ReferenceTypeId.constants.select { |c| ReferenceTypeId::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ReferenceTypeId\" if constantValues.empty?\n value\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n ChecksumAlgorithm.send(:new, 'UNKNOWN', value)\n end", "def build_from_hash(value)\n constantValues = Chain.constants.select { |c| Chain::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #Chain\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ErrorCodeOmnichannelMachine.constants.select { |c| ErrorCodeOmnichannelMachine::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ErrorCodeOmnichannelMachine\" if constantValues.empty?\n value\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n IpAllocationScheme.send(:new, 'UNKNOWN', value)\n end", "def initialize(type)\n unless type.is_a?(GraphQL::EnumType)\n raise \"expected type to be a GraphQL::EnumType, but was #{type.class}\"\n end\n\n @type = type\n @values = {}\n\n all_values = type.values.keys\n\n all_values.each do |value|\n str = value.dup\n all_values.each do |v|\n str.define_singleton_method(\"#{v.downcase}?\") { false }\n end\n str.define_singleton_method(\"#{value.downcase}?\") { true }\n str.freeze\n const_set(value, str) if value =~ /^[A-Z]/\n @values[str] = str\n end\n\n @values.freeze\n end", "def parse_enum_if_enum(klass,property_name,value)\n type = klass.to_clr_type.get_property(classify(property_name.to_s)).property_type\n type.is_enum ? Enum.parse(type, classify(value.to_s)) : value\n end", "def parse_enum_if_enum(klass,property_name,value)\n type = klass.to_clr_type.get_property(classify(property_name.to_s)).property_type\n type.is_enum ? Enum.parse(type, classify(value.to_s)) : value\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n IpProtocol.send(:new, 'UNKNOWN', value)\n end", "def build_from_hash(value)\n constantValues = ResponseErrorCode.constants.select { |c| ResponseErrorCode::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ResponseErrorCode\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = CorrectCodeType.constants.select { |c| CorrectCodeType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #CorrectCodeType\" if constantValues.empty?\n value\n end", "def enum(value)\n @enum = value\n end", "def build_from_hash(value)\n constantValues = CurrencyCode.constants.select { |c| CurrencyCode::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #CurrencyCode\" if constantValues.empty?\n value\n end", "def get_string_enum\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/enum'\n _query_builder = APIHelper.append_url_with_query_parameters(\n _query_builder,\n 'type' => 'string'\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n _response.raw_body\n end", "def build_from_hash(value)\n constantValues = GSuiteBuiltinTranslation.constants.select{|c| GSuiteBuiltinTranslation::const_get(c) == value}\n raise \"Invalid ENUM value #{value} for class #GSuiteBuiltinTranslation\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ContentModuleType.constants.select { |c| ContentModuleType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ContentModuleType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = SchemaFieldMode.constants.select { |c| SchemaFieldMode::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #SchemaFieldMode\" if constantValues.empty?\n value\n end", "def from_string(string)\n from_bits(*Builder::FromString.new(string).bits)\n end", "def build_from_hash(value)\n constantValues = PaymentAccountSchemeName.constants.select { |c| PaymentAccountSchemeName::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #PaymentAccountSchemeName\" if constantValues.empty?\n value\n end", "def typecast_to_class(value)\n value.to_s.constantize\n rescue NameError\n nil\n end", "def build_from_hash(value)\n constantValues = LedColor.constants.select { |c| LedColor::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #LedColor\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = DaemonState.constants.select { |c| DaemonState::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #DaemonState\" if constantValues.empty?\n value\n end", "def visit_enum(binding_type)\n if not input.is_a? Enum\n # TODO: Verify if the value is instance of actual binding class\n report_error('vapi.bindings.typeconverter.unexpected.ruby.type',\n Enum, input.class)\n end\n self.result = binding_type.definition.new_value(input)\n end" ]
[ "0.7495569", "0.7495569", "0.74386185", "0.7192527", "0.70895386", "0.70895386", "0.70895386", "0.70895386", "0.70895386", "0.70895386", "0.70865124", "0.7032917", "0.7008576", "0.7008576", "0.6892211", "0.68670857", "0.68670857", "0.6845763", "0.67862046", "0.67834616", "0.67317176", "0.67317176", "0.6626145", "0.6623483", "0.6587726", "0.6570122", "0.6560128", "0.6560128", "0.6523066", "0.6523066", "0.6440003", "0.64347", "0.6383892", "0.631073", "0.62975895", "0.6289992", "0.6224352", "0.62070024", "0.61878854", "0.6153309", "0.61519605", "0.61021245", "0.6090049", "0.6090049", "0.6090049", "0.6090049", "0.6090049", "0.6090049", "0.6090049", "0.6090049", "0.6090049", "0.6090049", "0.6090049", "0.6070621", "0.6067047", "0.60586566", "0.60266054", "0.60249317", "0.60124695", "0.597689", "0.597451", "0.59738004", "0.597335", "0.5960258", "0.5954248", "0.59469056", "0.5914334", "0.5911726", "0.59109616", "0.5890434", "0.58877355", "0.58855563", "0.5878038", "0.58727354", "0.58688056", "0.58618134", "0.58368", "0.5817062", "0.580678", "0.58009994", "0.579926", "0.579789", "0.5797573", "0.5793261", "0.5793261", "0.5786068", "0.57750267", "0.5770232", "0.5755376", "0.57473993", "0.5746361", "0.5738399", "0.5731196", "0.57240444", "0.5716732", "0.57119083", "0.5704418", "0.5703874", "0.5679791", "0.5655619" ]
0.5926311
66
Constructs a new instance.
def initialize(value, unknown = nil) super(self.class.binding_type, value, unknown) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new()\n #This is a stub, used for indexing\n end", "def constructor; end", "def new\n \n end", "def new(*args)\n self.class.new(*args)\n end", "def new(*args)\n self.class.new(*args)\n end", "def new #:nodoc:\n end", "def construct\n end", "def initialize\n \n end", "def initialize() end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def new(opts = {})\n klass.new(opts)\n end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\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", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize()\n end", "def new\n self\n end", "def initialize\n end", "def new(*args)\n raise NoMethodError.new(\"You can not instaniate this class!\")\n end", "def new(*args) dup.initialize(*args) end", "def initialize()\n raise \"#{self.class.to_s} should not be instantiated directly.\"\n end", "def initialize\r\n\r\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n initialize!\n end", "def initialize\n initialize!\n end", "def initialize\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def new\n BaseObject.new(self)\n end", "def newInstance( params={} )\n model.new( params ).extend( InstanceMethods )\n end", "def initialize( * )\n super\n end", "def new(*args,&block)\n Base.new(*args,&block)\n end", "def initialize\n init\n end", "def initialize\n \n end", "def initialize\n \n end", "def new\n \n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def new\n new_with_value(nil)\n end", "def instantiate\n resource.new(data)\n end", "def new()\n trace(\"Instance #{index} created\")\n index += 1\n end" ]
[ "0.80456895", "0.80456895", "0.80456895", "0.80456895", "0.80456895", "0.8043627", "0.8043627", "0.8043627", "0.8043627", "0.8043627", "0.8043627", "0.8043627", "0.8043627", "0.8043627", "0.79921883", "0.7854048", "0.7695342", "0.76886445", "0.76153916", "0.754372", "0.75409234", "0.74029356", "0.7367339", "0.7343057", "0.7343057", "0.7343057", "0.7343057", "0.7343057", "0.7343057", "0.73030764", "0.7258721", "0.7258721", "0.7258721", "0.7258721", "0.7258721", "0.72416604", "0.72416604", "0.72416604", "0.72416604", "0.72416604", "0.72416604", "0.72416604", "0.72416604", "0.72416604", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.7139949", "0.71289563", "0.7127605", "0.7115569", "0.71032614", "0.7093564", "0.7048321", "0.6990373", "0.6990373", "0.6990373", "0.6990373", "0.6990373", "0.6990373", "0.6990373", "0.69875544", "0.69875544", "0.697815", "0.69634074", "0.69634074", "0.69634074", "0.69634074", "0.69634074", "0.69634074", "0.69634074", "0.69634074", "0.6960778", "0.6917359", "0.6894451", "0.68780726", "0.68758", "0.68689096", "0.68689096", "0.6855974", "0.6854572", "0.6854572", "0.6854572", "0.6854572", "0.6854572", "0.6854572", "0.6854572", "0.6854572", "0.6854572", "0.6854572", "0.68507713", "0.6832209", "0.6830385" ]
0.0
-1
Converts from a string value (perhaps off the wire) to an instance of this enum type.
def from_string(value) const_get(value) rescue NameError TestStatus.send(:new, 'UNKNOWN', value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_string(value)\n const_get(value)\n rescue NameError\n Type.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n Type.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n Type.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n TransferStatus.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n EmulationType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n UserAccountStatus.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n State.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n State.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n ReturnStatus.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n MessageStatus.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n MessageStatus.send(:new, 'UNKNOWN', value)\n end", "def enum(value)\n EnumValue.new(value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n UserRole.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n ResultType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n SourceType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n ConnectionState.send(:new, 'UNKNOWN', value)\n end", "def __enum(value)\n EnumValue.new(value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n MacAddressType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n HostBusAdapterType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n HostBusAdapterType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n Category.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n Category.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n LocationType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n UserPasswordStatus.send(:new, 'UNKNOWN', value)\n end", "def build_from_hash(value)\n constantValues = CageType.constants.select { |c| CageType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #CageType\" if constantValues.empty?\n value\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n NetworkProtocol.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n DeviceAccessType.send(:new, 'UNKNOWN', value)\n end", "def build_from_hash(value)\n constantValues = ExchangeStatus.constants.select { |c| ExchangeStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ExchangeStatus\" if constantValues.empty?\n value\n end", "def visit_enum(binding_type)\n #VAPI.log.debug \"VERBOSE: visit_enum called - #{self.input}\"\n enum_string = self.input.value\n if binding_type.binding_class\n self.result = binding_type.binding_class.from_string(enum_string)\n else\n #TODO: port this to ruby\n #self.result = Enum.new(enum_string)\n self.result = enum_string\n end\n end", "def build_from_hash(value)\n constValues = ErrorCode.constants.select{|c| ErrorCode.const_get(c).value == value}\n raise \"Invalid ENUM value #{value} for class #ErrorCode\" if constValues.length != 1\n @value = ErrorCode.const_get(constValues[0]).value\n self\n end", "def build_from_hash(value)\n constantValues = ExternalOrderItemSourceTypeEnumModel.constants.select { |c| ExternalOrderItemSourceTypeEnumModel::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ExternalOrderItemSourceTypeEnumModel\" if constantValues.empty?\n value\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackupRestoreProcessState.send(:new, 'UNKNOWN', value)\n end", "def build_from_hash(value)\n constantValues = BarcodeType.constants.select { |c| BarcodeType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #BarcodeType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = TransactionTypeEnumModel.constants.select { |c| TransactionTypeEnumModel::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #TransactionTypeEnumModel\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n constantValues = RequestType.constants.select { |c| RequestType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #RequestType\" if constantValues.empty?\n value\n end", "def enum(name)\n name = name.to_sym\n\n enum_info = ENUMS[name]\n if enum_info.nil?\n raise ArgumentError, sprintf('No enum found with name %s', name)\n end\n\n require_path = sprintf(ENUM_PATH, @path_version, enum_info.first)\n require require_path\n\n class_path = sprintf(ENUM_CLASS_PATH, @version, enum_info.last,\n enum_info.last)\n return class_for_path(class_path)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n DiskProvisioningType.send(:new, 'UNKNOWN', value)\n end", "def build_from_hash(value)\n constantValues = ChargeType.constants.select { |c| ChargeType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ChargeType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ContactType.constants.select { |c| ContactType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ContactType\" if constantValues.empty?\n value\n end", "def init(name, value, define_constant = false)\n @values ||= {}\n @symbols ||= []\n\n s = name.to_sym\n\n n = s.to_s\n n_lc = n.downcase\n raise ArgumentError.new(\"Key #{s} is not lower case\") if n != n_lc\n raise ArgumentError.new(\"Key #{s} already defined\") if @values.key? name\n\n val = value.to_i\n if @values.key? val\n # This is a new alias for an existing value\n enum_val = @values[val]\n enum_val.instance_eval { @aliases << s }\n else\n enum_val = new(s, val)\n @values[val] = enum_val\n end\n\n @values[s] = enum_val\n @symbols << s\n\n const_set s.to_s.upcase, enum_val if define_constant\n\n enum_val\n end", "def build_from_hash(value)\n constantValues = NewOrResale.constants.select { |c| NewOrResale::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #NewOrResale\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = MessageStatus.constants.select { |c| MessageStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #MessageStatus\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = CorporateType.constants.select { |c| CorporateType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #CorporateType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ObjectType.constants.select { |c| ObjectType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ObjectType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = BrokerAccountType.constants.select { |c| BrokerAccountType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #BrokerAccountType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ContentEncoding.constants.select { |c| ContentEncoding::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ContentEncoding\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ColorType.constants.select { |c| ColorType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ColorType\" if constantValues.empty?\n value\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n DNSServerMode.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n FirewallRulePolicy.send(:new, 'UNKNOWN', value)\n end", "def build_from_hash(value)\n constantValues = OperationStatus.constants.select { |c| OperationStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #OperationStatus\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = PropertyType.constants.select { |c| PropertyType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #PropertyType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = FrontendState.constants.select { |c| FrontendState::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #FrontendState\" if constantValues.empty?\n value\n end", "def new(value)\n\t\t\treturn @enumvalues[value] if @enumvalues.has_key? value\n\t\t\t_setup_enumvalue(value, value, allocate)\n\t\tend", "def build_from_hash(value)\n constantValues = TransactionType.constants.select { |c| TransactionType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #TransactionType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ConnectionStatus.constants.select { |c| ConnectionStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ConnectionStatus\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = OrderStatus.constants.select { |c| OrderStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #OrderStatus\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = AnnotationType.constants.select { |c| AnnotationType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #AnnotationType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = Channel.constants.select { |c| Channel::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #Channel\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = BroadcastResolution.constants.select { |c| BroadcastResolution::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #BroadcastResolution\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ReferenceTypeId.constants.select { |c| ReferenceTypeId::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ReferenceTypeId\" if constantValues.empty?\n value\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n ChecksumAlgorithm.send(:new, 'UNKNOWN', value)\n end", "def build_from_hash(value)\n constantValues = Chain.constants.select { |c| Chain::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #Chain\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ErrorCodeOmnichannelMachine.constants.select { |c| ErrorCodeOmnichannelMachine::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ErrorCodeOmnichannelMachine\" if constantValues.empty?\n value\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n IpAllocationScheme.send(:new, 'UNKNOWN', value)\n end", "def initialize(type)\n unless type.is_a?(GraphQL::EnumType)\n raise \"expected type to be a GraphQL::EnumType, but was #{type.class}\"\n end\n\n @type = type\n @values = {}\n\n all_values = type.values.keys\n\n all_values.each do |value|\n str = value.dup\n all_values.each do |v|\n str.define_singleton_method(\"#{v.downcase}?\") { false }\n end\n str.define_singleton_method(\"#{value.downcase}?\") { true }\n str.freeze\n const_set(value, str) if value =~ /^[A-Z]/\n @values[str] = str\n end\n\n @values.freeze\n end", "def parse_enum_if_enum(klass,property_name,value)\n type = klass.to_clr_type.get_property(classify(property_name.to_s)).property_type\n type.is_enum ? Enum.parse(type, classify(value.to_s)) : value\n end", "def parse_enum_if_enum(klass,property_name,value)\n type = klass.to_clr_type.get_property(classify(property_name.to_s)).property_type\n type.is_enum ? Enum.parse(type, classify(value.to_s)) : value\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n IpProtocol.send(:new, 'UNKNOWN', value)\n end", "def build_from_hash(value)\n constantValues = ResponseErrorCode.constants.select { |c| ResponseErrorCode::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ResponseErrorCode\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = CorrectCodeType.constants.select { |c| CorrectCodeType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #CorrectCodeType\" if constantValues.empty?\n value\n end", "def enum(value)\n @enum = value\n end", "def get_string_enum\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/enum'\n _query_builder = APIHelper.append_url_with_query_parameters(\n _query_builder,\n 'type' => 'string'\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n _response.raw_body\n end", "def build_from_hash(value)\n constantValues = CurrencyCode.constants.select { |c| CurrencyCode::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #CurrencyCode\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = GSuiteBuiltinTranslation.constants.select{|c| GSuiteBuiltinTranslation::const_get(c) == value}\n raise \"Invalid ENUM value #{value} for class #GSuiteBuiltinTranslation\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ContentModuleType.constants.select { |c| ContentModuleType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ContentModuleType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = SchemaFieldMode.constants.select { |c| SchemaFieldMode::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #SchemaFieldMode\" if constantValues.empty?\n value\n end", "def from_string(string)\n from_bits(*Builder::FromString.new(string).bits)\n end", "def build_from_hash(value)\n constantValues = PaymentAccountSchemeName.constants.select { |c| PaymentAccountSchemeName::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #PaymentAccountSchemeName\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = LedColor.constants.select { |c| LedColor::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #LedColor\" if constantValues.empty?\n value\n end", "def typecast_to_class(value)\n value.to_s.constantize\n rescue NameError\n nil\n end", "def build_from_hash(value)\n constantValues = DaemonState.constants.select { |c| DaemonState::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #DaemonState\" if constantValues.empty?\n value\n end", "def visit_enum(binding_type)\n if not input.is_a? Enum\n # TODO: Verify if the value is instance of actual binding class\n report_error('vapi.bindings.typeconverter.unexpected.ruby.type',\n Enum, input.class)\n end\n self.result = binding_type.definition.new_value(input)\n end" ]
[ "0.7493947", "0.7493947", "0.7436984", "0.7192308", "0.7087891", "0.7087891", "0.7087891", "0.7087891", "0.7087891", "0.7087891", "0.7085152", "0.7032823", "0.7008514", "0.7008514", "0.68929034", "0.68672293", "0.68672293", "0.684477", "0.6785868", "0.6783008", "0.662472", "0.6622807", "0.6586578", "0.65692025", "0.6558584", "0.6558584", "0.65226483", "0.65226483", "0.64392656", "0.64343524", "0.63828945", "0.6309026", "0.629687", "0.6290214", "0.62243366", "0.6206861", "0.6187289", "0.615336", "0.61515194", "0.6100904", "0.60892236", "0.60892236", "0.60892236", "0.60892236", "0.60892236", "0.60892236", "0.60892236", "0.60892236", "0.60892236", "0.60892236", "0.60892236", "0.6069717", "0.6066953", "0.6057812", "0.60257417", "0.60236806", "0.60129744", "0.5976285", "0.5973202", "0.59731096", "0.5972036", "0.59593856", "0.5953515", "0.5946986", "0.5924605", "0.591284", "0.59112847", "0.591025", "0.58901024", "0.5887028", "0.58845437", "0.58776456", "0.5872741", "0.5867786", "0.5861292", "0.58361304", "0.5816374", "0.5807206", "0.5800698", "0.5799446", "0.57976073", "0.57969695", "0.57934797", "0.57934797", "0.5784765", "0.5775434", "0.5770217", "0.57546335", "0.574751", "0.57471", "0.5737496", "0.57301253", "0.5722539", "0.57173336", "0.57116777", "0.57040775", "0.5700769", "0.5679229", "0.5654201" ]
0.67318434
20
Constructs a new instance.
def initialize(value, unknown = nil) super(self.class.binding_type, value, unknown) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new()\n #This is a stub, used for indexing\n end", "def constructor; end", "def new\n \n end", "def new(*args)\n self.class.new(*args)\n end", "def new(*args)\n self.class.new(*args)\n end", "def new #:nodoc:\n end", "def construct\n end", "def initialize\n \n end", "def initialize() end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def new(opts = {})\n klass.new(opts)\n end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\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", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize()\n end", "def new\n self\n end", "def initialize\n end", "def new(*args)\n raise NoMethodError.new(\"You can not instaniate this class!\")\n end", "def new(*args) dup.initialize(*args) end", "def initialize()\n raise \"#{self.class.to_s} should not be instantiated directly.\"\n end", "def initialize\r\n\r\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n initialize!\n end", "def initialize\n initialize!\n end", "def initialize\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def new\n BaseObject.new(self)\n end", "def newInstance( params={} )\n model.new( params ).extend( InstanceMethods )\n end", "def initialize( * )\n super\n end", "def new(*args,&block)\n Base.new(*args,&block)\n end", "def initialize\n init\n end", "def initialize\n \n end", "def initialize\n \n end", "def new\n \n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def new\n new_with_value(nil)\n end", "def instantiate\n resource.new(data)\n end", "def new()\n trace(\"Instance #{index} created\")\n index += 1\n end" ]
[ "0.8045547", "0.8045547", "0.8045547", "0.8045547", "0.8045547", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.80440617", "0.7991461", "0.785467", "0.7695489", "0.7688422", "0.7615257", "0.754397", "0.75422287", "0.7402954", "0.73675203", "0.7343034", "0.7343034", "0.7343034", "0.7343034", "0.7343034", "0.7343034", "0.7302681", "0.7258747", "0.7258747", "0.7258747", "0.7258747", "0.7258747", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.7241807", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71855557", "0.71399224", "0.7129271", "0.71275824", "0.71158165", "0.7102901", "0.7093707", "0.70484614", "0.69906384", "0.69906384", "0.69906384", "0.69906384", "0.69906384", "0.69906384", "0.69906384", "0.6987927", "0.6987927", "0.697844", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.69636047", "0.6961699", "0.6917308", "0.68943954", "0.68785733", "0.68759966", "0.686905", "0.686905", "0.68560094", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6854784", "0.6851173", "0.6832223", "0.68299955" ]
0.0
-1
Converts from a string value (perhaps off the wire) to an instance of this enum type.
def from_string(value) const_get(value) rescue NameError MessageStatus.send(:new, 'UNKNOWN', value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_string(value)\n const_get(value)\n rescue NameError\n Type.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n Type.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n Type.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n TransferStatus.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n EmulationType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n UserAccountStatus.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n State.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n State.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n ReturnStatus.send(:new, 'UNKNOWN', value)\n end", "def enum(value)\n EnumValue.new(value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n UserRole.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n ResultType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n TestStatus.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n TestStatus.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n SourceType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n ConnectionState.send(:new, 'UNKNOWN', value)\n end", "def __enum(value)\n EnumValue.new(value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n MacAddressType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n HostBusAdapterType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n HostBusAdapterType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n Category.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n Category.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n LocationType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n UserPasswordStatus.send(:new, 'UNKNOWN', value)\n end", "def build_from_hash(value)\n constantValues = CageType.constants.select { |c| CageType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #CageType\" if constantValues.empty?\n value\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n NetworkProtocol.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n DeviceAccessType.send(:new, 'UNKNOWN', value)\n end", "def build_from_hash(value)\n constantValues = ExchangeStatus.constants.select { |c| ExchangeStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ExchangeStatus\" if constantValues.empty?\n value\n end", "def visit_enum(binding_type)\n #VAPI.log.debug \"VERBOSE: visit_enum called - #{self.input}\"\n enum_string = self.input.value\n if binding_type.binding_class\n self.result = binding_type.binding_class.from_string(enum_string)\n else\n #TODO: port this to ruby\n #self.result = Enum.new(enum_string)\n self.result = enum_string\n end\n end", "def build_from_hash(value)\n constValues = ErrorCode.constants.select{|c| ErrorCode.const_get(c).value == value}\n raise \"Invalid ENUM value #{value} for class #ErrorCode\" if constValues.length != 1\n @value = ErrorCode.const_get(constValues[0]).value\n self\n end", "def build_from_hash(value)\n constantValues = ExternalOrderItemSourceTypeEnumModel.constants.select { |c| ExternalOrderItemSourceTypeEnumModel::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ExternalOrderItemSourceTypeEnumModel\" if constantValues.empty?\n value\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackupRestoreProcessState.send(:new, 'UNKNOWN', value)\n end", "def build_from_hash(value)\n constantValues = BarcodeType.constants.select { |c| BarcodeType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #BarcodeType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = TransactionTypeEnumModel.constants.select { |c| TransactionTypeEnumModel::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #TransactionTypeEnumModel\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n constantValues = RequestType.constants.select { |c| RequestType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #RequestType\" if constantValues.empty?\n value\n end", "def enum(name)\n name = name.to_sym\n\n enum_info = ENUMS[name]\n if enum_info.nil?\n raise ArgumentError, sprintf('No enum found with name %s', name)\n end\n\n require_path = sprintf(ENUM_PATH, @path_version, enum_info.first)\n require require_path\n\n class_path = sprintf(ENUM_CLASS_PATH, @version, enum_info.last,\n enum_info.last)\n return class_for_path(class_path)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n DiskProvisioningType.send(:new, 'UNKNOWN', value)\n end", "def build_from_hash(value)\n constantValues = ChargeType.constants.select { |c| ChargeType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ChargeType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ContactType.constants.select { |c| ContactType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ContactType\" if constantValues.empty?\n value\n end", "def init(name, value, define_constant = false)\n @values ||= {}\n @symbols ||= []\n\n s = name.to_sym\n\n n = s.to_s\n n_lc = n.downcase\n raise ArgumentError.new(\"Key #{s} is not lower case\") if n != n_lc\n raise ArgumentError.new(\"Key #{s} already defined\") if @values.key? name\n\n val = value.to_i\n if @values.key? val\n # This is a new alias for an existing value\n enum_val = @values[val]\n enum_val.instance_eval { @aliases << s }\n else\n enum_val = new(s, val)\n @values[val] = enum_val\n end\n\n @values[s] = enum_val\n @symbols << s\n\n const_set s.to_s.upcase, enum_val if define_constant\n\n enum_val\n end", "def build_from_hash(value)\n constantValues = NewOrResale.constants.select { |c| NewOrResale::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #NewOrResale\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = CorporateType.constants.select { |c| CorporateType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #CorporateType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ObjectType.constants.select { |c| ObjectType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ObjectType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = MessageStatus.constants.select { |c| MessageStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #MessageStatus\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = BrokerAccountType.constants.select { |c| BrokerAccountType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #BrokerAccountType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ContentEncoding.constants.select { |c| ContentEncoding::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ContentEncoding\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ColorType.constants.select { |c| ColorType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ColorType\" if constantValues.empty?\n value\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n DNSServerMode.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n FirewallRulePolicy.send(:new, 'UNKNOWN', value)\n end", "def build_from_hash(value)\n constantValues = PropertyType.constants.select { |c| PropertyType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #PropertyType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = OperationStatus.constants.select { |c| OperationStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #OperationStatus\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = FrontendState.constants.select { |c| FrontendState::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #FrontendState\" if constantValues.empty?\n value\n end", "def new(value)\n\t\t\treturn @enumvalues[value] if @enumvalues.has_key? value\n\t\t\t_setup_enumvalue(value, value, allocate)\n\t\tend", "def build_from_hash(value)\n constantValues = TransactionType.constants.select { |c| TransactionType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #TransactionType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ConnectionStatus.constants.select { |c| ConnectionStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ConnectionStatus\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = OrderStatus.constants.select { |c| OrderStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #OrderStatus\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = AnnotationType.constants.select { |c| AnnotationType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #AnnotationType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = Channel.constants.select { |c| Channel::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #Channel\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = BroadcastResolution.constants.select { |c| BroadcastResolution::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #BroadcastResolution\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ReferenceTypeId.constants.select { |c| ReferenceTypeId::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ReferenceTypeId\" if constantValues.empty?\n value\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n ChecksumAlgorithm.send(:new, 'UNKNOWN', value)\n end", "def build_from_hash(value)\n constantValues = Chain.constants.select { |c| Chain::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #Chain\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ErrorCodeOmnichannelMachine.constants.select { |c| ErrorCodeOmnichannelMachine::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ErrorCodeOmnichannelMachine\" if constantValues.empty?\n value\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n IpAllocationScheme.send(:new, 'UNKNOWN', value)\n end", "def initialize(type)\n unless type.is_a?(GraphQL::EnumType)\n raise \"expected type to be a GraphQL::EnumType, but was #{type.class}\"\n end\n\n @type = type\n @values = {}\n\n all_values = type.values.keys\n\n all_values.each do |value|\n str = value.dup\n all_values.each do |v|\n str.define_singleton_method(\"#{v.downcase}?\") { false }\n end\n str.define_singleton_method(\"#{value.downcase}?\") { true }\n str.freeze\n const_set(value, str) if value =~ /^[A-Z]/\n @values[str] = str\n end\n\n @values.freeze\n end", "def parse_enum_if_enum(klass,property_name,value)\n type = klass.to_clr_type.get_property(classify(property_name.to_s)).property_type\n type.is_enum ? Enum.parse(type, classify(value.to_s)) : value\n end", "def parse_enum_if_enum(klass,property_name,value)\n type = klass.to_clr_type.get_property(classify(property_name.to_s)).property_type\n type.is_enum ? Enum.parse(type, classify(value.to_s)) : value\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n IpProtocol.send(:new, 'UNKNOWN', value)\n end", "def build_from_hash(value)\n constantValues = ResponseErrorCode.constants.select { |c| ResponseErrorCode::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ResponseErrorCode\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = CorrectCodeType.constants.select { |c| CorrectCodeType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #CorrectCodeType\" if constantValues.empty?\n value\n end", "def enum(value)\n @enum = value\n end", "def build_from_hash(value)\n constantValues = CurrencyCode.constants.select { |c| CurrencyCode::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #CurrencyCode\" if constantValues.empty?\n value\n end", "def get_string_enum\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/enum'\n _query_builder = APIHelper.append_url_with_query_parameters(\n _query_builder,\n 'type' => 'string'\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n _response.raw_body\n end", "def build_from_hash(value)\n constantValues = GSuiteBuiltinTranslation.constants.select{|c| GSuiteBuiltinTranslation::const_get(c) == value}\n raise \"Invalid ENUM value #{value} for class #GSuiteBuiltinTranslation\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = ContentModuleType.constants.select { |c| ContentModuleType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ContentModuleType\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = SchemaFieldMode.constants.select { |c| SchemaFieldMode::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #SchemaFieldMode\" if constantValues.empty?\n value\n end", "def from_string(string)\n from_bits(*Builder::FromString.new(string).bits)\n end", "def build_from_hash(value)\n constantValues = PaymentAccountSchemeName.constants.select { |c| PaymentAccountSchemeName::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #PaymentAccountSchemeName\" if constantValues.empty?\n value\n end", "def typecast_to_class(value)\n value.to_s.constantize\n rescue NameError\n nil\n end", "def build_from_hash(value)\n constantValues = LedColor.constants.select { |c| LedColor::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #LedColor\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = DaemonState.constants.select { |c| DaemonState::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #DaemonState\" if constantValues.empty?\n value\n end", "def visit_enum(binding_type)\n if not input.is_a? Enum\n # TODO: Verify if the value is instance of actual binding class\n report_error('vapi.bindings.typeconverter.unexpected.ruby.type',\n Enum, input.class)\n end\n self.result = binding_type.definition.new_value(input)\n end" ]
[ "0.7495569", "0.7495569", "0.74386185", "0.7192527", "0.70895386", "0.70895386", "0.70895386", "0.70895386", "0.70895386", "0.70895386", "0.70865124", "0.7032917", "0.7008576", "0.7008576", "0.6892211", "0.6845763", "0.67862046", "0.67834616", "0.67317176", "0.67317176", "0.6626145", "0.6623483", "0.6587726", "0.6570122", "0.6560128", "0.6560128", "0.6523066", "0.6523066", "0.6440003", "0.64347", "0.6383892", "0.631073", "0.62975895", "0.6289992", "0.6224352", "0.62070024", "0.61878854", "0.6153309", "0.61519605", "0.61021245", "0.6090049", "0.6090049", "0.6090049", "0.6090049", "0.6090049", "0.6090049", "0.6090049", "0.6090049", "0.6090049", "0.6090049", "0.6090049", "0.6070621", "0.6067047", "0.60586566", "0.60266054", "0.60249317", "0.60124695", "0.597689", "0.597451", "0.59738004", "0.597335", "0.5960258", "0.5954248", "0.59469056", "0.5926311", "0.5914334", "0.5911726", "0.59109616", "0.5890434", "0.58877355", "0.58855563", "0.5878038", "0.58727354", "0.58688056", "0.58618134", "0.58368", "0.5817062", "0.580678", "0.58009994", "0.579926", "0.579789", "0.5797573", "0.5793261", "0.5793261", "0.5786068", "0.57750267", "0.5770232", "0.5755376", "0.57473993", "0.5746361", "0.5738399", "0.5731196", "0.57240444", "0.5716732", "0.57119083", "0.5704418", "0.5703874", "0.5679791", "0.5655619" ]
0.68670857
15
Constructs a new instance.
def initialize(value, unknown = nil) super(self.class.binding_type, value, unknown) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new()\n #This is a stub, used for indexing\n end", "def constructor; end", "def new\n \n end", "def new(*args)\n self.class.new(*args)\n end", "def new(*args)\n self.class.new(*args)\n end", "def new #:nodoc:\n end", "def construct\n end", "def initialize\n \n end", "def initialize() end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def new(opts = {})\n klass.new(opts)\n end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\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", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize()\n end", "def new\n self\n end", "def initialize\n end", "def new(*args)\n raise NoMethodError.new(\"You can not instaniate this class!\")\n end", "def new(*args) dup.initialize(*args) end", "def initialize()\n raise \"#{self.class.to_s} should not be instantiated directly.\"\n end", "def initialize\r\n\r\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n initialize!\n end", "def initialize\n initialize!\n end", "def initialize\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def new\n BaseObject.new(self)\n end", "def newInstance( params={} )\n model.new( params ).extend( InstanceMethods )\n end", "def initialize( * )\n super\n end", "def new(*args,&block)\n Base.new(*args,&block)\n end", "def initialize\n init\n end", "def initialize\n \n end", "def initialize\n \n end", "def new\n \n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def new\n new_with_value(nil)\n end", "def instantiate\n resource.new(data)\n end", "def new()\n trace(\"Instance #{index} created\")\n index += 1\n end" ]
[ "0.80456895", "0.80456895", "0.80456895", "0.80456895", "0.80456895", "0.8043627", "0.8043627", "0.8043627", "0.8043627", "0.8043627", "0.8043627", "0.8043627", "0.8043627", "0.8043627", "0.79921883", "0.7854048", "0.7695342", "0.76886445", "0.76153916", "0.754372", "0.75409234", "0.74029356", "0.7367339", "0.7343057", "0.7343057", "0.7343057", "0.7343057", "0.7343057", "0.7343057", "0.73030764", "0.7258721", "0.7258721", "0.7258721", "0.7258721", "0.7258721", "0.72416604", "0.72416604", "0.72416604", "0.72416604", "0.72416604", "0.72416604", "0.72416604", "0.72416604", "0.72416604", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.71852785", "0.7139949", "0.71289563", "0.7127605", "0.7115569", "0.71032614", "0.7093564", "0.7048321", "0.6990373", "0.6990373", "0.6990373", "0.6990373", "0.6990373", "0.6990373", "0.6990373", "0.69875544", "0.69875544", "0.697815", "0.69634074", "0.69634074", "0.69634074", "0.69634074", "0.69634074", "0.69634074", "0.69634074", "0.69634074", "0.6960778", "0.6917359", "0.6894451", "0.68780726", "0.68758", "0.68689096", "0.68689096", "0.6855974", "0.6854572", "0.6854572", "0.6854572", "0.6854572", "0.6854572", "0.6854572", "0.6854572", "0.6854572", "0.6854572", "0.6854572", "0.68507713", "0.6832209", "0.6830385" ]
0.0
-1
You can create a new url sending json requests like: curl X POST d "original_link= When deployed, replace localhost:3000 with the correct
def create @url = request.format.json? ? Url.new(original_link: params[:original_link]) : Url.new(url_params) respond_to do |format| if @url.save format.html { redirect_to @url, notice: 'URL was successfully created.' } format.json { render :show, status: :created, location: @url } else format.html { render :new } format.json { render json: @url.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_links(json) end", "def shorten_link(url)\n uri = URI.parse(\"http://localhost:3000/shorten\")\n params = {\"url\": url}\n uri.query = URI.encode_www_form(params)\n JSON.parse(Net::HTTP.get(uri))\nend", "def test_should_create_link_via_API_JSON\r\n get \"/logout\"\r\n post \"/links.json\", :api_key => 'testapikey',\r\n :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response :created\r\n link = JSON.parse(response.body)\r\n check_new_link(link) \r\n end", "def create url\n function = ''\n \n post_data = {}\n post_data[:url] = url\n\n request(@resource, function, nil, 'post', post_data)\n end", "def create(url, data)\n RestClient.post ENV['APIBASE']+url, data, :content_type => :json\nend", "def json_url\n \"#{REDDIT_URL_PREFIX}#{permalink}.json\"\n end", "def create\n \t@url = Url.build(params[:link],request.base_url) \t\n \trender json: @url.to_json\n end", "def create_short_url(original_url = nil)\n params = {body: {originalURL: original_url, domain: @short_domain}.to_json, headers: {\"Authorization\" => @short_api_key}}\n response = self.class.post(\"/links\", params)\n @short_url = JSON.parse(response.body)[\"shortURL\"]\n response\n end", "def json_url\n # \"#{REDDIT_URL_PREFIX}#{permalink}#{@self_id}.json\"\n end", "def shorten_link\n \t\tinput_link = params[:link][:given_link]\n \t\trender json: shorten_my_link(input_link)\n \tend", "def create_api\n\n @url = Url.new(:url => params[:url])\n\n if @url.save\n url_hash = Hash.new\n\n url_hash[:short_url] = root_url.to_s() + \"urls_api/\" + (@url.id).to_s(36)\n url_hash[:url] = @url.url\n\n render :json => url_hash.to_json\n end\n\n end", "def send(key)\n HTTParty.post(@add_url, {\n :headers => {\n \"Content-Type\" => \"application/json; charset=UTF8\",\n \"X-Accept\" => \"application/json\"\n },\n :body => {\n #:url => formatted[:url],\n :url => \"https://www.engadget.com/2016/10/09/more-galaxy-note-7-replacement-fires/\",\n #:tags => formatted[:tags],\n :consumer_key => ENV['POCKET_CONSUMER_KEY'],\n :access_token => key\n }.to_json\n })\n end", "def putShortenurl( url)\n params = Hash.new\n params['url'] = url\n return doCurl(\"put\",\"/shortenurl\",params)\n end", "def test_process_url_params_idempotent\n # verify that using url method from RestClient doesn't change existing url\n request_url=@@dummy_host+\"/users/self/upcoming_events?as_user_id=sis_login_id:studenta\"\n full_request_url = RestClient::Request.new(:method => :get, :url => request_url).url\n #puts \"full_request_url: [#{full_request_url}]\"\n refute_nil full_request_url\n assert_equal(request_url, full_request_url)\n end", "def create\n @link = Link.new(params[:link])\n\n respond_to do |format|\n if @link.save\n @response = { url: \"#{request.protocol}#{request.host_with_port}/#{Link.encode(@link.id)}\" }\n format.json { render json: @response, status: :created, location: @link }\n else\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(url, payload)\n url = URI.parse(url)\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Patch.new(url.path+'?access_token=verysecret')\n request.content_type = 'application/json'\n request.body = JSON.generate(payload)\n response = http.start {|http| http.request(request) }\n begin\n return JSON.parse(response.body)\n rescue\n # Log as a problematic case with rule number and line\n $problems.write \"#{$index}, #{payload}, #{response.body}\\n\"\n return nil\n end\nend", "def put(url, payload)\n url = URI.parse(url)\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Put.new(url.path+'?access_token=verysecret')\n request.content_type = 'application/json'\n request.body = JSON.generate(payload)\n begin\n response = http.start {|http| http.request(request) }\n rescue\n puts url\n end\n begin\n return JSON.parse(response.body)\n rescue\n # Log as a problematic case with rule number and line\n $problems.write \"#{$index}, #{payload}, #{response.body}\\n\"\n return nil\n end\nend", "def set_whats_new_url(args = {}) \n put(\"/globalsettings.json/news/url\", args)\nend", "def do_rest_url(api_name)\n raise 'Signature should not be blank. Please generate signature by LazadaOP#do_signature.' if @common_params[:sign].blank?\n length = @server_url.length\n rest_url = @server_url[(length - 1)] == '/' ? @server_url.chomp!('/') : @server_url\n\n common_params_string = ''\n @common_params.each do |key, value|\n common_params_string += '&' unless common_params_string.blank?\n common_params_string += \"#{key}=#{value}\"\n end\n \"#{rest_url + api_name}?#{common_params_string}\"\n end", "def api(uri, request = :get)\n JSON.parse(\n `curl --request #{request.to_s.upcase} -s -S --header \"PRIVATE-TOKEN: $GITLAB_TOKEN\" \"$GITLAB_BASE_URL/api/v4/#{uri}\"`\n )\nend", "def link_params\n if json_request?\n params.permit(:source_link)\n else\n params.require(:link).permit(:source_link, :key)\n end\n end", "def post_with_app(url, payload = '')\n github_api_conn.post do |request|\n request.url url\n\n request.headers['Authorization'] = \"Token #{access_token}\"\n request.headers['Accept'] = accept_header\n request.body = payload\n end\n end", "def http_post(curl, data, url)\n\n # Define the post data\n data2 = ''\n\n # Loop through the data[\"post_data\"] passed in to build up the post data string\n data[\"post_data\"].each do |key, value|\n if (data2 != '') then\n data2 = data2 + '&'\n end\n # If the value is null we don't just want it to look like: item=\n if (value.nil?) then\n data2 = data2 + CGI::escape(key.to_s) + '='\n else\n data2 = data2 + CGI::escape(key.to_s) + '=' + CGI::escape(value.to_s)\n end\n end\n\n # Define the url we want to hit\n curl.url = url\n # Specify the headers we want to hit\n curl.headers = data['header']\n\n # perform the call\n curl.post(data2)\n\n curl.headers = nil\n\n # Set headers to nil so none get reused elsewhere\n curl.headers = nil\n\n # return the curl object\n return curl\n\nend", "def post_with_curl\n url = @settings.webhook_url\n `curl -is -X POST -H \"Content-Type:application/json\" -d '#{get_body}' '#{url}'`\n end", "def post(url, payload)\n url = URI.parse(url)\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Post.new(url.path+'?access_token=verysecret')\n request.content_type = 'application/json'\n request.body = JSON.generate(payload)\n response = http.start {|http| http.request(request) }\n begin\n return JSON.parse(response.body)\n rescue\n # Log as a problematic case with rule number and line\n $problems.write \"#{$index}, #{payload}, #{response.body}\\n\"\n return nil\n end\nend", "def send_url(url)\n # debug - puts \"trying #{url}\"\n result = JSON.parse(URI.parse(url).read)\n puts \"#{result['status']} #{result['message']}\" if result['status'] == 'ERROR'\nend", "def api\n new_vurl.ip_address = request.remote_ip\n new_vurl.user = User.create!(:name => 'API')\n\n respond_to do |format|\n if suspected_spam_user?\n format.html { render :text => \"Get thee behind me, spammer\" and return }\n format.json { render :json => {:errors => \"Get thee behind me, spammer\"} and return }\n end\n\n if new_vurl.save\n format.html { render :text => redirect_url(new_vurl.slug) }\n format.json { render :json => {:shortUrl => redirect_url(new_vurl.slug)} }\n else\n format.html { render :text => new_vurl.errors.full_messages }\n format.json { render :json => {:errors => new_vurl.errors.full_messages.first} }\n end\n end\n end", "def href\n link.gsub(\".json\", \"\")\n end", "def post url, payload\n RestClient::Request.execute(:method => :post, :url => url, :payload => payload, :headers => lbaas_headers, :timeout => @timeout, :open_timeout => @open_timeout)\n end", "def short\n alexa_rank = alexa_rank params[:url]\n host = get_domain params[:url]\n host = host.split \".\"\n domain = host.count >= 3 ? host[host.count - 3] : host[host.count - 2]\n @url = @user.url.create url: params[:url], alexa_rank: alexa_rank, domain: domain\n @url.save!\n render json: {url_short: @url.url_short}\n end", "def forward_json(reading_json)\n #uri = URI.parse(\"http://cmu-sensor-network.herokuapp.com/sensors\")\n uri = URI.parse(\"http://209.129.244.9/sensors\")\n post_json_request = Net::HTTP::Post.new(uri.request_uri)\n post_json_request.add_field(\"Content-Type\", \"application/json\")\n post_json_request.body = reading_json\n http = Net::HTTP::new(uri.host, uri.port)\n response = http.request(post_json_request)\n return response\n end", "def original_url; end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def create\n\n @url = Url.new(url_params)\n @url.user = current_user\n @url.unique_key = @url.generate_unique_key\n\n #save data\n if @url.save\n response = {:status => 'success',\n :mgs => short_url(@url.unique_key)}\n else\n response = {:status => 'fail',\n :mgs => 'Not a valid URL.'}\n end\n\n #send response\n respond_to do |format|\n format.json { render json: response }\n end\n end", "def method_missing(symbol,*args)\n if args.length >= 1\n link_only = false\n if symbol == :link_for\n symbol = args.shift\n link_only = true\n end\n @logger.debug(\"Executing a #{symbol} against gliffy for url #{args[0]}\")\n\n # exposing this for testing\n protocol = determine_protocol(args[1])\n @full_url_no_params = protocol + \"://\" + @api_root + replace_url(args[0])\n url = SignedURL.new(@credentials,@full_url_no_params,symbol == :GET ? 'GET' : 'POST')\n url.logger = @logger\n url.params = args[1] if !args[1].nil?\n url[:protocol_override] = nil\n url[:action] = symbol\n\n # These can be override for testing purposes\n timestamp = args[2] if args[2]\n nonce = args[3] if args[3]\n\n full_url = url.full_url(timestamp,nonce)\n if link_only\n return full_url\n else\n response = @http.post(full_url)\n return response\n end\n else\n super(symbol,args)\n end\n end", "def build_urlpath\n render_endpoint_request do\n erb = EndpointRequestBuilder.new(@endpoint)\n extra_params = erb.formatted_url_path(@arguments)\n render json: { success: extra_params }, status: 200\n end\n end", "def to_url\n \"%s/web/api/%s/%s/authkey=%s/%s\" % [ host, target, url_options, authkey, output ]\n end", "def shorten\n request = {\n body: { longUrl: url }.to_json,\n headers: { 'Content-Type' => 'application/json' },\n query: { key: api_key, \n access_token: access_token }\n }\n\n request.merge!({ http_proxyaddr: proxy.host, \n http_proxyport: proxy.port, \n http_proxyuser: proxy.user, \n http_proxypass: proxy.password }) if proxy\n\n Timeout::timeout(timeout) do\n # submit the url to Goo.gl\n result = self.class.post(\"/urlshortener/v1/url\", request)\n # return the response id or the url\n result.parsed_response[\"id\"] || url\n end\n # if a problem occurs\n rescue Timeout::Error, JSON::ParserError => e\n # just return the original url\n url\n end", "def\tcreate_url(long_url)\n\t\t begin\n\t\t\t options = { :query => { :url => long_url, :api_key => @api_key } }\n result = HTTParty.post(@firefly_url + '/api/add', options)\n\n\t\t\t\tif result =~ /Permission denied/i\n raise \"Permission denied. Is your API Key set correctly?\" if result.status = 401\n\t\t\t\telse\n\t\t\t\t return result\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def post(url, payload = {}, headers = {})\n http :post, \"#{url}.json\", payload.to_json, headers\n end", "def consume_url; end", "def request (url_requested, api_key)\n url_builded = url_requested + \"&api_key=\" + api_key\n\n url = URI(url_builded)\n\n https = Net::HTTP.new(url.host, url.port)\n https.use_ssl = true\n\n request = Net::HTTP::Get.new(url)\n\n response = https.request(request)\n\n JSON.parse(response.read_body)\nend", "def patch_with_app(url, payload = '')\n github_api_conn.patch do |request|\n request.url url\n\n request.headers['Authorization'] = \"Token #{access_token}\"\n request.headers['Accept'] = accept_header\n request.body = payload\n end\n end", "def to(url); end", "def shorten(url)\n query = { :'link[url]' => url }\n self.class.post(\"/links\", :query => query)\n end", "def create\n @url = Url.create_update_with(url_params)\n @short_url = \"#{request.host_with_port}/#{@url.short_url}\"\n redirect_to root_path(short_url: @short_url)\n end", "def postFlatpackLink( flatpack_id, keywords, location, linkText)\n params = Hash.new\n params['flatpack_id'] = flatpack_id\n params['keywords'] = keywords\n params['location'] = location\n params['linkText'] = linkText\n return doCurl(\"post\",\"/flatpack/link\",params)\n end", "def post(href, additional_parameters = {})\n rest_connect do |base_uri, headers|\n href = \"#{base_uri}/#{href}\" unless begins_with_slash(href)\n res = Net::HTTP::Post.new(href , headers)\n unless additional_parameters.empty?\n res.set_content_type('application/json')\n res.body = additional_parameters.to_json\n end\n #res.set_form_data(additional_parameters, '&')\n res\n end\n end", "def create\n url = ShortenedUrl.find_by_long_url(shortened_urls_params[:long_url])\n \n if url\n render json: {shortUrl: url[:short_url]}\n else\n shortened_url = ShortenedUrl.new(shortened_urls_params)\n \n if shortened_url.save\n short_url = shortened_url.generate_short_url\n shortened_url.update_attribute(\"short_url\", short_url)\n \n render json: { shortUrl: shortened_url[:short_url], success: true }\n else\n render json: { error: true }\n end\n end\n end", "def remap_url(original_url)\n return original_url if self.class.service_name == \"tfs\"\n \n server_uri = URI(data.server_url)\n \n uri = URI(original_url)\n uri.scheme = server_uri.scheme\n uri.host = server_uri.host\n uri.port = server_uri.port\n uri.to_s\n end", "def shorten_url\n if @url.save\n headers 'Location' => url(@url.path)\n halt 201, \"Created #{url(@url.path)}\"\n else\n halt 406, \"#{@url.errors.full_messages.join(\".\\n\")}\"\n end\n end", "def generate_request(url, method, prepped_json = nil)\n uri = URI.parse url\n http = Net::HTTP.new uri.host, uri.port\n \n if uri.instance_of? URI::HTTPS\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n\n if method == 'post'\n request = Net::HTTP::Post.new uri.request_uri\n else\n request = Net::HTTP::Get.new uri.request_uri\n end\n request.add_field 'Content-Type', 'application/json'\n request.add_field 'Authorization', 'JWT ' + SiteSetting.moderator_json_web_token\n \n if prepped_json\n request.body = prepped_json\n end\n\n return http.request request\n end", "def hit_api_direct\n # CollegiateLink API needs some data to be hashed and sent for auth purposes\n time = (Time.now.to_f * 1000).to_i.to_s\n ipaddress = ENV['cl_ipaddress']\n apikey = ENV['cl_apikey']\n privatekey = ENV['cl_privatekey']\n random = SecureRandom.hex\n hash = Digest::SHA256.hexdigest(apikey + ipaddress + time + random + privatekey)\n\n url = ENV['cl_apiurl'] + @resource + \"?time=\" + time + \"&apikey=\" + apikey + \"&random=\" + random + \"&hash=\" + hash + @url_options\n return send_request(url, nil)\n end", "def shorten(url)\n params = { :query => { :url => url } }\n request = EM::HttpRequest.new(API_URL).post(params)\n request.callback(&method(:on_success))\n request.errback(&method(:on_error))\n self\n end", "def append_info_to_payload(payload)\n super\n payload[:host] = request.host\n end", "def do_request(homework)\n uri = URI.parse('https://webhook.site/1e9a10c7-54e0-414b-a1a7-3a7dad38c56d')\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n req = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json')\n req.body = {\n homework_source: homework.source_code,\n student: fullname,\n pr_title: homework.pr_title\n }.to_json\n http.request(req)\n end", "def rest_production(verb, url, payload)\n response = RestClient.send(verb, url, payload, request_headers)\n log_info(\"Response #{response.code}:\\n#{response.body.inspect}\\n\")\n response.code\n end", "def autoname_url(url)\n request('POST', @uri.request_uri, url)\n end", "def curl(server, url, args:{}, file:\"\", post:false, json:false, getfile:nil)\n cmd = \"\"\n # Getfile needs json to remove html, but don't parse as json\n cmd << if getfile.nil? then '-i ' else '-H \"Accept: application/json\" ' end\n cmd << '-X POST ' if post\n cmd << '-H \"Accept: application/json\" ' if json\n cmd << \"-F \\'file=@#{file}\\' \" if file != \"\"\n args.each_pair { |k,v| cmd << \"-F \\'#{k}=#{v}\\' \" }\n\n pipe = getfile.nil? ? '' : '-o ' + File.join($workdir, getfile)\n url2 = !getfile.nil? ? url + getfile + \"/\" : url\n\n res = run(\"curl http://#{server}#{url2} #{cmd}#{pipe}\")\n # clean up json output\n if json\n i = res =~ /{/\n res = res[i..-1] if i\n res = JSON::parse(res)\n end\nend", "def put url, payload\n RestClient::Request.execute(:method => :put, :url => url, :payload => payload, :headers => lbaas_headers, :timeout => @timeout, :open_timeout => @open_timeout)\n end", "def new\n @page_title = 'New URL'\n @url = ShortenUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @url }\n end\n end", "def ingest\n json = self.result.deep_dup.with_indifferent_access\n JsonUtilities.strip_uri_type!(json)\n JsonUtilities.clean_uris!(json)\n client = HTTPClient.new\n # fire & forget\n client.put_async(\"#{INGEST_BASE_URL}?api_key=#{ENV['RC_API_KEY']}&doi=#{URI.encode_www_form_component(doi)}\",\n MultiJson.dump(json),\n 'Content-Type' => 'application/json',\n 'Accept' => 'application/json')\n end", "def shorten_url(url)\n res = http_post(\"http://crash.io\", :url => url)\n if res.status == 201\n res.headers['location']\n else\n url\n end\n rescue TimeoutError\n url\n end", "def post_to_url(conn, key, body)\n res = conn.post do | req |\n # req.headers['x-api-key'] = key\n req.body = body.to_json\n end\n JSON.parse(res.body)\n end", "def add(url, opts={}, req_opts={})\n \n defaults = {\n \"method\" => 'GET',\n \"version\" => '1.1',\n \"url\" => url,\n :auth => {} #accepts {:username => 'user_id', :password => 'pass'} hash\n }\n \n # This is used to tell Tsung if we want a dynamic substitution\n req_defaults = {\n \"subst\" => 'false',\n :ssl => self.config.ssl,\n :dyn_variables => {\n # \"name\"\n # \"re\"\n },\n :custom_headers => {},\n :secondary_server_req => nil,\n :external => false\n }\n\n opts = defaults.merge(opts)\n req_opts = req_defaults.merge(req_opts)\n @http_mode = (req_opts[:ssl] ? 'https' : 'http')\n \n # Split the hashes to take our dyn_variable\n #dyn_variables = req_opts.reject{|k,v| k == \"subst\"}[:dyn_variables]\n auth_opt = opts.select{|k,v| k == :auth}\n opts.reject!{|k,v| k == :auth}\n dyn_variables = req_opts[:dyn_variables]\n custom_headers = req_opts[:custom_headers]\n secondary_server_req = req_opts[:secondary_server_req]\n external = req_opts[:external]\n req_opts.delete_if{|k,v| k != \"subst\"}\n \n \n # Make sure we have a proper URL format\n base_url = ''\n self.config.log.debug_msg(\"URL: #{url}\\nLast Req External - Beg: #{@@last_req_external}\")\n \n # Secondary server request\n if(!secondary_server_req.nil?)\n # Secondary server, just set it to fully qualified hostname\n base_url = \"#{@http_mode}://#{secondary_server_req}\"\n base_url << \"/#{self.config.secondary_context}\" if(!self.config.secondary_context.empty?)\n base_url << '/' if(url !~ /^\\//)\n @@last_req_fq = true\n \n elsif(url !~ /^#{http_mode}/)\n \n # Take care of last request external\n if(@@last_req_external or (self.config.ssl and !@@last_req_fq))\n # We need to make the request fully qualified\n base_url = self.url\n @@last_req_fq = true\n else\n base_url << \"/#{self.config.context}\" if(url !~ /^\\/#{self.config.context}/ and !self.config.context.empty?)\n end\n \n base_url << '/' if(url !~ /^\\//)\n \n end\n \n url = base_url + url\n opts[\"url\"] = url\n \n self.config.log.debug_msg(\"New URL: #{url}\")\n \n # Building request string soley for list method\n req_str = \"<http url='#{url}' version='#{opts[:version]}' method='#{opts[:method]}'\"\n req_str << \" content_type='#{opts[:content_type]}'\" if(opts[:content_type])\n req_str << \" contents='#{opts[:contents]}'\" if(opts[:contents])\n req_str << \">\"\n\n req = @xml_element.add_element('request', req_opts)\n dyn_variables.each do |dyn_var|\n req.add_element('dyn_variable', dyn_var)\n end\n http = req.add_element('http', opts)\n \n # Write basic authentication for request if necessary\n #http.add_element('www_authenticate', {'userid' => auth_opt[:auth][:username], 'passwd' => auth_opt[:auth][:password]}) if(!auth_opt[:auth].empty?)\n \n # BUG - need a way to dynamically ingest custome headers per product\n # BUG - hardcoded to first app server\n custom_headers['Referer'] = self.url if(self.config.product == 'oae' and !custom_headers['Referer'])\n \n if(!custom_headers.empty?)\n custom_headers.each_pair do |key, value|\n http.add_element('http_header', {'name' => key, 'value' => value})\n end\n end\n \n # Set external flag if necessary\n @@last_req_external = (external ? true : false)\n external ? self.config.log.debug_msg(\"EXTERNAL: true\") : self.config.log.debug_msg(\"EXTERNAL: false\")\n self.config.log.debug_msg(\"Last Req External - End: #{@@last_req_external}\")\n \n @list << req_str\n end", "def rest_request(verb, url, data)\n if Rails.env.production?\n rest_production(verb, url, JSON.generate(data))\n else\n log_info(\"[#{Rails.env}]: #{verb} #{url}\", 200)\n end\n rescue RestClient::Exception => e\n log_error \"Failed with #{e.http_code}: #{e}\\n#{e.response}\", e.http_code\n end", "def setup_http_request(obj, cookie=nil, args={})\n if args.has_key?(:url) and args[:url] != nil\n if args[:url].scan(/%[s|d]/).length > 0\n if args[:url].scan(/%[s|d]/).length != args[:url_arg].length\n ALERT.call(caller_locations, __callee__, \"URL contains %d '%%s' or '%%d' argument... Fix your code\" % args[:url].scan(/%[s|d]/).length)\n exit 2\n end\n req = obj[:method].new(args[:url] % args[:url_arg])\n else\n req = obj[:method].new(args[:url])\n end\n else\n if args.has_key?(:url_arg)\n if obj[:url].scan(/%[s|d]/).length > 0\n if obj[:url].scan(/%[s|d]/).length != args[:url_arg].length\n ALERT.call(caller_locations, __callee__, \"URL contains %d '%%s' or '%%d' argument... Fix your code\" % obj[:url].scan(/%[s|d]/).length)\n exit 2\n end\n req = obj[:method].new(obj[:url] % args[:url_arg])\n else\n req = obj[:method].new(obj[:url])\n end\n else\n req = obj[:method].new(obj[:url])\n end\n end\n req[\"Host\"] = \"www.blablacar.fr\"\n req[\"origin\"] = \"https://www.blablacar.fr\"\n req[\"User-Agent\"] = \"Mozilla/5.0 (X11; Linux x86_64; rv:18.0) Gecko/20100101 Firefox/18.0\"\n req[\"Accept\"] = \"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\"\n if obj.has_key?(:referer)\n req['Referer'] = obj[:referer]\n else\n req[\"Referer\"] = \"https://www.blablacar.fr/dashboard\"\n end\n req.add_field(\"Connection\", \"keep-alive\")\n if cookie\n req.add_field(\"Cookie\", cookie)\n end\n if obj.has_key?(:header)\n obj[:header].each_slice(2).map{|h|\n req.add_field(h[0], h[1])\n }\n end\n if obj.has_key?(:data)\n if obj[:data].scan(/%[s|d]/).length > 0\n if obj[:data].scan(/%[s|d]/).length != args[:arg].length\n ALERT.call(caller_locations, __callee__, \"Body request contains %d '%%s' or '%%d' argument... Fix your code\" % obj[:data].scan(/%[s|d]/).length)\n exit 2\n else\n req.body = obj[:data] % args[:arg]\n end\n else\n req.body = obj[:data]\n end\n req['Content-Length'] = req.body.length\n end\n req\nend", "def simple_request(method, url)\n uri = URI.parse(url)\n request = Net::HTTP::Get.new(uri)\n request.content_type = \"application/json\"\n request[\"Accept\"] = \"application/json\"\n request[\"App-Id\"] = ENV[\"salt_edge_app_id\"]\n request[\"Secret\"] = ENV[\"salt_edge_secret\"]\n\n req_options = {\n use_ssl: uri.scheme == \"https\",\n } \n\n response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n http.request(request)\n end\n\n #puts response.body\n return JSON.parse(response.body)\n end", "def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts JSON.pretty_generate(result)\n result\nend", "def url\n data['url']\n end", "def create_url\n \"#{api_url}/gists\"\n end", "def item_url(result)\n query = CGI.parse(env.url.query.to_s)\n url = \"#{env.url.scheme}://#{env.url.host}#{env.url.path.sub(/\\.json\\z/, '')}/#{result['identifiers'][0]['identifier']}.json\"\n if query['key'].any?\n url += \"?key=#{CGI.escape(query['key'][0].to_s)}\"\n end\n url\n end", "def post_and_get_url(token, options)\n GistRequest.new(token, options).fetch('html_url')\n end", "def makeURL(path)\n \"#{self.api_endpt + path}?token=#{self.token}\"\n end", "def request_url\n base_url = \"http://#{api_host}#{PATH}?\"\n base_url << \"appid=#{app_id}\"\n base_url << \"&callname=#{call_name}\"\n base_url << \"&siteid=#{site_id}\"\n base_url << \"&version=#{API_VERSION}\"\n base_url\n end", "def rewrite_iiif_base_uri(info_original)\n parsed_json = JSON.parse(info_original)\n public_base_uri = \"#{ENV['IIIF_SERVER_URL']}#{trailing_slash_fix}#{identifier}\"\n parsed_json[\"@id\"] = public_base_uri\n JSON.generate(parsed_json)\n end", "def validate_url\n return head(:bad_request, content_type: 'application/json') unless params[:shorten][:url]\n end", "def number2(json_file)\n #puts json_file\n puts \"name = #{json_file['name']}\".green\n puts \"description = #{json_file['description']}\".green\n puts \"url = #{json_file['routes']['/']['meta']['self']}\".green\n puts\n\n\n\n all_routes = get_all_routes(json_file)\n all_routes.each do |key, value|\n puts \"Route : #{key}\".blue\n found = false\n\n # check if there is a link \n if value[\"meta\"] != nil\n link = value[\"meta\"][\"self\"]\n found = true\n else\n link = \"There is no link. You should check by hand.\"\n end\n\n # check the methods available \n methods = value[\"supports\"]\n methods.each do |k, v|\n if found\n code = 0\n case k\n when \"GET\"\n response = HTTParty.get(link, follow_redirects: false) \n code = response.code\n when \"POST\"\n response = HTTParty.post(link, body: {foo: 'bar'}, follow_redirects: false)\n code = response.code\n when \"HEAD\"\n response = HTTParty.head(link, follow_redirects: false)\n code = response.code\n when \"PUT\"\n response = HTTParty.put(link, follow_redirects: false)\n code = response.code\n when \"DELETE\"\n response = HTTParty.delete(link, follow_redirects: false)\n code = response.code\n when \"OPTIONS\"\n response = HTTParty.options(link, follow_redirects: false)\n code = response.code\n when \"PATCH\"\n response = HTTParty.patch(link, follow_redirects: false)\n code = response.code\n end\n if code == 401 or code == 403 or code == 404\n puts \"Method : #{k} ---> response code = #{code}\".red\n elsif code == 200\n puts \"Method : #{k} ---> response code = #{code}\".green\n else \n puts \"Method : #{k} ---> response code = #{code}\".yellow\n end\n else\n puts \"Method : #{k}\"\n end\n end\n\n # put the link \n if link == \"There is no link. You should check by hand.\"\n puts \"---> [ #{link} ]\".yellow\n else\n puts \"---> [ #{link} ]\"\n end\n\n # create space\n puts \"\\n\\n\\n\"\n end\n exit\nend", "def post(url, query = {}, payload = {})\n restclient({\n method: :post,\n url: \"#{@scheme}://#{@host}/#{url}\",\n timeout: Timeout,\n open_timeout: OpenTimeout,\n payload: payload.to_json,\n headers: {\n authorization: @auth,\n content_type: :json,\n accept: :json,\n params: query\n }\n })\n end", "def invoke_request(url)\n site = RestClient::Resource.new(url, \"dHgVM1emGoTyr8zHmVNH\")\n return JSON.parse(site.get(:accept=>\"application/json\"))\nend", "def invoke_request(url)\n site = RestClient::Resource.new(url, \"dHgVM1emGoTyr8zHmVNH\")\n return JSON.parse(site.get(:accept=>\"application/json\"))\nend", "def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{uri}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts result[:result]\n result\nend", "def http_post(url, data)\n\turi = URI(url)\n\treq = Net::HTTP::Post.new(uri.path, initheader = {'Content-Type' =>'application/json'})\n req.body = data.to_json\n response = Net::HTTP.new(uri.host, uri.port).start {|http| http.request(req) }\n return response\nend", "def full_url\n char = (api_env('URL') =~ /\\?/).nil? ? '?' : '&'\n api_env('URL') + \"#{char}#{api_env('PARAM')}=#{login}\"\n end", "def post url\n Timeout.timeout(60) do\n puts \"POST: #{url}\" if config[:debug]\n \n tags = (Hpricot(open(\"http://del.icio.us/url/check?url=#{CGI.escape(url)}\"))/\n '#top-tags'/'li')[0..10].map do |li| \n (li/'span').innerHTML[/(.*?)<em/, 1]\n end.join(\" \")\n puts \"POST-TAGS: #{tags}\" if config[:debug]\n \n description = begin\n Timeout.timeout(5) do \n (((Hpricot(open(url))/:title).first.innerHTML or url) rescue url)\n end\n rescue Timeout::Error\n puts \"POST: URL timeout\" if config[:debug]\n url\n end\n \n query = { :url => url, :description => description, :tags => tags, :replace => 'yes' }\n\n http = Net::HTTP.new('api.del.icio.us', 443) \n http.use_ssl = true \n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n response = http.start do |http|\n post_url = '/v1/posts/add?' + query.map {|k,v| \"#{k}=#{CGI.escape(v)}\"}.join('&')\n puts \"POST: post url #{post_url}\" if config[:debug]\n req = Net::HTTP::Get.new(post_url, {\"User-Agent\" => \"Kirby\"})\n req.basic_auth config[:delicious_user], config[:delicious_pass]\n http.request(req)\n end.body\n\n puts \"POST: #{response.inspect}\" if config[:debug]\n end\n rescue Exception => e\n puts \"POST: #{e.inspect}\" if config[:debug]\n end", "def create\n @short_url = @user.short_urls.new(short_url_params)\n\n if @short_url.save\n short_url = @short_url\n short_url.shorty = \"http://www.my-domain.com/#{@short_url.shorty}\"\n render json: short_url, status: :created\n else\n render json: {errors: @short_url.errors}, status: :unprocessable_entity\n end\n end", "def post_request(secureNetId, secureKey, url)\n uri = URI.parse(url) # Parse the URI\n http = Net::HTTP.new(uri.host, uri.port) # New HTTP connection\n http.use_ssl = true # Must use SSL!\n req = Net::HTTP::Post.new(uri.request_uri) # HTTP POST request \n body = {} # Request body hash\n yield body # Build body of request\n req.body = body.to_json # Convert hash to json string\n req[\"Content-Type\"] = 'application/json' # JSON body\n req[\"Origin\"] = 'worldpay.com' # CORS origin\n req.basic_auth secureNetId, secureKey # HTTP basic auth\n res = http.request(req) # Make the call\n return JSON.parse(res.body) # Convert JSON to hashmap\nend", "def post_json(path, body)\n uri = build_uri(path)\n #puts \"🤖 POST #{path}\"\n #puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n #puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n #puts result[:result]\n result\nend", "def post_json(path, body)\n uri = build_uri(path)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n result = JSON.parse(response.body)\n puts result\n result\nend", "def request(url,token = nil)\n url = URI(\"#{url}&api_key=#{token}\") # se quita uri y parentesis\n #puts url_string\n \n \n https = Net::HTTP.new(url.host, url.port)\n https.use_ssl = true\n request = Net::HTTP::Get.new(url)\n response = https.request(request)\n data = JSON.parse(response.read_body)\n #puts data\nend", "def create\n if @link.save\n render json: @link, status: :created, location: @link\n else\n render json: @link.errors, status: :unprocessable_entity\n end\n end", "def new\n #@instance = Instance.new\n @instance.url = \"http://#{request.host}\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instance }\n end\n end", "def create_recipe_request(version, auth_headers, data = {})\n post \"/api/recipes\", params: data, headers: {'Content-Type' => \"application/json\", 'Accept' => \"application/vnd.ink.#{version}\" }.merge(auth_headers)\nend", "def getJson(url)\r\n request_uri = url\r\n request_query = ''\r\n url = \"#{request_uri}#{request_query}\"\r\n result = getJsonFromUrl(url)\r\n return result\r\nend", "def transform_automation_url(arg)\n return arg unless arg.start_with?(\"http\")\n\n remote_file = determine_remote_filename(arg)\n github_match = GITHUB_REGEX.match(arg)\n\n arg = if arg.start_with?(\"https://gist.github.com\")\n arg.sub( # rubocop:disable Style/StringConcatenation\n \"https://gist.github.com\", \"https://gist.githubusercontent.com\"\n ) + \"/raw\"\n elsif github_match\n new_url = arg.sub(GITHUB_REGEX, \"https://raw.githubusercontent.com\")\n github_tree_match = GITHUB_TREE_REGEX.match(arg)\n github_blob_match = GITHUB_BLOB_REGEX.match(arg)\n\n if github_tree_match\n new_url.sub(\"/tree/\", \"/\")\n elsif github_blob_match\n new_url.sub(\"/blob/\", \"/\")\n else\n \"#{new_url}/#{Bridgetown::Utils.default_github_branch_name(arg)}\"\n end\n else\n arg\n end\n\n \"#{arg}/#{remote_file}\"\n end", "def on_request_uri(cli, req)\r\n\t\tsend_response(cli, %Q{window.location.replace('#{datastore['Website']}');})\r\n\tend", "def url=(_); end", "def post_new_gist content \n\t\t\t\turl = GITHUB_API_GIST_LINK \n\t\t\t\tresponse = https_open_for ({url: url, mthd:\"post\", content: content})\n \t\t\t\tJSON.parse response.body\n\t\t\tend", "def url=(_arg0); end", "def url=(_arg0); end" ]
[ "0.65737766", "0.6375937", "0.6261237", "0.6152084", "0.6150196", "0.6119849", "0.6116279", "0.61070454", "0.6029699", "0.5989601", "0.5986795", "0.5891399", "0.5886601", "0.5865979", "0.58451164", "0.5762698", "0.5749765", "0.57045716", "0.5693671", "0.5678255", "0.5646607", "0.5641716", "0.5639367", "0.56356853", "0.5603015", "0.5600107", "0.55970037", "0.5591708", "0.5582509", "0.5578772", "0.556231", "0.5559288", "0.5558223", "0.554837", "0.55241317", "0.5517932", "0.55130607", "0.5497424", "0.5494059", "0.5479828", "0.5472319", "0.5463132", "0.5462182", "0.5458248", "0.54533994", "0.5452356", "0.5448023", "0.54459965", "0.5439823", "0.54328895", "0.5428693", "0.5420063", "0.5412144", "0.54101515", "0.54092854", "0.5405372", "0.53949285", "0.53866285", "0.53757036", "0.53634065", "0.5360647", "0.5352874", "0.5340422", "0.53396064", "0.5332692", "0.53325766", "0.53253716", "0.53218985", "0.5320846", "0.53160673", "0.53157717", "0.5313191", "0.53117955", "0.5308814", "0.5300563", "0.52949977", "0.52910185", "0.5288631", "0.5287419", "0.5285092", "0.5285092", "0.528492", "0.5283286", "0.528009", "0.5278601", "0.5275619", "0.52738297", "0.5267824", "0.5266421", "0.52645415", "0.5263912", "0.5259633", "0.5256691", "0.5255104", "0.5254722", "0.52545637", "0.5251588", "0.52501875", "0.5247047", "0.5247047" ]
0.53292066
66
GET /tidbits GET /tidbits.json
def index @tidbits = Tidbit.all @tid_ruby = Tidbit.where(subject: "ruby") @tid_positive = Tidbit.where(subject: "positive") @tid_ee = Tidbit.where(subject: "ee") @tid_random = Tidbit.where(subject: "random") @tid_poker = Tidbit.where(subject: "poker") @tid_rails = Tidbit.where(subject: "rails") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_tidbit\n @tidbit = Tidbit.find(params[:id])\n end", "def create\n @tidbit = Tidbit.new(tidbit_params)\n\n respond_to do |format|\n if @tidbit.save\n format.html { redirect_to @tidbit, notice: 'Tidbit was successfully created.' }\n format.json { render :show, status: :created, location: @tidbit }\n else\n format.html { render :new }\n format.json { render json: @tidbit.errors, status: :unprocessable_entity }\n end\n end\n end", "def thing_flattrs(id,params={})\n get(\"/rest/v2/things/#{id}/flattrs\",params)\n end", "def tbu_list\n @client.make_request :get, templates_path('tbu')\n end", "def get_blockchain_stats\n stats = HTTParty.get(\"http://webbtc.com/stats.json\")\nend", "def get_tweet(search,since_id = 0, throtle = 20)\n\turl = 'http://search.twitter.com/search.json?q='+search+'&rpp='+throtle.to_s+'&since_id='+since_id.to_s\n\tprint \"Asking with this url \" + url+ \"\\n\"\n\tresp = Net::HTTP.get_response(URI.parse(url))\n\tresponse_array = JSON.parse(resp.body)\nend", "def get_coins\n get(\"/getcoins\")\n end", "def transactionById\n results = HTTParty.get(\"http://192.168.99.101:4050/transactions/\" + (params[:id]).to_s)\n render json: results.parsed_response, status: results.code\n end", "def tidbit_params\n params.require(:tidbit).permit(:body)\n end", "def getdifficulty\n request :getdifficulty\n end", "def getdifficulty\n @api.request 'getdifficulty'\n end", "def get\n appid = ENV['TRIMET_APP_ID']\n response = Unirest.get( \"http://developer.trimet.org/ws/v2/vehicles?appid=#{appid}\" )\n response.body\nend", "def get_trip_detail(id)\n server_response = handle_timeouts do\n get \"/1/trips/#{id}.json?locale=en\"\n end\n server_response['response']\n end", "def show\n @torrent = Torrents.new(:url => \"http://newt.local:9091/transmission/rpc\").find(Integer(params[:id]))\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @torrent }\n end\n end", "def get_tags_by_url\n url = Url.find_by(id: params[:id])\n tags = url.tags\n render json: {code: 200, tags: tags}\n end", "def getPtbAll( entity_id, destructive)\n params = Hash.new\n params['entity_id'] = entity_id\n params['destructive'] = destructive\n return doCurl(\"get\",\"/ptb/all\",params)\n end", "def index\n number_tweets = if params[\"count\"] then params[\"count\"].to_i else 10 end\n tweet_ids = []\n if @user.interests\n for i in 1..number_tweets\n interest = @user.interests.sample\n tweet = Rails.application.config.twitter_client.search(\"#{interest[:hashtag]}\", count: 1).take(1)\n tweet_ids.push(tweet.first.id.to_s)\n end\n end\n\n render json: tweet_ids, status: :ok\n end", "def getblockchaininfo\n @api.request 'getblockchaininfo'\n end", "def show\n @bloom = Bloom.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bloom }\n end\n end", "def tweets\n user = User.find(params[:id])\n render json: user.list_tweets, status: :ok\n end", "def show\n @tinymap = Tinymap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tinymap }\n end\n end", "def show\n @tnumber = Tnumber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @tnumber }\n end\n end", "def trips\n get '/gtfs/trips'\n end", "def index\n @tribes = Tribe.all\n end", "def gettransaction(txid)\n request :gettransaction, txid\n end", "def index\n @trips = Trip.all\n\n render json: @trips\n end", "def index\n @trips = Trip.all\n\n render json: @trips\n end", "def list_tenants_for_circle(args = {}) \n get(\"/tenantcircles.json/tenants\", args)\nend", "def show\n @t = T.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @t }\n end\n end", "def update\n respond_to do |format|\n if @tidbit.update(tidbit_params)\n format.html { redirect_to @tidbit, notice: 'Tidbit was successfully updated.' }\n format.json { render :show, status: :ok, location: @tidbit }\n else\n format.html { render :edit }\n format.json { render json: @tidbit.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n tag = Tag.find_by_tid(params[:id])\n if tag.nil?\n render json_status_response(404, \"Tag not found\")\n return\n end\n\n render :status => 200,\n :json => tag_as_hash(tag).merge({\n status: 200,\n # TODO csrf\n })\n end", "def index\n @tprimarytumors = Tprimarytumor.all\n respond_to do |format|\n format.html\n format.json { render :json => @tprimarytumors.map(&:attributes) }\n end\n end", "def show\n @bitacora = Bitacora.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bitacora }\n end\n end", "def index\n response = RestClient.get 'http://api.bitvalor.com/v1/order_book.json'\n data = JSON.parse(response.body)[\"bids\"]\n @fox = data.select {|element| element[0] == \"FOX\"}\n @b2u = data.select {|element| element[0] == \"B2U\"}\n @mbt = data.select {|element| element[0] == \"MBT\"}\n end", "def tribes\n Tribe.all\n end", "def get_trails_by_id(params = {})\n request_by_ids(\"get-trails-by-id\", params)\n end", "def index\n @trips = Trip.all\n render :json => @trips\n end", "def list_pbts\n params = init_params\n request_url = UrlGenerator.url_for(\"pbts\")\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_sequence_from_togows(togows_url)\n url = URI.parse(togows_url)\n path = Net::HTTP::Get.new(url.path)\n Net::HTTP.start(url.host, url.port) {|http|\n res = http.request(path)\n res.body\n }\n end", "def get_sequence_from_togows(togows_url)\n url = URI.parse(togows_url)\n path = Net::HTTP::Get.new(url.path)\n Net::HTTP.start(url.host, url.port) {|http|\n res = http.request(path)\n res.body\n }\n end", "def index\n @tintas = Tinta.all\n end", "def show\n @tag = Tag.find(params[:id])\n\n @tweets = @tag.tweets.paginate(:page => params[:page], :per_page => 20)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @tag }\n end\n end", "def show\n @bottling = Bottling.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bottling }\n end\n end", "def index\n @torrents = Torrents.new(:url => \"http://newt.local:9091/transmission/rpc\").load\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @torrents }\n end\n end", "def specific\n @state = State.find(params[:id])\n @loans = @state.loans.where(:purpose_id == params[:purpose_id])\n render json: { state: @state, loans: @loans }\n end", "def index\n url = \"https://data.cityofchicago.org/resource/x2n5-8w5q.json\"\n options = { :body => {:status => text}, :basic_auth => @auth }\n @response = HTTParty.get(url, options)\n\n @crime = Hash.new\n\n #@crime['block'] = @response[0]['block']\n @crime = @response\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gittos }\n end\n end", "def index\n respond_to do |format|\n format.html\n format.json { render json: Tissue.all }\n end\n \n end", "def show\n @tinymap2 = Tinymap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tinymap2 }\n end\n end", "def show\n @tetramod = Tetramod.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tetramod }\n end\n end", "def show\n @breadcrumb = 'read'\n @tariff_type = TariffType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tariff_type }\n end\n end", "def index\n @tacks = Tack.all\n\n render json: @tacks\n end", "def get(id)\n _get(\"/quick-scan/#{id}\") { |json| json }\n end", "def tattoos\n render :nothing => true and return if params[:id].nil?\n\n @tattoo = Tattoo.find(params[:id])\n render :json => @tattoo.to_json(:include => [:artist, :assets])\n #render :json => @tattoo.to_json(:include => { :assets => { :only => [:id, :data_file_name] } })\n return\n end", "def index\n @bitcoins = Bitcoin.all\n end", "def get_transaction(tx_id:)\n client.make_request('/get-transaction', 'post', params: {tx_id: tx_id})\n end", "def show\n @treq = Treq.find(params[:id])\n @treq_files = @treq.treq_files.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @treq }\n end\n end", "def drugbank_get(route, params)\n url = $drugbank_api + route\n res = HTTParty.get(url, :query => params, :headers => $drugbank_headers)\n return res\nend", "def vehicle_details tank_id\n request_string = \n \"/wot/encyclopedia/tankinfo/?application_id=#{APP_ID}&tank_id=#{tank_id}\"\n data = hash_from_request_string(request_string)\n return data[\"#{tank_id}\"]\nend", "def index\n @bitacoras = Bitacora.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bitacoras }\n end\n end", "def show\n user = user_from_token\n @tweet = user.tweets.where(:id => params[:id])\n render :json => @tweet\n end", "def show\n @liber777_table = Liber777Table.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @liber777_table }\n end\n end", "def index\n @tips_tricks = @tips_tricks.published.recent.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tips_tricks }\n end\n end", "def get_bike(bikeID, userID)\n user = User.find_by(id: userID)\n authorize_time_check(user)\n response = RestClient.get('https://www.strava.com/api/v3/gear/'+bikeID, {Authorization: 'Bearer ' + user.access_token})\n bike = JSON.parse(response)\n end", "def _api\n res = TinyURL.pack(request[:turl]) if request[:turl]\n res = TinyURL.unpack(request[:url].split('/').last) if request[:url]\n res = TinyURL.count(request[:hits].split('/').last).to_s if request[:hits]\n res ||= ''\n respond res\n end", "def get_page_contents()\n JSON.parse( \n @client.api.get(\"#{@client.base_uri.path}/api.php?#{URI.encode_www_form({\n :action => 'query',\n :prop => 'info|revisions',\n :titles => BAN_PAGE,\n :rvprop => 'content',\n :intoken => 'edit',\n :indexpageids => 1,\n :format => 'json',\n :cb => rand(1000000)\n })}\", @headers).body,\n :symbolize_names => true\n )[:query]\n end", "def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end", "def index\n @specialties = Specialty.all\n\n render json: @specialties\n end", "def txs_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransactionsApi.txs_get ...'\n end\n # resource path\n local_var_path = '/txs'\n\n # query parameters\n query_params = {}\n query_params[:'message.action'] = opts[:'message_action'] if !opts[:'message_action'].nil?\n query_params[:'message.sender'] = opts[:'message_sender'] if !opts[:'message_sender'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'tx.minheight'] = opts[:'tx_minheight'] if !opts[:'tx_minheight'].nil?\n query_params[:'tx.maxheight'] = opts[:'tx_maxheight'] if !opts[:'tx_maxheight'].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 => 'PaginatedQueryTxs')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionsApi#txs_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @mosttinymobtrail = Mosttinymobtrail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mosttinymobtrail }\n end\n end", "def show\n @tupian = Tupian.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tupian }\n end\n end", "def getToolsSyndicateTomtom( entity_id)\n params = Hash.new\n params['entity_id'] = entity_id\n return doCurl(\"get\",\"/tools/syndicate/tomtom\",params)\n end", "def index\n @q = Tweet.order('created_at DESC').page(params[:page]).ransack(params[:q])\n @tweets = @q.result(distinct: true)\n # render json: @tweets.each {|tweet| tweet.id}\n end", "def setup_taxa2tree\n Typhoeus.stub('http://api.unipept.ugent.be/api/v2/taxa2tree.json').and_return do |_|\n link = req.options[:body][:link] == 'true'\n if link\n Typhoeus::Response.new(code: 200, body: JSON.dump(gist: 'https://gist.github.com/8837824df7ef9831a9b4216f3fb547ee'))\n else\n result = JSON.parse(File.read(File.join(File.dirname(__FILE__), 'resources/taxa2tree.json')))\n Typhoeus::Response.new(code: 200, body: JSON.dump(result))\n end\n end\n end", "def show\n @mint_coin = @coin.mint_coins.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @mint_coin }\n end\n end", "def show\n @tramite = Tramite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tramite }\n end\n end", "def index\n @tagihans = Tagihan.all\n @tagihans = @tagihans.select { |x| x.user_id == params[:user_id].to_i }\n render json: { items: @tagihans }\n end", "def tires_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TiresApi.tires_list ...'\n end\n # resource path\n local_var_path = '/tires/'\n\n # query parameters\n query_params = {}\n query_params[:'width'] = opts[:'width'] if !opts[:'width'].nil?\n query_params[:'width_min'] = opts[:'width_min'] if !opts[:'width_min'].nil?\n query_params[:'width_max'] = opts[:'width_max'] if !opts[:'width_max'].nil?\n query_params[:'aspect_ratio'] = opts[:'aspect_ratio'] if !opts[:'aspect_ratio'].nil?\n query_params[:'aspect_ratio_min'] = opts[:'aspect_ratio_min'] if !opts[:'aspect_ratio_min'].nil?\n query_params[:'aspect_ratio_max'] = opts[:'aspect_ratio_max'] if !opts[:'aspect_ratio_max'].nil?\n query_params[:'rim_diameter'] = opts[:'rim_diameter'] if !opts[:'rim_diameter'].nil?\n query_params[:'rim_diameter_min'] = opts[:'rim_diameter_min'] if !opts[:'rim_diameter_min'].nil?\n query_params[:'rim_diameter_max'] = opts[:'rim_diameter_max'] if !opts[:'rim_diameter_max'].nil?\n query_params[:'brands'] = opts[:'brands'] if !opts[:'brands'].nil?\n query_params[:'brands_exclude'] = opts[:'brands_exclude'] if !opts[:'brands_exclude'].nil?\n query_params[:'countries'] = opts[:'countries'] if !opts[:'countries'].nil?\n query_params[:'countries_exclude'] = opts[:'countries_exclude'] if !opts[:'countries_exclude'].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 = ['user_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 => 'Array<Tire>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TiresApi#tires_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def trips_by_trip_id(trip_id)\n get \"/gtfs/trips/tripId/#{trip_id}\"\n end", "def show\n @breadcrumb = 'read'\n @timerecord_code = TimerecordCode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timerecord_code }\n end\n end", "def index\n @tunes = Tune.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tunes }\n end\n end", "def index\n @tenancies = Tenancy.all\n end", "def recipe_info_for(id)\n response = Faraday.get(\"https://api.spoonacular.com/recipes/#{id}/information?includeNutrition=true&apiKey=#{spoonacular_key}\")\n JSON.parse response.body\n end", "def index\n @flags = Flag.search(params[:search]).order(\"id\").page(params[:page]).per(10)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @flags }\n end\n end", "def get(transaction_id:)\n client.get(path: \"#{sub_path}/#{transaction_id}\", api_key: api_key)\n end", "def getPageInfoByIDType(id, type)\n request('getPageInfoByIDType', {'id' => id, 'type' => type})\nend", "def get_banks\n HTTParty.get(BASE_URI + 'bank?country=ghana',\n headers: HEADERS).parsed_response\n end", "def trips\n @trip_requests = current_user.trip_requests.trips.paginate(page:params[:page], per_page:20)\n json_response(@trip_requests)\n end", "def set_tint\n @tint = Tint.find(params[:id])\n end", "def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend", "def destroy\n @tidbit.destroy\n respond_to do |format|\n format.html { redirect_to tidbits_url, notice: 'Tidbit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n info = Aws.get_recipes_from_db\n render :json => info\n end", "def trip(trip_id)\n connection.get(\"/trips/#{trip_id}\").body\n end", "def tires_read_with_http_info(tire, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TiresApi.tires_read ...'\n end\n # verify the required parameter 'tire' is set\n if @api_client.config.client_side_validation && tire.nil?\n fail ArgumentError, \"Missing the required parameter 'tire' when calling TiresApi.tires_read\"\n end\n # resource path\n local_var_path = '/tires/{tire}/'.sub('{' + 'tire' + '}', tire.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'width'] = opts[:'width'] if !opts[:'width'].nil?\n query_params[:'width_min'] = opts[:'width_min'] if !opts[:'width_min'].nil?\n query_params[:'width_max'] = opts[:'width_max'] if !opts[:'width_max'].nil?\n query_params[:'aspect_ratio'] = opts[:'aspect_ratio'] if !opts[:'aspect_ratio'].nil?\n query_params[:'aspect_ratio_min'] = opts[:'aspect_ratio_min'] if !opts[:'aspect_ratio_min'].nil?\n query_params[:'aspect_ratio_max'] = opts[:'aspect_ratio_max'] if !opts[:'aspect_ratio_max'].nil?\n query_params[:'rim_diameter'] = opts[:'rim_diameter'] if !opts[:'rim_diameter'].nil?\n query_params[:'rim_diameter_min'] = opts[:'rim_diameter_min'] if !opts[:'rim_diameter_min'].nil?\n query_params[:'rim_diameter_max'] = opts[:'rim_diameter_max'] if !opts[:'rim_diameter_max'].nil?\n query_params[:'lang'] = opts[:'lang'] if !opts[:'lang'].nil?\n query_params[:'brands'] = opts[:'brands'] if !opts[:'brands'].nil?\n query_params[:'brands_exclude'] = opts[:'brands_exclude'] if !opts[:'brands_exclude'].nil?\n query_params[:'countries'] = opts[:'countries'] if !opts[:'countries'].nil?\n query_params[:'countries_exclude'] = opts[:'countries_exclude'] if !opts[:'countries_exclude'].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 = ['user_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 => 'Array<MakeWithModels>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TiresApi#tires_read\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get(path, params={})\n params = merge_set_up_params(params)\n @token = \"b3688c52-9235-45ca-b01f-c5b2b83a4f4f\"\n @result = Typhoeus::Request.get(API_URL + path, :params => params,\n :headers => {\"Authorization\" => \"Basic#{@token}\"})\n puts @result.body\n # check if the url looks correct in the log\n puts @result.effective_url\n # parse the result to json\n return JSON.parse(@result.body)\n end", "def index\n id = SecureRandom.uuid.to_s\n\n flag_info = {:id => id, :type => \"index\" }\n\n publish :flag, JSON.generate(flag_info)\n\n @flags, @auctions = get_flags(id)\n end", "def getstubjson(title_number)\n uri = URI.parse($STUBJSON)\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new('/' + title_number)\n request.basic_auth $http_auth_name, $http_auth_password\n response = http.request(request)\n if (response.code != '200') then\n raise \"Error in getting JSON for: \" + title_number\n end\n return response.body\nend", "def list_arrays_for_tenant(args = {}) \n get(\"/tenants.json/#{args[:tenantId]}/arrays\", args)\nend", "def index\n @ts = T.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ts }\n end\n end", "def index\n @taxis = Taxi.where(:open_for_bidding => true).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @taxis }\n end\n end", "def getTransaction( transaction_id)\n params = Hash.new\n params['transaction_id'] = transaction_id\n return doCurl(\"get\",\"/transaction\",params)\n end" ]
[ "0.61573625", "0.5871873", "0.5687385", "0.5572308", "0.5497737", "0.5352217", "0.5331107", "0.53251296", "0.5304984", "0.52813184", "0.5244673", "0.51920235", "0.5182054", "0.51745886", "0.51743996", "0.51705015", "0.51435184", "0.51237476", "0.5111508", "0.5111431", "0.5109851", "0.50980425", "0.5096156", "0.50960773", "0.506643", "0.50587636", "0.50587636", "0.5025172", "0.50211036", "0.5020144", "0.5012169", "0.50063246", "0.50052947", "0.50048643", "0.50044256", "0.5000514", "0.49944887", "0.49882618", "0.4986413", "0.4986413", "0.4985342", "0.4984409", "0.4982429", "0.4975141", "0.49746284", "0.49635938", "0.49420893", "0.4941972", "0.49403366", "0.49305272", "0.49275634", "0.4918001", "0.49172184", "0.4911351", "0.49072438", "0.49030635", "0.48948842", "0.48947728", "0.48912206", "0.48885423", "0.48797062", "0.48778546", "0.48761344", "0.48709658", "0.48701152", "0.48671845", "0.48637834", "0.4863372", "0.4861743", "0.48535484", "0.48516202", "0.48504484", "0.48502937", "0.48462585", "0.4836791", "0.4828643", "0.48269334", "0.4825991", "0.4818502", "0.48180673", "0.48178574", "0.4810628", "0.48059276", "0.480439", "0.4800857", "0.47992188", "0.4796997", "0.47856095", "0.47854298", "0.47826317", "0.47778982", "0.4775622", "0.47748533", "0.47741243", "0.4762813", "0.47596037", "0.47593033", "0.47589594", "0.47583714", "0.47557318" ]
0.6080764
1
GET /tidbits/1 GET /tidbits/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_tidbit\n @tidbit = Tidbit.find(params[:id])\n end", "def create\n @tidbit = Tidbit.new(tidbit_params)\n\n respond_to do |format|\n if @tidbit.save\n format.html { redirect_to @tidbit, notice: 'Tidbit was successfully created.' }\n format.json { render :show, status: :created, location: @tidbit }\n else\n format.html { render :new }\n format.json { render json: @tidbit.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @tidbits = Tidbit.all\n @tid_ruby = Tidbit.where(subject: \"ruby\")\n @tid_positive = Tidbit.where(subject: \"positive\")\n @tid_ee = Tidbit.where(subject: \"ee\")\n @tid_random = Tidbit.where(subject: \"random\")\n @tid_poker = Tidbit.where(subject: \"poker\")\n @tid_rails = Tidbit.where(subject: \"rails\")\n end", "def thing_flattrs(id,params={})\n get(\"/rest/v2/things/#{id}/flattrs\",params)\n end", "def transactionById\n results = HTTParty.get(\"http://192.168.99.101:4050/transactions/\" + (params[:id]).to_s)\n render json: results.parsed_response, status: results.code\n end", "def get_trip_detail(id)\n server_response = handle_timeouts do\n get \"/1/trips/#{id}.json?locale=en\"\n end\n server_response['response']\n end", "def show\n @torrent = Torrents.new(:url => \"http://newt.local:9091/transmission/rpc\").find(Integer(params[:id]))\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @torrent }\n end\n end", "def show\n @t = T.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @t }\n end\n end", "def get_tweet(search,since_id = 0, throtle = 20)\n\turl = 'http://search.twitter.com/search.json?q='+search+'&rpp='+throtle.to_s+'&since_id='+since_id.to_s\n\tprint \"Asking with this url \" + url+ \"\\n\"\n\tresp = Net::HTTP.get_response(URI.parse(url))\n\tresponse_array = JSON.parse(resp.body)\nend", "def show\n @tnumber = Tnumber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @tnumber }\n end\n end", "def show\n @tetramod = Tetramod.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tetramod }\n end\n end", "def show\n @tinymap = Tinymap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tinymap }\n end\n end", "def show\n @tinymap2 = Tinymap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tinymap2 }\n end\n end", "def get_blockchain_stats\n stats = HTTParty.get(\"http://webbtc.com/stats.json\")\nend", "def show\n @breadcrumb = 'read'\n @tariff_type = TariffType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tariff_type }\n end\n end", "def show\n @bitacora = Bitacora.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bitacora }\n end\n end", "def show\n @tramite = Tramite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tramite }\n end\n end", "def show\n @microtask = Microtask.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @microtask }\n end\n end", "def show\n tag = Tag.find_by_tid(params[:id])\n if tag.nil?\n render json_status_response(404, \"Tag not found\")\n return\n end\n\n render :status => 200,\n :json => tag_as_hash(tag).merge({\n status: 200,\n # TODO csrf\n })\n end", "def gettransaction(txid)\n request :gettransaction, txid\n end", "def index\n @tprimarytumors = Tprimarytumor.all\n respond_to do |format|\n format.html\n format.json { render :json => @tprimarytumors.map(&:attributes) }\n end\n end", "def show\n @tupian = Tupian.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tupian }\n end\n end", "def get(id)\n _get(\"/quick-scan/#{id}\") { |json| json }\n end", "def getdifficulty\n request :getdifficulty\n end", "def show\n @bottling = Bottling.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bottling }\n end\n end", "def trip(trip_id)\n connection.get(\"/trips/#{trip_id}\").body\n end", "def getdifficulty\n @api.request 'getdifficulty'\n end", "def tbu_list\n @client.make_request :get, templates_path('tbu')\n end", "def tattoos\n render :nothing => true and return if params[:id].nil?\n\n @tattoo = Tattoo.find(params[:id])\n render :json => @tattoo.to_json(:include => [:artist, :assets])\n #render :json => @tattoo.to_json(:include => { :assets => { :only => [:id, :data_file_name] } })\n return\n end", "def show\n @mosttinymobtrail = Mosttinymobtrail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mosttinymobtrail }\n end\n end", "def show\n @bloom = Bloom.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bloom }\n end\n end", "def get\n appid = ENV['TRIMET_APP_ID']\n response = Unirest.get( \"http://developer.trimet.org/ws/v2/vehicles?appid=#{appid}\" )\n response.body\nend", "def show\n @liber777_table = Liber777Table.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @liber777_table }\n end\n end", "def show\n @treq = Treq.find(params[:id])\n @treq_files = @treq.treq_files.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @treq }\n end\n end", "def index\n @trips = Trip.all\n\n render json: @trips\n end", "def index\n @trips = Trip.all\n\n render json: @trips\n end", "def GetTicket id\n\n APICall(path: \"tickets/#{id}.json\")\n\n end", "def trips_by_trip_id(trip_id)\n get \"/gtfs/trips/tripId/#{trip_id}\"\n end", "def show(id) \n response = request(:get, \"/recipes/#{id}.json\")\n response.first[1]\n end", "def get(transaction_id:)\n client.get(path: \"#{sub_path}/#{transaction_id}\", api_key: api_key)\n end", "def show\n @tier = Tier.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @tier }\n end\n end", "def get_transaction(tx_id:)\n client.make_request('/get-transaction', 'post', params: {tx_id: tx_id})\n end", "def index\n number_tweets = if params[\"count\"] then params[\"count\"].to_i else 10 end\n tweet_ids = []\n if @user.interests\n for i in 1..number_tweets\n interest = @user.interests.sample\n tweet = Rails.application.config.twitter_client.search(\"#{interest[:hashtag]}\", count: 1).take(1)\n tweet_ids.push(tweet.first.id.to_s)\n end\n end\n\n render json: tweet_ids, status: :ok\n end", "def vehicle_details tank_id\n request_string = \n \"/wot/encyclopedia/tankinfo/?application_id=#{APP_ID}&tank_id=#{tank_id}\"\n data = hash_from_request_string(request_string)\n return data[\"#{tank_id}\"]\nend", "def index\n @trips = Trip.all\n render :json => @trips\n end", "def show\n tile = Tile.find(params[:id]) \n render json: tile\n end", "def index\n @torrents = Torrents.new(:url => \"http://newt.local:9091/transmission/rpc\").load\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @torrents }\n end\n end", "def show\n @tktest = Tktest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tktest }\n end\n end", "def getToolsSyndicateTomtom( entity_id)\n params = Hash.new\n params['entity_id'] = entity_id\n return doCurl(\"get\",\"/tools/syndicate/tomtom\",params)\n end", "def getPageInfoByIDType(id, type)\n request('getPageInfoByIDType', {'id' => id, 'type' => type})\nend", "def update\n respond_to do |format|\n if @tidbit.update(tidbit_params)\n format.html { redirect_to @tidbit, notice: 'Tidbit was successfully updated.' }\n format.json { render :show, status: :ok, location: @tidbit }\n else\n format.html { render :edit }\n format.json { render json: @tidbit.errors, status: :unprocessable_entity }\n end\n end\n end", "def specific\n @state = State.find(params[:id])\n @loans = @state.loans.where(:purpose_id == params[:purpose_id])\n render json: { state: @state, loans: @loans }\n end", "def show\n @tag = Tag.find(params[:id])\n\n @tweets = @tag.tweets.paginate(:page => params[:page], :per_page => 20)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @tag }\n end\n end", "def tidbit_params\n params.require(:tidbit).permit(:body)\n end", "def get_sequence_from_togows(togows_url)\n url = URI.parse(togows_url)\n path = Net::HTTP::Get.new(url.path)\n Net::HTTP.start(url.host, url.port) {|http|\n res = http.request(path)\n res.body\n }\n end", "def get_sequence_from_togows(togows_url)\n url = URI.parse(togows_url)\n path = Net::HTTP::Get.new(url.path)\n Net::HTTP.start(url.host, url.port) {|http|\n res = http.request(path)\n res.body\n }\n end", "def index\n url = \"https://data.cityofchicago.org/resource/x2n5-8w5q.json\"\n options = { :body => {:status => text}, :basic_auth => @auth }\n @response = HTTParty.get(url, options)\n\n @crime = Hash.new\n\n #@crime['block'] = @response[0]['block']\n @crime = @response\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gittos }\n end\n end", "def get\n url = prefix + \"get\" + id_param\n return response(url)\n end", "def show\n @mint_coin = @coin.mint_coins.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @mint_coin }\n end\n end", "def index\n @trips = Trip.desc.all\n @latest_trip = @trips.first\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trips }\n end\n end", "def recipe_info_for(id)\n response = Faraday.get(\"https://api.spoonacular.com/recipes/#{id}/information?includeNutrition=true&apiKey=#{spoonacular_key}\")\n JSON.parse response.body\n end", "def show\n @breadcrumb = 'read'\n @timerecord_code = TimerecordCode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timerecord_code }\n end\n end", "def index\n respond_to do |format|\n format.html\n format.json { render json: Tissue.all }\n end\n \n end", "def show\n @bottle = Bottle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bottle }\n \tformat.json { render :json => @bottle }\n\t\tend\n end", "def tweets\n user = User.find(params[:id])\n render json: user.list_tweets, status: :ok\n end", "def index\n @tunes = Tune.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tunes }\n end\n end", "def show\n user = user_from_token\n @tweet = user.tweets.where(:id => params[:id])\n render :json => @tweet\n end", "def index\n @q = Tweet.order('created_at DESC').page(params[:page]).ransack(params[:q])\n @tweets = @q.result(distinct: true)\n # render json: @tweets.each {|tweet| tweet.id}\n end", "def set_tint\n @tint = Tint.find(params[:id])\n end", "def index\n @tintas = Tinta.all\n end", "def show\n @txt5 = Txt5.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @txt5 }\n end\n end", "def show\n @trips_connect = TripsConnect.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trips_connect }\n end\n end", "def getTransaction( transaction_id)\n params = Hash.new\n params['transaction_id'] = transaction_id\n return doCurl(\"get\",\"/transaction\",params)\n end", "def index\n @tacks = Tack.all\n\n render json: @tacks\n end", "def get_tags_by_url\n url = Url.find_by(id: params[:id])\n tags = url.tags\n render json: {code: 200, tags: tags}\n end", "def show\r\n tweet = Tweet.find(params[:id])\r\n render json: tweet\r\n end", "def index\n @specialties = Specialty.all\n\n render json: @specialties\n end", "def show\n @taxi = Taxi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @taxi }\n end\n end", "def index\n @tips_tricks = @tips_tricks.published.recent.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tips_tricks }\n end\n end", "def show \n @toy = Toy.find(params[:id]) \n # render json: Toy.find_by_id(params[:id]), status: :ok\n end", "def show\n @twitter_id = TwitterId.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @twitter_id }\n end\n end", "def show\n @territorio = Territorio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @territorio }\n end\n end", "def getstubjson(title_number)\n uri = URI.parse($STUBJSON)\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new('/' + title_number)\n request.basic_auth $http_auth_name, $http_auth_password\n response = http.request(request)\n if (response.code != '200') then\n raise \"Error in getting JSON for: \" + title_number\n end\n return response.body\nend", "def getblockchaininfo\n @api.request 'getblockchaininfo'\n end", "def get(path, params={})\n params = merge_set_up_params(params)\n @token = \"b3688c52-9235-45ca-b01f-c5b2b83a4f4f\"\n @result = Typhoeus::Request.get(API_URL + path, :params => params,\n :headers => {\"Authorization\" => \"Basic#{@token}\"})\n puts @result.body\n # check if the url looks correct in the log\n puts @result.effective_url\n # parse the result to json\n return JSON.parse(@result.body)\n end", "def get(path)\n response = http.get(path) do |req|\n req.headers['Accept'] = 'application/json'\n req.headers['Authorization'] = \"Bearer #{api_token}\"\n end\n\n raise NotFound if response.status == 404\n raise 'TVDB Error' unless response.success?\n\n JSON.parse(response.body)\n end", "def index\n @tribes = Tribe.all\n end", "def show\n puts params[:id]\n render json: Todo.find(params[:id])\n end", "def show\n @kitty = Kitty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kitty }\n end\n end", "def index\n @ts = T.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ts }\n end\n end", "def show\n @tutorial = Tutorial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tutorial.to_hash(false) }\n end\n end", "def show\n @torso = Torso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @torso }\n end\n end", "def get_tweet(id)\n\n\t\t# tweet = Tweet.where({:tweet_id => id})\n\n\n\tend", "def trips\n get '/gtfs/trips'\n end", "def trips\n flight = Flight.where(\"id = ?\", params[:id]).take\n if flight.nil?\n render :json => {errors: \"404\"}, :status => 404\n else\n respond_with( flight.trips )\n end\n end", "def tires_read_with_http_info(tire, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TiresApi.tires_read ...'\n end\n # verify the required parameter 'tire' is set\n if @api_client.config.client_side_validation && tire.nil?\n fail ArgumentError, \"Missing the required parameter 'tire' when calling TiresApi.tires_read\"\n end\n # resource path\n local_var_path = '/tires/{tire}/'.sub('{' + 'tire' + '}', tire.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'width'] = opts[:'width'] if !opts[:'width'].nil?\n query_params[:'width_min'] = opts[:'width_min'] if !opts[:'width_min'].nil?\n query_params[:'width_max'] = opts[:'width_max'] if !opts[:'width_max'].nil?\n query_params[:'aspect_ratio'] = opts[:'aspect_ratio'] if !opts[:'aspect_ratio'].nil?\n query_params[:'aspect_ratio_min'] = opts[:'aspect_ratio_min'] if !opts[:'aspect_ratio_min'].nil?\n query_params[:'aspect_ratio_max'] = opts[:'aspect_ratio_max'] if !opts[:'aspect_ratio_max'].nil?\n query_params[:'rim_diameter'] = opts[:'rim_diameter'] if !opts[:'rim_diameter'].nil?\n query_params[:'rim_diameter_min'] = opts[:'rim_diameter_min'] if !opts[:'rim_diameter_min'].nil?\n query_params[:'rim_diameter_max'] = opts[:'rim_diameter_max'] if !opts[:'rim_diameter_max'].nil?\n query_params[:'lang'] = opts[:'lang'] if !opts[:'lang'].nil?\n query_params[:'brands'] = opts[:'brands'] if !opts[:'brands'].nil?\n query_params[:'brands_exclude'] = opts[:'brands_exclude'] if !opts[:'brands_exclude'].nil?\n query_params[:'countries'] = opts[:'countries'] if !opts[:'countries'].nil?\n query_params[:'countries_exclude'] = opts[:'countries_exclude'] if !opts[:'countries_exclude'].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 = ['user_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 => 'Array<MakeWithModels>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TiresApi#tires_read\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @kitten = Kitten.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kitten }\n end\n end", "def get_trails_by_id(params = {})\n request_by_ids(\"get-trails-by-id\", params)\n end", "def show\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip }\n end\n end", "def show\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip }\n end\n end", "def destroy\n @tidbit.destroy\n respond_to do |format|\n format.html { redirect_to tidbits_url, notice: 'Tidbit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.6305381", "0.59881765", "0.591504", "0.57948226", "0.57537085", "0.56509244", "0.5624073", "0.55232847", "0.5493613", "0.54709756", "0.54389286", "0.53930604", "0.5369768", "0.53646183", "0.53584266", "0.5316135", "0.5312515", "0.5312228", "0.52966183", "0.52955174", "0.5285901", "0.5278793", "0.5273533", "0.5267316", "0.52565783", "0.52461946", "0.52421343", "0.5237797", "0.5233925", "0.52327937", "0.5228753", "0.52262235", "0.52236336", "0.5215665", "0.5204016", "0.5204016", "0.5200128", "0.518449", "0.51814353", "0.5176499", "0.5165724", "0.5162054", "0.5152832", "0.51517105", "0.5151658", "0.51468", "0.5140072", "0.51341045", "0.51339954", "0.5129837", "0.5128974", "0.5127049", "0.5125151", "0.5123631", "0.5119816", "0.5119816", "0.51193255", "0.51172537", "0.51148903", "0.51075447", "0.51053774", "0.51025045", "0.5099701", "0.5098323", "0.5092157", "0.5088417", "0.50869334", "0.5086546", "0.5075971", "0.5061396", "0.5058009", "0.5056914", "0.5051004", "0.5048374", "0.5045369", "0.5038368", "0.5037302", "0.5036952", "0.50317925", "0.5030047", "0.5029841", "0.50291526", "0.5025687", "0.50213385", "0.5012234", "0.5011115", "0.5003403", "0.49895084", "0.49875283", "0.49873608", "0.4986558", "0.4983448", "0.49831426", "0.49817288", "0.49719402", "0.49695483", "0.49672297", "0.49640036", "0.49628362", "0.49628362", "0.4962063" ]
0.0
-1
POST /tidbits POST /tidbits.json
def create @tidbit = Tidbit.new(tidbit_params) respond_to do |format| if @tidbit.save format.html { redirect_to @tidbit, notice: 'Tidbit was successfully created.' } format.json { render :show, status: :created, location: @tidbit } else format.html { render :new } format.json { render json: @tidbit.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tidbit_params\n params.require(:tidbit).permit(:body)\n end", "def set_tidbit\n @tidbit = Tidbit.find(params[:id])\n end", "def create_twit(twit)\n RestClient.post configuration.base_url + '/twits',\n { twit: twit }.to_json,\n content_type: :json,\n accept: :json\n end", "def test_create_transaction\n params = {\n bank_transaction: {\n bank_account_id: 1,\n date: Time.local(2012, 4, 16),\n amount: 55\n }\n }\n\n post '/api/banks/1/transactions', params\n data = ActiveSupport::JSON.decode last_response.body\n\n assert last_response.successful?\n assert_match('application/json', last_response.content_type)\n assert BankTransaction.find(data['id'])\n end", "def create(bin_params)\n @rest.post('save', bin_params)\n end", "def send_post_request(body)\n response = HTTParty.post(\n url.to_str,\n :body => body.to_json,\n :headers => { 'Content-Type' => 'application/json' },\n :basic_auth => auth,\n verify: false\n )\n\n logger.debug(\n \"POST Request to Turbulence: \\n\" +\n \"\\tURL: #{url.to_str}\\n\" +\n \"\\tAUTH: #{auth}\\n\" +\n \"\\tBODY: #{body.to_json}\"\n )\n\n unless response.success?\n raise \"Request to turbulence(#{url.to_str}) failed, \\n\" +\n \"\\tauth: #{auth.inspect}, \\n\" +\n \"\\tBody: #{body}, \\n\" +\n \"\\tResponse: #{response.body}\"\n end\n response_body = JSON.parse(response.body)\n return response_body[\"ID\"]\n end", "def postSignal( entity_id, country, gen_id, signal_type, data_type, inactive_reason, inactive_description, feedback)\n params = Hash.new\n params['entity_id'] = entity_id\n params['country'] = country\n params['gen_id'] = gen_id\n params['signal_type'] = signal_type\n params['data_type'] = data_type\n params['inactive_reason'] = inactive_reason\n params['inactive_description'] = inactive_description\n params['feedback'] = feedback\n return doCurl(\"post\",\"/signal\",params)\n end", "def bit_params\n params.require(:bit).permit(:title, :headline, :footline, :description)\n end", "def postTransaction(useridgiving, useridreceiving, amount)\n parameters={useridgiving: useridgiving.to_i, useridreceiving: useridreceiving.to_i, amount: amount.to_f, state: \"initial\"}\n options = {\n :body => parameters.to_json,\n :headers => {\n 'Content-Type' => 'application/json'\n }\n }\n results = HTTParty.post(\"http://192.168.99.101:4050/transactions\", options) # create initial state\n return results\n end", "def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend", "def post operation, data={}\n body = case data\n when String\n body = data\n else\n Yajl::Encoder.encode(data)\n end\n\n request = new_request operation, body\n request.sign sts\n hydra.queue request\n hydra.run\n response = request.response\n puts response.inspect if @debug\n\n if response.code == 200\n Yajl::Parser.parse response.body\n else\n raise_error response\n end\n end", "def tombstone_timehold_params\n params.require(:tombstone_timehold).permit(:tombstoneJSON, :permanent, :rating)\n end", "def update\n respond_to do |format|\n if @tidbit.update(tidbit_params)\n format.html { redirect_to @tidbit, notice: 'Tidbit was successfully updated.' }\n format.json { render :show, status: :ok, location: @tidbit }\n else\n format.html { render :edit }\n format.json { render json: @tidbit.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n megam_rest.post_node(to_hash)\n end", "def add task_details\n\n #prepare payload\n now = Time.now.to_i \n defaults = {\n \"method\" => \"task.save\",\n \"id\" => UUID.generate,\n \"type\" => 0,\n \"_type\" => now,\n \"state\" => 0,\n \"_state\" => now,\n }\n\n task = defaults.merge(task_details)\n self.post [task].to_json\n end", "def post_webhook\n HTTParty.post(\n \"https://api.trello.com/1/tokens/#{user.token}/webhooks/?key=#{ENV['TRELLO_KEY']}\",\n query: {\n description: \"Sprint webhook user#{user.id}\",\n callbackURL: \"#{ENV['BASE_URL']}webhooks\",\n idModel: trello_ext_id\n },\n headers: { \"Content-Type\" => \"application/json\" }\n )\n end", "def create\n @bits_1 = Bits1.new(bits_1_params)\n\n respond_to do |format|\n if @bits_1.save\n format.html { redirect_to @bits_1, notice: 'Bits 1 was successfully created.' }\n format.json { render action: 'show', status: :created, location: @bits_1 }\n else\n format.html { render action: 'new' }\n format.json { render json: @bits_1.errors, status: :unprocessable_entity }\n end\n end\n end", "def txs_decode_post(tx, opts = {})\n data, _status_code, _headers = txs_decode_post_with_http_info(tx, opts)\n data\n end", "def create\n @tarot_bot = TarotBot.new(tarot_bot_params)\n\n if @tarot_bot.save\n render json: { status: :ok }\n else\n render json: { status: :internal_server_error }\n end\n end", "def txs_decode_post_with_http_info(tx, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransactionsApi.txs_decode_post ...'\n end\n # verify the required parameter 'tx' is set\n if @api_client.config.client_side_validation && tx.nil?\n fail ArgumentError, \"Missing the required parameter 'tx' when calling TransactionsApi.txs_decode_post\"\n end\n # resource path\n local_var_path = '/txs/decode'\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(tx)\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 => 'StdTx')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionsApi#txs_decode_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def post(url)\n options = { :body => { \n :__VIEWSTATE => '/wEPDwUJNTI1NzY5NDcyD2QWAgIDD2QWFAIfDw8WBB4EVGV4dAUPQ29udGFpbiBTZWFyY2g6HgdWaXNpYmxlZ2RkAiEPEA8WAh8BZ2RkZGQCLQ8QDxYGHg1EYXRhVGV4dEZpZWxkBQ1EaXN0cmljdF9OYW1lHg5EYXRhVmFsdWVGaWVsZAUNRGlzdHJpY3RfQ29kZR4LXyFEYXRhQm91bmRnZBAVFAZTRUxFQ1QjQmFua3VyYSAgICAgICAgICAgICAgICAgICAgICAgIFswMV0jQnVyZHdhbiAgICAgICAgICAgICAgICAgICAgICAgIFswMl0jQmlyYmh1bSAgICAgICAgICAgICAgICAgICAgICAgIFswM10jRGFyamVlbGluZyAgICAgICAgICAgICAgICAgICAgIFswNF0jSG93cmFoICAgICAgICAgICAgICAgICAgICAgICAgIFswNV0jSG9vZ2hseSAgICAgICAgICAgICAgICAgICAgICAgIFswNl0jSmFscGFpZ3VyaSAgICAgICAgICAgICAgICAgICAgIFswN10jQ29vY2hiZWhhciAgICAgICAgICAgICAgICAgICAgIFswOF0jTWFsZGEgICAgICAgICAgICAgICAgICAgICAgICAgIFswOV0jUGFzY2hpbSBNaWRuYXBvcmUgICAgICAgICAgICAgIFsxMF0jUHVyYmEgTWlkbmFwb3JlICAgICAgICAgICAgICAgIFsxMV0jTXVyc2hpZGFiYWQgICAgICAgICAgICAgICAgICAgIFsxMl0jTmFkaWEgICAgICAgICAgICAgICAgICAgICAgICAgIFsxM10jUHVydWxpYSAgICAgICAgICAgICAgICAgICAgICAgIFsxNF0jTm9ydGggMjQtUGFyZ2FuYXMgICAgICAgICAgICAgIFsxNV0jU291dGggMjQtUGFyZ2FuYXMgICAgICAgICAgICAgIFsxNl0jRGFrc2hpbiBEaW5hanB1ciAgICAgICAgICAgICAgIFsxN10jVXR0YXIgRGluYWpwdXIgICAgICAgICAgICAgICAgIFsxOF0jS29sa2F0YSAgICAgICAgICAgICAgICAgICAgICAgIFsxOV0VFAEwAjAxAjAyAjAzAjA0AjA1AjA2AjA3AjA4AjA5AjEwAjExAjEyAjEzAjE0AjE1AjE2AjE3AjE4AjE5FCsDFGdnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnFgFmZAIxDxAPFggfAgUKQkxPQ0tfTkFNRR8DBQpCTE9DS19DT0RFHwRnHgdFbmFibGVkZ2QQFQEDQUxMFQEAFCsDAWcWAWZkAjMPDxYEHwAFC1BhbmNoYXlhdCA6HwFoZGQCNQ8QDxYKHwIFB0dQX05BTUUfAwUHR1BfQ09ERR8EZx8BaB8FaGQQFQAVABQrAwAWAGQCNw8PFgQfAAUHTW91emEgOh8BaGRkAjkPEA8WCB8CBQtFTkdfTU9VTkFNRR8DBQdtb3Vjb2RlHwRnHwFoZBAVABUAFCsDABYAZAI7DxAPFgIfAWdkZBYBZmQCPw88KwALAgAPFgoeC18hSXRlbUNvdW50Zh4IRGF0YUtleXMWAB8BaB4JUGFnZUNvdW50AgEeFV8hRGF0YVNvdXJjZUl0ZW1Db3VudGZkATwrABQCAzwrAAQBABYCHwFnBDwrAAQBABYCHwFoZGR/u9mK2BOq0HHWP5gKuP0KvXCJ3A==',\n :__EVENTTARGET => 'ddlDistrict', \n :__EVENTARGUMENT => ''\n }}\n self.class.post(url, options)\n end", "def add_pbts pbts\n params = init_params\n params[:pbts] = pbts.to_json\n request_url = UrlGenerator.url_for(\"pbts\", \"add\")\n asgn = SignatureGenerator.signature_for(http_verb: 'POST', url: request_url, params: params)\n\n res = self.post(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 txs_encode_post_with_http_info(tx, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransactionsApi.txs_encode_post ...'\n end\n # verify the required parameter 'tx' is set\n if @api_client.config.client_side_validation && tx.nil?\n fail ArgumentError, \"Missing the required parameter 'tx' when calling TransactionsApi.txs_encode_post\"\n end\n # resource path\n local_var_path = '/txs/encode'\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(tx)\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 => 'InlineResponse2003')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionsApi#txs_encode_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def twizzle_params\n params.require(:twizzle).permit(:user_id, :content)\n end", "def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end", "def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end", "def txs_encode_post(tx, opts = {})\n data, _status_code, _headers = txs_encode_post_with_http_info(tx, opts)\n data\n end", "def create\n @tinta = Tinta.new(tinta_params)\n\n respond_to do |format|\n if @tinta.save\n format.html { redirect_to @tinta, notice: 'Tinta was successfully created.' }\n format.json { render :show, status: :created, location: @tinta }\n else\n format.html { render :new }\n format.json { render json: @tinta.errors, status: :unprocessable_entity }\n end\n end\n end", "def api_post(action, data, binary_key = nil)\n api_request(action, data, 'POST', binary_key)\n end", "def test_post_sample_traces\n header 'Content-Type', 'application/json'\n\n (0..4).each do |i|\n data = File.read \"sample-traces/#{i}.json\"\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n assert last_response.ok?\n end\n end", "def create(input)\n @response = self.request(Net::HTTP::Post.new(\n \"/stikkits.atom?raw_text=#{CGI.escape(input)}\"\n ))\n #-- TODO: This should be processed and useful output presented\n #++\n puts @response.body\n end", "def tweet­_params\n params.require(:tweet­).permit(:status, :zombie_id)\n end", "def tottle_params\n params.require(:tottle).permit(:message, :user_id)\n end", "def create\n @bitacora = Bitacora.new(params[:bitacora])\n\n respond_to do |format|\n if @bitacora.save\n format.html { redirect_to @bitacora, notice: 'Bitacora was successfully created.' }\n format.json { render json: @bitacora, status: :created, location: @bitacora }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bitacora.errors, status: :unprocessable_entity }\n end\n end\n end", "def make_tn_request( opts={} )\n\t\topts = TEST_REQUEST_OPTS.merge( opts )\n\t\theaders = normalize_headers( opts )\n\n\t\theaderstring = TNetstring.dump( headers )\n\t\tbodystring = TNetstring.dump( opts[:body] || '' )\n\n\t\t# UUID ID PATH SIZE:HEADERS,SIZE:BODY,\n\t\tdata = \"%s %d %s %s%s\" % [\n\t\t\topts[:uuid],\n\t\t\topts[:id],\n\t\t\topts[:path],\n\t\t\theaderstring,\n\t\t\tbodystring,\n\t\t]\n\t\treturn data.encode( 'binary' )\n\tend", "def make_tn_request( opts={} )\n\t\topts = TEST_REQUEST_OPTS.merge( opts )\n\t\theaders = normalize_headers( opts )\n\n\t\theaderstring = TNetstring.dump( headers )\n\t\tbodystring = TNetstring.dump( opts[:body] || '' )\n\n\t\t# UUID ID PATH SIZE:HEADERS,SIZE:BODY,\n\t\tdata = \"%s %d %s %s%s\" % [\n\t\t\topts[:uuid],\n\t\t\topts[:id],\n\t\t\topts[:path],\n\t\t\theaderstring,\n\t\t\tbodystring,\n\t\t]\n\t\treturn data.encode( 'binary' )\n\tend", "def destroy\n @tidbit.destroy\n respond_to do |format|\n format.html { redirect_to tidbits_url, notice: 'Tidbit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @tinymap = Tinymap.new(params[:tinymap])\n\n respond_to do |format|\n if @tinymap.save\n format.html { redirect_to @tinymap, notice: 'Tinymap was successfully created.' }\n format.json { render json: @tinymap, status: :created, location: @tinymap }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tinymap.errors, status: :unprocessable_entity }\n end\n end\n end", "def postBusiness_tool( tool_id, country, headline, description, link_url, active)\n params = Hash.new\n params['tool_id'] = tool_id\n params['country'] = country\n params['headline'] = headline\n params['description'] = description\n params['link_url'] = link_url\n params['active'] = active\n return doCurl(\"post\",\"/business_tool\",params)\n end", "def create\n @tetramod = Tetramod.new(params[:tetramod])\n\n respond_to do |format|\n if @tetramod.save\n format.html { redirect_to @tetramod, notice: 'Tetramod was successfully created.' }\n format.json { render json: @tetramod, status: :created, location: @tetramod }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tetramod.errors, status: :unprocessable_entity }\n end\n end\n end", "def tin_params\n params.require(:tin).permit(:description, :image)\n end", "def create\n @tenacity = current_user.tenacities.new(tenacity_params)\n\n respond_to do |format|\n if @tenacity.save\n format.html { redirect_to @tenacity, notice: 'Tenacity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tenacity }\n else\n format.html { render action: 'new' }\n format.json { render json: @tenacity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_trip\n # Only attempt to create trip if all the necessary pieces are there\n return false unless @itinerary && @trip && @service && @user\n \n label = request_label(:book, trip_id)\n \n @http_request_bundler.add(\n label, \n @url + \"/create_trip\", \n :post,\n head: headers,\n body: body_for_booking(@booking_options).to_json\n ).response!(label)\n end", "def test_create_a_task_with_valid_attributes\n post '/tasks', { task: { title: \"something\", description: \"else\", user_id: 1 } } # post '/tasks', { task: { title: \"something\", description: \"else\", user_id: 1, status_id: 1 } }\n assert_equal 1, Task.count # count is a method that ActiveRecord gives us\n assert_equal 200, last_response.status\n assert_equal \"created!\", last_response.body\n end", "def create\n @tottle = Tottle.new(tottle_params)\n\n respond_to do |format|\n if @tottle.save\n format.html { redirect_to @tottle, notice: 'Tottle was successfully created.' }\n format.json { render :show, status: :created, location: @tottle }\n else\n format.html { render :new }\n format.json { render json: @tottle.errors, status: :unprocessable_entity }\n end\n end\n end", "def post\n Rentlinx.client.post(self)\n end", "def tantosha_params\n params.require(:tantosha).permit(:tannto_code, :tanto_name, :password)\n end", "def create\n @fbt = Fbt.new(fbt_params)\n\n respond_to do |format|\n if @fbt.save\n format.html { redirect_to @fbt, notice: \"Fbt was successfully created.\" }\n format.json { render :show, status: :created, location: @fbt }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @fbt.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n transaction = params[\"transaction\"]\n patient = Patient.generate_mckid(transaction)\n patient.save\n\n transaction[\"transaction_types\"].each do |key, value|\n if value == \"1\"\n Transaction.create(mck_id: patient&.guid.upcase, data_type: key )\n end\n end\n\n respond_to do |format|\n format.html { redirect_to new_transaction_path, notice: 'Transaction was successfully created.' }\n end\n end", "def post(hash)\n connection.post do |conn|\n if hash[:content_type]\n conn.headers[\"Content-Type\"] = hash[:content_type]\n end\n\n conn.url(hash[:path], :access_token => access_token)\n conn.body = hash[:body]\n end\n end", "def create\n @bike = Bike.new(params.permit(:bike_index_uid, :user_id))\n @bike.hash_code = generate_hash\n\n respond_to do |format|\n if @bike.save\n format.html { redirect_to @bike, notice: 'Your bike is now verified!' }\n format.json { render :show, status: :created, location: @bike }\n else\n format.html { render :new }\n format.json { render json: @bike.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_arrays_to_tenant(args = {}) \n post(\"/tenants.json/#{args[:tenantId]}/arrays\", args)\nend", "def create\n megam_rest.post_billedhistories(to_hash)\n end", "def create\n @ty = Tie.new(ty_params)\n\n respond_to do |format|\n if @ty.save\n format.html { redirect_to @ty, notice: 'Tie was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ty }\n else\n format.html { render action: 'new' }\n format.json { render json: @ty.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bowl = Bowl.new(params[:bowl])\n \n # set the current user's id and the creation time for this bowl\n @bowl.user_id = session[:user].userid.to_i\n @bowl.created = Time.now\n \n respond_to do |format|\n if @bowl.save\n\n Rails.logger.info \"Adding contents for bowl\"\n \n params.keys.each do |param|\n if param.start_with?(\"input_\") and (params[param] != \"\") \n @bowl.contents.create(:bowl_id => @bowl.id, :dryfruit_id => param[6, 2], :quantity => params[param]) \n end\n end\n \n format.html { redirect_to bowls_path, :notice => 'Bowl was successfully created.' }\n format.json { render :json => @bowl, :status => :created, :location => @bowl }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end", "def tx_params\n params.require(:tx).permit(:txhash, :txdata)\n end", "def create\n HTTParty.post(create_url, :options => { :headers => HEADERS })\n end", "def create_node(params)\n node = @tinkit_class.new(params)\n node.__save\n node\n #TODO: What if params includes attachments?\n end", "def create\n @tnumber = Tnumber.new(params[:tnumber])\n\n respond_to do |format|\n if @tnumber.save\n format.html { redirect_to @tnumber, :notice => 'Tnumber was successfully created.' }\n format.json { render :json => @tnumber, :status => :created, :location => @tnumber }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @tnumber.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\t\turi = URI.parse(Counter::Application.config.simplyurl)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\n\t\trequest = Net::HTTP::Post.new('/offsets.json')\n\t\tputs params\n\t\tputs params.slice(*['custids','acctids','itemids'])\n\t\t\n\t\t# ok, this join stuff is bogus - it encodes properly, but the other side only sees the last element and loses the array type - it's just string\n\t\t# this way, i 'split' it at the other side to recover my array\n\t\t# it should work without the join/split crap, but it doesn't\n\t\trequest.set_form_data({:custids => ( params['custids'] || []).join(','), :acctids => ( params['acctids'] || []).join(','), :itemids => ( params['itemids'] || []).join(','), :amount => params['amount'], :type => params['type']})\n\t\t\n\t\tputs request.body\n\t\t\n\t\tresponse = http.request(request)\n\t\tputs response.body\n\n respond_to do |format|\n format.html { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n format.json { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n end\n end", "def create\n @tack = Tack.new(tack_params)\n\n if @tack.save\n render json: @tack, status: :created, location: @tack\n else\n render json: @tack.errors, status: :unprocessable_entity\n end\n end", "def post_json(path, body)\n uri = build_uri(path)\n #puts \"🤖 POST #{path}\"\n #puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n #puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n #puts result[:result]\n result\nend", "def create\n @tissue = Tissue.new(tissue_params)\n\n respond_to do |format|\n if @tissue.save\n format.html { redirect_to @tissue, notice: 'Tissue was successfully created.' }\n format.json { render :show, status: :created, location: @tissue }\n else\n format.html { render :new }\n format.json { render json: @tissue.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @twizzle = Twizzle.new(twizzle_params)\n\n respond_to do |format|\n if @twizzle.save\n format.html { redirect_to @twizzle, notice: 'Twizzle was successfully created.' }\n format.json { render :show, status: :created, location: @twizzle }\n else\n format.html { render :new }\n format.json { render json: @twizzle.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_ticket(params)\n ticket = Lighthouse::Ticket.new(:project_id => project_id)\n ticket.title = params[:title]\n ticket.body = params[:body]\n ticket.tags = params[:tags]\n ticket.save\n end", "def create_revision(id, bin_params)\n @rest.post(\"#{id}/save\", bin_params)\n end", "def trip_params\n params.require(:trip).permit(:name, :description, :user_id, :start_date, :airport_id, :base64, attendee_ids:[], leg_ids:[])\n end", "def create_post(params)\n mock_request = Rack::MockRequest.new(APP)\n mock_request.post(new_post_endpoint, { 'router.params' => params, format: :json })\n end", "def create\n @tarot = Tarot.new(tarot_params)\n\n respond_to do |format|\n if @tarot.save\n format.html { redirect_to @tarot, notice: 'Tarot was successfully created.' }\n format.json { render :show, status: :created, location: @tarot }\n else\n format.html { render :new }\n format.json { render json: @tarot.errors, status: :unprocessable_entity }\n end\n end\n end", "def postEntityPhone( entity_id, number, trackable)\n params = Hash.new\n params['entity_id'] = entity_id\n params['number'] = number\n params['trackable'] = trackable\n return doCurl(\"post\",\"/entity/phone\",params)\n end", "def create\n @tprimarytumor = Tprimarytumor.new(tprimarytumor_params)\n\n respond_to do |format|\n if @tprimarytumor.save\n format.html { redirect_to @tprimarytumor, notice: 'tprimarytumor was successfully created.' }\n format.json { render :show, status: :created, location: @tprimarytumor }\n else\n format.html { render :new }\n format.json { render json: @tprimarytumor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params[:postit_task][:sequence] = 1\n params[:postit_task][:checked] = \"N\"\n params[:postit_task][:optional] = \"N\"\n \n @postit_task = PostitTask.new(params[:postit_task])\n if @postit_task.save\n flash[:notice] = 'Cette tâche a été correctement créée.'.trn\n redirect_to :action => \"list\"\n else\n render :action => 'new'\n end\n end", "def tombstone_timehold_params_from_lomat\n params.permit(:tombstoneJSON, :permanent, :rating)\n end", "def create\n @tktest = Tktest.new(params[:tktest])\n\n respond_to do |format|\n if @tktest.save\n format.html { redirect_to @tktest, notice: 'Tktest was successfully created.' }\n format.json { render json: @tktest, status: :created, location: @tktest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tktest.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @checklist = Checklist.new(params[:checklist])\n \n random_string = ActiveSupport::SecureRandom.hex(5)\n while Checklist.find_by_tag(random_string) != nil\n random_string = ActiveSupport::SecureRandom.hex(5)\n end\n @checklist.tag = random_string\n \n respond_to do |format|\n if @checklist.save\n format.html { redirect_to @checklist, notice: 'Checklist was successfully created.' }\n format.json { render json: @checklist, status: :created, location: @checklist }\n else\n format.html { render action: \"new\" }\n format.json { render json: @checklist.errors, status: :unprocessable_entity }\n end\n end\n end", "def postWebcard( entity_id)\n params = Hash.new\n params['entity_id'] = entity_id\n return doCurl(\"post\",\"/webcard\",params)\n end", "def create\n @treq = Treq.new(params[:treq])\n \n respond_to do |format|\n if @treq.save\n unless params[:treq_files].blank?\n params[:treq_files]['file'].each do |a|\n @treq_file = @treq.treq_files.create!(:file => a, :treq_id => @treq.id)\n end\n end\n TreqNotifier.submit_treq(@treq).deliver\n format.html { redirect_to @treq, notice: 'Treq was successfully created.' }\n format.json { render json: @treq, status: :created, location: @treq }\n else\n format.html { render action: \"new\", alert: \"Test Requset has been submitted.\"}\n format.json { render json: @treq.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bottling = Bottling.new(params[:bottling])\n\n respond_to do |format|\n if @bottling.save\n format.html { redirect_to @bottling, notice: 'bottling was successfully created.' }\n format.json { render json: @bottling, status: :created, location: @bottling }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bottling.errors, status: :unprocessable_entity }\n end\n end\n end", "def turistic_spot_post_params\n params.require(:turistic_spot_post).permit(:turistic_post_id)\n end", "def post(path, options = {})\n nonce, signature = generate_signature\n options = options.merge(key: @api_key, nonce: nonce, signature: signature)\n result = @connection.post(\"#{path}/\", options).body\n JSON.parse(result)\n end", "def create\n @bloom = Bloom.new(params[:bloom])\n\n respond_to do |format|\n if @bloom.save\n format.html { redirect_to @bloom, notice: 'Bloom was successfully created.' }\n format.json { render json: @bloom, status: :created, location: @bloom }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bloom.errors, status: :unprocessable_entity }\n end\n end\n end", "def post payload, path = \"\" \n make_request(path, \"post\", payload)\n end", "def POST; end", "def bits_1_params\n params.require(:bits_1).permit(:user_id, :bit_cost, :comment)\n end", "def post_new_gist content \n\t\t\t\turl = GITHUB_API_GIST_LINK \n\t\t\t\tresponse = https_open_for ({url: url, mthd:\"post\", content: content})\n \t\t\t\tJSON.parse response.body\n\t\t\tend", "def signed_post_request url, body\n body_json= body.to_json\n token = jwt_post_signature url, body_json\n HTTParty.post('http://localhost:5000'+url,\n {headers:{\n \"Authorization\"=>\"JWT token=\\\"#{token}\\\"\",\n \"Content-Type\"=> \"application/json;charset=utf-8\",\n },\n body: body_json}\n )\n\n end", "def create\n @tombstone_timehold = TombstoneTimehold.new(tombstone_timehold_params)\n\n respond_to do |format|\n if @tombstone_timehold.save\n format.html { redirect_to @tombstone_timehold, notice: 'Tombstone timehold was successfully created.' }\n format.json { render :show, status: :created, location: @tombstone_timehold }\n else\n format.html { render :new }\n format.json { render json: @tombstone_timehold.errors, status: :unprocessable_entity }\n end\n end\n end", "def postReadings(info, state)\r\n params = {\r\n :device_id => info.deviceId,\r\n :sensor_data => [\r\n {\r\n :type => \"Temperature\",\r\n :value => state.temperature,\r\n :time => Time.now.to_i\r\n },\r\n {\r\n :type => \"Humidity\",\r\n :value => state.humidity,\r\n :time => Time.now.to_i\r\n }\r\n ]\r\n }\r\n res = apiPostJson(\"readings\", params)\r\n if res.status != 201\r\n $LOG.warn(\"Failed to post readings to backend! Status: #{res.status}, Response: #{res.body}\")\r\n end\r\n end", "def create\n\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n create_multiple_tags(task_params[\"tag\"], @task.id)\n\n format.html { redirect_to @task.list, notice: \"Task successfully created\" }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tcredito = Tcredito.new(tcredito_params)\n\n respond_to do |format|\n if @tcredito.save\n format.html { redirect_to @tcredito, notice: 'Tcredito was successfully created.' }\n format.json { render :show, status: :created, location: @tcredito }\n else\n format.html { render :new }\n format.json { render json: @tcredito.errors, status: :unprocessable_entity }\n end\n end\n end", "def create body = {}\n @connection.request(method: :post, path: \"/secrets/create\", headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end", "def create\n @tenki = Tenki.new(tenki_params)\n\n respond_to do |format|\n if @tenki.save\n format.html { redirect_to @tenki, notice: 'Tenki was successfully created.' }\n format.json { render :show, status: :created, location: @tenki }\n else\n format.html { render :new }\n format.json { render json: @tenki.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @turistum = Turistum.new(turistum_params)\n\n respond_to do |format|\n if @turistum.save\n format.html { redirect_to @turistum, notice: 'Turistum was successfully created.' }\n format.json { render :show, status: :created, location: @turistum }\n else\n format.html { render :new }\n format.json { render json: @turistum.errors, status: :unprocessable_entity }\n end\n end\n end", "def terms_id_term_post_with_http_info(id_term, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TermsApi.terms_id_term_post ...'\n end\n # verify the required parameter 'id_term' is set\n if @api_client.config.client_side_validation && id_term.nil?\n fail ArgumentError, \"Missing the required parameter 'id_term' when calling TermsApi.terms_id_term_post\"\n end\n # resource path\n local_var_path = '/terms/{id_term}'.sub('{' + 'id_term' + '}', id_term.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params['language'] = opts[:'language'] if !opts[:'language'].nil?\n form_params['file_content'] = opts[:'file_content'] if !opts[:'file_content'].nil?\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 => 'TermsOfService')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TermsApi#terms_id_term_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @tramite = Tramite.new(params[:tramite])\n\n respond_to do |format|\n if @tramite.save\n format.html { redirect_to @tramite, notice: 'Tramite was successfully created.' }\n format.json { render json: @tramite, status: :created, location: @tramite }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tramite.errors, status: :unprocessable_entity }\n end\n end\n end", "def tint_params\n params.fetch(:tint, {}).permit(:name)\n end", "def create\n @bicyclepost = Bicyclepost.new(bicyclepost_params)\n\n respond_to do |format|\n if @bicyclepost.save\n format.html { redirect_to @bicyclepost, notice: 'Bicyclepost was successfully created.' }\n format.json { render :show, status: :created, location: @bicyclepost }\n else\n format.html { render :new }\n format.json { render json: @bicyclepost.errors, status: :unprocessable_entity }\n end\n end\n end", "def tribal_membership_params\n params.permit(:id, :tribe_id)\n end", "def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts JSON.pretty_generate(result)\n result\nend", "def postEntityAdvertiserTag( gen_id, entity_id, language, tags_to_add, tags_to_remove)\n params = Hash.new\n params['gen_id'] = gen_id\n params['entity_id'] = entity_id\n params['language'] = language\n params['tags_to_add'] = tags_to_add\n params['tags_to_remove'] = tags_to_remove\n return doCurl(\"post\",\"/entity/advertiser/tag\",params)\n end" ]
[ "0.67257637", "0.6064634", "0.5403469", "0.5387822", "0.53811026", "0.529706", "0.5264566", "0.52413356", "0.52254593", "0.51839864", "0.51720685", "0.5170495", "0.51580316", "0.5088447", "0.50763184", "0.50667524", "0.50548977", "0.50353134", "0.5028679", "0.5028118", "0.50277853", "0.49965528", "0.4988765", "0.49750602", "0.49736026", "0.49728787", "0.49694514", "0.49349463", "0.49317777", "0.4930361", "0.49260724", "0.49231112", "0.49057615", "0.48875296", "0.4887298", "0.4887298", "0.48842978", "0.48786414", "0.48773143", "0.48724934", "0.4863493", "0.48584646", "0.483768", "0.48323584", "0.48287222", "0.48284626", "0.48241177", "0.4821413", "0.48185486", "0.48175466", "0.48175123", "0.4800697", "0.4794339", "0.47906286", "0.47850963", "0.47809854", "0.4761245", "0.47601452", "0.47567254", "0.47530675", "0.47504237", "0.47423223", "0.4742167", "0.47387683", "0.47372788", "0.47368965", "0.47289458", "0.4724847", "0.47206935", "0.4719635", "0.47191876", "0.47144324", "0.47133845", "0.47101396", "0.47077966", "0.4707186", "0.4705485", "0.47053498", "0.47046813", "0.47020465", "0.46979684", "0.4697709", "0.46945688", "0.4693791", "0.4689625", "0.4687299", "0.46842033", "0.468407", "0.46821323", "0.46806553", "0.467781", "0.46717593", "0.46717212", "0.467158", "0.46708968", "0.4669656", "0.46658847", "0.46650767", "0.46640608", "0.4662354" ]
0.71434623
0
PATCH/PUT /tidbits/1 PATCH/PUT /tidbits/1.json
def update respond_to do |format| if @tidbit.update(tidbit_params) format.html { redirect_to @tidbit, notice: 'Tidbit was successfully updated.' } format.json { render :show, status: :ok, location: @tidbit } else format.html { render :edit } format.json { render json: @tidbit.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch!\n request! :patch\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_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n @treq = Treq.find(params[:id])\n\n respond_to do |format|\n unless params[:treq_files].blank?\n params[:treq_files]['file'].each do |a|\n @treq_file = @treq.treq_files.create!(:file => a, :treq_id => @treq.id)\n end\n end\n if @treq.update_attributes(params[:treq])\n format.html { redirect_to @treq, notice: 'Treq was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @treq.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n keystone.update_tenant({:id=>params[:id],:name=>params[:name],:description=>params[:description],:enabled=>params[:enabled]})\n respond_to do |format|\n format.html { redirect_to tenants_path, :notice => 'Tenant was successfully updated.' }\n format.json { head :ok }\n end\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def patch(path, params = {})\n request(:patch, path, params)\n end", "def patch(path, params = {})\n request(:patch, path, params)\n end", "def update\n @microtask = Microtask.find(params[:id])\n\n respond_to do |format|\n if @microtask.update_attributes(params[:microtask])\n format.html { redirect_to @microtask, notice: 'Microtask was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @microtask.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, opts = {})\n request(:patch, path, opts).body\n end", "def update_user_for_tenant(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/{tenantId}/users/{userId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n @tariff = Tariff.find params[:id]\n\n respond_to do |format|\n if @tariff.update(tariff_params)\n format.html { redirect_to @tariff, notice: 'Tariff was successfully updated.' }\n format.json { respond_with_bip(@tariff) }\n else\n format.html { render :edit }\n format.json { respond_with_bip(@tariff) }\n end\n end\n end", "def update\n @t = T.find(params[:id])\n\n respond_to do |format|\n if @t.update_attributes(params[:t])\n format.html { redirect_to @t, notice: 'T was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @t.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bits_1.update(bits_1_params)\n format.html { redirect_to @bits_1, notice: 'Bits 1 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bits_1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bowl = Bowl.find(params[:id])\n \n # set bowl modify time\n @bowl.modified = Time.now\n \n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n \n Rails.logger.info \"Updating Bowl Contents\"\n \n # remove all contents for this bowl and add new\n @bowl.contents.delete_all(\"bowl_id=\" + @bowl.id)\n \n params.keys.each do |param|\n if param.start_with?(\"input_\") and (params[param] != \"\") \n @bowl.contents.create(:bowl_id => @bowl.id, :dryfruit_id => param[6, 2], :quantity => params[param]) \n end\n end\n\n format.html { redirect_to bowls_path, :notice => 'Bowl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put!\n request! :put\n end", "def update_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance/{tenantId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end", "def patch(path, **args); end", "def update\n respond_to do |format|\n if @bottle.update(bottle_params)\n format.html { redirect_to user_path(current_user.id), notice: 'Bottle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bottle.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update\n @tetramod = Tetramod.find(params[:id])\n\n respond_to do |format|\n if @tetramod.update_attributes(params[:tetramod])\n format.html { redirect_to @tetramod, notice: 'Tetramod was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tetramod.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_array_for_tenant(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/{tenantId}/arrays/{arrayId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update # PATCH\n raise NotImplementedError\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update\n @bottle = Bottle.find(params[:id])\n\n respond_to do |format|\n if @bottle.update_attributes(params[:bottle])\n format.html { redirect_to(@bottle, :notice => 'Bottle was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bottle.errors, :status => :unprocessable_entity }\n end\n end\n end", "def updateTransaction(state, id)\n parameters={state: state}\n options = {\n :body => parameters.to_json,\n :headers => {\n 'Content-Type' => 'application/json'\n }\n }\n results = HTTParty.put(\"http://192.168.99.101:4050/transactions/\" + id.to_s , options) # put pending state\n return results\n end", "def patch\n end", "def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end", "def update\n @tweak = Tweak.find(params[:id])\n\n respond_to do |format|\n if @tweak.update_attributes(params[:tweak])\n flash[:notice] = 'tweak was successfully updated.'\n format.html { redirect_to(@tweak) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tweak.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n if @todo.update_attributes(todo_params)\n render json: @todo, status: :ok\n else\n render json: @todo.errors, status: 422\n end\n end", "def update_current_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update\n set_task\n respond_to do |format|\n if @task.update!(task_params)\n format.html\n format.json { respond_with_bip(@task) }\n end\n end\n end", "def patch(path, data, params = {}, request_options = {})\n request(:patch, path, data, params)\n end", "def update\n @kitten = Kitten.find(params[:id])\n\n respond_to do |format|\n if @kitten.update_attributes(params[:kitten])\n format.html { redirect_to @kitten, notice: 'Kitten was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kitten.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tips_trick.update_attributes(params[:tips_trick])\n format.html { redirect_to @tips_trick, notice: 'Tips trick was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tips_trick.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tinta.update(tinta_params)\n format.html { redirect_to @tinta, notice: 'Tinta was successfully updated.' }\n format.json { render :show, status: :ok, location: @tinta }\n else\n format.html { render :edit }\n format.json { render json: @tinta.errors, status: :unprocessable_entity }\n end\n end\n end", "def rest_patch(base_uri,json_payload,params)\n begin\n @response = RestClient.patch(base_uri,json_payload,params)\n rescue => e\n puts @response.code\n end\n return @response\n end", "def patch(payload)\n post_like payload, Net::HTTP::Patch.new(@uri.path)\n end", "def edit_user_task\n task = Task.find(params[:id])\n \n if task.update(task_params)\n render json: {task: task, status: 201} \n else\n render json: {errors: task.errors.full_message , status: 422}\n end\n end", "def edit_user_task\n task = Task.find(params[:id])\n \n if task.update(task_params)\n render json: {task: task, status: 201} \n else\n render json: {errors: task.errors.full_message , status: 422}\n end\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def update\n @tobject = Tobject.find(params[:id])\n\n respond_to do |format|\n if @tobject.update_attributes(params[:tobject])\n format.html { redirect_to @tobject, notice: 'Tobject was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tobject.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tottle.update(tottle_params)\n format.html { redirect_to @tottle, notice: 'Tottle was successfully updated.' }\n format.json { render :show, status: :ok, location: @tottle }\n else\n format.html { render :edit }\n format.json { render json: @tottle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update_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_radios_for_array(args = {}) \n id = args['id']\n temp_path = \"/radios.json/{arrayId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"radioId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def patch(path, body_params = {})\n debug_log \"PATCH #{@host}#{path} body:#{body_params}\"\n headers = { 'Content-Type' => 'application/json' }\n res = connection.run_request :put, path, body_params.to_json, headers\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end", "def update\n @tktest = Tktest.find(params[:id])\n\n respond_to do |format|\n if @tktest.update_attributes(params[:tktest])\n format.html { redirect_to @tktest, notice: 'Tktest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tktest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # @user_trick = UserTrick.find(params[:id])\n @user_trick.update(user_trick_params)\n render json: UserTrickSerializer.new(@user_trick).serialized_json\n end", "def update\n respond_to do |format|\n if @ty.update(ty_params)\n format.html { redirect_to @ty, notice: 'Tie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ty.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @kitty = Kitty.find(params[:id])\n\n respond_to do |format|\n if @kitty.update_attributes(params[:kitty])\n format.html { redirect_to @kitty, notice: 'Kitty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kitty.errors, status: :unprocessable_entity }\n end\n end\n end", "def UpdateTicket params = {}\n \n APICall(path: 'tickets.json',method: 'PUT',payload: params.to_json)\n \n end", "def patch(path, opts = {}, &block)\n request(:patch, path, opts, &block)\n end", "def patch(path, opts = {}, &block)\n request(:patch, path, opts, &block)\n end", "def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tier = Tier.find(params[:id])\n\n respond_to do |format|\n if @tier.update_attributes(params[:tier])\n format.html { redirect_to @tier, :notice => 'Tier was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @tier.errors, :status => :unprocessable_entity }\n end\n end\n end", "def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end", "def update\n @tinymap = Tinymap.find(params[:id])\n\n respond_to do |format|\n if @tinymap.update_attributes(params[:tinymap])\n format.html { redirect_to @tinymap, notice: 'Tinymap was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tinymap.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tenni = Tenni.find(params[:id])\n\n respond_to do |format|\n if @tenni.update_attributes(params[:tenni])\n format.html { redirect_to @tenni, notice: 'Tenni was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tenni.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @trick = Trick.find(params[:id])\n\n respond_to do |format|\n if @trick.update_attributes(params[:trick])\n format.html { redirect_to @trick, notice: 'Trick was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trick.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tack = Tack.find(params[:id])\n\n if @tack.update(tack_params)\n head :no_content\n else\n render json: @tack.errors, status: :unprocessable_entity\n end\n end", "def rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend", "def restobooking\n @buchung = Buchung.find(params[:id])\n @buchung.status='B' \n \n respond_to do |format|\n if @buchung.update_attributes(params[:buchung])\n format.html { redirect_to @buchung, notice: 'Buchung wurde erfolgreich geaendert.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @buchung.errors, status: :unprocessable_entity }\n end\n end \n end", "def update\n @trenton = Trenton.first\n\n respond_to do |format|\n if @trenton.update_attributes(params[:trenton])\n format.html { redirect_to about_path, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trenton.errors, status: :unprocessable_entity }\n end\n end\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 patch(uri, options = T.unsafe(nil)); end", "def update\n @mint_coin = @coin.mint_coins.find(params[:id])\n\n respond_to do |format|\n if @mint_coin.update_attributes(params[:mint_coin])\n format.html { redirect_to coin_mint_coins_url([@coin]), :notice => 'Mint coin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @mint_coin.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @t1 = T1.find(params[:id])\n\n respond_to do |format|\n if @t1.update_attributes(params[:t1])\n flash[:notice] = 'T1 was successfully updated.'\n format.html { redirect_to(@t1) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @t1.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_tidbit\n @tidbit = Tidbit.find(params[:id])\n end", "def update\n respond_to do |format|\n if @tangent.update(tangent_params)\n format.html { redirect_to @tangent, notice: 'Tangent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tangent.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tattoo = Tattoo.find(params[:id])\n\n respond_to do |format|\n if @tattoo.update_attributes(params[:tattoo])\n format.html { redirect_to @tattoo, notice: 'Tattoo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tattoo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @breet.update(breet_params)\n format.html { redirect_to @breet, notice: 'Breet was successfully updated.' }\n format.json { render :show, status: :ok, location: @breet }\n else\n format.html { render :edit }\n format.json { render json: @breet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_current_logged_in_users_password(args = {}) \n id = args['id']\n temp_path = \"/users.json/current/password\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"userId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n @bottling = Bottling.find(params[:id])\n\n respond_to do |format|\n if @bottling.update_attributes(params[:bottling])\n format.html { redirect_to @bottling, notice: 'bottling was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bottling.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tnumber = Tnumber.find(params[:id])\n\n respond_to do |format|\n if @tnumber.update_attributes(params[:tnumber])\n format.html { redirect_to @tnumber, :notice => 'Tnumber was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @tnumber.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @task = Task.find(params[:id])\n params[:task] ? @task.update_attributes(params[:task]) : @task.update_attributes(:description=>params[:description], :isDone=>params[:isDone], :order=>params[:order] )\n #@task.save\n respond_with(@task)\nend", "def update\n respond_to do |format|\n if @tarot.update(tarot_params)\n format.html { redirect_to @tarot, notice: 'Tarot was successfully updated.' }\n format.json { render :show, status: :ok, location: @tarot }\n else\n format.html { render :edit }\n format.json { render json: @tarot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @thing = Thing.find(params[:id])\n\n respond_to do |format|\n if @thing.update_attributes(params[:thing])\n format.html { redirect_to things_path, notice: 'Your thing was successfully updated!' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @thing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n add_breadcrumb 'Edit Ticketnotes'\n\n respond_to do |format|\n if @ticketnote.update(ticketnote_params)\n format.html do\n redirect_to @ticketnote,\n notice: 'Ticket note was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @ticketnote }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json do\n render json: @ticketnote.errors, status: :unprocessable_entity\n end\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n if @todo.update(todo_params)\n render json: @todo\n else\n render json: @todo.errors, status: :unprocessable_entity\n end\n end", "def patch(path, params)\n time(\"PATCH #{path}\") { Cloudflarer.new.patch(path, params) }\n end", "def update\n @trip = Trip.find(params[:id])\n\n if @trip.update(trip_params)\n render :json => {:success => true}\n else\n render :json => {:success => false, :errors => [\"Trip update failed.\"]}\n end\n end", "def edit(id, options = {})\n optional = [:label,\n :description,\n :compatible_with,\n :script_type\n ]\n params.accepts(optional).validate! options\n request(:put, \"/recipes/#{id}.json\", default_params(options))\n end", "def update\n respond_to do |format|\n if @tenacity.update(tenacity_params)\n format.html { redirect_to @tenacity, notice: 'Tenacity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tenacity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n task = Task.find(params[:id])\n if task.update(task_params)\n render json: task\n else\n render_errors(task)\n end\n end", "def update\n respond_to do |format|\n if @bunny.update(bunny_params)\n format.html { redirect_to @bunny, notice: 'Bunny was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bunny.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tprimarytumor.update(tprimarytumor_params)\n format.html { redirect_to @tprimarytumor, notice: 'tprimarytumor was successfully updated.' }\n format.json { render :show, status: :ok, location: @tprimarytumor }\n else\n format.html { render :edit }\n format.json { render json: @tprimarytumor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tcredito.update(tcredito_params)\n format.html { redirect_to @tcredito, notice: 'Tcredito was successfully updated.' }\n format.json { render :show, status: :ok, location: @tcredito }\n else\n format.html { render :edit }\n format.json { render json: @tcredito.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(url, options = {}, &block)\n request HttpPatch, url, options, &block\n end", "def patch_tier1_with_http_info(tier_1_id, tier1, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.patch_tier1 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.patch_tier1\"\n end\n # verify the required parameter 'tier1' is set\n if @api_client.config.client_side_validation && tier1.nil?\n fail ArgumentError, \"Missing the required parameter 'tier1' when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.patch_tier1\"\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}'.sub('{' + 'tier-1-id' + '}', tier_1_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(tier1)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#patch_tier1\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n @todo = Todo.find(params[:todo][:id])\n if @todo.update_attributes(user_params)\n render json: @todo\n else\n render nothing: true, status: :bad_request\n end\n end", "def update\n @stuff = Stuff.find(params[:id])\n\n respond_to do |format|\n if @stuff.update_attributes(params[:stuff])\n format.html { redirect_to @stuff, :notice => 'Stuff was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @stuff.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @thing = Thing.find(params[:id])\n\n respond_to do |format|\n if @thing.update_attributes(params[:thing])\n format.html { redirect_to @thing, notice: 'Thing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @thing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bla = Bla.find(params[:id])\n\n respond_to do |format|\n if @bla.update_attributes(params[:bla])\n format.html { redirect_to @bla, :notice => 'Bla was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bla.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.6324299", "0.6308433", "0.61281043", "0.5956387", "0.59438103", "0.5908949", "0.5774309", "0.5774309", "0.57697207", "0.5757143", "0.57471025", "0.5738746", "0.5734689", "0.5717169", "0.5701462", "0.5694921", "0.5692678", "0.5688012", "0.56864333", "0.56824577", "0.5675939", "0.5675939", "0.56759244", "0.56729895", "0.5664391", "0.5650917", "0.5648789", "0.56307334", "0.5575834", "0.55754495", "0.55669624", "0.5545262", "0.5545191", "0.5537469", "0.5530633", "0.5520305", "0.5518044", "0.5514312", "0.5508456", "0.550625", "0.54955", "0.5491498", "0.5484717", "0.5482942", "0.5482942", "0.5478951", "0.5478951", "0.54769653", "0.5476406", "0.5474726", "0.5470501", "0.54665947", "0.5466563", "0.54653203", "0.54626137", "0.5460001", "0.54583365", "0.5445013", "0.5442179", "0.5442179", "0.5441079", "0.54349726", "0.54342157", "0.5431513", "0.5430598", "0.542984", "0.54288", "0.5418404", "0.5412447", "0.54115707", "0.54009753", "0.53971505", "0.5394152", "0.538975", "0.53809214", "0.53782344", "0.53698754", "0.53654647", "0.53625154", "0.53605956", "0.53548557", "0.53491163", "0.53406996", "0.5340435", "0.53299344", "0.5309252", "0.5300719", "0.5287343", "0.52868444", "0.5280864", "0.5280243", "0.5279592", "0.52705395", "0.5270154", "0.5265929", "0.5263095", "0.5262167", "0.5259568", "0.5258832", "0.52586657" ]
0.6553318
0
DELETE /tidbits/1 DELETE /tidbits/1.json
def destroy @tidbit.destroy respond_to do |format| format.html { redirect_to tidbits_url, notice: 'Tidbit was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end", "def deleteFlatpack( flatpack_id)\n params = Hash.new\n params['flatpack_id'] = flatpack_id\n return doCurl(\"delete\",\"/flatpack\",params)\n end", "def delete(id)\n request(:delete, \"/recipes/#{id}.json\")\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "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 @treq = Treq.find(params[:id])\n @treq.destroy\n\n respond_to do |format|\n format.html { redirect_to treqs_url }\n format.json { head :no_content }\n end\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def destroy\n @bits_1.destroy\n respond_to do |format|\n format.html { redirect_to bits_1s_url }\n format.json { head :no_content }\n end\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def delete\n request(:delete)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def test_delete_task\n result = @nirvana.delete @task['id']\n result = JSON.parse(result)\n\n assert result.keys.include?('results')\n assert result['results'][0]\n assert result['results'][0].keys.include?('task')\n assert \"0\" != result['results'][0]['task']['deleted'] \n end", "def destroy\n \n keystone.delete_tenant(keystone.get_tenant(params[:id])[:id])\n\n respond_to do |format|\n format.html { redirect_to tenants_url }\n format.json { head :ok }\n end\n end", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def delete!\n request! :delete\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(path, params = {})\n debug_log \"DELETE #{@host}#{path} params:#{params}\"\n res = connection.delete path, params\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end", "def delete!( opts = {} )\n http_action :delete, nil, opts\n end", "def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end", "def delete(path)\n request(:delete, path)\n end", "def destroy\n @tantosha.destroy\n # @tantosha.delete\n respond_to do |format|\n format.html { redirect_to tantoshas_url }\n format.json { head :no_content }\n end\n end", "def delete_kit(id)\n resp = make_request :delete, \"kits/#{id}\"\n check_response_for_field resp, \"ok\"\n end", "def delete_array_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/arrays/#{args[:arrayId]}\", args)\nend", "def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end", "def deleteExecution(execution_id)\n uri = URI(RUNDECKSERVER + ':' + RUNDECKPORT + '/api/12/execution/' + execution_id)\n http = Net::HTTP.new(uri.host, uri.port)\n headers = {'Content-Type'=> 'application/jsonr','X-RunDeck-Auth-Token'=> API_KEY }\n r = http.delete(uri.path, headers) \n return r\nend", "def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def tenant_delete(tenant_id)\n\t\n\t\tdelete_call = Curl::Easy.http_delete(\"#{@ip_address}:#{@port_2}/v2.0/tenants/#{tenant_id}\"\n\t\t) do |curl|\n\t\t\tcurl.headers['x-auth-token'] = @token\n\t\t\tcurl.headers['userId'] = tenant_id\n\t\t end\n\t\t\n\t\tputs \"invoked tenant delete\"\n\tend", "def delete_story_version(id)\n @client.raw('delete', \"/content/story-versions/#{id}\")\n end", "def delete(path)\n request 'DELETE', path\n end", "def delete\n Iterable.request(conf, base_path).delete\n end", "def delete!\n Recliner.delete(uri)\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def cmd_delete argv\n setup argv\n e = @hash['element']\n response = @api.delete(e)\n msg response\n return response\n end", "def delete_item(item_id)\n response = Unirest.delete CONNECT_HOST + '/v1/' + LOCATION_ID + '/items/' + item_id,\n headers: REQUEST_HEADERS\n\n if response.code == 200\n puts 'Successfully deleted item'\n return response.body\n else\n puts 'Item deletion failed'\n puts response.body\n return nil\n end\nend", "def delete(path, params)\n parse_response @client[path].delete(:params => params)\n end", "def delete(path)\n make_call(mk_conn(path), :delete)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete_user_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/users/#{args[:userId]}\", args)\nend", "def delete_item(id)\n record \"/todos/delete_item/#{id}\"\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def test_delete_post\n expected = 200\n post_id = 1\n uri = URI.parse('http://localhost:3000/v1/posts/'+post_id.to_s)\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Delete.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end", "def delete\n @delete ||= Verb.new do |verb|\n verb.entity :trip, :air, :lodging, :car, :profile, :rail, \\\n :transport, :cruise, :restaurant, :activity, :note, :map, \\\n :directions \\\n do |entity, id|\n do_request('delete', entity, {:id=>id}, nil)\n end\n end\n end", "def destroy\n @bloom = Bloom.find(params[:id])\n @bloom.destroy\n\n respond_to do |format|\n format.html { redirect_to blooms_url }\n format.json { head :no_content }\n end\n end", "def delete_story(id)\n @client.raw('delete', \"/content/stories/#{id}\")\n end", "def delete(unique_id)\n rsp = post(\"<delete><id>#{unique_id}</id></delete>\")\n success?(rsp.body) or log_error(rsp.body)\n end", "def test_delete1()\n key = \"_Delete1\"\n c = Scalaroid::JSONConnection.new(url = Scalaroid::DEFAULT_URL)\n rdht = Scalaroid::ReplicatedDHT.new(conn = c)\n sc = Scalaroid::TransactionSingleOp.new(conn = c)\n\n (0..($_TEST_DATA.length - 1)).each do |i|\n sc.write(@testTime.to_s + key + i.to_s, $_TEST_DATA[i])\n end\n\n # now try to delete the data:\n (0..($_TEST_DATA.length - 1)).each do |i|\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(4, ok)\n results = rdht.get_last_delete_result()\n assert_equal(4, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(0, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n\n # try again (should be successful with 0 deletes)\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(0, ok)\n results = rdht.get_last_delete_result()\n assert_equal(0, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(4, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n end\n\n c.close()\n end", "def delete(path)\n request(:delete, path)\n end", "def delete(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.delete(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\n end", "def delete endpoint\n do_request :delete, endpoint\n end", "def delete(path, params)\n request(:delete, path, {})\n end", "def DeleteTicket id\n \n APICall(path: \"tickets/#{id}.json\",method: 'DELETE')\n \n end", "def delete(path)\n\t\trequest(path, :delete)\n\tend", "def destroy\n @microtask = Microtask.find(params[:id])\n @microtask.destroy\n\n respond_to do |format|\n format.html { redirect_to microtasks_url }\n format.json { head :no_content }\n end\n end", "def deleteFlatpackLink( flatpack_id, gen_id)\n params = Hash.new\n params['flatpack_id'] = flatpack_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/flatpack/link\",params)\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @baton = Baton.find(params[:id])\n @baton.destroy\n\n respond_to do |format|\n format.html { redirect_to batons_url }\n format.json { head :no_content }\n end\n end", "def destroy\n record = TaxRule.find(params[:id])\n record.trash\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete\n \n end", "def destroy\n @taxi = Taxi.find(params[:id])\n @taxi.destroy\n\n respond_to do |format|\n format.html { redirect_to taxis_url }\n format.json { head :ok }\n end\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def delete\n client.delete(url)\n @deleted = true\n end", "def destroy\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n response = HTTParty.delete(url, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n redirect_to units_url, notice: 'Unit was successfully deleted.'\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 @tetramod = Tetramod.find(params[:id])\n @tetramod.destroy\n\n respond_to do |format|\n format.html { redirect_to tetramods_url }\n format.json { head :no_content }\n end\n end", "def delete(path, params = {})\n request(:delete, path, params)\n end", "def delete(path, params = {})\n request(:delete, path, params)\n end", "def delete(path, params = {})\n request(:delete, path, params)\n end", "def DeleteView id\n \n APICall(path: \"views/#{id}.json\",method: 'DELETE')\n \n end", "def delete(path, opts = {})\n request(:delete, path, opts).body\n end", "def delete(*rest) end", "def delete\n if body.empty? && params[:id]\n client.delete(params)\n elsif body.empty?\n client.delete_by_query(params.merge(body: body.merge(ALL)))\n else\n client.delete_by_query(params.merge(body: body))\n end\n end", "def delete\n \n end", "def delete(path, params = {})\n Chirpy.request params.merge({:path => path, :method => 'delete'}.merge(authentication))\n end", "def destroy\n @bottle = Bottle.find(params[:id])\n @bottle.destroy\n\n respond_to do |format|\n format.html { redirect_to(bottles_url) }\n format.xml { head :ok }\n end\n end", "def delete\n super \"/templates/#{template_id}.json\", {}\n end", "def destroy\n @basis = Base.find(params[:id])\n @basis.destroy\n\n respond_to do |format|\n format.html { redirect_to bases_url }\n format.json { head :no_content }\n end\n end", "def delete\n api(\"Delete\")\n end", "def delete\n delete_from_server single_url\n end", "def destroy\n @tramite = Tramite.find(params[:id])\n @tramite.destroy\n\n respond_to do |format|\n format.html { redirect_to tramites_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7187074", "0.7007323", "0.6776838", "0.67191", "0.6694537", "0.6683867", "0.66341543", "0.6589798", "0.6554202", "0.65271866", "0.6526255", "0.6442809", "0.63999116", "0.63999116", "0.63999116", "0.63999116", "0.639556", "0.63699317", "0.6365324", "0.63343275", "0.63343275", "0.63228345", "0.631086", "0.6306958", "0.6303965", "0.62771", "0.627268", "0.62711024", "0.6269964", "0.62693995", "0.625757", "0.6251162", "0.62459844", "0.6245198", "0.62338847", "0.62292075", "0.62231827", "0.62172997", "0.617655", "0.6169878", "0.61680406", "0.6166466", "0.61647755", "0.61550534", "0.615337", "0.61524457", "0.61518055", "0.6139808", "0.6139808", "0.613832", "0.6132477", "0.6131103", "0.6131103", "0.6131103", "0.6131103", "0.6131103", "0.6131103", "0.6131103", "0.61276245", "0.61215556", "0.61207634", "0.6118551", "0.61141396", "0.6113745", "0.61134946", "0.6112689", "0.61120975", "0.61073834", "0.6102681", "0.6101686", "0.60997903", "0.608526", "0.608383", "0.6081401", "0.6081098", "0.6077968", "0.6074116", "0.6073996", "0.60731417", "0.6067472", "0.60662913", "0.6065911", "0.60638094", "0.60612243", "0.60533696", "0.6052397", "0.6052397", "0.6052397", "0.6045575", "0.6044269", "0.6037257", "0.6036054", "0.6035817", "0.60350204", "0.60303915", "0.602812", "0.6027607", "0.6026825", "0.60267615", "0.6026202" ]
0.7125573
1
Use callbacks to share common setup or constraints between actions.
def set_tidbit @tidbit = Tidbit.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def set_actions\n actions :all\n end", "def define_action_helpers?; end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def save_action; end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def callback_phase\n super\n end", "def advice\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "def _handle_action_missing(*args); end", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def duas1(action)\n action.call\n action.call\nend" ]
[ "0.6163821", "0.6045432", "0.5945441", "0.5916224", "0.58894575", "0.5834073", "0.57764685", "0.5702474", "0.5702474", "0.5653258", "0.56211996", "0.54235053", "0.5410683", "0.5410683", "0.5410683", "0.53948104", "0.5378064", "0.5356684", "0.53400385", "0.53399503", "0.53312254", "0.53121567", "0.52971965", "0.52964705", "0.52956307", "0.52587366", "0.52450675", "0.5237777", "0.5237777", "0.5237777", "0.5237777", "0.5237777", "0.5233381", "0.52325714", "0.52288216", "0.52229726", "0.5218362", "0.52142864", "0.5207988", "0.5206337", "0.51762295", "0.51745105", "0.51728606", "0.516616", "0.5161016", "0.5157393", "0.5152562", "0.51524293", "0.5152397", "0.5144533", "0.513982", "0.51342106", "0.5113793", "0.5113793", "0.5113671", "0.51092553", "0.51062804", "0.50921935", "0.5088855", "0.5082236", "0.5079901", "0.5066569", "0.5055307", "0.5053106", "0.50499666", "0.50499666", "0.5035068", "0.50258636", "0.50220853", "0.5015893", "0.50134486", "0.5001442", "0.50005543", "0.4998581", "0.49901858", "0.49901858", "0.4986648", "0.49809486", "0.49792925", "0.4978855", "0.49685496", "0.49656174", "0.49576473", "0.49563017", "0.4955349", "0.49536878", "0.4952439", "0.49460214", "0.494239", "0.49334687", "0.49315962", "0.49266812", "0.49261138", "0.4925925", "0.4922542", "0.4920779", "0.49173284", "0.49169463", "0.4916256", "0.49162322", "0.49156886" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def tidbit_params params.require(:tidbit).permit(:body) 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 model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def 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 active_code_params\n params[:active_code].permit\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\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 filter_parameters; end", "def filter_parameters; end", "def list_params\n params.permit(:name)\n 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 admin_social_network_params\n params.require(:social_network).permit!\n end", "def url_whitelist; 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 filter_params\n params.require(:filters).permit(:letters)\n end", "def permit_request_params\n params.permit(:address)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\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 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.69802505", "0.6781974", "0.67470175", "0.67430073", "0.67350477", "0.6593221", "0.6504263", "0.64988977", "0.6481794", "0.64800006", "0.64568025", "0.64411247", "0.6379476", "0.63765615", "0.6368045", "0.6320141", "0.6300363", "0.6300057", "0.62952244", "0.6294712", "0.6293856", "0.6290323", "0.62816143", "0.6241851", "0.6241208", "0.622036", "0.62128764", "0.62110275", "0.61966056", "0.61776453", "0.617547", "0.6174961", "0.61654735", "0.6153256", "0.61516005", "0.6149498", "0.6123234", "0.6118653", "0.61077267", "0.61061186", "0.6093616", "0.608318", "0.6074428", "0.60650206", "0.60244286", "0.6020295", "0.60155797", "0.6012826", "0.6010141", "0.6010141", "0.60037106", "0.600298", "0.59979576", "0.5994806", "0.5994283", "0.5993927", "0.5980616", "0.59667075", "0.59614897", "0.59610957", "0.596071", "0.5959614", "0.59554", "0.59542966", "0.5946781", "0.5940262", "0.5940262", "0.59401053", "0.5937168", "0.5932135", "0.59293395", "0.592659", "0.59202623", "0.59112674", "0.59088206", "0.590716", "0.59056735", "0.589997", "0.5899655", "0.5898926", "0.5896042", "0.589589", "0.5895867", "0.58894163", "0.5884936", "0.5879227", "0.58740723", "0.5871364", "0.5870148", "0.5869228", "0.5868196", "0.5867967", "0.5865532", "0.58653617", "0.58644646", "0.58631665", "0.5862611", "0.5857609", "0.58558804", "0.5853729", "0.5853025" ]
0.0
-1
Setup the database migrations
def copy_migrations rake 'hyrax:install:migrations' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def migrate\n run_migrations pending_migrations, :up\n end", "def run\n load_migrations\n @migrations.each do |mig_class, version|\n mig_class.up\n # Add it to the schema_migrations table as well\n # This will fail if auto-migrations is only and always used,\n # as the schema_migrations table will not exist.\n SchemaMigration.find_or_create_by_version(version) rescue nil\n end\n end", "def migrations\n rake 'admin:install:migrations'\n rake 'db:migrate SCOPE=admin'\n end", "def install_migrations\n migrations = [\n \"create_blogelator_posts.rb\",\n \"create_blogelator_authors.rb\",\n \"create_blogelator_tags.rb\",\n \"create_blogelator_posts_tags.rb\",\n \"create_blogelator_posts_posts.rb\"\n ]\n migration_path = \"db/migrate\"\n migrations.each do |file|\n migration_template \"#{migration_path}/#{file}\", \"#{migration_path}/#{file}\"\n end\n end", "def setup\n setup_test_database\n drop_and_create_schema_migrations_table\n end", "def initial_setup\n CORE.each { |c| c.auto_migrate! }\n end", "def do_migrations\n migration_path = File.join(\"generators\", \"talia\", \"templates\", \"migrations\")\n ActiveRecord::Migrator.migrate(migration_path, ENV[\"VERSION\"] ? ENV[\"VERSION\"].to_i : nil )\n end", "def migrate_database\n RFlow.logger.debug 'Applying default migrations to config database'\n migrations_path = File.join(File.dirname(__FILE__), 'configuration', 'migrations')\n ActiveRecord::Migration.verbose = false\n ActiveRecord::Migrator.migrate migrations_path\n end", "def install_migrations\n rake(\"maintenance_tasks:install:migrations\")\n rake(\"db:migrate\")\n end", "def setup options = {}\n options.to_options!\n chroot do\n generate_migration options\n migrate options\n end\n end", "def create_tables!\n migrate(:up)\n end", "def migration_railties; end", "def migration_railties; end", "def run_active_record_migrations!\n ActiveRecord::Migration.verbose = false\n ActiveRecord::Migrator.migrate([\"test/fixtures/migrate\"])\n end", "def install_migrations\n\t\tsay_status :copying, \"migrations\"\n\t\trake 'railties:install:migrations'\n\tend", "def migration\n end", "def migrate!\n connect! unless connected?\n Sequel.extension :migration\n Sequel::Migrator.run(db, File.join(__dir__, \"../../db/migrations\"), table: schema_table)\n end", "def migrate\n ActiveRecord::Migrator.migrate(File.join(db_dir, \"migrate\"))\n end", "def migrations\n raise(ArgumentError, \"Can't set migrations while using :version option\") if @using_deprecated_version_setting\n yield\n end", "def setup\n begin\n create_campaign_table_if_not_exist\n seed_data\n rescue Exception => e\n raise \"Database setup failed with error #{e}\"\n ensure\n @connection.close\n end\n end", "def migrate!\n Migrator.migrate(name)\n end", "def migrate!\n Migrator.migrate(name)\n end", "def install_migrations\n puts \"Copying over Cadenero migrations...\"\n Dir.chdir(Rails.root) do\n `rake cadenero:install:migrations`\n end\n end", "def initialize_schema_migrations_table\n unless table_exists?('schema_migrations')\n execute(\"CREATE TABLE schema_migrations (version string primary key INDEX using plain)\")\n end\n end", "def initialize_schema_migrations_table\n unless table_exists?('schema_migrations')\n execute(\"CREATE TABLE schema_migrations (version string primary key INDEX using plain)\")\n end\n end", "def initialize_schema_migrations_table\n unless table_exists?('schema_migrations')\n execute(\"CREATE TABLE schema_migrations (version string primary key INDEX using plain)\")\n end\n end", "def install_sequence\n stop\n \n backup_database\n install_pre_hook\n pre_migrate_database\n copy_files\n freeze_rails\n create_default_config_files\n fix_permissions\n create_directories\n create_initial_database\n set_initial_port_number\n expand_template_files\n \n migrate\n install_post_hook\n save\n \n run_rails_tests\n \n start\n end", "def dbmigrate!\n ActiveRecord::Base.establish_connection(PuppetHerald.database.spec)\n ActiveRecord::Migrator.up 'db/migrate'\n ActiveRecord::Base.clear_active_connections!\n nil\n end", "def apply\n migration.up\n end", "def migrate!\n @logger.fine('Dropping schema...')\n\n migrate(0) # migrate to version 0.\n migrate # migrate to latest version.\n end", "def generate_migrations\n versions = []\n versions << generate_migration(\"create_users\", <<-EOF\nHanami::Model.migration do\n change do\n create_table :users do\n primary_key :id\n column :name, String\n end\n end\nend\nEOF\n)\n\n versions << generate_migration(\"add_age_to_users\", <<-EOF\nHanami::Model.migration do\n change do\n add_column :users, :age, Integer\n end\nend\nEOF\n)\n versions\n end", "def migrate(version = nil)\n @logger.fine('Running test migrations...')\n super(File.join(Automation::FRAMEWORK_ROOT, Automation::FET_DIR, 'test/database/migrations'), version)\n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def migrate\n DataMapper.auto_migrate!\n end", "def auto_migrate!\n AutoMigrator.auto_migrate(name)\n end", "def auto_migrate!\n AutoMigrator.auto_migrate(name)\n end", "def up\n ActiveRecord::Base.transaction do\n migrate_cause\n migrate_messages\n end\n end", "def migrations\n @migrations ||= {}\n end", "def up\n end", "def run_migrations\n unless options[\"no-migrate\"]\n puts \"Running rake db:migrate\"\n `rake db:migrate`\n end\n end", "def generate!\n ::ActiveRecord::Base.establish_connection 'production'\n Schemaless::MigrationsGenerator.new(all_tables).invoke_all\n end", "def run_before_migrate_setup\n Chef::Log.info 'No before migrate setup defined.'\n end", "def generate_migrations\n Dir[File.join(source_paths, 'db', 'migrate', '*.rb')].each do |file|\n migration_filepath = file.match(/\\A.+\\/(db\\/migrate\\/.+)\\Z/i)[1]\n raw_migration_filename = file.match(/\\d+\\_(.+)\\Z/i)[1] \n migration_template migration_filepath, \"db/migrate/#{raw_migration_filename}\" \n end\n end", "def copy_migrations\n # Can't get this any more DRY, because we need this order.\n better_migration_template \"create_searches.rb\"\n better_migration_template \"create_bookmarks.rb\"\n better_migration_template \"remove_editable_fields_from_bookmarks.rb\"\n better_migration_template \"add_user_types_to_bookmarks_searches.rb\"\n end", "def run_migrations(migrations)\n migrations.each do |direction, version_or_filenames|\n Array.wrap(version_or_filenames).each do |version_or_filename|\n /^(?<version>\\d{3,})/ =~ File.basename(version_or_filename)\n ActiveRecord::Migrator.run(direction, ActiveRecord::Migrator.migrations_path, version.to_i)\n end if version_or_filenames\n end\n if ActiveRecord::Base.schema_format == :ruby\n File.open(ENV['SCHEMA'] || \"#{Rails.root}/db/schema.rb\", 'w') do |file|\n ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, file)\n end\n end\n #TODO unload migraion classes\n end", "def add_migrations\n \tmigrations = Dir.glob(SocialFramework::Engine.config.paths[\"db/migrate\"].first + \"/*\")\n\n if options[:migrations]\n options[:migrations].each do |migrate|\n file = \"social_framework_#{migrate.pluralize}.rb\"\n file = migrations.select { |m| m.include?(file) }.first\n unless file.nil? or file.empty?\n file_name = file.split(\"/\").last\n copy_file file, \"db/migrate/#{file_name}\"\n else\n puts \"Could not find migration: '#{migrate}'\"\n end\n end\n else\n migrations.each do |migrate|\n file = migrate.split(\"/\").last \n copy_file migrate, \"db/migrate/#{file}\"\n end\n end\n end", "def run_migrations(migrations)\n migrations.each do |direction, version_or_filenames|\n Array.wrap(version_or_filenames).each do |version_or_filename|\n version = File.basename(version_or_filename)[/\\d{3,}/]\n\n if defined? ActiveRecord::MigrationContext # >= 5.2\n ActiveRecord::Base.connection.migration_context.run(direction, version.to_i)\n else\n ActiveRecord::Migrator.run(direction, ActiveRecord::Migrator.migrations_paths, version.to_i)\n end\n end if version_or_filenames\n end\n if ActiveRecord::Base.schema_format == :ruby\n File.open(ENV['SCHEMA'] || \"#{Rails.root}/db/schema.rb\", 'w') do |file|\n ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, file)\n end\n end\n #TODO unload migraion classes\n end", "def migrate\n raise NotImplementedError\n end", "def install_migrations\n rake \"platforms_core:install:migrations\"\n end", "def pre_migrate_database\n old_schema_version = get_schema_version\n new_schema_version = File.read(File.join(source_directory,'db','schema_version')).to_i\n \n return unless old_schema_version > 0\n \n # Are we downgrading?\n if old_schema_version > new_schema_version\n message \"Downgrading schema from #{old_schema_version} to #{new_schema_version}\"\n \n in_directory install_directory do\n unless system(\"rake -s migrate VERSION=#{new_schema_version}\")\n raise InstallFailed, \"Downgrade migrating from #{old_schema_version} to #{new_schema_version} failed.\"\n end\n end\n end\n end", "def copy_migrations\n rake \"sipity:install:migrations\"\n end", "def setup\n clear_db\n\n @db = Wgit::Database.new\n end", "def up(&block)\n migration.up = block\n end", "def auto_migrate!\n DataMapper.auto_migrate!(name)\n end", "def reset_migrations!\n @migrations = nil\n @migrate_to = nil\n Neo4j::Transaction.run do\n Neo4j.ref_node[:_db_version] = nil\n end\n end", "def migrations\n @migrations ||= begin\n paths = Dir[\"#{migrations_path}/*.rb\"]\n migrations = paths.map { |path| MigrationProxy.new(path) }\n migrations.sort\n end\n end", "def setup_db\n return unless File.exist?(\"#{Jets.root}/config/database.yml\")\n\n db_configs = Jets.application.config.database\n # DatabaseTasks.database_configuration for db:create db:migrate tasks\n # Documented in DatabaseTasks that this is the right way to set it when\n # using ActiveRecord rake tasks outside of Rails.\n ActiveRecord::Tasks::DatabaseTasks.database_configuration = db_configs\n\n current_config = db_configs[Jets.env]\n if current_config.blank?\n abort(\"ERROR: config/database.yml exists but no environment section configured for #{Jets.env}\")\n end\n # Using ActiveRecord rake tasks outside of Rails, so we need to set up the\n # db connection ourselves\n ActiveRecord::Base.establish_connection(current_config)\n end", "def reset_migrations!\n @migrations = nil\n @migrate_to = nil\n Neo4j::Transaction.run do\n migration_meta_node[:_db_version] = nil\n end\n end", "def create_migration_files\n source_dir = 'db/migrate/country_domain'\n destination_dir = 'db/migrate'\n\n migration_template(\n \"#{source_dir}/0001_create_countries.rb\",\n \"#{destination_dir}/create_countries.rb\"\n )\n\n migration_template(\n \"#{source_dir}/0002_create_administrative_level_types.rb\",\n \"#{destination_dir}/create_administrative_level_types.rb\"\n )\n\n migration_template(\n \"#{source_dir}/0003_create_administrative_divisions.rb\",\n \"#{destination_dir}/create_administrative_divisions.rb\"\n )\n\n migration_template(\n \"#{source_dir}/0004_create_postal_codes.rb\",\n \"#{destination_dir}/create_postal_codes.rb\"\n )\n\n migration_template(\n \"#{source_dir}/0005_create_administrative_street_names.rb\",\n \"#{destination_dir}/create_administrative_street_names.rb\"\n )\n\n migration_template(\n \"#{source_dir}/0006_create_administrative_street_numbers.rb\",\n \"#{destination_dir}/create_administrative_street_numbers.rb\"\n )\n end", "def run_local_migrations()\n setup_local_environment\n # Runs migrations against the local database.\n common = Common.new\n Dir.chdir('db') do\n common.run_inline %W{./run-migrations.sh main}\n end\n Dir.chdir('db-cdr/generate-cdr') do\n common.run_inline %W{./init-new-cdr-db.sh --cdr-db-name cdr}\n end\n common.run_inline %W{gradle :loadConfig -Pconfig_key=main -Pconfig_file=config/config_local.json}\n common.run_inline %W{gradle :loadConfig -Pconfig_key=cdrBigQuerySchema -Pconfig_file=config/cdm/cdm_5_2.json}\n common.run_inline %W{gradle :loadConfig -Pconfig_key=featuredWorkspaces -Pconfig_file=config/featured_workspaces_local.json}\n common.run_inline %W{gradle :updateCdrConfig -PappArgs=['config/cdr_config_local.json',false]}\nend", "def migrate options = {}\n options.to_options!\n chroot do\n util.spawn \"rake RAILS_ENV=#{ Bj.rails_env } db:migrate\", options\n end\n end", "def copy_migrations\n [\n \"acts_as_follower_migration.rb\",\n \"add_social_to_users.rb\",\n \"add_ldap_attrs_to_user.rb\",\n \"add_avatars_to_users.rb\",\n \"add_groups_to_users.rb\",\n \"create_local_authorities.rb\",\n \"create_trophies.rb\",\n 'add_linkedin_to_users.rb',\n 'create_tinymce_assets.rb',\n 'create_content_blocks.rb',\n 'create_featured_works.rb',\n 'add_external_key_to_content_blocks.rb'\n ].each do |file|\n better_migration_template file\n end\n end", "def setup_db\n #Supress annoying Schema creation output when tests run\n old_stdout = $stdout\n $stdout = StringIO.new\n \n ActiveRecord::Schema.define(:version => 1) do\n create_table :people do |t|\n t.column :username, :string\n t.column :hair_color, :string\n end\n \n create_table :coffee_mugs do |t|\n t.column :person_id, :integer\n end\n \n create_table :roles do |t|\n t.column :name, :string\n end\n \n create_table :people_roles do |t|\n t.column :role_id, :integer\n t.column :person_id, :integer\n end\n \n create_table :notebooks do |t|\n t.column :title, :string\n t.column :owner_id, :integer\n t.column :ghost_writer_id, :integer\n end\n \n create_table :update_permissions do |t|\n t.column :updater_id, :integer\n t.column :notebook_id, :integer\n end\n \n create_table :pages do |t|\n t.column :number, :integer\n t.column :notebook_id, :integer\n end\n \n create_table :margin_notes do |t|\n t.column :content, :string\n t.column :page_id, :integer\n end\n \n create_table :coffee_stains do |t|\n t.column :opacity, :integer\n t.column :page_id, :integer\n end\n \n create_table :words do |t|\n t.column :text, :string\n t.column :page_id, :integer\n end\n end\n \n #Re-enable stdout\n $stdout = old_stdout\nend", "def generate\n if Rails.version < '4'\n migration_template('rails3_migration',\n \"#{db_migrate_path}/create_db_poller.rb\")\n else\n migration_template('migration',\n \"#{db_migrate_path}/create_db_poller.rb\")\n end\n end", "def copy_migrations\n # Can't get this any more DRY, because we need this order.\n %w{acts_as_follower_migration.rb\tadd_social_to_users.rb\t\tcreate_single_use_links.rb\tadd_ldap_attrs_to_user.rb\nadd_avatars_to_users.rb\t\tcreate_checksum_audit_logs.rb\tcreate_version_committers.rb\nadd_groups_to_users.rb\t\tcreate_local_authorities.rb\tcreate_trophies.rb}.each do |f|\n better_migration_template f\n end\n end", "def run_migrations\n return unless pending_migrations?\n callback(:run_migrations) do\n notify(:run_migrations)\n heroku.run_migrations\n end\n end", "def setup_databases\n postgres_user = app_name\n postgres_pass = SecureRandom.urlsafe_base64\n postgres_port = find_open_port\n redis_port = find_open_port\n\n add_env \"REDIS_URL\",\n \"redis://localhost:#{redis_port}\"\n\n add_env \"DATABASE_URL\",\n \"postgres:///#{postgres_user}:#{postgres_pass}@localhost:#{postgres_port}\",\n skip_secrets: true\n\n template \"database.yml\",\n \"#{app_name}/config/database.yml\",\n force: true\n\n template \"docker-compose.yml\",\n \"#{app_name}/docker-compose.yml\",\n postgres_user: postgres_user,\n postgres_pass: postgres_pass,\n postgres_port: postgres_port,\n redis_port: redis_port\n end", "def auto_upgrade!\n AutoMigrator.auto_upgrade(name)\n end", "def auto_upgrade!\n AutoMigrator.auto_upgrade(name)\n end", "def migrate\n with_maintenance do\n backup if backup?\n run_migration\n restart\n end\n end", "def run_db_migrate_rake_task(rollback = false)\n run_custom_build_steps :before_database_migrations\n\n old_schema_version = 0\n old_schema_version = @metadata.read(schema_version_cache).chomp.to_i if @metadata.exists?(schema_version_cache)\n rollback = true if old_schema_version > schema_version\n old_schema_version = @metadata.read(rollback_schema_version_cache).chomp if @metadata.exists?(rollback_schema_version_cache) && rollback\n return true if schema_same_since?(old_schema_version)\n\n instrument \"rails3.run_db_migrate_rake_task\" do\n log(\"db_migrate\") do\n\n migrate = rake.task(\"db:migrate\")\n migrate = rake.task(\"db:rollback\") if rollback\n\n return true unless migrate.is_defined?\n\n if ENV['FORCE_DATABASE_MIGRATIONS']\n topic(\"Forcing database migrations.\")\n else\n topic(\"Running database migrations\") unless rollback\n topic(\"Rolling back database to version #{old_schema_version}\") if rollback\n end\n\n if user_env_hash.empty?\n default_env = {\n \"DATABASE_URL\" => ENV[\"DATABASE_URL\"] || default_database_url\n }\n else\n default_env = {\n \"DATABASE_URL\" => default_database_url\n }\n end\n\n default_env['VERSION'] = old_schema_version if rollback\n\n cache.load migrations_cache if rollback # we need the newer migrations to be able to rollback\n\n migrate.invoke(env: default_env.merge(user_env_hash).merge(\"RAILS_ENV\" => \"migrations\"))\n\n if migrate.success?\n log \"db_migrate\", :status => \"success\"\n puts \"Database migrations completed (#{\"%.2f\" % migrate.time}s)\" unless rollback\n puts \"Database rollback completed (#{\"%.2f\" % migrate.time}s)\" if rollback\n\n FileUtils.mkdir_p(heroku_metadata)\n @metadata.write(rollback_schema_version_cache, old_schema_version, false)\n @metadata.write(schema_version_cache, schema_version, false) unless rollback\n @metadata.write(schema_version_cache, old_schema_version, false) if rollback\n @metadata.save\n\n cache.store migrations_cache\n\n run_custom_build_steps :after_database_migrations\n else\n log \"db_migrate\", :status => \"failure\"\n error \"Database migrations failed.\" unless rollback\n error \"Database rollback failed.\" if rollback\n end\n end\n end\n end", "def setup_database\n Hanami::Model.load!\n end", "def migrate\n db.create_table? table_name do\n primary_key :id\n String :ptype\n String :v0\n String :v1\n String :v2\n String :v3\n String :v4\n String :v5\n end\n end", "def up\n # Use self.class:: so constants are resolved in subclasses instead of this class.\n self.class::COLUMNS.each do |column|\n change_column_null(self.class::TABLE_NAME, column, false)\n end\n end", "def run_migrations(manifest)\n\n # run bootstrap before user migrations to prepare database\n run_bootstrap\n\n # loop through the manifest, executing migrations in turn\n manifest.each_with_index do |migration, index|\n execute_migration(migration.name, migration.filepath)\n end\n\n end", "def up\n builds_with_artifacts.find_each do |build|\n build.migrate_artifacts!\n end\n end", "def supports_migrations?\n true\n end", "def supports_migrations?\n true\n end", "def auto_migrate!(repository_name = nil)\n auto_migrate_down!(repository_name)\n auto_migrate_up!(repository_name)\n end", "def migrate\n puts \"Migrating your database\"\n version = `ls db/migrate | wc -l`.to_i\n ActiveRecord::Base.establish_connection(Play.config['db'])\n ActiveRecord::Migrator.migrate(\"#{File.dirname(__FILE__)}/../db/migrate/\", version)\nend", "def check_schema_migrations\n return if column_family_exists?('schema_migrations')\n say 'Creating schema_migrations column family'\n DatastaxRails::Cql::CreateColumnFamily.new('schema_migrations').primary_key('cf')\n .columns(cf: :text, digest: :text, solrconfig: :text, stopwords: :text).execute\n end", "def migration\n migration_template 'migration.rb', 'db/migrate/create_seo_landing_pages.rb'\n end", "def install_migrations\n say_status :copying, \"migrations\"\n silence_stream(STDOUT) do\n silence_warnings { rake 'qe:install:migrations' }\n end\n end", "def migrate\n maintenance = Heroku::PgMigrate::Maintenance.new(api, app)\n scale_zero = Heroku::PgMigrate::ScaleZero.new(api, app)\n rebind = Heroku::PgMigrate::RebindConfig.new(api, app)\n provision = Heroku::PgMigrate::Provision.new(api, app)\n foi_pgbackups = Heroku::PgMigrate::FindOrInstallPgBackups.new(api, app)\n transfer = Heroku::PgMigrate::Transfer.new(api, app)\n check_shared = Heroku::PgMigrate::CheckShared.new(api, app)\n release_num = Heroku::PgMigrate::ReleaseNumber.new(api, app)\n\n mp = Heroku::PgMigrate::MultiPhase.new()\n mp.enqueue(check_shared)\n mp.enqueue(foi_pgbackups)\n mp.enqueue(provision)\n mp.enqueue(release_num)\n mp.enqueue(maintenance)\n mp.enqueue(scale_zero)\n mp.enqueue(transfer)\n mp.enqueue(rebind)\n\n mp.engage()\n end", "def supports_migrations?\n true\n end", "def supports_migrations?\n true\n end", "def supports_migrations?\n true\n end", "def migrate_database(app_name, instance_name)\n Dir.chdir RailsPwnerer::Config[app_name, instance_name][:app_path] do\n # now migrate the database\n if File.exist?('Gemfile')\n Kernel.system 'bundle exec rake db:migrate RAILS_ENV=production'\n else\n Kernel.system 'rake db:migrate RAILS_ENV=production'\n end\n end\n end", "def setup_db\n @database.create_table :merchants do\n primary_key :id\n String :name\n end\n\n @database.create_table :cards do\n primary_key :id\n String :token, :unique => true, :null => false\n Integer :limit, :null => false\n Integer :balance, :null => false\n Integer :velocity_limit\n Integer :velocity_interval\n end\n\n @database.create_table :txns do\n primary_key :id\n Integer :card_id, :null => false\n Integer :merchant_id, :null => false\n Integer :amount, :null => false\n DateTime :created_at, :null => false\n end\n\n @database.create_table :locks do\n String :id, :unique => true, :null => false\n DateTime :created_at\n end\n\n return true\n end", "def migrate_database\n # Creating the new database\n ActiveRecord::Base.connection.execute(\"CREATE DATABASE `crowdvoice_installation_#{@new_install.name}`\")\n @default_config ||= ActiveRecord::Base.connection.instance_variable_get(\"@config\").dup\n\n # Connect to new database\n # TODO: Fix server name, shouldn't use the crowdvoice_installation prefix\n ActiveRecord::Base.establish_connection(@default_config.dup.update(:database => \"crowdvoice_installation_#{@new_install.name}\"))\n\n #Migrating database\n\n ActiveRecord::Migrator.migrate(\"db/migrate/\")\n @new_user = @old_user.clone\n @new_user.is_admin = true\n @new_user.save(:validate => false)\n @server_install = Installation.create(:email => @new_user.email, :name => \"crowdvoice-installation-#{@new_install.name}\")\n CustomAttribute.create(\n :name => @new_install.name,\n :logo => @new_install.name,\n :twitter => 'http://twitter.com/intent/tweet?source=webclient&text=Tracking+voices+of+protest+-+http%3A%2F%2Fwww.crowdvoice.org',\n :facebook => 'https://www.facebook.com/sharer.php?t=Tracking+voices+of+protest&u=http%3A%2F%2Fwww.crowdvoice.org',\n :title => @new_install.name,\n :message => \"Modify this message on your admin area!\")\n end", "def migrated_up(migration)\n column_family.insert({\n data: {\n version: migration.version.to_s,\n name: migration.name,\n migrated_at: Time.now.utc,\n },\n })\n end", "def create_migration_file\n #~ migration_template 'users.rb', 'db/migrate/create_users_table.rb',\n\t\t#~ migration_template 'profiles.rb', 'db/migrate/create_contact_details_table.rb',\n\t\t#~ migration_template 'subjects.rb', 'db/migrate/create_profiles_table.rb',\n\t\t#~ migration_template 'attachments.rb', 'db/migrate/create_attachments_table.rb'\n end", "def define\n desc \"Generate a migration (don't forget to pass the migration name)\"\n task \"#{@name}:migrations:generate\", [:name] do |t, args|\n raise 'Need a migration name' unless args[:name]\n Enrar::Migration.new(args[:name]).generate!\n end\n\n desc \"Create the db\"\n task \"#{@name}:db:create\" do\n Enrar::DB.new.create!\n end\n\n desc \"Migrate the database (VERBOSE=true)\"\n task \"#{@name}:db:migrate\", [:version] do |t, args|\n Enrar::Migrator.new(args[:version], verbose: ENV['VERBOSE']).migrate!\n end\n self\n end", "def generate_migrations(m)\n m.migration_template 'acts_as_attention_concept_migration.rb', File.join('db', 'migrate'),\n {:migration_file_name => \"create_attention_concepts\"}\n end", "def generate_migration(tables)\n return if tables.empty? && @db_tables.empty?\n result.clear\n\n add_line \"Sequel.migration do\"\n indent do\n generate_migration_body(tables)\n end\n add_line \"end\\n\"\n\n result.join(\"\\n\")\n end", "def up\n delete_queued_jobs(MIGRATION)\n\n requeue_background_migration_jobs_by_range_at_intervals(MIGRATION, DELAY_INTERVAL)\n end", "def migrate\n # Create the directories\n vpc_dir = \"#{@migration_root}/vpc\"\n policies_dir = \"#{vpc_dir}/policies\"\n route_tables_dir = \"#{vpc_dir}/route-tables\"\n network_acls_dir = \"#{vpc_dir}/network-acls\"\n subnets_dir = \"#{vpc_dir}/subnets\"\n vpcs_dir = \"#{vpc_dir}/vpcs\"\n\n if !Dir.exists?(@migration_root)\n Dir.mkdir(@migration_root)\n end\n if !Dir.exists?(vpc_dir)\n Dir.mkdir(vpc_dir)\n end\n if !Dir.exists?(policies_dir)\n Dir.mkdir(policies_dir)\n end\n if !Dir.exists?(route_tables_dir)\n Dir.mkdir(route_tables_dir)\n end\n if !Dir.exists?(network_acls_dir)\n Dir.mkdir(network_acls_dir)\n end\n if !Dir.exists?(subnets_dir)\n Dir.mkdir(subnets_dir)\n end\n if !Dir.exists?(vpcs_dir)\n Dir.mkdir(vpcs_dir)\n end\n\n # Migrate the different assets\n migrate_policies(policies_dir)\n route_table_names = migrate_route_tables(route_tables_dir)\n network_acl_names = migrate_network_acls(network_acls_dir)\n subnet_names = migrate_subnets(subnets_dir, route_table_names, network_acl_names)\n migrate_vpcs(vpcs_dir, route_table_names, subnet_names, network_acl_names)\n end", "def before_setup\n Account.connection.drop_table :accounts, if_exists: true\n Account.connection.exec_query(\"CREATE SEQUENCE accounts_id_seq\")\n Account.connection.exec_query(\"\n CREATE TABLE accounts (\n id BIGINT PRIMARY KEY DEFAULT nextval('accounts_id_seq'),\n firm_id bigint,\n firm_name character varying,\n credit_limit integer\n )\n \")\n\n Company.connection.drop_table :companies, if_exists: true\n Company.connection.exec_query(\"CREATE SEQUENCE companies_nonstd_seq\")\n Company.connection.exec_query(\"\n CREATE TABLE companies (\n id BIGINT PRIMARY KEY DEFAULT nextval('companies_nonstd_seq'),\n type character varying,\n firm_id bigint,\n firm_name character varying,\n name character varying,\n client_of bigint,\n rating bigint,\n account_id integer,\n description character varying\n )\n \")\n\n Course.connection.drop_table :courses, if_exists: true\n Course.connection.exec_query(\"CREATE SEQUENCE courses_id_seq\")\n Course.connection.exec_query(\"\n CREATE TABLE courses (\n id INT PRIMARY KEY DEFAULT nextval('courses_id_seq'),\n name character varying,\n college_id integer\n )\n \")\n\n self.class.fixtures :accounts\n self.class.fixtures :companies\n self.class.fixtures :courses\n end", "def install_hydra_role_management\n generate('roles')\n rake('db:migrate')\n end", "def upgrade(migrations, context, meta_node)\n migrations.each do |m|\n Neo4j.logger.info \"Running upgrade: #{m}\"\n m.execute_up(context, meta_node)\n end\n end" ]
[ "0.74758285", "0.7456984", "0.74459994", "0.7405735", "0.7358846", "0.7246884", "0.7202893", "0.7149887", "0.7090692", "0.7038769", "0.70298225", "0.6974153", "0.6974153", "0.6860222", "0.6855415", "0.68009853", "0.6789679", "0.6785831", "0.6687629", "0.6627187", "0.65969884", "0.65969175", "0.6581648", "0.6576101", "0.6576101", "0.6576101", "0.65502787", "0.6541352", "0.6537632", "0.65344757", "0.6503198", "0.64786875", "0.6477339", "0.6474751", "0.6464802", "0.6464802", "0.64552265", "0.6432979", "0.641437", "0.640923", "0.6406718", "0.6393654", "0.63614583", "0.6351147", "0.63342357", "0.6252012", "0.62516665", "0.6247921", "0.624321", "0.6226114", "0.62234795", "0.6209111", "0.62032366", "0.6202465", "0.6189521", "0.61890817", "0.6172849", "0.6161806", "0.6155643", "0.61528695", "0.61366886", "0.61226237", "0.6072594", "0.6069431", "0.6064707", "0.60460764", "0.60338855", "0.6024447", "0.6024447", "0.60173297", "0.60030234", "0.5990212", "0.5966125", "0.5948062", "0.5923989", "0.591998", "0.5887805", "0.5887805", "0.5884912", "0.5861765", "0.58603245", "0.5858258", "0.585468", "0.5853647", "0.58516777", "0.58516777", "0.58516777", "0.58512855", "0.58455026", "0.5843492", "0.58360195", "0.58340514", "0.5827657", "0.58173287", "0.58169556", "0.5808196", "0.5805272", "0.5800815", "0.57898974", "0.5781427" ]
0.61382854
60
Add behaviors to the user model
def inject_user_behavior file_path = "app/models/#{model_name.underscore}.rb" if File.exist?(file_path) inject_into_file file_path, after: /include Hydra\:\:User.*$/ do "\n # Connects this user object to Hyrax behaviors." \ "\n include Hyrax::User" \ "\n include Hyrax::UserUsageStats\n" end else puts " \e[31mFailure\e[0m Hyrax requires a user object. This " \ "generator assumes that the model is defined in the file " \ "#{file_path}, which does not exist. If you used a different " \ "name, please re-run the generator and provide that name as an " \ "argument. Such as \b rails -g hyrax:models client" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def person_extra_methods\n include Domainify::InstanceMethods\n #confirm account id is correct on create of user\n after_create :update_user_account_id\n end", "def attribute_change_for_model_by_user(action, ownable, trackable, user, notes=nil)\n Attributable::Activity.create!({ action: action, ownable: ownable, trackable: trackable, user: user, notes: notes })\n end", "def add_module_irc_behavior(type)\n define_add_behaviour type\n define_del_behaviour type\n end", "def extend_user(module_name, init_method = nil)\n @user_extensions << module_name\n @user_init_methods << init_method unless init_method.nil?\n end", "def inject_sufia_user_behavior\n file_path = \"app/models/#{model_name.underscore}.rb\"\n if File.exist?(file_path)\n inject_into_file file_path, after: /include CurationConcerns\\:\\:User.*$/ do\n \"\\n # Connects this user object to Sufia behaviors.\" \\\n \"\\n include Sufia::User\\n\"\n end\n else\n puts \" \\e[31mFailure\\e[0m Sufia requires a user object. This generators assumes that the model is defined in the file #{file_path}, which does not exist. If you used a different name, please re-run the generator and provide that name as an argument. Such as \\b rails -g sufia client\"\n end\n end", "def merge!(type, behaviors, new_values)\n self.type ||= type\n self.behaviors += behaviors\n self.behaviors.uniq!\n self.values += new_values\n end", "def inject_sufia_user_behavior\n file_path = \"app/models/#{model_name.underscore}.rb\"\n if File.exists?(file_path) \n inject_into_class file_path, model_name.classify do \n \"# Connects this user object to Sufia behaviors. \" +\n \"\\n include Sufia::User\\n\" \n end\n else\n puts \" \\e[31mFailure\\e[0m Sufia requires a user object. This generators assumes that the model is defined in the file #{file_path}, which does not exist. If you used a different name, please re-run the generator and provide that name as an argument. Such as \\b rails -g sufia client\" \n end \n end", "def activate!(user)\n return false if self.active?\n\n @user = user\n\n create_hook!\n\n self.active = true\n self.save!\n end", "def trigger_after_like\n likeable.fire_after_like(self) if likeable.respond_to?(:fire_after_like)\n user.fire_after_like(self) if user.respond_to?(:fire_after_like)\n end", "def initialize\n super\n @strategy = :user\n end", "def run_callbacks\n user = @user_repository.find_or_create(@to_user_id)\n user.add_follower(@from_user_id)\n end", "def user_actions\n if allow_sign_up?\n [:create]\n else\n []\n end\n end", "def activate\n # admin.tabs.add \"Ae Users Authenticator\", \"/admin/ae_users_authenticator\", :after => \"Layouts\", :visibility => [:all]\n User.send :include, AeUsersAuthenticator\n end", "def favourite_article\n self.users << CLI.active_user\n self.save\n end", "def set_ability\n @current_ability ||= Ability.new(User.new)\n end", "def userize\n self.becomes(User)\n end", "def handle_activation(user)\n\t\t\n\tend", "def set_users\n\n end", "def activate_user\n self.save\n self.send_user_notification_email\n end", "def apply_save_data_to_curation_concern(attributes)\n if attributes.fetch('on_behalf_of', nil).present?\n current_depositor = curation_concern.depositor\n new_depositor = ::User.find_by_user_key(attributes.fetch('on_behalf_of'))\n curation_concern.apply_depositor_metadata(new_depositor)\n curation_concern.edit_users = update_edit_users_for_curation_concern(current_depositor, new_depositor)\n end\n super\n end", "def inject_blacklight_user_behavior\n file_path = \"app/models/#{model_name.underscore}.rb\"\n if File.exists?(file_path) \n inject_into_class file_path, model_name.classify do \n \"# Connects this user object to Blacklights Bookmarks and Folders. \" +\n \"\\n include Blacklight::User\\n\" \n end\n else\n puts \" \\e[31mFailure\\e[0m Blacklight requires a user object in order to presist bookmarks and saved searches. This generators assumes that the model is defined in the file /app/models/user.rb, which does not exist. If you used a different name, please re-run the migration and provide that name as an argument. Such as \\b rails -g blacklight client\" \n end \n end", "def set_user; end", "def add_user_permission(u)\n\t\t\n\tend", "def act_as_mentionee\n include Mentionee\n end", "def add_user(user)\n super.tap do |org_user|\n class_name = (users.count == 1) ? JudgeTeamLead : DecisionDraftingAttorney\n class_name.create!(organizations_user: org_user)\n end\n end", "def curator_actions(user)\n can_act_as_logged_in_user(user)\n can_curate\n can_update_metadata\n end", "def make_user\n end", "def init_behavior user_opts\n super if defined? super\n @systems ||= Hash.new\n\n options_for_me = self.class.behavior_options[SystemUser]\n\n options_for_me && options_for_me.each do |klass, options|\n # add the behavior options to the user_opts hash\n # in case we need access to some level class config param\n user_opts.merge!(options)\n @systems[klass] = klass.new( self, user_opts )\n end\n end", "def merge_abilities\n current_ability.merge(Trough::Ability.new(current_user))\n end", "def add\n @user = current_user\n unless current_user.user_info.blank? \n current_user.user_info.each do | key , value|\n m = \"#{key}=\"\n unless key.to_str == \"avatar\" \n @user.send( m, current_user.user_info[key] ) if @user.respond_to?( m )\n end\n end\n end\n respond_to do |format|\n format.html # add.html.erb\n format.json { render json: @user }\n end\n end", "def assign_current_user_to_models\n ActiveRecord::Base.current_user_proc = proc {send(DefaultCurrentUserMenthod)}\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 create_behavior(attributes)\n BrickFTP::API::Behavior.create(attributes)\n end", "def create_behavior(attributes)\n BrickFTP::API::Behavior.create(attributes)\n end", "def applies_to?(user); false end", "def add_user_search\n insert_into_file(\n \"#{Rails.root}/app/models/user.rb\", :after => \"---- Plugins\\n\"\n ) do\n \" include PgSearch\\n\" +\n \" multisearchable :against => [:name, :email]\\n\"\n end\n end", "def add_behaviour(actions)\n @actions.merge!(MockZen::parse_actions(actions))\n self\n end", "def user; end", "def user; end", "def act_as_followee\n include Followee\n end", "def user(*args)\n @users << User.add(*args)\n end", "def add_behaviour behaviour_class, options\n options[:character ]=self\n b = behaviour_class.new(options)\n @behaviours << b if b.kind_of? Behaviour\n end", "def update_happiness\n updated_happiness = self.user.happiness + self.attraction.happiness_rating\n self.user.happiness = updated_happiness\n self.user.save\n end", "def method_missing(method_name, *args)\n\t\tif DELEGATED_METHODS.include?(method_name)\n\t\t\[email protected](method_name, *args)\n\t\telse\n\t\t\tsuper\n\t\tend\n\tend", "def user\n end", "def augment\n @users = User.all\n @user = current_user\n if @user.update_attributes(user_params)\n flash[:success] = \"Welcome to Telmi!\"\n render 'index'\n else\n render 'nda_page'\n flash[:danger] = \"Unable to create user. Please try again.\"\n end\n end", "def method_missing(method_name, *args, &block)\n if user.respond_to?(method_name)\n user.send(method_name, *args, &block)\n else\n super\n end\n end", "def set_perms\n self.perms = Access.for_user(self)\n end", "def attribute_change_by_user(action, trackable, user, notes=nil)\n Attributable::Activity.create!({ action: action, trackable: trackable, notes: notes, user: user })\n end", "def register_relative(attributes)\n user = register_user(attributes)\n user.add_role(Role::Relative)\n user.save\n user\n end", "def create_model_user\n u = User.find_by(email: '[email protected]')\n\n # setup long fab\n f = u.fabs.last\n f.backward[0].update_attributes body: \"Duis vitae nisi quis enim viverra consequat at et lorem. Morbi in quam ut tellus fermentum iaculis. Nullam erat libero, suscipit eget nullam.\"\n f.backward[1].update_attributes body: \"Fusce malesuada odio orci, sit amet malesuada ipsum laoreet in. Aenean id pretium arcu. Integer volutpat gravida ante, quis rutrum est fermentum vel. Sed tempus justo ipsum, ac accumsan quam facilisis eu. Aliquam mollis euismod eros nullam.\"\n f.backward[2].update_attributes body: \"Quisque quis dignissim dui. Aliquam nec varius neque. Duis vitae lacus amet.\"\n\n f.forward[0].update_attributes body: \"Dolor sit amet, consectetur adipiscing elit. Nunc neque elit, lacinia eu neque id, venenatis finibus sem. Nunc vel dui ligula. Nullam vitae enim ut ligula euismod tempus vel eget tortor. Vestibulum quis tristique sapien. Nam cursus ac posuere.\"\n f.forward[1].update_attributes body: \"Aenean ornare mi in tellus egestas rhoncus. Quisque quam ante, ultricies at pretium dictum, pulvinar convallis dolor volutpat.\"\n f.forward[2].update_attributes body: \"Dolor sit amet, consectetur adipiscing elit. Nunc neque elit, lacinia eu neque id, venenatis finibus sem. Nunc vel dui ligula. Nullam vitae enim ut ligula euismod tempus vel eget tortor. Vestibulum quis tristique sapien. Nam cursus ac posuere.\"\n\n # setup Gif Tag\n\n f.gif_tag open(\"http://media2.giphy.com/media/9B5EkgWrF4Rri/giphy.gif\")\n f.save\n\n end", "def act_as_mentioner\n include Mentioner\n end", "def use( klass, opts={} )\n behavior_options[SystemUser] ||= Hash.new\n behavior_options[SystemUser][klass] = opts\n end", "def add_default_behavior(behavior)\n ORIGINAL_BEHAVIORS << behavior\n end", "def meta_abilities\n User.roles.each do |(k, v)|\n if user.has_role? k\n can \"do_#{k}\".to_sym, :all\n end\n end\n end", "def create\n authorize! :create, User\n @user = User.new(params[:user])\n @user.enabled = false\n respond_to do |format|\n if @user.valid? && @user.save\n do_extra_actions\n flash[:notice] = (flash[:notice] == :user_activated) ? :user_created_and_activated : :user_created\n flash[:notice_param] = @user\n format.html do\n redirect_to users_url(:use_session => true)\n end\n format.xml { head :created, :location => user_url(@user) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors.to_xml }\n end\n end\n end", "def set_user\n @user = User.find(params[:id])\n # automatically add user right when we see the user\n # /!\\ it add to every and single user visited!\n if [email protected]_user?\n @user.roles << Role.where(name: 'user').first_or_create\n end\n end", "def user\n self.becomes(User)\n end", "def user\n self.becomes(User)\n end", "def update_user\n end", "def create\n @user = User.new(params[:user])\n find_languages_and_countries\n @user.is_admin = false\n GivePoints.add_on_create(@user)\n respond_to do |format|\n if @user.save\n format.html { redirect_to confirmation_has_been_sent_path, :notice => 'User was successfully created.' }\n format.json { render :json => @user, :status => :created, :location => @user }\n else\n format.html { render :controller => \"public\", :action => \"public_signin\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_create_user_fields\n user_id = AuditModule.get_current_user.uid\n self.created_by = user_id\n self.updated_by = user_id\n end", "def create\n authorize User\n @user.assign_attributes(user_params)\n logger.info \"PARAMS: #{user_params}\"\n logger.info \"USER: #{@user.inspect}\"\n\n respond_to do |format|\n if @user.save\n @user.create_activity :create, owner: current_user\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def call\n context.user = User.find_by_telegram_id(context.telegram_user.id)\n return if context.user\n\n context.is_new_user = true\n context.user = User.create(\n telegram_id: context.telegram_user.id,\n )\n end", "def model_class\n User\n end", "def add_user(user)\n @users << user\n end", "def activate\n\t\t#puts \"sessions_controller.activate\"+params.inspect\n\t\tuser = User.find(params[:id]) if User.exists?(params[:id])\n\t\tunless user.nil?\n\t\t\tif user.may_connect?\n\t\t\t\ttype=Typesobject.find_by_forobject_and_name(\"user\", PlmServices.get_property(:TYPE_USER_PERSON))\n\t\t\t\tuser.typesobject=type\n\t\t\t\tif user.save\n\t\t\t\t\t@current_user = user\n\t\t\t\t\tsession[:user_id] = user.id\n\t\t\t\t\tflash[:notice] = t(:ctrl_role_needed)\n\t\t\t\t\trespond_to do |format|\n\t\t\t\t\t\tformat.html { render :action => :edit }\n\t\t\t\t\t\tformat.xml { head :ok }\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tflash[:notice] = t(:ctrl_new_account_not_validated, :user=>user.login)\n\t\t\t\t\t#puts \"sessions_controller.activate new_account_not_validated :\"+user.to_s\n\t\t\t\t\trespond_to do |format|\n\t\t\t\t\t#format.html { render :action => :new }\n\t\t\t\t\t\tformat.html { redirect_to user}\n\t\t\t\t\t\tformat.xml {render :xml => errs, :status => :unprocessable_entity }\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tflash[:error] = t(:ctrl_user_not_valid,:user=>user )\n\t\t\t\t@current_user=nil\n\t\t\t\t#puts \"sessions_controller.activate user_not_valid :\"+user.to_s\n\t\t\t\trespond_to do |format|\n\t\t\t\t\tformat.html { redirect_to user }\n\t\t\t\t\tformat.xml {render :xml => errs, :status => :unprocessable_entity }\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\tflash[:notice] = t(:ctrl_new_account_not_existing, :user=>nil)\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html { render :action => :new }\n\t\t\t\tformat.xml {render :xml => errs, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\n\tend", "def allowed_types\n [Tapir::Entities::User]\nend", "def customize_new_user(user)\n # user.level = User::Levels::MEMBER\n # user.can_approve_posts = false\n # user.can_upload_free = false\n # user.is_super_voter = false\n #\n # user.base_upload_limit = 10\n # user.comment_threshold = -1\n # user.blacklisted_tags = [\"spoilers\", \"guro\", \"scat\", \"furry -rating:s\"].join(\"\\n\")\n # user.default_image_size = \"large\"\n # user.per_page = 20\n # user.disable_tagged_filenames = false\n true\n end", "def before_save(model)\n model.updated_by = @@current_user if model.respond_to?(\"updated_by\")\n end", "def users\n \n end", "def gt_enable!\n unless self.gt_enabled?\n self.gt_enabled = true\n\n self.cohorts << Settings::User.current_cohort unless self.cohorts.include? Settings::User.current_cohort\n GT::UserManager.ensure_users_special_rolls(self, true)\n\n self.save(:validate => false)\n\n public_roll = self.public_roll\n if (self.user_type == User::USER_TYPE[:real] || self.user_type == User::USER_TYPE[:converted])\n public_roll.roll_type = Roll::TYPES[:special_public_real_user]\n end\n public_roll.save(:validate => false)\n end\n end", "def create\n @user = User.new(params[:user])\n @user.firm = current_firm\n @users = current_firm.users\n @model = \"user\"\n @model_instanse = @user\n respond_to do |format|\n if @user.save\n flash[:notice] = flash_helper(\"Registration successful.\")\n format.html {redirect_to(users_path())}\n format.js\n else\n format.js { render \"shared/validate_create\" }\n end\n end\n end", "def record_user_activity\n current_user.touch :last_active_at if current_user\n end", "def set_users\n @can_change_owner = policy(@run || Run).current_user_allowed_to_crud?\n @users = policy_scope(User).map{|u| [ u.name, u.id ] } if @can_change_owner\n end", "def interactions \n normal_interactions << default_interaction\n end", "def require_user\n end", "def add_user(email, options={})\n raise NotImplementedError, \"Please implement this in your concrete class\"\n end", "def create\n @myth = Myth.new(myth_params)\n\n\n respond_to do |format|\n if @myth.save\n @myth.mythsUsers << MythsUser.create(user: current_user, access_level: 2)\n format.html { redirect_to @myth, notice: 'Myth was successfully created.' }\n format.json { render :show, status: :created, location: @myth }\n else\n format.html { render :new }\n format.json { render json: @myth.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(member_params)\n restrict_other_family\n @user.username = (0...4).map{ ('a'..'z').to_a[rand(26)] }.join\n\n respond_to do |format|\n if @user.save\n # redirect_back_or_default new_user_url\n\n format.html { redirect_to member_path(@user), notice: \"#{@user.dispname(User::FULLNAME)}を登録しました.\" }\n format.json { render json: @user, status: :created, location: @user }\n else\n @users = User.includes_ext.order(\"user_exts.birth_day ASC\")\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def reload_user_model\n if @user_model.present?\n @user_model = @user_model.to_s.constantize\n end\n end", "def add_user_role\n user_role = Role.find_by_name(\"user\")\n self.roles << user_role if user_role and self.roles.empty?\n end", "def create_user_information # for new users. runs last according to rails.\n self.dj_name = name\n self.roles = Role.where(:title => 'noob')\n self.active = true\n set_password\n end", "def user_attributes=(attrs)\n self.user = User.where(attrs).first_or_initialize(attrs) \n @show_exists_message = !user.new_record?\n end", "def create_user\n super\n end", "def add_actions; end", "def my_users\n self.users + [self.user]\n end", "def before_create(model)\n model.created_by = @@current_user if model.respond_to?(\"created_by\")\n end", "def apply(changes)\n GoodData::User.apply(self, changes)\n end", "def before_create_user\n logger.debug(\"on before creare user\")\n #Generate a unique key\n if facebook_user?\n self.active = 1 \n else\n activation_key_string = self.salt+self.email+self.hashed_password\n self.activation_key =Digest::SHA1.hexdigest(activation_key_string)\n self.active = 0\n end\n self.admin = 0 \n self.handle=generate_unique_handle\n \n end", "def model_actions(perms)\n ActiveRecord::Base.descendants.each do |m|\n next unless m.respond_to?(:permission_definition)\n next if m.permission_definition.nil? || m.permission_definition == {}\n perms << PermissionsGenerator.new(m)\n end\n return perms\nend", "def attend\n # update user_fun.is_attend\n user_fun = UserFun.find(params[:user_fun_id])\n user_fun.update_attribute(:is_attend, 1)\n\n # save user_point\n user_point = UserPoint.new\n user_point.add_point(current_user.id, 30000, 'fun')\n \n # save team_point \n team_point = TeamPoint.new\n team = Team.find_by_user1(current_user.id)\n team_point.add_point(team.id, 30000)\n\n redirect_to '/users/home'\n end", "def save\r\n @@users.push self\r\n end", "def set_up_user\n # user's details\n @user = current_user\n @notification = Notification.where(user_id: @user.id, read: 0)\n end", "def add_user!( user, update_user = true )\n puts \"add_user\"\n unless @users.include?( user )\n @users << user\n user.add_badge!( self, false ) if update_user\n end\n return @users\n end", "def create\n @user = User.new()\n user_params = permitted_attributes(@user)\n @user.attributes = user_params\n authorize(@user)\n if @user.save\n users = policy_scope(User)\n render json: { users: users}\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def add_user params\n validate_and_store :user, {:state => 'user'}.merge(params)\n end", "def update_users\n User.all.each do |user|\n user.update_family_goal\n end\n end", "def add\n @user = User.new\n end", "def create\n super do\n case @user.role\n when 'trainee'\n trainee = Trainee.new(user_id: @user.id)\n trainee.save\n when 'trainer'\n trainer = Trainer.new(user_id: @user.id)\n trainer.save\n end\n end\n end" ]
[ "0.5595829", "0.53345513", "0.53054124", "0.5245441", "0.52158254", "0.5152075", "0.51172626", "0.5111411", "0.5107016", "0.50877917", "0.5066574", "0.5065238", "0.5052048", "0.498654", "0.49776256", "0.49758825", "0.4968686", "0.49598297", "0.4959245", "0.49569952", "0.4955699", "0.4954609", "0.4954022", "0.4929898", "0.4926353", "0.4918387", "0.4895942", "0.48884144", "0.48811594", "0.4867685", "0.48481128", "0.48433062", "0.4834498", "0.4834498", "0.48340517", "0.48255336", "0.482453", "0.48093072", "0.48093072", "0.48081946", "0.48001057", "0.47819158", "0.4763687", "0.476282", "0.47576517", "0.47532967", "0.4749541", "0.47463942", "0.47429562", "0.47378138", "0.47359297", "0.47314888", "0.47202894", "0.47176793", "0.47113055", "0.47075984", "0.47019243", "0.46996954", "0.46996954", "0.4692932", "0.4687447", "0.4685853", "0.46846974", "0.46820062", "0.46809426", "0.467853", "0.46766263", "0.46743268", "0.46716556", "0.46681184", "0.46659344", "0.4665241", "0.4660026", "0.4657485", "0.46537837", "0.46525005", "0.46517992", "0.46431804", "0.4641093", "0.46308002", "0.46282268", "0.46255723", "0.46216974", "0.46215484", "0.46180564", "0.46175212", "0.4605227", "0.46032178", "0.45975405", "0.45973584", "0.45968193", "0.45877942", "0.45719105", "0.4568258", "0.45627004", "0.4558389", "0.4557899", "0.45551133", "0.4554131", "0.45538372" ]
0.59222883
0
GET /ajaxes GET /ajaxes.json
def index @ajaxes = Ajax.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @gets = Get.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gets }\n end\n end", "def index\n @requests = Request.all\n\n render json: @requests\n end", "def index\n @requests = Request.all\n\n respond_to do |format|\n format.json { render :json => @requests}\n end\n end", "def index\n @clientes = Cliente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clientes }\n end\n end", "def index\n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end", "def index\n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end", "def index\n @requests = ::Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end", "def index\n @posts = Post.all\n render json: @posts\n end", "def index\n @posts = Post.all\n\n render json: @posts\n end", "def index\n @posts = Post.all\n\n render json: @posts\n end", "def index\n @heroes = Hero.all\n\n render json: @heroes\n end", "def index\n @admin_guests = Guest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_guests }\n end\n end", "def index\n\n get_collections\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deities }\n format.js {}\n end\n end", "def index\n @postos = Posto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @postos }\n end\n end", "def index\n @instances = Instance.all\n render json: @instances\n end", "def index\n @posts = Post.all\n render json: @posts\n end", "def index\n\n @posts = Post.all\n\n render json: @posts, status: 200\n end", "def index\n @antecedentes = Antecedente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @antecedentes }\n end\n end", "def index\n @resources = Resource.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resources }\n end\n end", "def index\n @listes = Liste.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listes }\n end\n end", "def index\n render json: Post.all\n end", "def index\n @instances = Instance.all\n render :json => @instances\n end", "def index\n get_data\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @countries }\n format.js\n end\n end", "def index\n @verbindungs = Verbindung.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @verbindungs }\n end\n end", "def index\n render json: Client.all\n end", "def index\n @coordenador_estagios = CoordenadorEstagio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @coordenador_estagios }\n end\n end", "def index\n render 'post'\n respond_to :json\n end", "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json {render json: @posts}\n end\n end", "def index\n render json: { posts: Post.all }\n end", "def index\n render json: Blog.all\n end", "def index\n @posts = Post.all\n \n render json: @posts\n end", "def index\n\n get_collections\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @temples }\n format.js {}\n end\n end", "def index\n @offers = Offer.all\n respond_to do |format|\n format.jsonapi { render jsonapi: @offers }\n format.html { @offers }\n end\n end", "def index\n @detalles = Detalle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @detalles }\n end\n end", "def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n\n end", "def index \n fans = Fan.all \n render json: fans \n end", "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end", "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end", "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end", "def index\n render json: @fiestas\n end", "def index\n @api_javascripts = Api::Javascript.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @api_javascripts }\n end\n end", "def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end", "def index\n @site_editorials = SiteEditorial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @site_editorials }\n end\n end", "def index\n @posts = Post.all\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @posts }\n end\n end", "def json_index_static_contents\n\n @static_contents = StaticContent.all\n respond_to do |format|\n\n format.json { render json: @static_contents }\n end\n end", "def index_ajax\n @assets = Asset.find(:all)\n render :back => '/app'\n end", "def index\n @contacts = Contact.all\n render json: @contacts\n end", "def index\n @articles = Article.all\n\n respond_to do |format|\n format.json { render json: @articles }\n end\n end", "def index\n\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @posts }\n end\n end", "def index\n @somethings = Something.all\n render json: @somethings\n end", "def index\n @assuntos = Assunto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assuntos }\n end\n end", "def index\n @attendees = Attendees.all\n render json: @attendees\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @personas }\n end\n end", "def index\r\n @salles = Salle.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @salles }\r\n end\r\n end", "def index\n @clients = Client.all\n @uuid = params[:uuid]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end", "def index\n respond_to do |format|\n format.html do \n @sites = Site.all\n end\n format.json do\n render json: Site.all\n end\n end\n end", "def index\n @acoes = Acao.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @acoes }\n end\n end", "def show\n @posts = Post.find(params[:id])\n render json: @posts\n end", "def index\n @offers = Offer.all\n\n render json: @offers\n end", "def index\n render json: @links\n end", "def index\n @empresas = Empresa.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @empresas }\n end\n end", "def index\n @enderecos = Endereco.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enderecos }\n end\n end", "def index\n @ajax_search = params[:ajax_search] == \"true\" ? true : false\n \n @servers = Server.search(params[:search]).order(sort_column + \" \" + sort_direction).paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.js # index.js.erb\n format.json { render json: @servers }\n end\n end", "def index\n @pages = Page.all\n render json: @pages\n end", "def index\n @events = Event.all\n render json: @events\n end", "def index\n @dia_eventos = DiaEvento.all\n render json: @dia_eventos\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def index\n @administradors = Administrador.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @administradors }\n end\n end", "def index\n contacts = Contact.order('created_at DESC')\n\n respond_to do |format|\n format.html \n format.json { render json: contacts.as_json }\n end\n end", "def index\n @guests = @wedding.guests.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @guests }\n end\n end", "def index\n @places = @site.places.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @places }\n end\n end", "def index\n @features = Feature.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @features }\n end\n end", "def index\n @events = Event.all\n\n render json: @events\n end", "def index\n respond_with(@collection) do |format|\n format.html\n format.json { render :json => json_data }\n end\n end", "def index\n @regiones = Region.all\n\n render json: @regiones\n end", "def index\n @normas = Norma.all\n render json: @normas\n end", "def index\n @api_v1_post_votes = PostVote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @api_v1_post_votes }\n end\n end", "def show\n render json: @entity.to_json if request.xhr?\n end", "def index\n temp = current_user.id\n # Auf Methode warten, nur noch offene, in der Zukunft liegende Requests \n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end", "def index\n @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 @contacts = Contact.all\n render json: {status: 200, contacts: @contacts}\n end", "def index\n @telefones = Telefone.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @telefones }\n end\n end", "def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end", "def index\n @countries = Country.all\n\n render json: @countries\n end", "def index\n respond_to do |format|\n format.html\n format.json\n end\n end", "def index\n @ventas = Venta.order(\"fecha desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ventas }\n end\n end", "def index\n @jobs = Job.all\n render json: @jobs\n end", "def index\n @zones = Zone.all\n\n render json: @zones\n end", "def ajax\n\n# Render json data containing the different fields: (For ajax use)\n render :json => { total: Cache.count, \n uploads: Cache.where(source: 'original').count, \n downloads: Cache.where(source: 'collamine').count, \n urls: Cache.desc(:created_at).limit(10).pluck(:url), \n domains: Cache.desc(:created_at).distinct(:domain).take(10)\n }\n end", "def index\n @essays = Essay.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @essays }\n end\n end", "def index\n respond_to do |format|\n format.html\n format.json\n end \n end", "def index\n @nasp_rails = NaspRail.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @nasp_rails }\n end\n end", "def index\n respond_to do |format|\n format.html\n format.json\n end \n end", "def index\n @verbs = Verb.all\n\n render json: @verbs\n end", "def index\n @episodes = Episode.all\n\n render json: @episodes\n end", "def index\n @jobs = Job.all\n\n render json: @jobs\n end", "def index\n @instituicoes = Instituicao.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @instituicoes }\n end\n end" ]
[ "0.6412622", "0.6380785", "0.6371203", "0.6301283", "0.6256182", "0.6256182", "0.6250867", "0.6239266", "0.6238073", "0.6238073", "0.6231606", "0.6153148", "0.6152899", "0.6141373", "0.6139688", "0.61334676", "0.61307216", "0.6124237", "0.61040074", "0.609613", "0.6091262", "0.60890275", "0.60833496", "0.6077521", "0.6073669", "0.60608846", "0.60594654", "0.6059145", "0.605885", "0.6045088", "0.60365903", "0.6033409", "0.60295725", "0.60203713", "0.60194355", "0.6016147", "0.6012064", "0.6012064", "0.6012064", "0.6009213", "0.6005627", "0.5997473", "0.5985371", "0.59837896", "0.5969335", "0.5966792", "0.5963523", "0.5955902", "0.595163", "0.59496087", "0.5945336", "0.5942524", "0.59424955", "0.5936846", "0.592972", "0.592004", "0.59199846", "0.5915701", "0.5911349", "0.5908285", "0.59062976", "0.5901324", "0.5898889", "0.5894378", "0.58909315", "0.58888274", "0.5885875", "0.5885875", "0.5885071", "0.5882886", "0.5878967", "0.5877304", "0.5875676", "0.5873949", "0.5872616", "0.5869884", "0.586054", "0.5858865", "0.58586717", "0.5857251", "0.5856583", "0.5856583", "0.5856583", "0.58555645", "0.5851466", "0.58508766", "0.58499277", "0.5849607", "0.5845638", "0.5842989", "0.584264", "0.58391327", "0.58385384", "0.5834426", "0.58343655", "0.5834168", "0.58305264", "0.58299005", "0.5829478", "0.58246005" ]
0.6882418
0
GET /ajaxes/1 GET /ajaxes/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @ajaxes = Ajax.all\n end", "def index\n @gets = Get.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gets }\n end\n end", "def index\n @requests = Request.all\n\n respond_to do |format|\n format.json { render :json => @requests}\n end\n end", "def show\n # TODO: this is a placeholder for logic using Sentence\n render :json => { :index => params[:id],\n :contents => \"SERVER: this would be the contents of page \" + params[:id]\n }\n end", "def index\n @requests = Request.all\n\n render json: @requests\n end", "def index\n @clientes = Cliente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clientes }\n end\n end", "def index\n @clients = Client.all\n @uuid = params[:uuid]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end", "def index\n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end", "def index\n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end", "def index\n @requests = ::Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end", "def index\n\n get_collections\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deities }\n format.js {}\n end\n end", "def index\n\n get_collections\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @temples }\n format.js {}\n end\n end", "def index\n render 'post'\n respond_to :json\n end", "def index\n get_data\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @countries }\n format.js\n end\n end", "def json_index_static_contents\n\n @static_contents = StaticContent.all\n respond_to do |format|\n\n format.json { render json: @static_contents }\n end\n end", "def index_ajax\n @assets = Asset.find(:all)\n render :back => '/app'\n end", "def index\n @heroes = Hero.all\n\n render json: @heroes\n end", "def index\n render json: Client.all\n end", "def index\n @resources = Resource.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resources }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @supervisions }\n end\n end", "def index\n @instances = Instance.all\n render json: @instances\n end", "def index\n render json: {success: true}\n end", "def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n\n end", "def index\n @ajax_search = params[:ajax_search] == \"true\" ? true : false\n \n @servers = Server.search(params[:search]).order(sort_column + \" \" + sort_direction).paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.js # index.js.erb\n format.json { render json: @servers }\n end\n end", "def index\n @instances = Instance.all\n render :json => @instances\n end", "def index\n @offers = Offer.all\n respond_to do |format|\n format.jsonapi { render jsonapi: @offers }\n format.html { @offers }\n end\n end", "def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end", "def ajax\n\n uri_string = @params[:uri]\n # uri_string = \"http://www.phase-eight.com#{path_string}\"\n uri = construct_uri_object uri_string\n response = network_response uri\n logger.debug \"XHR response type #{response.content_type}\"\n logger.debug \"XHR response body #{response.body.html_safe}\"\n render text: response.body\n end", "def index\n @posts = Post.all\n render json: @posts\n end", "def index\n @posts = Post.all\n\n render json: @posts\n end", "def index\n @posts = Post.all\n\n render json: @posts\n end", "def index\n respond_to do |format|\n format.html\n format.json\n end \n end", "def index\n respond_to do |format|\n format.html\n format.json\n end \n end", "def index\n respond_to do |format|\n format.html\n format.json\n end\n end", "def index\n @postos = Posto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @postos }\n end\n end", "def index\n @api_javascripts = Api::Javascript.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @api_javascripts }\n end\n end", "def index\n @antecedentes = Antecedente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @antecedentes }\n end\n end", "def index\n @listes = Liste.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listes }\n end\n end", "def index\n puts \"index\"\n @contents = Content.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n \n format.json { render json: @contents }\n end\n end", "def index\n temp = current_user.id\n # Auf Methode warten, nur noch offene, in der Zukunft liegende Requests \n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end", "def index\n\n @posts = Post.all\n\n render json: @posts, status: 200\n end", "def index\n @requests = Request.where(status: -1)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end", "def index\n @coordenador_estagios = CoordenadorEstagio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @coordenador_estagios }\n end\n end", "def index\n render json: Post.all\n end", "def index\r\n @salles = Salle.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @salles }\r\n end\r\n end", "def index\n @selections = Selection.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @selections }\n end\n end", "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json {render json: @posts}\n end\n end", "def index\n @features = Feature.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @features }\n end\n end", "def index\n @shorteners = Shortener.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shorteners }\n end\n end", "def index\n render json: Event.all, status: :ok\n end", "def index\r\n render json: { status: \"Test API\"}\r\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @departments }\n format.json { render :text => get_json }\n end\n end", "def index\n respond_with(@collection) do |format|\n format.html\n format.json { render :json => json_data }\n end\n end", "def index\n get_data\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cities }\n format.js\n end\n end", "def index\n @admin_guests = Guest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_guests }\n end\n end", "def index\n render json: @fiestas\n end", "def index\n @verbindungs = Verbindung.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @verbindungs }\n end\n end", "def index\n @detalles = Detalle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @detalles }\n end\n end", "def show\n @respuesta = Respuesta.find(params[:id])\n\n render json: @respuesta\n end", "def index\n @api_v1_post_votes = PostVote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @api_v1_post_votes }\n end\n end", "def index\n @articles = Article.all\n\n respond_to do |format|\n format.json { render json: @articles }\n end\n end", "def index\n index! do |format|\n format.html\n format.json do\n object = if params[:id]\n resource.increment_hits!\n resource\n else\n collection\n end\n\n render :json => object \n end\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_features }\n end\n end", "def index\n @servers = getmydata(\"Server\")\n\tpagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers }\n end\n end", "def index\n render json: Blog.all\n end", "def index\n @posts = Post.all\n render json: @posts\n end", "def json_index_bundles\n\n @bundles = Bundle.where(\"active = 'y'\").order(:id)\n respond_to do |format|\n format.json { render json: @bundles.as_json()\n\n }\n end\n\n end", "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end", "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end", "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end", "def index\n @posts = Post.all\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @posts }\n end\n end", "def index\n @site_editorials = SiteEditorial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @site_editorials }\n end\n end", "def show\n @api_javascript = Api::Javascript.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api_javascript }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @examinations }\n end\n end", "def index\n @events = Event.live\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 @events = Event.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def show\n @posts = Post.find(params[:id])\n render json: @posts\n end", "def index\n @routines = Routine.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @routines }\n end\n end", "def index\n @events = Event.all\n render json: @events\n end", "def index\n respond_to do |format|\n format.html {index_html}\n format.json {index_json}\n end\n end", "def index\n get_sparepart\n get_data\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n format.js\n end\n end", "def index\n\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @posts }\n end\n end", "def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n @events = Event.all\n\n render json: @events\n end", "def index\n respond_to do |format|\n format.html do \n @sites = Site.all\n end\n format.json do\n render json: Site.all\n end\n end\n end", "def show\n \trender json: Post.find(params[:id])\n end", "def index\n @essays = Essay.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @essays }\n end\n end", "def index\n render json: { posts: Post.all }\n end", "def index\n @api_v1_todos = Todo.all\n render json: @api_v1_todos\n end", "def index\n @somethings = Something.all\n render json: @somethings\n end", "def index\n @events = Event.all\n render json: @events, status: 200\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def index\n respond_to do |format|\n format.html\n format.json { render json: @events }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @personas }\n end\n end", "def index\n respond_to do |format|\n format.json {render json: process_search(Admin)}\n format.html # index.html.erb\n end\n end" ]
[ "0.65611947", "0.6251226", "0.61182296", "0.61097974", "0.6085957", "0.6059036", "0.60453117", "0.60371166", "0.60371166", "0.60125023", "0.59928226", "0.59915906", "0.5984348", "0.59730905", "0.5937941", "0.593581", "0.58609205", "0.58459353", "0.5835623", "0.5821474", "0.58147126", "0.58038837", "0.58007634", "0.57877296", "0.5781923", "0.5776409", "0.57723993", "0.57723063", "0.5771113", "0.57630485", "0.57630485", "0.5756832", "0.5756804", "0.57553786", "0.57530653", "0.57522815", "0.5747521", "0.5746089", "0.57423264", "0.57417405", "0.57411546", "0.57407343", "0.5724683", "0.57186246", "0.571643", "0.57111484", "0.5708", "0.57048136", "0.570346", "0.57017446", "0.5700248", "0.5699676", "0.56994265", "0.5698615", "0.56954706", "0.5693445", "0.568809", "0.56818265", "0.5679984", "0.5677437", "0.56750184", "0.5673569", "0.56717986", "0.56672734", "0.5663047", "0.56626993", "0.5659946", "0.56583583", "0.56583583", "0.56583583", "0.5650301", "0.5648872", "0.5643399", "0.563975", "0.5637192", "0.5637192", "0.5631546", "0.56302", "0.5629542", "0.5624517", "0.5624033", "0.5616458", "0.56123114", "0.56123114", "0.56123114", "0.56123114", "0.56123114", "0.56123114", "0.56121576", "0.56045264", "0.5603081", "0.5603013", "0.56006867", "0.5598973", "0.5598472", "0.5598176", "0.5597552", "0.5597552", "0.5596213", "0.55957675", "0.55956227" ]
0.0
-1
POST /ajaxes POST /ajaxes.json
def create @ajax = Ajax.new(ajax_params) respond_to do |format| if @ajax.save format.html { redirect_to @ajax, notice: 'Ajax was successfully created.' } format.json { render action: 'show', status: :created, location: @ajax } else format.html { render action: 'new' } format.json { render json: @ajax.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def POST; end", "def index\n @ajaxes = Ajax.all\n end", "def post(*args)\n request :post, *args\n end", "def xhr_post *args, params_or_action\n Presto::Browser.new(@controller, env, 'POST', true).body *args, params_or_action\n end", "def post(target, data, &block)\n xhr = XMLHttpRequest.new()\n xhr.open('POST', \"actions/#{target}\", true)\n xhr.setRequestHeader('Content-Type', 'application/json;charset=utf-8')\n xhr.responseType = 'text'\n\n def xhr.onreadystatechange()\n if xhr.readyState == 4\n data = nil\n\n begin\n if xhr.status == 200\n data = JSON.parse(xhr.responseText)\n elsif xhr.status == 404\n alert \"Not Found: actions/#{target}\"\n elsif xhr.status >= 400\n console.log(xhr.responseText)\n alert \"Exception\\n#{JSON.parse(xhr.responseText).exception}\"\n end\n rescue => e\n console.log(e)\n end\n\n block(data)\n end\n end\n\n xhr.send(JSON.stringify(data))\nend", "def index\n render 'post'\n respond_to :json\n end", "def post(*args)\n request(:post, *args)\n end", "def post(*args)\n super(*wrap_for_json_api(*args))\n end", "def post_request\n\t\turl = request.fullpath.gsub(\"/api\", \"\")\n\t\t@rr = Rr.where(\"url = ?\", url).first\n\t\trespond_to do |format|\n\t\t\tformat.json { render :json => rr.response}\n\t\t\tformat.xml { render :xml => @rr.response}\n\t\t\tformat.js { render :js => @rr.response}\n\t\tend\n\tend", "def post(options)\n options.assert_valid_keys :url, :form, :params, :eval_response\n options.default! :form => nil, :params => {}, :eval_response => false\n\n if Eschaton.current_view.protect_against_forgery?\n options[:url][:authenticity_token] = Eschaton.current_view.form_authenticity_token\n end\n\n form_fields = if options[:form]\n \"jQuery('##{options[:form]}').serialize()\"\n else\n options[:params].to_js\n end\n\n url = Eschaton.url_for_javascript(options[:url])\n self << \"jQuery.post(#{url}, #{form_fields}, function(data) {\"\n\n yield :data if block_given?\n\n self.eval(:data) if options[:eval_response]\n \n self << \"});\" \n end", "def post(data = {})\n call data, method: :post\n end", "def ajax_save_edit_node\n\n # Get the Node from the DB\n node = Node.find(params[:id])\n\n node.name = params[:name]\n node.email_template_id = params[:email_template_id]\n node.delay_unit = params[:delay_unit]\n node.delay_time = params[:delay_time]\n\n # Save and verify Node and return correct JSON response\n node.put('', {\n :name => node.name,\n :email_template_id => node.email_template_id,\n :delay_unit => node.delay_unit,\n :delay_time => node.delay_time,\n })\n\n # Return Success Response\n response = {\n success: true,\n message: 'Node Updated!'\n }\n render json: response\n\n\n\n end", "def post!\n request! :post\n end", "def post\n resource.post(request, response)\n end", "def post\r\n end", "def json_post\n @content_type = 'text/plain'\n @render_nothing = true\n @rendered_template = true\n @current_layout = nil\n puts \"json_post: submitting #{params[:path]}\" if @@debug\n path = params[:path]\n if path\n puts \"json_post: path is #{path} l=#{path.length}\" if @@debug\n path = path.split('/').compact()\n path.delete('')\n # you cannot make rooted nodes via json atm... fix? xxx\n if path.length > 1\n name = path.pop\n nodes = Note.make_path @user,path\n puts \"json_post: making at path #{path.join('/')}\" if @@debug\n if nodes\n note = nodes.last.make_child @user,params,name\n puts \"json_post: made child #{note} from #{name} l=#{name.length}\"\n params[:path] = path.join('/') # for call to json_query\n # it is important to do a query rather than returning the note; to get freshest order\n json_query\n return\n #write_json note if note\n end\n end\n end\n render :nothing => true\n end", "def post; end", "def api_post(action, data)\n api_request(action, data, 'POST')\n end", "def post endpoint, data\n do_request :post, endpoint, data\n end", "def ajax_add_node\n\n # Create a new Node Instance\n node = Node.new\n\n # Update the fields of Node Instance\n node.app_id = params[:app_id]\n node.funnel_id = params[:funnel_id]\n\n if params[:email_template_id] == '0'\n # Create a new Email Template\n template = EmailTemplate.new\n template.app_id = params[:app_id]\n template.name = params[:name] + ' Email Template'\n template.description = ''\n template.email_subject = ''\n template.color = '#3498db'\n\n # Save blank Email Template\n template.save\n\n node.email_template_id = template.id\n\n else\n node.email_template_id = params[:email_template_id]\n\n end\n\n node.name = params[:name]\n node.delay_time = params[:delay_time]\n node.delay_unit = params[:delay_unit]\n node.top = 60\n node.left = 500\n node.num_emails = 0\n node.num_emails_sent = 0\n node.num_revenue = 0.0\n node.num_emails_opened = 0\n node.num_emails_clicked = 0\n\n\n\n node.save\n\n response = {\n success: true,\n message: 'Node Saved',\n id: node.id,\n email_template_id: node.email_template_id\n\n }\n\n render json: response\n\n\n\n end", "def post\n end", "def render_ajax(event)\n fail \"event/trigger is not found\" unless event[:trigger]\n fail \"event/action is not found\" unless event[:action]\n\n <<-EOS\npost \"/#{event[:id]}\" do\n content_type :json\n response = { _db_errors: {} }\n#{indent(params_rb(event[:trigger][:params]), 1)}\n#{indent(action_rb(event[:action]), 1)}\n response.to_json\nend\n EOS\n end", "def post(target, data, &block)\n xhr = XMLHttpRequest.new()\n xhr.open('POST', \"../json/#{target}\", true)\n xhr.setRequestHeader('Content-Type', 'application/json;charset=utf-8')\n xhr.responseType = 'text'\n\n def xhr.onreadystatechange()\n if xhr.readyState == 4\n data = nil\n\n begin\n if xhr.status == 200\n data = JSON.parse(xhr.responseText) \n elsif xhr.status >= 400\n console.log(xhr.responseText)\n alert \"Exception\\n#{JSON.parse(xhr.responseText).exception}\"\n end\n rescue => e\n console.log(e)\n end\n\n block(data)\n end\n end\n\n xhr.send(JSON.stringify(data))\nend", "def moip_post\n @nasp_rail = NaspRail.new(params[:nasp_rail])\n\n format.html { redirect_to @nasp_rail, :notice => 'Nova entrada criada com sucesso.' }\n format.json { render :json => @nasp_rail, :status => :created, :location => @nasp_rail }\n end", "def post(path, data = {})\n request 'POST', path, body: data.to_json\n end", "def http_post(path, data, content_type = 'application/json')\n http_methods(path, :post, data, content_type)\n end", "def post(path, **args); end", "def post(url, post_vars={})\n send_request url, post_vars, 'POST'\n end", "def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end", "def post_data; end", "def post(*args)\n prepare_request(:post, args)\n @@client.add(:post, @path, *args)\n end", "def post(action, **args); end", "def post(request)\n # sure thing!\n json_response(200, { message: \"This dummy POST endpoint didn't do anything.\" })\n end", "def create\n render json: Post.create(params[\"post\"])\n end", "def post_json(path, body)\n uri = build_uri(path)\n #puts \"🤖 POST #{path}\"\n #puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n #puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n #puts result[:result]\n result\nend", "def send_post(resource, data)\n\n url = URI.parse(primavera_path(resource))\n req = Net::HTTP::Post.new(url.to_s, initheader = {'Content-Type' => 'application/json'})\n req.body = data\n\n puts 'Sending POST request to ' + url.to_s\n\n send_request(url, req)\n end", "def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts JSON.pretty_generate(result)\n result\nend", "def index\n @postos = Posto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @postos }\n end\n end", "def ajax_detail\n @eob = Eob.find(params[:id])\n @eob_details = []\n if params[:eob]\n @attributes = params[:eob][:eob_details_attributes]\n @attributes.each do |key, value|\n @eob_details.push @eob.eob_details.build(value)\n end\n end\n @count = @eob.eob_details.count\n @eob_details.push @eob.eob_details.build()\n\n respond_to do |format|\n format.js {render :layout => false }\n end\n end", "def post(*args)\n Request.post(*args)\n end", "def index\n @posts = Post.all\n render json: @posts\n end", "def handle_POST(request)\n\tinitial_and_headers,body = initialandheaders_Body_Split(request)\n\tinitial,headers = initial_Headers_Split(initial_and_headers)\n\tparams = JSON.parse(body) # parse parameters from json file\n\tcontents = File.read \"thanks.html\"\n\tcontents = modify_content(contents, params[\"viking\"])\n\tinitial = generic_Generate_Initial(200)\n\theaders = generic_Generate_Headers(contents)\n\tgeneric_Generate_Response(initial,headers,contents)\nend", "def post(json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name].compact.join('/')\n url += \"/\"\n return HTTParty.post(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end", "def ajax\n\n uri_string = @params[:uri]\n # uri_string = \"http://www.phase-eight.com#{path_string}\"\n uri = construct_uri_object uri_string\n response = network_response uri\n logger.debug \"XHR response type #{response.content_type}\"\n logger.debug \"XHR response body #{response.body.html_safe}\"\n render text: response.body\n end", "def post_json(url, data)\n JSON.parse(post(url, data, :json, :json))\n end", "def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts result[:result]\n result\nend", "def index\n @posts = Post.all\n\n render json: @posts\n end", "def index\n @posts = Post.all\n\n render json: @posts\n end", "def posts\n @url = MYHOST + \"/api/posts/all\"\n\n\n @respuesta = HTTParty.get(\n @url.to_str\n )\n\n @body = @respuesta.body\n if @body \n redirect_to api_resultado_path(:body => @body, :token => @token)\n return\n end\n end", "def ajax_create_funnel\n\n # Create new Funnel Model\n funnel = Funnel.new\n\n if params[:email_list_id] == '0'\n email_list = EmailList.new\n email_list.name = params[:name]\n email_list.description = params[:name]+ \" Email List\"\n email_list.app_id = params[:app_id]\n email_list.active = 0\n email_list.save!\n\n email_list_id = email_list.id\n else\n email_list_id = params[:email_list_id]\n end\n\n # Update the Fields of Funnel Model\n funnel.app_id = params[:app_id]\n funnel.trigger_id = params[:trigger_id]\n funnel.name = params[:name]\n funnel.email_list_id = email_list_id\n funnel.description = params[:description]\n funnel.num_emails_sent = 0\n funnel.num_revenue = 0.0\n funnel.active = 0\n\n # Save and verify Funnel and return correct JSON response\n if funnel.save!\n final_json = JSON.pretty_generate(result = {\n :success => true\n })\n else\n final_json = JSON.pretty_generate(result = {\n :success => false\n })\n end\n\n # Return JSON response\n render json: final_json\n end", "def post(data = \"\")\n submit :Post, data\n end", "def post options\n rest_request({ method: :post }.merge(options))\n end", "def post options\n rest_request({ method: :post }.merge(options))\n end", "def index\n puts session[:_csrf_token]\n @departments = Department.all\n render json: @departments, status: :ok\n end", "def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{uri}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts result[:result]\n result\nend", "def index\n render json: Post.all\n end", "def post(path, options={})\n request :post, path, options\n end", "def index\n @requests = Request.all\n\n respond_to do |format|\n format.json { render :json => @requests}\n end\n end", "def index\n\n @posts = Post.all\n\n render json: @posts, status: 200\n end", "def post(path, data={})\n request(:post, path, data)\n end", "def index\n render json: { posts: Post.all }\n end", "def index\n render json: {success: true}\n end", "def ejemplares\n\t\tsnib = Geoportal::Snib.new\n\t\tsnib.params = params\n\t\tsnib.ejemplares\n\t\t\n\t\trender json: snib.resp\n\tend", "def index\n @requests = Request.all\n\n render json: @requests\n end", "def destroy\n @ajax.destroy\n respond_to do |format|\n format.html { redirect_to ajaxes_url }\n format.json { head :no_content }\n end\n end", "def index\n @posts = Post.all\n render json: @posts\n end", "def create\n params.permit(:pseudo_administrateur, :email_administrateur, :motDePasse_administrateur)\n ajout = AdministrateurService.instance.creerNouveauAdmin(params[:pseudo_administrateur], params[:email_administrateur], params[:motDePasse_administrateur])\n (ajout != nil) ? (render json: ajout, status: :ok) : (render json: nil, status: :not_found)\n end", "def index\n @posts = Post.all\n @vote = Vote.new\n respond_to do |format|\n format.json{render json:@posts}\n format.html\n end\n\n end", "def index\n @posts = Post.all\n \n render json: @posts\n end", "def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end", "def sondagesParAdmin\n sondages = SondageService.instance.listeDesSondagesParAdmin(params[:id])\n render json: sondages, status: :ok\n end", "def post_and_run(options)\n options[:eval_response] = true\n\n self.post options\n end", "def submit\n\t\tset_post_data\n get_response @url\n parse_response\n\tend", "def ajax_load_node_edit_info\n\n # Get the Node from the DB\n node = Node.find(params[:node_id])\n\n data = {\n :node_id => node.id,\n :node_name => node.name,\n :node_email_template_name => node.email_template_id,\n :node_delay_time => node.delay_time,\n :node_delay_unit => node.delay_unit,\n }\n\n # Return data as JSON\n render json: data\n\n end", "def post_json(path, body)\n uri = build_uri(path)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n result = JSON.parse(response.body)\n puts result\n result\nend", "def create\n @post = Post.create(post_params)\n set_posts\n respond_to do |format|\n format.js\n format.html\n end\n end", "def post()\n return @http.request(@req)\n end", "def post_api(path, params={}, headers={})\n headers.merge!('CONTENT_TYPE' => \"application/json\")\n post path, params, headers\nend", "def reply(data)\n res.json(Satz.serializer.dump(data))\n end", "def post(request)\n _request(request) { |client, options| client.post options }\n end", "def ajax_new_broadcast\n\n # Create new Batch Email\n batch = BatchEmailJob.create(app_id: params[:app_id],\n email_template_id: params[:email_template_id],\n name: params[:name],\n description: params[:description])\n puts \"========\"\n puts batch.id\n puts \"========\"\n\n # batch = BatchEmailJob.new\n #\n # # Update the Attributes for the Batch Email Job\n # batch.app_id = params[:app_id]\n # batch.email_template_id = params[:email_template_id]\n # batch.name = params[:name]\n # batch.description = params[:description]\n #\n # # Save Broadcast\n # batch.save\n\n # Create new Broadcast List Instance\n params[:email_list_id].each do |listid|\n # list = BroadcastList.new\n\n BroadcastList.create(app_id: params[:app_id],\n batch_email_job_id: batch.id,\n email_list_id: listid\n )\n\n # # Update with attributes\n # list.app_id = params[:app_id]\n # list.batch_email_job_id = batch.id\n # list.email_list_id = listid\n #\n # # Save Broadcast List\n # list.save\n end\n\n\n response = {\n success: true,\n message: 'Broadcast Created',\n broadcast_id: batch.id\n }\n\n render json: response\n\n end", "def post(path, form_data=nil)\n parse_json do |parser|\n @http_client.post(path, form_data) {|chunk| parser << chunk }\n end\n end", "def post(action, params={}, options={})\n request(:post, action, params, options)\n end", "def post(id, opts = {})\r\n uri = url_for(\"posts/#{id}\", opts)\r\n response = RestClient.get(uri)\r\n JSON.parse response\r\n end", "def post_rest_api(endpoint, data, http)\n rest_api_endpoint = \"/classifier-api/v1/#{endpoint}\"\n\n # Create an HTTP POST request against the specified REST API endpoint\n request = Net::HTTP::Post.new(rest_api_endpoint)\n # Set the Content-Type and data of the HTTP POST request\n request.content_type = \"application/json\"\n request.body = data\n # Submit the request\n response = http.request(request)\n # Return the response bosy (JSON containing the result of the POST operation)\n response.body\nend", "def postEntityBulkJson( data)\n params = Hash.new\n params['data'] = data\n return doCurl(\"post\",\"/entity/bulk/json\",params)\n end", "def index\n render json: @fiestas\n end", "def create\n if request.format.js?\n @schicht = Schicht.new(schicht_params)\n # Transform date to utc (compatibility with offline version)\n @schicht.datum = DateTime.new(@schicht.datum.year, @schicht.datum.month, @schicht.datum.day)\n @schicht.benutzer = current_user\n @schicht.objekt = current_objekt\n @schicht.wachbuch_eintrag = WachbuchEintrag.create\n @schicht.save\n else\n doc = Nokogiri::XML(request.body.read)\n sNode = doc.xpath('elwak/schicht')[0]\n @schicht = parseSchicht(sNode)\n end\n respond_to do |format|\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><success />'}\n format.js {render action: 'save_success'}\n end\n end", "def index\n @orders = Order.all\n render json: { status: 'SUCCESS', message: 'Loaded posts', data: @orders }\n end", "def ajax_fines\n @fines = params['fines']&.values.to_a\n render json: { record: render_to_string('_fines', layout: false), locals: { fines: @fines } }\n end", "def post\n request_object.post_query\n end", "def index\n @admin_guests = Guest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_guests }\n end\n end", "def sharerequests\n @group = Group.find(session[:group_id])\n @membership = Membership.find_by(user_id: session[:user_id], group_id: session[:group_id])\n @requests = Request.where(item_id: Item.where(owner_id: @membership)).order('requesting_at DESC')\n authorize @requests, :index?\n respond_to do |format|\n format.js\n format.html\n end\n end", "def ajax_save_node\n\n # Get the Node from the DB\n node = Node.find(params[:node_id])\n\n # Update the Node\n node.top = params[:top]\n node.left = params[:left]\n\n # Save and verify Node and return correct JSON response\n if node.save!\n final_json = JSON.pretty_generate(result = {\n :success => true,\n :id => node.id\n })\n else\n final_json = JSON.pretty_generate(result = {\n :success => false\n })\n end\n\n # Return JSON response\n render json: final_json\n\n end", "def http_post(url, data)\n\turi = URI(url)\n\treq = Net::HTTP::Post.new(uri.path, initheader = {'Content-Type' =>'application/json'})\n req.body = data.to_json\n response = Net::HTTP.new(uri.host, uri.port).start {|http| http.request(req) }\n return response\nend", "def post\n frm.button(:name=>\"post\").click\n AssignmentsList.new(@browser)\n end", "def create\n @respuesta = Respuesta.new(params[:respuesta])\n\n if @respuesta.save\n render json: @respuesta, status: :created, location: @respuesta\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end", "def post_request(object)\n end", "def index\n @heroes = Hero.all\n\n render json: @heroes\n end", "def index\n #Does nothing really... (Except create log)\n\n render json: \"success\"\n end" ]
[ "0.58743423", "0.5765101", "0.5680591", "0.56796104", "0.5574302", "0.5567166", "0.5554237", "0.55435354", "0.55262554", "0.54625326", "0.54467887", "0.5423682", "0.5418343", "0.5415121", "0.5409295", "0.54090935", "0.5404913", "0.5400739", "0.5399805", "0.53854465", "0.53492767", "0.5343447", "0.5322799", "0.52762467", "0.5239592", "0.5228404", "0.52258605", "0.5191669", "0.5179788", "0.5179098", "0.5174734", "0.51625", "0.5162429", "0.5133856", "0.50984377", "0.5081068", "0.50788206", "0.505745", "0.50543", "0.5047669", "0.5043669", "0.50400347", "0.5038417", "0.5031164", "0.50301427", "0.5026629", "0.50209", "0.50209", "0.501976", "0.5019684", "0.5011602", "0.501109", "0.501109", "0.5010343", "0.5000141", "0.49829784", "0.49799928", "0.49793178", "0.49782088", "0.49763864", "0.49729195", "0.49658924", "0.49553674", "0.49506", "0.49490914", "0.49461514", "0.4938497", "0.49297684", "0.49287322", "0.4926397", "0.49263543", "0.49262336", "0.49107286", "0.49088988", "0.49087757", "0.49058256", "0.49054256", "0.4903306", "0.48966303", "0.48951128", "0.48950037", "0.48930272", "0.48839435", "0.48827785", "0.487216", "0.48712543", "0.48688483", "0.48635826", "0.4859448", "0.48550203", "0.4853848", "0.48460877", "0.48436347", "0.48435336", "0.48413327", "0.4841149", "0.48409644", "0.4836004", "0.483108", "0.48302287" ]
0.5573877
5
PATCH/PUT /ajaxes/1 PATCH/PUT /ajaxes/1.json
def update respond_to do |format| if @ajax.update(ajax_params) format.html { redirect_to @ajax, notice: 'Ajax was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @ajax.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch!\n request! :patch\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 api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def ajax_update\n params[:contact][:contact_type_ids] ||= []\n \n respond_to do |format|\n if @contact.update(contact_params)\n format.html { render action: 'ajax_show', :layout => nil, :id => @contact.id }\n format.json { head :no_content }\n else\n format.html { render action: 'ajax_edit' }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\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 patch options\n rest_request({ method: :patch }.merge(options))\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def put!\n request! :put\n end", "def update\n #formats as js since it's getting parsed on the front end\n respond_to do |format|\n format.js\n end\n end", "def update\n respond_to do |format|\n format.xml { head :method_not_allowed }\n format.json { head :method_not_allowed }\n end\n end", "def update\n @api_javascript = Api::Javascript.find(params[:id])\n\n respond_to do |format|\n if @api_javascript.update_attributes(params[:api_javascript])\n format.html { redirect_to @api_javascript, notice: 'Javascript was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_javascript.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def patch(path, params = {})\n request(:patch, path, params)\n end", "def patch(path, params = {})\n request(:patch, path, params)\n end", "def patch(path, data, params = {}, request_options = {})\n request(:patch, path, data, params)\n end", "def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_with []\n end", "def update\n respond_to do |format|\n format.js {update_js}\n end\n end", "def update\n render json: Post.update(params[\"id\"], params[\"post\"])\n end", "def patch(path, opts = {})\n request(:patch, path, opts).body\n end", "def ajax_save_edit_node\n\n # Get the Node from the DB\n node = Node.find(params[:id])\n\n node.name = params[:name]\n node.email_template_id = params[:email_template_id]\n node.delay_unit = params[:delay_unit]\n node.delay_time = params[:delay_time]\n\n # Save and verify Node and return correct JSON response\n node.put('', {\n :name => node.name,\n :email_template_id => node.email_template_id,\n :delay_unit => node.delay_unit,\n :delay_time => node.delay_time,\n })\n\n # Return Success Response\n response = {\n success: true,\n message: 'Node Updated!'\n }\n render json: response\n\n\n\n end", "def update(request)\n end", "def update(request)\n end", "def partial_update(klass, id, patchset, options = {}, format = nil)\n headers = {}\n headers[:accept] = \"#{format}\" if format\n format ||= @default_format\n options = { resource: klass, id: id, format: format}.merge options\n if [FHIR::Formats::ResourceFormat::RESOURCE_XML, FHIR::Formats::ResourceFormat::RESOURCE_XML_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_XML\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_XML}\"\n elsif [FHIR::Formats::ResourceFormat::RESOURCE_JSON, FHIR::Formats::ResourceFormat::RESOURCE_JSON_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_JSON\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_JSON}\"\n end\n headers[:prefer] = @return_preference if @use_return_preference\n reply = patch resource_url(options), patchset, fhir_headers(headers)\n reply.resource = parse_reply(klass, format, reply)\n reply.resource_class = klass\n reply\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update(model, id, opts = {})\n name = model_name(model)\n do_restful_action(\"update\", name) do\n self.nagyo[\"#{name}/#{URI.encode(id)}/edit\"].put(:format => :js, name => opts)\n end\n end", "def update\n respond_to do |format|\n if @rest_api.update(rest_api_params)\n format.html { redirect_to @rest_api, notice: 'Rest api was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rest_api.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end", "def update_api\n \t@task = Task.find(params[:id])\n \tcurrent_user\n \t@favorite = Favorite.find(@task.favorite_id)\n\n respond_to do |format|\n format.js { render 'demo/update_api' }\n end\n end", "def patch(request)\n request.method = :patch\n request.call\n end", "def patch(payload)\n post_like payload, Net::HTTP::Patch.new(@uri.path)\n end", "def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update\n fn = params[:id].gsub('DOTDOT','.').gsub('SLASHSLASH','/')\n File.open(fn,'w+') { |f| \n f.puts params[:content]\n }\n respond_to do |format|\n format.json { render json: { success: true} }\n end\n end", "def ajax_update_funnel_info\n\n # Get the Funnel by ID\n funnel = Funnel.find(params[:funnel_id])\n\n # If no funnel found\n if !funnel\n # Return Error Response\n response = {\n success: false,\n message: 'Funnel Not Found!'\n }\n\n render json: response\n end\n\n # If Trigger ID is 0\n if params[:funnel_trigger_id] == '0'\n # Return Error Response\n response = {\n success: false,\n message: 'Funnel must have a trigger!'\n }\n\n render json: response\n end\n\n # If Email List ID is zero, create new email list\n if params[:funnel_email_list_id] == '0'\n email_list = EmailList.new\n email_list.name = params[:funnel_name] + \"Email List\"\n email_list.description = \"Email list for \" + params[:funnel_name]\n email_list.app_id = params[:app_id]\n email_list.save!\n\n email_list_id = email_list.id\n else\n email_list_id = params[:funnel_email_list_id]\n end\n\n # Update the Funnel Info\n funnel.put('', {\n name: params[:funnel_name],\n description: params[:funnel_description],\n email_list_id: email_list_id,\n trigger_id: params[:funnel_trigger_id]\n })\n\n\n # Return Success Response\n response = {\n success: true,\n message: 'Funnel Updated!'\n }\n render json: response\n\n\n end", "def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\n end", "def activo_update\n respond_to do |format|\n activo = params[:laboratorio][:activo]\n id = params[:id]\n Laboratorio.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end", "def patch(path, **args); end", "def update\n head :forbidden\n\n #@action = Action.find(params[:id])\n\n #if @action.update_attributes(params[:action])\n # head :no_content\n # else\n # render json: @action.errors, status: :unprocessable_entity\n # end\n end", "def update\n respond_to do |format|\n \n end\n end", "def patch(url, data, headers = {})\n request(:patch, url, headers, :data => data)\n end", "def patch\n req.patch?\n end", "def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @clients = get_clients\n @client = Client.find(params[:id])\n\n respond_to do |format|\n if @client.update_attributes(params[:client])\n @clients = get_clients\n #format.html { redirect_to @client, notice: 'Client was successfully updated.' }\n format.json { head :no_content }\n format.js\n else\n #format.html { render action: \"index\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end", "def update\n @request = Request.find(params[:id])\n\n if @request.update(params[:request])\n head :no_content\n else\n render json: @request.errors, status: :unprocessable_entity\n end\n end", "def execute_update_api\n\t\t@task = Task.find(params[:id])\n\t\t@demo = Demo.find(@task.demo_id)\n\t\tif params[:all]\n\t \[email protected] do |task|\n\t\t\t\ttask.update_attribute(:cloud_id, params[:id_selected].to_i) if(params[:type] == \"Cloud API\" && params[:id_selected] != \"\")\n\t\t\t\ttask.update_attribute(:platform_id, params[:id_selected].to_i) if(params[:type] == \"Platform Management\" && params[:id_selected] != \"\")\n\t\t\tend\n\t\telse\n\t\t\[email protected]_attribute(:cloud_id, params[:id_selected].to_i) if(params[:type] == \"Cloud API\" && params[:id_selected] != \"\")\n\t\t\[email protected]_attribute(:platform_id, params[:id_selected].to_i) if(params[:type] == \"Platform Management\" && params[:id_selected] != \"\")\n\t\tend\n\n respond_to do |format|\n format.js { render 'demo/execute_update_api' }\n end\n end", "def update\n respond_to do |format|\n if @task.update_attributes(task_param)\n format.json { head :no_content }\n format.js { render }\n else\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n# respond_to do |format|\n# if @req.update(req_params)\n format.json { render :json => {:status => 'success'}}\n# format.html { redirect_to @req, notice: 'Req was successfully updated.' }\n# format.json { render :show, status: :ok, location: @req }\n# else\n format.json { render :json => {:status => 'failed'}}\n# format.html { render :edit }\n# format.json { render json: @req.errors, status: :unprocessable_entity }\n# end\n# end\n end", "def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end", "def update\n respond_to do |format|\n if @feature.update_attributes(params[:feature])\n flash[:notice] = 'Feature was successfully updated.'\n @changed << @feature.id\n\n format.html { redirect_to features_path }\n format.js { render 'shared/index'; flash.discard }\n format.json { head :no_content }\n else\n @edited << @feature.id\n @expanded << @feature.id\n\n format.html { render action: 'edit', template: 'shared/edit' }\n format.js { render 'feature' }\n format.json { render json: @feature.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @service.update(service_params) \n format.js { }\n else\n format.html { render :edit }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n if request.xhr?\n @resource = Resource.find(params[:id])\n add_dependent_entities\n render partial: 'edit_form', locals: { action: :edit }\n else\n render status: 406, plain: 'Not Acceptable'\n end\n end", "def update\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 { head :no_content }\n # else\n # format.html { render action: 'edit' }\n # format.json { render json: @request.errors, status: :unprocessable_entity }\n # end\n #end\n end", "def update\n if :opr == 'edit'\n update\n else\n @team = Team.find_by_id(params[:id])\n @team.update_attributes({:id => params[:id], :name => params[:name], :status => params[:status]})\n\n if request.xhr?\n render :json => @team\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 @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n if @servicio.update_attributes(params[:servicio])\n format.html { redirect_to @servicio, :notice => 'Servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @servicio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_by_ajax\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n cat_h = {:desktop => User::AUTH_DESKTOP, :user => User::AUTH_USER, :log => User::AUTH_LOG}\n\n yaml = ApplicationHelper.get_config_yaml\n\n cat_h.keys.each do |cat|\n\n next if params[cat].blank?\n\n unless @login_user.admin?(cat_h[cat])\n render(:text => t('msg.need_to_be_admin'))\n return\n end\n\n yaml[cat] ||= {}\n\n params[cat].each do |key, val|\n yaml[cat][key] = val\n end\n end\n\n ApplicationHelper.save_config_yaml(yaml)\n\n render(:text => '')\n end", "def update(id)\n provides :js, :json\n @edit = Version.first(id) || raise(NotFound)\n if @edit.update_attributes(:moderated => true)\n train_spam_engine(@edit)\n if request.xhr?\n render '', :status => 200 # renders nothing\n else\n redirect url(:edits)\n end\n else\n raise BadRequest\n end\n end", "def update\n client_id = params[:contact].delete(:client_id)\n @contact = Contact.find(params[:id])\n @contact.client = Client.find(client_id.to_i)\n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.js\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.js { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, to: nil, as: nil, **constraints, &blk)\n add_route(::Rack::PATCH, path, to, as, constraints, &blk)\n end", "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n get_tasks\n format.js\n format.html { redirect_to(@task, :notice => 'Task was successfully updated.') }\n format.xml { head :ok }\n else\n format.js\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end", "def update\n @feature = Feature.find(params[:id])\n if params[:vehicle_id]\n @method = Vehicle.find(params[:vehicle_id]).toggle_feature(@feature)\n end\n\n respond_to do |format|\n if @feature.update_attributes(feature_params)\n format.json { head :no_content }\n format.js\n else\n format.html { render action: \"edit\" }\n format.json { render json: @feature.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(*args)\n request :put, *args\n end", "def update\n @content_partial = ContentPartial.find(params[:id])\n\n respond_to do |format|\n if @content_partial.update_attributes(params[:content_partial])\n format.html { redirect_to @content_partial, notice: 'Content partial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @content_partial.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", {\"passed\" => success}.to_json, :content_type => :json\nend", "def patch(action, **args); end", "def update\n respond_to do |format|\n if @jquery_test.update(jquery_test_params)\n format.html { redirect_to @jquery_test, notice: 'Jquery test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @jquery_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @text.update_attributes(params[:text]) && @resource.update_attributes(params[:resource])\n format.js\n end\n end\n end", "def patch?\r\nHTTP_METHOD_LOOKUP[request_method] == :patch\r\nend", "def update\n respond_to do |format|\n if @prueba_json.update(prueba_json_params)\n format.html { redirect_to @prueba_json, notice: 'Prueba json was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @prueba_json.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bla = Bla.find(params[:id])\n\n respond_to do |format|\n if @bla.update_attributes(params[:bla])\n format.html { redirect_to @bla, :notice => 'Bla was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bla.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { render :show, status: :ok, location: @patch }\n else\n format.html { render :edit }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch\n end", "def activo_update\n respond_to do |format|\n activo = params[:producto][:activo]\n id = params[:id]\n Producto.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end", "def update_request?(http_method = nil)\n http_method = http_method.downcase.to_sym if http_method.is_a?(String)\n %i[put post patch].include?(http_method || @verb)\n end", "def update\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n format.html {\n if request.xhr?\n render :text => params[:resource].values.first\n else\n redirect_to(@resource, :notice => 'Resource was successfully updated.')\n end\n }\n format.xml { head :ok }\n else\n format.html {\n if request.xhr?\n render :text => @resource[params[:resource].keys.first]\n else\n render :action => \"edit\"\n end\n }\n format.xml { render :xml => @resource.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_multiple\r\n i = InvitationEngine.new(current_user, @resource, params)\r\n i.update_multiple\r\n flash.now[:notice] = \"#{view_helpers.pluralize(i.records_count, 'invitation')} was updated.\"\r\n \r\n load_objects\r\n respond_to do |format|\r\n format.js do\r\n render :update do |page|\r\n page.reload_flashes!\r\n page.replace_html 'users_and_guests', :partial => 'users_and_guests'\r\n page.replace_html 'invitations_buttons', :partial => 'invitations/buttons'\r\n end\r\n end\r\n end\r\n end", "def rest_patch(base_uri,json_payload,params)\n begin\n @response = RestClient.patch(base_uri,json_payload,params)\n rescue => e\n puts @response.code\n end\n return @response\n end", "def update_rest\n @entry_answer = EntryAnswer.find(params[:id])\n\n respond_to do |format|\n if @entry_answer.update_attributes(params[:entry_answer])\n flash[:notice] = 'EntryAnswer was successfully updated.'\n format.html { redirect_to(@entry_answer) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_answer.errors, :status => :unprocessable_entity }\n end\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 update\n respond_to do |format|\n format.json { render json: { status: :not_implemented } }\n end\n end", "def update\n @request = Request.find(params[:id])\n\n respond_to do |format|\n if @request.update_attributes(params[:request])\n format.html { redirect_to @request, :notice => 'Request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @request.errors, :status => :unprocessable_entity }\n end\n end\n end", "def http_method_modifies_resource?\n ['PUT','POST','PATCH'].include?(method.to_s.upcase)\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 edit\n @page_title = \"Edit Recipe Ingredient\"\n @recipe_ingredient = current_recipe.recipe_ingredients.find(params[:id])\n @btnText = \"Update Ingredient\"\n @obj = @recipe_ingredient\n respond_to do |f|\n f.html {render 'shared/form'}\n f.js\n end\n end", "def update\n respond_to do |format|\n if @rest.update(rest_params)\n format.html { redirect_to @rest, notice: 'Rest was successfully updated.' }\n format.json { render :show, status: :ok, location: @rest }\n else\n format.html { render :edit }\n format.json { render json: @rest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render status: 501, json: { errors: ['Action not implemented yet!'] }\n end", "def update\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n if @cliente.update_attributes(params[:cliente])\n flash[:notice] = t('general.messages.update_success', model_name: t('activerecord.models.cliente'))\n format.html { redirect_to edit_cliente_path(@cliente) }\n format.json { head :no_content }\n format.js { render action: 'save.js.erb' }\n else\n flash.now[:error] = t('general.messages.update_error', model_name: t('activerecord.models.cliente'))\n format.html { render action: \"edit\" }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n format.js { render action: 'save.js.erb' }\n end\n end\n end", "def update\n respond_to do |format|\n if @fonction.update(fonction_params)\n @fonctions = Fonction.all\n format.html { redirect_to @fonction, notice: 'Fonction was successfully updated.' }\n format.json { render :show, status: :ok, location: @fonction }\n format.js\n else\n format.html { render :edit }\n format.json { render json: @fonction.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def update(data, &block)\n request :patch, @data[:id], data, &block\n end" ]
[ "0.6707051", "0.66654325", "0.6388448", "0.62132215", "0.61397624", "0.61332035", "0.61332035", "0.6101988", "0.6101988", "0.6051678", "0.6050862", "0.60144687", "0.60122615", "0.5931832", "0.589355", "0.58600754", "0.58600754", "0.5836773", "0.5833708", "0.57784426", "0.5775043", "0.5756363", "0.5749977", "0.57495946", "0.57403666", "0.57387275", "0.57387275", "0.5737998", "0.57345235", "0.57236946", "0.57092935", "0.57044977", "0.5702235", "0.5682168", "0.56615126", "0.5640486", "0.563491", "0.5632169", "0.5625944", "0.5620985", "0.5617609", "0.56173587", "0.5600146", "0.5600102", "0.5599666", "0.55887127", "0.55886734", "0.55886734", "0.55862015", "0.55839723", "0.5579693", "0.5575751", "0.55753577", "0.5566701", "0.55597794", "0.5559634", "0.55408883", "0.5538831", "0.5528557", "0.5526376", "0.55262965", "0.55173403", "0.5516604", "0.55158794", "0.5511575", "0.5510446", "0.5507295", "0.5506226", "0.5506182", "0.55045086", "0.5502608", "0.55009484", "0.5492605", "0.549137", "0.5489234", "0.5486857", "0.5481498", "0.54814816", "0.5474377", "0.5472141", "0.5469958", "0.5469449", "0.54672176", "0.5465334", "0.5464673", "0.5463975", "0.5462715", "0.5460792", "0.54553187", "0.54439545", "0.54432476", "0.5443143", "0.5443143", "0.5443143", "0.5442395", "0.54346615", "0.5433966", "0.5430574", "0.5430293", "0.54264563" ]
0.65871906
2
DELETE /ajaxes/1 DELETE /ajaxes/1.json
def destroy @ajax.destroy respond_to do |format| format.html { redirect_to ajaxes_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def delete\n render json: Post.delete(params[\"id\"])\n end", "def delete!\n request! :delete\n end", "def delete\n request(:delete)\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def delete\n supprimer = SondageService.instance.supprimerSondage(params[:id])\n (supprimer) ? (render json: true, status: :ok) : (render json: false, status: :not_found)\nend", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end", "def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end", "def delete endpoint\n do_request :delete, endpoint\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def delete\n supprimer = QuestionOuverteService.instance.supprimerQuestion(params[:id])\n (supprimer) ? (render json: true, status: :ok) : (render json: false, status: :not_found)\n end", "def delete!( opts = {} )\n http_action :delete, nil, opts\n end", "def delete(path)\n request 'DELETE', path\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def delete\n supprimer = AdministrateurService.instance.supprimerAdmin(params[:id])\n (supprimer) ? (render json: true, status: :ok) : (render json: false, status: :not_found)\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin.destroy!\n \n respond_to do |format|\n format.json { respond_to_destroy(:ajax) }\n format.xml { head :ok }\n format.html { respond_to_destroy(:html) } \n end\n \n rescue ActiveRecord::RecordNotFound\n respond_to_not_found(:json, :xml, :html)\n end", "def delete(*args)\n request(:delete, *args)\n end", "def delete\n api_client.delete(url)\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def delete_document index, id\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}\")\n req = Net::HTTP::Delete.new(uri)\n run(uri, req)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def destroy\n @mensagem = Mensagem.find(params[:id])\n api_client.delete_object(@mensagem.post_id)\n @mensagem.destroy\n\n respond_to do |format|\n format.xml { head :ok }\n format.js { head :ok }\n end\n end", "def destroy\n render_json_auto @survey.delete_filter(params[:id].to_i) and return\n end", "def delete(path)\n request(:delete, path)\n end", "def destroy\n ImagesIndex.delete params[:id]\n respond_to do |format|\n format.html { redirect_to(\"/images_indices\") }\n format.xml { head :ok }\n end\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end", "def delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "def delete(path)\n\t\trequest(path, :delete)\n\tend", "def delete\n render json: Users.delete(params[\"id\"])\n end", "def delete\n delete_from_server single_url\n end", "def destroy\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @api_post.destroy\n\n head :no_content\n end", "def delete(*args)\n Request.delete(*args)\n end", "def destroy\n @fixture = Fixture.find(params[:id])\n @fixture.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n resource.destroy\n render json: {success: true}, status: :ok\n end", "def destroy\n resource.destroy\n render json: {success: true}, status: :ok\n end", "def destroy\n @srsaa = Srsaa.find(params[:id])\n @srsaa.destroy\n\n respond_to do |format|\n format.html { redirect_to srsaas_url }\n format.json { head :no_content }\n format.js\n end\n end", "def destroy\n @verb.destroy\n\n head :no_content\n end", "def delete(url)\n do_request(\"delete\", url)\n end", "def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @suscript = Suscript.find(params[:id])\n @suscript.destroy\n\n respond_to do |format|\n format.html { redirect_to suscripts_url }\n format.json { head :no_content }\n end\n \n end", "def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end", "def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n head :no_content\n end", "def delete\n Iterable.request(conf, base_path).delete\n end", "def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicitudes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @one = One.find(params[:id])\n @one.destroy\n\n respond_to do |format|\n format.html { redirect_to ones_url }\n format.json { head :no_content }\n end\n end", "def delete\n api(\"Delete\")\n end", "def destroy\n @six.destroy\n respond_to do |format|\n format.html { redirect_to sixes_url }\n format.json { head :no_content }\n end\n end", "def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end", "def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end", "def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end", "def destroy\n @api_javascript = Api::Javascript.find(params[:id])\n @api_javascript.destroy\n\n respond_to do |format|\n format.html { redirect_to api_javascripts_url }\n format.json { head :no_content }\n end\n end", "def delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end", "def destroy\n @mapping_data_obat = MappingDataObat.find(params[:id])\n\n @id = params[:id]\n\n respond_to do |format|\n if request.xhr?\n format.js do\n render :update do |page|\n page[\"list#{params[:id]}\"].fade()\n end\n end\n else\n if @mapping_data_obat.destroy\n format.html { redirect_to(mapping_data_obats_url) }\n else\n format.html { redirect_to(:action => \"edit\", :id => @id, :error => DELETE_CASCADE_ERROR_MSG) }\n end\n\n #format.xml { head :ok }\n end\n end\n end", "def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n head :no_content\n end", "def destroy\n @urij.destroy\n respond_to do |format|\n format.html { redirect_to urijs_url }\n format.json { head :no_content }\n end\n end", "def destroyViaAjax\n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n respond_to do |format|\n format.html { render :template => 'locations/index'}\n format.json { head :no_content }\n end\n end", "def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @verb.destroy\n respond_to do |format|\n format.html { redirect_to verbs_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: User.delete(params[\"id\"])\n end", "def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n respond_to do |format|\n format.html { redirect_to respuestas_url }\n format.json { head :no_content }\n end\n end", "def delete(path)\n request(:delete, path)\n end", "def http_delete(path, data = nil, content_type = 'application/json')\n http_methods(path, :delete, data, content_type)\n end", "def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_index_path }\n format.json { head :no_content }\n end\n end", "def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end", "def delete\n super \"/templates/#{template_id}.json\", {}\n end", "def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :ok }\n end\n end", "def delete(url)\n call(url: url, action: :delete)\n end", "def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to admin_requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @htc.destroy\n respond_to do |format|\n format.html { redirect_to htcs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_post_vote = PostVote.find(params[:id])\n @api_v1_post_vote.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v1_post_votes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @obat = Obat.find(params[:id])\n @obat.destroy\n @id = params[:id]\n\n\n respond_to do |format|\n if request.xhr?\n format.js do\n render :update do |page|\n page[\"list#{params[:id]}\"].fade()\n end\n end\n else\n if @obat.destroy\n format.html { redirect_to(:action => 'index', :id => \"new\", :notice => DELETE_MSG) }\n else\n format.html { redirect_to(:action => \"edit\", :id => @id, :error => DELETE_CASCADE_ERROR_MSG) }\n end\n\n #format.xml { head :ok }\n end\n #format.html { redirect_to(obats_url) }\n #format.xml { head :ok }\n end\n end", "def destroy\n @escola = Escola.find(params[:id])\n @escola.destroy\n\n respond_to do |format|\n format.html { redirect_to escolas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @request_datum.destroy\n respond_to do |format|\n format.html { redirect_to request_data_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7015308", "0.6910816", "0.686385", "0.6863849", "0.6848045", "0.6825333", "0.6776032", "0.6770547", "0.6770547", "0.6770547", "0.6770547", "0.67358655", "0.67358655", "0.67151934", "0.66826683", "0.66701657", "0.6666092", "0.6639765", "0.6622433", "0.66132575", "0.65961075", "0.6571696", "0.6560695", "0.6555575", "0.6555575", "0.6553876", "0.6543196", "0.65370846", "0.6523884", "0.6522931", "0.6514245", "0.6514245", "0.6512138", "0.65089846", "0.6499884", "0.6493181", "0.6478206", "0.64746493", "0.6470536", "0.64681625", "0.64678496", "0.646505", "0.64625984", "0.6460784", "0.6460784", "0.6460784", "0.6458787", "0.64552927", "0.6448289", "0.6446798", "0.64393544", "0.64393544", "0.643791", "0.64364225", "0.6428547", "0.642826", "0.642826", "0.642826", "0.642826", "0.642826", "0.642826", "0.6427167", "0.64242375", "0.64235604", "0.64235014", "0.6422045", "0.6411794", "0.64059055", "0.6405116", "0.64010173", "0.6399469", "0.63983804", "0.639729", "0.6396685", "0.6392124", "0.6387773", "0.6386132", "0.6378932", "0.63723934", "0.63672745", "0.6365211", "0.6365211", "0.6365211", "0.63605213", "0.63590306", "0.63561517", "0.634955", "0.6347263", "0.6346491", "0.63387793", "0.63373584", "0.63360417", "0.63346523", "0.63343376", "0.63339883", "0.63312477", "0.6329526", "0.6327539", "0.6327344", "0.6323956" ]
0.7324153
0
Use callbacks to share common setup or constraints between actions.
def set_ajax @ajax = Ajax.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_handler\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def 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 action; end", "def action; end", "def action; end", "def action; end", "def action; 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 before_dispatch(env); end", "def process_action(...)\n send_action(...)\n 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 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 setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def action\n end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def config(action, *args); 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 before_action \n end", "def action\n end", "def setup\n # override this if needed\n end", "def matt_custom_action_begin(label); 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 setup_signals; 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 after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def initialize(*args)\n super\n @action = :set\nend", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def lookup_action; end", "def around_hooks; end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def save_action; end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def action_target()\n \n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def setup(&blk)\n @setup_block = blk\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def callback_phase\n super\n end", "def advice\n end", "def call\n setup_context\n super\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 duas1(action)\n action.call\n action.call\nend" ]
[ "0.6162554", "0.60452986", "0.5945278", "0.59169763", "0.58877826", "0.5834763", "0.5775349", "0.5704972", "0.5704972", "0.56543803", "0.5621491", "0.5427202", "0.54093206", "0.54093206", "0.54093206", "0.53975695", "0.53776276", "0.53562194", "0.5340594", "0.5337824", "0.5328757", "0.5310255", "0.5300339", "0.5298796", "0.5295774", "0.5256034", "0.5243039", "0.5236007", "0.5235239", "0.5235239", "0.5235239", "0.5235239", "0.5235239", "0.52321917", "0.5227032", "0.52216744", "0.5216349", "0.52161187", "0.5210265", "0.5207244", "0.5177388", "0.5177142", "0.51747334", "0.516293", "0.51629275", "0.5155534", "0.51540613", "0.515197", "0.5151636", "0.5145279", "0.51380795", "0.5135777", "0.5117378", "0.5115066", "0.5115066", "0.5110235", "0.5106418", "0.50917816", "0.50909185", "0.50855017", "0.5082105", "0.506359", "0.5055345", "0.50546116", "0.50523037", "0.50523037", "0.50327307", "0.5024364", "0.5021113", "0.50174654", "0.50163317", "0.5000553", "0.50002855", "0.49991882", "0.49905527", "0.49905527", "0.49849054", "0.4982546", "0.4980941", "0.4979153", "0.49693102", "0.4967172", "0.49594432", "0.49564302", "0.49552485", "0.49533385", "0.49506924", "0.49452737", "0.49442786", "0.49347955", "0.49341312", "0.49295264", "0.49261844", "0.4925649", "0.49251428", "0.4920729", "0.49177617", "0.4916373", "0.49158472", "0.4915794", "0.49156648" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def ajax_params # params[:ajax] params.require(:ajax).permit(topic_attributes:[:name,: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 valid_params_request?; 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 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 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 valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\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 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 valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\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 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 url_params\n params[:url].permit(:full)\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 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.69795185", "0.6782116", "0.6745877", "0.6742722", "0.67368543", "0.65932566", "0.65048057", "0.6497429", "0.6481512", "0.6478456", "0.6455591", "0.64391", "0.6379068", "0.6376498", "0.636542", "0.632084", "0.630046", "0.62998945", "0.62943697", "0.6293775", "0.629097", "0.62902015", "0.62826055", "0.6241474", "0.6239528", "0.62192595", "0.6213959", "0.6209968", "0.6195236", "0.6178428", "0.6174288", "0.61730385", "0.6162674", "0.615271", "0.6151781", "0.61483663", "0.6122072", "0.6118153", "0.61082", "0.61056745", "0.6092642", "0.60814065", "0.60712725", "0.6063699", "0.60218817", "0.60172415", "0.6014784", "0.60113716", "0.6007368", "0.6007368", "0.60013884", "0.6000211", "0.5997662", "0.5992346", "0.59923387", "0.59920985", "0.5979802", "0.5966599", "0.59599686", "0.5958859", "0.5958176", "0.59577733", "0.5953665", "0.59535724", "0.5944413", "0.5939227", "0.59389156", "0.59389156", "0.59350467", "0.5930765", "0.5926072", "0.5925355", "0.59176385", "0.5910344", "0.59092146", "0.5908764", "0.5904986", "0.5897739", "0.58974844", "0.58968824", "0.5894499", "0.5894097", "0.58928955", "0.58877337", "0.588388", "0.5880237", "0.5873962", "0.5869052", "0.58690286", "0.58670396", "0.5866859", "0.5866724", "0.58638793", "0.58630764", "0.5862874", "0.58606905", "0.58596873", "0.5854749", "0.58539575", "0.58516955", "0.5849963" ]
0.0
-1
map will change the return type according to the operation and each won't functions or methods
def cheap_discounts # puts 'kanjus makkhi chus dont come again' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def map; end", "def map\n raise NotImplementedError\n end", "def map!\n end", "def map(*args, &blk) values.map(*args, &blk) ; end", "def fmap(*)\n raise NotImplementedError\n end", "def map\n end", "def map\n end", "def map(value, method)\n value.map do |item|\n @mapper.send(method, item)\n end\n end", "def map(*args)\n each {|x| x.map(*args)}\n end", "def map\n raise \"Do not call me when inspecting!\"\n end", "def my_map_p(proc)\n\t\tresults = []\n\t\tself.my_each do |item|\n\t\t\tresults << proc.call(item)\n\t\tend\n\t\tresults\n\tend", "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 map(source); end", "def map\n end", "def map(&block)\n to_a.map(&block)\n end", "def map(&block)\n to_a.map(&block)\n end", "def mapping; end", "def mapping; end", "def map!(&block)\n map(block)\n end", "def map\n\n end", "def map!(method=nil, *args, &block)\r\n self.replace(map(method, *args, &block))\r\n end", "def my_map(proc=nil)\n result = []\n self.to_a.my_each do |item|\n if proc\n result.push(proc.call item)\n elsif block_given?\n result.push(yield item)\n end\n end\n result\n end", "def my_map_mod(&proc)\n array = []\n self.my_each do |item|\n array << proc.call(item)\n end\n array\n end", "def my_map p=nil\n return self.to_enum(__method__) unless (block_given?||!p.nil?)\n out = [] # map always returns arrays\n self.my_each {|v| out << (p.nil? ? yield(v) : p.call(v))}\n out\n end", "def map(proc = nil, &block)\n func = (proc || block)\n return self.class.unit(func.call(@value))\n end", "def method_map(arr, meth,*args)\n arr.map {|e| e.send(meth,*args) }\n end", "def my_map (proc=nil)\n result = []\n my_each do |i|\n result << (proc ? proc.call(i) : yield(i))\n end\n result\n end", "def maps(x)\nend", "def map( &proc ) # this is a wrapper, which saves the given block\n\t\ttraverse( proc )\n\tend", "def map(&block)\n dup.map!(&block)\n end", "def map(list, &function)\n list.reduce([]) do |acc, val|\n acc.push function.call(val)\n end\nend", "def my_map code_proc=nil\n\t\tmapped = []\n\t\tif code_proc\n\t\t\tself.my_each do |x|\n\t\t\t\tmapped << code_proc.call(x)\t\n\t\t\tend\n\t\telse\n\t\t\tself.my_each do |x|\n\t\t\t\tmapped << yield(x)\t\n\t\t\tend\n\t\tend\n\t\treturn mapped\n\tend", "def map(func)\n\t\tif (!@head) then return end\n\t\tcurrent = @head\n\t\twhile (current)\n\t\t\tcurrent.alter(func)\n\t\t\tcurrent = current.get_next()\n\t\tend\n\tend", "def map(&block)\n append(Transform.new(&block))\n end", "def map(collection)\n result = []\n collection.each { |el| result << yield(el)}\n result\nend", "def map list, &block\n list.map(&block)\nend", "def map(*args, &blk)\n blk = blk ? blk : args.to_proc\n super(&blk)\n end", "def my_map(proc)\r\n \tarr = Array.new\r\n \tmy_each do |e|\r\n \t new_element = proc.call(e)\r\n \t new_element = yield new_element\r\n \t arr << new_element\r\n \tend\r\n \treturn arr\r\n end", "def map\n raise 'subclass must implement to return a value', NotImplementedError\n end", "def my_map2(proc = nil)\n\n result = []\n\n if !proc.nil? && block_given?\n for i in self\n result << proc.call(yield(i)); end\n return result; end\n\n return self.to_enum\n end", "def unop!(meth); map!{|i| meth.call(i)}; end", "def my_map(proc = nil)\n new_arr = []\n if proc\n self.my_each do |ele|\n new_arr << proc.call(ele)\n end\n elsif block_given?\n self.my_each do |ele|\n new_ele = yield ele\n new_arr << new_ele\n end\n else\n new_arr = self.to_enum\n end\n new_arr\n end", "def map\n C.curry.(\n ->(f, xs) {\n _f = ->(acc, x) {\n concat.(acc, [f.(x)])\n }\n\n C.fold.([], _f, xs)\n }\n )\n end", "def map\n r = self.dup\n begin\n r[0] = yield r[0]\n r[1] = yield r[1]\n rescue TypeError => e\n warn \"the block associated with #map returned nil; aborting map function\"\n puts e.backtrace\n end\n r\n end", "def my_map(&my_proc)\n mapped = [] # modified array\n self.my_each do |el|\n mapped << (my_proc != nil ? my_proc.call(el) : yield(el))\n end\n mapped\n end", "def my_map2(&proc)\n result = []\n if block_given?\n self.my_each do |i|\n result << proc.call(i)\n end\n return result\n else\n return self\n end\n end", "def my_map(proc = nil)\r\n\t\tresult = []\r\n\t\tif proc && block_given?\r\n\t\t\tself.my_each { |element| result << proc.call(yield(element)) }\r\n\t\telsif proc && !block_given?\r\n\t\t\tself.my_each { |element| result << proc.call(element) }\r\n\t\telsif proc.nil? && block_given?\r\n\t\t\tself.my_each { |element| result << yield(element) }\r\n\t else\r\n\t \tself\r\n\t\tend\r\n\t\tresult\r\n\tend", "def map(&blk)\n _values.map(&blk)\n end", "def map(input, property)\n flatten_if_necessary(input).map do |e|\n e = e.call if e.is_a?(Proc)\n\n if property == \"to_liquid\"\n e\n elsif property == \"to_f\"\n e.to_f\n elsif property == \"to_i\"\n e.to_i\n elsif e.respond_to?(:[])\n e[property]\n end\n end\n end", "def my_map(&proc)\n results = []\n my_each do |element|\n block_given? ? results << (proc.call(element)) : (return self.to_enum)\n end\n results\n end", "def map(&block)\n mapper.instance_eval(&block)\n end", "def map(&proc)\n Generator.new do |**kwargs|\n result = generate(**kwargs)\n result.map(&proc)\n end\n end", "def map &block\n self.class.from_a enumerable_map(&block)\n end", "def map(hash); end", "def my_map2(proc = nil)\n result = Array.new\n if proc.is_a?(Proc)\n self.my_each { |x| result << proc.call(x) }\n return result\n elsif block_given?\n self.my_each { |x| result << yield(x) }\n return result\n else\n return self\n end\n end", "def my_map3(proc=nil, &block)\n result = []\n for i in self\n result << block.call(proc.call(i)) if proc and block_given?\n result << proc.call(i) if !block_given?\n result << yield(i) if !proc and block_given?\n end\n return result\n end", "def map(*a)\n if a.empty?\n @all.map(&(Proc.new if block_given?))\n else\n super\n end\n end", "def result\n value.map do |v|\n calling_mapper.for(v).result\n end\n end", "def my_map(proc = nil, &block)\n\t\tarray = []\n\t\tif proc != nil && proc.is_a?(Proc)\n\t\t\tself.my_each do |x|\n\t\t\t\tarray << proc.call(x)\n\t\t\tend\n\t\telsif block_given?\n\t\t\tself.my_each do|x|\n\t\t\t\tarray << yield(x)\n\t\t\tend\n\t\tend\n\t\treturn array\n\tend", "def my_map_proc(a_proc = nil)\n\t\tnew_ary = []\n\t\tif a_proc.is_a?(Proc)\n\t\t\tfor i in self\n\t\t\t\tnew_ary << a_proc.call(i)\n\t\t\tend\n\t\telse\n\t\t\tfor i in self\n\t\t\t\tnew_ary << yield(i)\n\t\t\tend\n\t\tend\n\t\tnew_ary\n\tend", "def map\n yield(@value)\n end", "def map(arr) # creating our own map method\n\tnewArr = [] # declaring an empty array to push our results inside\n\tarr.each do |i| # run the block of code to iterate inside each elements in an array\n\t\tnewArr << yield(i) # push the modified elements inside our newArr []\n\tend\n\tnewArr\nend", "def some_method (testing)\n\tputs testing.map {|num| num**3} # method 1\nend", "def test_0130_map\n @@log.debug \"test_0130_map starts\" if @@log.debug?\n assert_respond_to(@list, :map, \"test_0130_map_respond\")\n # And array of dummy objects is returned\n new_list = @list.map { \"dummy\" }\n assert(new_list.size == @list.size,\"test_0130_map_basic\")\n assert(new_list[@list.size - 1] == \"dummy\",\"test_0130_map_sizecheck\")\n # Check Enumerator or Array return, no block given\n new_list = @list.map\nif RUBY_VERSION >= \"1.9\"\n result = new_list.is_a? Enumerator\n assert(result, \"test_0130_map_enumcheck\")\nelse\n result = new_list.is_a? Array\n assert(result, \"test_0130_map_arraycheck\")\nend\n # Create new Array 2\n new_list = @list.map {|obj| obj.ndata * 2 }\n assert(new_list == [8,6,4,2], \"test_0130_map_ndx2\")\n # Create new Array 3\n new_list = @list.map {|obj| obj.last }\n expected = [\"Newman\", \"Barker\", \"Bronson\", \"Dev\"]\n assert(new_list == expected, \"test_0130_map_lastname\")\n @@log.debug \"test_0130_map ends\" if @@log.debug?\n end", "def map_or_apply(unknown_object, function)\n unknown_object.is_a?(Array) ? unknown_object.map(&function) : function.(unknown_object)\n end", "def map_or_apply(unknown_object, function)\n unknown_object.is_a?(Array) ? unknown_object.map(&function) : function.(unknown_object)\n end", "def my_map_mult_two(arr)\n arr.map { |num| num * 2 }\nend", "def map(input, property); end", "def map\n out = []\n\n each { |e| out << yield(e) }\n\n out\n end", "def maps(x) x.map{|i| i * 2} end", "def my_map_v2(proc = nil) \n selfArr = self.entries\n (0...selfArr.length).each do |i|\n selfArr[i] = proc.call selfArr[i] if !proc.nil?\n selfArr[i] = yield(selfArr[i]) if proc.nil?\n end\n return selfArr\n end", "def my_map(&my_proc)\n return to_enum(:my_map) unless my_proc || block_given?\n\n arr = []\n my_proc ? each { |i| arr << my_proc.call(i) } : each { |i| arr << yield(i) if block_given? }\n arr\n end", "def chain_map(val, procs)\n procs.reduce(val) {|v, prc| prc.call(v)}\nend", "def map! &block\n mapped = enumerable_map(&block)\n clear\n merge mapped\n end", "def method_missing(method, *args, &blk)\n map_or_return {|elm| elm.send(method, *args, &blk) }\n end", "def test_map\n array = [1,2,3,4,5,6,7,8]\n array = array.map {|x| x*2}\n assert_equal [2, 4, 6, 8, 10, 12, 14, 16] , array\n end", "def result\n if value.length == 1\n calling_mapper.for(value.first).result\n else\n value.map do |value|\n calling_mapper.for(value).result\n end\n end\n end", "def map(arr)\n result = []\n arr.each {|element| result << yield(element)}\n result\nend", "def map(arr)\n result = []\n arr.each {|element| result << yield(element)}\n result\nend", "def chain_map(value, arr)\n arr.each do |proc_idx|\n value = proc_idx.call(value)\n end\n value\nend", "def map(data)\n result = []\n i = 0\n while i < data.count do\n x = yield(data[i])\n result << x\n i += 1\n end\n return result\nend", "def my_map_mod(proc = nil)\n\t\treturn self if proc == nil\n\t\tarray_before_block = []\n\t\tresult_if_block = []\n\t\tif proc\n\t\t\tself.my_each {|element| array_before_block << proc.call(element)}\n\t\tend\n\t\tif block_given?\n\t\t\tarray_before_block.my_each {|e| result_if_block << yield(e)}\n\t\t\treturn result_if_block\n\t\tend\n\t\tarray_before_block\n\tend", "def map\n reset_iteration\n return enum_for(:collect) unless block_given?\n [].tap { |ret| loop { ret << yield(self.next) } }\n end", "def result\n if value.length == 1\n calling_mapper.for(value.first).result\n else\n value.map do |element|\n calling_mapper.for(element).result\n end\n end\n end", "def apply_to_all(arg)\r\n\treturn lambda{|x| x.map{ |z| arg.call(z)}}\r\nend", "def my_map(*my_proc)\n caller = self\n return to_enum :my_map_proc unless block_given? || my_proc[0].class == Proc\n\n back = []\n caller.my_each do |value|\n if my_proc[0].is_a? Proc\n back.push my_proc[0].call value\n elsif block_given?\n back.push(yield value)\n end\n end\n back\n end", "def my_map(p = nil)\r\n if p.class == Proc\r\n arr = []\r\n self.my_each {|e| arr.push(p.call(e)) } unless p == nil\r\n if p !=nil and block_given?\r\n self.my_each {|e| arr.push(yield(e)) }\r\n end\r\n arr\r\n end\r\n end", "def map(array)\n array.each_with_object([]) { |element, results| results << yield(element) }\n# results\nend", "def map\n self\n end", "def new_map(&proc)\n\t\tnew_array = []\n\t\t\tif proc && block_given?\n\t\t\t\tself.my_each {|i| new_array << proc.call(yield(i))}\n\t\t\telsif proc && !block_given?\n\t\t\t\tself.my_each {|i| new_array << proc.call(i)}\n\t\t\tend\n\t\treturn new_array\n\tend", "def map(arr)\n # create empty array to populate with results of called block\n arr2 = []\n # for each element in the array, run the block of code, held in yield, on it then add that element to the new array\n arr.each { |x| arr2 << yield(x) }\n # return the new array, setting the original array to these new values\n arr2\nend", "def map(&proc)\n Generator.new do |size, rng|\n result = self.generate(size, rng)\n result.map(&proc)\n end\n end", "def my_map(&block)\n result = []\n my_each do |elem|\n result << block.call(elem)\n end\n result\n end", "def map\n fn = \"function() { \"\n fn << \"this.#{@field_name.to_s}.forEach(function(value) { \"\n fn << \"emit(value, 1); \"\n fn << \"}); \"\n fn << \"}\"\n end", "def map!(&block)\n self.replace(self.map &block)\n end", "def extract_as(mapping)\n mapping.inject({}) do |hash, (key, method)|\n hash.merge!(key => extract_value(method))\n end\n end", "def map(path, &block); end", "def map(method_name = nil, *args, &block)\n return if blank?\n if method_name\n @value = @value.public_send(method_name, *args, &block)\n else\n @value = block.call @value\n end\n end", "def map(realizer, enum)\n Xe.map(enum) { |x| realizer[x] }\n end", "def my_map_with_block_and_proc(proc = nil)\n\t\tcontainer = []\n\t\tself.my_each do |x|\n\t\t\tif block_given? && proc\n\t\t\t\tfirst = proc.call(x)\n\t\t\t\tcontainer << yield(first)\n\t\t\telsif !proc\n\t\t\t\tcontainer << yield(x)\n\t\t\telsif !block_given?\n\t\t\t\tcontainer << proc.call(x)\n\t\t\tend\n\t\tend\n\t\tcontainer\n\tend", "def fmap_left(&map)\n self.or { Failure(map.call(_1)) }\n end" ]
[ "0.7113912", "0.7075217", "0.69523174", "0.68413", "0.6831794", "0.67653304", "0.67653304", "0.6755617", "0.67222744", "0.66383195", "0.663169", "0.6607694", "0.66030395", "0.65635604", "0.6562311", "0.6562311", "0.6553749", "0.6553749", "0.6551459", "0.65028536", "0.6480778", "0.64436823", "0.64428836", "0.6421374", "0.6401553", "0.64014184", "0.6332932", "0.63139164", "0.63077205", "0.6303286", "0.62967145", "0.6281822", "0.6256461", "0.624845", "0.6206596", "0.6200129", "0.6185066", "0.61842084", "0.61799175", "0.61762977", "0.6167447", "0.6152532", "0.61395466", "0.61255616", "0.61250085", "0.61097854", "0.6104783", "0.610212", "0.60911983", "0.60857344", "0.6054548", "0.605113", "0.6036841", "0.60256916", "0.60167545", "0.6014672", "0.6011539", "0.60105705", "0.6008409", "0.6003358", "0.5995377", "0.5987776", "0.59804916", "0.5977899", "0.5972305", "0.5972305", "0.59634477", "0.5950395", "0.59358853", "0.5894173", "0.58788884", "0.5828134", "0.5817653", "0.57947266", "0.5794061", "0.57721144", "0.57464415", "0.57381725", "0.57381725", "0.57198215", "0.57132995", "0.57024974", "0.5701921", "0.5696809", "0.56965786", "0.5687651", "0.56800693", "0.565831", "0.5658181", "0.56574696", "0.5657264", "0.5644144", "0.5642813", "0.5623615", "0.56231755", "0.5622685", "0.5615259", "0.56098735", "0.5606262", "0.5594313", "0.55929637" ]
0.0
-1
Default method, subclasses must override this
def run super res = [] entity_name = _get_entity_name entity_type = _get_entity_type_string # skip cdns if !get_cdn_domains.select{ |x| entity_name =~ /#{x}/}.empty? || !get_internal_domains.select{ |x| entity_name =~ /#{x}/}.empty? _log "This domain resolves to a known cdn or internal host, skipping" return end # check that it resolves resolves_to = resolve_names entity_name unless resolves_to.first _log "No resolution for this record, unable to check" return end # We use their DNS servers to query nameservers= ['185.228.168.168', '185.228.168.169'] _log "Querying #{nameservers}" dns_obj = Resolv::DNS.new(nameserver: nameservers) # Try twice, just in case (avoid FP's) res = dns_obj.getaddresses(entity_name) res.concat(dns_obj.getresources(entity_name, Resolv::DNS::Resource::IN::CNAME)).flatten # Detected only if there's no resolution if res.any? _log "Resolves to #{res.map{|x| "#{x.to_s}" }}. Seems we're good!" else source = "CleanBrowsing" description = "The Cleanbrowsing DNS security filter focuses on restricting access " + "to malicious activity. It blocks phishing, spam and known malicious domains." _create_linked_issue("blocked_by_dns", { status: "confirmed", additional_description: description, source: source, proof: "Resolved to the following address(es) outside of #{source} (#{nameservers}): #{resolves_to.join(", ")}", to_reproduce: "dig #{entity_name} @#{nameservers.first}", references: [{ type: "remediation", uri: "https://cleanbrowsing.org/" }] }) # Also store it on the entity blocked_list = @entity.get_detail("suspicious_activity_detected") || [] @entity.set_detail("suspicious_activity_detected", blocked_list.concat([{source: source}])) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def overrides; end", "def custom; end", "def custom; end", "def default; end", "def default; end", "def private; end", "def special\n override\n end", "def defaults\n super\n end", "def implementation; end", "def implementation; end", "def default\n end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def method_missing(*args)\n default\n end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def tag; raise 'Override this method'; end", "def extended(*) end", "def set_default\n end", "def default_proc() end", "def initialize(*)\n super\n apply_defaults\n end", "def standard\n end", "def initialize\n super\n end", "def initialize\n super\n end", "def overrides=(_arg0); end", "def defaults!; end", "def defaults!; end", "def initialize\n super\n end", "def initialize\n super\n end", "def initialize\n super\n end", "def internal; end", "def set_defaults\n super\n end", "def set_defaults\n super\n end", "def main\n super\n return self\n end", "def call\n # implement in subclasses\n end", "def initialize\n super\n end", "def initialize\n super\n end", "def initialize\n super\n end", "def initialize()\n # override parent\n end", "def original; end", "def wrapper; end", "def initialize\n super \n end", "def ignores; end", "def type; super; end", "def overload; end", "def invoke\r\n # TODO: rename to more appropriate one 2007/05/10 by shino\r\n raise 'must be implemented in subclasses'\r\n end", "def initialize\n super(true)\n end", "def choose\n raise NotImplementedError.new('Must override')\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def normal\n end", "def normal\n end", "def default_content; end", "def virtual; end", "def extra; end", "def specialty; end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end" ]
[ "0.7415348", "0.73554313", "0.73554313", "0.6991004", "0.6991004", "0.69613177", "0.69572926", "0.6824949", "0.6801543", "0.6801543", "0.67361915", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0.65642005", "0.65501094", "0.65501094", "0.65501094", "0.65501094", "0.6528684", "0.6490566", "0.64695704", "0.64676064", "0.64597005", "0.6455708", "0.64551467", "0.64551467", "0.64329106", "0.64307904", "0.64307904", "0.6429658", "0.6429658", "0.6429658", "0.63993496", "0.6390495", "0.6390495", "0.6376105", "0.63759387", "0.6340433", "0.6340433", "0.6340433", "0.63253945", "0.6310201", "0.62980604", "0.62755877", "0.62675124", "0.6240711", "0.6220586", "0.6218145", "0.62124836", "0.6204448", "0.62003416", "0.62003416", "0.62003416", "0.62003416", "0.62003416", "0.62003416", "0.62003416", "0.6188848", "0.6188848", "0.6188653", "0.6170095", "0.6169804", "0.61623544", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336" ]
0.0
-1
Purges a queue (removes all messages from it)
def purge @channel.queue_purge(@name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def purge\n @queue.purge\n end", "def purge\n @queue.purge\n end", "def purge\n @queue.purge\n end", "def purge\n t = Time.now\n expired = []\n @queue.each do |identity,worker|\n expired << identity if t > worker.expiry\n end\n expired.each do |identity|\n @queue.delete identity\n end\n end", "def purge_queues\n [incoming_queue_url, outgoing_queue_url].each do |queue_url|\n while true\n messages = client.receive_message(queue_url: queue_url, max_number_of_messages: 10).messages\n break unless messages.first\n messages.each do |message|\n client.delete_message(queue_url: queue_url, receipt_handle: message.receipt_handle)\n end\n end\n end\n end", "def purge_queue(name, options = {})\n subject.queue_purge(name, options)\n end", "def purge\n Lock.transaction do\n deleted.all.each do |lock|\n msg = lock.message\n lock.destroy\n msg.destroy\n end\n end\n end", "def clear_queue(queue_name)\r\n execute :delete, \"#{queue_name}/messages\", {}, :x_ms_version => '2009-09-19'\r\n end", "def clear\n @queue.clear\n end", "def clear\n queue.clear\n end", "def redis_queues_cleanup!\n Gitlab::Redis::Queues.with(&:flushall)\n end", "def purge_interrupt_queue; end", "def purge_interrupt_queue; end", "def purge_queue\n Varnisher.log.info 'Purging resources...'\n\n Parallel.map(@urls) do |url|\n Varnisher.log.debug \"Purging #{url}...\"\n\n Varnisher.purge(url.to_s)\n end\n\n Varnisher.log.info 'Done.'\n end", "def redis_queues_cleanup!\n Gitlab::Redis::Queues.with(&:flushdb)\n end", "def handle_queue_clear(args)\n @queue = [[]]\n end", "def clear_queues_cache\n channel.queues.clear\n end", "def unlock_queueing_for_queue(queue)\n Resque.data_store.everything_in_queue(queue).uniq.each do |string|\n item = Resque.decode(string)\n\n unlock_queueing(queue, item).tap { RecoveringQueue.remove(queue, item) }\n end\n end", "def purge_message(message)\r\n if message.sender_purged && message.receiver_purged\r\n message.destroy\r\n end\r\n end", "def purge(*queues)\n queues = determine_queue_names(queues)\n publisher.purge(queues)\n end", "def clear\n @gate.synchronize do\n @queue = []\n @has_faulted = true\n end\n end", "def deq\n @queued = false\n nil\n end", "def clean_queue!\n # Go through the song queue from start to end\n queued_songs.each_with_index do |song, index|\n if song['playAt'] + song['duration'] > Time.now.to_i\n # This song is still ok to have, trim of all the ones to the left\n $redis.ltrim(queue_key, index, -1)\n return\n end\n end\n\n # Okay, every song has played already, nuke it\n $redis.del(queue_key)\n end", "def cleanup\n return if @max_age == 0\n timeout = Time.now - @max_age\n conditions = ['last_send_attempt > 0 and created_on < ?', timeout]\n mail = ActionMailer::Base.email_class.destroy_all conditions\n\n log \"expired #{mail.length} emails from the queue\"\n end", "def clear\n synchronize do\n @queue.clear\n end\n end", "def clear\n synchronize do\n @queue.clear\n end\n end", "def clear\n LOCK.synchronize do\n @queue.each { |_, jes| jes.each(&:close) }\n @queue.clear\n end\n end", "def remove\n @queue.pop\n end", "def clear\n synchronize do\n @queue.clear\n end\n end", "def clearQueue\n @itemList.clear()\n end", "def clear_queue(queue_name)\n if queue_name.kind_of?(Class)\n queue_name = queue_name.instance_variable_get(\"@queue\")\n end\n if queue_name == :delayed\n Resque.reset_delayed_queue\n else\n Resque.redis.del(\"queue:#{queue_name}\")\n Resque.redis.del(\"resque:queue:#{queue_name}\")\n end\n end", "def destroy!\n sqs.delete_queue(queue_url: address)\n end", "def purge_request(key)\n @queue.each do |identity,worker|\n worker.request_queue.delete key\n end\n end", "def remove_from_queue!(user)\n $redis.lrem(self.class.redis_key_for_user(user), 0, to_redis_object)\n end", "def clear_queue\n case @remove\n when 'one'\n puts \"Clearing e-mails #{@search_direction} #{@email}\"\n puts ''\n `exiqgrep -i #{@direction} #{@email} | xargs -P10 -i exim -Mrm '{}' >/dev/null`\n when 'all'\n if @valid_domain\n puts \"Removing all e-mails #{@search_direction} #{@domain}\"\n `exiqgrep -i #{@direction} #{@domain} | xargs -P10 -i exim -Mrm '{}' >/dev/null`\n else\n puts \"#{@domain} is not a valid local domain. Removing e-mails #{@search_direction} #{@email} instead\"\n `exiqgrep -i #{@direction} #{@email} | xargs -P10 -i exim -Mrm '{}' >/dev/null`\n end\n else\n puts \"Didn't remove any emails from the mailque\"\n end\n end", "def purge\n if attached?\n attachments.each(&:purge)\n @attachments = nil\n end\n end", "def bg_purge\n logger.warn \"About to purge background queue with #{bg_queue['MessageCount']} messages, #{bg_queue['MessagesAdded']} already received}\"\n purged_count = bg_queue.removeMessages('')\n logger.error \"Purged #{purged_count} messages\"\n {\n purged_count: purged_count\n }\n end", "def purge\n @items.delete_if(&:is_done) \n end", "def remove_from_queue\n if in_queue?\n decrement_queue_positions_on_lower_items\n update_attribute queue_position_column, nil\n end\n end", "def clear_queue\n @postponed_queries = []\n\n self\n end", "def clear\n LOCK.synchronize do\n @queue.each do |_, jobs|\n jobs.each do |job|\n job.close\n @registry.delete(job.id)\n end\n end\n\n @queue.clear\n end\n end", "def remove!\n @queue_for_removal.each do |path|\n FileUtils.rm(path) if File.exist?(path)\n end\n @removed = @queue_for_removal.dup\n @queue_for_removal.clear\n end", "def purge\n end", "def clean!\n clean_queue!\n clean_activity!\n end", "def clean\n clean_queued\n clean_running\n end", "def destroy!\n children = @zk.children(full_queue_path)\n locks = []\n children.each do |path|\n lock = @zk.locker(\"#{full_queue_path}/#{path}\")\n lock.lock!\n locks << lock\n end\n children.each do |path|\n @zk.delete(\"#{full_queue_path}/#{path}\")\n end\n @zk.delete(full_queue_path)\n locks.each do |lock|\n lock.unlock!\n end\n end", "def destroy\n @redis.pipelined do\n @redis.del @redis_name\n @redis.srem(:queues, @name)\n end\n @destroyed = true\n end", "def dequeue; @queue.pop end", "def clear\n jobs.each do |job|\n SidekiqUniqueJobs::Unlockable.unlock(job)\n end\n\n Sidekiq::Queues[queue].clear\n jobs.clear\n end", "def clear\n @que.clear\n end", "def clear\n @que.clear\n end", "def clear_queues\n RosettaQueue::Destinations.queue_names.each do |name| \n queue = name.gsub('/queue/','')\n open(\"http://127.0.0.1:8161/admin/deleteDestination.action?JMSDestination=#{queue}&JMSDestinationType=queue\")\n end\n end", "def purge_items\n purge(@nodename)\n end", "def trim_queue!(user)\n $redis.ltrim(self.class.redis_key_for_user(user), 0, KEEP_ACTIVITY_ITEMS)\n end", "def queue_purge(nowait = false, &block)\n nowait = true unless block\n @connection.send_frame(AMQ::Protocol::Queue::Purge.encode(@channel.id, @name, nowait))\n\n if !nowait\n self.redefine_callback(:purge, &block)\n # TODO: handle channel & connection-level exceptions\n @channel.queues_awaiting_purge_ok.push(self)\n end\n\n self\n end", "def purge_later\n if attached?\n attachments.each(&:purge_later)\n @attachments = nil\n end\n end", "def destroy\n profile = calc_profile\n cmd = \"jms-queue #{profile} remove --queue-address=#{@resource[:name]}\"\n bring_down 'JMS Queue', cmd\n end", "def reset!\n @queue = []\n @consumers = []\n end", "def delete_queue(queue_name)\r\n execute(:delete, queue_name, {}, {:x_ms_version => '2009-09-19'})\r\n end", "def remove_from_queue\n Resque.remove_delayed(SchedulerJob, :id => self.id)\n end", "def flush; queue.close end", "def requeue\n __requeue__(\"RPUSH\")\n end", "def clear\n @delivery_lock.synchronize do\n @messages.clear\n @buffer.clear\n end\n end", "def clear_queue_values\n @queue_values = {}\n end", "def purge\n self.files.each do |f|\n f.destroy\n end\n self.commits.each do |c|\n c.destroy\n end\n end", "def flush\n @queue.clear\n end", "def clear\n @que.clear\n end", "def destroy_all\n queue = params[:queue] || 'failed'\n Resque::Failure.clear(queue)\n redirect_to failures_path(redirect_params)\n end", "def pop\n @lock.synchronize do\n @queue.pop\n end\n end", "def clear\n @queue.clear\n true\n end", "def clear\n @que.clear\n self\n end", "def cleanup_callback_queue\n ObjectSpace.undefine_finalizer(@queue_id) if @queue_id\n return unless @callback_queue && callback_queue.alive?\n\n begin\n callback_queue.shutdown\n rescue MessageQueueDeadError\n end\n end", "def remove\n @queue.shift\n end", "def dequeue\n self.job.destroy if self.job.present?\n self.job_id = nil\n end", "def remove_comepleted_task_from_queue(task)\n queue_items = TaskQueue.where(task_id: task.id)\n unless queue_items.nil?\n queue_items.each do |queue_item|\n queue_item.destroy\n end\n end\n end", "def purge_processing!\n Async do\n Quiq.redis.pipeline do |pipe|\n loop do\n job = pipe.sync.call('RPOPLPUSH', @processing, @name)\n Quiq.logger.warn(\"Requeuing job #{job} in #{@name}\") unless job.nil?\n break if job.nil?\n end\n pipe.close\n end\n end.wait\n end", "def prune_responses_queue\n while !responses_queue.empty?\n message_id = responses_queue.first\n\n if responses[message_id].nil? || Time.now - responses[message_id].timestamp.to_time > 2.minutes\n responses_queue.shift\n responses.delete(message_id)\n else\n break\n end\n end\n end", "def pour_out\n @queue.deq\n end", "def remove\n @queue.shift\n end", "def purge\n self.branches.each do |b|\n b.purge\n b.destroy\n end\n end", "def purge\n self.branches.each do |b|\n b.purge\n b.destroy\n end\n end", "def clear_all\n super\n SidekiqUniqueJobs::Digests.new.del(pattern: \"*\", count: 1_000)\n end", "def remove\n @queue.shift\n end", "def flushQueue() \n done=0\n while ([email protected]?) do\n done=done+1\n @sender_plugin.send_data(@data.pop)\n end\n @@log.info \"Flushed \"+done.to_s\n end", "def remove_messages(filter = nil)\n with_queue_control do |control|\n control.remove_messages(filter)\n end\n end", "def reset_delayed_queue\n redis.del :delayed_queue\n end", "def delete_attachment_queue\n @delete_attachment_queue ||= {}\n end", "def process_queue\n # pop from the queue and push onto the in_progress queue\n data = _redis.brpoplpush(@queue, @in_progress_queue, timeout: @blocking_timeout)\n if data.nil? # Timed-out with nothing to process\n return\n end\n\n begin\n encrypted_data = RailsPipeline::EncryptedMessage.parse(data)\n RailsPipeline.logger.debug \"Processing #{encrypted_data.uuid}\"\n\n # re-publish to wherever (e.g. IronMQ)\n topic_name = encrypted_data.topic\n if topic_name.nil?\n RailsPipeline.logger.error \"Damaged message, no topic name\"\n return\n end\n\n publish(topic_name, data)\n @processed += 1\n\n # Now remove this message from the in_progress queue\n removed = _redis.lrem(@in_progress_queue, 1, data)\n if removed != 1\n RailsPipeline.logger.warn \"OHNO! Didn't remove the data I was expecting to: #{data}\"\n end\n rescue Exception => e\n RailsPipeline.logger.info e\n RailsPipeline.logger.info e.backtrace.join(\"\\n\")\n if !data.nil?\n RailsPipeline.logger.info \"Putting message #{encrypted_data.uuid} back on main queue\"\n _put_back_on_queue(data)\n end\n end\n end", "def delete\n @queue << \"delete\"\n end", "def cleanup\n $redis.del key('chat')\n $redis.del key('messages')\n end", "def unsubscribe(queue_name = nil)\n client.unsubscribe(\"/queue/#{queue_name || queue}\")\n end", "def purge\n\n\t\tend", "def delete_game_id_in_queue game_id, queue = nil\n current_queue = queue || craft_firebase_command(\"minesweeper/queue.json\")\n\n # getting new queue to update\n new_queue = current_queue&.reject { |queue_game_id|\n # reject chosen game\n game_id == queue_game_id\n }\n\n # update queue on server\n update_current_queue(new_queue)\nend", "def dequeues (user)\n raise IllegalStateTransitionError unless user_state[user] == :queued\n # remove request and change user's state\n Request.destroy(user.request.id)\n user_state[user] = :idle\n self.save\n check_rep\n end", "def empty_queue(client_id)\n return unless @server.has_connection?(client_id)\n @server.debug 'Delivering messages to ?', client_id\n @server.deliver(\n client_id,\n @messages.remove(client_id).map(&MultiJson.method(:load))\n )\n end", "def drain_queue(topic, &message_processor)\n QueueListener.drain(aws_client, config, topic, &message_processor)\n end", "def remove(pid)\n @dead_queues.unshift(@pids[pid]) # keep track of queues that pid was running, put it at front of list\n @pids.delete(pid)\n procline\n end", "def purge!\n @data = nil\n end", "def purge!\n @data = nil\n end", "def unsubscribe(name)\n if subscriptions.has_key? name\n subscriptions[name].queue.unsubscribe(:nowait => false)\n subscriptions.delete(name)\n end\n end" ]
[ "0.823347", "0.823347", "0.823347", "0.7661655", "0.7607196", "0.74705327", "0.73918253", "0.7191478", "0.7097893", "0.70909727", "0.7077912", "0.7024354", "0.7024354", "0.701208", "0.7006324", "0.70051193", "0.6931408", "0.68439126", "0.68298584", "0.6818685", "0.680437", "0.6801216", "0.67969084", "0.67710006", "0.67674303", "0.67674303", "0.67626137", "0.67507994", "0.6745742", "0.67386335", "0.6720446", "0.6701668", "0.67005503", "0.66917986", "0.66615874", "0.66301423", "0.662484", "0.65503675", "0.6549634", "0.65071857", "0.6503846", "0.64788824", "0.6452377", "0.6446459", "0.64442945", "0.64428854", "0.6440808", "0.64338505", "0.6391321", "0.63763136", "0.63763136", "0.6357423", "0.63407123", "0.632236", "0.6320866", "0.63000685", "0.628089", "0.6280583", "0.6278117", "0.6272517", "0.62680745", "0.6267158", "0.62622833", "0.62616193", "0.62606436", "0.62556636", "0.62417495", "0.62414664", "0.6240826", "0.62344193", "0.6228729", "0.6208261", "0.62045944", "0.6196809", "0.6195212", "0.61787033", "0.61670166", "0.6159878", "0.61505634", "0.61486", "0.61486", "0.6144697", "0.6139011", "0.61271113", "0.61116207", "0.6079807", "0.6073795", "0.6073397", "0.6070225", "0.6068657", "0.60464066", "0.60413384", "0.603975", "0.60318315", "0.60204566", "0.5993818", "0.5983663", "0.5983116", "0.5983116", "0.59821886" ]
0.7851776
3