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
Return a JSON object with image information add &metadata=true for image metadata add &presets=true for preset url for this image add &relative=true for relative urls instead of absolute
def info(preset, source_uri, format) url_opts = { :storage => params[:storage], :preset => preset, :format => format } relative_uri = url_for_external_image(params[:relative_path], url_opts) absolute_path = Merb.dir_for(:public) / relative_uri base_url = params[:relative] ? '' : (request.p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_image_metadata\n {}\n end", "def info(preset, source_path, format)\n url_opts = { :storage => params[:storage], :preset => preset, :format => format }\n relative_uri = url_for_image(params[:relative_path], url_opts)\n absolute_path = Merb.dir_for(:public) / relative_uri\n ...
[ "0.7031549", "0.7020652", "0.690066", "0.68072295", "0.6803236", "0.650662", "0.650662", "0.64883614", "0.6450161", "0.6448246", "0.638009", "0.6376391", "0.6346044", "0.63023746", "0.6302329", "0.6246139", "0.62407583", "0.6240012", "0.6201065", "0.61896676", "0.6154038", ...
0.6963861
2
Return the internal url for the given image location.
def image_location url_opts = { :storage => params[:storage] || 'default', :preset => params[:preset] || 'default', :format => params[:format] || 'jpg' } raise BadRequest if request.raw_post.blank? base_url = params[:relative] ? '' : (request.protocol + "://" + request.host) image_uri = base_ur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image_url(source)\n abs_path = image_path(source)\n unless abs_path =~ /^http/\n abs_path = \"#{request.protocol}#{request.host_with_port}#{abs_path}\"\n end\n abs_path\n end", "def image_url\n return \"\" if @path.nil? || @path.empty?\n \"#{images_scheme}://#{...
[ "0.7859339", "0.76939267", "0.7672241", "0.7546523", "0.7546523", "0.74603087", "0.7304334", "0.7295035", "0.72645384", "0.7262479", "0.72599655", "0.72440857", "0.7239856", "0.7204256", "0.7164402", "0.7145168", "0.7138603", "0.7133312", "0.71148044", "0.7112707", "0.7105587...
0.7318159
6
The absolute path derived from the request where files will be stored
def base_request_path Merb.dir_for(:public) / slice_url(:external_delete_all) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_path\n @request_path ||= ::File.expand_path(::File.join(root_dir, ::Rack::Utils.unescape(path_info)))\n end", "def root_file_path; end", "def path\n file.url\n end", "def original_fullpath; end", "def file_path\n dir\n end", "def path\n \"/#{UPLOAD_DIR}/#{filena...
[ "0.74823177", "0.74335265", "0.74174255", "0.7312486", "0.73083234", "0.727313", "0.72679776", "0.72456837", "0.72265416", "0.7216325", "0.71949065", "0.7194002", "0.71904707", "0.7181576", "0.71426016", "0.71414423", "0.7138165", "0.7128118", "0.7126308", "0.70932794", "0.70...
0.67756265
66
Render a preset pass :doc_id to enable referencing in SofaCache
def show(preset, character_data, format) only_provides(*graphics_mime_types) raise NotFound unless content_type && preset_exists?(preset) runner = send(:"#{rubify(preset)}_preset", character_data) raise InternalServerError unless runner.is_a?(ImMagick::Command::Runner) image_path = save_f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_document; end", "def preview_doc\n @tpl = Template.find(params[\"template_id\"]) \n output = @tpl.render_by_model_id(params[:id], 'print', 'www.freightoperations.com:8080')\n render(:text => output, :layout => false) \n end", "def show(preset, source_path...
[ "0.5854299", "0.5738233", "0.5724434", "0.55672073", "0.55521834", "0.5502645", "0.54903424", "0.5471691", "0.5463941", "0.5455128", "0.54450744", "0.5430332", "0.54270226", "0.5425831", "0.5425831", "0.5391101", "0.5360389", "0.53223485", "0.52882814", "0.52721", "0.52658117...
0.5494652
6
Default preset A preset method needs to have a _preset postfix in its name and should return a ImMagick::Command::Runner instance.
def default_preset(string) generate_label(string, :pointsize => 18, :alpha => true) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determine_preset_name\n @params.first.include?('.') ? 'default' : @params.shift\n end", "def get_preset\n pricingoptions.find_by(:preset => true) || pricingoptions.first\n end", "def choose_processor\n self.processor = if MiniMagick::Utilities.which('mogrify')\n ...
[ "0.6436318", "0.6012292", "0.5578235", "0.5368469", "0.53438175", "0.50430316", "0.49750558", "0.4969591", "0.4964898", "0.4959877", "0.49109083", "0.48617765", "0.4857073", "0.48376352", "0.47637957", "0.47537255", "0.470179", "0.46866375", "0.4660724", "0.4582039", "0.45796...
0.5461114
3
Helper to generate autosizing text labels
def generate_label(string, options = {}) merge_label_options!(options) text_image = ImMagick::convert.autosize.background(:background).gravity(:gravity) text_image.font(:font).pointsize(:pointsize).fill(:fill).label(:label).bordercolor(:background).border(:padding) final_image = text_imag...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adjust_width\n self.width = [[text_size('O' * @max_characters).width + padding * 2,\n @title ? text_size(@title).width + padding * 2 : 0].max, Graphics.width].min\n end", "def wrap_with_label(a_label, a_desc)\n spacer = \" \"*a_label.size\n desc_array = a_desc.fit(MAX_COLUMNS - a_label.size).split(\...
[ "0.6552779", "0.64661384", "0.6381637", "0.6312752", "0.62977105", "0.61164796", "0.6017476", "0.5996736", "0.59932965", "0.59745204", "0.59678245", "0.58608323", "0.58608323", "0.58608323", "0.58539295", "0.5818422", "0.5785287", "0.57120633", "0.57074493", "0.57063377", "0....
0.6200336
5
Helper to generate autosizing text labels with transparent characters on a filled background
def generate_inverse_label(string, options = {}) merge_label_options!(options) text_image = ImMagick::convert.autosize.background('white').gravity(:gravity) text_image.font(:font).pointsize(:pointsize).fill('black').label(:label) text_image.bordercolor('white').border(:padding) final_ima...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_label(string, options = {})\n merge_label_options!(options)\n \n text_image = ImMagick::convert.autosize.background(:background).gravity(:gravity)\n text_image.font(:font).pointsize(:pointsize).fill(:fill).label(:label).bordercolor(:background).border(:padding)\n final_image =...
[ "0.65932924", "0.6516505", "0.644389", "0.6437915", "0.6244249", "0.6198141", "0.617263", "0.60962677", "0.6037736", "0.60121185", "0.5942542", "0.5940871", "0.59315896", "0.5919311", "0.5896243", "0.58714855", "0.5869896", "0.5866029", "0.58310264", "0.5828539", "0.5827281",...
0.61802685
6
Reversemerge with default label options
def merge_label_options!(options) defaults = { :background => :white, :fill => :black, :gravity => :center, :pointsize => 12, :bordersize => 0, :padding => '0x0' } options.replace(defaults.merge(options)) options[:font] = locate_font(options[:font]) if options[:font] && options[:font][0..1] != '/'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_unmerge_options(options)\n default_emerge_options('--unmerge', options)\n end", "def process_reverse_labeling\n removed = labels_to_remove\n added = labels_to_add\n\n @labels_to_remove = added\n @labels_to_add = removed\n\n process_labeling\n end", "def merge(opts); end"...
[ "0.608189", "0.60294", "0.6024065", "0.58938664", "0.58676535", "0.58676535", "0.5751123", "0.569024", "0.56872827", "0.56845456", "0.5666632", "0.5630712", "0.56078887", "0.560457", "0.55909985", "0.5573236", "0.55172855", "0.5470925", "0.5436582", "0.5436582", "0.54362285",...
0.5376832
22
The absolute path derived from the request where files will be stored
def base_request_path Merb.dir_for(:public) / slice_url(:textim_delete_all) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_path\n @request_path ||= ::File.expand_path(::File.join(root_dir, ::Rack::Utils.unescape(path_info)))\n end", "def root_file_path; end", "def path\n file.url\n end", "def original_fullpath; end", "def file_path\n dir\n end", "def path\n \"/#{UPLOAD_DIR}/#{filena...
[ "0.7482371", "0.7432581", "0.7416603", "0.73115605", "0.73073536", "0.72727", "0.7268213", "0.7244649", "0.72251505", "0.7214889", "0.7193956", "0.7193439", "0.7189038", "0.71808606", "0.7142374", "0.71413803", "0.71373826", "0.71269643", "0.71257263", "0.709214", "0.70904994...
0.0
-1
Helper method for bottomup implementation
def knapsack_table(weights, values, capacity) table = Array.new (0..capacity).each do |i| table[i] = Array.new (0...weights.length).each do |j| if i == 0 table[i][j] = 0 elsif j == 0 table[i][j] = weights[j] > i ? 0 : values[j] else x = table[i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_to_bottom\n return unless in_list?\n\n decrement_positions_on_lower_items\n assume_bottom_position \n end", "def move_to_bottom\n return unless in_list?\n\n decrement_positions_on_lower_items\n assume_bottom_position\n end", "def move_to_bottom\n ...
[ "0.70185775", "0.6855966", "0.6792547", "0.66875625", "0.66756815", "0.6672704", "0.66373646", "0.663226", "0.6596407", "0.6587347", "0.6516622", "0.65097195", "0.6507161", "0.64792657", "0.6440934", "0.6431597", "0.6431418", "0.63186693", "0.6293141", "0.62752163", "0.626493...
0.0
-1
Strong parameters for security
def device_type_params params.require(:device_type).permit(:name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n ...
[ "0.7338929", "0.7112562", "0.7001379", "0.6909941", "0.6893166", "0.6778164", "0.6728982", "0.6712747", "0.66706747", "0.6638303", "0.6634234", "0.6623467", "0.6569364", "0.65660125", "0.6564164", "0.6562722", "0.6523633", "0.6519046", "0.65144724", "0.6503332", "0.6477931", ...
0.0
-1
Show list of collection_numbers.
def list_all store_location query = create_query(:CollectionNumber, :all) show_selected_collection_numbers(query) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_collection_numbers\n store_location\n query = create_query(:CollectionNumber, :all)\n show_selected_collection_numbers(query)\n end", "def index_collection_number\n query = find_or_create_query(:CollectionNumber, by: params[:by])\n show_selected_collection_numbers(query, id: params[:id]....
[ "0.8709816", "0.725367", "0.6710611", "0.6710611", "0.6710611", "0.66348636", "0.6567819", "0.6348846", "0.63161504", "0.62489945", "0.60139245", "0.59969974", "0.5952007", "0.5920297", "0.5878167", "0.5842691", "0.5839256", "0.58368087", "0.5832795", "0.57801336", "0.5780133...
0.77661663
1
Displays matrix of selected CollectionNumber's (based on current Query).
def index_query_results query = find_or_create_query(:CollectionNumber, by: params[:by]) show_selected_collection_numbers(query, id: params[:id].to_s, always_index: true) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_collection_numbers\n store_location\n query = create_query(:CollectionNumber, :all)\n show_selected_collection_numbers(query)\n end", "def index_collection_number\n query = find_or_create_query(:CollectionNumber, by: params[:by])\n show_selected_collection_numbers(query, id: params[:id]....
[ "0.6460874", "0.6278466", "0.62218153", "0.5944385", "0.5936518", "0.5780925", "0.5708219", "0.5704405", "0.56857836", "0.5667396", "0.56660587", "0.564561", "0.5595077", "0.55877006", "0.5586388", "0.5584422", "0.5560536", "0.55495554", "0.5546502", "0.5539534", "0.5539534",...
0.65627915
0
Display list of CollectionNumbers whose text matches a string pattern.
def pattern pat = params[:pattern].to_s if pat.match?(/^\d+$/) && (collection_number = CollectionNumber.safe_find(pat)) redirect_to(action: :show, id: collection_number.id) else query = create_query(:CollectionNumber, :pattern_search, pattern: pat) show_selected_collection_numbers(q...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collection_number_search\n pattern = params[:pattern].to_s\n if pattern.match(/^\\d+$/) &&\n (collection_number = CollectionNumber.safe_find(pattern))\n redirect_to(action: :show_collection_number, id: collection_number.id)\n else\n query = create_query(:CollectionNumber, :pattern_sear...
[ "0.5848781", "0.5657512", "0.5413631", "0.53491294", "0.5204944", "0.51298165", "0.5123133", "0.5089687", "0.50189894", "0.4970566", "0.49550745", "0.4914297", "0.48856968", "0.48846444", "0.48842603", "0.48827785", "0.48328122", "0.48108977", "0.47811553", "0.47797948", "0.4...
0.60422987
0
Display list of CollectionNumbers for an Observation
def observation_id @observation = Observation.find(params[:observation_id]) store_location query = create_query(:CollectionNumber, :for_observation, observation: params[:observation_id].to_s) show_selected_collection_numbers(query, always_index: true) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_collection_numbers\n store_location\n query = create_query(:CollectionNumber, :all)\n show_selected_collection_numbers(query)\n end", "def list_all\n store_location\n query = create_query(:CollectionNumber, :all)\n show_selected_collection_numbers(query)\n end", "def print_collecti...
[ "0.71890926", "0.66868156", "0.6572199", "0.6245091", "0.59159684", "0.5907214", "0.59010965", "0.58910835", "0.58870274", "0.5876983", "0.5837906", "0.57965636", "0.5788744", "0.5767374", "0.5767374", "0.5749112", "0.5738576", "0.57131433", "0.5692481", "0.56809205", "0.5608...
0.64593494
3
GET /entries GET /entries.json
def index @entries = current_user.entries.for_month(@date) @budgets = current_user.budgets end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @entries = Entry.desc(:created_at).page(params[:page] || 1).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end", "def index\n @entries = list_entries\n respond_with @entries\n end", "def index\n @entrie...
[ "0.7602954", "0.73572457", "0.73187", "0.7199528", "0.7181923", "0.7131827", "0.7064605", "0.70144105", "0.6977098", "0.6977098", "0.6977098", "0.6977098", "0.6977098", "0.6977098", "0.6909022", "0.68871284", "0.6821116", "0.681615", "0.6761819", "0.6759754", "0.67595285", ...
0.0
-1
GET /entries/1 GET /entries/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @entry = Entry.find(params[:id])\n\n render json: @entry\n end", "def index\n @entries = Entry.desc(:created_at).page(params[:page] || 1).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end", "def show\n ...
[ "0.73096466", "0.72406363", "0.71622026", "0.6988932", "0.6988932", "0.6988932", "0.6988932", "0.6988932", "0.6988932", "0.6988932", "0.6988932", "0.6988932", "0.6951171", "0.6930149", "0.68037343", "0.6788811", "0.67595065", "0.6744423", "0.66545874", "0.663944", "0.663944",...
0.0
-1
POST /entries POST /entries.json
def create @entry = current_user.entries.build(entry_params) respond_to do |format| if @entry.save format.html { redirect_to entries_path, notice: 'Entry was successfully created.' } format.json { render action: 'show', status: :created, location: @entry } else format.html {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @entry = Entry.new(entry_params)\n if @entry.valid?\n @entry.save\n render json: @entry, status: :created\n # , location: @entry\n else\n render json: @entry.errors, status: :unprocessable_entity\n end\n end", "def create_entries(opts = {})\n d...
[ "0.6758781", "0.6750437", "0.6650057", "0.6619877", "0.6605589", "0.65655607", "0.6554258", "0.6473777", "0.6473777", "0.6473777", "0.6459834", "0.64042604", "0.6378065", "0.63252205", "0.6319865", "0.63192296", "0.6319152", "0.6240254", "0.6161498", "0.61569434", "0.6156717"...
0.6269689
17
PATCH/PUT /entries/1 PATCH/PUT /entries/1.json
def update respond_to do |format| if @entry.update(entry_params) format.html { redirect_to entries_path, notice: 'Entry was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @entry.errors, statu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.json { render json: @entry, status: :created, location: @entry }\n else\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n en...
[ "0.70707685", "0.6925283", "0.66633534", "0.6620602", "0.6620602", "0.6620602", "0.66047883", "0.66002846", "0.66002846", "0.65777236", "0.6573984", "0.65706486", "0.6568783", "0.6543082", "0.65133905", "0.65022296", "0.65022296", "0.65022296", "0.6496996", "0.6496996", "0.64...
0.6643006
3
DELETE /entries/1 DELETE /entries/1.json
def destroy @entry.destroy respond_to do |format| format.html { redirect_to entries_url } format.json { head :no_content } format.js end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n debugger\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to entries_url }\n format.json { head :ok }\n end\n end", "def destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n...
[ "0.7634166", "0.7552098", "0.7552098", "0.75360084", "0.75360084", "0.75360084", "0.74967855", "0.749232", "0.74817103", "0.7432878", "0.7397135", "0.73723143", "0.73723143", "0.73176163", "0.73167855", "0.7302313", "0.7279891", "0.7257091", "0.7257091", "0.7257091", "0.72570...
0.7054363
43
Use callbacks to share common setup or constraints between actions.
def set_entry @entry = current_user.entries.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 entry_params if params[:entry][:budgets_list] budgets_list = params[:entry][:budgets_list].split(",") budgets = Budget.where(description: budgets_list) params[:entry][:budget_ids] = budgets.map(&:id) params[:entry].delete(:budgets_list) end params.require(:entry).permit! 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
GET /positions/1 GET /positions/1.json
def show @position = Position.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @position } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @positions = Position.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @positions }\n end\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @position }\n end\n end", ...
[ "0.7593512", "0.712281", "0.68048847", "0.6791091", "0.6781543", "0.6754654", "0.67389506", "0.6730504", "0.6699867", "0.6688384", "0.6616844", "0.65840214", "0.6576933", "0.65599394", "0.65412426", "0.64925224", "0.6491943", "0.64299923", "0.63483477", "0.634808", "0.6347972...
0.7194366
3
GET /positions/new GET /positions/new.json
def new @position = Position.new respond_to do |format| format.html # new.html.erb format.json { render json: @position } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @position_history = PositionHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @position_history }\n end\n end", "def new\n @user_position = UserPosition.new\n @positions = Position.all\n respond_to do |format|\n format.htm...
[ "0.7538665", "0.74924725", "0.7470396", "0.7412477", "0.73384833", "0.7199968", "0.7071142", "0.705314", "0.6981794", "0.6980522", "0.69738317", "0.6917425", "0.6897614", "0.6847984", "0.6847984", "0.6847905", "0.6805207", "0.669422", "0.667358", "0.6649709", "0.6637472", "...
0.804194
2
POST /positions POST /positions.json
def create begin @new_position = @@data_util.hash_data_to_upper_case(params[:position], ['description']) @new_position[:createdby] = session[:username] @new_position[:mypclient_id] = session[:client_id] @position = Position.new(@new_position) if @position.save @@request_result...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @position = Position.new(params[:position])\n respond_to do |format|\n if @position.save\n format.html { redirect_to @position, notice: 'Position was successfully created.' }\n format.json { render json: @position, status: :created, location: @position }\n else\n f...
[ "0.73199564", "0.731138", "0.7230476", "0.7229286", "0.7229286", "0.7099508", "0.7038487", "0.69394344", "0.69271314", "0.68641835", "0.68236244", "0.68215907", "0.6815353", "0.6792987", "0.66868937", "0.6645151", "0.6626778", "0.6612187", "0.6603228", "0.659924", "0.658245",...
0.7032043
7
PUT /positions/1 PUT /positions/1.json
def update begin @position = Position.find(params[:id]); @updated_position = @@data_util.hash_data_to_upper_case(params[:position], ['description']) @updated_position[:lastupdateby] = session[:username] if @position.update_attributes(@updated_position) @@request_result[:success] = t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n\n respond_to do |format|\n if @position.update_attributes(params[:position])\n format.html { redirect_to @position, notice: 'Position was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json ...
[ "0.7118767", "0.704742", "0.6983047", "0.6983047", "0.6983047", "0.6775917", "0.66971815", "0.6646472", "0.6638857", "0.65841967", "0.6576637", "0.65738064", "0.647592", "0.6439951", "0.64115715", "0.63652927", "0.6355299", "0.63496387", "0.6308718", "0.6268161", "0.6225891",...
0.64506227
13
DELETE /positions/1 DELETE /positions/1.json
def destroy begin @position = Position.find(params[:id]) if @position.destroy @@request_result[:success] = true @@request_result[:notice] = 'Operation ended successfully.' else @request_result[:errormsg] = @position.errors.full_messages[0] end rescue Exception => ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @position.destroy\n\n respond_to do |format|\n format.html { redirect_to positions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @position = Position.find(params[:id])\n @position.destroy\n\n respond_to do |format|\n format.html { redirect_t...
[ "0.7770895", "0.77123386", "0.76868826", "0.7456562", "0.74341714", "0.74341714", "0.74341714", "0.7403358", "0.73515475", "0.7341508", "0.7319502", "0.7243479", "0.7225972", "0.7150134", "0.7140941", "0.71384233", "0.71337557", "0.71032774", "0.708303", "0.7045375", "0.70441...
0.7046687
19
As per the README requirements. You have to use recursion in this problem You can create additional nested methods if you need to
def return_coins(remaining_coins,target_amount) # 1. loop through coins, if any one of it is == target_amount, return it. # 2. if coins < target_amount, minus the coin from target_amount and save it in a variable. return [] if remaining_coins.sum < target_amount return [1] if target_amount == 1 return [] if r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recursive => nil", "def nesting() end", "def recursive_solution\n\n end", "def traverse; end", "def nested(s)\n raise NotImplementedError, \"Method not implemented\"\nend", "def test_recursive_methods\n assert_equal 0, find_node(1).ancestors_r.size\n assert_equal 8, find_node(1).descendants_r...
[ "0.73503894", "0.7168131", "0.6890112", "0.632841", "0.6247091", "0.62019783", "0.6192174", "0.6192174", "0.6118991", "0.6016754", "0.60111946", "0.5985985", "0.5962587", "0.5941236", "0.59275126", "0.57394797", "0.5719942", "0.56547475", "0.5634221", "0.5609506", "0.5592766"...
0.0
-1
Create a new BawAudioTools::AudioBase.
def initialize(audio_defaults, logger, temp_dir, run_program, opts = {}) @audio_defaults = audio_defaults @logger = logger @temp_dir = temp_dir @run_program = run_program @audio_ffmpeg = opts[:ffmpeg] @audio_mp3splt = opts[:mp3splt] @audio_sox = opts[:sox] @audio_wavpack...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_audio audio_settings\n return Audio.new audio_settings\n end", "def new_audio_track(width, height)\n track = new_track(width, height)\n track.new_audio_media\n track\n end", "def new_audio_track(width, height)\n track = new_track(width, height)\n track.new_audio...
[ "0.6778456", "0.65677774", "0.65677774", "0.6265793", "0.6196069", "0.60892004", "0.6075483", "0.5968913", "0.59679174", "0.59092253", "0.5887835", "0.58506364", "0.5849685", "0.58415204", "0.5819057", "0.58058125", "0.57700884", "0.57344085", "0.57262766", "0.57253605", "0.5...
0.62160903
4
Construct path to a temp file with extension that does not exist.
def temp_file(extension) File.join(@temp_dir, ::SecureRandom.hex(7) + '.' + extension.trim('.', '')).to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def temp (extension)\n path = \"#{FileUtils::Config.tmp_dir}/tmp.#{extension}\"\n id = 1\n while File.exists?(path)\n path = \"#{FileUtils::Config.tmp_dir}/tmp.#{id}.#{extension}\"\n id += 1\n end\n\n path\n end", "def tempfile_extension\n # comp...
[ "0.7723973", "0.72646964", "0.7028215", "0.6992326", "0.6967713", "0.6915021", "0.6811299", "0.6806923", "0.6725388", "0.6708895", "0.667166", "0.66422343", "0.66182697", "0.6561769", "0.6484358", "0.6471776", "0.6468908", "0.6451267", "0.6446119", "0.64384913", "0.6431526", ...
0.7829178
0
Construct path to a temp file with full_name as the file name that does not exist.
def temp_file_from_name(file_name) File.join(@temp_dir, file_name).to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_temp_file\n copy_to_temp_file full_filename\n end", "def temporary_path(filename)\n Global.temporary_directory + filename\n end", "def temp_file_path(*args, &block)\n self.class.temp_file_path(prefix_suffix, *args, &block)\n end", "def temporary_path\n trimmed_name = nam...
[ "0.75720197", "0.7023003", "0.6865289", "0.66909486", "0.66581476", "0.66547036", "0.65833086", "0.6566178", "0.6504649", "0.64994055", "0.6492267", "0.649163", "0.6461044", "0.6440921", "0.64176106", "0.64049876", "0.63877046", "0.6385652", "0.63796854", "0.6374331", "0.6350...
0.7307635
1
Provides information about an audio file.
def info(source) source = check_source(source) if File.extname(source) == '.wac' info = info_wac2wav(source) else info = info_ffmpeg(source) clipping_check(source, info) end # calculate the bit rate in bits per second (bytes * 8 = bits) info[:bit_rate_bps_ca...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def audio_info(source)\n # based on how harvester gets file hash.\n generated_file_hash = \"SHA256::#{generate_hash(source).hexdigest}\"\n\n # integrity\n integrity_check = @audio.integrity_check(source)\n\n # get file info using ffmpeg\n info = @audio.info(source)\n\n {\n ...
[ "0.75431854", "0.7364134", "0.68641245", "0.67842424", "0.6729883", "0.6595376", "0.65025055", "0.6498787", "0.6466425", "0.64287066", "0.64111626", "0.64111626", "0.6406652", "0.63631135", "0.6338971", "0.63366765", "0.63311404", "0.6230935", "0.62218964", "0.6198347", "0.61...
0.58460975
45
Creates a new audio file from source path in target path, modified according to the parameters in modify_parameters. Possible options for modify_parameters: :start_offset :end_offset :channel :sample_rate
def modify(source, target, modify_parameters = {}) raise ArgumentError, "Source and Target are the same file: #{target}" if source == target source = check_source(source) raise Exceptions::FileAlreadyExistsError, "Target exists: #{target}" if File.exist? target raise Exceptions::InvalidTargetMed...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path_to_audio(source, options = T.unsafe(nil)); end", "def audio_tool_segment(extension, audio_tool_method, source, source_info, target, modify_parameters)\n # process the source file, put output to temp file\n temp_file = temp_file(extension)\n send(audio_tool_method, source, source_info, tem...
[ "0.63549167", "0.61836565", "0.5811438", "0.5608412", "0.5458947", "0.5405106", "0.5402392", "0.53946346", "0.53143394", "0.5266525", "0.5218351", "0.51692283", "0.5166357", "0.5156385", "0.5035007", "0.496975", "0.49628195", "0.49190572", "0.4903635", "0.49012995", "0.485654...
0.6792688
0
Checks whether the sample rate in modify_parameters is allowed
def check_sample_rate(target, modify_parameters = {}, source_info = {}) if modify_parameters.include?(:sample_rate) sample_rate = modify_parameters[:sample_rate].to_i # source_info sample_rate_hertz should match modify_parameters original_sample_rate if both are supplied if source_info.in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allow_sample?(sample)\n true\n end", "def fails_threshold?\n return false if sample_size < options.sample_threshold\n\n failure_rate >= options.rate_threshold\n end", "def check_for_rate_limits\n rate_limit_remaining < 10\n end", "def validate_parameters?(op)\n tem...
[ "0.62067306", "0.6008171", "0.5981752", "0.59645313", "0.58744526", "0.576425", "0.5729997", "0.56960785", "0.56941897", "0.5652338", "0.56425434", "0.5633678", "0.56084895", "0.5589596", "0.55861557", "0.5543356", "0.5520724", "0.55070496", "0.5491621", "0.54824764", "0.5464...
0.68153584
0
Check if a source exists, and is a file.
def check_source(path) raise Exceptions::FileNotFoundError, 'Source path was empty or nil' if path.nil? || (path.is_a?(String) && path.empty?) path = Pathname(path) # Maybe worth resolving symlinks to a realpath, but currently does not cause any failures without #path = File.realpath(File.readl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_exists?(file_path)\n File.exist? @site.in_source_dir(file_path)\n end", "def exists?\n File.exist? @src_path\n end", "def check_source_type(source)\n if File.file?(source)\n source_file = IO.readlines(source)\n else\n source_file = source\n end\n source_file\n en...
[ "0.7474867", "0.7455881", "0.73092073", "0.73027885", "0.7250587", "0.72069764", "0.7171997", "0.7150021", "0.6964303", "0.69612825", "0.6950359", "0.68988395", "0.6877554", "0.68544286", "0.6844462", "0.6843495", "0.68343794", "0.68332815", "0.68199444", "0.6801547", "0.6781...
0.7546252
0
def modify_shntool(source, source_info, target, start_offset, end_offset)
def audio_tool_segment(extension, audio_tool_method, source, source_info, target, modify_parameters) # process the source file, put output to temp file temp_file = temp_file(extension) send(audio_tool_method, source, source_info, temp_file, modify_parameters[:start_offset], modify_parameters[:end_offs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chkout_modify_existing_address\n $tracer.trace(__method__)\n #unit_test_no_generate: chkout_modify_existing_address, a.id(\"change_address\")\n return ToolTag.new(a.id(\"change_address\"), __method__, self)\n end", "def update!(**args)\n @source_node = args[:source_node] if args.key?(:sour...
[ "0.52917683", "0.52743775", "0.5214667", "0.51696545", "0.5155201", "0.5088498", "0.5083458", "0.5066339", "0.50416267", "0.5014668", "0.50116616", "0.5011375", "0.4979833", "0.4968546", "0.4968546", "0.4968546", "0.49678618", "0.49620098", "0.49410185", "0.49351603", "0.4920...
0.622731
0
a new card: suit and rank are required parameters
def initialize(suit, rank) unless SUITS.include?(suit) and RANKS.include?(rank) raise ArgumentError end @suit = suit @rank = rank end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_card(name, suit, rank)\r\n card = Card.new(name, suit, rank)\r\n @cards << card\r\n @order << card.to_s\r\n end", "def add_card(rank)\n @cards << Card.new(rank)\n end", "def initialize(rank, suit)\r\n self.rank = rank\r\n self.suit = suit\r\n end", "def initialize(rank, suit)\n ...
[ "0.8098122", "0.77467746", "0.76556325", "0.76409835", "0.7640719", "0.76253057", "0.757423", "0.73419344", "0.7314283", "0.72895724", "0.7245532", "0.72296983", "0.72163504", "0.72054", "0.70843655", "0.7059946", "0.70542634", "0.7003919", "0.694248", "0.6937502", "0.6934662...
0.66614896
42
string representation of card eg. a card with rank J and suit h would be "Jh"
def to_s [self.rank,self.suit].join end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n # A simple template with X's as placeholders\n # YY represents the placement of the card's rank\n template = <<-TPL.gsub(/^\\s+/,'')\n ╭───────╮\n | X X X |\n | X X X |\n | X YYX |\n | X X X |\n ╰───────╯\n TPL\n\n # the patterns represe...
[ "0.80240715", "0.7964864", "0.7739034", "0.7700982", "0.7675775", "0.76404184", "0.76404184", "0.75830734", "0.752638", "0.75166965", "0.75070655", "0.750421", "0.7501069", "0.75008523", "0.7389322", "0.73800415", "0.7313228", "0.7303994", "0.7289263", "0.728865", "0.7279812"...
0.74002016
14
Returns the data stored as a string
def to_s str_p = Binding.mongocrypt_binary_data(ref) len = Binding.mongocrypt_binary_len(ref) str_p.read_string(len) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n data\n end", "def to_s\n @data\n end", "def to_s\n return @data.to_s\n end", "def to_s\n data.to_s\n end", "def data_string\n Data.serialize(data)\n end", "def to_data\n to_s\n end", "def get_data_as_text()\n get_data_as_array().join(\", \")\n...
[ "0.82219756", "0.8220837", "0.81705946", "0.8149808", "0.8146244", "0.79581624", "0.78891695", "0.776028", "0.7578374", "0.7462027", "0.7431579", "0.73716396", "0.7363498", "0.72838795", "0.72606516", "0.72589684", "0.7252103", "0.72260493", "0.7136835", "0.71054095", "0.7066...
0.0
-1
Returns the reference to the underlying mongocrypt_binary_t object
def ref @bin end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n str_p = Binding.mongocrypt_binary_data(ref)\n len = Binding.mongocrypt_binary_len(ref)\n str_p.read_string(len)\n end", "def mongo_operation\n binary = Binary.new\n success = Binding.mongocrypt_ctx_mongo_op(@ctx, binary.ref)\n raise_from_status unless suc...
[ "0.72341144", "0.698139", "0.6658076", "0.6254893", "0.6168177", "0.604785", "0.60265195", "0.5937716", "0.5893569", "0.5809671", "0.5776652", "0.5776588", "0.5776588", "0.5776588", "0.5770899", "0.57700884", "0.5748784", "0.5748084", "0.5748084", "0.5748084", "0.5748084", ...
0.6601262
3
GET /categories/1 GET /categories/1.json
def show @category = Category.find(params[:id]) @subcategory = Category.new(:category_id => @category.id) respond_to do |format| format.html # show.html.erb format.json { render json: @category } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetCategories params = {}\n\n params = params.merge(path: 'categories.json')\n APICall(params)\n\n end", "def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end", "def GetCategory id\n\n ...
[ "0.7877691", "0.7865133", "0.78486437", "0.78422695", "0.7414923", "0.74083245", "0.73075056", "0.7306919", "0.7306919", "0.7282217", "0.7235693", "0.7186931", "0.7158298", "0.7133119", "0.7122198", "0.70659566", "0.70442134", "0.7036961", "0.70349413", "0.70324004", "0.70126...
0.0
-1
GET /categories/new GET /categories/new.json
def new @category = Category.new respond_to do |format| format.html # new.html.erb format.json { render json: @category } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @category = Category.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end", "def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category}\n...
[ "0.79390717", "0.7896847", "0.78593403", "0.77577215", "0.77108335", "0.77108335", "0.75833476", "0.7492212", "0.74630326", "0.74126434", "0.7397335", "0.7341672", "0.7341308", "0.73402065", "0.7337215", "0.7311533", "0.7289989", "0.7277701", "0.7267791", "0.7267406", "0.7260...
0.79364836
9
POST /categories POST /categories.json
def create @category = Category.new(params[:category]) respond_to do |format| if @category.save format.html { redirect_to Category.find(@category.category_id), notice: 'Category was successfully created.' } format.json { render json: @category, status: :created, location: @category } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CreateCategory params = {}\n \n APICall(path: 'categories.json',method: 'POST',payload: params.to_json)\n \n end", "def create\n json_create(category_params, Category)\n end", "def create_category payload\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.post CATE...
[ "0.7737917", "0.7434076", "0.723503", "0.7162482", "0.7123496", "0.7064267", "0.7051976", "0.6958003", "0.695681", "0.6903936", "0.68353516", "0.68210334", "0.6819175", "0.68084145", "0.6785145", "0.6614025", "0.65657556", "0.6565209", "0.6553536", "0.6522781", "0.6518589", ...
0.6379035
51
PUT /categories/1 PUT /categories/1.json
def update @category = Category.find(params[:id]) respond_to do |format| if @category.update_attributes(params[:category]) format.html { redirect_to @category, notice: 'Category was successfully updated.' } format.json { head :no_content } else format.html { render action: "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def UpdateCategory params = {}\n \n APICall(path: 'categories.json',method: 'PUT',payload: params.to_json)\n \n end", "def update_categories(categories, options = {} )\n options.merge!(:docid => self.docid, :categories => categories)\n resp = @conn.put do |req|\n ...
[ "0.7727539", "0.7493539", "0.7321486", "0.7017345", "0.6880331", "0.6794871", "0.6685988", "0.6667006", "0.66365516", "0.6620356", "0.6590883", "0.65760607", "0.65094024", "0.65084934", "0.6473978", "0.6473307", "0.6446729", "0.64275867", "0.64156556", "0.6381242", "0.6354989...
0.62340415
37
DELETE /categories/1 DELETE /categories/1.json
def destroy @category = Category.find(params[:id]) @category.destroy respond_to do |format| format.html { redirect_to categories_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DeleteCategory id\n \n APICall(path: \"categories/#{id}.json\",method: 'DELETE')\n \n end", "def destroy\n @category.destroy\n render json: @category, status: :ok\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |f...
[ "0.78272814", "0.77353686", "0.76392984", "0.7488916", "0.74731207", "0.74233276", "0.7399541", "0.7378597", "0.7378597", "0.7378597", "0.7372517", "0.7366761", "0.7362291", "0.7334964", "0.7334964", "0.7333799", "0.73254865", "0.7318471", "0.7294363", "0.728636", "0.7283016"...
0.7385346
18
Build a URI to the given controller and action, or path
def url_to(*args, **options) first_arg = args.first path = if first_arg.is_a?(String) || first_arg.is_a?(Flame::Path) find_static(first_arg).path(with_version: options[:version]) else path_to(*args, **options) end Addressable::URI.new( scheme: request.scheme, host: request.ho...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_url(action)\n \"#{@base_url}#{action}\"\n end", "def build_uri_path(path, params)\n path + handle_params(params)\n end", "def generate_action_url(main_controller, action_name)\n get main_controller + '/' + action_name, to: main_controller + '#' + action_name\n end", "def bui...
[ "0.69978327", "0.6939232", "0.68848497", "0.68000454", "0.6749961", "0.6728699", "0.67119837", "0.6677435", "0.6649291", "0.6635944", "0.6635944", "0.6635944", "0.6561068", "0.65567994", "0.65369433", "0.64870507", "0.6392029", "0.6358618", "0.63531584", "0.63531584", "0.6353...
0.0
-1
Path to previous page, or to index action, or to Index controller
def path_to_back back_path = request.referer return back_path if back_path && back_path != request.url return path_to :index if self.class.actions.include?(:index) '/' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def previous_page_path; end", "def path_to_back\n\t\t\t\tback_path = request.referer\n\t\t\t\treturn back_path if back_path && back_path != request.url\n\n\t\t\t\treturn path_to :index if self.class.actions.include?(:index)\n\n\t\t\t\t'/'\n\t\t\tend", "def prev_page_url\n if @page <= 2\n request.pa...
[ "0.8396007", "0.78929114", "0.74985653", "0.7494035", "0.7492207", "0.74730873", "0.74366516", "0.7378883", "0.73510414", "0.7319236", "0.72107565", "0.71732014", "0.71463734", "0.7113441", "0.70962596", "0.70771265", "0.70750827", "0.70405304", "0.6981507", "0.69141686", "0....
0.7918677
1
reads in each line. you need to change the following code so that it uses a loop which repeats acccording to the number of lines in the File which is given in the first line of the File
def read_data_from_file(aFile) count = aFile.gets.to_i puts count.to_s puts aFile.gets puts aFile.gets puts aFile.gets puts aFile.gets puts aFile.gets end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readlines(filename, start_pos, num_lines, client)\n arr = IO.readlines(\"File1.txt\")\n for i in 0..num_lines-1\n client.puts arr[i]\n end\nend", "def read_file filename\n\t\tbegin\t \n\t\t\tfile = File.new(filename, \"r\")\n\t\t\tline_number = 1\n\t\t file.each do |line|\t\t \t\n\t\t \tself....
[ "0.73721814", "0.72713983", "0.7238438", "0.6959442", "0.6797974", "0.676735", "0.6710691", "0.66931725", "0.6662895", "0.6646428", "0.6597146", "0.65894", "0.6582316", "0.6577988", "0.6577627", "0.6564412", "0.6533516", "0.6529329", "0.64940244", "0.64821", "0.6457761", "0...
0.6336712
36
writes data to a file then reads it in and prints each line as it reads. you should improve the modular decomposition of the following by moving as many lines of code out of main as possible.
def main aFile = File.new("mydata.txt", "w") # open for writing if aFile # if nil this test will be false write_data_to_file(aFile) aFile.close else puts "Unable to open file to write!" end aFile = File.new("mydata.txt", "r") # open for reading if aFile # if nil this test will be false re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def self_writing_programme\nFile.open(\"ex14.8.rb\", \"r\") do |file|\nfile.readlines.each do |line|\n puts line\nend\nfile.close\nend\nend", "def print_charmander\n puts \"\\nHere's your dragon! Meet #{@name}!\"\n File.open(\"charmander.txt\").each do |line|\n puts line\n end\n end", "def prin...
[ "0.6618466", "0.63374406", "0.63036454", "0.6271478", "0.62029684", "0.61719257", "0.6166036", "0.61087185", "0.60899085", "0.608665", "0.6034187", "0.60179764", "0.6015649", "0.6013838", "0.5996718", "0.59782714", "0.5923677", "0.5918045", "0.5915289", "0.5914874", "0.590829...
0.6041222
10
Retrive all employees based on manager selected by user else return all employees
def retrive_employees_by_manager @employees = if params[:manager_id].present? Employee.includes(:department) .where(manager_id: params[:manager_id]) else Employee.includes(:department).all end render :partial => "employees", :object => @employees end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def employees\n Employee.all.select do |employee|\n employee.manager == self\n \n end\n end", "def employees\n Employee.all.select {|employees| employees.manager_name == self.name} \n end", "def get_employees\n @employees = User.find_user_not_admin_not_clie...
[ "0.78427786", "0.78260714", "0.75586903", "0.74063313", "0.7255956", "0.72491515", "0.7126111", "0.7019017", "0.6983216", "0.6963566", "0.665538", "0.66361827", "0.6559177", "0.64916515", "0.64246845", "0.6418633", "0.64060646", "0.639795", "0.63680285", "0.63410413", "0.6340...
0.7777377
2
Returns the current version of the gem
def version VERSION end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_version\n version_number rev\n end", "def current_version\n versions.first\n end", "def gem_version\n Gem::Version.new VERSION\n end", "def gem_version\n ::Gem::Version.new(VERSION::STRING)\n end", "def current_version\n @version\n end", "def gem_version; end",...
[ "0.80497944", "0.7998986", "0.7965918", "0.7888595", "0.7863314", "0.7809014", "0.7809014", "0.7809014", "0.7809014", "0.7809014", "0.7809014", "0.7787214", "0.7599788", "0.74796724", "0.7460657", "0.74506485", "0.7446108", "0.7314792", "0.7285918", "0.7285918", "0.72780895",...
0.7092645
35
test klass primary key is integer type. (rails default)
def integer? primary_key_attribute = klass.attribute_types.select { |name, _| name == User.primary_key } if primary_key_attribute.key?(klass.primary_key.to_s) primary_key_attribute[klass.primary_key].type == :integer else true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def primary_key_type\n \"integer PRIMARY KEY\"\n end", "def primary_key\n fail NotImplementedError\n end", "def primary_key\n 'id'\n end", "def force_primary_key(klass)\n # Automatically add an :oid serializable field if none is\n # defined and no other primary key i...
[ "0.76787144", "0.68917054", "0.679383", "0.67665434", "0.666983", "0.6607317", "0.6603807", "0.6603807", "0.6603807", "0.6598008", "0.6598008", "0.65802985", "0.65460473", "0.652815", "0.6498675", "0.6492707", "0.64908653", "0.64521515", "0.64521515", "0.6449204", "0.6449204"...
0.714294
1
Set default status as pending
def default_status self.status = "Pending" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_status_to_pending\n self.status = :pending\n end", "def default\n self.status = \"In Progress\"\n end", "def pending!\n self.update_attribute(:status, PENDING)\n end", "def initialize_defaults\n self.status = :pending if status.blank?\n end", "def set_default_status\n\t self.status...
[ "0.890664", "0.8050014", "0.7994992", "0.7979822", "0.79019517", "0.78914595", "0.7706385", "0.76559746", "0.76514643", "0.7581495", "0.75709903", "0.75398946", "0.7242596", "0.7174101", "0.7170677", "0.7158488", "0.7154491", "0.7086234", "0.7023466", "0.70218104", "0.6975077...
0.8806933
1
Connect Overrides the connect method of MQTT::Client because the parent method leaves a connected = true after a fail connect. After a fail connect, the method connected? should return false instead of true
def connect begin super rescue Exception => ex disconnect() #TODO RAE: This behaviour works when the problem is not due to SSL. Try to fix it for SSL raise ex end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect?\n connect != false\n end", "def _connect\n return if @ssl_connected\n\n Error.translate do\n @plaintext_connected ||= super\n return if !@plaintext_connected\n\n # Mark the connection as not connected due to the pending SSL handshake.\n ...
[ "0.7244196", "0.71166086", "0.69941926", "0.6991012", "0.69831383", "0.6974406", "0.6961204", "0.6944528", "0.6671587", "0.6488008", "0.64638275", "0.6460402", "0.6450618", "0.6450344", "0.643009", "0.6427414", "0.64249945", "0.6358427", "0.6354749", "0.6353111", "0.6337795",...
0.60826457
72
Function to receive message from the subscribed topics. It runs as a forever / infinite loop if it is called with a block. If not, it waits until a message is received and is returned to a the caller If the method is called with a block, it is necessary to create a thread in order to doesn't block the program
def receive_messages_from_subscribed_topics if block_given? #@client.get do |topic, message| get do |topic, message| yield(topic, message) end else #topic, message = @client.get topic, message = get return topic, message end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def receive\n raise \"No subscription to receive messages from\" if (@queue_names.nil? || @queue_names.empty?)\n start = @current_queue\n while true\n @current_queue = ((@current_queue < @queue_names.length-1) ? @current_queue + 1 : 0)\n sleep(@connection_options[:p...
[ "0.7251551", "0.6592485", "0.6493758", "0.6424927", "0.639926", "0.632175", "0.6299793", "0.6256381", "0.62466335", "0.62413186", "0.6212829", "0.6198958", "0.6191155", "0.61463976", "0.6142906", "0.61381257", "0.61087674", "0.6067296", "0.6037293", "0.59880596", "0.5987578",...
0.73206955
0
returns a hash mapping each letter to its frequency. Ignores spaces.
def letter_count(str) characters = str.downcase.split("") hashes = {} characters.each do |character| if character >= "a" && character <= "z" hashes[character] = hashes[character] ? hashes[character] + 1 : 1 end end hashes end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def letter_frequency(text)\n\n #create blank hash\n character_hash = Hash.new\n character_hash.default = 0\n\n #delete other characters\n text.delete! \"^a-zA-Z\"\n\n #all lower case\n text = text.downcase\n\n #turn string into array\n text_array = text.chars\n\n #move each letter to hash with number of times it a...
[ "0.81773925", "0.8174003", "0.8150549", "0.8140974", "0.79549783", "0.7947882", "0.79057926", "0.79050934", "0.7900479", "0.78898424", "0.78745294", "0.77745384", "0.7756753", "0.77235913", "0.77121013", "0.76693", "0.7589138", "0.75672156", "0.75212383", "0.7519055", "0.7507...
0.7124798
49
GET /file_packages GET /file_packages.json
def index @file_packages = FilePackage.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_packages!(path)\n response = Api::Request.new do |request|\n request[:sign] = false\n request[:method] = :GET\n request[:path] = \"/shared/packages/#{path}\"\n end.execute!\n\n Object::File.open(path, 'wb') do |file|\n file.write(response)\n end\n\n path...
[ "0.73114324", "0.64447147", "0.64288986", "0.63484", "0.62861204", "0.6280573", "0.6236852", "0.6086987", "0.6086987", "0.6040913", "0.5989775", "0.5923256", "0.5922453", "0.59156895", "0.5913825", "0.5902505", "0.58908415", "0.58670866", "0.57833606", "0.57811475", "0.578013...
0.6837831
1
GET /file_packages/1 GET /file_packages/1.json
def show @file_update_from_file_package = [] @file_to_update_file_package = FileToUpdateFilePackage.where(file_package_id: @file_package.id) @file_to_update_file_package.each do |file_update_file_package| @file_update_from_file_package << file_update_file_package.file_to_update.name end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_packages!(path)\n response = Api::Request.new do |request|\n request[:sign] = false\n request[:method] = :GET\n request[:path] = \"/shared/packages/#{path}\"\n end.execute!\n\n Object::File.open(path, 'wb') do |file|\n file.write(response)\n end\n\n path...
[ "0.714195", "0.664724", "0.6330739", "0.6233689", "0.6174696", "0.6133381", "0.61062133", "0.6097193", "0.6097193", "0.6062817", "0.5977175", "0.5962146", "0.5961289", "0.5951282", "0.5924799", "0.58845496", "0.5825882", "0.58232003", "0.58101934", "0.5791901", "0.57774466", ...
0.0
-1
POST /file_packages POST /file_packages.json
def create @file_package = FilePackage.new(file_package_params) respond_to do |format| if @file_package.save @file_to_update_file_package = FileToUpdateFilePackage.new(file_package_id: @file_package.id) @file_to_update_file_package.save format.html { redirect_to @file_package, noti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_packages(packages)\n test_payload.set(:packages, packages)\n end", "def packagecloud_upload package,\n distro_id = 27,\n user = 'haf',\n repo = 'oss',\n key = ENV['PACKAGECLOUD_KEY']\n puts \...
[ "0.6786094", "0.62506926", "0.6163176", "0.6099638", "0.59885037", "0.59805864", "0.59513044", "0.5906778", "0.58689", "0.58340734", "0.58201575", "0.5773152", "0.5766117", "0.57558376", "0.5709619", "0.5699143", "0.5694698", "0.56922674", "0.5692162", "0.56901115", "0.568477...
0.6455574
1
PATCH/PUT /file_packages/1 PATCH/PUT /file_packages/1.json
def update respond_to do |format| if @file_package.update(file_package_params) format.html { redirect_to @file_package, notice: 'File package was successfully updated.' } format.json { render :show, status: :ok, location: @file_package } else format.html { render :edit } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_datapackage\n update_file_in_repo(\"datapackage.json\", create_json_datapackage)\n end", "def update\n respond_to do |format|\n add_items\n if @package.update(package_params)\n format.html { redirect_to @package, notice: 'Package was successfully updated.' }\n format.jso...
[ "0.63892555", "0.6339916", "0.6239994", "0.6233896", "0.6231027", "0.62206364", "0.61833817", "0.6156983", "0.6148451", "0.61322045", "0.61322045", "0.61126095", "0.6042367", "0.6004983", "0.60048884", "0.59921646", "0.59844124", "0.5968783", "0.5929757", "0.5925468", "0.5909...
0.6755643
0
DELETE /file_packages/1 DELETE /file_packages/1.json
def destroy @file_package.destroy respond_to do |format| format.html { redirect_to file_packages_url, notice: 'File package was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def b2_delete_file(file)\n\n if parse_files_json(file) == {}\n\n puts \"File not present\"\n\n else\n \n result_hash = convert_json(b2_delete_file_version(file))\n\n if result_hash[\"fileName\"] == file\n puts \"File deleted successfully\"\n else\n puts \"Error deleting...
[ "0.69046885", "0.6738402", "0.66752", "0.66527313", "0.66178745", "0.6597381", "0.6581092", "0.6562684", "0.65601075", "0.65591127", "0.65501684", "0.65306365", "0.6494288", "0.64899415", "0.64265627", "0.64265627", "0.6426315", "0.6425916", "0.64174116", "0.64077395", "0.638...
0.71358496
0
Use callbacks to share common setup or constraints between actions.
def set_file_package @file_package = FilePackage.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 file_package_params params.require(:file_package).permit(:name, :file_to_update_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.6981273", "0.6783789", "0.67460483", "0.6742222", "0.67354137", "0.65934366", "0.65028495", "0.6497783", "0.64826745", "0.6479415", "0.6456823", "0.6440081", "0.63800216", "0.6376521", "0.636652", "0.6319898", "0.6300256", "0.62994003", "0.6293621", "0.6292629", "0.6291586...
0.0
-1
generates the basic reader methods
def build( sym, val ) #puts "build: #{sym} - value: #{val}" val = "\"#{val}\"" if val.is_a? String class_eval(<<-EOS, __FILE__, __LINE__) unless defined? @#{sym} @#{sym} = #{val} end def self.#{sym} return @#{sym} if defined? @#{sym} superclass.#{sym} end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reader; end", "def reader=(_arg0); end", "def custom_reader(key); end", "def read\nend", "def read(*args, **kwd); end", "def read\n \n end", "def read(*args)\n #This is a stub, used for indexing\n end", "def make_readers!(fields, prefix = '_')\n fields.each do |key,field|\n ...
[ "0.7675222", "0.69556165", "0.6747992", "0.6647998", "0.6629214", "0.66045815", "0.6584714", "0.653543", "0.6522312", "0.6522312", "0.6522312", "0.6522312", "0.6522312", "0.6522312", "0.6522312", "0.64928067", "0.64928067", "0.64928067", "0.64928067", "0.6356629", "0.6351259"...
0.0
-1
generates the boolean 'foo?' methods
def build_boolean( sym, val ) #puts "build: #{sym} - value: #{val}" class_eval(<<-EOS, __FILE__, __LINE__) def self.#{sym}? return #{sym} == true end def #{sym}? self.class.#{sym}? end EOS end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def true \n \"true\" \n end", "def falsx\n false\nend", "def conditionally(*) end", "def conditionally(*) end", "def boolify(val)\n\nend", "def simple?\n true\n end", "def tagMethod?()\r\n\t\tlang = language()\r\n\t\treturn (@type == \"m\" || @type==\"f\") if (lang == \"java\")\r\n\t\tret...
[ "0.60532326", "0.6000471", "0.5960196", "0.5960196", "0.58647543", "0.5859049", "0.5848478", "0.5755302", "0.5749205", "0.5701487", "0.5692267", "0.566558", "0.56288135", "0.56187224", "0.56146973", "0.55862695", "0.55812305", "0.5574115", "0.5568373", "0.5568373", "0.5564456...
0.6285749
0
for backwards compatibility Use this in the console to get a list of font families
def family_list UIFont.familyNames.sort end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def family\n @family ||= family_options.map do |font_name, font_options|\n name = parse_font_name(font_name)\n\n options = font_options.sort.uniq\n\n options.any? ? \"#{name}:#{options.join(',')}\" : name\n end.join('|')\n end", "def fonts_list\n initiate_librar...
[ "0.7721103", "0.7646381", "0.7248035", "0.71208197", "0.7064267", "0.6859368", "0.6822804", "0.673041", "0.6493086", "0.64282936", "0.6418485", "0.63727885", "0.6327979", "0.63167113", "0.6265677", "0.60898954", "0.60611916", "0.60364574", "0.58241457", "0.5792614", "0.575720...
0.82194227
0
GET /option_types GET /option_types.json
def index @option_types = OptionType.page params[:page] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def types\n @opt_types.values\n end", "def describe_types\n [@options[:type]].flatten.join('/')\n end", "def court_types\n render json: GamePass.court_types_options\n end", "def index\n @optypes = Optype.all\n end", "def get_lesson_types\n get \"lessonTypes.json\"\n end", ...
[ "0.70611906", "0.70465845", "0.6788348", "0.67116636", "0.66859025", "0.6656508", "0.6474384", "0.64456856", "0.6423282", "0.64086634", "0.6407335", "0.6383134", "0.63299173", "0.63120115", "0.62849593", "0.6253483", "0.6245198", "0.6232169", "0.61800855", "0.6131065", "0.613...
0.70203376
2
GET /option_types/1 GET /option_types/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @option_types = OptionType.page params[:page]\n end", "def index\n @optypes = Optype.all\n end", "def type\n @option[:type].is_a?(Hash) ? @option[:type][:value] : @option[:type]\n end", "def describe_types\n [@options[:type]].flatten.join('/')\n end", "def court_...
[ "0.68087333", "0.6658529", "0.65865517", "0.6473731", "0.64127207", "0.6407826", "0.63785017", "0.62827146", "0.6266577", "0.62020695", "0.61681694", "0.6155296", "0.6143955", "0.613836", "0.6123266", "0.61230767", "0.61189157", "0.60929465", "0.60816354", "0.6065854", "0.604...
0.0
-1
POST /option_types POST /option_types.json
def create @option_type = OptionType.new(option_type_params) respond_to do |format| if @option_type.save format.html { redirect_to [:admin, @option_type], notice: 'Option type was successfully created.' } format.json { render action: 'show', status: :created, location: @option_type } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_option_types\n option_types = @@config[:option_types]\n puts \"Creating Option Types for UrbanAuto site, #{option_types.length} options found to check.\\n\"\n created = 0\n option_types.each_key do |ot|\n if OptionType.find(:first, :conditions => {:name => option_types[ot][:name]}).nil?...
[ "0.6694878", "0.66294116", "0.6534157", "0.62232006", "0.6173155", "0.61378956", "0.6127454", "0.607952", "0.6058712", "0.5991843", "0.5991843", "0.59368944", "0.59368944", "0.59297866", "0.59175724", "0.59112155", "0.5828599", "0.58009946", "0.57940865", "0.57836926", "0.575...
0.663311
1
PATCH/PUT /option_types/1 PATCH/PUT /option_types/1.json
def update respond_to do |format| if @option_type.update(option_type_params) format.html { redirect_to [:admin, @option_type], notice: 'Option type was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { rende...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @optype.update(optype_params)\n format.html { redirect_to @optype, notice: 'Optype was successfully updated.' }\n format.json { render :show, status: :ok, location: @optype }\n else\n format.html { render :edit }\n format.json { rend...
[ "0.6749418", "0.63348275", "0.63348275", "0.63348275", "0.6260202", "0.6237212", "0.6231222", "0.621957", "0.6216383", "0.6207389", "0.62027186", "0.6186684", "0.6106428", "0.60838056", "0.6075666", "0.6061587", "0.6027473", "0.6026208", "0.6026208", "0.60025847", "0.6002207"...
0.7359586
0
DELETE /option_types/1 DELETE /option_types/1.json
def destroy @option_type.destroy respond_to do |format| format.html { redirect_to admin_option_types_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @optype.destroy\n respond_to do |format|\n format.html { redirect_to optypes_url, notice: 'Optype was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_option\n option_param = params.permit(:id)\n\n render json: Option.delete_o...
[ "0.72555155", "0.7196702", "0.7014768", "0.7014768", "0.6964335", "0.6908677", "0.6908677", "0.6908677", "0.6885596", "0.6869575", "0.680564", "0.6805429", "0.67807734", "0.67804116", "0.67163396", "0.670153", "0.66600055", "0.6659483", "0.665136", "0.66480714", "0.6645412", ...
0.78709364
0
Use callbacks to share common setup or constraints between actions.
def set_option_type @option_type = OptionType.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 option_type_params params.require(:option_type).permit(:name, :presentation, :position, option_values_attributes: [:id, :name, :presentation, :_destroy]) 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.6980957", "0.6783065", "0.6747844", "0.6741468", "0.67356336", "0.6592548", "0.65036845", "0.64978707", "0.64825076", "0.64795035", "0.64560914", "0.64397955", "0.6379666", "0.6376688", "0.6366702", "0.6319728", "0.6300833", "0.6300629", "0.6294277", "0.6293905", "0.629117...
0.0
-1
to_s is similar to toString
def to_s "(#@name, #@age)" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end"...
[ "0.90085024", "0.90085024", "0.90085024", "0.90085024", "0.90085024", "0.90085024", "0.90085024", "0.90085024", "0.90085024", "0.90085024", "0.90085024", "0.90085024", "0.90085024", "0.90085024", "0.90085024", "0.90085024", "0.90085024", "0.90085024", "0.89745724", "0.89745724"...
0.0
-1
It should be possible to change the properties of a file and see stat return a different result
def test_stat_modifications @client.write(@file, '') [0745, 0600, 0443].each do |mode| @client.chmod(@file, mode) assert_equal mode, @client.stat(@file, refresh: true).mode end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stat() File.stat(path) end", "def stat\n return @stat unless @stat == :needs_stat\n\n method = :stat\n\n # Files are the only types that support links\n if (self.class.name == :file and self[:links] != :follow) or self.class.name == :tidy\n method = :lstat\n end\n\n @stat = begin\n ...
[ "0.74513924", "0.6966966", "0.6775694", "0.67714196", "0.6768781", "0.6612547", "0.6565932", "0.6506559", "0.64949596", "0.64121807", "0.6396997", "0.6312671", "0.6304778", "0.6215063", "0.6145141", "0.61272573", "0.6084672", "0.60452396", "0.59958494", "0.59853745", "0.59707...
0.7341335
1
GET /venues GET /venues.json
def index # authorize! :index, @user, :message => 'Not authorized as an administrator.' # @venues = Venue.all @venues = RawEvent.where(:submitted => nil, :deleted => nil).collect { |raw_event| raw_event.raw_venue ? raw_event.raw_venue.venue : nil }.compact @num_raw_events = Hash.new(0) @venues....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def venues(options = {})\n self.class.require_latitude_and_longitude(options)\n\n response = self.class.get(\"/venues.json\", :query => options, :basic_auth => @auth)[\"venues\"]\n response && response.flatten\n end", "def index\n @venues = current_user.venues\n end", "def index\n @venues = Ve...
[ "0.78412294", "0.75436866", "0.7476105", "0.7476105", "0.74669623", "0.7434513", "0.72530305", "0.7251006", "0.7022262", "0.6940428", "0.6893959", "0.6828712", "0.68162227", "0.67744845", "0.6768917", "0.6753593", "0.6683326", "0.66703904", "0.6664218", "0.6654483", "0.664117...
0.6862872
11
GET /venues/1 GET /venues/1.json
def show @venue = Venue.find(params[:id]) puts "venue_id " puts params[:id] @venue.clicks += 1 @venue.save @jsonOccs = [] @jsonRecs = [] @occurrences = @venue.events.collect { |event| event.occurrences.select { |occ| occ.start >= DateTime.now } }.flatten.sort_by { |occ| occ.start } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def venue(id)\n get(\"venues/#{id}\").venue\n end", "def index\n @venues = Venue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @venues }\n end\n end", "def index\n @venues = Venue.all\n\n respond_to do |format|\n format.htm...
[ "0.7447727", "0.7320159", "0.7320159", "0.73036766", "0.7182737", "0.7142532", "0.71293336", "0.7121276", "0.7087837", "0.6954922", "0.6936978", "0.69144917", "0.6851897", "0.67881936", "0.6668611", "0.65478027", "0.6529226", "0.6525174", "0.651809", "0.6516533", "0.6466204",...
0.0
-1
GET /venues/new GET /venues/new.json
def new @venue = Venue.new respond_to do |format| format.html # new.html.erb format.json { render json: @venue } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @venue = Venue.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @venue }\n end\n end", "def new\n @manage_venue = Venue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manage_ven...
[ "0.7627676", "0.73516995", "0.7290851", "0.7247363", "0.7218171", "0.7218171", "0.72123617", "0.71841794", "0.71841794", "0.71841794", "0.71235377", "0.71199805", "0.71199805", "0.7084033", "0.7080062", "0.7052279", "0.70303845", "0.70043486", "0.6995956", "0.6989294", "0.698...
0.7625887
2
POST /venues POST /venues.json
def create @venue = Venue.new(params[:venue]) respond_to do |format| if @venue.save puts "here save" format.html { redirect_to action: :index } format.json { render json: @venue, status: :created, location: @venue } else puts "here not save" format.html { ren...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n #create venues trought users controller\n end", "def create\n @venue = Venue.new(venue_params)\n\n if @venue.save\n render json: @venue, status: :created, location: @venue\n else\n render json: {errors: @venue.errors}, status: :unprocessable_entity\n end\n end", "def my_...
[ "0.6653705", "0.6587077", "0.65826625", "0.6261902", "0.623826", "0.6235417", "0.6235417", "0.6235362", "0.62184465", "0.62086916", "0.61531246", "0.6102987", "0.60702014", "0.60702014", "0.60619015", "0.60213", "0.60197747", "0.6015039", "0.6005984", "0.5981106", "0.5973437"...
0.5907949
25
PUT /venues/1 PUT /venues/1.json
def update @venue = Venue.find(params[:id]) if(params[:venue][:events_attributes]) params[:venue][:events_attributes].each do |params_event| if params_event[1]["recurring"] # puts "recurring" params_event[1]["occurrences_attributes"].shift if params_event[1]["occurre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @venue = Venue.find(params[:id])\n\n respond_to do |format|\n if @venue.update_attributes(params[:venue])\n format.html { redirect_to @venue, :notice => 'Venue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => ...
[ "0.681824", "0.6793762", "0.6793762", "0.67916703", "0.67813736", "0.65336335", "0.65336335", "0.65336335", "0.6532224", "0.6526602", "0.65069", "0.65062284", "0.6500193", "0.64864534", "0.64864534", "0.6451238", "0.638299", "0.6351204", "0.63454634", "0.6331166", "0.63040483...
0.0
-1
GET /venues/new GET /venues/new.json
def fromRaw @venue = Venue.find(params[:id]) puts params @event = @venue.events.build() @event.update_attributes(params[:event]) # pp @event @raw_event = RawEvent.find(params[:raw_event_id]) @raw_event.submitted = true #pp @raw_event @raw_event.save @event.user_id = current_user....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @venue = Venue.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @venue }\n end\n end", "def new\n @venue = Venue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @venue }\n end\...
[ "0.7627416", "0.7625786", "0.7625786", "0.7625786", "0.7625786", "0.73517907", "0.72904843", "0.7247505", "0.721714", "0.721714", "0.7212177", "0.7183906", "0.7183906", "0.7183906", "0.7123089", "0.71201843", "0.71201843", "0.7084514", "0.70802325", "0.7051478", "0.7029857", ...
0.0
-1
DELETE /venues/1 DELETE /venues/1.json
def destroy @venue = Venue.find(params[:id]) @venue.destroy respond_to do |format| format.html { redirect_to venues_url } format.json { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @venue = Venue.find(params[:id])\n @venue.destroy\n\n respond_to do |format|\n format.html { redirect_to manage_venues_url }\n format.json { head :ok }\n end\n end", "def destroy\n @venue = Venue.find(params[:id])\n @venue.destroy\n\n respond_to do |format|\n fo...
[ "0.7531355", "0.7507718", "0.7507718", "0.7507718", "0.7507718", "0.74199617", "0.73949975", "0.7332596", "0.72691673", "0.7267232", "0.7267232", "0.7267232", "0.7267232", "0.7213395", "0.7181069", "0.7181069", "0.7181069", "0.7181069", "0.7181069", "0.7181069", "0.7181069", ...
0.7553671
0
GET /representant_locataires GET /representant_locataires.json
def index @representant_locataires = RepresentantLocataire.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_representant_locataire\n @representant_locataire = RepresentantLocataire.find(params[:id])\n end", "def index\n code = :ok\n currentUser = {\n id: current_user.utilisateur.id,\n fullName: current_user.utilisateur.prenom_nom,\n }\n result = {\n ...
[ "0.6781449", "0.6759832", "0.66037405", "0.65037304", "0.6470584", "0.6450522", "0.6406702", "0.63737035", "0.6286927", "0.6279777", "0.6248342", "0.62311316", "0.6223985", "0.6162624", "0.6156933", "0.6133206", "0.61002177", "0.60963047", "0.6059694", "0.6055712", "0.6028329...
0.7438949
0
GET /representant_locataires/1 GET /representant_locataires/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @representant_locataires = RepresentantLocataire.all\n end", "def set_representant_locataire\n @representant_locataire = RepresentantLocataire.find(params[:id])\n end", "def index\n code = :ok\n currentUser = {\n id: current_user.utilisateur.id,\n ful...
[ "0.72980034", "0.6948206", "0.66321784", "0.64330846", "0.642656", "0.6375457", "0.63713896", "0.6361998", "0.63374245", "0.63008213", "0.62859356", "0.62107503", "0.6197446", "0.61965865", "0.6185265", "0.61844087", "0.61698973", "0.61698973", "0.61467", "0.6142508", "0.6125...
0.0
-1
POST /representant_locataires POST /representant_locataires.json
def create @representant_locataire = RepresentantLocataire.new(representant_locataire_params) respond_to do |format| if @representant_locataire.save format.html { redirect_to @representant_locataire, notice: 'Representant locataire was successfully created.' } format.json { render :show, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @locataire = Locataire.new(locataire_params)\n\n respond_to do |format|\n if @locataire.save\n format.html { redirect_to @locataire, notice: 'Locataire was successfully created.' }\n format.json { render :show, status: :created, location: @locataire }\n else\n form...
[ "0.6934585", "0.683579", "0.6697483", "0.65379065", "0.6514345", "0.6279168", "0.61742496", "0.61122274", "0.61072147", "0.6098709", "0.60711867", "0.6058324", "0.6048124", "0.60445356", "0.6009058", "0.60075706", "0.60026723", "0.59723234", "0.5935823", "0.5935774", "0.59036...
0.74927706
0
PATCH/PUT /representant_locataires/1 PATCH/PUT /representant_locataires/1.json
def update respond_to do |format| if @representant_locataire.update(representant_locataire_params) format.html { redirect_to @representant_locataire, notice: 'Representant locataire was successfully updated.' } format.json { render :show, status: :ok, location: @representant_locataire } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @locataire.update(locataire_params)\n format.html { redirect_to @locataire, notice: 'Locataire was successfully updated.' }\n format.json { render :show, status: :ok, location: @locataire }\n else\n format.html { render :edit }\n for...
[ "0.69508636", "0.667888", "0.666651", "0.65694505", "0.6361586", "0.6287818", "0.62232465", "0.6194022", "0.6186537", "0.617857", "0.6177951", "0.61707234", "0.6159683", "0.61385876", "0.6137698", "0.61241144", "0.61150855", "0.61035407", "0.6078253", "0.6064705", "0.60492337...
0.7472227
0
DELETE /representant_locataires/1 DELETE /representant_locataires/1.json
def destroy @representant_locataire.destroy respond_to do |format| format.html { redirect_to representant_locataires_url, notice: 'Representant locataire was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @locataire.destroy\n respond_to do |format|\n format.html { redirect_to locataires_url, notice: 'Locataire was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @representante.destroy\n respond_to do |format|\n format.html { re...
[ "0.7214607", "0.7100458", "0.70186627", "0.6987318", "0.6980077", "0.6972117", "0.6931918", "0.6896415", "0.6896415", "0.6810334", "0.6778886", "0.67622614", "0.6759246", "0.6756679", "0.67423075", "0.673812", "0.67240137", "0.672384", "0.67181313", "0.6717346", "0.6704708", ...
0.78748786
0
Use callbacks to share common setup or constraints between actions.
def set_representant_locataire @representant_locataire = RepresentantLocataire.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 representant_locataire_params params.require(:representant_locataire).permit(:civilite, :nom, :prenom, :adresse, :codePostal, :ville, :locataire_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.6980957", "0.6783065", "0.6747844", "0.6741468", "0.67356336", "0.6592548", "0.65036845", "0.64978707", "0.64825076", "0.64795035", "0.64560914", "0.64397955", "0.6379666", "0.6376688", "0.6366702", "0.6319728", "0.6300833", "0.6300629", "0.6294277", "0.6293905", "0.629117...
0.0
-1
enforces password presence validation either from signing up with or without provider doesn't enforce if password already set
def password_signup? if password_digest return false else bool1=(@non_signup_provider_bool == true) bool2=(@signup_provider_bool == true) bool1||bool2 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def password_required?; end", "def password_required?\n return false if !persisted? and provider.present?\n super\n end", "def password_required?\n provider.blank? && super\n end", "def password_required?\n super && provider.blank?\n end", "def password_required?\n super && provider.blank...
[ "0.80974185", "0.80547625", "0.80456454", "0.7974162", "0.7974162", "0.7974162", "0.7974162", "0.7974162", "0.7974162", "0.7974162", "0.7974162", "0.7974162", "0.7974162", "0.7974162", "0.7974162", "0.7974162", "0.7974162", "0.7974162", "0.7974162", "0.79701346", "0.7960983",...
0.0
-1
used to authenticate cookie session
def authenticated?(auth_token) return false if auth_token_digest.nil? BCrypt::Password.new(auth_token_digest).is_password? (auth_token) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auth_cookie\n cookies[:auth]\n end", "def authenticate!\n user = Oath::Lockdown::Rememberable.serialize_from_cookie(remember_cookie)\n\n if user\n success!(user)\n else\n cookies.delete(remember_key)\n pass\n end\n end", "def a...
[ "0.75307304", "0.74191487", "0.7375485", "0.7342621", "0.730273", "0.7254843", "0.7159457", "0.71481484", "0.7111898", "0.70957255", "0.70944273", "0.7086406", "0.70772463", "0.7071116", "0.7042904", "0.700998", "0.70096076", "0.7004337", "0.69981676", "0.69897574", "0.698169...
0.0
-1
Does this rely on side effects?
def process_response(cgi_response, ssb_response) case when ssb_response.nil? ['response is nil', 'N/A'] when ssb_response.instance_of?(String) string_response(cgi_response, ssb_response) when ['301', '302'].include?(ssb_response.code) redirect_response(cgi_response, ssb_r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def same; end", "def internship_passed; end", "def side_effects?\n true\n end", "def private; end", "def awaken!\n\t\traise 'Not implemented'\n\tend", "def isolated; end", "def isolated; end", "def used?; end", "def offences_by=(_arg0); end", "def anchored; end", "def pausable; end"...
[ "0.61359084", "0.6126331", "0.60998875", "0.6068025", "0.5931067", "0.5924588", "0.5924588", "0.5917268", "0.58601636", "0.58338606", "0.5794552", "0.5757463", "0.57435584", "0.57430613", "0.57238466", "0.57238466", "0.5693584", "0.56616676", "0.56265855", "0.56184775", "0.56...
0.0
-1
def paypal if current_user.present? && current_user == object object.paypal else nil end end
def email_setting if current_user.present? && current_user == object es = object.email_setting || EmailSetting.new { invitations: es.invitations, conversations: es.conversations, comments: es.comments, recomments: es.recomments, newfollowers: es.newfollowers, newsletters: es.newsletters } else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_user_is_pal?\n current_user && current_user.person && current_user.person.is_pal?\n end", "def payment\n @payment ||= user.try(:payment_method).try(:to_payment)\n end", "def payable_provider\n\t\tuser.try(:is_payable?) ? user : nil\n\tend", "def is_seller?\n self.paypal_id.present? && ...
[ "0.6976138", "0.6855098", "0.6822985", "0.65921175", "0.64834404", "0.6359977", "0.63425255", "0.6322149", "0.6250822", "0.62470114", "0.62465733", "0.6236821", "0.623414", "0.6234061", "0.6216693", "0.61553985", "0.6147592", "0.6123361", "0.6099542", "0.6086261", "0.6079404"...
0.0
-1
Takes in student test scores
def test_scores(score) puts "Student scored an #{score}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_score_working\n assert_equal score(\"abcdef\"), (1 + 3 + 3 + 2 + 1 + 4)\n assert_equal score(\"zebra\"), (10 + 1 + 3 + 1 + 1)\n end", "def create_scores\r\n\r\n end", "def formulate_score()\n @player_score = @player_score.sort!().reverse!().join().to_i()\n p \"#{@players[0].get_name}'s s...
[ "0.675522", "0.6718665", "0.67104703", "0.66835976", "0.66569656", "0.6626291", "0.661553", "0.6603737", "0.6586425", "0.65722233", "0.65618414", "0.6561089", "0.6553233", "0.65470177", "0.6522117", "0.6501236", "0.64963305", "0.6492455", "0.6467639", "0.6457709", "0.6456761"...
0.81289613
0
TODO : Rename to 'supplier_specs'
def actual_specs as = supplier_orders.map(&:actual_specs) as = as.uniq.compact as end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def supplier_attrs\n phone_type = FactoryGirl.create :phone_type\n {\n organization_id: @employee.organization_id, \n supplier: FactoryGirl.attributes_for(:supplier, name: 'Test Abc')\n .merge({'addresses_attributes' => {'0' => FactoryGirl.attributes_for(:address, is_prim...
[ "0.67241764", "0.6601948", "0.6478085", "0.6314661", "0.6265853", "0.6208211", "0.61975515", "0.61923677", "0.6170389", "0.6138214", "0.6109038", "0.6077419", "0.5982477", "0.5971343", "0.5921968", "0.58836466", "0.58827096", "0.58816284", "0.5877679", "0.58732253", "0.586614...
0.68637335
0
def add_beginning wip , realized that I have to shift the elements if I add at the beginning. Stopped with this approach
def add(val) get_node(val) #every new element that has to be added should point to a new node correponding to it. list_size = @elements.size last_element_index = list_size - 1 @elements[last_element_index].next_node = list_size new_element_index = list_size @elements[new_element_index] = @node ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_at_head(val)\n \n end", "def begin_arr_add(arr, element)\n # Add `element` to the beginning of the Array variable `arr` and return `arr`\n return arr.unshift(element)\nend", "def begin_arr_add(arr, element)\n # Add `element` to the beginning of the Array \n # varia...
[ "0.7026387", "0.7003652", "0.68863153", "0.6848387", "0.68133664", "0.6665945", "0.66550237", "0.6590723", "0.6505315", "0.6465556", "0.6424866", "0.6388042", "0.6388042", "0.6354576", "0.63473463", "0.63054836", "0.62485665", "0.6247184", "0.61056477", "0.60852945", "0.60371...
0.0
-1
Standard CRUD Ops overrides Featured entries are not destroyed. The 'removed' flag is set_set Featured entries are deleted if their associated entry is destroyed
def destroy @record = FeaturedEntry.where('id = ?',params[:id]).take if @record.present? @record.update_attribute('removed', true) respond_with :blog, :v1, @record else render :json => {errors: @record.errors}, :status => 424 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_operations; end", "def logical_delete\n if is_main?\n resource.status = 'DELETED'\n resource.save\n else\n destroy\n end\n end", "def remove!\n self.update_attributes(status: REMOVED, featured: false)\n end", "def remove!\n self.update_attributes(status: REMOVED, fe...
[ "0.63109404", "0.61780363", "0.6136797", "0.6136797", "0.6136797", "0.59414434", "0.59343237", "0.5906367", "0.5764934", "0.57543373", "0.5709716", "0.5679062", "0.56678355", "0.5618589", "0.56033325", "0.56032145", "0.55565363", "0.55471283", "0.55427396", "0.55331665", "0.5...
0.54519784
22
fallback to translation in different locale
def fallback_localization(locale, key_without_locale) value = nil return nil unless fallbacks = ::Rails.application.config.i18n.fallbacks keys = fallbacks == true ? @locale_cache.keys : fallbacks keys.map(&:to_s).each do |lc| if lc != locale.locale && value.nil? nk = "#{lc}.#{k...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_fallback(_original_locale, _fallback_locale, _key, _options); end", "def locale_fallback?\n evaluate_localization_option!(:fallback)\n end", "def set_locale_with_fallback(locale)\n # Loading the default (fallback) locale\n set_locale Locale.find_main_cached.short.to_sym\n\n # Loading th...
[ "0.76732963", "0.74929947", "0.7412328", "0.71923536", "0.7164455", "0.7154956", "0.71382225", "0.70700717", "0.6992039", "0.6992039", "0.6969418", "0.6962926", "0.69371665", "0.6864555", "0.68074757", "0.67318827", "0.6721702", "0.6709784", "0.6702086", "0.66966414", "0.6690...
0.72793627
3
tries to get `default_value` from localization_key checks other localizations
def fallback_to_default(localization_key, localization) localization_key.localizations.where.not(default_value: nil). \ where.not(id: localization.id).first&.default_value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fallback_localization(locale, key_without_locale)\n value = nil\n return nil unless fallbacks = ::Rails.application.config.i18n.fallbacks\n keys = fallbacks == true ? @locale_cache.keys : fallbacks\n keys.map(&:to_s).each do |lc|\n if lc != locale.locale && value.nil?\n nk =...
[ "0.7080433", "0.6731979", "0.6715263", "0.6687734", "0.6560042", "0.6535552", "0.64615655", "0.63384813", "0.62794137", "0.6153515", "0.61260116", "0.6116664", "0.6106073", "0.610021", "0.6082364", "0.60637426", "0.6042635", "0.6007414", "0.6001777", "0.59968144", "0.59830344...
0.85205436
0
checks parameter type and returns value basing on it symbols are beeing looked up in db string are returned directly procs are beeing called (once) hashes are converted do string (for now)
def parse_value(v, locale) new_value = nil case v when Symbol then lk = @localization_key_object_cache[v.to_s] || \ Lit::LocalizationKey.where(localization_key: v.to_s).first if lk loca = Lit::Localization.active.where(locale_id: locale.id). ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_parameter(hash_p, key_p, lambda_p)\n value = hash_p[key_p.to_s]\n emsg, hash_p[key_p.to_s] = lambda_p.call(key_p.to_s, hash_p[key_p.to_s])\n emsg = \"Not String. Invalid map #{key_p}! #{key_p.to_s.upcase}=#{value.inspect}\" unless hash_p[key_p.to_s].is_a?(String)\n emsg.to_s\nend", "def param_check...
[ "0.6231124", "0.6118265", "0.59951144", "0.59474385", "0.5865963", "0.5843713", "0.57672936", "0.57672936", "0.57663685", "0.57175785", "0.56442535", "0.5561369", "0.55589914", "0.55536586", "0.5531466", "0.5519482", "0.5499628", "0.54653174", "0.54456514", "0.54456514", "0.5...
0.0
-1