query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
POST /big_cms/content_managers POST /big_cms/content_managers.xml
def create @content_manager = BigCms::ContentManager.new(params[:big_cms_content_manager]) respond_to do |format| if @content_manager.save format.html { redirect_to(@content_manager, :notice => 'Content manager was successfully created.') } format.xml { render :xml => @content_manager, :status => :created, :location => @content_manager } else format.html { render :action => "new" } format.xml { render :xml => @content_manager.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @content_managers = BigCms::ContentManager.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @content_managers }\n end\n end", "def new\n @content_manager = BigCms::ContentManager.new\n\n respond_to do |format|\n format.html # ...
[ "0.6582013", "0.65374124", "0.60921097", "0.55950606", "0.5573421", "0.5573421", "0.55538017", "0.55091816", "0.5500837", "0.54941654", "0.54563653", "0.54165107", "0.53155154", "0.52443063", "0.52069193", "0.51290435", "0.51225466", "0.5120885", "0.5120881", "0.510888", "0.5...
0.7387091
0
PUT /big_cms/content_managers/1 PUT /big_cms/content_managers/1.xml
def update @content_manager = BigCms::ContentManager.find(params[:id]) respond_to do |format| if @content_manager.update_attributes(params[:big_cms_content_manager]) format.html { redirect_to(@content_manager, :notice => 'Content manager was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @content_manager.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @content_manager = BigCms::ContentManager.new(params[:big_cms_content_manager])\n\n respond_to do |format|\n if @content_manager.save\n format.html { redirect_to(@content_manager, :notice => 'Content manager was successfully created.') }\n format.xml { render :xml => @content...
[ "0.62780535", "0.60925794", "0.5954246", "0.57813567", "0.5690324", "0.55603063", "0.55131745", "0.5482299", "0.54670393", "0.546165", "0.5442602", "0.54134506", "0.5400088", "0.5376924", "0.535574", "0.53292", "0.5277841", "0.52732456", "0.52716976", "0.5245242", "0.52124596...
0.7318692
0
DELETE /big_cms/content_managers/1 DELETE /big_cms/content_managers/1.xml
def destroy @content_manager = BigCms::ContentManager.find(params[:id]) @content_manager.destroy respond_to do |format| format.html { redirect_to(big_cms_content_managers_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @content = Content.find(params[:id])\n @folder = Folder.find(session[:folder_id])\n Searcher.open(Const.get('searcher_db')) do |db|\n db.erase(@content)\n end\n @content.destroy\n\n respond_to do |format|\n #format.html { redirect_to(contents_url) }\n format.html { re...
[ "0.66552645", "0.6611813", "0.66052115", "0.6582038", "0.6507542", "0.6402482", "0.6385869", "0.6363235", "0.632145", "0.6320801", "0.6312841", "0.6303811", "0.6282112", "0.62499547", "0.6243594", "0.62074924", "0.62074924", "0.61943054", "0.61824644", "0.61775434", "0.615415...
0.78733516
0
check for group members, or just all users, memoize them for later use
def users if @group @users ||= @group.users.tracking_enabled.with_waypoints.order(:name) else @users ||= User.tracking_enabled.with_waypoints.order(:name) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ifMember(group_id,user_id)\n GroupUser.where(:group_id => group_id, :user_id => user_id).exists? #change to current_user_id \n end", "def members\n set_group \n @members = User.joins(:groups).where(\"group_id = ? and acceptance_status = ?\", params[:id], true) if GroupsController.group_membe...
[ "0.73414904", "0.69475776", "0.68028855", "0.6775097", "0.66422075", "0.6638977", "0.66348803", "0.66172147", "0.6614346", "0.6611006", "0.6561588", "0.65495026", "0.6475874", "0.6465221", "0.6453644", "0.6437714", "0.6425871", "0.64176244", "0.6370952", "0.6346365", "0.63446...
0.0
-1
Make the URL friendly
def to_param slug end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_url_friendly( name )\n return name.strip.gsub(/[^A-Za-z0-9_]/, '+')\n end", "def do_url (name)\n name.to_s.downcase.gsub(' ', '_')\n end", "def to_url\n val = self.strip_tags!\n val = val.gsub(/[ —_\\/]/, '-')#TODO: длинный пробел не работает\n val = val.gsub(/[+.,!?@#$%^&*()\\[\\]{}:...
[ "0.75273657", "0.70173156", "0.6963788", "0.69507736", "0.6824612", "0.6748813", "0.6748813", "0.6748813", "0.6748813", "0.67211056", "0.6699388", "0.6657215", "0.66274035", "0.65998167", "0.6563775", "0.6563775", "0.655829", "0.65570074", "0.65570074", "0.6552289", "0.655079...
0.0
-1
GET /groups GET /groups.json
def index @groups = Group.all @host_groups = Group.where "groupable_type = 'HostGroup'" @fan_groups = Group.where "groupable_type = 'FanGroup'" @artist_groups = Group.where "groupable_type = 'ArtistGroup'" respond_to do |format| format.html # index.html.erb format.json { render json: @groups } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetGroups params = {}\n\n params = params.merge(path: 'groups.json')\n APICall(params)\n\n end", "def groups\n \n \n @groups = @current_user.groups\n render 'groups.json.jbuilder', status: :ok\n end", "def index\n @groups = Group.all\n\n respond_to do...
[ "0.8286577", "0.8278107", "0.7801243", "0.7762667", "0.77249485", "0.765602", "0.765602", "0.76541275", "0.7636101", "0.7561083", "0.7547335", "0.74825233", "0.74768126", "0.7467619", "0.74643844", "0.73794276", "0.7367821", "0.7351049", "0.7334809", "0.72987163", "0.7240665"...
0.7151056
28
GET /groups/1 GET /groups/1.json
def show @group = Group.find(params[:id]) @is_artist = false @is_host = false if (@group.groupable_type == 'ArtistGroup') @show_class = 'Kuenstlergruppe' @all_instruments = Instrument.all @is_artist = true elsif (@group.groupable_type == 'FanGroup') fg = Group.where "groupable_type = 'ArtistGroup' AND groupable_id = ?", FanGroup.find(@group.groupable_id).artist_group_id if fg.empty? @show_class = "Fangruppe (die zugehoerige Band ist nicht mehr aktiv)" else @show_class = "#{fg.first.name} - Fangruppe" end elsif (@group.groupable_type == 'HostGroup') @show_class = 'Veranstaltergruppe' @hg = HostGroup.find @group.groupable_id @is_host = true else @show_class = 'untypisierte Gruppe' end @all_registered_users = (User.all - @group.members) respond_to do |format| format.html # show.html.erb format.json { render json: @group } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetGroup id\n\n APICall(path: \"groups/#{id}.json\")\n\n end", "def groups\n \n \n @groups = @current_user.groups\n render 'groups.json.jbuilder', status: :ok\n end", "def show\n group = Group.find(params[:id])\n\n render json: group\n end", "def GetGroup...
[ "0.7906696", "0.77682996", "0.77013576", "0.7696094", "0.76500016", "0.7552326", "0.7552326", "0.7536221", "0.74999285", "0.74999285", "0.74628925", "0.7451343", "0.7425182", "0.7417058", "0.7410386", "0.7380656", "0.73710245", "0.7351068", "0.7332308", "0.73154056", "0.73041...
0.0
-1
GET /groups/new GET /groups/new.json
def new @group = Group.new respond_to do |format| format.html # new.html.erb format.json { render json: @group } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @group = Group.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end", "def new\n @group = Group.new\n render json: @group\n end", "def new\n @group = Group.new\n respond_to do |format|\n format.html # new.htm...
[ "0.81868374", "0.8114395", "0.8111757", "0.81058866", "0.81058866", "0.8078829", "0.8077698", "0.7879486", "0.78655005", "0.7839486", "0.7837166", "0.7815334", "0.7760269", "0.7760269", "0.77593815", "0.773152", "0.7715838", "0.77147657", "0.7687062", "0.76687133", "0.7640447...
0.8177045
7
POST /groups POST /groups.json
def create cu = User.find params[:user_id] @group = Group.new(params[:group]) cu.groups << @group case params[:group_type].to_i when 1 @group.groupable = ArtistGroup.create if defined?(params[:instr_id]) && (not params[:instr_id].nil?) m = Membership.where "group_id = #{@group.id} AND userable_id = #{cu.id} AND userable_type = 'User'" params[:instr_id].each do |i| m.first.instruments << Instrument.find(i) end end when 2 @group.groupable = FanGroup.create :artist_group => ArtistGroup.find(params[:art_group_id].to_i) when 3 @group.groupable = HostGroup.create end respond_to do |format| if @group.save format.html { redirect_to @group, notice: 'Die Gruppe wurde erfolgreich angelegt.' } format.json { render json: @group, status: :created, location: @group } else format.html { render action: "new" } format.json { render json: @group.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CreateGroup params = {}\n \n APICall(path: 'groups.json',method: 'POST',payload: params.to_json)\n \n end", "def create\n #logger.info \"Post parameters: #{params}\"\n @group = Group.new(name: params[:group][:name], expiration: params[:group][:expiration], owner: current_user)...
[ "0.77380043", "0.7621419", "0.751383", "0.74283075", "0.738724", "0.738724", "0.7202902", "0.7202091", "0.7180679", "0.71750224", "0.71592236", "0.71332103", "0.7128259", "0.70654404", "0.7040274", "0.7027708", "0.70119005", "0.70049846", "0.70049846", "0.70049846", "0.700498...
0.0
-1
PUT /groups/1 PUT /groups/1.json
def update @group = Group.find(params[:id]) respond_to do |format| if @group.update_attributes(params[:group]) format.html { redirect_to @group, notice: 'Group was successfully updated.' } format.json { head :ok } else format.html { render action: "edit" } format.json { render json: @group.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n logger.info \"Put parameters: #{params.to_json}\"\n @group = Group.find(params[:id])\n\n if @group.update_attributes(params[:group])\n head :no_content\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end", "def UpdateGroup params = {}\n \n ...
[ "0.7675662", "0.7538753", "0.7476837", "0.73122233", "0.72365075", "0.71344316", "0.7086071", "0.70466214", "0.70403993", "0.7030775", "0.7004877", "0.7004877", "0.7004877", "0.6983096", "0.6981075", "0.69727534", "0.69571275", "0.69434506", "0.69096833", "0.6897216", "0.6878...
0.7030311
11
DELETE /groups/1 DELETE /groups/1.json
def destroy @group = Group.find(params[:id]) mbs = Membership.where "group_id = ?", @group.id mbs.each do |m| m.destroy end @group.destroy respond_to do |format| format.html { redirect_to groups_url } format.json { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DeleteGroup id\n \n APICall(path: \"groups/#{id}.json\",method: 'DELETE')\n \n end", "def destroy\n group = Group.find(params[:id])\n group.destroy\n render json: {}\n end", "def deleteGroup( group_id)\n params = Hash.new\n params['group_id'] = group_id\n return...
[ "0.80822545", "0.79805106", "0.79167783", "0.786261", "0.786261", "0.7848193", "0.7848193", "0.78414327", "0.78414327", "0.78414327", "0.78414327", "0.78414327", "0.7832357", "0.7832357", "0.7832357", "0.7832357", "0.7832357", "0.7832357", "0.7808105", "0.7787947", "0.7787941...
0.7321351
99
Define the info method
def info puts "The name and the price will be printed" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def info\n\tend", "def info; end", "def info; end", "def get_info\n end", "def get_info\n end", "def get_info\n end", "def my_info\r\n end", "def info\n raise \"Not yet implemented\"\n end", "def info\n puts 'Info'\n end", "def info()\n #This is a stub, used...
[ "0.8798817", "0.8751856", "0.8751856", "0.8572518", "0.8572518", "0.8572518", "0.83887404", "0.8187677", "0.809251", "0.7997726", "0.7963708", "0.79075515", "0.7878783", "0.78342766", "0.7830162", "0.7772663", "0.7759887", "0.7734963", "0.75677425", "0.7530553", "0.7510698", ...
0.70913696
44
Create a method named 'sort_string' which accepts a String and rearranges all the words in ascending order, by length. Assume a single space to separate the words. Example: Given a string "Sort words in a sentence", it should return "a in Sort words sentence". def sort_string(string) string.split.sort_by(:length) end print sort_string("Sort words in a sentence") Michelle's notes: convert to array with split, call .sort_by length how? on the array
def sort_string(string) string.split.sort_by(&:length) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_string(string)\n\twords = string.split\n\t#loop through array, get length and sort by length. \n\twords.sort! { |x,y| x.length <=> y.length }\n\twords.join(\" \")\nend", "def sort_string(string)\n words = string.split\n words = words.sort_by{|x| x.length} \n return words.join(\" \")\nend", "def so...
[ "0.8768297", "0.86476445", "0.8577836", "0.8349355", "0.83380425", "0.8324169", "0.82534444", "0.8252141", "0.824398", "0.8202797", "0.81964004", "0.8182937", "0.8029729", "0.8017551", "0.79918385", "0.79710543", "0.79153985", "0.7788263", "0.77760607", "0.7738742", "0.773610...
0.85544693
3
The number 3797 has an interesting property. Being prime itself, it is possible to continuously remove digits from left to right, and remain prime at each stage: 3797, 797, 97, and 7. Similarly we can work from right to left: 3797, 379, 37, and 3. Find the sum of the only eleven primes that are both truncatable from left to right and right to left. NOTE: 2, 3, 5, and 7 are not conumsidered to be truncatable primes.
def sieve(x) s = (0..x.to_i).to_a s[0] = s[1] = nil s.each{ |p| # Perform the block for each entry in the array. next unless p # Iterate on next array value if entry is nil break if p * p > x # Cease iteration if p*p > max_value (p*p).step(x, p) { |m| s[m] = nil } # Starting at p*p, set every p-th value to "nil" until max_value } s = s.compact end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prime_truncates\n primes = eratosthenes(1000000)\n results = []\n\n primes.each do |x|\n if x > 10\n truncate_left = x.to_s.chars.map(&:to_i)\n truncate_right = x.to_s.chars.map(&:to_i)\n #puts \"#{truncate_left.inspect} #{truncate_right.inspect}\"\n num_of_digits = truncate_left.leng...
[ "0.75934106", "0.7177682", "0.66803575", "0.64746183", "0.6451906", "0.6449592", "0.6440226", "0.64255124", "0.6397227", "0.63885677", "0.6387947", "0.6355522", "0.63515306", "0.6312274", "0.6298576", "0.62944674", "0.62927705", "0.6287369", "0.62819296", "0.62774277", "0.626...
0.0
-1
Note: these methods aren't tested, since they're so heavily dependent on the structure of the page, which isn't controlled by me.
def parse_collection_element( element ) link = element.css("a")[1] Collection.new( link.text, build_uri(link.attr("href")) ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def page_load; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def pages; end", "def page_source; end", "def page; self en...
[ "0.6072969", "0.59128803", "0.59128803", "0.59128803", "0.59128803", "0.59128803", "0.59128803", "0.59128803", "0.59128803", "0.59128803", "0.59128803", "0.59128803", "0.59128803", "0.58515364", "0.5760326", "0.5755236", "0.56233066", "0.56079555", "0.56079555", "0.557209", "...
0.0
-1
=> Welcome, Sheni. You are number 3 in line.
def line(katz_deli) if katz_deli.length == 0 puts "The line is currently empty." else message="The line is currently:" katz_deli.each_with_index do |value, index| message += " #{index.to_i+1}. #{value}" end puts "#{message}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def welcome_message\n puts \"Welcome to Shiqing's Secret Number Game! \\nShiqing created this game.\"\nend", "def welcome\t\n\t\tputs \"Enjoy the Game #{$person.show_name}\"\n\t\tputs \"This game is about guessing a '\\Secret Number'\\ between 1-10. You have 3 attempts to identify the '\\Secret Number'\\. \n\t\...
[ "0.73981786", "0.7216111", "0.71229005", "0.7105714", "0.7014298", "0.7010113", "0.70013607", "0.6922632", "0.6783831", "0.67824274", "0.6751082", "0.67079663", "0.6703934", "0.6703834", "0.66952336", "0.66929054", "0.669253", "0.667304", "0.6669587", "0.6636441", "0.66306156...
0.0
-1
=> "The line is currently: 1. Anila 2. Sheni"
def now_serving(katz_deli) if katz_deli.empty? puts "There is nobody waiting to be served!" else puts "Currently serving #{katz_deli.first}." katz_deli.shift end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line(line)\n que = \"The line is currently:\"\n if line.size == 0\n que = que.chomp(que[que.size-1]) #to remove ':' from que\n que += \" empty.\"\n else\n for i in 0...line.size\n que += \" #{i+1}. #{line[i]}\"\n end\n end\n puts que\nend", "def line(katz_deli)\n\n line_string = \"The ...
[ "0.6715574", "0.6675761", "0.6622687", "0.6613479", "0.65614945", "0.6548939", "0.6491857", "0.64815843", "0.635839", "0.63551855", "0.6317427", "0.62672406", "0.62544566", "0.62473774", "0.6219193", "0.6218912", "0.62164605", "0.61822116", "0.61726534", "0.6158058", "0.61564...
0.0
-1
A collection of SortConditions for this sort_state
def sort_conditions @sort_conditions ||= SimpleTypedList.new SortCondition end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_criteria\n @sort_criteria ||=\n sort_params.reduce('') do |sum, (key, value)|\n comparables = [\"a[:#{key}]\", \"b[:#{key}]\"]\n comparables.reverse! if value == :desc\n sum + \"comp = comp == 0 ? #{comparables.join(' <=> ')} : comp; \"\n end\n end", "def...
[ "0.6437678", "0.6006048", "0.59539115", "0.57694393", "0.57167906", "0.56980944", "0.566279", "0.56334096", "0.56130064", "0.5601339", "0.5591102", "0.55071187", "0.55058724", "0.55058724", "0.5489533", "0.54775745", "0.5466237", "0.54637134", "0.54515696", "0.5442326", "0.54...
0.8081352
0
Adds a SortCondition to the sort_state. This is the recommended way to add conditions to it. It requires a column_index for the sorting, descending and the custom order are optional.
def add_sort_condition(column_index:, order: :asc, custom_list: []) sort_conditions << SortCondition.new(column_index: column_index, order: order, custom_list: custom_list) sort_conditions.last end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def custom_sort(condition, sort, user_id)\n # param\n default_sort_master = SearchForm.sort_master\n is_default_sort = [*(-1 * default_sort_master.length...0)].map(&:to_s).include?(sort)\n # order by\n if is_default_sort\n default_sort(condition, default_sort_master, sort)\n el...
[ "0.6932707", "0.68367773", "0.6139", "0.606046", "0.59991723", "0.59266484", "0.58756167", "0.5838181", "0.58351785", "0.5787092", "0.5733725", "0.57104224", "0.56792206", "0.5679035", "0.5636585", "0.5584793", "0.55702335", "0.5535534", "0.5524491", "0.5523602", "0.55075383"...
0.784734
0
method to increment the String representing the first cell of the range of the autofilter by 1 row for the sortCondition xml string
def increment_cell_value(str) letter = str[/[A-Za-z]+/] number = str[/\d+/].to_i incremented_number = number + 1 "#{letter}#{incremented_number}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def customize_row_index(row_index)\n row_index += 1\n end", "def transaction_set_header\n ['ST', '835' ,(@check_index + 1).to_s.rjust(4, '0')].join(@element_seperator)\n end", "def increment_positions_on_lower_items(position)\n # acts_as_list_class.update_all(\"#{position_column} = (#{position_c...
[ "0.5148658", "0.50015604", "0.499004", "0.48711818", "0.47739193", "0.47728983", "0.4752401", "0.47433174", "0.47163048", "0.47104898", "0.46679318", "0.4667526", "0.46484652", "0.4617378", "0.4600715", "0.46006012", "0.4598078", "0.45979524", "0.45726362", "0.45726362", "0.4...
0.4534361
20
After registration or login go to the right place
def after_sign_in_path_for(resource) member_path resource.id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def beta_registration\n return if current_user\n store_location\n redirect_to login_path\n end", "def register\r\n logger.info(\"UserController::register\")\r\n if logged_in?\r\n redirect_to :controller=>'user' , :action=>'my_account'\r\n end \r\n end", "def store_location\n # ...
[ "0.67836106", "0.67120445", "0.6632317", "0.6630951", "0.6524321", "0.6520937", "0.6509094", "0.6467532", "0.63941634", "0.63891876", "0.63575774", "0.63438904", "0.63384354", "0.6294176", "0.62853056", "0.6278327", "0.6278327", "0.6278327", "0.6278327", "0.6278327", "0.62783...
0.0
-1
get_ methods are automatically detected as possible metadata properties this plugin can fill. The property name filled by such method is given by the method's name: get_my_property will fill the :my_property metadata. The method get_others is used specifically to return properties whose name is unknown before fetching them. Get a specific property for a given set of nodes.
def get_nothing(nodes, metadata) record_call(:get_nothing, nodes, metadata) # Here we return something to test that if the first one fails we have the second CMDB nodes.map { |node| [node, "#{node} has nothing"] }.to_h end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_property(name, default= \"\")\n\t\treturn @transport.get_path(\"meta\",\"properties\", name) { default }\n\tend", "def define_getter_for(name, property_name: name)\n return if getters.include?(name)\n define_method(name) { |&block| self.[](property_name, &block) }\n getters << ...
[ "0.6182884", "0.6182395", "0.6167486", "0.58901936", "0.5850413", "0.58473736", "0.5833968", "0.5828825", "0.58120143", "0.5776215", "0.5758581", "0.5733154", "0.5676744", "0.56626076", "0.56626076", "0.56626076", "0.56626076", "0.56573755", "0.5616546", "0.5604276", "0.55829...
0.0
-1
Get a specific property for a given set of nodes.
def get_same_comment(nodes, metadata) record_call(:get_same_comment, nodes, metadata) nodes.map { |node| [node, "Comment for #{node}"] }.to_h end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_property!(node, name)\n value = node.xpath(name).text\n raise \"missing property '#{name}' in node: #{node}\" if value.empty?\n value\n end", "def get_property(node, name)\n node.xpath(name).text\n end", "def get_property(prop)\r\n prop = URI.parse(prop) unless ...
[ "0.66421777", "0.6613985", "0.63504857", "0.6222379", "0.6020043", "0.5959805", "0.59484744", "0.5936926", "0.58592415", "0.5854041", "0.5841914", "0.5744915", "0.5744316", "0.5709556", "0.56859344", "0.56850904", "0.5675808", "0.5667836", "0.56366163", "0.5613919", "0.560551...
0.0
-1
Get a specific property for a given set of nodes.
def get_different_comment(nodes, metadata) record_call(:get_different_comment, nodes, metadata) nodes.map { |node| [node, 'Comment from test_cmdb_2'] }.to_h end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_property!(node, name)\n value = node.xpath(name).text\n raise \"missing property '#{name}' in node: #{node}\" if value.empty?\n value\n end", "def get_property(node, name)\n node.xpath(name).text\n end", "def get_property(prop)\r\n prop = URI.parse(prop) unless ...
[ "0.66421777", "0.6613985", "0.63504857", "0.6222379", "0.6020043", "0.5959805", "0.59484744", "0.5936926", "0.58592415", "0.5854041", "0.5841914", "0.5744915", "0.5744316", "0.5709556", "0.56859344", "0.56850904", "0.5675808", "0.5667836", "0.56366163", "0.5613919", "0.560551...
0.0
-1
Get a specific property for a given set of nodes.
def get_different_comment_2(nodes, metadata) record_call(:get_different_comment_2, nodes, metadata) nodes.map { |node| [node, 'Comment2 from test_cmdb_2'] }.to_h end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_property!(node, name)\n value = node.xpath(name).text\n raise \"missing property '#{name}' in node: #{node}\" if value.empty?\n value\n end", "def get_property(node, name)\n node.xpath(name).text\n end", "def get_property(prop)\r\n prop = URI.parse(prop) unless ...
[ "0.66421777", "0.6613985", "0.63504857", "0.6222379", "0.6020043", "0.5959805", "0.59484744", "0.5936926", "0.58592415", "0.5854041", "0.5841914", "0.5744915", "0.5744316", "0.5709556", "0.56859344", "0.56850904", "0.5675808", "0.5667836", "0.56366163", "0.5613919", "0.560551...
0.0
-1
Register a call to be checked by the tests later Parameters:: method (Symbol): Method being called args (Array): Arguments given to the call
def record_call(method, *args) @calls = [] unless defined?(@calls) # Create a shallow copy of the args, just to make sure they won't get changed by later code @calls << [method] + Marshal.load(Marshal.dump(args)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method_call(method)\n\n\n\n # 197:7: called_method_name[method] '(' ( arguments[method] )? ')' ';'\n called_method_name(method)\n\n match(:LEFT_PARENTESIS)\n # 197:38: ( arguments[method] )?\n alt27 = 2\n # 197:38: ( arguments[method] )?\n look_ahead27_0 = look_...
[ "0.6858975", "0.6237834", "0.61832553", "0.6145338", "0.60489637", "0.5977971", "0.59229666", "0.5906149", "0.59038466", "0.59038466", "0.5900943", "0.58875537", "0.586053", "0.5818486", "0.5818486", "0.5807106", "0.5770599", "0.5749207", "0.5745525", "0.5739143", "0.5728422"...
0.6422736
2
create an instance of the class
def initialize(key,value) @key = key @value = value self.put(key,value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "d...
[ "0.76551366", "0.76551366", "0.76551366", "0.76551366", "0.76551366", "0.76551366", "0.76551366", "0.76551366", "0.76551366", "0.75507367", "0.75507367", "0.75507367", "0.75507367", "0.75507367", "0.74226886", "0.7413732", "0.7413216", "0.7412002", "0.73979497", "0.73913795", ...
0.0
-1
completely update existing record raises error if not found returns true if success, false if not
def update(value) key = self.key raise TCKeyNotFound unless self.delete @value = value put(key,value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_record \n if valid? && exists?\n query_string = \"UPDATE #{table} SET #{parameters_and_values_sql_string} WHERE id = #{@id};\"\n run_sql(query_string)\n @id\n else\n false\n end\n end", "def update_existing?\n !self.errors.any? && !item_return? && exists?\n end", "d...
[ "0.7971429", "0.7587212", "0.70364237", "0.6891356", "0.68833256", "0.6876648", "0.6855985", "0.68169117", "0.68151486", "0.68065006", "0.67891127", "0.67891127", "0.67546904", "0.66934097", "0.667767", "0.66594183", "0.662119", "0.65752524", "0.6569391", "0.6556532", "0.6525...
0.0
-1
delete an instance. Returns true if successful.
def delete open returning db.delete(self.key) do |result| close end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n ensure_service!\n service.delete_instance path\n true\n end", "def delete_instance instance_id\n execute do\n instances.delete_instance(\n instance_path(instance_id)\n )\n end\n end", "def delete_instance...
[ "0.8089813", "0.7516614", "0.738712", "0.72226447", "0.7020016", "0.6992585", "0.68937767", "0.681246", "0.67951375", "0.67786044", "0.6752187", "0.67444414", "0.66289437", "0.66190565", "0.660606", "0.66013944", "0.6597279", "0.65844333", "0.6576896", "0.65692073", "0.656361...
0.0
-1
returns true if successful
def put(key,value) open db[key] = value close end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def success?\n return true\n end", "def success?() end", "def success?\n true\n end", "def success?\n false\n end", "def success?\n false\n end", "def success?\n end", "def success?\n @error == false\n end", "def successful?\n @code == 0\n ...
[ "0.8129675", "0.8076046", "0.7901817", "0.7806217", "0.7806217", "0.77270377", "0.7544274", "0.744673", "0.7408221", "0.7390422", "0.7382772", "0.735323", "0.73525316", "0.73316365", "0.7305436", "0.72715104", "0.7258798", "0.724478", "0.72356635", "0.7217172", "0.7217172", ...
0.0
-1
fired when a track begins playing
def on_play(track) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_playing_track_changed(track)\n end", "def play_first_track()\n @ole.PlayFirstTrack()\n end", "def play_first_track()\n @ole.PlayFirstTrack()\n end", "def play_track\n return if @status.playback_state == :paused\n @logger.debug \"Playing track: #{@status.seconds} out of #{@status...
[ "0.76969385", "0.72475976", "0.72475976", "0.7064642", "0.6937949", "0.69146234", "0.66903615", "0.6676411", "0.66653794", "0.66390085", "0.66043067", "0.6563345", "0.6470697", "0.6458127", "0.64351904", "0.6434434", "0.6342219", "0.6324205", "0.6274029", "0.6271983", "0.6266...
0.8139569
0
fired when a track stops playing
def on_stop (track) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop\n if @playing\n @should_stop = true\n end\n end", "def stop\n @av_player.stop unless @av_player.nil?\n end", "def on_play(track)\n end", "def on_playing_track_changed(track)\n end", "def stop_song()\n @song_settings.stop rescue nil\n @show_pl...
[ "0.7256465", "0.67925584", "0.661744", "0.6605841", "0.65596026", "0.6379807", "0.629477", "0.6212285", "0.6178093", "0.61745393", "0.6085795", "0.6068525", "0.6052868", "0.5998807", "0.59870636", "0.5972227", "0.5938702", "0.5888811", "0.5846157", "0.58290166", "0.58290166",...
0.7939616
0
fired when information about the currently playing track has changed
def on_playing_track_changed(track) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_track_change\n # XXXMLG implement\n end", "def on_play(track)\n end", "def current_track\n reload\n @tracks[@current_track_index]\n end", "def tracks\n reload\n @tracks\n end", "def store_track_info\n if track = Track.find_by_id(session[:now_playing]).update_attribu...
[ "0.74635106", "0.6665595", "0.6638131", "0.64074826", "0.6175781", "0.6162234", "0.61579746", "0.6119478", "0.6085057", "0.6019288", "0.60147035", "0.59866834", "0.59812504", "0.59723276", "0.5934818", "0.5906822", "0.5866973", "0.5854722", "0.5853359", "0.58296067", "0.58271...
0.8230618
0
fired when calls to the iTunes COM interface will be deferred
def on_busy(reason) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nuixWorkerItemCallbackInit\nend", "def nuixWorkerItemCallbackClose\nend", "def run_purchase_notify\n self.delay.purchase_notify\n end", "def notifier; end", "def notifier; end", "def subscribed; end", "def enqueue_pending_output; end", "def delayed\n NotImplementedError\n end", ...
[ "0.5974352", "0.5242179", "0.511929", "0.5053777", "0.5053777", "0.50451326", "0.5027716", "0.50261605", "0.50144523", "0.49896213", "0.49706808", "0.49414545", "0.49089274", "0.49089274", "0.4866149", "0.48282006", "0.47917455", "0.47340864", "0.47334266", "0.47300652", "0.4...
0.49882728
10
fired when calls to the iTunes COM interface will no longer be deferred
def on_ready end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nuixWorkerItemCallbackClose\nend", "def unsubscribed; end", "def unsubscribe; end", "def unsubscribe()\n end", "def un_load\n\n NSLog('Whatever hasn\\'t been unloaded and could be better be now!')\n NSLog('We probably don\\'t need this now that we\\'re using RubyMotion and it\\'s awesome!'...
[ "0.5978906", "0.56433016", "0.5558368", "0.54327273", "0.54137367", "0.5392427", "0.5355092", "0.53317404", "0.52981323", "0.52858025", "0.5284003", "0.52795947", "0.52726793", "0.52726793", "0.5270722", "0.5232733", "0.5232733", "0.5214197", "0.521139", "0.52013654", "0.5163...
0.0
-1
fired when iTunes is about to quit
def on_quitting end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_quit\n end", "def will_quit\n end", "def quit; @quit = 1 end", "def on_prompting_for_quit\n end", "def quit; end", "def quit; end", "def quit\n Gamework::App.quit\n end", "def quit\n end", "def force_quit; @quit = 2 end", "def onQuit\n if DECORPOT_DOWNLOADS.length > 0\n...
[ "0.72172517", "0.6958776", "0.6708768", "0.6635162", "0.6625022", "0.6625022", "0.6606306", "0.65535736", "0.6475967", "0.6452871", "0.64269173", "0.64168745", "0.6360202", "0.6359019", "0.6359019", "0.63002676", "0.63002676", "0.62709224", "0.6268463", "0.6267448", "0.625720...
0.74621767
0
fired when iTunes is about prompt the user to quit
def on_prompting_for_quit end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quit\n abort(\"Thank you!\")\n end", "def on_quitting\n end", "def quit\n abort (\"Thanks for checking it out!\") \nend", "def quit; @quit = 1 end", "def on_quit\n end", "def exit_star\n stop_music\n abort(\"You're logged out\")\n end", "def will_quit\n end", "def qu...
[ "0.70682836", "0.70131433", "0.6998659", "0.6909184", "0.68759966", "0.6869595", "0.6846246", "0.6791746", "0.6791746", "0.67526376", "0.6728113", "0.671523", "0.6556248", "0.65523404", "0.6547297", "0.6543838", "0.6529352", "0.65192467", "0.6516478", "0.64713126", "0.6466632...
0.7653283
0
fired when the sound output volume has changed
def on_sound_volume_changed(newVolume) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sound_volume(value)\n @ole.SoundVolume = value\n nil\n end", "def volume=(vol)\n `#{@sound}.volume = #{vol}`\n end", "def sound_volume\n @ole.SoundVolume\n end", "def sfx_volume=(value)\n return unless value.between?(0, 100)\n @sfx_volume = Audio.sfx_volume = value\...
[ "0.7366843", "0.73260534", "0.71732664", "0.7012423", "0.68974054", "0.6869187", "0.6754327", "0.66617507", "0.66617507", "0.6646296", "0.65755546", "0.6487132", "0.6470571", "0.6359143", "0.633326", "0.62637174", "0.62596774", "0.6220357", "0.61507356", "0.61340344", "0.6115...
0.8455086
0
GET /itemstables/1 GET /itemstables/1.json
def show @itemstable = Itemstable.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @itemstable } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @items = Item.find(:all, :order => 'id ASC')\n # @items = Item.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @api_v1_items = Item.all\n render json: @api_v1_items\n end", "def index\n ...
[ "0.7268009", "0.7128106", "0.71129125", "0.71129125", "0.71129125", "0.71129125", "0.71022373", "0.707881", "0.70739734", "0.70731467", "0.68795013", "0.6833108", "0.68018353", "0.67950106", "0.67687905", "0.67684484", "0.67684484", "0.67684484", "0.67684484", "0.67684484", "...
0.76786083
0
GET /itemstables/new GET /itemstables/new.json
def new @itemstable = Itemstable.new respond_to do |format| format.html # new.html.erb format.json { render json: @itemstable } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @item = Item.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n \n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n ...
[ "0.74983203", "0.748148", "0.748148", "0.748148", "0.748148", "0.748148", "0.748148", "0.748148", "0.748148", "0.748148", "0.748148", "0.748148", "0.748148", "0.748148", "0.748148", "0.748148", "0.748148", "0.748148", "0.748148", "0.748148", "0.748148", "0.73879844", "0.7...
0.8194042
0
POST /itemstables POST /itemstables.json
def create @itemstable = Itemstable.new(params[:itemstable]) respond_to do |format| if @itemstable.save format.html { redirect_to @itemstable, notice: 'Itemstable was successfully created.' } format.json { render json: @itemstable, status: :created, location: @itemstable } else format.html { render action: "new" } format.json { render json: @itemstable.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n item = list.items.create!(item_params)\n render json: item, status: 201\n end", "def new\n @itemstable = Itemstable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @itemstable }\n end\n end", "def index\n @rentable_items = Rent...
[ "0.65573484", "0.63643664", "0.6166642", "0.60988367", "0.6086625", "0.6075624", "0.60271096", "0.60179335", "0.60179335", "0.60179335", "0.60179335", "0.60135174", "0.60130274", "0.5996573", "0.5990474", "0.59811145", "0.5967928", "0.5964161", "0.595236", "0.58680665", "0.58...
0.6989823
0
PUT /itemstables/1 PUT /itemstables/1.json
def update @itemstable = Itemstable.find(params[:id]) respond_to do |format| if @itemstable.update_attributes(params[:itemstable]) format.html { redirect_to @itemstable, notice: 'Itemstable was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @itemstable.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put_item(table_name, item)\n params = {\n table_name: table_name,\n item: item,\n return_values: \"NONE\",\n }\n $client.put_item(params)\n return item\nend", "def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end", "def update\n\n #update the item of request_ite...
[ "0.7377511", "0.69241804", "0.63948345", "0.6362756", "0.6294077", "0.6291325", "0.6277151", "0.6276869", "0.62618345", "0.625649", "0.62355524", "0.6203212", "0.6200948", "0.61769843", "0.6140988", "0.6084838", "0.60818106", "0.6035695", "0.60203", "0.6003617", "0.60011095",...
0.7092643
1
DELETE /itemstables/1 DELETE /itemstables/1.json
def destroy @itemstable = Itemstable.find(params[:id]) @itemstable.destroy respond_to do |format| format.html { redirect_to itemstables_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n render json: Item.delete(params[\"id\"])\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete_item(id)\n record \"/todos/delete_item/#{id}\"\n end", "def destroy\n# @item = Item.get(params[:id])\n ...
[ "0.75610363", "0.7224623", "0.72150683", "0.71026784", "0.70952463", "0.7089601", "0.70874", "0.70846236", "0.7077368", "0.70770943", "0.70770943", "0.70770943", "0.70770943", "0.70770943", "0.70770943", "0.70770943", "0.70770943", "0.70770943", "0.70770943", "0.70770943", "0...
0.7881444
0
When called, executes `block` and wraps all array values in Variables::Append. This is the default behavior in older versions and allows to provide arrays for default values that will be prepended.
def wrap_arrays_from_block(block) ->(*args) { options = block.(*args) options.merge( Defaults.wrap_arrays( options ) ) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append(values)\n @varset.append(values)\n end", "def array_append(array, value)\n array << value.freeze\n end", "def add_to_array(var1, *others)\n\tcurrent_arr = [var1, *others]\n\tcurrent_arr = current_arr.flatten\n\tp current_arr\nend", "def fill(*args, &block)\n ary = self...
[ "0.57355505", "0.55405724", "0.54926556", "0.5284793", "0.5227539", "0.5204189", "0.51883245", "0.5180044", "0.5147493", "0.5119615", "0.5119615", "0.5119615", "0.5119615", "0.5119615", "0.5119615", "0.5119615", "0.5119615", "0.5119615", "0.5119615", "0.5119615", "0.5119615",...
0.6735532
0
Intl languages are first choices
def name name_priorities.each do |method| n = send(method) return n unless n.blank? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_languages_localized\n available_languages.map{ |x| known_languages.assoc(x)}.map{ |y| [y[2],y[0]]}.sort!\n end", "def select_language\n I18n.backend.send(:init_translations) unless I18n.backend.initialized?\n lang = PatientHelper.languages(primary_language)&.dig(:code)&.to_sym || :en\n la...
[ "0.73524034", "0.7224257", "0.71047217", "0.70918095", "0.70918095", "0.6978803", "0.69208384", "0.69062316", "0.68458605", "0.67772454", "0.6757631", "0.6757631", "0.6757631", "0.6757631", "0.67445964", "0.6739358", "0.67355174", "0.67012185", "0.66930944", "0.6664172", "0.6...
0.0
-1
Time Complexity: O(logN) Space Complexity: O(1) ======
def binary_search(array, value) # First, we establish the lower and upper bounds of where the value we are # searching for can be. At the beginning, the lower bound is the first value # of the array and the upper bound is the last value of the array. lower_bound = 0 upper_bound = array.length - 1 # Now we start searching for the value inside the array between the lower and upper bounds. # In each iteration of the loop, we check the middle value between the lower and upper bounds # against the value we are searching for. If the middle value matches the value we are searching # for then we stop, otherwise we update the lower and upper bounds of our search accordingly(Should # we search to the right or the left of the mid point in the next iteration to find the value we are # looking for). # # If the value at the mid point matches with the value we are looking for, we are done and we return # the mid point(index of the value we are looking for). # # If the value is lower than the value at the mid point, we should to search to the left side of the mid point # in the next iteration. So we set the upper bound to the left of mid point. # # If the value is higher than the value at the mid point, we should to search to the right side of the mid point # in the next iteration. So we set the lower bound to the right of mid point. while lower_bound <= upper_bound # Find the mid point between the upper and lower bounds mid_point = (lower_bound + upper_bound) / 2 # Look up the value at the mid point value_at_mid_point = array[mid_point] # Check the value at the mid point against the value we are looking for: if value == value_at_mid_point return mid_point elsif value < value_at_mid_point upper_bound = mid_point - 1 elsif value > value_at_mid_point lower_bound = mid_point + 1 end end # If the value is not found, return nil indicating the value we are searching for # doesn't exist inside the array. return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_dublicate(array)\n sum = 1000000*(1000000+1)/2 # (n*(n+1))/2\n array.each do |el| \n sum -= el\n end\n return sum\nend", "def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\...
[ "0.6845418", "0.6471743", "0.6173412", "0.6094586", "0.59827656", "0.59721345", "0.5947499", "0.59355", "0.5933217", "0.5923607", "0.5871951", "0.5867153", "0.5867127", "0.58345264", "0.5826136", "0.5792129", "0.5784695", "0.5782071", "0.5770908", "0.5759165", "0.5753188", ...
0.0
-1
check performs a check to see if the user is allowed to access the given resource. Example: authorization_check("BlogController", "index", :get)
def authorization_check(controller, action, request, context = {}) # Determine the controller to look for controller_method = [controller, action].join("/") # Get the privilegesets privilege_sets = Privilege.select(controller_method, request) # Check the privilege sets check_privilege_sets(privilege_sets, context) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_authorization(**options)\n after_action(**options) do |controller|\n next if controller.instance_variable_defined?(:@_authorized)\n raise AuthorizationNotPerformed,\n 'This action failed the check_authorization because it does not authorize_resource. '\\\n ...
[ "0.67128867", "0.6635511", "0.6569784", "0.6442864", "0.6438612", "0.6392164", "0.6363927", "0.63496876", "0.629216", "0.6264981", "0.62346727", "0.61979455", "0.6166654", "0.6149321", "0.6140977", "0.6125435", "0.6115374", "0.6103019", "0.6079661", "0.607264", "0.6070394", ...
0.70750666
0
Check the given privilege_set symbol TODO following code is not yet tested
def check_privilege_set(privilege_set, context = {}) check_privilege_sets([PrivilegeSet.sets[privilege_set.to_sym]], context) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_privilege(user, privilege_id_str)\n if user == nil\n return false\n else\n return user.role.privileges.any? {|h| h[:str_id] == privilege_id_str}\n end\nend", "def test_set3_13_check() \n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'ALL_PRIVILEGES'\n res_ob_type = 'do...
[ "0.6405427", "0.6372189", "0.62293327", "0.6226812", "0.6218069", "0.6216629", "0.62120205", "0.6130963", "0.60479605", "0.6028858", "0.5946755", "0.5893574", "0.5889485", "0.5880267", "0.58716834", "0.58555186", "0.582169", "0.57881457", "0.5784594", "0.5675658", "0.5641284"...
0.79669785
0
Check the given privilege_sets
def check_privilege_sets(privilege_sets, context = {}) # Check the generic roles return true if privilege_sets.any? { |set| permitted_for_generic_role?(set, context) } # Check the context roles Get the permissions privilege_sets.collect do |privilege_set| Cbac::Permission.where(privilege_set_id: privilege_set.id, generic_role_id: 0) end.flatten.each do |permission| puts "Checking for context_role:#{permission.context_role} on privilege_set:#{permission.privilege_set.name}" if Cbac::Config.verbose eval_string = ContextRole.roles[permission.context_role.to_sym] begin return true if eval_string.call(context) rescue Exception => e puts "Error in context role: #{permission.context_role} on privilege_set: #{permission.privilege_set.name}. Context: #{context}" if %w{development test}.include? Rails.env raise e # In development mode, this should crash as hard as possible, but in further stages, it should not end end end # not authorized puts "Not authorized for: #{privilege_sets.to_s}" if Cbac::Config.verbose false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_privilege_set(privilege_set, context = {})\n check_privilege_sets([PrivilegeSet.sets[privilege_set.to_sym]], context)\n end", "def check_set_up(privileges)\n privileges.keys.each{|action| check_assertion(privileges[action]) }\n end", "def check_privilages_existence(privilages)\n ...
[ "0.7993759", "0.6908472", "0.6542557", "0.6271623", "0.62657756", "0.6261383", "0.62261134", "0.62224156", "0.61061436", "0.60405606", "0.5975749", "0.5969089", "0.5960539", "0.5891954", "0.5859304", "0.5855594", "0.58138436", "0.58017844", "0.57674587", "0.5765676", "0.57456...
0.8038551
0
Code that performs authorization
def authorize authorization_check(params[:controller], params[:action], request.request_method.downcase, self) || unauthorized end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authorization; end", "def authorize\n end", "def authorize\n end", "def authorization(*args, &block); end", "def authorize\n \t\t#teste http://localhost:3000/products/2/who_bought.atom\n \t\t#ou curl --silent --user dave:secret http://localhost:3000/products/2/who_bought.atom \n \t\treturn if User...
[ "0.8424192", "0.81786144", "0.81786144", "0.8057203", "0.73492277", "0.73293334", "0.73101616", "0.72962135", "0.727187", "0.72391844", "0.72391844", "0.72337836", "0.72337836", "0.7219183", "0.72029734", "0.7182899", "0.7180293", "0.71570307", "0.71395826", "0.71185476", "0....
0.0
-1
Default unauthorized method Override this method to supply your own code for incorrect authorization
def unauthorized render :text => "You are not authorized to perform this action", :status => 401 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unauthorized\n end", "def unauthorized\n\n render_error( :unauthorized )\n\n end", "def rescue_unauthorized\n render nothing: true, status: 403\n end", "def rescue_unauthorized\n render nothing: true, status: 403\n end", "def authorization_denied\n head :unauthorized\n end", ...
[ "0.8209946", "0.79433995", "0.77960193", "0.77960193", "0.7766516", "0.7696467", "0.767584", "0.76593107", "0.7592584", "0.75299865", "0.7474257", "0.7473472", "0.74692553", "0.7411897", "0.7347399", "0.7328193", "0.7294469", "0.7291607", "0.7258608", "0.72415435", "0.7229615...
0.7433386
13
Default implementation of the current_user method
def current_user_id(context = {}) context[:cbac_user].to_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_user\n raise NotImplementedError\n end", "def current_user\n raise NotImplementedError\n end", "def current_user\n # super: don't change anything, i just want the exact same behavior \n # as in the method that we are overriding\n\n # what this line means is that if the ...
[ "0.8409555", "0.8409555", "0.8211945", "0.7963521", "0.7880092", "0.7812115", "0.77935165", "0.779014", "0.77833045", "0.7764306", "0.7762301", "0.77466625", "0.7734777", "0.7731507", "0.76824594", "0.76824594", "0.76769435", "0.7671034", "0.7625231", "0.760659", "0.75925577"...
0.0
-1
Load controller classes and methods
def load_controller_methods begin Dir.glob("app/controllers/**/*.rb").each{|file| require file} rescue LoadError raise "Could not load controller classes" end # Make this iterative TODO @classes = ApplicationController.subclasses end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load\n @load_controller = @controller\n end", "def load_controllers\n return unless File.directory?(controllers_path)\n path = File.realpath(controllers_path)\n $LOAD_PATH.unshift(path)\n Dir[\"#{path}/**/*.rb\"].each do |f|\n next if f.include?('_pb') # exclude if people inclu...
[ "0.75922275", "0.6968351", "0.6943086", "0.68622535", "0.6557313", "0.65356094", "0.64624506", "0.64334196", "0.6421578", "0.63898486", "0.6360494", "0.6341731", "0.6308316", "0.62962604", "0.6213496", "0.6172085", "0.6156524", "0.61544", "0.61544", "0.6131889", "0.61222076",...
0.8094158
0
Extracts the class name from the filename
def extract_class_name(filename) File.basename(filename).chomp(".rb").camelize end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_class_name(filename)\n filename.split('/')[2..-1].collect { |i| i.camelize }.join('::').chomp(\".rb\")\n end", "def get_class_name(file_name)\n file_name += \".rb\" unless file_name =~ /\\.rb$/\n f = File.open(file_name, \"r\")\n f.readlines.each { |line| return $1.strip if line =~ /clas...
[ "0.9189254", "0.7985312", "0.7962697", "0.76170534", "0.7613907", "0.7591991", "0.75383353", "0.7486605", "0.7476503", "0.7440032", "0.73725414", "0.729087", "0.7249732", "0.7129715", "0.695761", "0.69045603", "0.68619853", "0.6852073", "0.6848823", "0.6787582", "0.6769271", ...
0.90446746
1
This is the code that is executed if CBAc is not properly installed/ configured. It includes a different authorize method, aimes at refusing all authorizations
def authorize render :text => "Authorization error", :status => 401 false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authorize\n end", "def authorize\n end", "def pre_authorize_cb; end", "def try_authorize\n authorize = Authorize.new(config, settings)\n authorize.configure\n end", "def pre_authorize_cb=(_arg0); end", "def enforce_requested_account_authorized!\n clear_authorization! unless requested_acco...
[ "0.6863489", "0.6863489", "0.67751867", "0.6713624", "0.6654996", "0.6480534", "0.64054066", "0.6390889", "0.63658774", "0.632697", "0.63116044", "0.63058066", "0.6301498", "0.6280871", "0.62599516", "0.6245719", "0.6201634", "0.62010664", "0.61899", "0.6168444", "0.61501604"...
0.5985434
42
Gets the registered endpoints.
def endpoints @endpoints ||= [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def endpoints\n EndpointRegistry[id]\n end", "def endpoints\n @endpoints ||= init_endpoints\n end", "def endpoints_list\n get \"endpoints\"\n end", "def get_endpoints\n endpoints = call(CMD_GET_ENDPOINTS)[:endpoints]\n endpoints.map {|endpoint| Endpoint.new(endpoint) }\n...
[ "0.83758074", "0.82501245", "0.8208895", "0.81948", "0.81769294", "0.78440744", "0.770362", "0.7447684", "0.7370538", "0.7327905", "0.70774144", "0.70774144", "0.6964012", "0.6872378", "0.67422926", "0.6628573", "0.6545027", "0.65358776", "0.65138197", "0.6499729", "0.6433641...
0.81492835
5
Inserts an endpoint into endpoints.
def register_endpoint(endpoint) endpoints << endpoint register_method(endpoint) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def << route\n raise \"Argument must be an Endpoint\" unless Endpoint === route\n _base, *subroute = route[:_path].split '/' # Split out first element\n if subroute.count == 0\n route[:_path] = \"\"\n @endpoints << route\n else\n route[:_path] = subroute.join ...
[ "0.67693305", "0.66528094", "0.6600635", "0.6094935", "0.60357314", "0.59651494", "0.5949847", "0.58685446", "0.5840391", "0.58166456", "0.58024174", "0.5786039", "0.5698026", "0.5626166", "0.5621901", "0.56167907", "0.54994386", "0.54994386", "0.54994386", "0.54994386", "0.5...
0.75189096
0
GET /exercise_modifications GET /exercise_modifications.json
def index @exercise_modifications = ExerciseModification.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @modifications = Modification.all\n\n render json: @modifications\n end", "def set_exercise_modification\n @exercise_modification = ExerciseModification.find(params[:id])\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render js...
[ "0.68814135", "0.6652723", "0.64713377", "0.63942856", "0.6308373", "0.6228848", "0.60247415", "0.5957111", "0.5807272", "0.580581", "0.57681024", "0.5755821", "0.5687894", "0.56870854", "0.56870854", "0.56870854", "0.5670374", "0.5669516", "0.56612235", "0.56083626", "0.5600...
0.73316497
0
GET /exercise_modifications/1 GET /exercise_modifications/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @exercise_modifications = ExerciseModification.all\n end", "def index\n @modifications = Modification.all\n\n render json: @modifications\n end", "def set_exercise_modification\n @exercise_modification = ExerciseModification.find(params[:id])\n end", "def edit\n respond_with...
[ "0.7276018", "0.6837251", "0.6648811", "0.65126956", "0.64649326", "0.6153017", "0.61002266", "0.60685694", "0.6061745", "0.60397404", "0.60397404", "0.60397404", "0.60004187", "0.5987086", "0.5984838", "0.59574586", "0.5942433", "0.5939712", "0.5939712", "0.5921761", "0.5911...
0.0
-1
PATCH/PUT /exercise_modifications/1 PATCH/PUT /exercise_modifications/1.json
def update respond_to do |format| if @exercise_modification.update(exercise_modification_params) format.js { render "timetable_modifications/reload_timetable_modification", locals: {timetable_modification: @exercise_modification.timetable_modification, beginning_date: @exercise_modification.date} } else format.js { render plain: @exercise_modification.errors.full_messages, status: :error } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n if @exercise.update_attributes(params[:exercise])\n format.html { redirect_to @exercise, :notice => 'exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { ...
[ "0.7018154", "0.69290125", "0.69290125", "0.69290125", "0.692228", "0.68373615", "0.6761925", "0.67183185", "0.66845524", "0.66745627", "0.6671997", "0.6671997", "0.66580135", "0.66468465", "0.6628762", "0.65594214", "0.6499039", "0.64630693", "0.6437929", "0.6430585", "0.641...
0.611093
38
DELETE /exercise_modifications/1 DELETE /exercise_modifications/1.json
def destroy @exercise_modification.destroy respond_to do |format| format.html { redirect_to @exercise_modification.timetable_modification.calendar.therapy, notice: 'Exercise modification was successfully destroyed.' } format.json { head :no_content } format.js { render "timetable_modifications/reload_timetable_modification", locals: {timetable_modification: @exercise_modification.timetable_modification, beginning_date: @exercise_modification.date} } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to...
[ "0.71407413", "0.7140703", "0.7140703", "0.7140703", "0.7140703", "0.7109999", "0.7109999", "0.7050458", "0.7016485", "0.69755006", "0.69571203", "0.693884", "0.69317514", "0.6898711", "0.682429", "0.68111223", "0.67982054", "0.6785001", "0.6785001", "0.678148", "0.6745263", ...
0.63069797
52
Use callbacks to share common setup or constraints between actions.
def set_exercise_modification @exercise_modification = ExerciseModification.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.61642385", "0.60448", "0.5945487", "0.5915654", "0.58890367", "0.58330417", "0.5776098", "0.5703048", "0.5703048", "0.5654613", "0.5620029", "0.5423114", "0.540998", "0.540998", "0.540998", "0.5393666", "0.53783023", "0.53568405", "0.53391176", "0.5339061", "0.53310865", ...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def exercise_modification_params params.require(:exercise_modification).permit(:exercise_template_id, :date, :coach_id, :price, :note, :timetable_modification_id, :removal) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
im sure there a better way
def projects taggings.all(:conditions => { :taggable_type => :Project}).map(&:taggable) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def schubert; end", "def probers; end", "def formation; end", "def suivre; end", "def stderrs; end", "def anchored; end", "def malts; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def offences_by; end", "def verdi; end", "def part...
[ "0.6445236", "0.61228144", "0.61174506", "0.5982853", "0.5981587", "0.58337283", "0.569486", "0.56908005", "0.5678792", "0.5678792", "0.5678792", "0.5678792", "0.56453013", "0.5615586", "0.5579909", "0.5579909", "0.5579909", "0.5571126", "0.5544085", "0.55424714", "0.5540987"...
0.0
-1
Record a passing assertion.
def pass checked_print ?. end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pass(pass_msg = nil)\n if @__assert_pending__ == 0\n capture_result(Assert::Result::Pass, pass_msg)\n else\n capture_result(\n Assert::Result::Fail,\n \"Pending pass (make it not pending)\",\n )\n end\n end", "def assertions; end", "def assertions; e...
[ "0.7144822", "0.69003457", "0.69003457", "0.6731753", "0.6688611", "0.6648133", "0.6586666", "0.6458668", "0.63890445", "0.6356762", "0.6356762", "0.63461477", "0.6324098", "0.6322266", "0.63087225", "0.63087225", "0.620087", "0.61977386", "0.6195783", "0.6193223", "0.6180468...
0.60438216
34
Record a failing assertion.
def fail @counts.fails += 1 puts_failure_data(header: FAIL_HEADER) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assertFailTest value\n rescue_assertion /#{ASSERT_ERROR}/ do\n assert value\n end\n end", "def assert_failure(response)\n clean_backtrace do\n assert_false response.success?, \"Response expected to fail: #{response.inspect}\"\n end\n end", "def assert_failure(respons...
[ "0.71804255", "0.70275664", "0.6884264", "0.6800581", "0.6772558", "0.6772558", "0.67643386", "0.67241514", "0.672073", "0.6683843", "0.6592414", "0.65915436", "0.6587613", "0.65788794", "0.65788794", "0.65612245", "0.6550263", "0.6509772", "0.64399767", "0.6427266", "0.64189...
0.62471884
49
Run a block under a certain name, catching and printing errors.
def group name @messages << name yield rescue StandardError => caught @counts.errors += 1 puts_failure_data( header: ERROR_HEADER, additional_info: error_to_info_array(caught) ) ensure @messages.pop end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(name=:main, options={}, &block)\n name = name.to_sym\n if !run_blocks.key? name\n options[:name] = name\n self.run_blocks[name] = [options, block]\n else\n raise NameError.new(\"Run block named #{name} already exists!\")\n end\n end", "def check...
[ "0.7200283", "0.65100384", "0.6352573", "0.62662876", "0.624095", "0.6221418", "0.6162405", "0.61336964", "0.61194336", "0.61193615", "0.6117797", "0.6117797", "0.61116284", "0.60780346", "0.6041341", "0.6031171", "0.60176367", "0.6011822", "0.60062647", "0.6000329", "0.59694...
0.0
-1
Add a line break if the last output was a print instead of a puts.
def break_after_print checked_puts if @prev_printed end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linebreak(amount=1)\n $stdout.print \"\\n\" * amount\n end", "def print_new_line\n puts ''\nend", "def fancy_newline\n @results += '|'\n newline\n end", "def line_feed\n write_raw \"\\n\"\n end", "def newline\n @results += nl\n end", "def write_separator\n @stream.put...
[ "0.7025258", "0.67630816", "0.66331655", "0.65614134", "0.6560803", "0.653687", "0.6486709", "0.6467514", "0.63861865", "0.6371358", "0.6369528", "0.6349727", "0.6342702", "0.63416815", "0.63416815", "0.63168776", "0.6312039", "0.63109505", "0.6296311", "0.62566906", "0.62498...
0.6992254
1
Output data related to a failure.
def puts_failure_data header:, additional_info: [] break_after_print checked_puts header + @messages.join(SEPERATOR) additional_info.each.with_index do |text, index| checked_puts indent(text, index + 1) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_fail_output(data)\n\t \t{data: nil, code: 401, result: \"fail\"}\n\t end", "def dump_failure(counter, failure)\n end", "def dump_failure(counter, failure)\n end", "def fail\n @counts.fails += 1\n puts_failure_data(header: FAIL_HEADER)\n end", "def failure(log_data = n...
[ "0.73017323", "0.68990624", "0.68990624", "0.68957937", "0.6850271", "0.6803093", "0.6762174", "0.6668698", "0.6668698", "0.66460466", "0.66460466", "0.6623406", "0.6549492", "0.65437186", "0.65274864", "0.6507109", "0.64896005", "0.64667255", "0.6424701", "0.64186394", "0.63...
0.6224476
42
Perform a puts and then set a flag for future line breaks.
def checked_puts object = '' real_puts object @prev_printed = false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def break_after_print\n checked_puts if @prev_printed\n end", "def puts(*args)\n @lock.synchronize do\n # ensure no indicator line remains out\n clear_stream\n @stream.puts(*args)\n end\n end", "def put_a_line\n puts \"\\n\"\n puts \"/\\\\\" * 40\n puts \"\\n\"\n end", ...
[ "0.6539675", "0.6033225", "0.597712", "0.5881232", "0.5837994", "0.5820349", "0.58044785", "0.57748836", "0.57747644", "0.57464963", "0.5743127", "0.5710441", "0.57094014", "0.5700951", "0.56792694", "0.5632745", "0.5632336", "0.5622981", "0.55974245", "0.55893785", "0.558426...
0.59146136
3
Perform a print and then set a flag for future line breaks.
def checked_print object = '' print object @prev_printed = true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def break_after_print\n checked_puts if @prev_printed\n end", "def nl\n @linebreak = true\n end", "def print_new_line\n puts ''\nend", "def linebreak(amount=1)\n $stdout.print \"\\n\" * amount\n end", "def print_in_same_line(log_string)\n print log_string + \"\\r\"\n end", ...
[ "0.7542785", "0.61922234", "0.61079156", "0.5936136", "0.59223294", "0.5905099", "0.5905053", "0.5835826", "0.5828196", "0.58174324", "0.5812909", "0.58024865", "0.58009225", "0.5800355", "0.5775888", "0.5773205", "0.5773057", "0.5752696", "0.57379675", "0.5714859", "0.569370...
0.60168844
3
Indent each line of a given string by a given amount.
def indent string, amount indent_string = ' ' * amount * INDENT_DEPTH string.gsub(/^/, indent_string) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def indent(string, amt)\n string.gsub /\\n *([^\\n]+)/m, \"\\n#{' ' * amt}\\\\1\"\n end", "def indent(str, amount=2)\n i = (\" \"*amount)\n (i + str.gsub(/\\n/, \"\\n#{i}\")).rstrip\n end", "def indent!(amount, indent_string = nil, indent_empty_lines = false)\n indent_string =...
[ "0.8068906", "0.8029936", "0.787587", "0.78464556", "0.7688212", "0.7597994", "0.757623", "0.7256313", "0.72115827", "0.69257283", "0.68497634", "0.6837663", "0.6777779", "0.67024785", "0.66995925", "0.6688951", "0.65265", "0.6511423", "0.64882815", "0.6469986", "0.64649403",...
0.79474837
2
Convert an error object into an array of strings describing the error.
def error_to_info_array error [ "#{error.class}: #{error.message}", error.backtrace .reject { |path| path.match?(/^#{__FILE__}:/) } .join(?\n) ] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def errors_string\n getErrors.map { |e| \"(#{e.object || ''}): #{e.error}\" }.join(', ').strip\n end", "def error_list_for(object)\n return errors_to_list(object.errors.full_messages)\n end", "def errors_string(error)\n str = []\n str << \"Exception occurred: #{error.message}\"\n str...
[ "0.70746017", "0.68215424", "0.6784252", "0.67407465", "0.67064893", "0.6560868", "0.65390396", "0.644001", "0.644001", "0.6428473", "0.63731635", "0.6372967", "0.62648946", "0.62582535", "0.62134457", "0.6192698", "0.61866814", "0.61678684", "0.61678684", "0.6164037", "0.616...
0.7048287
1
Group together assertions and groups under a given name.
def group name TetCore.group(name) { yield } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assert name\n TetCore.group(name) do\n TetCore.assert\n\n yield ? TetCore.pass : TetCore.fail\n end\nend", "def group name\n @messages << name\n yield\n rescue StandardError => caught\n @counts.errors += 1\n puts_failure_data(\n header: ERROR_HEADER,\n ad...
[ "0.6431452", "0.5829767", "0.54952645", "0.5414721", "0.5384079", "0.53477186", "0.5307462", "0.52626175", "0.52625716", "0.52443", "0.51932913", "0.5161136", "0.5161136", "0.5161136", "0.51521087", "0.51448816", "0.512766", "0.5122026", "0.51192135", "0.5116697", "0.5116697"...
0.5770597
2
Assert that a given block will return true.
def assert name TetCore.group(name) do TetCore.assert yield ? TetCore.pass : TetCore.fail end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_block(&blk)\n begin\n return true if yield\n rescue\n false\n end\n end", "def test_assert_block_works\n assert_block do\n true\n end\n end", "def executeAssertionBlock(block)\n !!block.call(object)\n end", "def test_check_block_num_equal\r\n assert_equal tru...
[ "0.8064507", "0.79779375", "0.7679944", "0.7488706", "0.7482165", "0.71795994", "0.7114606", "0.70432365", "0.703502", "0.7029824", "0.7012212", "0.69944793", "0.69749415", "0.6951795", "0.69138235", "0.6907696", "0.69074166", "0.6905159", "0.6877028", "0.68727046", "0.683919...
0.0
-1
Assert that a given block will raise an expected error.
def error name, expect: TetCore.group(name) do begin TetCore.assert yield rescue expect TetCore.pass else TetCore.fail end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_bad_block\n assert_raises SystemExit do\n assert_output \"Line 1: Invalid block, missing or extra element(s)\\nBLOCKCHAIN INVALID\" do\n line = ['0', '0', 'SYSTEM>569274(100)', '1553184699.650330000', '288d', '']\n line_num = 1\n @verify.check_block(line, line_num)\n ...
[ "0.7349022", "0.7202271", "0.70680815", "0.7062145", "0.7061285", "0.7050269", "0.7037141", "0.6978762", "0.692188", "0.68444675", "0.6800411", "0.67910504", "0.67748296", "0.6771287", "0.6771287", "0.6760973", "0.67570794", "0.6755936", "0.67487395", "0.67487395", "0.6748739...
0.6738037
23
A redefined version of puts which ensures a line break before the printed object (for easier debugging).
def puts object = '' TetCore.break_after_print TetCore.real_puts(object) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def puts(*args)\n args.each do |obj|\n self.write \"#{obj.to_s.sub(/\\n$/, '')}\\n\"\n flush\n end\n end", "def puts(msg)\n # print msg\n # print \"\\n\"\n @lines << \"#{msg}\\n\"\nend", "def puts(str = \"\")\n # {{{\n self.print(str + \"\\n\")\n # }}}\n end", "def...
[ "0.6948816", "0.69219565", "0.6813474", "0.6706996", "0.6658812", "0.6637449", "0.65695125", "0.65555215", "0.65325814", "0.6531985", "0.6531985", "0.65266347", "0.6491014", "0.6477412", "0.6468542", "0.63745636", "0.6350347", "0.63457614", "0.6328514", "0.63271636", "0.63271...
0.70835596
0
A redefined version of p which ensures a line break before the printed object (for easier debugging).
def p object TetCore.break_after_print TetCore.real_p(object) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def p_blankline\n p do\n nbsp\n end\n end", "def pprint(object)\n PP.pp(object)\nend", "def pretty_print(pp)\n pp.object_address_group(self) do\n ivs = sorted_instance_variables.map(&:to_s)\n pp.seplist(ivs, proc { pp.text ',' }) do |iv|\n pp.breakable ' '\n ...
[ "0.6569725", "0.64134145", "0.6392816", "0.6312792", "0.6312792", "0.63040197", "0.6283957", "0.6179135", "0.61288357", "0.6124406", "0.6121072", "0.6112978", "0.61085033", "0.61085033", "0.61051726", "0.5991977", "0.59801865", "0.59782106", "0.5953166", "0.5951761", "0.59471...
0.6535291
1
Use callbacks to share common setup or constraints between actions.
def set_article @article = find_one(Article, articles_url) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Not done without DBClean
def teardown super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flushdb; end", "def clean_up\n end", "def clean_up\n end", "def reset_db\n \n end", "def clean\n\t\t\n\t\t@db.del 'twitter'\n\t\t@db.del 'rpg'\n\t\n\tend", "def hard_clean!\n open_db\n @file.truncate(PREAMBLE_SIZE)\n write_fresh_database\n end", "def flush_db\n [ 'active_...
[ "0.72631586", "0.70748657", "0.70748657", "0.70508116", "0.7023957", "0.69838667", "0.69481957", "0.689827", "0.6858428", "0.68381804", "0.6805836", "0.6783668", "0.6713358", "0.6694401", "0.6689428", "0.6686901", "0.6647055", "0.6564634", "0.6515291", "0.65070283", "0.648864...
0.0
-1
You may not use Stringswapcase; write your own version of this method.
def swapcase(string) string.chars.map do |char| if char.downcase == char char.upcase elsif char.upcase == char char.downcase else char end end.join('') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def swapcase() end", "def swapcase!() end", "def swap_case(str)\n str.swapcase\nend", "def SwapCase(str)\n\n return str.swapcase! \n \nend", "def SwapCase(str)\n str.swapcase\nend", "def SwapCase(str)\n str.swapcase\nend", "def downcase() end", "def SwapCase(str)\n\tstr.swapcase\nend", ...
[ "0.88640493", "0.8771278", "0.8654622", "0.8632088", "0.85968226", "0.85968226", "0.84793943", "0.844951", "0.8391302", "0.83685565", "0.8342224", "0.83126247", "0.8234063", "0.82171947", "0.8210463", "0.8210349", "0.8209833", "0.8201698", "0.81713945", "0.8166072", "0.816550...
0.8019857
31
Finds the shortest distance between a line and a point. Parameters: Point or Array of Numeric(coordinates)
def distance(other) other = Point.new(other[0], other[1]) if other.is_a?(Array) raise TypeError, "Distance between Line and #{ other.class } is not defined" unless other.is_a?(Point) return 0 if self.contains?(other) self.perpendicular_segment(other).length end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance_of_point_to_line(point, line, point_on_line)\n (point - point_on_line).dot((line).normal_unit).abs\n end", "def line_point_distance(line_start, line_end, point)\n top = ((line_end.y - line_start.y) * point.x) -\n ((line_end.x - line_start.x) * point.y) +\n (line_end....
[ "0.7101902", "0.66273624", "0.65636814", "0.65373605", "0.6108937", "0.61080325", "0.60805017", "0.6078634", "0.6058194", "0.60509586", "0.6030127", "0.60140157", "0.60131896", "0.6007438", "0.59692913", "0.59124255", "0.59019506", "0.584644", "0.58404934", "0.5836621", "0.58...
0.5845545
18
Returns True if self and other are the same mathematical entities. Parameters: GeometryEntity
def ==(other) return false unless other.is_a?(Line) Point.is_collinear?(self.p1, other.p1, self.p2, other.p2) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rep_equals?(another_geometry)\n raise Error::UnsupportedOperation, \"Method Geometry#rep_equals? not defined.\"\n end", "def equals?(another_geometry)\n raise Error::UnsupportedOperation, \"Method Geometry#equals? not defined.\"\n end", "def eql?(other)\n return false unles...
[ "0.70841193", "0.69638544", "0.6590686", "0.6379645", "0.62444025", "0.6229096", "0.6216815", "0.6200492", "0.61317474", "0.6124625", "0.6116047", "0.61117667", "0.6111161", "0.610256", "0.6100246", "0.60884285", "0.60751015", "0.6065544", "0.6015397", "0.5993276", "0.5991931...
0.5816099
50
The equation of the line: ax + by + c.
def equation if p1.x == p2.x return "x - #{p1.x}" elsif p1.y == p2.y return "#{p2.y} - p1.y" end "#{a}*x + #{b}*y + #{c} = 0" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance_to_line(a, b, c, x, y)\n # Using -c instead of +c due to moving C across the equals sign\n (a * x + b * y - c).abs.to_f / Math.sqrt(a * a + b * b)\n end", "def cramers_rule(ax,ay,az,a)\n # ax = array for all coefficients of x\n # ay = array for all coefficients of y\n # a...
[ "0.61501676", "0.587046", "0.58419555", "0.5816525", "0.57991874", "0.5711215", "0.5701129", "0.56950814", "0.55938506", "0.55499816", "0.5442694", "0.54342175", "0.5382598", "0.53742343", "0.53634655", "0.53375894", "0.529489", "0.5275826", "0.5275826", "0.52574193", "0.5257...
0.5982151
1
The coefficients 'a' for ax + by + c = 0.
def a @a ||= self.p1.y - self.p2.y end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def polynomial_coefficients(p, i)\n [p[3][i] - 3 * p[2][i] + 3 * p[1][i] - p[0][i],\n 3 * p[2][i] - 6 * p[1][i] + 3 * p[0][i],\n 3 * p[1][i] - 3 * p[0][i],\n p[0][i]]\n end", "def cramers_rule(ax,ay,az,a)\n # ax = array for all coefficients of x\n # ay = array ...
[ "0.57720715", "0.5612548", "0.5497373", "0.5457277", "0.5376953", "0.52761525", "0.51809067", "0.51520205", "0.5140647", "0.5140647", "0.5061224", "0.50208366", "0.49871272", "0.49871272", "0.4976904", "0.4948696", "0.49389657", "0.49363217", "0.4860692", "0.482912", "0.48109...
0.40786737
92
The coefficients 'b' for ax + by + c = 0.
def b @b ||= self.p2.x - self.p1.x end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cdf(x, a, b)\n return 0.0 if x <= 0.0\n return 1.0 if x >= 1.0\n Math::IncompleteBeta.axpy(1.0, 0.0, a, b, x)\n end", "def init_coefficients\n weight_keys = @model.weights.keys\n \n @model.output_size[0].times do\n row = []\n @model.output_size[1].times do...
[ "0.5713198", "0.55270666", "0.53680974", "0.5110441", "0.5066021", "0.5016892", "0.49815753", "0.49736282", "0.49728835", "0.49437505", "0.49186125", "0.48842096", "0.48842096", "0.48837766", "0.48512015", "0.48512015", "0.48303822", "0.48262736", "0.48016065", "0.47894138", ...
0.47276807
21
The coefficients 'c' for ax + by + c = 0.
def c @c ||= self.p1.x * self.p2.y - self.p1.y * self.p2.x end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def polynomial_coefficients(p, i)\n [p[3][i] - 3 * p[2][i] + 3 * p[1][i] - p[0][i],\n 3 * p[2][i] - 6 * p[1][i] + 3 * p[0][i],\n 3 * p[1][i] - 3 * p[0][i],\n p[0][i]]\n end", "def init_coefficients\n weight_keys = @model.weights.keys\n \n @model.output_size[...
[ "0.5483159", "0.5350325", "0.5270687", "0.5207772", "0.5204517", "0.518682", "0.5126041", "0.51128256", "0.50208014", "0.4988658", "0.4981637", "0.49813348", "0.49800348", "0.49565813", "0.49130553", "0.48894542", "0.4848897", "0.48318374", "0.48318374", "0.4801245", "0.47915...
0.50726676
8
GET /post9s GET /post9s.json
def index @post9s = Post9.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n\n @posts = Post.all\n\n render json: @posts, status: 200\n end", "def index\n @posts = Post.all\n render json: @posts\n end", "def index\n @posts = Post.all\n\n render json: @posts\n end", "def index\n @posts = Post.all\n\n render json: @posts\n end", "def index\n ...
[ "0.6850464", "0.6808827", "0.6792011", "0.6792011", "0.67626184", "0.6734654", "0.6732348", "0.673066", "0.67299086", "0.67299086", "0.67299086", "0.67183125", "0.6708495", "0.6697027", "0.6691991", "0.6663267", "0.663233", "0.6625373", "0.6613277", "0.6581927", "0.6566487", ...
0.72354263
0
GET /post9s/1 GET /post9s/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @post9s = Post9.all\n end", "def index\n\n @posts = Post.all\n\n render json: @posts, status: 200\n end", "def index\n @posts = Post.all\n render json: @posts\n end", "def index\n @posts = Post.all\n\n render json: @posts\n end", "def index\n @posts = Post.all\n\n ...
[ "0.7041", "0.6660259", "0.66245764", "0.66114384", "0.66114384", "0.6610557", "0.6597396", "0.6584152", "0.65809333", "0.6568472", "0.6568472", "0.6568472", "0.6563923", "0.6536756", "0.65288466", "0.65239215", "0.64981735", "0.64966744", "0.64957935", "0.64831084", "0.648131...
0.0
-1
POST /post9s POST /post9s.json
def create @post9 = Post9.new(post9_params) respond_to do |format| if @post9.save format.html { redirect_to @post9, notice: 'Post9 was successfully created.' } format.json { render :show, status: :created, location: @post9 } else format.html { render :new } format.json { render json: @post9.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n render json: Post.create(params[\"post\"])\n end", "def test_post_sample_traces\n header 'Content-Type', 'application/json'\n\n (0..4).each do |i|\n data = File.read \"sample-traces/#{i}.json\"\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n assert last_respons...
[ "0.5938688", "0.5893856", "0.5843974", "0.5815755", "0.58063555", "0.57829344", "0.57540226", "0.57065016", "0.5671646", "0.5671466", "0.5670034", "0.5666082", "0.5663792", "0.56560344", "0.564889", "0.5627489", "0.56259674", "0.5557768", "0.5554175", "0.55201966", "0.5502208...
0.6555039
0
PATCH/PUT /post9s/1 PATCH/PUT /post9s/1.json
def update respond_to do |format| if @post9.update(post9_params) format.html { redirect_to @post9, notice: 'Post9 was successfully updated.' } format.json { render :show, status: :ok, location: @post9 } else format.html { render :edit } format.json { render json: @post9.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n render json: Post.update(params[\"id\"], params[\"post\"]...
[ "0.6691746", "0.6652953", "0.66443723", "0.6484629", "0.6462096", "0.6461876", "0.64293826", "0.6366487", "0.6344029", "0.63279814", "0.63244885", "0.6304801", "0.62867945", "0.62526554", "0.62504166", "0.6234353", "0.62262714", "0.6220846", "0.6215028", "0.6213874", "0.61901...
0.63389176
9
DELETE /post9s/1 DELETE /post9s/1.json
def destroy @post9.destroy respond_to do |format| format.html { redirect_to post9s_url, notice: 'Post9 was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @api_post.destroy\n\n head :no_content\n end", "def delete\n render json: Post.delete(params[\"id\"])\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n\n json_response(@po...
[ "0.7451044", "0.7444812", "0.7389248", "0.7295355", "0.7264935", "0.7253466", "0.72238225", "0.72156405", "0.7212639", "0.7210475", "0.7181015", "0.71800905", "0.7167696", "0.7167429", "0.70855254", "0.7070129", "0.70650893", "0.70383406", "0.7037499", "0.7031429", "0.7029643...
0.7297477
3
Use callbacks to share common setup or constraints between actions.
def set_post9 @post9 = Post9.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def post9_params params[:post9][:user_id] = current_user.id params.require(:post9).permit(:title, :content, :user_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6981606", "0.6784227", "0.6746523", "0.67439264", "0.67361516", "0.6593381", "0.6506166", "0.64994407", "0.6483518", "0.64797056", "0.64578557", "0.6441216", "0.63811713", "0.63773805", "0.6366333", "0.63217646", "0.6301816", "0.63009787", "0.6294436", "0.62940663", "0.629...
0.0
-1
Pulls down a copy of a SubVersion source repository.
def scm_pull(uri,dest=nil) if dest sh 'svn', 'checkout', uri, dest else sh 'svn', 'checkout', uri end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pull(remote = nil, branch = nil)\n self.lib.pull(remote, branch)\n end", "def call\n wiki.repo.git.pull({}, 'orgin', 'master')\n\n if settings.site\n if Dir.exist?(site_path)\n $stderr.puts \"Pulling `#{repo.branch}' from `origin' in `#{repo.path}'...\"\n ...
[ "0.65066814", "0.6410297", "0.64008564", "0.6349781", "0.6348407", "0.6338483", "0.6335742", "0.6290717", "0.6214094", "0.61530507", "0.61175036", "0.60698277", "0.6044757", "0.6036262", "0.6009077", "0.6008291", "0.5977345", "0.59619045", "0.5931379", "0.5925045", "0.5903647...
0.68998563
0
Updates a local SubVersion repository.
def scm_update(path,uri=nil) cd(path) { sh 'svn', 'update' } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n working_dir do\n git 'fetch', 'origin'\n git 'checkout', branch\n git 'reset', '--hard', \"origin/#{branch}\"\n git 'submodule', 'update', '--init'\n end\n end", "def update\n working_dir do\n git 'checkout', working_dir\n git 'clean', '-fd...
[ "0.6604557", "0.65105295", "0.6490381", "0.6436179", "0.6420287", "0.64060146", "0.64060146", "0.6284669", "0.6281402", "0.6188914", "0.61650217", "0.6123574", "0.6120752", "0.6082119", "0.6030044", "0.6012872", "0.600011", "0.59953207", "0.59906036", "0.598999", "0.5973422",...
0.6333419
7
function to get connect to sql
def query_db (sql_statement) db = SQLite3::Database.new 'database.sqlite3' db.results_as_hash = true results = db.execute sql_statement db.close results end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _connect_database\n _send_command(\"db_connect #{@options[:db_user]}:#{@options[:db_pass]}@#{@options[:db_host]}/#{@options[:db_name]}\")\n end", "def connect_code\n if @config.db_general_authmode == :winauth\n @config.db_connect_string_winauth.gsub(/@host@/, host).\n g...
[ "0.67725325", "0.6627116", "0.66024995", "0.6587588", "0.65868634", "0.65598077", "0.65433913", "0.6514879", "0.65145606", "0.64992315", "0.6405782", "0.6400489", "0.6399742", "0.6395476", "0.6369161", "0.63680017", "0.6363829", "0.6358746", "0.6355745", "0.6328632", "0.63084...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_industry @api_v1_industry = Industry.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.61642385", "0.60448", "0.5945487", "0.5915654", "0.58890367", "0.58330417", "0.5776098", "0.5703048", "0.5703048", "0.5654613", "0.5620029", "0.5423114", "0.540998", "0.540998", "0.540998", "0.5393666", "0.53783023", "0.53568405", "0.53391176", "0.5339061", "0.53310865", ...
0.0
-1
Only allow a trusted parameter "white list" through.
def industry_params params.require(:industry) .permit( :industry_name, :exchange_code, :sync_flag, :logo ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.638045...
0.0
-1
Creates `Describe` message to describe some portal or SQLstatement
def initialize(statement_or_portal: 'S', statement_or_portal_name: '') super() write_byte(statement_or_portal.ord) write_string(statement_or_portal_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _describe_portal(statement, tx = nil)\n @statement = statement\n run(:_send_describe_portal, [statement], tx)\n end", "def _describe_statement(statement, tx = nil)\n @statement = statement\n run(:_send_describe_statement, [statement], tx)\n end", "def describe(desc, *additional_de...
[ "0.7182751", "0.6471244", "0.608312", "0.6053788", "0.6053788", "0.60167605", "0.5895326", "0.58733326", "0.5872356", "0.5834615", "0.57434624", "0.5676911", "0.56363595", "0.55958897", "0.55891526", "0.55572146", "0.5542741", "0.5527195", "0.5504", "0.5501559", "0.54878116",...
0.0
-1