query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
calculates amount earned per driver calculates & returns maximum amount earned amongst drivers
def amt_per_driver(red) sum_array = [] names_array = [] red.each do |key,value| sum = 0 value.each do |hash| sum += hash.fetch(:"cost") end puts "Driver #{key} has earned $#{sum}." sum_array << sum names_array << key end r = sum_array.max winner = names_array[sum_array.find_index(r)] return winner end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_highest_pay(drivers)\n maximum = 0\n max = {}\n driver = \"Default\"\n drivers.each do |driver_data|\n driver_data.each do |driver_id, rides|\n money = find_total_pay(rides)\n if maximum < money\n maximum = money\n driver = driver_id\n end\n end\n max[:driver_id] ...
[ "0.7774704", "0.77394897", "0.77053046", "0.7571726", "0.75631285", "0.73713523", "0.7366555", "0.7327447", "0.73147064", "0.7126194", "0.71195334", "0.70600337", "0.7037339", "0.6992539", "0.699252", "0.6942459", "0.6819177", "0.677203", "0.67685384", "0.6719584", "0.6707777...
0.7277316
9
calculates average rating per driver calculates and returns highest average rating amongst drivers
def average_rating(blue) average_array = [] names1_array = [] blue.each do |key,value| sum = 0 value.each do |hash| sum += hash.fetch(:"rating") end converted = sum.to_f puts "Driver #{key} has an average rating of #{(converted/value.length).round(3)}." average_array << (converted/value.length).round(3) names1_array << key end s = average_array.max winner2 = names1_array[average_array.find_index(s)] return winner2 puts end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def driver_avg_rating(driver)\n all_ratings = driver[:rides].map { |ride| ride[:rating] }\n avg_rating = all_ratings.sum.to_f / all_ratings.length.to_f\n return avg_rating\nend", "def find_avg_rating(driver)\n\trating_sum = 0\n\ttotal_ratings = 0\n\t\n\tdriver[:dates].each do |date, info|\n\t\tinfo[:ratings]....
[ "0.8097378", "0.809536", "0.79093534", "0.78903913", "0.78410196", "0.7768204", "0.77463967", "0.772871", "0.77221423", "0.7700411", "0.7672396", "0.7628224", "0.76281095", "0.7580153", "0.7575411", "0.7542024", "0.75290674", "0.7472963", "0.74156606", "0.7334983", "0.7297684...
0.71402806
29
restituisce l'elenco dei giocatori che segue il giocatore
def follows @follows ||= refresh_follows end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mi_carrera\n\n\tend", "def ligar #Metodo/função da classe Carro\n puts 'O carro está pronto para iniciar o trajeto.'\n end", "def ligar #iniciando o método ligar\n puts 'O carro está ligado...' #imprime na tela a ação do método\n end", "def grasa(sexo,peso,talla)\n\t\t@grasa = 1.2*imc...
[ "0.6263885", "0.60918045", "0.60330415", "0.59559965", "0.5946107", "0.58874065", "0.5807076", "0.58064204", "0.57922417", "0.5764479", "0.5663736", "0.5642081", "0.56177723", "0.5612532", "0.5580819", "0.5556859", "0.55558974", "0.5554805", "0.55498934", "0.5508758", "0.5496...
0.0
-1
restituisce l'elenco dei giocatori che seguono il giocatore
def followers @followers ||= refresh_followers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ligar #Metodo/função da classe Carro\n puts 'O carro está pronto para iniciar o trajeto.'\n end", "def set_giro_comercial\n @giro_comercial = GiroComercial.find(params[:id])\n end", "def graficas\n end", "def mi_carrera\n\n\tend", "def ligar #iniciando o método ligar\n puts 'O...
[ "0.6045805", "0.5950965", "0.594579", "0.5840703", "0.57533586", "0.55719966", "0.55663234", "0.55381054", "0.55278677", "0.5523077", "0.54993045", "0.5484451", "0.54810405", "0.5469095", "0.5469095", "0.545094", "0.54463714", "0.54360306", "0.5368311", "0.5363452", "0.535740...
0.0
-1
returns all the lines before the method that might contain the restpi descriptions not bulletproof but working for conventional Ruby code
def lines_above_method added_lines = [] lines_to_add = [] block_level = 0 ensure_line_breaks(controller_content.lines).first(action_line).reverse_each do |line| if line =~ /\s*\bend\b\s*/ block_level += 1 end if block_level > 0 lines_to_add << line else added_lines << line end if line =~ /\s*\b(module|class|def)\b / break end next unless line =~ /do\s*(\|.*?\|)?\s*$/ block_level -= 1 if block_level == 0 added_lines.concat(lines_to_add) lines_to_add = [] end end return added_lines.reverse.join end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def possibly_add_trace_info_calls(line)\n # If the current line does not start a logical line, don't bother\n if not @state[:ll_start]\n return line\n end\n\n # We will be making decisions based on the first word on the line\n line_words = line.split\n if line_words.empty?\n # The line ...
[ "0.6531765", "0.65259814", "0.65259814", "0.6408572", "0.6344814", "0.6340993", "0.6295923", "0.6295923", "0.6295923", "0.6295923", "0.6295923", "0.6295923", "0.6295923", "0.6295923", "0.6295923", "0.6295923", "0.62486714", "0.62486714", "0.6199949", "0.6177948", "0.6153217",...
0.73736304
0
this method would be totally useless unless some clever guy desided that it would be great idea to change a behavior of "".lines method to not include end of lines. For more details:
def ensure_line_breaks(lines) if lines.to_a.size > 1 && lines.first !~ /\n\Z/ lines.map { |l| l !~ /\n\Z/ ? (l << "\n") : l }.to_enum else lines end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def never_lines; end", "def never_lines; end", "def empty_line\n end", "def remove_lines(text)\n text.gsub(/\\n/, '')\n end", "def ignore_rest_of_line\n @string.gsub!(/.*?\\n/, \"\\n\")\n end", "def remove_lines(text)\n text.delete(\"\\n\")\n end", "def nice_lines\n # note: $/...
[ "0.6939041", "0.6939041", "0.6932014", "0.67451525", "0.67421156", "0.6572148", "0.65575933", "0.6545008", "0.6517908", "0.639115", "0.6357843", "0.6352414", "0.6332136", "0.63167334", "0.6313163", "0.63057935", "0.6294071", "0.6294071", "0.6292644", "0.6289101", "0.6289101",...
0.5902022
63
FIXME: redo with locations and kparse.
def run(args) case args.size when 1 if @proc.frame file = @proc.frame.source_container[1] line = @proc.frame.source_location[0] else errmsg("No Ruby program loaded.") return end when 2 line = Integer(args[1]) rescue nil if line if @proc.frame file = @proc.frame.source_container[1] else errmsg("No Ruby program loaded.") return end else file = args[1] line = 1 end when 3 line, file = args[2], args[1] else errmsg "edit needs at most 2 args." end editor = ENV['EDITOR'] || '/bin/ex' unless File.executable?(editor) errmsg "Editor #{editor} is not executable. Trying anyway..." end if File.readable?(file) file = File.basename(file) if settings[:basename] edit_cmd = "#{editor} +#{line} \"#{file}\"" msg "Running #{edit_cmd}..." system(edit_cmd) msg "Warning: return code was #{$?.exitstatus}" if $?.exitstatus != 0 else errmsg "File \"#{file}\" is not readable." end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def locations; end", "def LocationPath(path, parsed); end", "def loc; end", "def loc; end", "def loc; end", "def parse; end", "def parse; end", "def parse; end", "def parse()\n #This is a stub, used for indexing\n end", "def perform\n resolve_context\n\n pa...
[ "0.6329383", "0.62890434", "0.6006142", "0.6006142", "0.6006142", "0.5820263", "0.5820263", "0.5820263", "0.5776895", "0.575439", "0.57443607", "0.57443607", "0.5702065", "0.5702065", "0.5693296", "0.5654276", "0.56237185", "0.5612134", "0.55895007", "0.5553296", "0.553833", ...
0.0
-1
The label of this parameter. Will be shown in the UI.
def label attributes.fetch(:label) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def label\n return @label\n end", "def label\n \"#{@name} (#{@id})\"\n end", "def label\n return @label\n end", "def label\n attribute :label\n end", "def label\n self['label']\n end", "def label\n @params['label']\n end", "def label\n ...
[ "0.81054044", "0.8020664", "0.79829717", "0.78824943", "0.78716487", "0.78160024", "0.78148746", "0.77350366", "0.7725147", "0.7698426", "0.7693422", "0.7618493", "0.7584463", "0.7571586", "0.7561514", "0.75474316", "0.74755406", "0.7443115", "0.7403932", "0.74025047", "0.739...
0.776087
12
The humanreadable doccomment of this parameter. Will be shown in the UI but can be omitted.
def documentation attributes.fetch(:documentation) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def description\n parameter[:description]\n end", "def doc\n if @spec.key?('doc')\n Comment.new(\"@param #{@spec['name']} #{@spec['doc']}\")\n else\n Comment.new\n end\n end", "def docstring\n object.docstring.tr(\"\\n\", \" \")\n end", "def docstring; ...
[ "0.73036766", "0.7201204", "0.7025432", "0.7018758", "0.7018758", "0.6641367", "0.6564507", "0.6564507", "0.65603465", "0.65170354", "0.6510147", "0.65072715", "0.64961255", "0.6494745", "0.64919674", "0.6444656", "0.6444656", "0.6444656", "0.6444656", "0.6444656", "0.6444656...
0.67339796
8
Write the habtm association table
def habtm_to_fixture(path) joins = self.reflect_on_all_associations.select { |j| j.macro == :has_and_belongs_to_many } joins.each do |join| hsh = {} connection.select_all("SELECT * FROM #{join.options[:join_table]}").each_with_index { |record, i| hsh["join_#{'%05i' % i}"] = record } write_file(File.expand_path("#{path}/#{join.options[:join_table]}.yml", RAILS_ROOT), hsh.to_yaml(:SortKeys => true)) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def habtm_to_fixture\n joins = self.reflect_on_all_associations.select do |j|\n j.macro == :has_and_belongs_to_many\n end\n joins.each do |join|\n hsh = {}\n connection.select_all(\"SELECT * FROM #{join.options[:join_table]}\").each_with_index do |record, i|\n hsh[\"joi...
[ "0.6851121", "0.5933904", "0.5914215", "0.5858294", "0.5846164", "0.58163303", "0.56643647", "0.566073", "0.5569352", "0.5523867", "0.5407585", "0.54048973", "0.53579354", "0.5308933", "0.526921", "0.5257054", "0.5245627", "0.5217911", "0.5194788", "0.51559305", "0.5145512", ...
0.70449305
1
this is generally called by the parser code
def initialize(ranges, of_type) @ranges, @of_type = ranges, of_type end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parsed; end", "def parsed; end", "def parse; end", "def parse; end", "def parse; end", "def parse()\n #This is a stub, used for indexing\n end", "def parser; end", "def parser; end", "def parser; end", "def parser; end", "def after_parse; end", "def after_parse; ...
[ "0.7136895", "0.7136895", "0.7109572", "0.7109572", "0.7109572", "0.7078698", "0.685638", "0.685638", "0.685638", "0.685638", "0.67835945", "0.67835945", "0.6625641", "0.65476626", "0.65476197", "0.6545604", "0.6545604", "0.6426855", "0.63605547", "0.6357579", "0.6357579", ...
0.0
-1
These are replicas that did not get created yet, So they still do not have any associated pod, these are marked as pending instances.
def not_created_instances pending_instances_count = wanted_instances - filtered_pods_by_track.count return [] if pending_instances_count <= 0 Array.new(pending_instances_count, deployment_instance(pod_name: 'Not provided', pod_status: 'Pending')) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replicas; end", "def active_instances\n Egi::Fedcloud::Vmhound::Log.info \"[#{self.class}] Retrieving running instances\"\n fetch_instances ['ACTIVE']\n end", "def active_instances; end", "def instances\n @instances ||= init_instances.reject(&:terminated?)\n end", "def available_inst...
[ "0.6615595", "0.5887121", "0.5830375", "0.5723418", "0.56646824", "0.5658143", "0.557032", "0.5548124", "0.5546056", "0.54205334", "0.5419506", "0.5401854", "0.53747326", "0.53621936", "0.5354917", "0.5353343", "0.5266532", "0.52556515", "0.5244883", "0.52402973", "0.5231401"...
0.7089103
0
=> id: object.id name campsite => campsite: object.campsite => Camper.first.campsite => Campsite object with the matching id
def campsite CampsiteSerializer.new(object.campsite) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_campsite\n @campsite = Campsite.find(params[:id])\n end", "def set_campsite\n @campsite = Campsite.find(params[:id])\n end", "def show\n # Gets us one row, and returns it as an object\n # (an instance of the Campsite model class)\n @campsite = Campsite.find params[:id]\n end", "...
[ "0.7367905", "0.72060144", "0.7067551", "0.6939683", "0.65462697", "0.65462697", "0.6536989", "0.6413934", "0.6373604", "0.63613755", "0.6166391", "0.6166391", "0.61503536", "0.61252797", "0.61210907", "0.61210907", "0.59998864", "0.5944419", "0.5899594", "0.5899594", "0.5887...
0.67668045
4
Called when connection is opened
def on_open(env) app_name = env['PATH_INFO'].split('/').last @connection = Connection.new(self, app_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_open(event)\n logger.debug \"Connection openned as user: #{@user} on channel: #{@channel}.\"\n end", "def on_open(&block)\n define_callback :connect, &block\n end", "def on_open(event)\n logger.debug 'Socket opened'\n @connected = true\n end", "def establis...
[ "0.7487306", "0.7367888", "0.736605", "0.7193025", "0.7027628", "0.6988226", "0.69563806", "0.69419885", "0.68937486", "0.6848413", "0.67653614", "0.6753386", "0.67072374", "0.6699102", "0.66600865", "0.6658202", "0.66481274", "0.663165", "0.66143346", "0.66143346", "0.661433...
0.7235323
3
Called when message is received
def on_message(env, msg) log("received", msg) Message.new(@connection, msg).dispath end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def received\n end", "def on_receive(message)\n end", "def receive_message(message)\n end", "def received message, headers={}\n end", "def receive_msg msg\n # stub, overwrite this in your handler\n end", "def on_message_data_receiving_event(ctx) end", "def receive(message)\n ...
[ "0.8196982", "0.8043418", "0.78684247", "0.7755499", "0.7690439", "0.7484054", "0.7465898", "0.7463579", "0.7435282", "0.7356738", "0.72319484", "0.71925116", "0.7102674", "0.7096351", "0.7084706", "0.7075729", "0.7067955", "0.7067955", "0.7025732", "0.7002633", "0.70022815",...
0.7528364
5
Called when client closes clonnecton
def on_close(env) @connection.destroy if @connection end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_client_close(client)\n end", "def on_close client\n controller(client).on_close\n end", "def on_closed(&block)\n define_callback :disconnect, &block\n end", "def client_disconnected\n end", "def on_close\n\t\tend", "def close_client(cli)\n listener.close_client(cli...
[ "0.77877927", "0.77501893", "0.7156686", "0.7154758", "0.69908524", "0.6945303", "0.6937837", "0.69084346", "0.6907219", "0.6881535", "0.68662024", "0.6850375", "0.6840751", "0.6815869", "0.6815839", "0.6805223", "0.6790676", "0.67808753", "0.6776506", "0.6776506", "0.673026"...
0.68630606
11
Send JSONencoded data instead of clear text
def send_data(data) jsonified_data = data.to_json log('sending', jsonified_data) super(jsonified_data) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send data\n self.send(data.to_json)\n end", "def json_out(data)\n content_type 'application/json', :charset => 'utf-8'\n data.to_json + \"\\n\"\n end", "def json_out(data)\n content_type 'application/json', :charset => 'utf-8'\n data.to_json + \"\\n\"\n end", "def json_out(data)\n co...
[ "0.70893335", "0.67421955", "0.67421955", "0.67421955", "0.673449", "0.6566904", "0.6526241", "0.64311385", "0.6421238", "0.6367433", "0.6309816", "0.62539196", "0.62342525", "0.61870503", "0.61363524", "0.6128118", "0.6069554", "0.6053091", "0.6049494", "0.6045776", "0.60219...
0.7244981
0
Remember, you can access your database connection anywhere in this class with DB[:conn]
def initialize(name, grade, id=nil) @name = name @grade = grade @id = id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connection\n @db = Connection.client\nend", "def db; end", "def db; end", "def db\n @db ||= new_connection\n end", "def connection; end", "def connection; end", "def connection; end", "def connection; end", "def connection; end", "def connection; end", "def connection; end", ...
[ "0.7719552", "0.7409344", "0.7409344", "0.71225536", "0.71116126", "0.71116126", "0.71116126", "0.71116126", "0.71116126", "0.71116126", "0.71116126", "0.71116126", "0.7066477", "0.7036872", "0.6986953", "0.6969356", "0.6957798", "0.6946606", "0.69454324", "0.69204223", "0.69...
0.0
-1
Returns the name of the currentlyexecuting rake task, if it can be determined. If monkey patching is disabled, this will be nil.
def current_task_name return nil unless enabled? self.class.current_task_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rake_task_name\n ENV['RAKE_TASK'].to_s.sub(/(?:r?spec|cucumber):?(.*)/, '\\1').upcase\n end", "def get_task(task_name)\n if using_rake? and task_defined?(task_name)\n Rake::Task[task_name]\n end\n end", "def file_name\n \"#{task_name}.rake\"\n end", "def getTaskName\r\...
[ "0.69430447", "0.6810676", "0.6646243", "0.65869236", "0.62806386", "0.62635046", "0.6261987", "0.61961883", "0.6188612", "0.6188612", "0.61418813", "0.61359304", "0.61228824", "0.6111042", "0.5935502", "0.59326285", "0.5896452", "0.5864681", "0.5864178", "0.58473426", "0.583...
0.7490603
0
Update the context when a new command starts by: Clearing the command history if the rake task has changed Recording the command in the history Returns whether or not this command was the first execution of this command in the current rake task
def register_new_command(command) reset_history_if_task_changed first_execution = !history.include?(command.to_s) history << command.to_s history.uniq! first_execution end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check\n super\n # Save the start time for the job\n @start_time = Time.now\n raise ArgumentError, \"Missing execution context\" if @context.blank?\n true\n end", "def process_ok\n @@last_command_symbol = current_symbol\n super\n end", "def process_ok\n @@last_command_symbol = curr...
[ "0.5614838", "0.5605433", "0.5605433", "0.5605433", "0.5605433", "0.5579098", "0.55495805", "0.54018897", "0.5309768", "0.52907526", "0.52404183", "0.5227866", "0.51973087", "0.51854163", "0.51530725", "0.5152679", "0.5140359", "0.5140359", "0.5140359", "0.51397026", "0.51300...
0.57899916
0
The zerobased position of the specified command in the current rake task. May be `nil` in certain multithreaded scenarios, so be careful!
def position(command) history.index(command.to_s) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_position\n return 1 if Task.all.empty?\n Task.maximum('position') + 1\n end", "def offset\n execute['offset']\n end", "def linenumber\n return @cmd.nil? ? 0 : @cmd.linenumber\n end", "def prev\n\t\tTask.order(:position).where(\"position < ?\", position).last\n\tend"...
[ "0.6016256", "0.57998776", "0.57166636", "0.5398835", "0.5366547", "0.5340632", "0.53307056", "0.52746576", "0.52363294", "0.521876", "0.5160839", "0.5148128", "0.50869274", "0.5077604", "0.506422", "0.50304294", "0.50090295", "0.50086194", "0.50023574", "0.4985811", "0.49720...
0.5965317
1
Notify topic subscribers with message
def notify_topic(message, options: nil, &block) command = make_simple_command(:post, 'messages:send', options) command.request_representation = Google::Apis::Messages::Message::Representation command.request_object = message if !ENV['FIREBASE_DEBUG'].nil? log_json(command) end execute_or_queue_command(command, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notify(msg, subject)\n end", "def subscribe(_topic, **)\n raise 'not implemented'\n end", "def notify_about_topic!(topic)\n with_user_locale do\n UserMailer.topic_match_notification(self, topic).deliver!\n end\n end", "def onMessage(topic, message)\n puts \"Topic: #{topic}, Me...
[ "0.7048961", "0.7027781", "0.68511194", "0.67798424", "0.66448903", "0.66347677", "0.659654", "0.6559153", "0.6536481", "0.65314466", "0.64673364", "0.64324474", "0.6428041", "0.64251274", "0.63997537", "0.6398071", "0.6376669", "0.63427925", "0.6328544", "0.6308202", "0.6292...
0.6450687
11
S3 will give url, file wil show mount point, we care just about s3
def file_url resource.send(mount_point).url end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url\n if @attributes[:filename] =~ /^http:\\/\\//\n @attributes[:filename]\n elsif $cloudfront && $cloudfront[s3_bucket]\n \"#{$cloudfront[s3_bucket]}/#{s3_key}\"\n else\n \"http://#{s3_bucket}.s3.amazonaws.com/#{s3_key}\"\n end\n end"...
[ "0.7727604", "0.7621129", "0.74733555", "0.7451903", "0.7289858", "0.7251765", "0.7250063", "0.7175832", "0.71548337", "0.71092117", "0.70494074", "0.7046797", "0.69964075", "0.6987783", "0.69791925", "0.69603026", "0.69481176", "0.69361454", "0.6916069", "0.6911586", "0.6911...
0.69761264
15
Returns the topmost directory that is common to all paths in `sources`
def sources_license_path(sources) common_prefix = Pathname.common_prefix(*sources).to_path # don't allow the repo root to be used as common prefix # the project this is run for should be excluded from the manifest, # or ignored in the config. any license in the root should be ignored. return common_prefix if common_prefix != Licensed::Git.repository_root # use the first source file as the license path. sources.first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dirs\n sources.inject(Hash.new{ |hsh, key| hsh[key] = [] }) do |c, source|\n c[File.dirname(source[:path])].push(source)\n c\n end.sort.collect { |k, v| { dir: k, files: v } }\n end", "def common_src_dirs\n\tsrc_dirs_matches = common_src_dir_list.split(\":\")\n\tsrc_dirs_matches\nend", "de...
[ "0.6564006", "0.65006685", "0.6272733", "0.62413514", "0.6189823", "0.6177835", "0.615677", "0.60817105", "0.6049254", "0.6013757", "0.59722394", "0.59722394", "0.5909469", "0.5871205", "0.58694696", "0.58360994", "0.5829154", "0.57852244", "0.569422", "0.56411886", "0.562258...
0.5932705
12
Returns the latest git SHA available from `sources`
def package_version(sources) return if sources.nil? || sources.empty? sources.map { |s| Licensed::Git.version(s) } .compact .max_by { |sha| Licensed::Git.commit_date(sha) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def git_sha(length = 40)\n Pkg::Util.in_project_root do\n stdout, _, _ = Pkg::Util::Execution.capture3(\"#{GIT} rev-parse --short=#{length} HEAD\")\n stdout.strip\n end\n end", "def git_source\n `git remote -v`.\n split(/\\n/).\n map(&:chomp).\n map { |s| s.sp...
[ "0.65414435", "0.6515281", "0.6390067", "0.628491", "0.62400216", "0.62400216", "0.62344366", "0.6210026", "0.61913997", "0.61279076", "0.6109959", "0.6086003", "0.60647374", "0.60363626", "0.6011635", "0.5951972", "0.5945268", "0.59404075", "0.5879333", "0.58781165", "0.5860...
0.7404479
0
Returns a map of package names > array of full source paths found in the app manifest
def packages manifest.each_with_object({}) do |(src, package_name), hsh| next if src.nil? || src.empty? hsh[package_name] ||= [] hsh[package_name] << File.join(Licensed::Git.repository_root, src) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def package_manifest()\n res = []\n @items.each do |item|\n sources = item[:sources]\n sources = [ sources ] unless sources.kind_of?(Array)\n sources.each do |src|\n # TODO - want to split into multiple packages\n #if pkg == :main\n # next unless item[:dest] =~ /(LIB|BIN)...
[ "0.71163255", "0.70474017", "0.6901172", "0.6592638", "0.6585065", "0.6427675", "0.6330999", "0.63095695", "0.62537205", "0.61551493", "0.613561", "0.6062275", "0.60312575", "0.5998572", "0.59138787", "0.59077495", "0.5849544", "0.58181447", "0.578917", "0.57832736", "0.57829...
0.71624374
0
Returns parsed manifest data for the app
def manifest case manifest_path.extname.downcase.delete "." when "json" JSON.parse(File.read(manifest_path)) when "yml", "yaml" YAML.load_file(manifest_path) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def manifest\n return @manifest if @manifest\n result = []\n app_prefix = /^\\{app\\}\\//\n manifest_regexp = /#{manifest_name}$/\n files.each do |file|\n path, installed_path = file.source, file.dest\n next unless installed_path =~ app_prefix\n # Skip the MANIFEST fil...
[ "0.7270742", "0.7215077", "0.71873343", "0.70169485", "0.6859899", "0.6812294", "0.6719963", "0.67197907", "0.6710553", "0.65369", "0.65361476", "0.65185714", "0.6480582", "0.6350169", "0.63478243", "0.62742746", "0.6183861", "0.6154522", "0.61467355", "0.61334175", "0.606991...
0.7266803
1
Returns the manifest location for the app
def manifest_path path = @config["manifest"]["path"] if @config["manifest"] return Licensed::Git.repository_root.join(path) if path @config.cache_path.join("manifest.json") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def manifest_path\n build_output_dir.join('manifest.json')\n end", "def manifest_path\n Gym.cache[:manifest_path] ||= File.join(temporary_output_path, \"manifest.plist\")\n end", "def assets_manifest_path\n build_output_dir.join('manifest-assets.json')\n end", "def get_path_to_merged_mani...
[ "0.75245154", "0.7323672", "0.7041831", "0.6916614", "0.6832418", "0.68134207", "0.6759457", "0.66155875", "0.6597622", "0.65458906", "0.6534932", "0.64810526", "0.6450023", "0.6411475", "0.6403845", "0.63982743", "0.63525033", "0.6341697", "0.6337782", "0.6334989", "0.633377...
0.71290743
2
This makes sense intuitively when yield is invoked with arguments, they are passed into the block. Question? What happens if there's a mismatch between the of block arguments vs. yield arguments? Answer: any extra block arguments that don't have a corresponding yield argument are nil. Any extra yield arguments are ignored by the block.
def test_blocks_can_take_arguments method_with_block_arguments do |argument| assert_equal 'Jim', argument end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test\n yield(1, 2) # passing 2 block args\nend", "def yield_block_example()\n puts \"Start of yield block example\"\n yield('example of param passing')\n puts \"End of yield block example\"\nend", "def block_args_unleashed\n yield(1,2,3,4,5)\nend", "def block_args_unleashed\n yield(1,2,3,4,5)...
[ "0.7806148", "0.7612532", "0.7610036", "0.7610036", "0.7556697", "0.75537384", "0.7540687", "0.74700665", "0.74233633", "0.73156285", "0.7300345", "0.7283627", "0.72810864", "0.72807133", "0.72678393", "0.7254444", "0.7211738", "0.7085149", "0.7064426", "0.70425045", "0.70421...
0.0
-1
You can't pass in multiple blocks to a method, but a method can invoke the block multiple times. Question: is result "captured" by the block as a closure variable? Answer: I think so! Observation: result is a local variable scoped to this test method. It can't be accessed within many_yields. However, in closure parlance, result is an "open" or "free" variable" that's "enclosed" by the block. Therefore, when many_yields invokes yield, it indirectly modifies result. If Ruby did not support closures, result would be some uninitialized value.
def test_methods_can_call_yield_many_times result = [] many_yields { |item| result << item } assert_equal [:peanut, :butter, :and, :jelly], result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test\n yield(1, 2) # passing 2 block args\nend", "def test\n yield(1, 2)\nend", "def ret_block\n x = 1\n y = 2\n z = 3\n yield(x,y,z)\n yield(x)\n yield(x,x,x,x)\n yield([x,y,z])\nend", "def test_two\n yield(5)\n puts 'You are in the method test_two'\n yield(100)\nend", "def multiple_pass\n ...
[ "0.74846095", "0.7386573", "0.73793614", "0.7215319", "0.721373", "0.7187738", "0.7161491", "0.7117252", "0.7113501", "0.699186", "0.6931425", "0.686276", "0.686276", "0.686276", "0.686276", "0.682683", "0.6792806", "0.677104", "0.6746565", "0.67305356", "0.6727858", "0.671...
0.79582644
0
Introduction to the block_given? method, which is defined in the Ruby kernel
def test_methods_can_see_if_they_have_been_called_with_a_block assert_equal :with_block, yield_tester { :with_block } assert_equal :no_block, yield_tester end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def block_given?() 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 if_block_given\n p \"hoge\"\n yield if block_given?\n p \"end\"\nend", "def i_check_if_block\n if block_given?\n yield\n else\n puts \"no block\...
[ "0.9019372", "0.82445717", "0.80853945", "0.805096", "0.79445076", "0.78192204", "0.779868", "0.77852017", "0.752451", "0.74429655", "0.7407647", "0.74068177", "0.7405128", "0.7370599", "0.73610646", "0.7250953", "0.7236079", "0.7171287", "0.7123716", "0.70855105", "0.7081929...
0.6770398
39
Here's a method where the block explicitly declares that it accepts a block. Note the ampersand again. Side note: you can pass a block to any method, even one that never calls yield. Methods can use block_given? to figure out how to behave.
def method_with_explicit_block(&block) block.call(10) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def block_method\n yield if block_given?\nend", "def with_block(&block)\n end", "def block_example(&block)\n does block\n end", "def explicit_block(&sloth)\n sloth.call # same as yield\nend", "def tester &foo\n yield if block_given?\nend", "def do_something\n yield if block_given?\nend", "...
[ "0.8100577", "0.79823637", "0.7976726", "0.79329395", "0.788811", "0.77882075", "0.77637124", "0.77417123", "0.772956", "0.77149236", "0.768141", "0.76684904", "0.7645572", "0.76047224", "0.75935066", "0.7583278", "0.75397635", "0.7531289", "0.7527558", "0.75243205", "0.75243...
0.7261579
72
Temporary while "version" is being deprecated
def api_version dataset_version ? dataset_version.version : nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 ver...
[ "0.7384154", "0.7384154", "0.7384154", "0.7384154", "0.7384154", "0.7384154", "0.7384154", "0.7384154", "0.7384154", "0.7384154", "0.7384154", "0.7384154", "0.7384154", "0.7384154", "0.7384154", "0.7384154", "0.7384154", "0.7384154", "0.7384154", "0.7384154", "0.7384154", "...
0.0
-1
The set_cart() getting the :cart_id from the session object and then find a corresponding cart by its ID. If :cart_id is not found , then it create a new Cart
def set_cart @cart = Cart.find(session[:cart_id]) rescue ActiveRecord::RecordNotFound @cart = Cart.create session[:cart_id] = @cart.id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_cart\n # check the session for the cart id\n @cart = Cart.find(session[:cart_id])\n # rescue (catch exception) will take over if the cart_id is not found\n # it will vreate a new cart and save the new cart's id\n rescue ActiveRecord::RecordNotFound\n @cart = Cart.create\n ...
[ "0.9051508", "0.90106505", "0.8969362", "0.89533335", "0.89330596", "0.89322525", "0.89322525", "0.8815856", "0.8721847", "0.87009484", "0.8620158", "0.84681386", "0.84264356", "0.8417843", "0.83530676", "0.8285271", "0.8151602", "0.8151602", "0.8151602", "0.8151602", "0.8151...
0.8725421
8
Verify that the JSON hash for this type has a key that matches its name.
def verify_integrity(object_data, entry) if object_data["policies"].empty? yield("Policy group #{object_data["name"]} does not have any policies in it.") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_key?(key)\n self.body.is_a?(Hash) && self.body.has_key?(key)\n end", "def has_key?(name)\n hashed.has_key? name\n end", "def validate_key!(key)\n unless key.is_a?(String) or key.is_a?(Symbol)\n raise SketchUpJSON::JSONEncodeError, \"This hash can not generate valid JSON\"\n e...
[ "0.6705622", "0.6551355", "0.6406341", "0.6332104", "0.625972", "0.6256355", "0.62547183", "0.62426096", "0.62335557", "0.61498994", "0.6133579", "0.6110299", "0.60828406", "0.60310787", "0.5996904", "0.59833115", "0.59604317", "0.59604317", "0.5951023", "0.5921163", "0.58853...
0.0
-1
GET /scores GET /scores.json
def index @scores = Score.all respond_to do |format| format.html format.csv { send_data Score.to_csv} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @scores = Score.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @scores }\n end\n end", "def scores\n response[\"scores\"]\n end", "def index\n @username_scores = UsernameScore.all\n\n respond_to do |format|\n for...
[ "0.78816223", "0.76711124", "0.7332223", "0.7273375", "0.72428125", "0.72428125", "0.72428125", "0.7223653", "0.72007906", "0.7164597", "0.70893115", "0.70399624", "0.70283324", "0.70283324", "0.7005825", "0.6971795", "0.6939399", "0.6871157", "0.68651736", "0.6834893", "0.68...
0.0
-1
GET /scores/1 GET /scores/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @scores = Score.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @scores }\n end\n end", "def show\n @score = Score.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sc...
[ "0.7671945", "0.73843235", "0.73843235", "0.73843235", "0.73413235", "0.71682507", "0.714384", "0.7032913", "0.700452", "0.6974586", "0.6917765", "0.6873204", "0.6859418", "0.6859418", "0.68282276", "0.680167", "0.67791915", "0.67552835", "0.6725018", "0.6674272", "0.66484296...
0.0
-1
POST /scores POST /scores.json
def create @score = Score.new(score_params) @score.user = current_user respond_to do |format| if @score.save format.html { redirect_to @score.goal, notice: 'Update was successfully created. Thanks for posting. You\'re awesome!' } format.json { render :show, status: :created, location: @score.goal } else #The "new" template references @goal and gets rendered when validation fails so we must set @goal. @goal = @score.goal format.html { render :new } format.json { render json: @score.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n score = current_user.scores.new(score_params)\n\n if score.save\n render json: score\n else\n render json: { errors: score.errors.join(',') }, status: 422\n end\n end", "def create\n @score = Score.new(score_params)\n if @score.save\n render json: @score, status: 20...
[ "0.75069267", "0.7396116", "0.72264963", "0.72264963", "0.7102729", "0.7102729", "0.7075778", "0.69180334", "0.68628573", "0.68499625", "0.6842346", "0.67576694", "0.67052865", "0.67030334", "0.6696168", "0.668016", "0.6678745", "0.66737896", "0.66692066", "0.6618131", "0.656...
0.5949888
70
PATCH/PUT /scores/1 PATCH/PUT /scores/1.json
def update @score.user = current_user respond_to do |format| if @score.update(score_params) format.html { redirect_to @score.goal, notice: 'Score was successfully updated.' } format.json { render :show, status: :ok, location: @score.goal } else format.html { render :edit } format.json { render json: @score.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @score = Score.find(params[:id])\n\n respond_to do |format|\n if @score.update_attributes(params[:score])\n format.html { redirect_to @score, notice: 'Score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit...
[ "0.7228637", "0.7228637", "0.7228637", "0.71737444", "0.7142025", "0.7020812", "0.7020812", "0.7020812", "0.7020812", "0.68898237", "0.6807742", "0.6746576", "0.67141646", "0.66702276", "0.6663457", "0.66392225", "0.66243273", "0.6576297", "0.6573947", "0.65723795", "0.656148...
0.6338375
35
DELETE /scores/1 DELETE /scores/1.json
def destroy @score.destroy respond_to do |format| format.html { redirect_to @score.goal, notice: 'Score was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @score.destroy\n respond_to do |format|\n format.html { redirect_to scores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @score = Score.find(params[:id])\n @score.destroy\n\n respond_to do |format|\n format.html { redirect_to scores_url }\n ...
[ "0.7736037", "0.77191144", "0.77191144", "0.77191144", "0.77191144", "0.7700453", "0.74788547", "0.7470438", "0.7470438", "0.74565727", "0.74565727", "0.74565727", "0.74565727", "0.74067026", "0.7325221", "0.7291442", "0.7267695", "0.7233835", "0.7157316", "0.7156617", "0.714...
0.73302567
14
Use callbacks to share common setup or constraints between actions.
def set_score @score = Score.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_...
[ "0.61642385", "0.60448", "0.5945487", "0.5915654", "0.58890367", "0.58330417", "0.5776098", "0.5703048", "0.5703048", "0.5654613", "0.5620029", "0.5423114", "0.540998", "0.540998", "0.540998", "0.5393666", "0.53783023", "0.53568405", "0.53391176", "0.5339061", "0.53310865", ...
0.0
-1
Internal: Constructor, executes given block within its instance. url The WebRocket backend endpoint URL to connect to.
def initialize(url, &block) super(url) @handlers = {} instance_eval(&block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(url)\n @url = url\n freeze\n end", "def initialize(url)\n @url = url\n end", "def initialize(url)\n @url = url\n end", "def initialize(url)\n self.url = url\n self\n end", "def initialize base_url, endpoint, params={}, &blk\n @url = base_url.dup\n...
[ "0.719171", "0.69881266", "0.6960245", "0.69566584", "0.69423246", "0.6896464", "0.68926066", "0.68872035", "0.6835307", "0.6767686", "0.6731819", "0.66148895", "0.65994966", "0.65975916", "0.6586494", "0.65141755", "0.64420563", "0.64037323", "0.63886756", "0.63867116", "0.6...
0.7576025
0
Internal: Logger property reader. Returns configured logger.
def logger @logger ||= Logger.new(STDOUT) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logger\n @logger ||= configuration.logger\n end", "def logger\n @logger ||= Logger.get_logger(config.robot.log_level, config.robot.log_formatter)\n end", "def logger\n self.configuration.logger\n end", "def logger\n return @logger ||= default_logger\n end", "def get_logg...
[ "0.70315874", "0.70034647", "0.6990928", "0.6917186", "0.6912544", "0.6895153", "0.68550277", "0.6853477", "0.68275434", "0.6819598", "0.67343044", "0.6721863", "0.66901183", "0.6672645", "0.6667073", "0.6667073", "0.66624534", "0.66004705", "0.65894663", "0.65758497", "0.655...
0.0
-1
Internal: Message dispatcher. message The Message to be dispatched.
def on_message(message) search_for = message.event.split("/") raise InvalidBackendEvent(message.event) if search_for.size < 2 klass = @handlers[search_for[0]] and handler = klass.method(search_for[1]) raise UndefinedHandler.new(message.event) unless handler logger.info("#{message.event}, #{message.inspect}") handler.call(message) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dispatch(message)\n Turntabler.run { @handler.call(message) } if @handler\n end", "def dispatch(t_msg)\n self.send(@dispatcher_block, t_msg)\n end", "def dispatch(message_payload)\n debug_me{[ :message_payload ]}\n raise ::SmartMessage::Errors::NotImplemented\n end", "def...
[ "0.76505184", "0.70578897", "0.7003588", "0.68390936", "0.6731348", "0.67144996", "0.6636114", "0.6612202", "0.6574509", "0.65562165", "0.6530059", "0.65270257", "0.6520933", "0.6406031", "0.6397448", "0.63766956", "0.6373217", "0.63703644", "0.63257337", "0.6312982", "0.6301...
0.61822176
29
Returns the full title on a perpage basis.
def full_title(page_title) base_title = "Scirate" if page_title.empty? base_title else sanitize("#{base_title} | #{page_title}") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def title\n @title_pages.each { |tp| tp.title and return tp.title }\n nil\n end", "def full_title(page_title)\n base_title = \"Proman 2013\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "def full_title(page_title)\n base_tit...
[ "0.79661685", "0.7838576", "0.782354", "0.778291", "0.7771004", "0.7731623", "0.7723927", "0.7688301", "0.768416", "0.7683897", "0.7669959", "0.7664185", "0.76503503", "0.7647503", "0.7639728", "0.76372623", "0.7627365", "0.7624781", "0.7611458", "0.7603172", "0.75916624", ...
0.7360912
56
, :default_url => "/images"
def auto_complete_info(field) { "id" => id, "label" => send(field), "value" => send(field) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_url\n \"/images/fallback/\" + [thumb, \"images.jpeg\"].compact.join('_')\n end", "def default_url\n \"http://placehold.it/330&text=pic\"\n end", "def default_url\n return '' #ActionController::Base.helpers.asset_path('common/no-image.png')\n end", "def default_url\n '/images/blank...
[ "0.7938529", "0.7887761", "0.7886708", "0.7830713", "0.78160155", "0.7793942", "0.7785783", "0.77641845", "0.77627164", "0.7644425", "0.7619371", "0.7558355", "0.7552572", "0.75099593", "0.74787855", "0.7469655", "0.7469629", "0.7457741", "0.74573034", "0.7451057", "0.7445617...
0.0
-1
GET /budget_dispositions GET /budget_dispositions.json
def index @budget_dispositions = BudgetDisposition.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_budget_disposition\n @budget_disposition = BudgetDisposition.find(params[:id])\n end", "def create\n @budget_disposition = BudgetDisposition.new(budget_disposition_params)\n\n respond_to do |format|\n if @budget_disposition.save\n format.html { redirect_to @budget_disposition, n...
[ "0.69621986", "0.6747142", "0.65880036", "0.65015346", "0.64244634", "0.6293919", "0.6024445", "0.5828227", "0.5822988", "0.58197314", "0.57955027", "0.57353747", "0.57170475", "0.571001", "0.5632934", "0.5566135", "0.5560328", "0.5510307", "0.5510189", "0.5498484", "0.541613...
0.77610767
0
GET /budget_dispositions/1 GET /budget_dispositions/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @budget_dispositions = BudgetDisposition.all\n end", "def set_budget_disposition\n @budget_disposition = BudgetDisposition.find(params[:id])\n end", "def create\n @budget_disposition = BudgetDisposition.new(budget_disposition_params)\n\n respond_to do |format|\n if @budget_di...
[ "0.77308786", "0.74474955", "0.71020854", "0.67548305", "0.6735005", "0.66933733", "0.62968636", "0.5973149", "0.59012806", "0.5814899", "0.58012754", "0.57986784", "0.5765477", "0.5748348", "0.5738187", "0.56662786", "0.55912507", "0.55602187", "0.5549196", "0.5547626", "0.5...
0.0
-1
POST /budget_dispositions POST /budget_dispositions.json
def create @budget_disposition = BudgetDisposition.new(budget_disposition_params) respond_to do |format| if @budget_disposition.save format.html { redirect_to @budget_disposition, notice: 'Budget disposition was successfully created.' } format.json { render :show, status: :created, location: @budget_disposition } else format.html { render :new } format.json { render json: @budget_disposition.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def budget_disposition_params\n params.require(:budget_disposition).permit(:disposition, :multiplier)\n end", "def set_budget_disposition\n @budget_disposition = BudgetDisposition.find(params[:id])\n end", "def index\n @budget_dispositions = BudgetDisposition.all\n end", "def destroy\n ...
[ "0.73375434", "0.7250868", "0.68422365", "0.6473303", "0.6440012", "0.6180949", "0.6084065", "0.5973414", "0.5951094", "0.5698744", "0.569085", "0.55731606", "0.5573036", "0.5571852", "0.55659294", "0.5515634", "0.54885304", "0.54866576", "0.54672825", "0.54313457", "0.542606...
0.750382
0
PATCH/PUT /budget_dispositions/1 PATCH/PUT /budget_dispositions/1.json
def update respond_to do |format| if @budget_disposition.update(budget_disposition_params) format.html { redirect_to @budget_disposition, notice: 'Budget disposition was successfully updated.' } format.json { render :show, status: :ok, location: @budget_disposition } else format.html { render :edit } format.json { render json: @budget_disposition.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_budget_disposition\n @budget_disposition = BudgetDisposition.find(params[:id])\n end", "def update\n respond_to do |format|\n if @budget.update(budget_params)\n Item.where([\"budget_id = #{params[:id]}\"]).update_all(budget_id: nil)\n if !params[:budget][:items].nil?\n ...
[ "0.69212234", "0.6739058", "0.671074", "0.65181684", "0.65181684", "0.6518101", "0.6495646", "0.64692473", "0.64692473", "0.635143", "0.63333243", "0.63155854", "0.63105243", "0.6295784", "0.6180135", "0.6180135", "0.6112057", "0.60848194", "0.6084", "0.60549945", "0.60515285...
0.75291187
0
DELETE /budget_dispositions/1 DELETE /budget_dispositions/1.json
def destroy @budget_disposition.destroy respond_to do |format| format.html { redirect_to budget_dispositions_url, notice: 'Budget disposition was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @budget = Budget.find(params[:id])\n @budget.destroy\n\n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @budget = Budget.find(params[:id])\n @budget.destroy\n respond_to do |format|\n ...
[ "0.7281517", "0.7269502", "0.70949566", "0.7084151", "0.7084151", "0.7084151", "0.70740753", "0.7050401", "0.701172", "0.6976154", "0.69011784", "0.69011784", "0.68741256", "0.6840713", "0.68227524", "0.68054706", "0.68032825", "0.68027854", "0.6773742", "0.6715634", "0.67127...
0.7829018
0
Use callbacks to share common setup or constraints between actions.
def set_budget_disposition @budget_disposition = BudgetDisposition.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_...
[ "0.61637366", "0.60446453", "0.59452957", "0.591511", "0.58885515", "0.5834122", "0.57761765", "0.5702554", "0.5702554", "0.5652102", "0.5619581", "0.5423898", "0.5409782", "0.5409782", "0.5409782", "0.5394745", "0.53780794", "0.5356209", "0.5338898", "0.53381324", "0.5328622...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def budget_disposition_params params.require(:budget_disposition).permit(:disposition, :multiplier) 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...
[ "0.6981606", "0.6784227", "0.6746523", "0.67439264", "0.67361516", "0.6593381", "0.6506166", "0.64994407", "0.6483518", "0.64797056", "0.64578557", "0.6441216", "0.63811713", "0.63773805", "0.6366333", "0.63217646", "0.6301816", "0.63009787", "0.6294436", "0.62940663", "0.629...
0.0
-1
Read an Array of associations an construct a list of joins.
def initialize(associations) @left_joins_by_alias = {} last_table_alias = nil associations.each_with_index do |association, association_path_index| # Important, this variable will take the last joined table to chain the join, in the first loop, will take # the association origin table name. last_table_alias ||= association.active_record.table_name left_join = Babik::QuerySet::Join.new_from_association(association, association_path_index, last_table_alias) @left_joins_by_alias[left_join.target_alias] = left_join last_table_alias = left_join.target_alias end @target_alias = last_table_alias end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def joins\n j = []\n associations.each do |association|\n next if association.conditions.blank?\n association_joins = association.joins\n j << (association_joins.blank? ? association.relationship_name.to_sym : {association.relationship_name.to_sym => association_joins})\n ...
[ "0.6928929", "0.67442495", "0.6362653", "0.6196695", "0.61632484", "0.60660857", "0.6052408", "0.59367466", "0.59101784", "0.5890045", "0.5771288", "0.577122", "0.57686675", "0.57619816", "0.571209", "0.5705028", "0.56838477", "0.56828475", "0.5679677", "0.56782037", "0.56460...
0.5328847
41
Table alias will be another way of calling target alias, i.e. the alias of the target table in the join, i.e. the alias of the last table in the join,
def table_alias @target_alias end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def join_table_alias\n final_reverse_edge[:alias]\n end", "def join_table_alias\n cached_fetch(:join_table_alias) do\n s, a = split_join_table_alias\n a || s\n end\n end", "def table_alias\n if @table_expr.is_a?(AliasedExpression)\n ...
[ "0.8225794", "0.7927469", "0.7660707", "0.76490885", "0.7555541", "0.7531295", "0.7316471", "0.71372074", "0.7100809", "0.6973801", "0.67246157", "0.662915", "0.6622338", "0.6613552", "0.66104305", "0.65168154", "0.65127563", "0.64374447", "0.6427763", "0.6421738", "0.6381008...
0.7912214
2
Parses the UserAgent header.
def parse_agent(header) # First of all match the agent and the version catch(:result) do Brauser::Definitions.browsers.each do |_, definition| result = definition.match(header) throw(:result, result) if result end nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_agent\n @headers['User-Agent']\n end", "def user_agent\n @headers['User-Agent']\n end", "def user_agent\n @headers['User-Agent']\n end", "def user_agent\n @data[\"user_agent\"]\n end", "def user_agent\n @request['User-Agent']\n end", "def user_agent\n h...
[ "0.7541631", "0.7541631", "0.7541631", "0.72222465", "0.7211566", "0.72098494", "0.7174478", "0.683791", "0.679635", "0.6720699", "0.6710837", "0.6710837", "0.6710837", "0.6710837", "0.6710837", "0.67092246", "0.66415197", "0.6640904", "0.6634285", "0.6634285", "0.66103154", ...
0.7256826
3
Parses a AcceptLanguage header.
def parse_accept_language(header) header.ensure_string.tokenize.reduce({}) do |rv, token| code, priority = token.split(";q=") rv[code.downcase.gsub("_", "-").to_sym] = priority.to_float if code && priority rv end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_locale_from_accept_language_header\n lang = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first\n logger.info \"INFO: Language #{lang} determined from header\"\n lang\n end", "def parse_accept_language(request)\n if request.env.has_key?('HTTP_ACCEPT_LANGUAGE')\n raw_loca...
[ "0.7873741", "0.7811968", "0.78054553", "0.7745025", "0.7745025", "0.7745025", "0.7692503", "0.7692503", "0.76456136", "0.76000434", "0.7525317", "0.7497771", "0.74538463", "0.73375404", "0.73282796", "0.72989047", "0.723541", "0.72315854", "0.69406384", "0.68051267", "0.6741...
0.8002823
0
Rails will automatically clear the prepared statements on the connection that runs the migration, so we use two connections to simulate what would actually happen on a production system; we'd have one connection running the migration from the rake task ("ddl_connection" here), and we'd have another connection in a web worker.
def with_two_connections run_without_connection do |original_connection| ActiveRecord::Base.establish_connection(original_connection.merge(pool_size: 2)) begin ddl_connection = ActiveRecord::Base.connection_pool.checkout begin yield original_connection, ddl_connection ensure ActiveRecord::Base.connection_pool.checkin ddl_connection end ensure ActiveRecord::Base.connection_handler.clear_all_connections!(:all) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect_to_migration_db\n ActiveRecord::Base.establish_connection(\n adapter: 'postgresql',\n encoding: 'unicode',\n pool: 10,\n url: ENV['MIGRATION_DB_URL']\n )\n ActiveRecord::Base.connection.execute(\n \"SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY;\"\n )\n end"...
[ "0.667434", "0.63986063", "0.6338498", "0.61706877", "0.6122626", "0.60099226", "0.5970621", "0.588453", "0.58387727", "0.58378017", "0.5826807", "0.5818792", "0.5788478", "0.5772368", "0.57700795", "0.57283413", "0.56930333", "0.5674189", "0.56420416", "0.5632278", "0.558766...
0.6326533
3
Set the list based on given options Parameters:: iDisplayedList (list,Boolean,Object,Object] >): The list of plugins
def setOptions(iDisplayedList) @DisplayedList = iDisplayedList set_item_count(@DisplayedList.size) # Refresh everything refresh_items(0, item_count) # Rearrange columns widths set_column_width(0, 20) set_column_width(1, Wx::LIST_AUTOSIZE) set_column_width(2, Wx::LIST_AUTOSIZE) # Compute minimal size self.min_size = [ [ column_width(0) + column_width(1) + column_width(2) + 8, 200 ].min, 0 ] # Resize lOldSize = self.parent.size self.parent.fit self.parent.size = lOldSize end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setOptions(iOptions)\n # Fill @DisplayedList\n @DisplayedList = []\n iOptions[:intPluginsOptions].each do |iPluginID, iPluginsList|\n iPluginsList.each do |iInstantiatedPluginInfo|\n iTagID, iActive, iOptions, iInstanceInfo = iInstantiatedPluginInfo\n lNewOptions = nil\n...
[ "0.69191194", "0.6261992", "0.593898", "0.5817813", "0.5803296", "0.5721271", "0.5721271", "0.56645054", "0.5652337", "0.56311727", "0.5503022", "0.54997313", "0.54895765", "0.54815525", "0.54806703", "0.542864", "0.54283994", "0.539834", "0.53696465", "0.53379446", "0.531614...
0.672963
1
Callback that returns item text Parameters:: iIdxItem (_Integer_): Item's index iIdxColumn (_Integer_): Column's index Return:: _String_: The text
def on_get_item_text(iIdxItem, iIdxColumn) rText = '' case iIdxColumn when 0 # Active checkbox rText = '' when 1 # Name of the integration plugin rText = @Controller.getIntegrationPlugins[@DisplayedList[iIdxItem][0]][:Title] when 2 # Tag ID rText = @DisplayedList[iIdxItem][1].join('/') if (rText.empty?) rText = 'Root' end else log_bug "Unknown column ID #{iIdxColumn} for text list display." end return rText end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_raw_text(item); end", "def update_raw_text(item); end", "def draw_item(index)\n rect = item_rect(index)\n self.contents.clear_rect(rect)\n item = @data[index]\n self.draw_text(rect.x, rect.y, rect.width, line_height, item.name)\n end", "def draw_item(index)\n item = @data[index]\n ...
[ "0.6517009", "0.6517009", "0.6172558", "0.61669695", "0.61089", "0.61009765", "0.60551107", "0.5950785", "0.5781272", "0.57670784", "0.57152414", "0.5681994", "0.5651192", "0.55756724", "0.55682904", "0.556658", "0.55589515", "0.555858", "0.5527521", "0.5522351", "0.54959536"...
0.78080064
0
Callback that returns item image Parameters:: iIdxItem (_Integer_): Item's index iIdxColumn (_Integer_): Column's index Return:: _Integer_: The image index
def on_get_item_column_image(iIdxItem, iIdxColumn) rIdxImage = '' case iIdxColumn when 0 rIdxImage = @ImageListManager.getImageIndex(@DisplayedList[iIdxItem][2]) do if (@DisplayedList[iIdxItem][2]) rImage = getGraphic('Checkbox_Checked.png') else rImage = getGraphic('Checkbox_UnChecked.png') end next rImage end when 1 rIdxImage = @ImageListManager.getImageIndex( [ Wx::Bitmap, @Controller.getIntegrationPlugins[@DisplayedList[iIdxItem][0]][:BitmapName] ] ) do next @Controller.getPluginBitmap(@Controller.getIntegrationPlugins[@DisplayedList[iIdxItem][0]]) end when 2 rIdxImage = @ImageListManager.getImageIndex( [ Tag, @DisplayedList[iIdxItem][1] ] ) do if (@DisplayedList[iIdxItem][4][1] == nil) # This Tag does not exist in this data. next getGraphic('UnknownTag.png') else next @Controller.getTagIcon(@DisplayedList[iIdxItem][4][1]) end end else log_bug "Unknown column ID #{iIdxColumn} for image list display." end return rIdxImage end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_get_item_column_image(i, col)\n -1\n end", "def item_position(index, for_image = false, img_width = 0)\n \tcase index\n \twhen 0\n \t\tcx = (for_image && img_width > 155) ? First_Item_Position[0] - img_width / 16 : First_Item_Position[0]\n cy = First_Item_Position[1]\n \twhen 1\n cx = Se...
[ "0.76061", "0.6759683", "0.64736825", "0.6387911", "0.6353573", "0.6155147", "0.6045588", "0.59840393", "0.59562355", "0.5776742", "0.57194483", "0.56841826", "0.5676793", "0.5626622", "0.562627", "0.5623312", "0.5610843", "0.558374", "0.55825144", "0.55677736", "0.55481476",...
0.78841496
0
Constructor Parameters:: iParent (Wx::Window): The parent window iController (_Controller_): The controller ioDisplayedItem ([String,Tag,Boolean,Object]): The item info to display ioNotifier (_Object_): Object to be notified when modifications occur iItemID (_Integer_): The item's ID being displayed in this panel
def initialize(iParent, iController, ioDisplayedItem, ioNotifier, iItemID) super(iParent) @Controller = iController @DisplayedItem = ioDisplayedItem # Components iController.accessIntegrationPlugin(@DisplayedItem[0]) do |iPlugin| @ConfigPanel = iPlugin.getConfigPanel(self, @Controller) end if (@ConfigPanel != nil) @ConfigPanel.setData(@DisplayedItem[3]) end lSTTag = Wx::StaticText.new(self, Wx::ID_ANY, 'Tag:') lSTTagName = Wx::StaticText.new(self, Wx::ID_ANY, @DisplayedItem[1].join('/')) if (lSTTagName.label.empty?) lSTTagName.label = 'Root' end lBBSelectTag = Wx::BitmapButton.new(self, Wx::ID_ANY, getGraphic('Tree.png')) lCBActive = Wx::CheckBox.new(self, Wx::ID_ANY, 'Active') lCBActive.value = @DisplayedItem[2] lBDelete = Wx::Button.new(self, Wx::ID_ANY, 'Delete') # Sizers lMainSizer = Wx::BoxSizer.new(Wx::VERTICAL) if (@ConfigPanel != nil) lMainSizer.add_item(@ConfigPanel, :flag => Wx::GROW, :proportion => 1) else lMainSizer.add_item([0,0], :flag => Wx::GROW, :proportion => 1) end lTagSizer = Wx::BoxSizer.new(Wx::HORIZONTAL) lTagSizer.add_item([8, 0], :proportion => 0) lTagSizer.add_item(lSTTag, :flag => Wx::ALIGN_CENTER, :proportion => 0) lTagSizer.add_item([8, 0], :proportion => 0) lTagSizer.add_item(lSTTagName, :flag => Wx::ALIGN_CENTER, :proportion => 0) lTagSizer.add_item([8, 0], :proportion => 0) lTagSizer.add_item(lBBSelectTag, :flag => Wx::ALIGN_CENTER, :proportion => 0) lTagSizer.add_item([0, 0], :proportion => 1) lMainSizer.add_item(lTagSizer, :flag => Wx::ALIGN_LEFT, :proportion => 0) lBottomSizer = Wx::BoxSizer.new(Wx::HORIZONTAL) lBottomSizer.add_item(lCBActive, :flag => Wx::ALIGN_CENTER, :proportion => 0) lBottomSizer.add_item([0, 0], :proportion => 1) lBottomSizer.add_item(lBDelete, :flag => Wx::ALIGN_CENTER, :proportion => 0) lMainSizer.add_item(lBottomSizer, :flag => Wx::GROW|Wx::ALL, :border => 8, :proportion => 0) self.sizer = lMainSizer self.fit # Events evt_checkbox(lCBActive) do |iEvent| @DisplayedItem[2] = lCBActive.value ioNotifier.refreshList end evt_button(lBBSelectTag) do |iEvent| require 'pbs/Windows/SelectTagDialog' showModal(SelectTagDialog, self, iController.RootTag, iController) do |iModalResult, iDialog| if (iModalResult == Wx::ID_OK) lTag = iDialog.getSelectedTag if (lTag != nil) # Fit lOldSize = self.size self.fit self.size = lOldSize # Modify underlying data @DisplayedItem[1] = iController.getTagID(lTag) # Update display lSTTagName.label = @DisplayedItem[1].join('/') if (lSTTagName.label.empty?) lSTTagName.label = 'Root' end # Notify for modification ioNotifier.refreshList end end end end evt_button(lBDelete) do |iEvent| # Delete this instance ioNotifier.deleteItem(iItemID) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def item\n IITWindow.new(@ole.Item)\n end", "def initialize(iParent)\n super(iParent)\n\n # This attribute will be changed only if the icon is changed.\n # It is used instead of the Wx::BitmapButton::bitmap_label because it can be nil, and in this case we don't want to replace it with the ...
[ "0.66518867", "0.6423833", "0.6347242", "0.62862265", "0.62478733", "0.62372005", "0.6140713", "0.5990815", "0.59888333", "0.5849258", "0.5799307", "0.5661639", "0.56314224", "0.5614135", "0.5614135", "0.55859834", "0.5580027", "0.5550135", "0.550876", "0.55036", "0.54672325"...
0.76265174
0
Get the options from the plugin specifics components Return:: _Object_: The options
def getOptions rOptions = nil if (@ConfigPanel != nil) rOptions = @ConfigPanel.getData end return rOptions end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_options\n @options\n end", "def get_options; end", "def options\n Properties[self.class] ||= {}\n return Properties[self.class][:opts] || []\n end", "def options\n return @options\n end", "def options\n @options\n end", "def options\n @options\n end", "d...
[ "0.7503896", "0.73976743", "0.7214447", "0.7124815", "0.70725524", "0.70725524", "0.7046827", "0.6986466", "0.69562936", "0.6926936", "0.6924953", "0.69107175", "0.69107175", "0.6897555", "0.6888648", "0.6888648", "0.68795866", "0.6855663", "0.68541914", "0.68541914", "0.6854...
0.65483505
47
Constructor Parameters:: iParent (Wx::Window): The parent window iController (_Controller_): The controller, used to get plugins specific data
def initialize(iParent, iController) super(iParent) @Controller = iController # The panel that will be instantiated dynamically to show plugins options @PluginOptionsPanel = nil # The corresponding displayed item info # [ String, Tag, Boolean, Object, Object ] @DisplayedItemInfo = nil # The context menu, created once on demand @NewMenu = nil # The displayed list info, stores the same info as PluginsOptions, but ensures that the order will not be altered. # The last object of each item is the instance info. It is used to keep track of the instantiated objects for this options. # list< [ String, Object, Boolean, Object, Object ] > @DisplayedList = [] # Components @IPLC = InstantiatedPluginsListCtrl.new(self, @Controller) lBAddNew = Wx::Button.new(self, Wx::ID_ANY, 'Add new') # Sizers lMainSizer = Wx::BoxSizer.new(Wx::HORIZONTAL) lLeftSizer = Wx::BoxSizer.new(Wx::VERTICAL) lLeftSizer.add_item(@IPLC, :flag => Wx::GROW, :proportion => 1) lLeftSizer.add_item(lBAddNew, :flag => Wx::ALIGN_LEFT, :proportion => 0) lMainSizer.add_item(lLeftSizer, :flag => Wx::GROW|Wx::ALL, :border => 2, :proportion => 0) self.sizer = lMainSizer self.fit # Events evt_list_item_selected(@IPLC) do |iEvent| lIdxItem = iEvent.index # Instantiate a config panel for this type resetOptionsPanel @DisplayedItemInfo = @DisplayedList[lIdxItem] @PluginOptionsPanel = InstantiatedPluginOptionsPanel.new(self, @Controller, @DisplayedItemInfo, self, lIdxItem) # Fit everything in sizers lMainSizer.add_item(@PluginOptionsPanel, :flag => Wx::GROW, :proportion => 1) lOldSize = self.size self.fit self.size = lOldSize end evt_button(lBAddNew) do |iEvent| # Create a menu that proposes to create a new integration plugin if (@NewMenu == nil) computeNewMenu end popup_menu(@NewMenu) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(iParent, iController, ioDisplayedItem, ioNotifier, iItemID)\n super(iParent)\n\n @Controller = iController\n @DisplayedItem = ioDisplayedItem\n\n # Components\n iController.accessIntegrationPlugin(@DisplayedItem[0]) do |iPlugin|\n @ConfigPanel = iPlugin.ge...
[ "0.6748708", "0.64048153", "0.62671834", "0.6058106", "0.5766032", "0.57188773", "0.57129645", "0.566767", "0.5564457", "0.5507786", "0.5477473", "0.5446162", "0.5406432", "0.53993624", "0.53988343", "0.53954536", "0.535711", "0.5353443", "0.5349497", "0.533656", "0.5314005",...
0.74214035
0
Computes the menu to create new plugin instances It is assumed that it is not created yet
def computeNewMenu @NewMenu = Wx::Menu.new @Controller.getIntegrationPlugins.each do |iPluginID, iPluginInfo| lNewMenuItem = Wx::MenuItem.new(@NewMenu, Wx::ID_ANY, iPluginInfo[:Title]) lNewMenuItem.bitmap = @Controller.getPluginBitmap(iPluginInfo) @NewMenu.append_item(lNewMenuItem) # The event # Clone variables to make them persistent in the Proc context lPluginIDCloned = iPluginID evt_menu(lNewMenuItem) do |iEvent| @Controller.accessIntegrationPlugin(lPluginIDCloned) do |iPlugin| @DisplayedList << [ lPluginIDCloned, [], true, iPlugin.getDefaultOptions, [ nil, nil ] ] end refreshList end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(iParent, iController)\n super(iParent)\n\n @Controller = iController\n # The panel that will be instantiated dynamically to show plugins options\n @PluginOptionsPanel = nil\n # The corresponding displayed item info\n # [ String, Tag, Boolean, Object, Object ]\n @Di...
[ "0.6755944", "0.6718588", "0.66341704", "0.6449072", "0.625689", "0.6113547", "0.60582703", "0.6034182", "0.6033074", "0.6011397", "0.60014606", "0.5992662", "0.59788173", "0.59691143", "0.594951", "0.5916151", "0.59057367", "0.5905183", "0.5899163", "0.5877358", "0.586464", ...
0.78988636
0
Deletes a given item ID, and refreshes everything. It is assumed that we delete the currently displayed item. Parameters:: iItemID (_Integer_): Item's ID to delete
def deleteItem(iItemID) @DisplayedList.delete_at(iItemID) resetOptionsPanel refreshList end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_item(iid)\n params = {'pio_iid' => iid}.merge(default_params)\n @connection.delete(:items, iid, params).body\n end", "def delete\n @@all_items.delete(@id)\n end", "def delete_item(item)\n @get_items.delete(item)\n end", "def delete_item(item_id)\n raise \"implemented ...
[ "0.69778365", "0.6484632", "0.64743775", "0.61818355", "0.6041111", "0.60343397", "0.60313344", "0.5983977", "0.59785616", "0.5916645", "0.59149075", "0.59109956", "0.58960646", "0.5861678", "0.585296", "0.58506215", "0.5840742", "0.5836069", "0.58234715", "0.58139986", "0.58...
0.81857693
0
Delete the last options panel
def resetOptionsPanel if (@PluginOptionsPanel != nil) # First, update options if needed updateOptionsFromPanel # Then destroy everything @PluginOptionsPanel.destroy @PluginOptionsPanel = nil @DisplayedItemInfo = nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_park\n nomPark = builder.get_object(\"label_nomPark1\").text\n indexComboPark = ctrl.del_park nomPark\n\n #Maj de la combo box\n combo_main.remove_text (indexComboPark+1)\n\n #Vidage des frames\n framePan.each{|child| framePan.remove(child)}\n framePar.each{|c...
[ "0.64275914", "0.63809437", "0.621978", "0.6132112", "0.6094402", "0.6078285", "0.60756516", "0.6074177", "0.6061505", "0.6031513", "0.59774905", "0.5936199", "0.5905609", "0.5866428", "0.58517456", "0.58454317", "0.58204246", "0.5814243", "0.57925177", "0.57741934", "0.57643...
0.6663158
0
Set current components based on options Parameters:: iOptions (map): Options
def setOptions(iOptions) # Fill @DisplayedList @DisplayedList = [] iOptions[:intPluginsOptions].each do |iPluginID, iPluginsList| iPluginsList.each do |iInstantiatedPluginInfo| iTagID, iActive, iOptions, iInstanceInfo = iInstantiatedPluginInfo lNewOptions = nil if (iOptions != nil) lNewOptions = iOptions.clone end # We clone the options as we might modify them @DisplayedList << [ iPluginID, iTagID, iActive, lNewOptions, iInstanceInfo ] end end # Reflect new data in sub components refreshList resetOptionsPanel end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fillOptions(oOptions)\n # Get options from the panel first if needed\n updateOptionsFromPanel\n # Then write options based on @DisplayedList\n oOptions[:intPluginsOptions] = {}\n @DisplayedList.each do |iItemInfo|\n iPluginID, iTagID, iActive, iOptions, iInstanceInfo = iItemInfo...
[ "0.62188643", "0.60244817", "0.5962893", "0.58470786", "0.5780535", "0.5753035", "0.5751695", "0.57319474", "0.57203776", "0.5690162", "0.5673145", "0.56696945", "0.56589377", "0.5654989", "0.5600867", "0.55872816", "0.5516838", "0.5498318", "0.549664", "0.54686195", "0.54482...
0.702636
0
Fill the options from the components Parameters:: oOptions (map): The options to fill
def fillOptions(oOptions) # Get options from the panel first if needed updateOptionsFromPanel # Then write options based on @DisplayedList oOptions[:intPluginsOptions] = {} @DisplayedList.each do |iItemInfo| iPluginID, iTagID, iActive, iOptions, iInstanceInfo = iItemInfo if (oOptions[:intPluginsOptions][iPluginID] == nil) oOptions[:intPluginsOptions][iPluginID] = [] end oOptions[:intPluginsOptions][iPluginID] << [ iTagID, iActive, iOptions, iInstanceInfo ] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def options *options\n if options.size > 0\n @options = {}\n options.each do |a|\n a.is_a?(Hash) ?\n @options.update(a) :\n a.is_a?(Array) ?\n @options.update(Hash[a.zip(a)]) :\n @options.update(a => a)\n end\n end\...
[ "0.6218216", "0.6080693", "0.60295355", "0.59740347", "0.5971983", "0.59451836", "0.59220105", "0.5883731", "0.5873031", "0.58471024", "0.5801353", "0.579005", "0.57790637", "0.5777951", "0.57699156", "0.5758175", "0.5737857", "0.5737857", "0.5737857", "0.5737857", "0.5737857...
0.7030409
0
GET /recruiters/1 GET /recruiters/1.xml
def show @recruiter = Recruiter.find(params[:id]) if current_user @followed = !!Following.find_by_follower_id_and_followed_id( current_user.id, @recruiter.id) @owner = ( current_user == @recruiter ) else @followed = false @owner = false end respond_to do |format| format.html # show.html.erb format.xml { render :xml => @recruiter } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @reviewers = Reviewer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @reviewers }\n end\n end", "def show\n \n@clicker = Clicker.find(params[:id])\n\n \nrespond_to do |format|\n \nformat.html # show.html.erb\n \nformat....
[ "0.61108154", "0.608639", "0.60768974", "0.6064563", "0.6008826", "0.5973534", "0.5972769", "0.5972369", "0.5965679", "0.59153306", "0.5911686", "0.5905343", "0.59045386", "0.58977807", "0.58820707", "0.58777", "0.5868482", "0.5858404", "0.58427405", "0.583971", "0.58370525",...
0.0
-1
GET /centro_costos GET /centro_costos.json
def index @centro_costos = CentroCosto.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cost(args = {})\n make_request(\n http_method: :get,\n endpoint: path_for(:cost),\n access_token: args.delete(:access_token),\n options: { query: args }\n )\n end", "def index\n @ccostos = Ccosto.all\n end", "def index\n @tipocosto...
[ "0.6785156", "0.65860975", "0.63659513", "0.6364177", "0.6351436", "0.6292135", "0.6270084", "0.6270084", "0.62329215", "0.6197947", "0.61560553", "0.6131853", "0.6068506", "0.606479", "0.59888905", "0.5985925", "0.59632605", "0.5953171", "0.5920119", "0.59090984", "0.5901254...
0.7326748
0
GET /centro_costos/1 GET /centro_costos/1.json
def show add_breadcrumb "Detalles", @centro_costos end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @centro_costos = CentroCosto.all\n end", "def cost(args = {})\n make_request(\n http_method: :get,\n endpoint: path_for(:cost),\n access_token: args.delete(:access_token),\n options: { query: args }\n )\n end", "def index\n ...
[ "0.70274377", "0.65940964", "0.6374443", "0.62836397", "0.6273402", "0.6273402", "0.62732196", "0.6262636", "0.62378925", "0.62059826", "0.6200402", "0.6195789", "0.61695504", "0.61599344", "0.61543995", "0.6144874", "0.61176944", "0.6115849", "0.6092403", "0.60881674", "0.60...
0.56316924
87
POST /centro_costos POST /centro_costos.json
def create @centro_costo = CentroCosto.new(centro_costo_params) respond_to do |format| if @centro_costo.save format.html { redirect_to centro_costos_path, notice: 'Centro de Costo creado exitosamente' } format.json { render :show, status: :created, location: @centro_costo } else format.html { render :new } format.json { render json: @centro_costo.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def centro_costo_params\n params.require(:centro_costo).permit(:codigo, :nombre, :activo)\n end", "def create\n @ccosto = Ccosto.new(ccosto_params)\n\n respond_to do |format|\n if @ccosto.save\n format.html { redirect_to @ccosto, notice: 'Ccosto was successfully created.' }\n format....
[ "0.7058624", "0.6828289", "0.6753588", "0.6685221", "0.6600552", "0.6513586", "0.6478978", "0.64098734", "0.63067067", "0.62661064", "0.6206627", "0.6191736", "0.61815053", "0.61765254", "0.61681783", "0.6158749", "0.6144872", "0.6131173", "0.61231875", "0.6115019", "0.610078...
0.7294903
0
PATCH/PUT /centro_costos/1 PATCH/PUT /centro_costos/1.json
def update respond_to do |format| if @centro_costo.update(centro_costo_params) format.html { redirect_to centro_costo_path, notice: 'Centro de Costo actualizado exitosamente' } format.json { render :show, status: :ok, location: @centro_costo } else format.html { render :edit } format.json { render json: @centro_costo.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n respond_to do |format|\n if @ccosto.update(ccosto_params)\n format.html { redirect_to @ccosto, notice: 'Ccosto was successfully updated.' }\n format.json { render :show, status:...
[ "0.6567607", "0.6557392", "0.6556047", "0.6513072", "0.6421222", "0.639997", "0.63933754", "0.63143456", "0.6287113", "0.6274556", "0.6260632", "0.62603235", "0.623741", "0.6229728", "0.6226767", "0.61996907", "0.61996907", "0.6188598", "0.6177317", "0.6173111", "0.6172883", ...
0.69974095
0
DELETE /centro_costos/1 DELETE /centro_costos/1.json
def destroy @centro_costo.destroy respond_to do |format| format.html { redirect_to centro_costos_url, notice: 'Centro de Costo eliminado' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @cost.destroy\n respond_to do |format|\n format.html { redirect_to ficha_costs_url(@ficha), notice: 'Cost was successfully destroyed.' }\n format.json { head :no_content }\n en...
[ "0.7294015", "0.7162337", "0.70048165", "0.6972276", "0.6912064", "0.6909448", "0.6899358", "0.68738157", "0.6831462", "0.68055904", "0.680535", "0.6804841", "0.67975926", "0.6796875", "0.67801994", "0.67797905", "0.6767414", "0.67672", "0.6734766", "0.67324346", "0.67314357"...
0.7441441
0
Use callbacks to share common setup or constraints between actions.
def set_centro_costo @centro_costo = CentroCosto.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_...
[ "0.61637366", "0.60446453", "0.59452957", "0.591511", "0.58885515", "0.5834122", "0.57761765", "0.5702554", "0.5702554", "0.5652102", "0.5619581", "0.5423898", "0.5409782", "0.5409782", "0.5409782", "0.5394745", "0.53780794", "0.5356209", "0.5338898", "0.53381324", "0.5328622...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def centro_costo_params params.require(:centro_costo).permit(:codigo, :nombre, :activo) 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...
[ "0.6981606", "0.6784227", "0.6746523", "0.67439264", "0.67361516", "0.6593381", "0.6506166", "0.64994407", "0.6483518", "0.64797056", "0.64578557", "0.6441216", "0.63811713", "0.63773805", "0.6366333", "0.63217646", "0.6301816", "0.63009787", "0.6294436", "0.62940663", "0.629...
0.0
-1
Wait for some time before issuing more commands
def wait(duration) info "Request from Experiment Script: Wait for #{duration}s...." warn "Calling 'wait' or 'sleep' will block entire EC event loop. Please try 'after' or 'every'" sleep duration end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait\n sleep 0.0001\n end", "def wait\n sleep WAIT_TIME unless @skip_wait\n end", "def send_blocking_command(command, _timeout, &block); end", "def brute_wait(delay)\n sleep(delay)\n end", "def wait; end", "def wait; end", "def wait; end", "def abs_wait_short\n wait(15)\n ...
[ "0.68507415", "0.6849631", "0.683165", "0.6795435", "0.6735744", "0.6735744", "0.6735744", "0.6689745", "0.66779584", "0.6668865", "0.66639864", "0.66214496", "0.6619672", "0.6590024", "0.6557539", "0.6541646", "0.65317523", "0.65200585", "0.6495074", "0.6487178", "0.6471658"...
0.6117702
56
Parse the dockercompose config
def parse_docker_compose_config(filepath) f = File.read(filepath) f = f.gsub(/\$([a-zA-Z_]+[a-zA-Z0-9_]*)|\$\{(.+)\}/) { ENV[$1 || $2] } config = YAML.load(f) unless config config = YAML.load('{}') end case (config['version']) when 2,'2' parse_version_2(config) else parse_version_1(config) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_config(config); end", "def get_containers\n content = YAML::load(File.read(docker_compose_file))\n content.has_key?('version') ? content['services'].keys : content.keys\n end", "def parse_cloud_config\n cloud_config = YAML.load(File.read('config/cloud.yml'))\n check_cloud_config(cloud_co...
[ "0.6606603", "0.6316332", "0.6270446", "0.6120003", "0.60112953", "0.59782535", "0.5969016", "0.59553677", "0.5862404", "0.5851343", "0.5842463", "0.5821912", "0.5799432", "0.57783675", "0.573017", "0.57300794", "0.56854707", "0.56507194", "0.5616287", "0.5579581", "0.5565285...
0.79779786
0
def ssl_required? return false if ['development'].include?(Rails.env) (ENV['Rails.env'] == "production" || !local_request?) && (self.class.read_inheritable_attribute(:ssl_required_actions) || []).include?(action_name.to_sym) end
def send_email(commented_on_user_model, commenting_user_id, email_subject, email_text) commenting_user = User.find(commenting_user_id) # create email and send it to right recipients depending on their roles if is_internal? # mail going from us to client UserMailer.comment_email_from_us(commented_on_user_model, commenting_user, email_subject, email_text).deliver else # mail from client to us, get user email id UserMailer.comment_email_to_us(commented_on_user_model, commenting_user, email_subject, email_text).deliver end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ssl_required?\n return ENV['SSL'] == 'on' ? true : false if defined? ENV['SSL']\n return false if local_request?\n return false if RAILS_ENV == 'test'\n ((self.class.read_inheritable_attribute(:ssl_required_actions) || []).include?(action_name.to_sym)) && (::Rails.env == 'production...
[ "0.94412726", "0.9290819", "0.8948443", "0.89374906", "0.89069986", "0.8906167", "0.85058826", "0.8401236", "0.8351457", "0.83350784", "0.8328271", "0.8286655", "0.8237679", "0.82315457", "0.8223395", "0.81942016", "0.81531745", "0.81353915", "0.8097923", "0.8061097", "0.8027...
0.0
-1
GET /direccions or /direccions.json
def index @direccions = Direccion.all @usuarios = Usuario.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n\t\t@direccions = Direccion.where(:personas_id => session[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml { render :xml => @direccions }\n\t\tend\n\tend", "def index\n @direccions = Direccion.recientes.all\n end", "def index\n @direcciones = Direccio...
[ "0.6326877", "0.62818307", "0.61861676", "0.6122747", "0.5980716", "0.5931203", "0.58664256", "0.57555455", "0.56848854", "0.5678653", "0.56385267", "0.5634942", "0.5614392", "0.5555357", "0.5514184", "0.5493967", "0.5486325", "0.54861385", "0.5473268", "0.54556197", "0.54222...
0.59248644
6
GET /direccions/1 or /direccions/1.json
def show @usuarios = Usuario.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @direccions = Direccion.recientes.all\n end", "def show\n\t\t@direccion = Direccion.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 => @direccion }\n\t\tend\n\tend", "def index\n\t\t@direccions = Direccion.where(:personas_id =>...
[ "0.6284443", "0.61956173", "0.60926586", "0.60449827", "0.5975937", "0.58851844", "0.5705224", "0.5618293", "0.5615223", "0.55837756", "0.5525893", "0.55220413", "0.55220413", "0.55220413", "0.5419309", "0.54111534", "0.5391869", "0.53723663", "0.5348307", "0.5287637", "0.528...
0.0
-1
POST /direccions or /direccions.json
def create @direccion = Direccion.new(direccion_params) respond_to do |format| if @direccion.save format.html { redirect_to @direccion, notice: "Direccion was successfully created." } format.json { render :show, status: :created, location: @direccion } else format.html { render :new, status: :unprocessable_entity } format.json { render json: @direccion.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @direccion = Direccion.new(direccion_params)\n\n respond_to do |format|\n if @direccion.save\n format.html { redirect_to @direccion, notice: 'Direccion was successfully created.' }\n format.json { render :show, status: :created, location: @direccion }\n else\n form...
[ "0.6509631", "0.6509631", "0.64638233", "0.6381088", "0.6187963", "0.5819504", "0.57219005", "0.5664499", "0.56410456", "0.5621188", "0.55979955", "0.55471677", "0.5409324", "0.54055405", "0.54055405", "0.54055405", "0.5399822", "0.53937155", "0.5391935", "0.53786135", "0.536...
0.6460282
3
PATCH/PUT /direccions/1 or /direccions/1.json
def update respond_to do |format| if @direccion.update(direccion_params) format.html { redirect_to @direccion, notice: "Direccion was successfully updated." } format.json { render :show, status: :ok, location: @direccion } else format.html { render :edit, status: :unprocessable_entity } format.json { render json: @direccion.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @direcciont.update(direcciont_params)\n format.html { redirect_to @direcciont, notice: 'Direcciont was successfully updated.' }\n format.json { render :show, status: :ok, location: @direcciont }\n else\n format.html { render :edit }\n ...
[ "0.67719525", "0.67710596", "0.67710596", "0.6545409", "0.64954877", "0.59979624", "0.58053875", "0.58053875", "0.58053875", "0.57442564", "0.57146865", "0.54988784", "0.5495549", "0.5490942", "0.54889345", "0.54677504", "0.5439647", "0.5416708", "0.53933394", "0.53810406", "...
0.6702643
3
DELETE /direccions/1 or /direccions/1.json
def destroy @direccion.destroy respond_to do |format| format.html { redirect_to direccions_url, notice: "Direccion was successfully destroyed." } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @direccion = Direccion.find(params[:id])\n @direccion.destroy\n\n respond_to do |format|\n format.html { redirect_to(direccions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @direccion.destroy\n respond_to do |format|\n format.html { redirect_to di...
[ "0.69993556", "0.69964486", "0.6976087", "0.69190615", "0.68378603", "0.6664612", "0.6619372", "0.6524924", "0.6508782", "0.6498187", "0.6358465", "0.63483185", "0.63311505", "0.63211226", "0.62965685", "0.6290908", "0.6269525", "0.62155044", "0.61841923", "0.61697465", "0.61...
0.69874483
2
Use callbacks to share common setup or constraints between actions.
def set_direccion @direccion = Direccion.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_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a list of trusted parameters through.
def direccion_params params.require(:direccion).permit(:calle, :ciudad, :estado, :usuario_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.63264...
0.0
-1
GET /cheques/1 GET /cheques/1.xml
def show @cheque = Cheque.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @cheque } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @cuitcheques = Cuitcheque.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cuitcheques }\n end\n end", "def show\n @clique = Clique.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml ...
[ "0.6655811", "0.66021615", "0.6539009", "0.6518552", "0.60720074", "0.5895123", "0.5893208", "0.5839004", "0.581831", "0.5813481", "0.5800671", "0.5778644", "0.57686514", "0.5764082", "0.5760015", "0.5749594", "0.57476246", "0.5735845", "0.57335526", "0.5726932", "0.5726932",...
0.67426044
0
GET /cheques/new GET /cheques/new.xml
def new @cheque = Cheque.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @cheque } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @estoques = Estoque.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estoques }\n end\n end", "def new\n @cuitcheque = Cuitcheque.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cu...
[ "0.7387736", "0.70436615", "0.7031948", "0.67729795", "0.6756301", "0.6718379", "0.6718379", "0.67134607", "0.66868156", "0.6647934", "0.66468835", "0.663339", "0.66110694", "0.6582993", "0.6570813", "0.6552984", "0.65463495", "0.65318775", "0.65318775", "0.65318775", "0.6531...
0.7453217
0
POST /cheques POST /cheques.xml
def create @cheque = Cheque.new(params[:cheque]) respond_to do |format| if @cheque.save format.html { redirect_to(@cheque, :notice => 'Cheque was successfully created.') } format.xml { render :xml => @cheque, :status => :created, :location => @cheque } else format.html { render :action => "new" } format.xml { render :xml => @cheque.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @estoques = Estoque.new(params[:estoque])\n\n respond_to do |format|\n if @estoques.save\n flash[:notice] = 'ESTOQUE CADASTRADO COM SUCESSO.'\n format.html { redirect_to(@estoques) }\n format.xml { render :xml => @estoques, :status => :created, :location => @estoques }...
[ "0.60702723", "0.58428115", "0.57412964", "0.57381254", "0.5726783", "0.55949235", "0.5580759", "0.5567607", "0.5536643", "0.5468899", "0.54524326", "0.5443867", "0.54212666", "0.5402611", "0.53961575", "0.5374468", "0.5369453", "0.53592515", "0.5352167", "0.5334348", "0.5316...
0.62130535
0
PUT /cheques/1 PUT /cheques/1.xml
def update @cheque = Cheque.find(params[:id]) respond_to do |format| if @cheque.update_attributes(params[:cheque]) format.html { redirect_to(@cheque, :notice => 'Cheque was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @cheque.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @clique = Clique.find(params[:id])\n\n respond_to do |format|\n if @clique.update_attributes(params[:clique])\n flash[:notice] = 'Clique was successfully updated.'\n format.html { redirect_to(@clique) }\n format.xml { head :ok }\n else\n format.html { rende...
[ "0.64181995", "0.60930455", "0.6028687", "0.5976326", "0.59259474", "0.5873178", "0.57947415", "0.57104594", "0.5710329", "0.5618434", "0.5527651", "0.55190915", "0.5513461", "0.5484772", "0.54317504", "0.53919625", "0.5388924", "0.5387439", "0.5382525", "0.5373268", "0.53576...
0.629422
1
DELETE /cheques/1 DELETE /cheques/1.xml
def destroy @cheque = Cheque.find(params[:id]) @cheque.destroy respond_to do |format| format.html { redirect_to(cheques_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @clique = Clique.find(params[:id])\n @clique.destroy\n\n respond_to do |format|\n format.html { redirect_to(cliques_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @cuitcheque = Cuitcheque.find(params[:id])\n @cuitcheque.destroy\n respond_to do |format...
[ "0.7180585", "0.687668", "0.6647216", "0.6565709", "0.6500433", "0.64889586", "0.64677894", "0.6458852", "0.6387648", "0.63872004", "0.6303656", "0.62251866", "0.619448", "0.6191193", "0.6182754", "0.61510056", "0.6148292", "0.6148207", "0.61203957", "0.6105418", "0.6090641",...
0.709768
1
GET /prestamos/1 GET /prestamos/1.xml
def show @prestamo = Prestamo.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @prestamo } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @st_pis = StPi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @st_pis }\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 inde...
[ "0.6138793", "0.60724866", "0.60638034", "0.60586303", "0.599951", "0.599951", "0.5914801", "0.5906888", "0.59062976", "0.5895699", "0.58905447", "0.588646", "0.58683026", "0.5857595", "0.5857277", "0.58500624", "0.58297074", "0.5825895", "0.581997", "0.5803324", "0.5802363",...
0.6564899
0
GET /prestamos/new GET /prestamos/new.xml
def new @prestamo = Prestamo.new @prestamo.cuotas = 1 @prestamo.total = 0 @prestamo.tasa = 0 @prestamo.usuario_id = params[:usuario_id] if params[:usuario_id] respond_to do |format| format.html # new.html.erb format.xml { render :xml => @prestamo } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 @nostro = Nostro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nostro }\n ...
[ "0.68524563", "0.66879123", "0.66777635", "0.6674897", "0.6656069", "0.6607641", "0.6562857", "0.6562857", "0.65488243", "0.65257025", "0.6510431", "0.64940304", "0.6474971", "0.6456418", "0.64541215", "0.6445867", "0.6435338", "0.64350617", "0.64318913", "0.6426936", "0.6424...
0.0
-1
POST /prestamos POST /prestamos.xml
def create @prestamo = Prestamo.new(params[:prestamo]) respond_to do |format| if @prestamo.save flash[:notice] = 'Prestamo creado correctamente.' format.html { params[:oper].nil? ? redirect_to(@prestamo) : render(:text => "Ok")} else format.html { render :action => "new" } format.xml { render :xml => @prestamo.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @prestamo = Prestamo.new(prestamo_params)\n\n respond_to do |format|\n if @prestamo.save\n format.html { redirect_to @prestamo, notice: \"Prestamo was successfully created.\" }\n format.json { render :show, status: :created, location: @prestamo }\n else\n format.ht...
[ "0.6255365", "0.620927", "0.6024321", "0.5902372", "0.5800567", "0.56710964", "0.5641034", "0.5627036", "0.5626381", "0.5613767", "0.5581263", "0.5567675", "0.55472106", "0.5545843", "0.5541433", "0.5538299", "0.553406", "0.5529971", "0.5513123", "0.5482544", "0.54755646", ...
0.54957235
19
PUT /prestamos/1 PUT /prestamos/1.xml
def update @prestamo = Prestamo.find(params[:id]) respond_to do |format| if @prestamo.update_attributes(params[:prestamo]) flash[:notice] = 'Prestamo actualizado correctamente.' format.html { redirect_to(@prestamo) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @prestamo.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def put...
[ "0.63080627", "0.61606705", "0.59915984", "0.5715957", "0.5708433", "0.55199146", "0.54425764", "0.53848535", "0.5369994", "0.53110605", "0.53110605", "0.53043723", "0.5281275", "0.5270303", "0.52490264", "0.5237883", "0.51873213", "0.5171205", "0.5169727", "0.51641375", "0.5...
0.5635301
5
DELETE /prestamos/1 DELETE /prestamos/1.xml
def destroy @prestamo = Prestamo.find(params[:id]) @prestamo.destroy respond_to do |format| format.html { redirect_to(prestamos_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def delete()\n response = send_post_reques...
[ "0.6715026", "0.66078854", "0.6588819", "0.6460144", "0.63202566", "0.6288983", "0.62667924", "0.6260668", "0.6241557", "0.6235021", "0.62097764", "0.62097764", "0.62097764", "0.62097764", "0.62097764", "0.6177983", "0.61665094", "0.61661965", "0.6160179", "0.6156514", "0.615...
0.70668966
0
default_scope :order => "created_at DESC"
def cast Kernel.const_get(objeto_classe).find(objeto_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_sort\n 'created_at desc'\n end", "def default_sort\n { order: :created_at, direction: :desc }\n end", "def with_default_ordering\n order(:start_time)\n end", "def recent\n self.order('created_at DESC')\n end", "def default_ordered_on; 'published_at' end", "...
[ "0.81672114", "0.7505303", "0.6881794", "0.6753567", "0.6623581", "0.66032887", "0.6595906", "0.65809405", "0.65367526", "0.65367526", "0.65153205", "0.651149", "0.6445809", "0.6394111", "0.6393115", "0.6343962", "0.6336544", "0.6302993", "0.6286363", "0.6282977", "0.6275646"...
0.0
-1
GET /documents/1 GET /documents/1.xml
def show @document = Document.find(:first, :conditions => ["id = ?", params[:id]]) respond_to do |format| format.html # new.html.erb format.xml { render :xml => @document } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_document index, id\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}\")\n req = Net::HTTP::Get.new(uri)\n run(uri, req)\n end", "def index\n @docs = Doc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @docs }\n end\n en...
[ "0.7194724", "0.70446724", "0.70299417", "0.702104", "0.702104", "0.69994307", "0.6873466", "0.68399405", "0.68399405", "0.68398774", "0.68381006", "0.6821465", "0.68133855", "0.67824036", "0.6740979", "0.67080915", "0.66573036", "0.6656229", "0.65442586", "0.6539844", "0.648...
0.67469215
14
GET /documents/new GET /documents/new.xml
def new @document = Document.new respond_to do |format| format.js { @document.user_id = params[:user_id] if params[:user_id] @document.title = params[:title] if params[:title] if @document.save render :js => "(function(){T8Writer.Core.createDocument.success(#{@document.id},'#{@document.title}');})();" else render :js => "(function(){T8Writer.Core.createDocument.errors('#{@document.errors}','#{@document.title}');})();" end } format.html # new.html.erb format.xml { render :xml => @document } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @document = Document.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @document }\n end\n end", "def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @d...
[ "0.7681931", "0.76688975", "0.75582725", "0.75155044", "0.750648", "0.73022234", "0.7266488", "0.7220133", "0.71671677", "0.7164488", "0.7143675", "0.7086671", "0.70654833", "0.70649886", "0.70623195", "0.70600325", "0.7048578", "0.70401603", "0.70401603", "0.70401603", "0.70...
0.0
-1