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
Retrieve a Family by font family name
def family_by_name(name) Family.find_by_name(name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def family\n @family ||= family_options.map do |font_name, font_options|\n name = parse_font_name(font_name)\n\n options = font_options.sort.uniq\n\n options.any? ? \"#{name}:#{options.join(',')}\" : name\n end.join('|')\n end", "def _font_family(id)\n {\n 0x...
[ "0.728838", "0.68707097", "0.67631054", "0.6666355", "0.663432", "0.65537095", "0.65502644", "0.64358795", "0.63719773", "0.6371882", "0.6363303", "0.6351897", "0.6331646", "0.63307244", "0.63152313", "0.6279574", "0.61627495", "0.6132671", "0.6091355", "0.6053745", "0.603033...
0.7447777
0
returns the next consecutive semester and year same as above, except instance method
def get_next_semester_and_year return Semester.get_next_semester_and_year(semester, year) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def year\n ((semester - 1) / 2) + 1\n end", "def next_year\n AcademicYear.find_by(year: self.year + 1)\n end", "def semester\n time = time_from_enrollment\n @semester = time.div(1.year / 2) + 1\n @semester = 1 if @semester <= 0\n return @semester\n end", "def get_next_yr\n\tset_cur_year(...
[ "0.7330652", "0.7274078", "0.7120933", "0.69841176", "0.67547953", "0.6654071", "0.6459806", "0.6417507", "0.640847", "0.6392686", "0.6349299", "0.63334507", "0.63226867", "0.62452334", "0.62261397", "0.62091297", "0.6134392", "0.61342484", "0.6108077", "0.6076894", "0.606788...
0.82644194
0
follow character straigh and diagonal
def follow_char(character) sx = distance_x_from(character.x) sy = distance_y_from(character.y) if sx != 0 && sy != 0 move_diagonal(sx > 0 ? 4 : 6, sy > 0 ? 8 : 2) elsif sx != 0 move_straight(sx > 0 ? 4 : 6) elsif sy != 0 move_straight(sy > 0 ? 8 : 2) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diagonal_up_to_string(row_index, col_index)\n #move to edge\n until row_index == @rows - 1 || col_index == 0\n row_index += 1\n col_index -= 1\n end\n\n #form diagonal string from edge\n diagonal_string = \"\"\n while row_index > 0 && col_index < @cols\n diagonal_string += @gri...
[ "0.66723865", "0.64288956", "0.63903207", "0.6275684", "0.62707317", "0.6252836", "0.6166597", "0.60894215", "0.590144", "0.5861546", "0.5823039", "0.5768013", "0.5763936", "0.5752961", "0.57455945", "0.57381254", "0.5736229", "0.57319665", "0.5724865", "0.57094526", "0.57042...
0.64770716
1
jump to specific tiles
def jumpto_tile(x, y) jumpto(0, [x, y]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def goto(obj, tile=nil)\r\n @x = obj.x\r\n @y = obj.y\r\n @mapx = tile.mapx\r\n @mapy = tile.mapy\r\n @tile = tile\r\n if @tile != nil\r\n @tile.occupy(self)\r\n end\r\n end", "def move_one begTile\n @maze.get_adjacent_tiles(begTile).each do |tile...
[ "0.681838", "0.62129366", "0.6167943", "0.6155464", "0.60703015", "0.6056737", "0.6056698", "0.6022444", "0.5966098", "0.59534216", "0.5945517", "0.59411716", "0.59160763", "0.5876896", "0.5866439", "0.57733643", "0.5735784", "0.5730152", "0.5722916", "0.5709836", "0.570626",...
0.8066769
0
User anime sprite creation
def create_anime_sprite_object(item) $game_player.anime_action.each {|i| if i.user == self if i.custom_graphic @transparent = false i.user.using_custom_g = false end $game_player.anime_action.delete(i) end} if PearlKernel.user_graphic != "nil" return if PearlKern...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main_sprite ; end", "def create_oneanim_sprite\n @one_anim = Sprite_OneAnim.new(@viewport1)\n end", "def call_idle(sprite, anime)\n $game_player.set_step_anime(anime)\n $game_player.set_graphic(sprite)\n end", "def call_idle(sprite, anime)\n $game_player.set_step_anime(anime)\n $game...
[ "0.6765057", "0.6732406", "0.6731488", "0.6675855", "0.6648297", "0.64864844", "0.6442998", "0.6386315", "0.638057", "0.6354336", "0.6308734", "0.6243068", "0.62347287", "0.62156254", "0.6199578", "0.6186388", "0.6129895", "0.61244035", "0.61062926", "0.6093964", "0.6084211",...
0.79256856
0
reset knockdown enemies game player call
def reset_knockdown_enemies $game_map.events.values.each do |event| if event.knockdown_data[1] != nil event.knockdown_data[0] = 0 event.knowdown_effect(2) end if event.deadposee and event.killed $game_self_switches[[$game_map.map_id, event.id, PearlKernel::Knockdown...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_knockdown_actors\n # reset knock down\n if @knockdown_data[1] != nil\n @knockdown_data[0] = 0\n knowdown_effect(2)\n end\n # force clear knock down\n $game_player.followers.each do |follower|\n if follower.knockdown_data[1] != nil\n follower.knockdown_data[0] = 0\n ...
[ "0.735721", "0.731591", "0.731591", "0.7201511", "0.7006652", "0.6916159", "0.6873152", "0.6828643", "0.6814836", "0.68051904", "0.6728379", "0.66886264", "0.66626406", "0.6618975", "0.65896195", "0.6569383", "0.6563998", "0.65541506", "0.6540335", "0.6425402", "0.6383882", ...
0.7789281
0
Prints the supplied message to the socket.
def print_raw(msg = '') @sock.write(msg) @sock.flush msg end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def puts(message)\n\t\t@socket.puts(message)\n\tend", "def send(msg)\n @socket.puts msg\n puts '<< ' << msg\n end", "def send(message)\n puts prefix + message\n end", "def say(string)\n @socket.puts string\n end", "def print(message)\n output.print(message)\n end", "def sen...
[ "0.8073091", "0.7744468", "0.73710304", "0.71799856", "0.7156388", "0.7147595", "0.713827", "0.70731854", "0.70153785", "0.69717157", "0.6969954", "0.69104356", "0.6861471", "0.68448496", "0.6813168", "0.67955124", "0.67862856", "0.6758694", "0.6730025", "0.66705555", "0.6662...
0.78019667
1
GET /credit_point_packs GET /credit_point_packs.json
def index @credit_point_packs = CreditPointPack.order_by_price end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @credit_point_pack = CreditPointPack.new(credit_point_pack_params)\n\n respond_to do |format|\n if @credit_point_pack.save\n format.html { redirect_to @credit_point_pack, notice: 'Credit point pack was successfully created.' }\n format.json { render :show, status: :created, lo...
[ "0.69023854", "0.6467619", "0.6414127", "0.62306315", "0.6175926", "0.59596044", "0.594749", "0.5926122", "0.57959676", "0.56767106", "0.5656793", "0.5647559", "0.56451315", "0.5626509", "0.5554531", "0.55371195", "0.55223006", "0.54787344", "0.54723185", "0.5454747", "0.5438...
0.6833062
1
POST /credit_point_packs POST /credit_point_packs.json
def create @credit_point_pack = CreditPointPack.new(credit_point_pack_params) respond_to do |format| if @credit_point_pack.save format.html { redirect_to @credit_point_pack, notice: 'Credit point pack was successfully created.' } format.json { render :show, status: :created, location: @cr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def credit_point_pack_params\n params.require(:credit_point_pack).permit(:name, :number_of_points, :price, :available)\n end", "def set_credit_point_pack\n @credit_point_pack = CreditPointPack.find(params[:id])\n end", "def update\n respond_to do |format|\n if @credit_point_pack.update(...
[ "0.6830603", "0.64698017", "0.61246294", "0.5901423", "0.5814124", "0.58043295", "0.5740566", "0.57147807", "0.57138926", "0.5712787", "0.571232", "0.5711936", "0.5686819", "0.5673943", "0.5668886", "0.56241727", "0.55962145", "0.5557745", "0.55378014", "0.5536556", "0.552861...
0.7847959
0
PATCH/PUT /credit_point_packs/1 PATCH/PUT /credit_point_packs/1.json
def update respond_to do |format| if @credit_point_pack.update(credit_point_pack_params) format.html { redirect_to @credit_point_pack, notice: 'Credit point pack was successfully updated.' } format.json { render :show, status: :ok, location: @credit_point_pack } else format.html ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_credit_point_pack\n @credit_point_pack = CreditPointPack.find(params[:id])\n end", "def update\n @bundlesticker = Bundlesticker.find(params[:id])\n\n respond_to do |format|\n if @bundlesticker.update_attributes(params[:bundlesticker])\n format.html { redirect_to @bundlesticker, ...
[ "0.65346515", "0.6236466", "0.6234161", "0.6153591", "0.6115034", "0.60719955", "0.60673", "0.6046007", "0.59513086", "0.59331775", "0.58997893", "0.58946025", "0.58605856", "0.5855198", "0.58446693", "0.58408546", "0.58351654", "0.581373", "0.58112025", "0.580933", "0.580471...
0.74985576
0
DELETE /credit_point_packs/1 DELETE /credit_point_packs/1.json
def destroy @credit_point_pack.destroy respond_to do |format| format.html { redirect_to credit_point_packs_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deleteFlatpack( flatpack_id)\n params = Hash.new\n params['flatpack_id'] = flatpack_id\n return doCurl(\"delete\",\"/flatpack\",params)\n end", "def destroy\n @bill_point = BillPoint.find(params[:id])\n @bill_point.destroy\n\n respond_to do |format|\n format.html { redirect_to bill_po...
[ "0.7190704", "0.68271494", "0.68006396", "0.66729957", "0.66162777", "0.6608651", "0.6576276", "0.6576276", "0.6576276", "0.65756583", "0.65636003", "0.6559614", "0.6551069", "0.6550039", "0.6541549", "0.6535688", "0.65291417", "0.6523564", "0.6518564", "0.6498263", "0.648256...
0.8009552
0
Express the result with one emoji.
def emoji if failure? FAILURE_EMOJI else ERROR_EMOJI end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def emoji; end", "def postprocess(text)\n inline_emoji(text)\n end", "def farewell_message\n puts \"\"\n puts \"Cheers! \\u{1f37b}\" # beer emoji 🍻\n end", "def render(text, emojis)\n emoji_index_cycle = (0...emojis.size).cycle\n\n char_maps = text.split('')\n .map { |cha...
[ "0.7086658", "0.6013211", "0.5942271", "0.59170234", "0.58520955", "0.5789691", "0.57489485", "0.56702167", "0.56276166", "0.5481399", "0.5461501", "0.54057574", "0.5359345", "0.5331856", "0.53045225", "0.52942723", "0.5279001", "0.5276611", "0.52535856", "0.5245185", "0.5238...
0.6381777
1
Collect all distinct tire model / tire category combinations for this brand Tire models are allowed to appear under more than one category
def get_all_tire_categories cats = TireModelInfo.joins('INNER JOIN tire_models ON tire_models.tire_model_info_id = tire_model_infos.id', 'INNER JOIN tire_categories ON tire_models.tire_category_id = tire_categories.id') .where(tire_manufacturer_id: self.id) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_tgp_tire_categories\n models = TireModelInfo.joins('INNER JOIN tire_models ON tire_models.tire_model_info_id = tire_model_infos.id')\n .where(tire_manufacturer_id: self.id).where('tgp_category_id IS NOT NULL')\n .select('DISTINCT tire_model_infos.id,...
[ "0.7014927", "0.6648356", "0.6133134", "0.6118905", "0.6111475", "0.60105354", "0.5930659", "0.59269226", "0.59262073", "0.58913136", "0.5886169", "0.5849953", "0.5843857", "0.58431584", "0.58404857", "0.5815513", "0.57914346", "0.57116693", "0.57049423", "0.56540936", "0.564...
0.6868425
1
Collect all distinct tire model / TGP category combinations for this brand Tire models are allowed to appear under more than one category
def get_all_tgp_tire_categories models = TireModelInfo.joins('INNER JOIN tire_models ON tire_models.tire_model_info_id = tire_model_infos.id') .where(tire_manufacturer_id: self.id).where('tgp_category_id IS NOT NULL') .select('DISTINCT tire_model_infos.id, tire_mo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_tire_categories\n cats = TireModelInfo.joins('INNER JOIN tire_models ON tire_models.tire_model_info_id = tire_model_infos.id',\n 'INNER JOIN tire_categories ON tire_models.tire_category_id = tire_categories.id')\n .where(tire_manufacturer_id: self...
[ "0.65831774", "0.6457169", "0.6087188", "0.6050091", "0.60227567", "0.59662926", "0.59370995", "0.59357786", "0.5825724", "0.58216643", "0.57676286", "0.5759138", "0.5734927", "0.57027525", "0.56972903", "0.56753653", "0.5655451", "0.5648612", "0.5637516", "0.56079876", "0.56...
0.71169597
0
Collect all distinct tire model / car type combinations for this brand
def get_all_car_types models = TireModelInfo.joins('INNER JOIN tire_models ON tire_models.tire_model_info_id = tire_model_infos.id') .select('tire_model_infos.*, tire_models.tire_code AS "tire_code", MIN(tire_models.orig_cost) AS "starting_cost"') .where(tire_manufa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def products_brands(products)\n products.map{|product| product['brand']}.uniq\nend", "def brands_array\n ($products_hash['items'].map { |toy| toy['brand'] }).uniq\nend", "def cars\n return cars_by_license_plate unless @license_plate.empty?\n cars_by_color\n end", "def brands\n beers...
[ "0.64856875", "0.6158809", "0.6057597", "0.5898414", "0.57761735", "0.57627577", "0.57495594", "0.56794167", "0.5621073", "0.5608803", "0.5587764", "0.55733275", "0.5571617", "0.5567967", "0.5563719", "0.5539419", "0.55317026", "0.55138755", "0.55098176", "0.54869604", "0.547...
0.7143937
0
PUT /cards/1 PUT /cards/1.xml
def update # @card = Card.find(params[:id]) respond_to do |format| if @card.update_attributes(params[:card]) flash[:notice] = 'Card was successfully updated.' format.html { redirect_to(@card) } format.xml { head :ok } else format.html { render :action => "edit" } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @card = Card.find(params[:id])\n respond_to do |format|\n if @card.update_attributes(params[:card])\n flash[:notice] = 'Card was successfully updated.'\n format.html { redirect_to(deck_card_url(@deck, @card)) }\n format.xml { head :ok }\n else\n @decks = De...
[ "0.6589716", "0.65789574", "0.6406034", "0.63808924", "0.63539326", "0.63539326", "0.63539326", "0.63418454", "0.6318522", "0.6305802", "0.6300466", "0.629058", "0.62860274", "0.61777765", "0.61374116", "0.61374116", "0.61374116", "0.61374116", "0.61374116", "0.61374116", "0....
0.6795415
0
DELETE /cards/1 DELETE /cards/1.xml
def destroy # @card = Card.find(params[:id]) @card.destroy respond_to do |format| format.html { redirect_to(:back) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @card = Card.find(params[:id])\n @card.destroy\n\n respond_to do |format|\n format.html { redirect_to(deck_cards_url(@deck)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @five_card = FiveCard.find(params[:id])\n @five_card.destroy\n\n respond_to do |form...
[ "0.7198513", "0.70586306", "0.7013227", "0.6997778", "0.69684434", "0.6935861", "0.6913809", "0.68681854", "0.6815935", "0.6802931", "0.6791042", "0.6787548", "0.67659336", "0.67659336", "0.67659336", "0.67377", "0.67159986", "0.6696428", "0.66957396", "0.6688146", "0.666909"...
0.72129923
0
Autotest will look for spec commands in the following locations, in this order: bin/spec default spec bin/loader installed in Rubygems
def spec_commands [ File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'bin', 'spec')), File.join(Config::CONFIG['bindir'], 'spec') ] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spec_commands\n [File.join(Config::CONFIG['bindir'], 'spec'), 'spec']\n end", "def spec_commands\n [File.join(Config::CONFIG['bindir'], 'spec'), 'spec']\n end", "def spec_commands\n [File.join(Config::CONFIG['bindir'], 'spec'), 'spec']\n end", "def setup_auto_test\n ENV['RSPEC'] = 'true' ...
[ "0.7678369", "0.7678369", "0.7678369", "0.68583155", "0.65796", "0.6557628", "0.6321307", "0.62469125", "0.621284", "0.61861", "0.61861", "0.6170495", "0.61602753", "0.60869324", "0.6081475", "0.6057148", "0.60191387", "0.6014289", "0.6014236", "0.6011074", "0.60078967", "0...
0.78004867
0
GET /Embeddable/open_responses/1 GET /Embeddable/open_responses/1.xml
def show @open_response = Embeddable::OpenResponse.find(params[:id]) if request.xhr? render :partial => 'show', :locals => { :open_response => @open_response } else respond_to do |format| format.html # show.html.haml format.jnlp { render :partial => 'shared/installer', :locals =>...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @user_openids = UserOpenid.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @user_openids }\n end\n end", "def show\n @response = Response.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n ...
[ "0.608897", "0.6075171", "0.5915318", "0.5871443", "0.5867999", "0.5866636", "0.5804312", "0.5762687", "0.5761617", "0.5742818", "0.5735696", "0.5703224", "0.56950384", "0.5685316", "0.56615794", "0.5660818", "0.56452525", "0.5633318", "0.56174076", "0.5613713", "0.560558", ...
0.6319006
0
POST /Embeddable/open_responses POST /Embeddable/open_responses.xml
def create @open_response = Embeddable::OpenResponse.new(params[:open_response]) cancel = params[:commit] == "Cancel" if request.xhr? if cancel redirect_to :index elsif @open_response.save render :partial => 'new', :locals => { :open_response => @open_response } else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @open_response = Embeddable::OpenResponse.find(params[:id])\n respond_to do |format|\n format.html { redirect_to(open_responses_url) }\n format.xml { head :ok }\n format.js\n end\n # TODO: We should move this logic into the model!\n @open_response.page_elements.each do...
[ "0.567167", "0.56690717", "0.5621848", "0.56049716", "0.551115", "0.5444393", "0.5381834", "0.5281441", "0.527088", "0.523555", "0.52156264", "0.5182548", "0.5177007", "0.5177007", "0.5177007", "0.5177007", "0.5177007", "0.5177007", "0.5177007", "0.5177007", "0.5177007", "0...
0.65215564
0
PUT /Embeddable/open_responses/1 PUT /Embeddable/open_responses/1.xml
def update cancel = params[:commit] == "Cancel" @open_response = Embeddable::OpenResponse.find(params[:id]) if request.xhr? if cancel || @open_response.update_attributes(params[:embeddable_open_response]) render :partial => 'show', :locals => { :open_response => @open_response } else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @open_response = Embeddable::OpenResponse.new(params[:open_response])\n cancel = params[:commit] == \"Cancel\"\n if request.xhr?\n if cancel\n redirect_to :index\n elsif @open_response.save\n render :partial => 'new', :locals => { :open_response => @open_response }\n ...
[ "0.57641286", "0.5665278", "0.55735976", "0.55076814", "0.5501253", "0.54921687", "0.5480575", "0.54805607", "0.5436062", "0.53067553", "0.5296444", "0.52292", "0.52272546", "0.5188145", "0.5163034", "0.5149911", "0.5143354", "0.5141434", "0.5137631", "0.5130713", "0.51269764...
0.65986556
0
DELETE /Embeddable/open_responses/1 DELETE /Embeddable/open_responses/1.xml
def destroy @open_response = Embeddable::OpenResponse.find(params[:id]) respond_to do |format| format.html { redirect_to(open_responses_url) } format.xml { head :ok } format.js end # TODO: We should move this logic into the model! @open_response.page_elements.each do |pe| p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @response = Response.find(params[:id...
[ "0.7012579", "0.6651561", "0.65560836", "0.65465456", "0.65258634", "0.65165734", "0.6482845", "0.6429739", "0.6411512", "0.63764036", "0.6356658", "0.63456875", "0.6345088", "0.6328726", "0.63209045", "0.63144433", "0.62959623", "0.62645596", "0.6258221", "0.6238944", "0.623...
0.7056803
0
return the number of matches in the file. Don't read the entire file into memory; read it only (num_lines_per_batch) lines at a time
def num_matches_in_file(fname, match_regexp) num_lines_per_batch = 5000 num_matched = 0 if File.exist? fname File.open(fname, "r") do |f| # use an enumerator to read just (num_lines_per_batch) lines at a time f.lazy.each_slice(num_lines_per_batch) do |lines| ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_lines(all_lines_from_file)\n all_lines_from_file.lines.count\nend", "def n_lines(filename)\n File.foreach(filename).reduce(0) { |acc, _elem| acc + 1 }\n end", "def n_lines(filename); end", "def count_lines()\n start_time = Time.now\n @file_lines = 0 \n last_block_po...
[ "0.68329793", "0.6793775", "0.6727576", "0.6684314", "0.66674596", "0.665338", "0.66107076", "0.6572488", "0.649866", "0.649313", "0.6434707", "0.64026797", "0.6375943", "0.6369467", "0.63271815", "0.62666637", "0.6243256", "0.6243017", "0.61899006", "0.61893433", "0.618073",...
0.82626873
0
Updates self.models and build a route for the model raise an error if the model is already known
def register_model(model) raise ArgumentError, "already know this model" if models.include?(model) models << model build_route_for_model(model) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build!\n models.each do |model|\n build_route_for_model(model)\n end\n end", "def setup_routes\n if prefix\n pre = prefix.to_s[1..-1] + '/'\n end\n model_regexp = Regexp.union(models.keys.map{|m| Regexp.escape(m)})\n controller = @controller.name.sub(/...
[ "0.66855085", "0.58033574", "0.553516", "0.548542", "0.5375248", "0.5286758", "0.5268972", "0.51702493", "0.515043", "0.5144157", "0.5143855", "0.50868946", "0.50835633", "0.5081802", "0.5057851", "0.504427", "0.49987757", "0.4946716", "0.49271715", "0.49091372", "0.48773256"...
0.6183743
1
Loads the file at path and turn it to a ruby object based on the file extension. If the file extension is not supported, will raise an error. uses JSON.parse(File.read(path)) and YAML.load_file(path) for '.json' and '.yaml' otherwise, will forward the handling such that '.foobaar' maps to :read_foobar(path)
def read_file(path) raise ArgumentError, "don't know extension #{ext}, use from [#{extensions.join(', ')}]" unless understands_ext?(path) ext = File.extname(path) case ext when '.json' JSON.parse(File.read(path)) when '.yaml' YAML.load_file(path) else self.sen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_config_file config_path\n File.open(config_path, \"r\") do |file|\n case File.extname(file).delete(\".\")\n when \"json\" then JSON.parse(file.read)\n when \"yml\" then YAML.load_file(file)\n else\n file.close\n raise LoadError, \"Type of file is not sup...
[ "0.67945975", "0.6717681", "0.6596083", "0.6596083", "0.65618277", "0.65604895", "0.6492246", "0.63893735", "0.63614494", "0.6229783", "0.6198518", "0.61499316", "0.6127462", "0.61159956", "0.6115513", "0.6110049", "0.60965884", "0.6092773", "0.6075345", "0.6067231", "0.60632...
0.8175572
0
Wether or not this DB understands the extension of the file at path.
def understands_ext?(path) extensions.find{|ext| ext == File.extname(path)} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def proper_ext?(raw_path)\n path = raw_path.is_a?(Pathname) ? raw_path : Pathname.new(raw_path)\n LokaliseRails.file_ext_regexp.match? path.extname\n end", "def uses_extension?\n @format =~ /\\.[^\\.]+$/\n end", "def supported_file?(path)\n ext = File.extname(path)\n ...
[ "0.7515566", "0.7483509", "0.7469188", "0.7319592", "0.7267296", "0.7261778", "0.72025883", "0.70653576", "0.7035526", "0.6792193", "0.67615813", "0.6758422", "0.67477065", "0.6728807", "0.6724527", "0.67084503", "0.6705728", "0.6670553", "0.6629256", "0.6621808", "0.65945596...
0.7767626
0
Returns the main name of a path, i.e., the basename without the extension main_name('/a/b/c/foo.bar') => 'foo'
def main_name(path) File.basename(path).sub(/\.[^\.]+$/,'') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path_name\n return unless @basename\n\n parts = @basename.split('.')\n parts.pop if parts.length > 1 && parts.last =~ /^\\w+$/\n parts.pop if parts.last =~ /^\\d+$/\n parts.join('.')\n end", "def file_name_from_path(path)\n path.split(\"/\")[-1]\n end", "def basename\n ...
[ "0.77965236", "0.73246247", "0.72832626", "0.7261556", "0.7219874", "0.71804863", "0.71052563", "0.7101444", "0.7081108", "0.70793754", "0.7016282", "0.6999164", "0.6997734", "0.6960618", "0.69556105", "0.69405204", "0.6929045", "0.68773997", "0.68773997", "0.68622255", "0.68...
0.8626803
0
Returns the perspective name and extension name (a 2 items array) for the given path. By default the blobs for resources content are stored in files named 'resource' with ext starting with a dot
def persp_and_ext_for_basename(path) [main_name(path).sub('resource-epo-',''), File.extname(path)] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path\n name + extension\n end", "def file_title(path)\n filename_from_path(path).split(\".\")[0]\n end", "def split_path(path)\n m = CHEF_OBJECT_RE.match(path)\n unless m\n warn \"Skipping '#{path}' -- it doesn't look like '*cookbooks/**/*', '*roles/*.{rb,json}', '*environments...
[ "0.6222756", "0.61076194", "0.5940214", "0.59223026", "0.5907372", "0.5900902", "0.57627887", "0.57480156", "0.574314", "0.5740957", "0.5726824", "0.5703643", "0.56914824", "0.56693316", "0.5634907", "0.561513", "0.5581304", "0.55733824", "0.55678064", "0.55049616", "0.545777...
0.68448985
0
Returns the basename of a resource blob for a perspective named persp and in a format with extension ext (including the leading dot). see also persp_and_ext_for_basename
def basename_for_persp_and_ext(persp, ext) "resource-epo-#{persp}#{ext}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def persp_and_ext_for_basename(path)\n [main_name(path).sub('resource-epo-',''), File.extname(path)]\n end", "def basename\n File.basename( fullpath, ext )\n end", "def path_name\n return unless @basename\n\n parts = @basename.split('.')\n parts.pop if parts.length > 1 && par...
[ "0.71994376", "0.6951703", "0.6906279", "0.68681073", "0.6795129", "0.6772939", "0.6714076", "0.67106754", "0.66917956", "0.6681591", "0.6680807", "0.66445214", "0.66301304", "0.66248095", "0.66248095", "0.6601679", "0.65960187", "0.6552587", "0.65388006", "0.65322244", "0.65...
0.799141
0
Saves one or more resource at the filesystem path given at root This method is mainly an handy helper around batch_save, look at the source and at batch_save's doc
def save(root, resource, perspective=:default, exts=nil) exts ||= extensions batch_save(root, [resource].flatten, [perspective].flatten, [exts].flatten) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch_save(root, resources, persps, exts)\n batch_save_actions(root, resources, persps, exts) do |action|\n action.perform\n end\n end", "def batch_save_actions(root, resources, persps, exts)\n if block_given?\n resources.each do |resource|\n db_path = File.join(root,...
[ "0.7635338", "0.66243577", "0.6067034", "0.5931464", "0.5767577", "0.56464463", "0.55878687", "0.55527407", "0.55380166", "0.5491703", "0.5483698", "0.54705024", "0.5463142", "0.54473186", "0.5441242", "0.5434289", "0.54005474", "0.5372312", "0.5358823", "0.5355736", "0.53519...
0.6817243
1
Saves all the resources, under all the perspectives persps, and all format given by extensions exts at the filesystem path root. resources, perps, exts, must respond to :each, like for Enumerable
def batch_save(root, resources, persps, exts) batch_save_actions(root, resources, persps, exts) do |action| action.perform end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch_save_actions(root, resources, persps, exts)\n if block_given?\n resources.each do |resource|\n db_path = File.join(root, resource.path(identifying_sym))\n yield PrepareDirAction.new(db_path)\n exts.each do |ext|\n persps.each do |persp|\n bas...
[ "0.7092153", "0.68857044", "0.612171", "0.5859371", "0.575992", "0.5634296", "0.55421543", "0.5347554", "0.53025943", "0.5282195", "0.5123961", "0.51138026", "0.5113333", "0.50949955", "0.509466", "0.50825787", "0.5018392", "0.50049037", "0.49954116", "0.49954116", "0.4987611...
0.732681
0
Yields all the action needed to store all the resources at perspectives persps and with formats exts. All actions respond to :perform (it is when they're executed). If no block given, returns an Enumerator with these actions.
def batch_save_actions(root, resources, persps, exts) if block_given? resources.each do |resource| db_path = File.join(root, resource.path(identifying_sym)) yield PrepareDirAction.new(db_path) exts.each do |ext| persps.each do |persp| basename = base...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_actions\n catch_exceptions do\n @success = if block_given?\n result = yield\n actions.each { |action| results[action] = result }\n !!result\n else\n actions.compact.each { |action| !skip_actions && (results[action] = object.send(action)) }\n r...
[ "0.58765167", "0.587392", "0.5661069", "0.5458024", "0.52771187", "0.5229261", "0.5206296", "0.52009153", "0.5187542", "0.5149291", "0.5110233", "0.50481886", "0.50359124", "0.49605536", "0.4944478", "0.49286473", "0.4918648", "0.4882591", "0.48800528", "0.4869334", "0.482979...
0.70245516
0
Public: Return logical path with digest spliced in. "foo/bar37b51d194a7513e45b56f6524f2d51f2.js" Returns String.
def digest_path if DigestUtils.already_digested?(@name) logical_path else logical_path.sub(/\.(\w+)$/) { |ext| "-#{etag}#{ext}" } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def digest_path\n logical_path.sub(/\\.(\\w+)$/) { |ext| \"-#{digest}#{ext}\" }\n end", "def logical_path\n digest_path\n end", "def path_with_fingerprint(digest)\n if Rails.env.development?\n pathname.to_s\n else\n sprockets_path_with_fingerprint(digest)\n end\n end...
[ "0.83635634", "0.7270988", "0.7147128", "0.69809395", "0.6870992", "0.6701046", "0.66437596", "0.66437596", "0.65050864", "0.64633024", "0.6454508", "0.6380829", "0.635202", "0.63293433", "0.6320092", "0.63150233", "0.6289059", "0.6266777", "0.6266221", "0.6236545", "0.623500...
0.78965664
1
Public: Return load path + logical path with digest spliced in. Returns String.
def full_digest_path File.join(@load_path, digest_path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def digest_path\n logical_path.sub(/\\.(\\w+)$/) { |ext| \"-#{digest}#{ext}\" }\n end", "def logical_path\n digest_path\n end", "def digest_path\n if DigestUtils.already_digested?(@name)\n logical_path\n else\n logical_path.sub(/\\.(\\w+)$/) { |ext| \"-#{etag}#{e...
[ "0.71245205", "0.6553707", "0.65431976", "0.64675695", "0.64177436", "0.63957435", "0.6304689", "0.60836434", "0.60177493", "0.59440017", "0.59432095", "0.59061414", "0.5889158", "0.58734107", "0.585569", "0.585569", "0.5831985", "0.5831985", "0.57912415", "0.57864416", "0.57...
0.7469544
0
Public: Get charset of source. Returns a String charset name or nil if binary.
def charset metadata[:charset] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def charset\n match_data = headers['Content-Type']&.match(/charset=(.*);?/)\n return unless match_data\n\n Encoding.find(match_data[1])\n end", "def charset\n if @header\n has_content_type? ? content_type_parameters['charset'] : @charset\n else\n @charset\n end\n ...
[ "0.659046", "0.6367566", "0.6229204", "0.61779934", "0.6177169", "0.61548465", "0.6091332", "0.60854757", "0.59697956", "0.594551", "0.5923558", "0.5916024", "0.59149176", "0.58618385", "0.58477885", "0.5847129", "0.5847129", "0.5847129", "0.5831569", "0.58224195", "0.5801194...
0.6480153
1
Private: Return the version of the environment where the asset was generated.
def environment_version metadata[:environment_version] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_version\n\t\tself.dev_stage.blank? ? dev_stage_string = \"\" : dev_stage_string = self.dev_stage + \" \"\n\t\treturn dev_stage_string + self.maj_version.to_s + \".\" + self.min_version.to_s\n\tend", "def current_version\n @version\n end", "def version\n @context[:version]\n end"...
[ "0.69615805", "0.68095315", "0.67515105", "0.6736874", "0.6731159", "0.66549534", "0.66549534", "0.664992", "0.66052073", "0.65853703", "0.6568541", "0.6568541", "0.6568541", "0.6568541", "0.6568541", "0.6568541", "0.6568541", "0.6568541", "0.6568541", "0.6560332", "0.6560332...
0.8182466
0
Public: Returns String hexdigest of source.
def hexdigest DigestUtils.pack_hexdigest(digest) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hexdigest\n @digest.unpack('H*'.freeze).first\n end", "def sha\n Digest::SHA2.new.update(self.source).to_s\n end", "def hexdigest\n # Read bytes in chunks of the optimal digest size.\n while (chunk = @io.read(@digest.block_length))\n @digest.update(chunk)\n end\n ...
[ "0.7024892", "0.69064796", "0.679805", "0.67686576", "0.67412823", "0.66941434", "0.6669235", "0.6544983", "0.6532558", "0.64899343", "0.6483101", "0.64821243", "0.6461859", "0.64482766", "0.6448199", "0.64390695", "0.64390695", "0.64012575", "0.633038", "0.62840676", "0.6273...
0.75798994
0
Public: Returns String base64 digest of source.
def base64digest DigestUtils.pack_base64digest(digest) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n @str ||= Base64.encode64(get_digest).gsub(/\\s/, '')\n end", "def digest\n ''\n end", "def digest\n ''\n end", "def to_str\n digest.to_str\n end", "def asset_digest(source)\n asset_paths.digest_for(source)\n end", "def digest(string, algorithm)\n Base...
[ "0.69453037", "0.6894197", "0.6894197", "0.6651485", "0.6564605", "0.65619093", "0.63819534", "0.63583064", "0.6333095", "0.6247995", "0.61536855", "0.6151128", "0.60855085", "0.60849744", "0.59491485", "0.59455854", "0.5943745", "0.5929269", "0.5894392", "0.5887646", "0.5875...
0.7498065
0
GET /administration/characters GET /administration/characters.xml
def index @characters = Character.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @characters } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @characters = @user.characters.find :all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @characters }\n end\n end", "def show\n @game_characters = GameCharacters.find(params[:id])\n\n respond_to do |format|\n format.html # show....
[ "0.7364486", "0.6606827", "0.6486396", "0.64427096", "0.6426193", "0.6344041", "0.63225186", "0.6296009", "0.61372197", "0.61120534", "0.6110572", "0.61103415", "0.6105569", "0.60874784", "0.6076488", "0.6076488", "0.6076488", "0.6076488", "0.6076488", "0.6076488", "0.6076488...
0.6786612
1
GET /administration/characters/new GET /administration/characters/new.xml
def new @character = Character.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @character } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @character = Character.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @character }\n end\n end", "def new\n @character = @user.build_character\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xm...
[ "0.7137016", "0.6925831", "0.6724865", "0.66399926", "0.65627956", "0.65136784", "0.64825016", "0.64626825", "0.6402074", "0.6339901", "0.6266646", "0.6252525", "0.6251108", "0.624846", "0.62344414", "0.622349", "0.6184354", "0.61517066", "0.6136809", "0.6133991", "0.6126514"...
0.7145752
1
POST /administration/characters POST /administration/characters.xml
def create @character = Character.new(params[:character]) respond_to do |format| if @character.save format.html { redirect_to([:administration, @character], :notice => 'Character was successfully created.') } format.xml { render :xml => @character, :status => :created, :location => @char...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @character = @user.build_character(params[:character])\n\n respond_to do |format|\n if @character.save\n flash[:notice] = 'Character was successfully created.'\n format.html { redirect_to(@character) }\n format.xml { render :xml => @character, :status => :created, :loc...
[ "0.6119401", "0.60532725", "0.59966314", "0.59722495", "0.5949715", "0.5833275", "0.583012", "0.58243775", "0.5779657", "0.57792294", "0.57703334", "0.5741661", "0.57349503", "0.57203096", "0.57203096", "0.57126504", "0.5687078", "0.56835383", "0.56731176", "0.56637275", "0.5...
0.65709054
0
PUT /administration/characters/1 PUT /administration/characters/1.xml
def update @character = Character.get(params[:id]) params[:character] = params[:character].map { |x,y| [x, y.empty? ? nil : y ] }.to_hash respond_to do |format| if @character.update(params[:character]) format.html { redirect_to([:administration, @character], :notice => 'Character was successf...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @character = current_user.characters.find(params[:id])\n\n # This has issues with case, resulting in dupes of the same tag\n #@character.tag_list = params[:character][:property] + \", \" + params[:tag_list]\n @character.tag_list = params[:tag_list]\n\n respond_to do |format|\n if @...
[ "0.6163145", "0.61080426", "0.60253054", "0.58980256", "0.58952814", "0.5878409", "0.5767526", "0.5690664", "0.5677809", "0.56575507", "0.56550324", "0.5623743", "0.561075", "0.5587094", "0.55801", "0.55734795", "0.5563027", "0.55590004", "0.55161834", "0.54790753", "0.547907...
0.6144497
1
DELETE /administration/characters/1 DELETE /administration/characters/1.xml
def destroy @character = Character.get(params[:id]) @character.destroy respond_to do |format| format.html { redirect_to(administration_characters_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @character.destroy\n\n respond_to do |format|\n format.html { redirect_to(characters_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @character = current_user.characters.find(params[:id])\n @character.destroy\n\n respond_to do |format|\n format.html ...
[ "0.6568869", "0.6527403", "0.64687365", "0.64465743", "0.64369845", "0.64369845", "0.6379042", "0.6340527", "0.62999654", "0.6275097", "0.6264484", "0.62528837", "0.62353474", "0.6120227", "0.61194664", "0.60967565", "0.60912496", "0.60853964", "0.608458", "0.60781497", "0.60...
0.67580277
0
GET /formatings GET /formatings.json
def index @formatings = Formating.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def formats\n format\n end", "def formatJSON\n # @formattedContents = .... whatever puts it into JSON\n end", "def show\n @format_lookup = FormatLookup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @format_lookup }\n ...
[ "0.656752", "0.6453584", "0.6375833", "0.6352654", "0.6352654", "0.62484217", "0.6132412", "0.60642856", "0.603619", "0.6035052", "0.6019027", "0.60008866", "0.5933324", "0.5930376", "0.585235", "0.58520377", "0.58435005", "0.58376604", "0.5830927", "0.58206546", "0.58206546"...
0.67075765
0
POST /formatings POST /formatings.json
def create @formating = Formating.new(formating_params) respond_to do |format| if @formating.save format.html { redirect_to @formating, notice: 'Formating was successfully created.' } format.json { render :show, status: :created, location: @formating } else format.html { ren...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @format = Format.new(params[:format])\n\n respond_to do |format|\n if @format.save\n format.html { redirect_to @format, notice: 'Format was successfully created.' }\n format.json { render json: @format, status: :created, location: @format }\n else\n format.html { r...
[ "0.6418125", "0.62965673", "0.62727493", "0.6196958", "0.61826956", "0.61495453", "0.60170305", "0.5974338", "0.59592396", "0.59141797", "0.5867909", "0.5843478", "0.58393484", "0.5827798", "0.5826603", "0.57820547", "0.57538116", "0.5731132", "0.57188994", "0.57188994", "0.5...
0.6536987
0
PATCH/PUT /formatings/1 PATCH/PUT /formatings/1.json
def update respond_to do |format| if @formating.update(formating_params) format.html { redirect_to @formating, notice: 'Formating was successfully updated.' } format.json { render :show, status: :ok, location: @formating } else format.html { render :edit } format.json { r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @format = Format.find(params[:id])\n\n respond_to do |format|\n if @format.update_attributes(params[:format])\n format.html { redirect_to @format, notice: 'Format was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: ...
[ "0.7030892", "0.68600416", "0.66184556", "0.6616267", "0.66029674", "0.6584635", "0.65763205", "0.6568493", "0.65168923", "0.65038246", "0.64924484", "0.64761287", "0.6347763", "0.62703013", "0.6229367", "0.6106919", "0.60405225", "0.59873754", "0.59060967", "0.58870274", "0....
0.6964785
1
DELETE /formatings/1 DELETE /formatings/1.json
def destroy @formating.destroy respond_to do |format| format.html { redirect_to formatings_url, notice: 'Formating was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @format = Format.find(params[:id])\n @format.destroy\n\n respond_to do |format|\n format.html { redirect_to formats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @format = Format.find(params[:id])\n @format.destroy\n\n respond_to do |format|\n...
[ "0.7777993", "0.7578849", "0.7578849", "0.74083096", "0.7376506", "0.72876847", "0.72776294", "0.72439045", "0.7227275", "0.72269297", "0.7208472", "0.7171798", "0.7170333", "0.7134721", "0.7060468", "0.69911176", "0.6952951", "0.6952951", "0.6931997", "0.6925111", "0.6873674...
0.78304654
0
helper method to fill the train full of passengers
def fill_train(train) 120.times { train.board(active_passenger, station) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(station)\r\n @station = station\r\n @train = nil\r\n @passengers = Array.new\r\n end", "def set_training\n @training = student.trainings.build\n end", "def set_train(train)\r\n @train = train\r\n end", "def train\n @badasspoints += 1\n end", "def initialize\n\t\t@tr...
[ "0.6616624", "0.63414437", "0.6041372", "0.5841471", "0.57378674", "0.56624705", "0.5657433", "0.55865383", "0.5515508", "0.54803216", "0.54798114", "0.54727316", "0.54563093", "0.5406053", "0.5376174", "0.5372072", "0.53648776", "0.5353674", "0.53228724", "0.5312346", "0.530...
0.7667284
0
DELETE /sms/1 DELETE /sms/1.json
def destroy @sm = Sm.find(params[:id]) @sm.destroy respond_to do |format| format.html { redirect_to sms_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @sms = Sms.find(params[:id])\n @sms.destroy\n\n respond_to do |format|\n format.html { redirect_to(sms_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @sms_based.destroy\n respond_to do |format|\n format.html { redirect_to sms_baseds_url }\n for...
[ "0.763914", "0.753193", "0.7351058", "0.73134625", "0.73062015", "0.72668487", "0.72561693", "0.7167998", "0.7055462", "0.70198476", "0.6975877", "0.6897508", "0.6858554", "0.67807156", "0.673323", "0.6692594", "0.66611314", "0.6652349", "0.6615884", "0.6610818", "0.6606579",...
0.75781196
1
returns the worker method name, given the routing string.
def method_name(queue) queue.split("__").last end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exchange_name\n \"#{worker_class_name}_#{job_method}\".downcase\n end", "def route_name; end", "def route_name; end", "def route_prefix_to_method_name(method)\n \"#{route_prefix + \"_\" if route_prefix}#{method}\"\n end", "def route_name\n @route_name || default_route_name\n ...
[ "0.66431427", "0.6123058", "0.6123058", "0.60569453", "0.6002618", "0.5943787", "0.58222353", "0.58222353", "0.58106875", "0.5762752", "0.5702368", "0.5665815", "0.5648369", "0.56248045", "0.561237", "0.5606944", "0.56054085", "0.55966467", "0.55616003", "0.55559224", "0.5524...
0.6728938
0
GET /setup_images GET /setup_images.json
def index @setup_images = SetupImage.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_images_data\t\t\t\t\t\t\n\t\t{ payload: { 'makes' => makes_dropdown, 'images' => images_array('none').compact}, success: true}\n\tend", "def get_images\n {}\n end", "def images\n response = JSON.parse( self.class.get(\"#{BASE_URL}/contest/#{@api_key}/images\") )\n end", "def images\n ...
[ "0.69578403", "0.68105143", "0.6670254", "0.66640836", "0.6536526", "0.64318055", "0.6386804", "0.63743997", "0.6367532", "0.6338391", "0.6328266", "0.6309938", "0.6290463", "0.6265324", "0.62472177", "0.6235345", "0.61736834", "0.6173317", "0.61668336", "0.61644685", "0.6147...
0.709687
0
POST /setup_images POST /setup_images.json
def create @setup_image = SetupImage.new(setup_image_params) respond_to do |format| if @setup_image.save format.html { redirect_to setup_path(@setup_image.setup_id), notice: 'Setup was successfully updated.' } format.json { render :show, status: :created, location: @setup_image }...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_image_params\n params.require(:setup_image).permit(:setup_id, :image)\n end", "def get_images_data\t\t\t\t\t\t\n\t\t{ payload: { 'makes' => makes_dropdown, 'images' => images_array('none').compact}, success: true}\n\tend", "def create\n @apartment = current_user.apartments.new(apartment_pa...
[ "0.681784", "0.65543956", "0.6303831", "0.62635", "0.62337154", "0.6214965", "0.61802816", "0.6173078", "0.6137321", "0.6121409", "0.6116104", "0.61096835", "0.61003244", "0.60777843", "0.60739785", "0.6028981", "0.6002002", "0.59794337", "0.59699404", "0.5964449", "0.593832"...
0.69055104
0
PATCH/PUT /setup_images/1 PATCH/PUT /setup_images/1.json
def update respond_to do |format| if @setup_image.update(setup_image_params) format.html { redirect_to @setup_image.setup, notice: 'Setup image was successfully updated.' } format.json { render :show, status: :ok, location: @setup_image } else format.html { render :edit } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @image = Image.find(params[:id])\n\n #we can allow updating an image name and description and unit, but not the image data. for that we need to create a new image\n update_params = image_params\n update_params.delete(\"image\")\n\n if @image.update(update_params)\n head :no_content...
[ "0.6779511", "0.6640825", "0.63569057", "0.6243799", "0.6202941", "0.61961436", "0.6196014", "0.6186075", "0.6179634", "0.614356", "0.61386883", "0.6095758", "0.6090155", "0.60816914", "0.6075981", "0.6075981", "0.6075981", "0.6075981", "0.60644954", "0.6059828", "0.60595286"...
0.6892546
0
DELETE /setup_images/1 DELETE /setup_images/1.json
def destroy @setup_image.destroy respond_to do |format| format.html { redirect_to :back } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n request(:delete, \"/computing/image/#{uuid}\")\n true\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n render json: {status: \"success\"}, status: :ok\n end", "def destroy\n @image.destroy\n\n respond_to do |format|\n format.json {...
[ "0.71614194", "0.7121775", "0.70840627", "0.7064575", "0.70218575", "0.7020135", "0.7004635", "0.69549704", "0.69496924", "0.6917747", "0.6913477", "0.69103336", "0.68787515", "0.68787515", "0.68787515", "0.68787515", "0.68787515", "0.68787515", "0.6859757", "0.6859757", "0.6...
0.7487771
0
Find current link associate with the currently viewed page, then walk up the parents and show
def expand_to_current current_location = $window.location.path # `window.location.pathname` # walk down tree links = @sidenav.find("a") current_link = links.select do |l| l.attr("href") == current_location end.first return unless current_link current_link.add_class("current-page") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @parent_path = set_parent_path\n end", "def find_pages_for_parents_list\n @pages_for_parents_list = []\n Page.find_all_by_parent_id(nil, :order => \"position ASC\").each do |page|\n @pages_for_parents_list << page\n @pages_for_parents_list += add_pages_branch_to_parents_list(page)\...
[ "0.6093502", "0.6035832", "0.6018221", "0.59428567", "0.58233255", "0.58202976", "0.57773834", "0.57773834", "0.57730484", "0.5717951", "0.56842506", "0.5655622", "0.5608482", "0.5592796", "0.55838126", "0.55795807", "0.554585", "0.5516596", "0.55038357", "0.55038357", "0.548...
0.6291414
0
Backup wallet to image file, it contain accounts image, assets image and keys image.
def backup_wallet client.make_request('/backup-wallet', 'post', params: {}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backup_image\n case provider\n when :libvirt\n system \"sudo virt-clone -o #{IMAGE_NAME} -n #{IMAGE_NAME}_sav --file /var/lib/libvirt/images/#{IMAGE_NAME}_sav.qcow2\"\n when :virtualbox\n # Shutdown the system\n system \"VBoxManage controlvm #{IMAGE_NAME} acpipowerbutton\"\n...
[ "0.6659576", "0.6521543", "0.6456153", "0.6359973", "0.6324028", "0.61434317", "0.6099499", "0.6090482", "0.6048025", "0.60380983", "0.5915952", "0.59055", "0.58923364", "0.58662075", "0.58524704", "0.5797919", "0.57369727", "0.57351327", "0.5733402", "0.5711486", "0.5711486"...
0.6738948
0
Restore wallet by image file.
def restore_wallet(account_image: {}, asset_image: {}, key_images: {}) params = { account_image: account_image, asset_image: asset_image, key_images: key_images } client.make_request('/restore-wallet', 'post', params: params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore_from_save_image(save_image)\n return if save_image.nil?\n restore_items_from_save_image(:active, save_image[:active_items])\n restore_items_from_save_image(:saved, save_image[:saved_items])\n end", "def restore\n path = PathHelper.path(fid)\n begin\n $mg.store_file(dkey, classnam...
[ "0.65408355", "0.61610854", "0.5873707", "0.58466434", "0.58148724", "0.5642125", "0.5641162", "0.5640173", "0.5584143", "0.5551671", "0.54848903", "0.54710484", "0.5460013", "0.5453181", "0.5422977", "0.5416861", "0.54148245", "0.5402313", "0.5390177", "0.5317422", "0.531717...
0.7391284
0
Trigger to rescan block information into related wallet.
def rescan_wallet client.make_request('/rescan-wallet', 'post', params: {}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_rescan\n EM.defer { @node.store.rescan }\n {:state => \"Rescanning ...\"}\n end", "def process( wallet )\n\t\tself.add_block do\n\t\t\tself.add_transaction( from: GENESIS_WALLET, to: wallet, amount: MINING_REWARD )\n\t\tend\n\tend", "def refresh(wallet_id)\n\t\t\t\tJuspayCheckout::ExpressChec...
[ "0.5701263", "0.5534253", "0.5416664", "0.53749126", "0.5366809", "0.5316177", "0.5277727", "0.5277727", "0.52421373", "0.52363616", "0.5136468", "0.51326907", "0.51172715", "0.5090018", "0.5064164", "0.50536823", "0.50529176", "0.50422734", "0.50383496", "0.50149024", "0.500...
0.72769284
0
Recovery wallet and accounts from root XPubs. All accounts and balances of bip44 multiaccount hierarchy for deterministic wallets can be restored via root xpubs.
def recovery_wallet(xpubs: []) client.make_request('/recovery-wallet', 'post', params: {xpubs: xpubs}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_derive_child_wallet\n addresses = []\n path = File.join(File.dirname(__FILE__), 'addresses.txt')\n File.open(path).read.each_line do |line|\n addresses << line.strip\n end\n xpub = \"xpub6EPbauBbH3SYLqJrdPAK8yQuyQDow7pY4HDV8SMezH3VVb5g5htLpMAb7gvFXVdXPRp6m2fYHc1J3bjurfbfRd2DuNZQ9rKKiKA...
[ "0.5695221", "0.54323214", "0.5343585", "0.5137428", "0.49947256", "0.49409306", "0.49350178", "0.48970926", "0.48897174", "0.47664508", "0.47620264", "0.47490352", "0.47310436", "0.47227284", "0.47217306", "0.47089007", "0.47069794", "0.47002456", "0.46941602", "0.46932575", ...
0.7513572
0
Return the information of wallet.
def wallet_info client.make_request('/wallet-info', 'post', params: {}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getwalletinfo\n node.wallet ? node.wallet.to_h : {}\n end", "def getwalletinfo\n @api.request 'getwalletinfo'\n end", "def wallet\n get 'wallet'\n end", "def wallet_information(wallet_id)\n add_timestamp\n add_salt\n headers = { 'content-type' => 'application/json',...
[ "0.86107737", "0.8168548", "0.7994915", "0.77760816", "0.7691275", "0.73840183", "0.6876495", "0.6849385", "0.67396706", "0.66357905", "0.65899664", "0.6556994", "0.64850205", "0.6466804", "0.64327633", "0.6405591", "0.63930184", "0.6382976", "0.637228", "0.63144517", "0.6276...
0.8846748
0
Return a stored pdef
def definition(name) @pdef_registry[name.to_sym] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def definition\n return pj_info.definition\n end", "def get_definition\n\n end", "def parse (pdef)\n\n tree = case pdef\n when Array then pdef\n when String then parse_string(pdef)\n when Class then pdef.do_make\n when ProcessDefinition then pdef.do_make\n when Simp...
[ "0.6696077", "0.6584004", "0.62652695", "0.6237746", "0.61041343", "0.57534575", "0.57519424", "0.57488763", "0.5720119", "0.57179016", "0.5680229", "0.56553876", "0.56553876", "0.5616365", "0.55804884", "0.5560979", "0.5560979", "0.5532538", "0.5532538", "0.552494", "0.55107...
0.67768735
0
just one banner for store
def one_banner if self.class_type == 'banner' && Multimedium.find_all_by_class_type('banner').count > 0 self.errors.add(:base, "This store already has one banner") false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def banner\n @data['banner']\n end", "def banner\n checkConnection()\n @banner\n end", "def banner\n checkConnection()\n @banner\n end", "def banner\n self.class.instance_variable_get(:@__banner)\n end", "def show\n banner = Banner.where(area: Banner.areas[:MemberShow]).first\n...
[ "0.71231735", "0.68731964", "0.68731964", "0.6748388", "0.6744911", "0.66055006", "0.64492196", "0.63693875", "0.61881524", "0.61881524", "0.6168486", "0.6160776", "0.6160776", "0.6160776", "0.6160776", "0.6160776", "0.6160776", "0.6159553", "0.6156885", "0.6155793", "0.61239...
0.7068478
1
set the style of the file accordingly to the class_type
def set_styles if self.class_type == 'variant' {:thumb => '300x300!'} elsif self.class_type == 'banner' {:banner => '800x100!'} elsif self.class_type == 'logo' {:logo => '400x60>'} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_class_style\n @class_style = ClassStyle.find(params[:id])\n end", "def fetch_style_class\n\t\tstyles = Dir.entries(\"./styles\").select do |entry|\n\t\t File.extname(entry).eql? \".rb\"\n\t\tend\n\n\t\tstyle_def = styles.detect do |style|\n\t\t File.basename(style, \".rb\") == @options[:sty...
[ "0.645608", "0.63567096", "0.6282099", "0.6250258", "0.6184444", "0.6184444", "0.6184444", "0.61592114", "0.6152576", "0.60998493", "0.60998493", "0.60998493", "0.6087915", "0.608073", "0.59904", "0.5940956", "0.59060866", "0.5902025", "0.58882016", "0.5883764", "0.5860706", ...
0.6458337
0
set the url where the files are going to be accessed based on the class_type
def set_url_base_on_parent! if self.class_type == 'variant' "/assets/upload/variants/:id/:style/:basename.:extension" elsif self.class_type == 'banner' "/assets/upload/banner/:style/:basename.:extension" elsif self.class_type == 'logo' "/assets/upload/logo/:style/:basename.:ext...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url_path_class=(klass)\n @_url_path_class = klass\n end", "def assign_download_endpoint(klass)\n endpoint_class = Class.new(klass)\n endpoint_class.opts[:shrine_class] = self\n const_set(:DownloadEndpoint, endpoint_class)\n end", "def url\n self.class.ur...
[ "0.7079703", "0.656588", "0.6538705", "0.63712037", "0.6356744", "0.6351664", "0.6223782", "0.61992407", "0.61583555", "0.6144934", "0.6142258", "0.6142258", "0.6142258", "0.6142258", "0.6142258", "0.6013497", "0.60076904", "0.59998655", "0.5993192", "0.59394485", "0.59394485...
0.6704642
1
GET /cc_statements/1 GET /cc_statements/1.xml
def show @cc_statement = CcStatement.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @cc_statement } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @cc_statement = CcStatement.new\n @cc_statement.build_cc_all\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cc_statement }\n end\n end", "def show\n @query = Query.find(params[:id])\n client = GridClientClass.new\n @modifier =...
[ "0.5782129", "0.5696132", "0.5664426", "0.5581414", "0.55535257", "0.5533329", "0.5511199", "0.54803324", "0.5427989", "0.5340383", "0.5337714", "0.5327987", "0.5288051", "0.52879035", "0.5285559", "0.52842164", "0.52528435", "0.5233402", "0.520974", "0.520887", "0.520272", ...
0.6717177
0
GET /cc_statements/new GET /cc_statements/new.xml
def new @cc_statement = CcStatement.new @cc_statement.build_cc_all respond_to do |format| format.html # new.html.erb format.xml { render :xml => @cc_statement } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @statement = Statement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @statement }\n end\n end", "def new\n logger.debug 'new_some interesting information'\n @comdty = Comdty.new\n setvariables\n\n respond_to do |format|\n f...
[ "0.6758487", "0.6496736", "0.64260536", "0.6336849", "0.6275615", "0.62714225", "0.6238137", "0.621727", "0.6215843", "0.61640376", "0.60985094", "0.60966", "0.60966", "0.60935676", "0.6088341", "0.60805917", "0.6075441", "0.6073276", "0.6058147", "0.6033018", "0.60233384", ...
0.72920173
0
POST /cc_statements POST /cc_statements.xml
def create #I need :parent_id set to 0 by default for itself and next_sib if params[:cc_statement][:cc_all_attributes][:parent_id] == "" params[:cc_statement][:cc_all_attributes][:parent_id] = "0" end #we need the parent id to set next_sib params[:cc_statement][:cc_all_attributes][:next_sib] +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @cc_statement = CcStatement.new\n @cc_statement.build_cc_all\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cc_statement }\n end\n end", "def commit(action, xml)\n headers = { 'Content-Type' => 'application/x-qbmsxml',\n ...
[ "0.559584", "0.55821294", "0.55568284", "0.5278184", "0.52586275", "0.5129247", "0.511046", "0.50929016", "0.5020656", "0.49388093", "0.4929368", "0.49190983", "0.4900148", "0.4897338", "0.4892051", "0.48857144", "0.48697066", "0.48474568", "0.4824941", "0.47993812", "0.47952...
0.5629144
0
PUT /cc_statements/1 PUT /cc_statements/1.xml
def update @cc_statement = CcStatement.find(params[:id]) #we need the parent id to set next_sib params[:cc_statement][:cc_all_attributes][:next_sib] += "_" params[:cc_statement][:cc_all_attributes][:next_sib] += params[:cc_statement][:cc_all_attributes][:parent_id] respond_to do |format| ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def upd...
[ "0.59867", "0.57625973", "0.5627057", "0.55521697", "0.55391717", "0.5527649", "0.54677486", "0.5454499", "0.5450926", "0.54061204", "0.5397487", "0.53304625", "0.5282188", "0.5259503", "0.51997775", "0.5170253", "0.5165421", "0.5160235", "0.5158506", "0.5150662", "0.5147112"...
0.62415546
0
DELETE /cc_statements/1 DELETE /cc_statements/1.xml
def destroy @cc_statement = CcStatement.find(params[:id]) @cc_statement.destroy respond_to do |format| format.html { redirect_to(cc_statements_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def test_set3_06b_delete_res_object()\n user = \"test_user\"\n priv = \"test_privilege\"\n res_ob_type = \"test\"\n res_ob_adr = \"/db/temporary/t...
[ "0.662174", "0.6168364", "0.6022061", "0.6020586", "0.6015052", "0.5917231", "0.5910602", "0.5893439", "0.58675194", "0.5865821", "0.58591783", "0.5834734", "0.58099306", "0.5794646", "0.5792098", "0.5773454", "0.57732546", "0.57552093", "0.5739053", "0.57134885", "0.57123095...
0.70043576
0
return the name for DocumentFragment
def name '#document-fragment' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nodeName\n \"#document-fragment\"\n end", "def name\n 'document'\n end", "def name\n \"document\"\n end", "def nodeName\n \"#document\"\n end", "def identify doc = @doc\n doc.elements.first.name.to_sym\n end", "def element_name() @stag.element_name ...
[ "0.74869055", "0.657811", "0.6546116", "0.651247", "0.6367251", "0.63114816", "0.618698", "0.6081865", "0.60559905", "0.60472465", "0.6040165", "0.6040165", "0.5963048", "0.5959108", "0.5940602", "0.58966523", "0.58788687", "0.5871114", "0.58604616", "0.5835952", "0.583393", ...
0.75937766
1
Only the owner of the venture is allowed to perform certain actions
def authenticate_venture_owner! render "errors/404" unless Venture.find(params[:venture_id]).user_id == current_user.id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restrict_access\t\n\t\tif current_user.owner == false\n\t\t\tredirect_to user_path(current_user), notice: \"You can't view this page, contact your box owner\"\n\t\tend\t\n\tend", "def owner_only\n unless current_user == @organism.owner\n flash[:alert] = \"Vous ne pouvez executer cette action car vous...
[ "0.6973081", "0.6841731", "0.6821679", "0.6813689", "0.6787564", "0.67339927", "0.67339927", "0.6612551", "0.6594413", "0.6590633", "0.65861136", "0.6556369", "0.6508762", "0.64926624", "0.6481037", "0.64808524", "0.64669216", "0.6453985", "0.6416339", "0.63913333", "0.638294...
0.6882936
1
==== Parameters env:: A hash of environment keys to be merged into the default list. opt:: A hash of options (see below). ==== Options (opt) :post_body:: The post body for the request. :req:: The request string. This will only be used if :post_body is left out. ==== Returns FakeRequest:: A Request object that is built ...
def fake_request(env = {}, opt = {}) if opt[:post_body] req = opt[:post_body] env[:content_type] ||= "application/x-www-form-urlencoded" else req = opt[:req] end FakeRequest.new(env, StringIO.new(req || '')) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_request(params = {}, env = {})\n params = Merb::Parse.params_to_query_string(params)\n\n query_string = env[:query_string] || env['QUERY_STRING']\n env[:query_string] = query_string ? \"#{query_string}&#{params}\" : params\n \n post_body = env[:post_body] ||...
[ "0.6353609", "0.6209062", "0.6131766", "0.6115029", "0.5974974", "0.581073", "0.5722107", "0.564282", "0.56267667", "0.5513149", "0.54360497", "0.5433785", "0.5376233", "0.5373324", "0.5373324", "0.5338877", "0.5331835", "0.5328152", "0.5294705", "0.5287614", "0.5279952", "...
0.84626085
0
Dispatches an action to the given class. This bypasses the router and is suitable for unit testing of controllers. ==== Parameters controller_klass:: The controller class object that the action should be dispatched to. action:: The action name, as a symbol. params:: An optional hash that will end up as params in the co...
def dispatch_to(controller_klass, action, params = {}, env = {}, &blk) params = merge_controller_and_action(controller_klass, action, params) dispatch_request(build_request(params, env), controller_klass, action.to_s, &blk) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dispatch_request(request, controller_klass, action, &blk)\n controller = controller_klass.new(request)\n yield controller if block_given?\n controller._dispatch(action)\n\n Merb.logger.info controller._benchmarks.inspect\n Merb.logger.flush\n\n controller\n end", ...
[ "0.65754294", "0.6272057", "0.6201761", "0.6188878", "0.6188878", "0.6165436", "0.59402746", "0.5709275", "0.5654451", "0.56012523", "0.5565367", "0.54914284", "0.5461166", "0.5456916", "0.5330146", "0.5133331", "0.51305085", "0.50572914", "0.50066924", "0.4976123", "0.494327...
0.82633656
0
Keep track of cookie values in CookieJar within the context of the block; you need to set this up for secific controllers. ==== Parameters controller_classes:: Controller classes to operate on in the context of the block. &blk:: The context to operate on; optionally accepts the cookie jar as an argument.
def with_cookies(*controller_classes, &blk) cookie_jar = CookieJar.new before_cb = lambda { |c| c.cookies.update(cookie_jar) } after_cb = lambda { |c| cookie_jar.update_from_request(c.request) } controller_classes.each do |klass| klass._before_dispatch_callbacks << before_cb ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cookies\n @controller.send(:cookies)\n end", "def setup_controller(controller, env, vars)\n controller.env = env\n controller.headers = {}\n\n setup_controller_params(controller, env, vars)\n\n controller.cookies = Fastr::HTTP.parse_cookies(env)\n controller.app = self\n e...
[ "0.54777724", "0.52980036", "0.52752024", "0.5243587", "0.5195627", "0.51925117", "0.51736873", "0.51158464", "0.50753534", "0.49427766", "0.49427766", "0.4933547", "0.4933547", "0.492929", "0.49202102", "0.49036098", "0.49036098", "0.49036098", "0.49036098", "0.48680338", "0...
0.8127432
0
Dispatches an action to the given class and using HTTP Basic Authentication This bypasses the router and is suitable for unit testing of controllers. ==== Parameters controller_klass:: The controller class object that the action should be dispatched to. action:: The action name, as a symbol. username:: The username. pa...
def dispatch_with_basic_authentication_to(controller_klass, action, username, password, params = {}, env = {}, &blk) env["X_HTTP_AUTHORIZATION"] = "Basic #{Base64.encode64("#{username}:#{password}")}" params = merge_controller_and_action(controller_klass, action, params) dispatc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dispatch_to(controller_klass, action, params = {}, env = {}, &blk)\n params = merge_controller_and_action(controller_klass, action, params)\n dispatch_request(build_request(params, env), controller_klass, action.to_s, &blk)\n end", "def login(action, username, password, header = 'HTTP_AUTH...
[ "0.63134056", "0.5604175", "0.54849416", "0.5276103", "0.5151506", "0.51505333", "0.5140847", "0.5140847", "0.51384544", "0.5101595", "0.5095869", "0.5087563", "0.49385706", "0.4902698", "0.48784572", "0.47924063", "0.4785079", "0.47757378", "0.47638625", "0.47475797", "0.473...
0.8277525
0
Prepares and returns a request suitable for dispatching with dispatch_request. If you don't need to modify the request object before dispatching (e.g. to add cookies), you probably want to use dispatch_to instead. ==== Parameters params:: An optional hash that will end up as params in the controller instance. env:: An ...
def build_request(params = {}, env = {}) params = Merb::Parse.params_to_query_string(params) query_string = env[:query_string] || env['QUERY_STRING'] env[:query_string] = query_string ? "#{query_string}&#{params}" : params post_body = env[:post_body] || env['POST_BO...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_from_env(env)\n request = {}\n request['path'] = env['REQUEST_URI'].to_s\n request['method'] = env['REQUEST_METHOD']\n request['query'] = env['QUERY_STRING'].to_s\n request['Body'] = env['rack.input'].read\n\n env.each do |key, value|\n if key.mat...
[ "0.64752877", "0.62871164", "0.60735166", "0.6067896", "0.6020211", "0.59661824", "0.591714", "0.58941156", "0.58926606", "0.5741204", "0.57023144", "0.56853217", "0.56853217", "0.56585866", "0.5646141", "0.5642714", "0.56414986", "0.56279665", "0.55799675", "0.55749434", "0....
0.6666283
0
An HTTP GET request that operates through the router. ==== Parameters path:: The path that should go to the router as the request uri. params:: An optional hash that will end up as params in the controller instance. env:: An optional hash that is passed to the fake request. Any request options should go here (see +fake...
def get(path, params = {}, env = {}, &block) env[:request_method] = "GET" mock_request(path, params, env, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(path, params = {})\n\t\trequest(path, :get, params)\n\tend", "def get(path:, params: {})\n request(method: :get, path: path, params: params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params = {})\n request(:get, path, params)\n ...
[ "0.725828", "0.7179628", "0.7128158", "0.71200424", "0.71200424", "0.71187145", "0.71187145", "0.71187145", "0.71187145", "0.71187145", "0.71187145", "0.71187145", "0.71187145", "0.71187145", "0.71187145", "0.70910823", "0.70910823", "0.6973759", "0.68960845", "0.68934894", "...
0.7662946
0
An HTTP POST request that operates through the router. ==== Parameters path:: The path that should go to the router as the request uri. params:: An optional hash that will end up as params in the controller instance. env:: An optional hash that is passed to the fake request. Any request options should go here (see fake...
def post(path, params = {}, env = {}, &block) env[:request_method] = "POST" mock_request(path, params, env, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(path, params)\n request(:post, path, params)\n end", "def post(path, params = {})\n\t\trequest(path, :post, params)\n\tend", "def post(path:, params: {})\n request(method: :post, path: path, params: params)\n end", "def post(path, params={})\n request(:post, path, params)\n e...
[ "0.7268376", "0.717251", "0.7144611", "0.7091272", "0.7091272", "0.7091272", "0.7076556", "0.7053185", "0.7053185", "0.7053185", "0.7053185", "0.7053185", "0.69848996", "0.68877596", "0.68677187", "0.6861362", "0.68173164", "0.67491925", "0.6692912", "0.6691374", "0.6682392",...
0.7627235
0
An HTTP PUT request that operates through the router. ==== Parameters path:: The path that should go to the router as the request uri. params:: An optional hash that will end up as params in the controller instance. env:: An optional hash that is passed to the fake request. Any request options should go here (see fake_...
def put(path, params = {}, env = {}, &block) env[:request_method] = "PUT" mock_request(path, params, env, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(path, params)\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def pu...
[ "0.7292966", "0.720389", "0.720389", "0.71866405", "0.7182192", "0.7182192", "0.7182192", "0.71755654", "0.71755654", "0.71755654", "0.71755654", "0.71755654", "0.71755654", "0.71755654", "0.71755654", "0.70728683", "0.70458686", "0.70229304", "0.6838001", "0.6824489", "0.665...
0.78555846
0
An HTTP DELETE request that operates through the router ==== Parameters path:: The path that should go to the router as the request uri. params:: An optional hash that will end up as params in the controller instance. env:: An optional hash that is passed to the fake request. Any request options should go here (see fak...
def delete(path, params = {}, env = {}, &block) env[:request_method] = "DELETE" mock_request(path, params, env, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(path, params)\n request(:delete, path, {})\n end", "def delete(uri, params = {}, env = {}, &block)\n super(uri, params, env, &block).tap do |response|\n record_request_response_pair!('delete')\n end\n end", "def delete(path, params = {})\n request(:...
[ "0.74507517", "0.7417788", "0.73641765", "0.73641765", "0.73448855", "0.7332574", "0.7332574", "0.7332574", "0.73173976", "0.73173976", "0.73173976", "0.73173976", "0.73173976", "0.73173976", "0.73173976", "0.7291985", "0.72366655", "0.720572", "0.719558", "0.7047115", "0.699...
0.7987581
0
The workhorse for the dispatchto helpers. ==== Parameters request:: A request object that has been setup for testing. controller_klass:: The class object off the controller to dispatch the action to. action:: The action to dispatch the request to. &blk:: The controller is yielded to the block provided for actions prior...
def dispatch_request(request, controller_klass, action, &blk) controller = controller_klass.new(request) yield controller if block_given? controller._dispatch(action) Merb.logger.info controller._benchmarks.inspect Merb.logger.flush controller end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dispatch_to(controller_klass, action, params = {}, env = {}, &blk)\n params = merge_controller_and_action(controller_klass, action, params)\n dispatch_request(build_request(params, env), controller_klass, action.to_s, &blk)\n end", "def dispatch_action(klass, action, request, response, sta...
[ "0.7685033", "0.6669442", "0.6500708", "0.6006697", "0.58645815", "0.5860242", "0.57698756", "0.57698756", "0.57417244", "0.56490266", "0.56320757", "0.5626222", "0.54789835", "0.547776", "0.54732305", "0.53960145", "0.5360265", "0.53585404", "0.5329015", "0.5314386", "0.5295...
0.7396057
1
Checks to see that a request is routable. ==== Parameters request:: The request object to inspect. ==== Raises Merb::ControllerExceptions::BadRequest:: No matching route was found. ==== Returns Hash:: The parameters built based on the matching route.
def check_request_for_route(request) match = ::Merb::Router.match(request) if match[0].nil? && match[1].empty? raise ::Merb::ControllerExceptions::BadRequest, "No routes match the request. Request uri: #{request.uri}" else match[1] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call(request)\n @constraints.all? { |key, val| request.send(key).include? val }\n end", "def call(request)\n compile! unless compiled?\n pattern, verb, params = *parse_request(request)\n pattern = pattern.encode(Encoding.default_external)\n candidacies = match_with(pat...
[ "0.6007185", "0.5976569", "0.59397715", "0.5760299", "0.5580053", "0.5485739", "0.546998", "0.5440643", "0.541358", "0.537255", "0.53686225", "0.5368136", "0.53625286", "0.53019357", "0.52885294", "0.52464867", "0.521794", "0.52103597", "0.5199129", "0.5196158", "0.51958007",...
0.69358224
0
Registers the metrics to be collected
def register_metrics! return if @registered @registered = true with_instance do |t| # Worker related t.add_gauge :dynflow_active_workers, 'The number of currently busy workers', [:queue, :world] t.add_counter :dynflow_worker_events, 'The nu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(...)\n @metrics = {}\n register(...)\n end", "def collect(metrics)\n metrics\n end", "def setup_metrics\n end", "def setup_metrics\n end", "def setup_metrics\n end", "def metrics\n @metrics ||= collect_metrics\n end", "def collect_metrics(*)\n ...
[ "0.74799824", "0.74355805", "0.73074955", "0.73074955", "0.73074955", "0.72846323", "0.68729484", "0.6775329", "0.67341197", "0.6715236", "0.6691084", "0.6645215", "0.6636278", "0.6546899", "0.6383423", "0.63759995", "0.63454545", "0.6331616", "0.633156", "0.6291296", "0.6282...
0.74661225
1
calculate contribution of each feature (f) for each class (k)
def calc_contribution(f) each_class do |k| a, b, c, d = get_A(f, k), get_B(f, k), get_C(f, k), get_D(f, k) s = 0.0 x, y = b+d, a+c s = (d/x)**(@k) - (c/y)**(@k) if not x.zero? and not y.zero? set_feature_score(f, k, s) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_contribution(f)\n each_class do |k|\n a, c = get_A(f, k), get_C(f, k)\n \n s =0.0\n x = a+c\n \n s = a/x if not x.zero?\n \n set_feature_score(f, k, s)\n end\n end", "def calc_contribution(f)\n each_class do |k|\n b, d = ge...
[ "0.78788304", "0.7792636", "0.7778219", "0.772977", "0.7694428", "0.76803815", "0.7582821", "0.7445391", "0.6979485", "0.6889027", "0.6828307", "0.63680226", "0.6309623", "0.62906444", "0.60808206", "0.5987632", "0.5912798", "0.59023523", "0.59009403", "0.5873083", "0.5818051...
0.7799466
1
Call the method given on the array of associated objects if the method is an array method, otherwise call the method on the association's dataset.
def method_missing(meth, *args, &block) (ARRAY.respond_to?(meth) ? @instance.send(:load_associated_objects, @reflection, @reload) : @instance.send(@reflection.dataset_method)). send(meth, *args, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def def_association_method(opts)\n association_module_def(opts.association_method, opts) do |*dynamic_opts, &block|\n Sequel::Deprecation.deprecate(\"Passing multiple arguments to ##{opts.association_method}\", \"Additional arguments are currently ignored\") if dynamic_opts.length > 1\n ...
[ "0.5923405", "0.5919031", "0.5654072", "0.56209105", "0.5603869", "0.5594049", "0.5547502", "0.55241543", "0.5513814", "0.54701936", "0.54488176", "0.5444896", "0.54447496", "0.54361165", "0.5424518", "0.53747237", "0.5359915", "0.5343474", "0.5343114", "0.53042823", "0.53014...
0.6684384
0
POST /fractions POST /fractions.json
def create @fraction = Fraction.new(fraction_params) respond_to do |format| if @fraction.save format.html { redirect_to @fraction, notice: 'Fraction was successfully created.' } format.json { render :show, status: :created, location: @fraction } else format.html { render :ne...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fraction_params\n params.require(:fraction).permit(:fraction)\n end", "def member_fraction_params\n params.require(:member_fraction).permit(:parliament_id, :structural_id, :fraction_id)\n end", "def create\n @member_fraction = MemberFraction.new(member_fraction_params)\n\n respond_to ...
[ "0.77332985", "0.68102807", "0.67114794", "0.65384734", "0.6472182", "0.64225864", "0.6376123", "0.62741846", "0.6221947", "0.6160466", "0.60524327", "0.6049844", "0.59856796", "0.58795744", "0.58648354", "0.58358276", "0.58195025", "0.5819296", "0.5800493", "0.5794508", "0.5...
0.7197817
1
PATCH/PUT /fractions/1 PATCH/PUT /fractions/1.json
def update respond_to do |format| if @fraction.update(fraction_params) format.html { redirect_to @fraction, notice: 'Fraction was successfully updated.' } format.json { render :show, status: :ok, location: @fraction } else format.html { render :edit } format.json { render...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @member_fraction.update(member_fraction_params)\n format.html { redirect_to member_fractions_path, notice: 'Member fraction was successfully updated.' }\n format.json { render :show, status: :ok, location: @member_fraction }\n else\n format...
[ "0.69239014", "0.67371404", "0.66484714", "0.6586919", "0.65382516", "0.60311043", "0.60145515", "0.58613765", "0.58448154", "0.5799816", "0.57682145", "0.57394004", "0.5737671", "0.5685192", "0.5665652", "0.56449336", "0.56228745", "0.5622771", "0.5622771", "0.5612094", "0.5...
0.7464898
0
DELETE /fractions/1 DELETE /fractions/1.json
def destroy @fraction.destroy respond_to do |format| format.html { redirect_to fractions_url, notice: 'Fraction was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @fraction = Fraction.find(params[:id])\n @fraction.destroy\n\n respond_to do |format|\n format.html { redirect_to regions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @member_fraction.destroy\n respond_to do |format|\n format.html { redirec...
[ "0.7416597", "0.7099154", "0.6915712", "0.6339604", "0.62519103", "0.62268734", "0.61898583", "0.6156016", "0.6055814", "0.60532826", "0.6031578", "0.59887844", "0.5967448", "0.5965297", "0.59568524", "0.59512883", "0.59381354", "0.59381354", "0.5929808", "0.5929391", "0.5920...
0.75078803
0
GET /framedp_summaries/1 GET /framedp_summaries/1.json
def show @framedp_summary = FramedpSummary.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @framedp_summary } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @framedp_summary = FramedpSummary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @framedp_summary }\n end\n end", "def show\n @summaries = Summary.all \n end", "def summary\n response = get \"summary\", {}\n Hashie::Mash.new(...
[ "0.672472", "0.6032978", "0.598185", "0.59406495", "0.5869434", "0.58512163", "0.5845019", "0.5838353", "0.5756592", "0.5709459", "0.5709459", "0.5709459", "0.5709459", "0.5646136", "0.56455547", "0.5639625", "0.56332684", "0.56332684", "0.5599149", "0.5577415", "0.55582815",...
0.73398685
0
GET /framedp_summaries/new GET /framedp_summaries/new.json
def new @framedp_summary = FramedpSummary.new respond_to do |format| format.html # new.html.erb format.json { render json: @framedp_summary } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @framedp_summary = FramedpSummary.new(params[:framedp_summary])\n\n respond_to do |format|\n if @framedp_summary.save\n format.html { redirect_to @framedp_summary, notice: 'Framedp summary was successfully created.' }\n format.json { render json: @framedp_summary, status: :cre...
[ "0.7236628", "0.71282554", "0.6664434", "0.6633187", "0.661516", "0.65543383", "0.653464", "0.6522222", "0.65004045", "0.64370763", "0.6396831", "0.63895905", "0.634813", "0.6339417", "0.6336515", "0.6326113", "0.6310421", "0.6301756", "0.6294988", "0.6292946", "0.6289391", ...
0.7755582
0
POST /framedp_summaries POST /framedp_summaries.json
def create @framedp_summary = FramedpSummary.new(params[:framedp_summary]) respond_to do |format| if @framedp_summary.save format.html { redirect_to @framedp_summary, notice: 'Framedp summary was successfully created.' } format.json { render json: @framedp_summary, status: :created, locat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @framedp_summary = FramedpSummary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @framedp_summary }\n end\n end", "def show\n @framedp_summary = FramedpSummary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html...
[ "0.6450295", "0.57815194", "0.56836575", "0.5571657", "0.554901", "0.55406606", "0.5516639", "0.5516639", "0.530029", "0.52817714", "0.5275705", "0.525951", "0.524886", "0.523936", "0.52131325", "0.52118635", "0.51829076", "0.5126057", "0.5103483", "0.5094349", "0.50934595", ...
0.70963943
0
PUT /framedp_summaries/1 PUT /framedp_summaries/1.json
def update @framedp_summary = FramedpSummary.find(params[:id]) respond_to do |format| if @framedp_summary.update_attributes(params[:framedp_summary]) format.html { redirect_to @framedp_summary, notice: 'Framedp summary was successfully updated.' } format.json { head :no_content } el...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @framedp_summary = FramedpSummary.new(params[:framedp_summary])\n\n respond_to do |format|\n if @framedp_summary.save\n format.html { redirect_to @framedp_summary, notice: 'Framedp summary was successfully created.' }\n format.json { render json: @framedp_summary, status: :cre...
[ "0.64135617", "0.5950805", "0.5858234", "0.5852816", "0.58208823", "0.58208823", "0.58208823", "0.5786521", "0.5749176", "0.5700257", "0.533353", "0.533353", "0.533353", "0.533353", "0.53335214", "0.5329445", "0.5320898", "0.53115624", "0.5306827", "0.5278408", "0.527586", ...
0.6763906
0
DELETE /framedp_summaries/1 DELETE /framedp_summaries/1.json
def destroy @framedp_summary = FramedpSummary.find(params[:id]) @framedp_summary.destroy respond_to do |format| format.html { redirect_to framedp_summaries_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @summary.destroy\n respond_to do |format|\n format.html { redirect_to summaries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @summary = Summary.find(params[:id])\n @summary.destroy\n\n respond_to do |format|\n format.html { redirect_to summ...
[ "0.6990364", "0.67791474", "0.6769124", "0.66883564", "0.66883564", "0.6684811", "0.64169574", "0.6364307", "0.63125694", "0.62874836", "0.6266948", "0.6266192", "0.61698157", "0.61542654", "0.6138919", "0.61344963", "0.61334956", "0.6116587", "0.61095464", "0.60976297", "0.6...
0.76653886
0
Use this boolean method to determine whether this customer_file can be used to collect a payment. Checks all of the following: The "authorized" flag is true. There is a minimum authorized amount. Customer and user records are attached, i.e., neither has been deleted.
def customer_has_authorized_payment? authorized and authorized_amount.try(:>, 0) and has_customer_account? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def charge_is_allowed?\n\t\tif not customer_has_authorized_payment?\n\t\t\terrors.add :base, I18n.t('views.customer_file.new_charge.you_are_not_authorized')\n\t\t\tfalse\n\t\telsif valid? and charge_amount.present? and authorized_amount and charge_amount.to_i <= authorized_amount\n\t\t\ttrue\n\t\telse\n\t\t\terror...
[ "0.71722645", "0.6657813", "0.6450728", "0.64218915", "0.64218915", "0.6343719", "0.6315825", "0.62663573", "0.6225009", "0.6186739", "0.61811507", "0.6180229", "0.61707926", "0.6163278", "0.6146223", "0.6146223", "0.6138449", "0.6123721", "0.6106551", "0.60813814", "0.603684...
0.7491831
0
Use this boolean method to determine whether the charge_amount can be collected. Also ensures that the customer still exists and has authorized payment to this provider.
def charge_is_allowed? if not customer_has_authorized_payment? errors.add :base, I18n.t('views.customer_file.new_charge.you_are_not_authorized') false elsif valid? and charge_amount.present? and authorized_amount and charge_amount.to_i <= authorized_amount true else errors.add :charge_amount, I18n.t('...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def charge?\n false\n end", "def charges?\n true\n end", "def needs_handling_charge?\n true\n end", "def charged?\n stripe_charge_id.present?\n end", "def charge_credit_card(amount)\n true\n end", "def charge_credit_card(amount)\n true\n end", "def charged?\n comp...
[ "0.76029074", "0.74639976", "0.7239608", "0.70875794", "0.7015584", "0.7015584", "0.68862283", "0.6858936", "0.6799953", "0.6784267", "0.6779929", "0.6715737", "0.66347224", "0.66147065", "0.6591362", "0.6591362", "0.6519883", "0.6464177", "0.64519244", "0.6433467", "0.641175...
0.8083334
0
GET /term_counts/1 GET /term_counts/1.xml
def show @term_count = TermCount.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @term_count } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @term_count = TermCount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @term_count }\n end\n end", "def get_document_frequency(term)\n\t\t\t@term_hash[term]\n\t\tend", "def index\n @tags = Tag.counts\n\n respond_to do...
[ "0.65998244", "0.64372104", "0.6348661", "0.60904974", "0.60649526", "0.59661585", "0.59277576", "0.5901891", "0.5875368", "0.57677156", "0.5746671", "0.57270795", "0.5712348", "0.57084346", "0.57039905", "0.5695749", "0.5694083", "0.5687324", "0.5687266", "0.56584513", "0.56...
0.6985498
0
GET /term_counts/new GET /term_counts/new.xml
def new @term_count = TermCount.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @term_count } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @term_count = TermCount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @term_count }\n end\n end", "def create\n @term_count = TermCount.new(params[:term_count])\n\n respond_to do |format|\n if @term_count.save\n flash[:not...
[ "0.7337316", "0.6986773", "0.6798613", "0.6798613", "0.6798613", "0.6700379", "0.64070505", "0.6358499", "0.634079", "0.6280353", "0.6235569", "0.61859065", "0.61798096", "0.61019623", "0.6041338", "0.6019147", "0.60190517", "0.60175043", "0.59731585", "0.59415734", "0.589880...
0.76714236
0
POST /term_counts POST /term_counts.xml
def create @term_count = TermCount.new(params[:term_count]) respond_to do |format| if @term_count.save flash[:notice] = 'TermCount was successfully created.' format.html { redirect_to(@term_count) } format.xml { render :xml => @term_count, :status => :created, :location => @term_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @term_count = TermCount.new(params[:term_count])\n\n respond_to do |format|\n if @term_count.save\n format.html { redirect_to @term_count, notice: 'Term count was successfully created.' }\n format.json { render json: @term_count, status: :created, location: @term_count }\n ...
[ "0.6594808", "0.6192454", "0.6025294", "0.6024979", "0.601109", "0.5878424", "0.58438814", "0.58272964", "0.58189905", "0.57945263", "0.57408464", "0.57081825", "0.5697413", "0.5660348", "0.56443745", "0.56002575", "0.55988723", "0.5592685", "0.55294317", "0.5498483", "0.5489...
0.66856563
0
PUT /term_counts/1 PUT /term_counts/1.xml
def update @term_count = TermCount.find(params[:id]) respond_to do |format| if @term_count.update_attributes(params[:term_count]) flash[:notice] = 'TermCount was successfully updated.' format.html { redirect_to(@term_count) } format.xml { head :ok } else format.html...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @term_count = TermCount.find(params[:id])\n\n respond_to do |format|\n if @term_count.update_attributes(params[:term_count])\n format.html { redirect_to @term_count, notice: 'Term count was successfully updated.' }\n format.json { head :no_content }\n else\n format...
[ "0.69729066", "0.6414061", "0.6399268", "0.6270709", "0.62558436", "0.62392956", "0.61575913", "0.6156369", "0.6155693", "0.61327827", "0.60665816", "0.60652447", "0.6032292", "0.59789103", "0.5946453", "0.5768371", "0.57486767", "0.57068497", "0.57019806", "0.57019806", "0.5...
0.7043425
0
DELETE /term_counts/1 DELETE /term_counts/1.xml
def destroy @term_count = TermCount.find(params[:id]) @term_count.destroy respond_to do |format| format.html { redirect_to(term_counts_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @term_count = TermCount.find(params[:id])\n @term_count.destroy\n\n respond_to do |format|\n format.html { redirect_to term_counts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @term.destroy\n head :no_content\n end", "def destroy\n @term =...
[ "0.71198714", "0.6885946", "0.6883627", "0.6883627", "0.6785037", "0.6728722", "0.66893494", "0.665326", "0.664966", "0.6646468", "0.65508735", "0.639998", "0.6351535", "0.62913245", "0.62871677", "0.62644607", "0.62591547", "0.6256864", "0.6248882", "0.6244227", "0.6222459",...
0.7470937
0