query
stringlengths
7
6.41k
document
stringlengths
12
28.8k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
5
10
document_rank
stringclasses
2 values
DELETE /time_entries/1 DELETE /time_entries/1.json
def destroy @time_entry = TimeEntry.with_deleted.find(params[:id]) @time_entry.destroy respond_to do |format| format.html { redirect_to time_entries_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @time_entry = TimeEntry.find(params[:id])\n @time_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to time_entries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @time_entry = TimeEntry.find(params[:id])\n @time_entry.destroy\n\n ...
[ "0.7719302", "0.7719302", "0.76278114", "0.7478545", "0.7295813", "0.7199814", "0.7171503", "0.7127114", "0.71220833", "0.70302796", "0.7028067", "0.6914805", "0.68997574", "0.688539", "0.6842422", "0.6842422", "0.680404", "0.67957485", "0.6791183", "0.6777039", "0.67686486",...
0.77798426
0
Runs a string given in input as Ruby code or buffers it if the command is incomplete Test against level or input to check if the command has been executed
def run str @input ||= '' @level += str.scan(LEVEL_UP).length @level -= str.scan(/(^|\s)end($|\s)/).length # Will probably fail with a character chain @input += str + "\n" if @level <= 0 tmp = input reset eval tmp, context end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_cmd(input); end", "def run_cmd(input)\n return @session.process(input,false)\n end", "def run_cmd(input)\n return self.process(input,false)\n end", "def execute_ruby(cmd, inp)\n begin\n cmd = Shellwords.shellsplit(cmd)\n rescue ArgumentError\n return \"command parse error: `#{...
[ "0.7114369", "0.644145", "0.6441347", "0.6322234", "0.6249415", "0.60236907", "0.6014585", "0.60128856", "0.6012476", "0.59657735", "0.5920252", "0.5905936", "0.58889264", "0.58597136", "0.58594006", "0.5851312", "0.58317167", "0.582933", "0.58111656", "0.5752191", "0.5741972...
0.6703683
1
Return size, always 3.
def size return 3 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size\n 4\n end", "def size; @size end", "def size\n @length / 4\n end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; e...
[ "0.8232413", "0.80479515", "0.8037623", "0.7920683", "0.7920683", "0.7920683", "0.7920683", "0.7920683", "0.7920683", "0.7920683", "0.7920683", "0.7920683", "0.7920683", "0.7920683", "0.7920683", "0.7920683", "0.7920683", "0.7920683", "0.7920683", "0.7920683", "0.7920683", ...
0.894307
0
Get the exterior product.
def exterior_product(vec) self.class.exterior_product(self, vec) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def part_of_product\n if @related_material\n @related_material.part_of_products.first\n end\n end", "def base_product\n product_num\n end", "def product\n Product.find_by_outer_id(outer_id) || Product.find_by_num_iid(num_iid)\n end", "def por_extenso\n Extenso.por_extenso(self)...
[ "0.6379086", "0.6274137", "0.6236722", "0.6161754", "0.5983231", "0.5828853", "0.57838136", "0.5726747", "0.571657", "0.56586814", "0.5651687", "0.56505424", "0.56427383", "0.55954325", "0.55954325", "0.5546749", "0.54802054", "0.5415928", "0.5413329", "0.54127514", "0.539460...
0.6473815
0
finding instrument user clicked on and creating inctance of booking for form
def show @instrument = Instrument.find(params[:id]) @booking = Booking.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @booking = @instrument.bookings.new(booking_params)\n @booking.user = current_user\n respond_to do |format|\n if @booking.save\n format.html { redirect_to @booking, notice: t('.success') }\n format.json { render :show, status: :created, location: @booking }\n else\n ...
[ "0.590109", "0.58447176", "0.57752013", "0.5624643", "0.5611555", "0.55997604", "0.55992717", "0.55907995", "0.5579643", "0.5565253", "0.55044836", "0.55027217", "0.5495404", "0.5493622", "0.54798585", "0.5456145", "0.5451069", "0.5450739", "0.5447786", "0.5441641", "0.543879...
0.5966437
0
now actually creating the new instrument with user params and saving it rendering new page if user did not input all params
def create @instrument = Instrument.new(instrument_params) @instrument.user = current_user if @instrument.save redirect_to instrument_path(@instrument), notice: 'Created new instrument.' else render :new end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n p \"*******INST CREATE*********\"\n user = User.find_by(id: session[:user_id])\n instrument = user.instruments.build(instrument_params)\n if instrument.save\n render json: instrument, status: :created\n else\n render json: {error: \"Not Created\"}, status: :not_created\n en...
[ "0.6965199", "0.6878428", "0.6794587", "0.6776414", "0.6501877", "0.64043325", "0.639236", "0.6371121", "0.6355526", "0.6307005", "0.6291374", "0.6257015", "0.6242751", "0.6237534", "0.6237511", "0.6214765", "0.62130183", "0.6210843", "0.6204317", "0.6187289", "0.61665154", ...
0.6991258
0
finding instrument to destroy destroying the instrument redirecting to root_path
def destroy @instrument = Instrument.find(params[:id]) @instrument.destroy redirect_to root_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n log_out\n redirected_to root_url\n end", "def destroy\n @instrument = Instrument.find(params[:id])\n @instrument.destroy\n\n respond_to do |format|\n format.html { redirect_to(instruments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n log_out if logged_...
[ "0.66026914", "0.6579177", "0.65782744", "0.63811505", "0.6361402", "0.6350783", "0.6333396", "0.6294609", "0.6234069", "0.62336135", "0.6205419", "0.6205419", "0.61742634", "0.61619437", "0.61619437", "0.61340487", "0.6130461", "0.6129906", "0.6086645", "0.6060793", "0.60301...
0.6830277
0
finding instrument to update updating instrument with user_params redirecting to instrument_path
def update @instrument = Instrument.find(params[:id]) @instrument.update(instrument_params) redirect_to instrument_path(@instrument) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @instrument = Instrument.find(params[:id])\n @person = @instrument.person\n @participant = @person.participant\n\n respond_to do |format|\n if @instrument.update_attributes(params[:instrument])\n\n redirect_path = @participant ? participant_path(@participant) : person_...
[ "0.69305575", "0.69022447", "0.68359554", "0.6640227", "0.6536821", "0.6509439", "0.6470895", "0.6465339", "0.6367576", "0.6351798", "0.6343359", "0.63422906", "0.63205796", "0.630853", "0.6302393", "0.62972105", "0.6296563", "0.62776315", "0.62370056", "0.62232256", "0.62066...
0.7233495
0
Implicitly hints that a uniform exists.
def uniform_location(uniform_name) uniform_sym = uniform_name.to_sym @uniform_locations[uniform_sym] ||= Gl.glGetUniformLocation(@name, uniform_name.to_s) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bind_uniform(name, location)\n return if location == NO_UNIFORM\n value = self[name]\n return unless value\n\n type, length, address =\n if value.kind_of? PackedValue\n [value.type, value.length, value.value]\n elsif value.respond_to? :address\n [value.class, value.length, v...
[ "0.6586444", "0.6070382", "0.6019188", "0.58786976", "0.5696789", "0.5485203", "0.5438191", "0.52530164", "0.5137256", "0.5043726", "0.5036066", "0.50084376", "0.49949974", "0.49572346", "0.476907", "0.47566202", "0.46102747", "0.4549433", "0.4522176", "0.44944403", "0.447254...
0.6331245
1
GET /party_lists GET /party_lists.json
def index @party_lists = PartyList.all.order(:id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_party_list\n @party_list = PartyList.find(params[:id])\n end", "def index\n @parties = Party.order(:name).all\n\n respond_to do |format|\n format.html\n format.json { render json: @parties }\n format.xml { render xml: @parties }\n end\n end", "def get_list(list_id)\n ...
[ "0.6903512", "0.65883553", "0.6513864", "0.64896125", "0.64874274", "0.6350442", "0.6239866", "0.6165532", "0.615419", "0.6144732", "0.6142607", "0.6142607", "0.61384887", "0.6124252", "0.6110967", "0.6096433", "0.60715467", "0.60371333", "0.6007722", "0.6006174", "0.5996661"...
0.69582874
0
POST /party_lists POST /party_lists.json
def create @party_list = PartyList.new(party_list_params) respond_to do |format| if @party_list.save format.html { redirect_to @party_list, notice: 'Party list was successfully created.' } format.json { render :show, status: :created, location: @party_list } else format.html...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_list(params={})\n @obj.post('create-list', @auth.merge(params))\n end", "def party_list_params\n params.require(:party_list).permit(:name, :avatar, :comments)\n end", "def set_party_list\n @party_list = PartyList.find(params[:id])\n end", "def create_list(name)\n data = ...
[ "0.682729", "0.68098384", "0.67933476", "0.646228", "0.6279475", "0.6260335", "0.6246846", "0.6113207", "0.6087917", "0.6043834", "0.6038729", "0.6024267", "0.6020488", "0.5995758", "0.5992617", "0.5991819", "0.59204835", "0.5911908", "0.591147", "0.5906218", "0.59047765", ...
0.7633069
0
PATCH/PUT /party_lists/1 PATCH/PUT /party_lists/1.json
def update respond_to do |format| if @party_list.update(party_list_params) format.html { redirect_to @party_list, notice: 'Party list was successfully updated.' } format.json { render :show, status: :ok, location: @party_list } else format.html { render :edit } format.jso...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_list(list_id, name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"patch\", \"lists/#{list_id}\", data)\n end", "def set_party_list\n @party_list = PartyList.find(params[:id])\n end", "def update\n @party = Party.find(params[:id])\n\n respond_to do |forma...
[ "0.68373257", "0.6601413", "0.6437038", "0.6427672", "0.64179814", "0.6396705", "0.63779783", "0.6304405", "0.62960064", "0.62570167", "0.6256205", "0.62478465", "0.62421215", "0.62073237", "0.61918515", "0.61918515", "0.6182753", "0.6152058", "0.6152058", "0.61432374", "0.61...
0.7505886
0
DELETE /party_lists/1 DELETE /party_lists/1.json
def destroy @party_list.destroy respond_to do |format| format.html { redirect_to party_lists_url, notice: 'Party list was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @party = Party.find(params[:id])\n @party.destroy\n\n respond_to do |format|\n format.html { redirect_to parties_url }\n format.json { head :no_content }\n end\n end", "def delete_list(user, list)\n delete(\"/#{user}/lists/#{list}.json\")\n end", "def delete_list(li...
[ "0.7019293", "0.68459284", "0.68293315", "0.67457783", "0.6743022", "0.6743022", "0.67038476", "0.6685997", "0.66618425", "0.6631687", "0.6631687", "0.6631687", "0.65966743", "0.6596603", "0.65961313", "0.6591933", "0.6591933", "0.6591933", "0.6581921", "0.6576677", "0.653149...
0.76714146
0
Simple method to merge strings from freelancer skills
def merge_skills(skills, newSkill) if newSkill!="" skills = skills + " " + newSkill end return skills end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_name_with_skills\n self.full_name + ' ' + self.all_skills_with_hashtags\n end", "def join_strings(word_1, word_2)\n join_strings=\"#{word_1} #{word_2}\"\nend", "def concatenate_words(sentence)\nend", "def merica(str)\n # concatenating the strings\n str + \"only in America!\"\nend", "def...
[ "0.6761452", "0.6377818", "0.6332484", "0.6289049", "0.628144", "0.6273637", "0.6091111", "0.6054331", "0.60448396", "0.59827167", "0.5976189", "0.5950364", "0.5895003", "0.5895003", "0.5815763", "0.5796502", "0.57707345", "0.57617056", "0.57538474", "0.5745201", "0.573637", ...
0.7227419
0
Use the Anemone page store to find the closest referer in the crawl tree that is a case (or nil if any URL in the chain can't be found)
def find_nearest_page_matching(url, regex) raise ArgumentError, 'No crawl found. Set @crawl as the first thing in your Anemone.crawl block' if crawl.nil? page = @crawl.pages[url] return page if page.nil? || page.url.to_s =~ regex find_nearest_page_matching(page.referer, regex) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def go\n captured = query_by_referrer\n return captured if captured.found?\n\n default_ordered_query\n end", "def crawl\n # TODO flush the page cache. We cache the crawled pages.\n begin\n account_detail_page #This will get us as far as we want to go, through several pages\n rescu...
[ "0.5892724", "0.54694486", "0.5422239", "0.54116744", "0.5401807", "0.5366848", "0.5318751", "0.5318751", "0.5318751", "0.5318751", "0.53057516", "0.52883935", "0.52883935", "0.52799827", "0.52797985", "0.5278542", "0.5261298", "0.5260768", "0.5240728", "0.52315557", "0.52315...
0.54917854
1
List milestones for a repository = Examples bitbucket = BitBucket.new :user => 'username', :repo => 'reponame' bitbucket.issues.milestones.list
def list(user_name, repo_name, params={}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? normalize! params response = get_request("/1.0/repositories/#{user}/#{repo.downcase}/issues/milestones", params) return response unless bl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def milestones\n process_list_response( send(:get , \"/api/v1/milestones.json\")[:body] , Unfuddled::Milestone)\n end", "def list(*args)\n arguments(args, required: [:user, :repo]) do\n permit VALID_MILESTONE_OPTIONS.keys\n assert_values VALID_MILESTONE_OPTIONS\n end\n\n ...
[ "0.77072847", "0.7568576", "0.7454273", "0.74063873", "0.74063873", "0.7121403", "0.7085949", "0.7025663", "0.67735606", "0.67034525", "0.6407855", "0.63975126", "0.6324642", "0.6321691", "0.6308109", "0.62788457", "0.6249693", "0.6249168", "0.619153", "0.6112057", "0.6093981...
0.7597863
1
Get a single milestone = Examples bitbucket = BitBucket.new bitbucket.issues.milestones.get 'username', 'reponame', 'milestoneid'
def get(user_name, repo_name, milestone_id, params={}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? _validate_presence_of milestone_id normalize! params get_request("/1.0/repositories/#{user}/#{repo.downcase}/issues/milestones...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def milestone(project, id)\n get(\"/projects/#{url_encode project}/milestones/#{id}\")\n end", "def get(*args)\n arguments(args, required: [:user, :repo, :number])\n\n get_request(\"/repos/#{arguments.user}/#{arguments.repo}/milestones/#{arguments.number}\", arguments.params)\n end", "def ...
[ "0.7819083", "0.7612949", "0.7431844", "0.73931336", "0.72962254", "0.7260072", "0.69790673", "0.68825376", "0.6781671", "0.672304", "0.672304", "0.65509117", "0.6515731", "0.64766014", "0.64080536", "0.6237649", "0.6204116", "0.61893845", "0.6105815", "0.6105815", "0.6105815...
0.7675952
1
Create a milestone = Inputs :name Required string = Examples bitbucket = BitBucket.new :user => 'username', :repo => 'reponame' bitbucket.issues.milestones.create :name => 'helloworld'
def create(user_name, repo_name, params={}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? normalize! params filter! VALID_MILESTONE_INPUTS, params assert_required_keys(%w[ name ], params) post_request("/1.0/repositories/...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_milestone(user_name=nil, repo_name=nil, params={})\n _update_user_repo_params(user_name, repo_name)\n _validate_user_repo_params(user, repo) unless user? && repo?\n\n _normalize_params_keys(params)\n _filter_params_keys(VALID_MILESTONE_INPUTS, params)\n _validate_input...
[ "0.77197176", "0.750156", "0.750156", "0.74777544", "0.74777544", "0.7393882", "0.7183288", "0.71807665", "0.701479", "0.67870593", "0.67266417", "0.6600806", "0.65512276", "0.65328", "0.6465845", "0.64473456", "0.6412497", "0.63975304", "0.63808376", "0.63702047", "0.6332788...
0.7817186
0
Update a milestone = Inputs :name Required string = Examples bitbucket = BitBucket.new bitbucket.issues.milestones.update 'username', 'reponame', 'milestoneid', :name => 'helloworld'
def update(user_name, repo_name, milestone_id, params={}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? _validate_presence_of milestone_id normalize! params filter! VALID_MILESTONE_INPUTS, params assert_required_keys(%w[ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_milestone(user_name, repo_name, milestone_id, params={})\n _update_user_repo_params(user_name, repo_name)\n _validate_user_repo_params(user, repo) unless user? && repo?\n _validate_presence_of milestone_id\n\n _normalize_params_keys(params)\n _filter_params_keys(VALID_...
[ "0.7766192", "0.6965826", "0.69231004", "0.68547994", "0.66919667", "0.6685642", "0.6607864", "0.65276617", "0.64786583", "0.64303184", "0.63980436", "0.6381614", "0.63498455", "0.6195654", "0.61362535", "0.61362535", "0.61362535", "0.6132694", "0.6084681", "0.60752535", "0.6...
0.79767275
0
GET /custom_events/1 GET /custom_events/1.xml
def show @custom_event = CustomEvent.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @custom_event } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calendar_event(event_id)\n record \"/calendar_events/#{event_id}.xml\", :method => :get\n end", "def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @events ...
[ "0.73055834", "0.7061174", "0.7059969", "0.6891292", "0.6814387", "0.67884237", "0.6784532", "0.66897553", "0.6648841", "0.6634603", "0.66315025", "0.66249067", "0.66249067", "0.66249067", "0.66249067", "0.6621328", "0.66013557", "0.6597169", "0.6581267", "0.65727425", "0.657...
0.7364384
0
GET /custom_events/new GET /custom_events/new.xml
def new @custom_event = CustomEvent.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @custom_event } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @event = Event.new_default\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end", "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @event }\n end\n e...
[ "0.77585804", "0.77302665", "0.7719559", "0.77181804", "0.75723165", "0.7566058", "0.7557748", "0.7557748", "0.7557748", "0.7557748", "0.7557748", "0.7557748", "0.7557748", "0.7557748", "0.7557748", "0.7557748", "0.7557748", "0.7557748", "0.7557748", "0.7556257", "0.75440925"...
0.8144636
0
PUT /custom_events/1 PUT /custom_events/1.xml
def update @custom_event = CustomEvent.find(params[:id]) respond_to do |format| if @custom_event.update_attributes(params[:custom_event]) logger.info "updated attribute" flash[:notice] = 'CustomEvent was successfully updated.' #@custom_events = CustomEvent.find(:all) #@public...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put_events(args)\n\tapi_url = \"#{@base_url}/#{args[:collection]}/#{args[:key]}/events/#{args[:event_type]}\"\n\tputs do_the_put_call( url: api_url, user: @user, json: args[:json] )\nend", "def save_event(event)\n method = (event.id == nil || event.id == '') ? :post : :put\n query_string = (method ...
[ "0.6588095", "0.6568102", "0.6243368", "0.621931", "0.62188065", "0.6208661", "0.6199198", "0.6195833", "0.61794114", "0.61794114", "0.6170073", "0.6161636", "0.6159317", "0.61148846", "0.60678035", "0.60676235", "0.60486925", "0.60443777", "0.6043721", "0.6034516", "0.603451...
0.67838293
0
DELETE /custom_events/1 DELETE /custom_events/1.xml
def destroy @custom_event = CustomEvent.find(params[:id]) @custom_event.destroy respond_to do |format| format.html { redirect_to(custom_events_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to(admin_events_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted event: #{@event.name}\")\n end", "def destroy\n @event.destroy\n respond_to do | format |\n ...
[ "0.67766184", "0.67501277", "0.66798496", "0.66798496", "0.66341573", "0.6602487", "0.6602487", "0.6602487", "0.6602487", "0.6602487", "0.6602487", "0.6602487", "0.6602487", "0.6602487", "0.6602487", "0.6602487", "0.6602487", "0.6602487", "0.6602487", "0.6602487", "0.6602487"...
0.7358108
0
The host name at which to connect to Solr. Default 'localhost'. ==== Returns String:: host name
def hostname unless defined?(@hostname) @hostname = solr_url.host if solr_url @hostname ||= user_configuration_from_key('solr', 'hostname') @hostname ||= default_hostname end @hostname end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hostname\n name + '.localhost'\n end", "def hostname\n Socket.gethostname\n end", "def hostname\n Socket.gethostname\n end", "def hostname\n Socket.gethostname.split('.').first.strip\n end", "def hostname\n @hostname ||= `hostname`.strip\n end", "def host\n\t\t...
[ "0.8081543", "0.766098", "0.766098", "0.7570593", "0.75348055", "0.7517301", "0.7513532", "0.7499513", "0.74338406", "0.73406804", "0.7334358", "0.7272968", "0.72699684", "0.72640216", "0.72274613", "0.72138935", "0.7205254", "0.71442604", "0.71016604", "0.7094605", "0.709403...
0.8438428
0
The port at which to connect to Solr. Defaults to 8981 in test, 8982 in development and 8983 in production. ==== Returns Integer:: port
def port unless defined?(@port) @port = solr_url.port if solr_url @port ||= user_configuration_from_key('solr', 'port') @port ||= default_port @port = @port.to_i end @port end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def port\n @port ||=\n if user_configuration.has_key?('solr')\n user_configuration['solr']['port']\n end || 8983\n end", "def port\n ENV.fetch('PORT', 8983)\n end", "def port\n return @port.to_i\n end", "def port\n conf['port'] || '80'\n en...
[ "0.8887995", "0.78635365", "0.753607", "0.746951", "0.74600095", "0.737927", "0.72772104", "0.72772104", "0.7272419", "0.7261463", "0.72520155", "0.7220364", "0.71657413", "0.71630394", "0.71619445", "0.7136809", "0.7133696", "0.7097821", "0.7089192", "0.7069812", "0.7048421"...
0.8874344
1
The url path to the Solr servlet (useful if you are running multicore). Default '/solr/default'. ==== Returns String:: path
def path unless defined?(@path) @path = solr_url.path if solr_url @path ||= user_configuration_from_key('solr', 'path') @path ||= default_path end @path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path\n @path ||=\n if user_configuration.has_key?('solr')\n \"#{user_configuration['solr']['path'] || '/solr'}\"\n end\n end", "def solr_url\n @solr_url ||= endpoint_url.gsub(/\\/select$/, '')\n end", "def solr_url\n @solr_url ||= @configuration...
[ "0.7688001", "0.737315", "0.72818965", "0.72788775", "0.72108835", "0.72043043", "0.7180702", "0.7105819", "0.7105819", "0.6896259", "0.6644922", "0.66327626", "0.6546388", "0.6526908", "0.63638675", "0.61476773", "0.61078197", "0.60974234", "0.60502315", "0.60310876", "0.600...
0.78345346
0
The host name at which to connect to the master Solr instance. Defaults to the 'hostname' configuration option. ==== Returns String:: host name
def master_hostname @master_hostname ||= (user_configuration_from_key('master_solr', 'hostname') || hostname) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hostname\n unless defined?(@hostname)\n @hostname = solr_url.host if solr_url\n @hostname ||= user_configuration_from_key('solr', 'hostname')\n @hostname ||= default_hostname\n end\n @hostname\n end", "def hostname\n @hostname ||= ENV['HOSTNAME'] ...
[ "0.86222357", "0.80152357", "0.8015042", "0.7977208", "0.79480636", "0.7927828", "0.79022527", "0.78599745", "0.7843177", "0.78336364", "0.78336364", "0.767907", "0.765595", "0.76495343", "0.75163424", "0.75045174", "0.74878716", "0.7477721", "0.7473205", "0.7445822", "0.7368...
0.86314994
0
The path to the master Solr servlet (useful if you are running multicore). Defaults to the value of the 'path' configuration option. ==== Returns String:: path
def master_path @master_path ||= (user_configuration_from_key('master_solr', 'path') || path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path\n @path ||=\n if user_configuration.has_key?('solr')\n \"#{user_configuration['solr']['path'] || '/solr'}\"\n end\n end", "def path\n unless defined?(@path)\n @path = solr_url.path if solr_url\n @path ||= user_configuration_from_key('so...
[ "0.7058772", "0.69833034", "0.65264505", "0.65264505", "0.6415586", "0.634893", "0.6310563", "0.6214633", "0.62054557", "0.61280555", "0.6002132", "0.5982079", "0.59138626", "0.59138626", "0.59016633", "0.5860812", "0.58013314", "0.57949394", "0.57855964", "0.57624555", "0.57...
0.79840094
0
True if there is a master Solr instance configured, otherwise false. ==== Returns Boolean:: bool
def has_master? @has_master = !!user_configuration_from_key('master_solr') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def registered_master?\n !level_db.get(KEY_PREFIX[:master]).nil?\n end", "def master?\n return !@slaveof.nil?\n end", "def master?\n !!@master\n end", "def master_enabled?\n return false if @master_preferences[@master_label].nil?\n return @master_preferences[@master_label].to_ruby.e...
[ "0.7382707", "0.72885257", "0.72652435", "0.7227414", "0.7213131", "0.7196507", "0.71719575", "0.7039075", "0.69160664", "0.69160664", "0.69134843", "0.6821734", "0.6814533", "0.6681748", "0.6658148", "0.6478363", "0.6450845", "0.64502746", "0.64502746", "0.6438817", "0.64314...
0.89232886
0
The default log_level that should be passed to solr. You can change the individual log_levels in the solr admin interface. If no level is specified in the sunspot configuration file, use a level similar to Rails own logging level. ==== Returns String:: log_level
def log_level @log_level ||= ( user_configuration_from_key('solr', 'log_level') || LOG_LEVELS[::Rails.logger.level] ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_level\n @log_level ||= DEFAULT_LOG_LEVEL\n end", "def log_level\n @log_level ||= DEFAULT_LOG_LEVEL\n end", "def default_log_level\n\t\t\tif $DEBUG\n\t\t\t\tLogger::DEBUG\n\t\t\telsif $VERBOSE\n\t\t\t\tLogger::INFO\n\t\t\telse\n\t\t\t\tLogger::WARN\n\t\t\tend\n\t\tend", "def log_level\...
[ "0.7756941", "0.7756941", "0.7729737", "0.725342", "0.7119505", "0.7109365", "0.70924956", "0.70824856", "0.7079741", "0.7076367", "0.70716816", "0.7067309", "0.70527816", "0.704302", "0.6902376", "0.689047", "0.68899703", "0.684474", "0.684474", "0.6842628", "0.68242055", ...
0.836026
0
Should the solr index receive a commit after each httprequest. Default true ==== Returns Boolean: auto_commit_after_request?
def auto_commit_after_request? @auto_commit_after_request ||= user_configuration_from_key('auto_commit_after_request') != false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_commit\n post_to_solr({},true)\n end", "def autocommit?()\n #This is a stub, used for indexing\n end", "def solr_commit\n Solarize::Post.execute(Solr::Request::Commit.new)\n end", "def commit\n solr_service_connection.commit\n end", "def autocommit\n IBM_DB.aut...
[ "0.65083295", "0.6402352", "0.637911", "0.63104665", "0.6305918", "0.61351115", "0.60815436", "0.6076705", "0.60358244", "0.59923846", "0.59923846", "0.5928472", "0.5851154", "0.5743252", "0.5690118", "0.5660516", "0.5573864", "0.5535565", "0.5486534", "0.5477988", "0.5459385...
0.7125242
0
As for auto_commit_after_request? but only for deletes Default false ==== Returns Boolean: auto_commit_after_delete_request?
def auto_commit_after_delete_request? @auto_commit_after_delete_request ||= (user_configuration_from_key('auto_commit_after_delete_request') || false) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auto_commit_after_request?\n @auto_commit_after_request ||=\n user_configuration_from_key('auto_commit_after_request') != false\n end", "def autocommit?()\n #This is a stub, used for indexing\n end", "def is_marked_for_delete?\n return @mark_for_delete\n end", "def ...
[ "0.72737837", "0.6947962", "0.6916931", "0.68600065", "0.68319523", "0.67506546", "0.67094284", "0.6562226", "0.65547186", "0.6538855", "0.6512156", "0.6506255", "0.65055305", "0.6478739", "0.6478739", "0.64314866", "0.64314866", "0.63832146", "0.6379776", "0.6379776", "0.634...
0.8775177
0
The callback to use when automatically indexing records. Defaults to after_save.
def auto_index_callback @auto_index_callback ||= (user_configuration_from_key('auto_index_callback') || 'after_save') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_update\n super\n self.class.call_es { _index_document }\n end", "def after_create\n super\n self.class.call_es { _index_document }\n end", "def after_index(indexable = nil,batch_connection = nil)\n\n end", "def after_create(model)\n update_s...
[ "0.6939893", "0.67688876", "0.66032654", "0.6318067", "0.6232138", "0.61771023", "0.61178", "0.59324807", "0.59281695", "0.5830446", "0.58153766", "0.580166", "0.5648313", "0.558993", "0.55820465", "0.5565247", "0.5551486", "0.5495859", "0.5488556", "0.5478083", "0.54610854",...
0.7952479
0
Logging in rails_root/log as solr_.log as a default. ===== Returns String:: default_log_file_location
def default_log_file_location File.join(::Rails.root, 'log', "solr_" + ::Rails.env + ".log") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_file\n @log_file ||= (user_configuration_from_key('solr', 'log_file') || default_log_file_location )\n end", "def default_log_path\n if @config.log_root\n File.join(@config.log_root, default_log_file_name)\n else\n nil\n end\n end", "def log_file\n Fil...
[ "0.8302128", "0.8208753", "0.78582126", "0.78211004", "0.7616691", "0.7476673", "0.72833616", "0.7124547", "0.7078312", "0.7078312", "0.69465417", "0.6759343", "0.6755002", "0.6745315", "0.66719025", "0.6661914", "0.66196275", "0.6592591", "0.6569379", "0.65335244", "0.653346...
0.93332016
0
Clears both the internal lists of entities and contexts.
def clear @entity_list = {} @context_list = {} @last_unique_id = 0 @entity_names = {} # Internal cache of context names for quick key retrieval end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear!\n contexts.clear\n end", "def clear!\n contexts.clear\n end", "def clear\n \n @hook_contexts.clear if @hook_contexts\n @execution_contexts.clear if @execution_contexts\n @cascade_contexts.clear if @cascade_contexts\n \n self\n \n end", "def clea...
[ "0.80656564", "0.80656564", "0.7758154", "0.7511816", "0.71288586", "0.70125735", "0.69689256", "0.6922737", "0.67608523", "0.6704949", "0.6704949", "0.6582116", "0.6539126", "0.6500507", "0.64793265", "0.6388345", "0.6363253", "0.63163555", "0.63068825", "0.63050246", "0.628...
0.82883865
0
++ Creates a new EntityDAO, adding it to the internal list and returning its instance. Entity names should be unique among the same context. (No check is performed about this, though.) They will be converted to strings internally.
def new_entity( name, parent_context = nil ) @last_unique_id += 1 entity = V3::EntityDAO.new( @last_unique_id, name.to_s, parent_context ) parent_context.entity_list[ name.to_s ] = entity if parent_context.instance_of?( V3::ContextDAO ) # Cache the key for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_entity( name, parent_context = nil )\n id = @entity_names[ get_entity_unique_name(name, parent_context) ]\n @entity_list[ id ]\n end", "def create(entity)\n unless entity.id\n @adapter.create(collection, entity)\n end\n\n entity\n end", "def add_entity\n e =...
[ "0.59213907", "0.5712357", "0.5544077", "0.5470924", "0.5442165", "0.5435268", "0.5411286", "0.5395928", "0.5395928", "0.5353739", "0.5339533", "0.5243308", "0.52074516", "0.5197445", "0.5126106", "0.5115129", "0.5112657", "0.5103246", "0.5075333", "0.504723", "0.504196", "...
0.76475114
0
Creates a new ContextDAO, adding it to the internal list and returning its instance. Context names can be duplicated, to allow multiple childcontexts holding different values of the same group of entities. The suggested way to process the contexts is as a sequential list. (i.e. scanning all the contexts named "result_r...
def new_context( name, parent_context = nil ) @last_unique_id += 1 @context_list[ @last_unique_id ] = V3::ContextDAO.new( @last_unique_id, name.to_s, parent_context ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def context(name)\n contexts[name] = [] unless contexts.has_key?(name)\n contexts[name]\n end", "def new_context(description, klass, &definition)\n (@contexts << klass.new(description, self, &definition)).last\n end", "def contexts\n @contexts ||= @contexts = {}\n end", ...
[ "0.5780692", "0.569332", "0.5647364", "0.5625411", "0.5610783", "0.5574601", "0.5529271", "0.55218893", "0.54197496", "0.5403604", "0.540133", "0.5371174", "0.53683686", "0.5363313", "0.53301746", "0.5250172", "0.52384293", "0.52018565", "0.5169296", "0.5167105", "0.51572734"...
0.72843516
0
++ Retrieves the unique entity name, used internally to cache its key.
def get_entity_unique_name( name, parent_context = nil ) "#{ parent_context ? "#{parent_context.id}-#{parent_context.name}" : '' }-#{ name.to_s }" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entity_name(entity)\n entity_value(entity, :full_name, :name, I18n.t('name_missing'))\n end", "def entity_name\n parse\n return @names.first\n end", "def key\n @entity.key\n end", "def entity_key\n resource_name.underscore.to_sym\n end", "def entities_key\n entities_name.underscor...
[ "0.75129724", "0.7383636", "0.7166202", "0.7164908", "0.70936126", "0.68073434", "0.6784813", "0.67693895", "0.6714521", "0.6640207", "0.66210496", "0.6604858", "0.6581592", "0.6579659", "0.65703875", "0.6562822", "0.65472656", "0.6522637", "0.6512543", "0.6504823", "0.645099...
0.7681559
0
Retrieves an entity by its name, given the parent context instance.
def get_entity( name, parent_context = nil ) id = @entity_names[ get_entity_unique_name(name, parent_context) ] @entity_list[ id ] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_entity_detail(detail_name)\n @entity.get_detail(detail_name)\n end", "def retrieve_entity\n if self.id\n @entity = Deltacloud::Database::Entity::retrieve(@model)\n if @entity.exists?\n after_retrieve\n end\n else\n @entity = nil\n end\n end", ...
[ "0.6002163", "0.5986662", "0.5839882", "0.5722929", "0.5712308", "0.57045996", "0.56919765", "0.5672888", "0.56506896", "0.56452113", "0.56427515", "0.56408864", "0.56331366", "0.5602796", "0.55974", "0.5587156", "0.55840814", "0.55147374", "0.55143225", "0.5483278", "0.54781...
0.8633785
0
++ Retrieves the contexts named as indicated. (i.e. "all the contexts named 'result_row'")
def get_contexts_named( name ) @context_list.values.map{ |context| context if context.name == name }.compact end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contexts\n JSON.parse(raw_contexts())[\"results\"][\"bindings\"].map{|x| x[\"contextID\"][\"value\"] }\n end", "def raw_contexts(result_format=\"application/sparql-results+json\")\n easy = Curl::Easy.new\n easy.headers[\"Accept\"] = result_format\n\n easy.url = self.uri + \"/contexts\"...
[ "0.6872841", "0.6479896", "0.6432969", "0.64063144", "0.6317191", "0.618607", "0.6027422", "0.5980706", "0.5964562", "0.5953163", "0.59507924", "0.59482753", "0.5936626", "0.591796", "0.58460456", "0.5837163", "0.5825554", "0.5822491", "0.581935", "0.5809059", "0.5790083", ...
0.73007816
0
++ Retrieves all the entities for a specific context.
def get_entities_for_context( parent_context = nil ) if parent_context.instance_of?( V3::ContextDAO )# Context specified? Return its entity list: parent_context.entity_list.values else # Let's do a "manual" search among the entities: # [Steve, 20150805] Thi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retrieve_all_entities\n response = self.execute(\"RetrieveAllEntities\", {\n EntityFilters: \"Entity\",\n RetrieveAsIfPublished: true\n },\n Metadata::RetrieveAllEntitiesResponse)\n end", "def entities\n _entities\n end", "def entities\n _entities\n end",...
[ "0.68490154", "0.67188394", "0.67188394", "0.67042935", "0.6647013", "0.6510834", "0.6442118", "0.6441165", "0.6312841", "0.6219882", "0.6214106", "0.6214106", "0.62096983", "0.6199449", "0.617377", "0.60952556", "0.6017993", "0.600789", "0.5987142", "0.59783435", "0.5957629"...
0.736744
0
Retrieves all the (siblings) contexts for a specific context. Note that by specifying +nil+ as a parent context, will result in all root context retrieved.
def get_siblings_for_context( parent_context = nil ) @context_list.values.map do |context| context if context.respond_to?(:parent_context) && (context.parent_context == parent_context) end.compact end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contexts\n @contexts ||= @contexts = {}\n end", "def contexts\n @contexts ||= {}\n end", "def contexts\n map(&:contexts).flatten.uniq.sort\n end", "def get_entities_for_context( parent_context = nil )\n if parent_context.instance_of?( V3::ContextDAO )# Context specified...
[ "0.6483445", "0.63141906", "0.6299211", "0.6076121", "0.6060163", "0.6013197", "0.5993317", "0.5941617", "0.569801", "0.56862205", "0.56248105", "0.5547251", "0.54995495", "0.54655653", "0.54520154", "0.54301244", "0.5393248", "0.53757703", "0.5327133", "0.5313975", "0.528915...
0.78469086
0
Internal: For a given +point+ in time, calculates the load which should be handled by transient energy producers, and assigns the calculated values to the producer's load curve. This is the "jumping off point" for calculating the merit order, and note that the method is called once per Merit::POINT. Since Calculator co...
def compute_point(order, point, producers) # Optimisation: This is order-dependent; it requires that always-on # producers are before the transient producers, otherwise "remaining" # load will not be correct. # # Since this method is called a lot, being able to handle always-on a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_point(order, point, participants)\n if (demand = demand_at(order, point)).negative?\n raise SubZeroDemand.new(point, demand)\n end\n\n demand = compute_always_ons(\n point, demand,\n participants.always_on,\n participants.flex.at_point(point)\n )\n\n ...
[ "0.6321755", "0.60812825", "0.5981526", "0.59455174", "0.58839643", "0.58198434", "0.58046997", "0.56684047", "0.5536908", "0.54751503", "0.534222", "0.52027094", "0.51183224", "0.50811666", "0.5038798", "0.501111", "0.49826777", "0.49811327", "0.497791", "0.49714407", "0.494...
0.76092327
0
create a new secondary_publication_number
def create @secondary_publication_number = SecondaryPublicationNumber.new(params[:secondary_publication_number]) @secondary_publication_number.save end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @secondary_publication_number = SecondaryPublicationNumber.find(params[:id])\n\t@secondary_publication_number.update_attributes(params[:secondary_publication_number])\n end", "def create\n\t@secondary_publication = SecondaryPublication.new(params[:secondary_publication])\n \t@secondary_publicati...
[ "0.66986525", "0.6678229", "0.66055155", "0.6441804", "0.6333184", "0.59490246", "0.5908597", "0.560981", "0.5555847", "0.55500203", "0.5516568", "0.55064684", "0.5495526", "0.54855627", "0.54673856", "0.5450609", "0.5412726", "0.5382135", "0.53705555", "0.535286", "0.5335613...
0.8264091
0
update an existing secondary_publication_number
def update @secondary_publication_number = SecondaryPublicationNumber.find(params[:id]) @secondary_publication_number.update_attributes(params[:secondary_publication_number]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @primary_publication_number = PrimaryPublicationNumber.find(params[:id])\n\n respond_to do |format|\n if @primary_publication_number.update_attributes(params[:primary_publication_number])\n format.html { redirect_to(@primary_publication_number, :notice => 'Primary publication number ...
[ "0.6854728", "0.67690563", "0.67131823", "0.6328336", "0.6055101", "0.5972203", "0.57662684", "0.57261705", "0.5677576", "0.5607939", "0.5600554", "0.55821013", "0.5572911", "0.5495879", "0.5495429", "0.5473304", "0.54580295", "0.5451855", "0.54463845", "0.5443153", "0.543836...
0.8558592
0
destroy the secondary_publication_number with id = params[:id]
def destroy thisNumber = SecondaryPublicationNumber.find(params[:id]) thisNumber.destroy @secondary_publications = @study.get_secondary_publications(params[:extraction_form_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @primary_publication_number = PrimaryPublicationNumber.find(params[:id])\n @primary_publication_number.destroy\n\n respond_to do |format|\n format.html { redirect_to(primary_publication_numbers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @publication_num...
[ "0.80431896", "0.79194057", "0.77324915", "0.74989593", "0.74416924", "0.72103095", "0.70939016", "0.70771974", "0.69101995", "0.6900275", "0.68852246", "0.67765635", "0.6715107", "0.66988254", "0.6673118", "0.6650622", "0.66505426", "0.6644315", "0.6644315", "0.6644315", "0....
0.8735176
0
GET /product_cates GET /product_cates.json
def index @product_cates = ProductCate.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @crates = Crate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crates }\n end\n end", "def index\n if is_my_resource(params[:prossumer_id])\n @products = Product.where(prossumer_id: params[:prossumer_id]).as_json({\n ...
[ "0.635632", "0.61790925", "0.61187536", "0.61152655", "0.60723484", "0.60031974", "0.5997642", "0.5995273", "0.5953059", "0.5925261", "0.59197694", "0.5915861", "0.588498", "0.5865731", "0.5847437", "0.5837887", "0.58280647", "0.5827365", "0.5813459", "0.5810902", "0.5791068"...
0.7525631
0
POST /product_cates POST /product_cates.json
def create @product_cate = ProductCate.new(product_cate_params) respond_to do |format| if @product_cate.save format.html { redirect_to @product_cate, notice: 'Product cate was successfully created.' } format.json { render :show, status: :created, location: @product_cate } else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @product_cates = ProductCate.all\n end", "def create\n @candies_product = CandiesProduct.new(candies_product_params)\n\n respond_to do |format|\n if @candies_product.save\n format.html { redirect_to @candies_product, notice: 'Candies product was successfully created.' }\n ...
[ "0.6179065", "0.6047354", "0.58769214", "0.58728254", "0.58627504", "0.5812873", "0.5778166", "0.56561", "0.56438977", "0.5642931", "0.563476", "0.562332", "0.5602068", "0.5562614", "0.5558732", "0.5547944", "0.5540008", "0.55357414", "0.55110925", "0.5501101", "0.550062", ...
0.66350067
0
DELETE /product_cates/1 DELETE /product_cates/1.json
def destroy @product_cate.destroy respond_to do |format| format.html { redirect_to product_cates_url, notice: 'Product cate was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @product.destroy\n\n render json: @product, status: :ok#, location: @collection\n end", "def destroy\n @product.destroy\n render json: {}\n end", "def destroy\n p @product.destroy!\n render json: { result: 'deleted' }, status: :ok\n end", "def destroy\n @purchase.destroy...
[ "0.6717103", "0.66579306", "0.6639093", "0.66334236", "0.6604102", "0.6576996", "0.6570536", "0.65475726", "0.65408087", "0.65389717", "0.6515142", "0.65117294", "0.65108854", "0.65104043", "0.6507789", "0.6505897", "0.6497713", "0.6489978", "0.6483425", "0.6475791", "0.64581...
0.69883144
0
Add or change an asset id in the asset id cache. This can be used for SASS on Heroku. :api: public
def add_to_asset_ids_cache(source, asset_id) self.asset_ids_cache_guard.synchronize do self.asset_ids_cache[source] = asset_id end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rails_asset_id(source)\n if asset_id = ENV[\"RAILS_ASSET_ID\"]\n asset_id\n else\n if self.cache_asset_ids && (asset_id = self.asset_ids_cache[source])\n asset_id\n else\n path = File.join(config.assets_dir, source)\n ass...
[ "0.69767493", "0.6781146", "0.67287135", "0.65945554", "0.60452086", "0.60452086", "0.60452086", "0.60452086", "0.60452086", "0.60452086", "0.60452086", "0.60411817", "0.6000291", "0.59650934", "0.591125", "0.5885534", "0.58758545", "0.5866846", "0.5865538", "0.57829213", "0....
0.7340529
0
Sort talks in descending order by duraion Find number of tracks needed, since we know the total duraion exactly And intialize tracks As per the Best fit algorithm, Fill each tracks by looping through sorted talks Do this till available talks become empty
def schedule_talks until available_talks.empty? Track.all.each do |track| schedule_talks_for_track(track) # When a track didn't fill exactly # Removing already scheduled last element from track and # Again trying for a exact match on available talks # Not a perfect sol...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pack_talks\n\n @tracks << Track.new() # create first [0] Track object\n x = 0 # first object @tracks[0]\n\n @talks.each do |talk|\n\n # if it's morning session, set limit to 180min, otherwise to 240min\n len = get_max_length(x)\n\n # if the sum of Track's total length + current talk's l...
[ "0.66730255", "0.6115911", "0.605454", "0.5993541", "0.5781465", "0.5744241", "0.5714921", "0.569363", "0.5466948", "0.54645944", "0.53755265", "0.536268", "0.5361759", "0.532656", "0.5316245", "0.5231652", "0.523097", "0.52071446", "0.51980644", "0.5172707", "0.5172007", "...
0.617165
1
Return true if canceled this task ==== Return true if canceled this task
def canceled? @state == :cancel end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def canceled?\n @__status == TaskStatus::CANCELED\n end", "def cancelled?\n false\n end", "def canceled?\n @current_state == Psc::ScheduledActivity::CANCELED\n end", "def cancelled?\n return self.status == 'canceled'\n end", "def rejected?\n self.status == Task::S...
[ "0.8562416", "0.7738751", "0.7672849", "0.7612788", "0.7597592", "0.7509902", "0.74425554", "0.74425554", "0.7420871", "0.73126084", "0.7265805", "0.71293604", "0.7126879", "0.7091618", "0.7024011", "0.7016525", "0.7013392", "0.7001374", "0.6988741", "0.69690067", "0.6925201"...
0.7894771
1
A getter for `gradle_task`, returning 'spotbugsRelease' if value is nil.
def gradle_task @gradle_task ||= 'spotbugsRelease' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gradle_task\n @gradle_task ||= \"ktlintCheck\"\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 release\n @release ||= ENV[\"RELEASE\"] || \"1\"\n end", "def get_release(project)\n info = get...
[ "0.65598345", "0.59358203", "0.5737082", "0.57256067", "0.56674534", "0.56023943", "0.54701036", "0.54523665", "0.5441252", "0.5330394", "0.5264861", "0.5240344", "0.5227098", "0.5202696", "0.5185519", "0.5168148", "0.5163548", "0.51371855", "0.5109742", "0.50849926", "0.5075...
0.838925
0
A getter for `skip_gradle_task`, returning false if value is nil.
def skip_gradle_task @skip_gradle_task ||= false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ignore_force?(task)\n !(metadata[\"run_#{task}\"].nil? || metadata[\"run_#{task}\"])\n end", "def ignore_task?(task)\n return true if metadata[\"run_#{task}\"] == false\n\n !clade? && @@INCLADE_TASKS.include?(task) && metadata[\"run_#{task}\"] != true\n end", "def should_skip\n @skip = proc...
[ "0.6518595", "0.64784586", "0.62998265", "0.6292668", "0.6292668", "0.6292668", "0.6290563", "0.62690115", "0.62614036", "0.61823386", "0.61674595", "0.61668545", "0.61337686", "0.6125552", "0.60769284", "0.6057696", "0.6050467", "0.601239", "0.59567827", "0.594658", "0.59313...
0.82654464
1
A getter for `root_path`, returning result of `git revparse showtoplevel` if value is nil.
def root_path @root_path ||= `git rev-parse --show-toplevel`.chomp end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def repository_root\n return unless available?\n root = Licensed::Shell.execute(\"git\", \"rev-parse\", \"--show-toplevel\", allow_failure: true)\n return nil if root.empty?\n root\n end", "def root(value = nil)\n if value\n @root = value\n else\n Utils::K...
[ "0.73593134", "0.694649", "0.6865729", "0.6700843", "0.66957176", "0.6623494", "0.6591485", "0.6579465", "0.6552028", "0.6532682", "0.64187455", "0.6401191", "0.6401191", "0.6364244", "0.6355525", "0.634226", "0.632569", "0.6322528", "0.6319492", "0.6288777", "0.6264779", "...
0.79346144
0
A getter for `report_file`, returning 'app/build/reports/spotbugs/release.xml' if value is nil.
def report_file @report_file ||= 'app/build/reports/spotbugs/release.xml' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def report_file\n return @report_file || \"build/reports/detekt/detekt.xml\"\n end", "def report_file\n return @report_file || 'app/build/reports/lint/lint-result.xml'\n end", "def report_file\n @report_file || 'app/build/reports/ktlint/ktlintSourceSetCheck.json'\n end", "def test_con...
[ "0.7797677", "0.71298295", "0.6664475", "0.6060904", "0.6012322", "0.58259284", "0.5654273", "0.56019944", "0.55606997", "0.55336714", "0.54858345", "0.54858345", "0.5479988", "0.54769075", "0.5468726", "0.54221344", "0.5403788", "0.5374407", "0.5364477", "0.5328036", "0.5310...
0.84897304
0
A getter for `report_files`, returning ['app/build/reports/spotbugs/release.xml'] if value is nil.
def report_files @report_files ||= [report_file] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def report_file\n @report_file ||= 'app/build/reports/spotbugs/release.xml'\n end", "def report_file\n return @report_file || \"build/reports/detekt/detekt.xml\"\n end", "def report_file\n return @report_file || 'app/build/reports/lint/lint-result.xml'\n end", "def files\n @expor...
[ "0.6313074", "0.6047547", "0.5837352", "0.5810982", "0.5669092", "0.56635225", "0.56498194", "0.5579815", "0.5519284", "0.54893845", "0.54874134", "0.54189825", "0.54014516", "0.53965956", "0.53937376", "0.53611314", "0.53464466", "0.53372395", "0.53268003", "0.5320092", "0.5...
0.75638413
0
Calls SpotBugs task of your Gradle project. It fails if `gradlew` cannot be found inside current directory. It fails if `report_file` cannot be found inside current directory. It fails if `report_files` is empty.
def report(inline_mode: true) unless skip_gradle_task raise('Could not find `gradlew` inside current directory') unless gradlew_exists? exec_gradle_task end report_files_expanded = Dir.glob(report_files).sort raise("Could not find matching SpotBugs report files for #{report_fil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lint\n unless gradlew_exists?\n fail(\"Could not find `gradlew` inside current directory\")\n return\n end\n\n unless SEVERITY_LEVELS.include?(severity)\n fail(\"'#{severity}' is not a valid value for `severity` parameter.\")\n return\n end\n\n system \"./gr...
[ "0.62935215", "0.52596444", "0.5257605", "0.5242235", "0.5207904", "0.51342595", "0.5102762", "0.5047541", "0.5025417", "0.502484", "0.4963007", "0.49560726", "0.49040627", "0.48541266", "0.4853064", "0.48441255", "0.48112792", "0.48043206", "0.47878724", "0.47822118", "0.476...
0.712252
0
Check gradlew file exists in current directory.
def gradlew_exists? !`ls gradlew`.strip.empty? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_env_sample_exists\n assert(File.file?('./.env_sample'))\n end", "def current_folder_has_souffle_config?\n File.exists? \"#{Dir.pwd}/souffle.json\"\n end", "def gemfile_exists? \n File.exists? \"Gemfile\"\nend", "def gemfile_exists? \n File.exists? \"Gemfile\"\nend", "def file_exists?(fil...
[ "0.64557767", "0.6333179", "0.6217829", "0.6217829", "0.6056618", "0.605368", "0.6046435", "0.6035463", "0.6017085", "0.5952188", "0.5914218", "0.5913326", "0.5906898", "0.5899916", "0.58908534", "0.5886532", "0.5880113", "0.58728504", "0.5856368", "0.5851407", "0.5849155", ...
0.8407961
0
A getter for `spotbugs_report`, returning SpotBugs report.
def spotbugs_report(report_file) require 'oga' Oga.parse_xml(File.open(report_file)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def report_file\n @report_file ||= 'app/build/reports/spotbugs/release.xml'\n end", "def report\n return @report\n end", "def bug_report_url()\n LibDrizzle.drizzle_bugreport\n end", "def show\n @bugs = service_method(:bugs_by_board,boardid: @sprint.team.board_id,s...
[ "0.6322081", "0.6055198", "0.57680035", "0.5750877", "0.5711777", "0.564839", "0.5594099", "0.5476167", "0.5461613", "0.5418667", "0.5367439", "0.5357381", "0.53265905", "0.5320875", "0.52858853", "0.5255507", "0.51931953", "0.517406", "0.5171568", "0.51465553", "0.5144168", ...
0.61145806
1
Returns +ture+ if the element is included in _self_.
def include?(elem) @elements.include?(elem) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def include?(element)\n @elements.include? element\n end", "def include?(value)\n element.include? value\n end", "def include?(other)\n `#{@el}.contains(#{DOM::NODE.get_element(other)})` || other == self\n end", "def not_include?(element)\n !self.include?(element)\n end", "d...
[ "0.72627753", "0.71385694", "0.7083272", "0.7056407", "0.7012274", "0.6885466", "0.68645346", "0.67983544", "0.67871845", "0.67210245", "0.66604084", "0.64970434", "0.649515", "0.6487864", "0.6472129", "0.64663243", "0.64399916", "0.63391", "0.6243539", "0.62222195", "0.62113...
0.7206876
1
Deletes the +element+ from this max heap, and maintains the heap properties. If the element is not found, return +nil+.
def delete(elem) deleted = @elements.delete(elem) build_heap unless deleted.nil? deleted end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pop;\n\t\t@heap.empty? and\n\t\t\treturn;\n\t\t_remove 0;\n\tend", "def remove_max\n return nil if heap.empty?\n deleted = @heap.delete_at 0\n last_one = @heap.pop\n if last_one #ei ole false tai nil\n @heap.insert 0, last_one\n heapify_down 0\n end\n deleted\n end", "def remov...
[ "0.6819025", "0.68113655", "0.66549516", "0.66510993", "0.6562311", "0.65469515", "0.65469515", "0.65193224", "0.65153104", "0.650952", "0.6493301", "0.6486128", "0.6463992", "0.6453655", "0.6442046", "0.6412629", "0.640591", "0.63867676", "0.63867676", "0.63826007", "0.63634...
0.75875956
0
Returns the parent index of the element at +i+.
def parent(i) (i-1)/2 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parent_index(i)\n (i / 2).floor\n end", "def parent(i)\n\treturn ((i+1)/2).floor-1 #could be simpler\nend", "def parent(index)\n case index\n when 0\n INVALID_INDEX\n else\n (index - 1) / 2\n end\n end", "def parent(i); (i-1)/2; end", "def idx_children(parent_i)...
[ "0.7558149", "0.73898953", "0.71897817", "0.7093185", "0.70867866", "0.7070461", "0.7049022", "0.70467985", "0.69362235", "0.6783529", "0.67319983", "0.665753", "0.66359806", "0.6612102", "0.6599606", "0.65568405", "0.6493102", "0.6480639", "0.63854927", "0.62796384", "0.6233...
0.7501852
1
Heapifies the element at position +i+.
def heapify(i) left = left(i) right = right(i) target = i if left < @elements.size and @comparator.call(@elements[i],@elements[left]) < 0 target = left end if right < @elements.size and @comparator.call(@elements[target],@elements[right]) < 0 targe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minheapify(i=0)\n\t\tn_heapify(@min, i)\n\t\t@heap\n\tend", "def heap_up(i)\n return if i == 0\n\n pnode = (i-1) / 2\n if @store[i].key < @store[pnode].key\n swap(i, pnode)\n heap_up(pnode)\n end\n end", "def heapify\n for i in (0..(@ary.size-1)).to_a.reverse\n upheap(i)\n ...
[ "0.7694692", "0.73285645", "0.7035773", "0.699259", "0.67716455", "0.6696808", "0.6610182", "0.6593232", "0.6411324", "0.6297163", "0.6227078", "0.6164906", "0.6147106", "0.607659", "0.6042002", "0.60286844", "0.60099924", "0.59845155", "0.59745103", "0.59721166", "0.59661084...
0.8124133
0
Checks if this numeric range intersects with another
def intersect?(o) self.class == o.class && !(@to < o.numeric_from || o.numeric_to < @from) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intersects?(*args)\n other = coerce_range(*args)\n raise ArgumentError, \"#{self.begin.class} expected, received #{other.begin.class}\" unless other.begin.kind_of?(self.begin.class)\n\n if other.instant?\n self.begin <= other.begin and other.end < self.end\n else\n other.begin...
[ "0.7757763", "0.73951113", "0.72122", "0.7132891", "0.712935", "0.7093643", "0.70667654", "0.7037788", "0.7002646", "0.6988205", "0.6983293", "0.6955906", "0.69552076", "0.69027674", "0.68826234", "0.68679166", "0.6837399", "0.6806454", "0.6787957", "0.677411", "0.6744015", ...
0.74312043
1
GET /event_elements GET /event_elements.json
def index @event_elements = EventElement.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end", "def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response.body) : nil\n end", "def index\n #returns all events from eventbrite API, need to change to pull from her en...
[ "0.73061967", "0.68866354", "0.6868861", "0.67947763", "0.66653544", "0.6641993", "0.66249585", "0.65587926", "0.6506329", "0.65009993", "0.648142", "0.64712006", "0.6470211", "0.6443841", "0.64436775", "0.64436775", "0.6436641", "0.64343876", "0.6418604", "0.63791955", "0.63...
0.72904515
1
POST /event_elements POST /event_elements.json
def create @event_element = EventElement.new(event_element_params) respond_to do |format| if @event_element.save format.html { redirect_to @event_element, notice: 'Event element was successfully created.' } format.json { render :show, status: :created, location: @event_element } els...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push_events\n saved = []\n jsonHash = request.POST[:_json];\n jsonHash.each do |jsonEvent|\n event = Event.new\n event.race_id = jsonEvent[\"raceId\"]\n event.walker_id = jsonEvent[\"walkerId\"]\n event.eventId = jsonEvent[\"eventId\"]\n event.eventType = jsonEvent[\"type\"]\n...
[ "0.6460685", "0.59564286", "0.5924289", "0.5916261", "0.5911022", "0.5910056", "0.58828604", "0.5859368", "0.58439016", "0.5804608", "0.5785104", "0.57801235", "0.57481337", "0.573887", "0.56989515", "0.56960005", "0.56655276", "0.5614666", "0.5586792", "0.5584357", "0.558233...
0.65677327
0
PATCH/PUT /event_elements/1 PATCH/PUT /event_elements/1.json
def update respond_to do |format| if @event_element.update(event_element_params) format.html { redirect_to @event_element, notice: 'Event element was successfully updated.' } format.json { render :show, status: :ok, location: @event_element } else format.html { render :edit } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch_event\n user_id = params[\"user_id\"]\n group_id = params[\"group_id\"]\n event_id = params[\"event_id\"]\n\n #TODO Handle 404 if event not found\n event = Event.find(event_id)\n\n json_body = JSON.parse(request.body.read)\n\n @@event_service.patch_event(j...
[ "0.68292314", "0.65027267", "0.6403947", "0.6382738", "0.63632184", "0.636033", "0.63441545", "0.6337041", "0.6318268", "0.6317005", "0.631292", "0.63085395", "0.6307107", "0.63040006", "0.628511", "0.62832874", "0.62605256", "0.62605256", "0.6243118", "0.6221383", "0.6166579...
0.69288176
0
DELETE /event_elements/1 DELETE /event_elements/1.json
def destroy @event_element.destroy respond_to do |format| format.html { redirect_to event_elements_url, notice: 'Event element was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @event = Event.using(:shard_one).find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_...
[ "0.7053537", "0.7040418", "0.7040418", "0.7040418", "0.7039979", "0.69784653", "0.6945369", "0.6918084", "0.689456", "0.68933415", "0.68933415", "0.68933415", "0.6880953", "0.68658686", "0.6861537", "0.6835604", "0.6835494", "0.6819734", "0.6815949", "0.68095356", "0.6809278"...
0.7162513
0
up by identifiers for each block, print 1 message per failure or error found
def parse_message_from_log_entry unique_messages = { } id = "" ARGF.each do |line| block_id = line.match(/Loaded suite (.*)/) failure_msg = line.match(/[1-9]+ failures/) err_msg = line.match(/[1-9]+ errors/) if ! block_id.nil? id = block_id[1] elsif ! failure_msg.n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_results\n if !@failures.empty?\n @failures.each do |test|\n pout \"\\nFailed: #{test[:desc]}\"\n puts test[:result]\n # print a newline for easier reading\n puts \"\"\n end\n abort\n else\n puts \"All passed!\".green\n end\nend", "def display_error(i, given, correct)\...
[ "0.6025213", "0.5931905", "0.59062314", "0.58988017", "0.5816392", "0.57000244", "0.56740606", "0.56740606", "0.566949", "0.5634256", "0.5603858", "0.5530434", "0.5529261", "0.5500961", "0.5486108", "0.54777855", "0.5447047", "0.54027534", "0.5400522", "0.5374856", "0.5364118...
0.602597
0
GET /contacters/new GET /contacters/new.json
def new @contacter = Contacter.new respond_to do |format| format.html # new.html.erb format.json { render json: @contacter } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @collected_character = CollectedCharacter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @collected_character }\n end\n end", "def new\n @critic = Critic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.js...
[ "0.71536696", "0.71376354", "0.69860715", "0.67932844", "0.6752665", "0.6752592", "0.6743498", "0.67230546", "0.67180645", "0.6714468", "0.67022973", "0.67022973", "0.6701186", "0.66965705", "0.6694155", "0.6668506", "0.666785", "0.666785", "0.66590345", "0.66305506", "0.6621...
0.7767325
0
PUT /contacters/1 PUT /contacters/1.json
def update @contacter = Contacter.find(params[:id]) respond_to do |format| if @contacter.update_attributes(params[:contacter]) format.html { redirect_to @contacter, notice: 'Contacter was successfully updated.' } format.json { head :no_content } else format.html { render act...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @character.update(character_params)\n render json: @character, status: 201, location: @character\n else\n render json: @character.errors, status: :unprocessable_entity\n end\n end", "def update\n # @character.update character_params\n if @character.update character_param...
[ "0.63220584", "0.59847754", "0.59705186", "0.59299725", "0.5897285", "0.58740646", "0.58708835", "0.58698434", "0.58609897", "0.58260393", "0.58260393", "0.58260393", "0.58260393", "0.58260393", "0.58086306", "0.5805845", "0.58056647", "0.5793683", "0.5789266", "0.5747582", "...
0.643063
0
DELETE /contacters/1 DELETE /contacters/1.json
def destroy @contacter = Contacter.find(params[:id]) @contacter.destroy respond_to do |format| format.html { redirect_to contacters_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @character.destroy\n respond_to do |format|\n format.html { redirect_to characters_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cict.destroy\n respond_to do |format|\n format.html { redirect_to cicts_url }\n format.json { head :no_conten...
[ "0.67664516", "0.6712981", "0.6622304", "0.6600404", "0.6595037", "0.6564816", "0.6544008", "0.65417403", "0.65376085", "0.65118873", "0.6508892", "0.6495616", "0.64875376", "0.6487026", "0.6485353", "0.6485353", "0.6485353", "0.6485353", "0.6485353", "0.6485353", "0.6485353"...
0.7373848
0
If the passphrase contains one of "i", "o" or "l", we should skip past all the subsequent strings in the sequence that will also contain these letters.
def skip_known_failures(passphrase) passphrase.gsub(/[iol].+$/) { |m| m.chars.first.next + ('a' * m[1..-1].size) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skip?(char)\n !KEYMAP.include? char\n end", "def is_valid_passchars?(passphrase)\n words = passphrase.split(' ').map { |word| word.chars.sort.join('') }\n words.uniq.length == words.length\nend", "def encryptor(user_pass)\n counter = 0\n output = \"\"\n while counter < user_pass.length\n\n if u...
[ "0.62243783", "0.6128043", "0.59000134", "0.58669007", "0.5838073", "0.582331", "0.58108056", "0.57477117", "0.5714367", "0.5712501", "0.5688031", "0.5656528", "0.5651552", "0.5646401", "0.56370896", "0.5628277", "0.5612075", "0.5587763", "0.5585386", "0.55820566", "0.5563366...
0.7532067
0
A method that attempts to render content from rit and if none found will raise an error Arguments: layout_name: +String+ The name of the rit layout instance_name: +String+ The name of the rit instance (optional) plate_name: +String+ The name of the rit plate Returns: Returns content (string) or raises error if not foun...
def rit_plate!(layout_name, instance_name, plate_name) Rit::Plate.get(layout_name, instance_name, plate_name, session[:preview_time]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rit_plate!(layout_name, instance_name, plate_name)\n RitClient::Plate.get(layout_name, instance_name, plate_name, nil) # session[:preview_time]\n end", "def render(name, options = {})\n options = options.merge(:request => request, :params => params)\n content = render_template(name, opt...
[ "0.6837537", "0.6112611", "0.5998462", "0.5934889", "0.5829886", "0.5757414", "0.57359535", "0.5678536", "0.5645443", "0.558501", "0.55717665", "0.5544386", "0.55421066", "0.5535778", "0.55078614", "0.55052394", "0.55020916", "0.5502012", "0.5449088", "0.5441717", "0.5434127"...
0.7066558
0
GET /fotos_empresas GET /fotos_empresas.json
def index @fotos_empresas = FotosEmpresa.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @fotos = Foto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fotos }\n end\n end", "def index\n @fotos = Foto.all\n end", "def index\n @fotos = Foto.all\n end", "def index\n @fotos = Foto.all\n end", "def index\n @p...
[ "0.72819805", "0.6677903", "0.6677903", "0.6677903", "0.6607128", "0.65713364", "0.6549457", "0.65436417", "0.650856", "0.64812297", "0.6460189", "0.6456988", "0.6441628", "0.64356804", "0.64270514", "0.64240247", "0.64195305", "0.6382988", "0.6381398", "0.6377611", "0.636621...
0.74116987
0
POST /fotos_empresas POST /fotos_empresas.json
def create @fotos_empresa = FotosEmpresa.new(fotos_empresa_params) respond_to do |format| if @fotos_empresa.save format.html { redirect_to @fotos_empresa, notice: 'Fotos empresa was successfully created.' } format.json { render :show, status: :created, location: @fotos_empresa } els...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fotos_empresa_params\n params.require(:fotos_empresa).permit(:name, :image, :estado)\n end", "def set_fotos_empresa\n @fotos_empresa = FotosEmpresa.find(params[:id])\n end", "def index\n @fotos_empresas = FotosEmpresa.all\n end", "def create\n @photos = Photo.new(photos_params)\n ...
[ "0.6770414", "0.6445009", "0.62958515", "0.59873664", "0.59584296", "0.5910884", "0.5883888", "0.5875258", "0.58667576", "0.58359736", "0.5790208", "0.5782646", "0.57696867", "0.5754405", "0.57535523", "0.57173353", "0.56878203", "0.5678379", "0.5666089", "0.5660587", "0.5656...
0.70054215
0
PATCH/PUT /fotos_empresas/1 PATCH/PUT /fotos_empresas/1.json
def update respond_to do |format| if @fotos_empresa.update(fotos_empresa_params) format.html { redirect_to @fotos_empresa, notice: 'Fotos empresa was successfully updated.' } format.json { render :show, status: :ok, location: @fotos_empresa } else format.html { render :edit } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @empresas.update(empresa_params)\n #File.extname(params[:logo].path)\n format.html { redirect_to @empresas, notice: 'Empresa was successfully updated.' }\n format.json { render :show, status: :ok, location: @empresas }\n else\n forma...
[ "0.6514478", "0.64352906", "0.6353353", "0.6338215", "0.6337079", "0.6337079", "0.6287684", "0.6222424", "0.6222141", "0.6207968", "0.6204778", "0.61978185", "0.6168992", "0.61014175", "0.61005306", "0.6087029", "0.6066618", "0.6065872", "0.6045812", "0.6030342", "0.6011959",...
0.6861167
0
DELETE /fotos_empresas/1 DELETE /fotos_empresas/1.json
def destroy @fotos_empresa.destroy respond_to do |format| format.html { redirect_to fotos_empresas_url, notice: 'Fotos empresa was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @foto.destroy\n respond_to do |format|\n format.html { redirect_to fotos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @foto = Foto.find(params[:id])\n @foto.destroy\n\n respond_to do |format|\n format.html { redirect_to fotos_url }\n f...
[ "0.73268193", "0.7246554", "0.7215032", "0.72038674", "0.7198135", "0.7140757", "0.7135134", "0.71095705", "0.70867217", "0.70660174", "0.7062079", "0.7054283", "0.70417583", "0.7038", "0.7032899", "0.7026498", "0.7006211", "0.6994916", "0.69821143", "0.6975315", "0.697528", ...
0.7468334
0
Is this an scp formatted uri? (Yes, always)
def scp? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def absolute_url?(string); end", "def url?(uri)\n /\\w+\\:\\/\\// =~ uri\n end", "def validate_uri(uri)\n unless uri.is_a?(String)\n return false\n end\n\n unless uri.slice(GIT_REGEXP).nil?\n return true\n end\n\n unless uri.slice(SCP_REGEXP).nil...
[ "0.6560364", "0.6531914", "0.65225935", "0.6519746", "0.6457378", "0.64513016", "0.643928", "0.6393079", "0.63580143", "0.62727237", "0.6253669", "0.6205099", "0.61840314", "0.6169451", "0.6145825", "0.6132675", "0.60920477", "0.6088567", "0.60739416", "0.6042817", "0.6013927...
0.7442469
0
POST /pagina_principals POST /pagina_principals.json
def create @pagina_principal = PaginaPrincipal.new(pagina_principal_params) respond_to do |format| if @pagina_principal.save format.html { redirect_to @pagina_principal, notice: 'Pagina principal was successfully created.' } format.json { render :show, status: :created, location: @pagina_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_principals; end", "def valid_principals=(_arg0); end", "def set_pagina_principal\n @pagina_principal = PaginaPrincipal.find(params[:id])\n end", "def pagina_principal_params\n params.require(:pagina_principal).permit(:index)\n end", "def principals=(principals)\n if principal...
[ "0.6146954", "0.5881749", "0.58080065", "0.56739277", "0.5511896", "0.54970765", "0.5487306", "0.54829973", "0.54705435", "0.545323", "0.52862793", "0.5257387", "0.5177048", "0.5172978", "0.5170634", "0.5162392", "0.5156691", "0.51498526", "0.51335627", "0.5111573", "0.511022...
0.65687186
0
PATCH/PUT /pagina_principals/1 PATCH/PUT /pagina_principals/1.json
def update respond_to do |format| if @pagina_principal.update(pagina_principal_params) format.html { redirect_to @pagina_principal, notice: 'Pagina principal was successfully updated.' } format.json { render :show, status: :ok, location: @pagina_principal } else format.html { ren...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_principal(path, prop_patch)\n end", "def update_principal(path, prop_patch)\n value = nil\n principal_index = nil\n principal = nil\n\n @principals.each_with_index do |value, i|\n principal_index = i\n if value['uri'] == path\n ...
[ "0.70489043", "0.6467016", "0.6143503", "0.6128833", "0.6063074", "0.604816", "0.6046974", "0.6044596", "0.6041435", "0.59922636", "0.5991825", "0.59721786", "0.59666413", "0.59430414", "0.59428984", "0.5942153", "0.5934267", "0.5930359", "0.592473", "0.5901405", "0.58866197"...
0.7072099
0
DELETE /pagina_principals/1 DELETE /pagina_principals/1.json
def destroy @pagina_principal.destroy respond_to do |format| format.html { redirect_to pagina_principals_url, notice: 'Pagina principal was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end\n \n end", "def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @princip...
[ "0.7025209", "0.7020778", "0.69988394", "0.69913095", "0.6964188", "0.69519305", "0.6944103", "0.6919521", "0.69168353", "0.6915807", "0.6914297", "0.6909983", "0.6886086", "0.68858635", "0.68801904", "0.68636686", "0.6856292", "0.6855705", "0.68552876", "0.68535185", "0.6851...
0.76799166
0
checks the album to see if there is a file with the same def has_same_photo?(album_id, f)
def has_same_photo?(fb_photos, f) # album = Mogli::Album.find(album_id, client) # fb_photos = album.photos has_photo = false fb_photos.each do |p| break if has_photo fb_photo_url = p.source fb_photo_file = get_photo_as_file_from_url(fb_photo_url) # Rails.logge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def same_files?(*files)\n images = files.map { |fname| Digest::MD5.digest(File.binread(fname)) }\n images.all? { |img| img == images[0] }\nend", "def has_photo?\n File.exists? photo_filename\n end", "def has_photo?\n File.exists? photo_filename\n end", "def has_photo?\n File.exists? photo_filena...
[ "0.692624", "0.6680751", "0.6680751", "0.6680751", "0.65596867", "0.65364087", "0.64193106", "0.6240499", "0.6178675", "0.61408794", "0.61218715", "0.6101617", "0.6097256", "0.6086178", "0.60632247", "0.5990265", "0.59662616", "0.5950601", "0.59047174", "0.59040934", "0.58802...
0.82081425
0
A group is not destroyed, it's disbanded!
def disband_group destroy_collection({:table=>'groups', :on_success=>'You disbanded the group.'}) rescue flash[:notice] = "Could not find group." redirect_to :action=>'groups' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_group(group)\r\n\t\tsend('RMG', group.info[:guid])\r\n\t\t## XXX save changes locally?\r\n\t\treturn 1\r\n\tend", "def remove_group(group)\n self.groups.destroy group \n end", "def dissolve_groups\n groups.destroy_all\n end", "def refuse_group group\n group_invitations.where(group: grou...
[ "0.75015825", "0.7431315", "0.73753315", "0.7365237", "0.7246178", "0.7246178", "0.7214653", "0.71843475", "0.7062452", "0.7038382", "0.69918215", "0.6975259", "0.6952159", "0.6875535", "0.6863994", "0.6835459", "0.682714", "0.6824124", "0.68159384", "0.6806176", "0.676754", ...
0.75392514
0
GET /room_plants GET /room_plants.json
def index @room_plants = RoomPlant.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n \n @plants = Plant.all\n @personal_plants = PersonalPlant.where(:user_id => session[:user][:id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @plants }\n end\n end", "def index\n @plants = Plant.all\n\n respond_to do |format|\n...
[ "0.6873085", "0.6651381", "0.66009724", "0.6308563", "0.6165632", "0.6165632", "0.6165632", "0.6165536", "0.613408", "0.6129944", "0.61185324", "0.6094506", "0.6074843", "0.6062588", "0.6046237", "0.6040447", "0.60214645", "0.60207134", "0.6010185", "0.59752303", "0.5973547",...
0.7080606
0
POST /room_plants POST /room_plants.json
def create @room_plant = RoomPlant.new(room_plant_params) if @room_plant.save render :show, status: :created, location: @room_plant else render json: @room_plant.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n plant = Plant.create(plant_params)\n render json: plant, status: :created\n end", "def create\n @room = Room.new(room_params)\n\n respond_to do |format|\n if @room.save\n format.html { redirect_to hotelprofile_path, notice: 'Room was successfully created.' }\n format....
[ "0.6517727", "0.63890606", "0.6387817", "0.6332335", "0.62932044", "0.62543356", "0.62041664", "0.6199585", "0.6198878", "0.618649", "0.61804456", "0.61730784", "0.61699", "0.61575717", "0.6154553", "0.61489403", "0.61489403", "0.61489403", "0.61406195", "0.61406195", "0.6125...
0.7071688
0
PATCH/PUT /room_plants/1 PATCH/PUT /room_plants/1.json
def update if @room_plant.update(room_plant_params) render :show, status: :ok, location: @room_plant else render json: @room_plant.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @room = Room.find(params[:id])\n\n if @room.update_attributes(params[:room])\n head :ok\n else\n render :json => @room.errors, :status => :unprocessable_entity \n end\n end", "def update\n @restroom = Restroom.find(params[:id])\n authorize @restroom\n\n respond_to do ...
[ "0.6791316", "0.67780656", "0.6730887", "0.6712128", "0.6712128", "0.6681339", "0.6670187", "0.6633799", "0.6629523", "0.6588999", "0.6587691", "0.65767485", "0.65751785", "0.6564573", "0.6511559", "0.650831", "0.6496751", "0.6483593", "0.6483593", "0.6483593", "0.6483593", ...
0.7021614
0
DELETE /room_plants/1 DELETE /room_plants/1.json
def destroy @room_plant.destroy end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @restroom.destroy\n respond_to do |format|\n format.html { redirect_to restrooms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_room.destroy\n respond_to do |format|\n format.html { redirect_to admin_rooms_url }\n format.json { head ...
[ "0.7271063", "0.72138345", "0.7201651", "0.71675795", "0.71072954", "0.7099285", "0.70901394", "0.70900524", "0.70890146", "0.7080594", "0.70632714", "0.70386904", "0.70239305", "0.7016282", "0.70043874", "0.6989799", "0.6989799", "0.698088", "0.6963748", "0.69513077", "0.694...
0.72758394
0
get the active tasks
def active_tasks request.method = :get request.uri = '_active_tasks' Couchdbtools.execute(request) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def active_tasks\n @tasks.select { | task | task.active }\n end", "def active_tasks\n output = []\n @@task_types.each do |association_symbol|\n output = output + self.send(association_symbol).active\n end\n output\n end", "def tasks\n task_list.tasks\n end", "def active_tasks(ta...
[ "0.8875768", "0.7871919", "0.7786497", "0.7763841", "0.77072775", "0.77072775", "0.77072775", "0.7630675", "0.7594248", "0.7484615", "0.7460146", "0.7398383", "0.73976403", "0.7374667", "0.736281", "0.7312423", "0.7286491", "0.7282861", "0.7204003", "0.7187266", "0.7170786", ...
0.8051246
1
Sets the base url for this class. Note that it will not be inherited by subclasses.
def set_base_url(url) base_url = url end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_base_url\n uri = URI.parse(@page_url)\n @base_url = \"#{uri.scheme}://#{uri.host}\"\n end", "def set_base_url(url)\r\n @http_client.base_url = url\r\n end", "def base_url=(uri)\n @base_uri = uri\n end", "def base_url=(url)\n @base_url = url\n Prov.base_u...
[ "0.80746716", "0.79137087", "0.7639439", "0.7569167", "0.74566764", "0.73124325", "0.72121936", "0.718432", "0.7156618", "0.7123073", "0.70852757", "0.7073852", "0.7054508", "0.6979999", "0.6972563", "0.6944093", "0.6938912", "0.6921294", "0.6783741", "0.672607", "0.6711101",...
0.83536834
0
Builds a new HTTP request and adds it to the +Config.hydra+ request queue. Registers a callback that invokes +handle_response+ when the request completes. Recognizes the following options: +headers+ a hash to add or update the request headers +timeout+ the timeout for the request (defaults to +Ladon.default_request_tim...
def queue_request(url_or_path, options = {}, &block) url = absolute_url(url_or_path) headers = {:Accept => MEDIA_TYPE_JSON}.merge(options.fetch(:headers, {})) headers = merge_log_weasel_header(headers) timeout = options.fetch(:timeout, Ladon.default_request_timeout) req...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_and_handle http_method, path, options\n if http_method.is_a?(String) || http_method.is_a?(Symbol)\n http_method = HTTP_METHODS[http_method.to_s]\n raise \"Unknown http method: #{http_method}\" unless http_method\n end\n \n req_options = default_options.dup\n ...
[ "0.5867015", "0.5827443", "0.5689182", "0.56365407", "0.53842497", "0.5358803", "0.53440934", "0.5326121", "0.53191715", "0.5239235", "0.5218071", "0.5206298", "0.5198162", "0.51842266", "0.51709586", "0.5157912", "0.5140975", "0.5109453", "0.5106532", "0.51051325", "0.508206...
0.6955892
0
Sends a synchronous DELETE request. On success, yields any returned data; on error, yields any provided default data or +nil+. Recognizes the following options: +headers+ a hash to add or update the request headers +timeout+ the timeout for the request (defaults to +Ladon.default_request_timeout+) +default_data+ passes...
def fire_delete(url_or_path, options = {}, &block) params = options.fetch(:params, {}) params.merge!(mapped_params(options)) url = absolute_url(url_or_path, params: params) headers = {:Accept => MEDIA_TYPE_JSON}.merge(options.fetch(:headers, {})) headers = merge_log_we...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete options={}, &block\n handle_exceptions do\n Chimps.log.info(\"DELETE #{url}\")\n Response.new(super(options, &block))\n end\n end", "def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n e...
[ "0.69131684", "0.69060266", "0.6822546", "0.67484254", "0.67352724", "0.67244554", "0.67244554", "0.6722736", "0.67103326", "0.6703254", "0.66961753", "0.66961753", "0.6660535", "0.65779996", "0.654648", "0.6512669", "0.65105695", "0.64814013", "0.64459455", "0.64413345", "0....
0.70708954
0
Returns a copy of +headers+ that includes a LogWeasel header if a LogWeasel transaction is in progress.
def merge_log_weasel_header(headers) if LogWeasel::Transaction.id headers.merge(LogWeasel::Middleware::KEY_HEADER => LogWeasel::Transaction.id) else headers end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def headers\n call_once\n @headers\n end", "def headers\n @headers ||={}\n end", "def headers\n @headers ||= {}\n end", "def get_headers\n @headers = headers\n @headers\n end", "def headers\n @headers ||= {}\n end", "def headers\n @headers.reject {...
[ "0.62355393", "0.6234131", "0.61439174", "0.6142247", "0.6125728", "0.61098045", "0.60988593", "0.60849", "0.608145", "0.60323966", "0.601206", "0.6000462", "0.5993433", "0.59727526", "0.59727526", "0.59727526", "0.5943301", "0.5892086", "0.58480734", "0.58279353", "0.5796364...
0.70551175
0
Returns the URL created by appending +url_or_path+ to the server's base URL, unless +url_or_path+ is alrady absolute.
def absolute_url(url_or_path, options= {}) url = url_or_path =~ /^#{base_url}/ ? url_or_path : "#{base_url}#{url_or_path}" params = options.fetch(:params, {}) query = params.inject([]) do |rv, param| rv.concat((param[1].is_a?(Array) ? param[1] : [param[1]]).map {|v| "#{uri_esca...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def base_url\n File.join(host, path)\n end", "def base_url(operation = nil)\n index = server_operation_index.fetch(operation, server_index)\n return \"#{scheme}://#{[host, base_path].join('/').gsub(/\\/+/, '/')}\".sub(/\\/+\\z/, '') if index == nil\n\n server_url(index, server_operation_va...
[ "0.66544044", "0.65869874", "0.6545508", "0.65320575", "0.63942105", "0.6325804", "0.6305801", "0.63028127", "0.63006556", "0.62917066", "0.62789845", "0.62712216", "0.6268397", "0.6257448", "0.62521595", "0.62189317", "0.6212656", "0.62119657", "0.61598283", "0.6149283", "0....
0.6700565
0
Encodes +entity_ as a JSON string.
def encode_entity(entity) Yajl::Encoder.encode(entity) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize(entity)\n value = entity.attribute(name)\n\n if value.nil?\n value = entity.write_attribute(name, default(entity))\n end\n\n serializer.serialize value, name: name\n end", "def _serialize(entity)\n @collection.serialize(entity)\n end", ...
[ "0.66318667", "0.65506786", "0.65506786", "0.6237487", "0.6177159", "0.61610687", "0.60063857", "0.60053104", "0.5929432", "0.58121765", "0.5761164", "0.5731225", "0.57239187", "0.56732655", "0.56310195", "0.56063277", "0.55532664", "0.5545393", "0.55242205", "0.54877627", "0...
0.7911234
0
Converts +entity+ from a JSON string to an object.
def parse_entity(entity) entity = Yajl::Parser.parse(entity) entity.is_a?(Hash) ? HashWithIndifferentAccess.new(entity) : entity end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json_to_obj json_str\n hash_to_obj(parse_json(json_str))\n end", "def _parse_entity(entity_string)\n entity_type = entity_string.split(\"#\").first\n\n # hack - fixes entities with full type\n unless entity_type =~ /::/\n entity_type = \"Intrigue::Entity::#{entity_type}\"\n end\n...
[ "0.7105521", "0.66010773", "0.6512244", "0.6490825", "0.6428207", "0.6293814", "0.6285323", "0.61657053", "0.61343664", "0.61341286", "0.6125743", "0.5979551", "0.5973756", "0.59164816", "0.57833725", "0.57226646", "0.57207406", "0.5691729", "0.56381327", "0.5630607", "0.5616...
0.68498087
1
Converts options to a pager. If none of the below described options is provided, returns +nil+.
def pager(options) pager = if options.include?(:pager) options[:pager] elsif options[:paged] || options[:pre_paged] || options[:page].present? || options[:per].present? Ladon::Pager.new(options) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_paging_options(options, default_opts = {})\n if default_opts.blank?\n # This conditions will order records by directory and name first.\n default_opts = {\n :sort_criteria => DEFAULT_ORDER\n }\n end\n paging_options(options, default_opts)\n ...
[ "0.6366224", "0.6321129", "0.6264103", "0.613818", "0.59587413", "0.5934598", "0.5926572", "0.5889537", "0.5737416", "0.57153875", "0.56498396", "0.5614686", "0.5596935", "0.55710346", "0.55707645", "0.5552049", "0.5524171", "0.5480148", "0.5470236", "0.54599315", "0.5397454"...
0.7431409
0
returns lowest sum of the winning and losing teams' scores
def lowest_total_score total_game_scores = games.map { |game| game.home_goals + game.away_goals} total_game_scores.min end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def winning_scores\n high_score = scores.max{|score| score.total}.total\n scores.select {|score| score.total == high_score}\n end", "def winning_team\n final_scores = player_collection.reduce(home: 0, away: 0) { |teams_points, next_player|\n case \n when next_player[:location] === :away\n ...
[ "0.7851294", "0.74098927", "0.73059714", "0.721409", "0.7213303", "0.7185231", "0.71397245", "0.7136335", "0.71146756", "0.70175725", "0.7000605", "0.6939029", "0.6937342", "0.6914247", "0.69123906", "0.6910729", "0.6878701", "0.6810575", "0.67979", "0.6797448", "0.6790686", ...
0.79345125
0
returns venue with most games played
def most_popular_venue venues = @games.group_by { |game| game.venue} venues.max_by { |venue, games| games.count }.first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def least_popular_venue\n venues = @games.group_by { |game| game.venue}\n venues.min_by { |venue, games| games.count }.first\n end", "def season_with_most_games\n seasons = @games.group_by { |game| game.season }\n seasons.max_by { |season, games| games.count }.first\n end", "def most_hits(seasona...
[ "0.765993", "0.7615187", "0.70569223", "0.69957685", "0.6989212", "0.6966518", "0.68768334", "0.6811023", "0.676626", "0.67556614", "0.67386675", "0.67024064", "0.66293275", "0.6609352", "0.66087717", "0.66087717", "0.6598287", "0.6582044", "0.6576285", "0.65722543", "0.65484...
0.8410583
0