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 |
|---|---|---|---|---|---|---|
Calculate total size, in bytes, of: UTF16encoded string uint16 length of string (2 bytes) null terminator (2 bytes) | def size
self.data.length + 4
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def size(str)\n str.unpack(\"U*\").size\n end",
"def get_safe_size(s)\n safe_size = get_unsafe_size(s)\n while (safe_size.to_s(16).rjust(8, '0')).scan(/../).include?(\"00\")\n safe_size -= 1\n end\n\n safe_size\n end",
"def total_payload_size\n length + 16 * character_count\n ... | [
"0.72015125",
"0.6801919",
"0.67692757",
"0.65911126",
"0.6521578",
"0.6501135",
"0.6395888",
"0.63870794",
"0.6385986",
"0.63798016",
"0.63798016",
"0.6294629",
"0.6282718",
"0.6190484",
"0.6150514",
"0.61168987",
"0.6111864",
"0.607908",
"0.6054241",
"0.6051185",
"0.6047707... | 0.5875803 | 27 |
Creates instances of the Aggregate functions and stores them in the function array. All aggregate call and summarize method calls operate on these function as a batch. | def create_functions
@ddl[:aggregate].each_with_index do |agg, _i|
output = agg[:args][0]
if contains_output?(output)
arguments = agg[:args][1]
format = (arguments.delete(:format) if arguments) || nil
begin
@functions << load_function(agg[:function]).new(output, arguments, format, @action)
rescue Exception => e # rubocop:disable Lint/RescueException
Log.error("Cannot create aggregate function '%s': %s" % [output, e])
@failed << {:name => output, :type => :startup}
end
else
Log.error("Cannot create aggregate function '%s'. '%s' has not been specified as a valid ddl output." % [output, output])
@failed << {:name => output, :type => :create}
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each_aggregate(&block)\n if block_given?\n @aggregates.each_function(&block)\n self\n else\n @aggregates.functions\n end\n end",
"def aggregate_function\n build_function(super, aggregate_constants)\n end",
"def aggregate_f(*args)\n aggregate_function.f(*args)\n... | [
"0.6710387",
"0.6633545",
"0.62691563",
"0.5913287",
"0.583792",
"0.5835885",
"0.58287156",
"0.57873803",
"0.5761962",
"0.57185614",
"0.5621458",
"0.5589315",
"0.558751",
"0.55674505",
"0.5546459",
"0.55322516",
"0.552728",
"0.5504985",
"0.5459525",
"0.5420436",
"0.5417802",
... | 0.6507355 | 2 |
Check if the function param is defined as an output for the action in the ddl | def contains_output?(output)
@ddl[:output].keys.include?(output)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_params\n raise 'No output defined. Please use --output option.' if @outputs.empty?\n end",
"def output? ; !!@output ; end",
"def done?\n !@output_id.nil?\n end",
"def arguments_valid?\n ret = false\n ret = true unless (@options.action == nil)\n end",
"def action_argume... | [
"0.612776",
"0.6070327",
"0.597946",
"0.5908288",
"0.5878903",
"0.58391726",
"0.5827675",
"0.5748225",
"0.56671315",
"0.5663992",
"0.562403",
"0.5589231",
"0.5547613",
"0.5543209",
"0.55371636",
"0.55096775",
"0.5495103",
"0.5474193",
"0.5468145",
"0.54485077",
"0.5446196",
... | 0.6811118 | 0 |
Call all the appropriate functions with the reply data received from RPC::Client | def call_functions(reply)
@functions.each do |function|
Log.debug("Calling aggregate function %s for result" % function)
begin
function.process_result(reply[:data][function.output_name], reply)
rescue Exception => e # rubocop:disable Lint/RescueException
Log.error("Could not process aggregate function for '%s': %s" % [function.output_name, e])
@failed << {:name => function.output_name, :type => :process_result}
@functions.delete(function)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def receive_data data\n @buf.extract(data).each do |packet|\n begin\n request = JSON::parse(packet)\n log.debug { request }\n case request['method']\n when \"relay_tx\"\n return handle_relay_tx(request, *request['params'])\n when \"monitor\"\n respond(re... | [
"0.63153875",
"0.622617",
"0.6218907",
"0.62075",
"0.6169773",
"0.6132769",
"0.6126708",
"0.6115627",
"0.60541344",
"0.59888375",
"0.5978423",
"0.5963581",
"0.59628373",
"0.59484845",
"0.5926947",
"0.5895297",
"0.58793026",
"0.5877376",
"0.58488405",
"0.58384126",
"0.58135504... | 0.57379323 | 33 |
Finalizes the function returning a result object | def summarize
summary = @functions.map do |function|
begin
function.summarize
rescue Exception => e # rubocop:disable Lint/RescueException
Log.error("Could not summarize aggregate result for '%s': %s" % [function.output_name, e])
@failed << {:name => function.output_name, :type => :summarize}
nil
end
end
summary.reject(&:nil?).sort do |x, y|
x.result[:output] <=> y.result[:output]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def finish(_result)\n end",
"def clear_result; end",
"def finalise\n end",
"def finalized; end",
"def finalize!; end",
"def finalize\n nil\n end",
"def finalize\n end",
"def finalize\n end",
"def finalize\n end",
"def finalize\n end",
"def finalize\n end",
"def fi... | [
"0.6868573",
"0.684749",
"0.67059416",
"0.6559592",
"0.63404405",
"0.6323175",
"0.6240594",
"0.6240594",
"0.6240594",
"0.6240594",
"0.6240594",
"0.6240594",
"0.6240594",
"0.6230367",
"0.6182199",
"0.6153636",
"0.60507613",
"0.6024462",
"0.59965855",
"0.59965855",
"0.5970299",... | 0.0 | -1 |
Loads function from disk for use | def load_function(function_name)
function_name = function_name.to_s.capitalize
PluginManager.loadclass("MCollective::Aggregate::%s" % function_name) unless Aggregate.const_defined?(function_name)
Aggregate.const_get(function_name)
rescue Exception # rubocop:disable Lint/RescueException
raise("Aggregate function file '%s.rb' cannot be loaded" % function_name.downcase)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load!; end",
"def load(file_path); end",
"def load(file_path); end",
"def load(path); end",
"def load; end",
"def load; end",
"def load; end",
"def load(name)\n Kernel.load name\nend",
"def puppet_function_load(name)\n name = name.to_sym unless name.is_a? Symbol\n Puppet::Parser::Fun... | [
"0.6985383",
"0.6885975",
"0.6885975",
"0.6858655",
"0.6851686",
"0.6851686",
"0.6851686",
"0.681678",
"0.67859066",
"0.6680383",
"0.6675167",
"0.659482",
"0.6558314",
"0.6558314",
"0.65532494",
"0.65532494",
"0.6494042",
"0.6456529",
"0.64447165",
"0.6438244",
"0.6437145",
... | 0.6318792 | 27 |
builds the actual args from the method signature if x is a symbol check for input in params if not in params use default if not a symbol use x in place of the value | def args_chain sign, params
[@visa_id] + sign.map{ |x| (params[x]||Session::defaults[x] if x.is_a? Symbol ) || x }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def canonicalise_args(fun)\n procpars = fun[:params] || {}\n if procpars.size == 0 && @args_named.size > 0\n set_error 999, \"Parameters passed to method declared to take none.\"\n return\n end\n # Go through the declared arglist and populate the positional arglist\n ... | [
"0.63874954",
"0.6271626",
"0.6252947",
"0.60311085",
"0.5996558",
"0.5939282",
"0.5926985",
"0.584166",
"0.5745298",
"0.5626676",
"0.5626676",
"0.5560366",
"0.5558328",
"0.553827",
"0.55204827",
"0.5520282",
"0.54967326",
"0.5467915",
"0.5417298",
"0.5409467",
"0.5407127",
... | 0.53648186 | 24 |
helper method for horizontal configuration | def horizontal param
@points = param[:points] || defaults[:points]
horizontal_dispatch param
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def horizontal\n return HORIZONTAL\n end",
"def horizontal_dirs\n # have to add extra logic?\n \n HORIZONTAL_DIRS\n\n end",
"def configurations; end",
"def landscape\n config\n end",
"def layout_config\n @squeezed_layout_config\n end",
"def config; end",
"def config; end... | [
"0.6484537",
"0.6019997",
"0.59005773",
"0.57975817",
"0.5708118",
"0.56599236",
"0.56599236",
"0.56599236",
"0.56599236",
"0.56599236",
"0.56599236",
"0.56599236",
"0.56599236",
"0.56599236",
"0.56599236",
"0.56599236",
"0.56599236",
"0.56599236",
"0.56599236",
"0.56599236",
... | 0.5293535 | 45 |
helper method for vertical configuration | def channel i, param
param.clone.tap{ |hash|
hash[:channel] = i.to_s
self.channel_dispatch hash
self.vertical hash
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vertical(options = {}, &block)\n Vertical.new({ parent: self }.merge!(options), &block)\n end",
"def vertical_line(options={:start_in => :limit_left, :size => :area_y})\n set RGhost::VerticalLine.new(options)\n end",
"def draw_vertical_segment\n @pixel_x = @cmd_options.first-1\n @color = ... | [
"0.63406026",
"0.5960121",
"0.57448065",
"0.5734794",
"0.56970537",
"0.5662436",
"0.5652138",
"0.5646943",
"0.55699885",
"0.555831",
"0.5548402",
"0.54956263",
"0.54668164",
"0.54188526",
"0.5393927",
"0.53391457",
"0.5291507",
"0.52518946",
"0.52518946",
"0.52518946",
"0.525... | 0.0 | -1 |
helper method for trigger configuration | def trigger param
self.send "trig_#{param[:type] || :edge}".to_sym, param
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def triggers\n\n end",
"def adjust_trigger(trig_type, trig_arn, func_arn, func_id=nil, protocol='lambda',region=@config['region'])\n \n case trig_type\n \n when 'sns'\n # XXX don't do this, use MU::Cloud::AWS::Notification \n sns_client = MU::Cloud::AWS.s... | [
"0.6575454",
"0.65325505",
"0.6513116",
"0.6496943",
"0.64460677",
"0.6402255",
"0.6402255",
"0.6402255",
"0.6402255",
"0.6402255",
"0.63702446",
"0.63702446",
"0.63702446",
"0.63702446",
"0.63702446",
"0.63702446",
"0.63702446",
"0.63702446",
"0.63702446",
"0.63702446",
"0.6... | 0.0 | -1 |
GET /candidates GET /candidates.json | def index
@candidates = Candidate.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @candidates = Candidate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @candidates }\n end\n end",
"def index\n @candidates = Candidate.all.order(:id)\n #render json: @candidates\n end",
"def index\n if Candidate.count == 0\n... | [
"0.7828381",
"0.73522097",
"0.72219783",
"0.6928002",
"0.6899774",
"0.6775134",
"0.67688996",
"0.6342606",
"0.6194655",
"0.6079805",
"0.6058217",
"0.60146403",
"0.596775",
"0.5949632",
"0.5942194",
"0.59386665",
"0.5871397",
"0.58210623",
"0.5799082",
"0.57743657",
"0.5762294... | 0.73016286 | 5 |
GET /candidates/1 GET /candidates/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @candidates = Candidate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @candidates }\n end\n end",
"def index\n @candidates = Candidate.all.order(:id)\n #render json: @candidates\n end",
"def show\n @candidate = Candidate.fin... | [
"0.7576062",
"0.719828",
"0.71253955",
"0.71249306",
"0.7115344",
"0.7115344",
"0.7115344",
"0.7115344",
"0.7115344",
"0.674099",
"0.66213965",
"0.6574931",
"0.64875436",
"0.64646935",
"0.61951876",
"0.60203767",
"0.60195625",
"0.601726",
"0.597598",
"0.5966151",
"0.5957981",... | 0.0 | -1 |
POST /candidates POST /candidates.json | def create
@candidate = Candidate.new(candidate_params)
@candidate.user_id = current_user.id
respond_to do |format|
if @candidate.save
flash[:notice] = 'Candidate was successfully created.'
format.html { redirect_to home_candidate_path(@candidate) }
format.json { render :show, status: :created, location: @candidate }
else
format.html { render :new }
format.json { render json: @candidate.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @candidate = current_user.candidates.new(candidate_params)\n respond_to do |format|\n if @candidate.save\n format.html { redirect_to @candidate, notice: 'Candidate was successfully created.' }\n format.json { render :show, status: :created, location: @candidate }\n else\n... | [
"0.73996586",
"0.69050306",
"0.6875307",
"0.6840989",
"0.6840989",
"0.6840989",
"0.6840989",
"0.68375486",
"0.68206316",
"0.6752525",
"0.67350394",
"0.6624552",
"0.65386087",
"0.64996314",
"0.64925003",
"0.6466578",
"0.6317362",
"0.63112783",
"0.6292041",
"0.62748843",
"0.626... | 0.6661347 | 11 |
PATCH/PUT /candidates/1 PATCH/PUT /candidates/1.json | def update
respond_to do |format|
if @candidate.update(candidate_params)
flash[:success] = 'Candidate was successfully updated'
format.html { redirect_to edit_candidate_path(@candidate), notice: 'Candidate was successfully updated.' }
format.json { render :show, status: :ok, location: @candidate }
else
flash[:failure] = 'Candidate updation unsuccessful'
format.html { render :edit }
format.json { render json: @candidate.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @candidate = Candidate.find(params[:id])\n\n respond_to do |format|\n if @candidate.update_attributes(params[:candidate])\n format.html { redirect_to @candidate, notice: 'Candidate was successfully updated.' }\n format.json { head :no_content }\n else\n format.html... | [
"0.6997068",
"0.6843286",
"0.6768482",
"0.6768482",
"0.6768482",
"0.6768482",
"0.6768482",
"0.6768482",
"0.6768482",
"0.67535204",
"0.65477365",
"0.6542974",
"0.6518262",
"0.6458349",
"0.64341927",
"0.6364452",
"0.63492894",
"0.624964",
"0.61845785",
"0.6174728",
"0.61387515"... | 0.6686334 | 10 |
DELETE /candidates/1 DELETE /candidates/1.json | def destroy
@candidate.destroy
respond_to do |format|
flash[:notice] = 'Candidate was successfully destroyed.'
format.html { redirect_to candidates_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @candidate = Candidate.find(params[:id])\n @candidate.destroy\n\n respond_to do |format|\n format.html { redirect_to candidates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @candidate = Candidate.find(params[:id])\n @candidate.destroy\n\n res... | [
"0.7436304",
"0.7436304",
"0.7173674",
"0.717342",
"0.717342",
"0.717342",
"0.717342",
"0.717342",
"0.717342",
"0.717342",
"0.71688795",
"0.71688795",
"0.71688795",
"0.7083692",
"0.68879616",
"0.67611915",
"0.67196244",
"0.6716783",
"0.6708224",
"0.6674849",
"0.6648467",
"0... | 0.7097595 | 13 |
Use callbacks to share common setup or constraints between actions. | def set_candidate
@candidate = Candidate.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 candidate_params
params.require(:candidate).permit( :first_name,:last_name,:dob,:gender, :marital_status, :status,:languages,:summary)
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 |
Creates an `and` type query matcher. All conditions in this type of matcher must pass to be considered a "match". It will shortcircuit in the case of a false match. | def and(*array_matchers, **keyword_matchers)
create_matcher('and', array_matchers, keyword_matchers)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def and_matcher(*args)\n AndMatcher.new(args)\n end",
"def and?\n AndPredicate.new self.to_parseable\n end",
"def andand(*spec)\n AndAnd.new(self, spec.flatten)\n end",
"def and_expr\n expr = equality()\n\n while match(:and)\n operator = previous()\n right ... | [
"0.8204355",
"0.7808722",
"0.7691399",
"0.76274705",
"0.75500953",
"0.7413053",
"0.7325874",
"0.70669675",
"0.6977767",
"0.6858834",
"0.6840731",
"0.6814311",
"0.6762778",
"0.6762778",
"0.66700894",
"0.66392523",
"0.66197526",
"0.66174436",
"0.66068053",
"0.65912163",
"0.6535... | 0.72061265 | 7 |
Creates an `or` type query matcher. Any conditions in this type of matcher must pass to be considered a "match". It will shortcircuit in the case of a true match. | def or(*array_matchers, **keyword_matchers)
create_matcher('or', array_matchers, keyword_matchers)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def or_matcher(*args)\n OrMatcher.new(args)\n end",
"def logical_or\n expr = logical_and\n\n while match?(:or)\n operator = previous\n right = logical_and\n expr = Ringo::Logical.new(expr, operator, right)\n end\n\n expr\n end",
"def or_clause\n a ... | [
"0.8073155",
"0.7510881",
"0.74621046",
"0.74611366",
"0.7448392",
"0.7437346",
"0.725626",
"0.7201213",
"0.711074",
"0.71020234",
"0.70318335",
"0.69977015",
"0.69072336",
"0.6886803",
"0.6853424",
"0.677621",
"0.6762472",
"0.6727602",
"0.6656749",
"0.6636346",
"0.6588634",
... | 0.730983 | 6 |
Creates a `not` type query matcher. No conditions in this type of matcher should pass to be considered a "match". It will shortcircuit in the case of a true match. | def not(*array_matchers, **keyword_matchers)
create_matcher('not', array_matchers, keyword_matchers)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def not_matcher(matcher)\n NotMatcher.new(matcher)\n end",
"def not( *filterspec )\n\t\tself.log.debug \"cloning %p with negated filterspec: %p\" % [ self, filterspec ]\n\t\tnotfilter = Treequel::Filter.new( :not, *filterspec )\n\t\treturn self.clone( :filter => self.filter + notfilter )\n\tend",
"... | [
"0.73200285",
"0.7278146",
"0.7237969",
"0.7124236",
"0.70505756",
"0.6993238",
"0.6782654",
"0.6779925",
"0.67423594",
"0.67321825",
"0.664675",
"0.6599901",
"0.65940684",
"0.65691113",
"0.6559502",
"0.6473227",
"0.63480055",
"0.6260238",
"0.62270045",
"0.6219167",
"0.621891... | 0.6743118 | 8 |
Similar to `case`, except it uses a `ResultPatternMatch` instead. | def result_case(target, destructure: false, &fn)
Qo::PatternMatchers::ResultPatternMatch
.new(destructure: destructure, &fn)
.call(target)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def case!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 23 )\n\n type = CASE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 144:8: 'case'\n match( \"case\" )\n\n \n @state.type = t... | [
"0.662114",
"0.6491278",
"0.63860977",
"0.63575363",
"0.6344473",
"0.62308085",
"0.62308085",
"0.6076645",
"0.6054541",
"0.6054541",
"0.6037954",
"0.60247666",
"0.5977843",
"0.5956351",
"0.59129816",
"0.58484346",
"0.5824745",
"0.58157057",
"0.5803418",
"0.58016825",
"0.57896... | 0.7665825 | 0 |
Dynamically creates a new branch to be used with custom pattern matchers. | def create_branch(name:, precondition: Any, extractor: IDENTITY, destructure: false, default: false)
Qo::Branches::Branch.create(
name: name,
precondition: precondition,
extractor: extractor,
destructure: destructure,
default: default
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_pattern_match(branches:)\n Qo::PatternMatchers::PatternMatch.create(branches: branches)\n end",
"def create_branch(_base_branch, _new_branch)\n puts 'TODO: Implement Git.create_branch'\n end",
"def create_branch\n @tree_class.new\n end",
"def create_branch new_branch_name\n... | [
"0.74253404",
"0.720424",
"0.70681125",
"0.69828886",
"0.69017947",
"0.6719717",
"0.6583488",
"0.6475421",
"0.6410504",
"0.63235855",
"0.6309198",
"0.6285649",
"0.6161878",
"0.6157274",
"0.60705686",
"0.5995742",
"0.59907097",
"0.5961429",
"0.5957209",
"0.5928284",
"0.5857041... | 0.69494015 | 4 |
Creates a new type of pattern matcher from a set of branches | def create_pattern_match(branches:)
Qo::PatternMatchers::PatternMatch.create(branches: branches)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_matcher(options, whitelist_option, blacklist_option); end",
"def match(*args)\n if args.first.is_a?(Qo::Matchers::GuardBlockMatcher)\n Qo::Matchers::PatternMatch.new(*args)\n else\n match_target, *qo_matchers = args\n Qo::Matchers::PatternMatch.new(*qo_matchers).call(matc... | [
"0.6051287",
"0.5499758",
"0.54571134",
"0.5445732",
"0.53744024",
"0.5301951",
"0.52606374",
"0.51869124",
"0.5180006",
"0.5111025",
"0.5105657",
"0.5097023",
"0.505593",
"0.5021175",
"0.5005874",
"0.49785346",
"0.49457228",
"0.49292594",
"0.49196014",
"0.490118",
"0.4895908... | 0.7791935 | 0 |
GET /refunds GET /refunds.json | def index
respond_to do |format|
format.html # index.html.erb
format.json { render json: @refunds }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refunds\n RefundRepository.new(api).all(token)\n end",
"def refund(tid, refund)\n begin\n #creating url\n url = \"#{@security.environment}/transactions/#{tid}/refunds\"\n\n # make the request.\n json_response = Rede::CommonRequest... | [
"0.774411",
"0.7166731",
"0.71120745",
"0.71120745",
"0.6953939",
"0.67905384",
"0.6724481",
"0.6713539",
"0.6691451",
"0.66871655",
"0.66508275",
"0.661992",
"0.661992",
"0.6613698",
"0.66089576",
"0.65944284",
"0.65873724",
"0.6585264",
"0.65592146",
"0.65592146",
"0.647270... | 0.7228496 | 1 |
GET /refunds/1 GET /refunds/1.json | def show
@refund = Refund.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @refund }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refunds\n RefundRepository.new(api).all(token)\n end",
"def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @refunds }\n end\n end",
"def refund(tid, refund)\n begin\n #creating url\n url = \"#{@s... | [
"0.7301627",
"0.71893334",
"0.71390665",
"0.71280944",
"0.7020472",
"0.7020472",
"0.6979931",
"0.695762",
"0.6921594",
"0.6905886",
"0.6871424",
"0.68568027",
"0.6736404",
"0.6691081",
"0.66664696",
"0.66564816",
"0.66289157",
"0.66115683",
"0.6606588",
"0.65953076",
"0.65933... | 0.749443 | 1 |
GET /refunds/new GET /refunds/new.json | def new
@refund = Refund.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @refund }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @refund = Refund.new(params[:refund])\n\n respond_to do |format|\n if @refund.save\n format.html { redirect_to @refund, notice: 'Refund was successfully created.' }\n format.json { render json: @refund, status: :created, location: @refund }\n else\n format.html { r... | [
"0.7760759",
"0.7684975",
"0.74572015",
"0.744348",
"0.6885683",
"0.6806962",
"0.6689645",
"0.66887814",
"0.6637615",
"0.65879345",
"0.6569617",
"0.6530977",
"0.65274894",
"0.65274894",
"0.65236926",
"0.6481491",
"0.64791125",
"0.64791125",
"0.6474597",
"0.6473745",
"0.646988... | 0.847749 | 1 |
POST /refunds POST /refunds.json | def create
@refund = Refund.new(params[:refund])
respond_to do |format|
if @refund.save
format.html { redirect_to @refund, notice: 'El rembolso ha sido almacenado' }
format.json { render json: @refund, status: :created, location: @refund }
else
format.html { render action: "new" }
format.json { render json: @refund.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @refund = Refund.new(params[:refund])\n\n respond_to do |format|\n if @refund.save\n format.html { redirect_to @refund, notice: 'Refund was successfully created.' }\n format.json { render json: @refund, status: :created, location: @refund }\n else\n format.html { r... | [
"0.7411639",
"0.72928524",
"0.72220093",
"0.7139806",
"0.70534503",
"0.6982286",
"0.69706225",
"0.6958251",
"0.6841389",
"0.6834011",
"0.6833234",
"0.68022853",
"0.68022853",
"0.677015",
"0.66018367",
"0.6594192",
"0.65577936",
"0.6523444",
"0.65152913",
"0.65089875",
"0.6508... | 0.7141533 | 3 |
PUT /refunds/1 PUT /refunds/1.json | def update
@refund = Refund.find(params[:id])
respond_to do |format|
if @refund.update_attributes(params[:refund])
format.html { redirect_to @refund, notice: 'Refund was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @refund.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @refund = Refund.find(params[:id])\n\n respond_to do |format|\n if @refund.update_attributes(params[:refund])\n format.html { redirect_to @refund, notice: 'Refund was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\"... | [
"0.75930625",
"0.7290829",
"0.70791286",
"0.70637393",
"0.6838148",
"0.68328863",
"0.68274236",
"0.6785931",
"0.6768365",
"0.6754151",
"0.6727216",
"0.6710479",
"0.66524756",
"0.662985",
"0.65941256",
"0.65941256",
"0.6587663",
"0.6534057",
"0.65168035",
"0.65012044",
"0.6469... | 0.75599337 | 1 |
DELETE /refunds/1 DELETE /refunds/1.json | def destroy
@refund = Refund.find(params[:id])
@refund.destroy
respond_to do |format|
format.html { redirect_to refunds_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @refund = Refund.find(params[:id])\n @refund.destroy\n\n respond_to do |format|\n format.html { redirect_to refunds_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @refund_request = RefundRequest.find(params[:id])\n @refund_request.destroy\n\n respond_t... | [
"0.81669515",
"0.79900545",
"0.7478539",
"0.7146553",
"0.6928762",
"0.6753174",
"0.6579645",
"0.65783507",
"0.65673065",
"0.65597016",
"0.65315986",
"0.65289164",
"0.64688873",
"0.646832",
"0.6432849",
"0.640182",
"0.6395198",
"0.6395198",
"0.6393717",
"0.63912356",
"0.638374... | 0.8130104 | 1 |
Creates a new Command object. message The message/command to be sent to the server. Example: hello = Command.new( "hello" ) client.send( hello ) or client.send( Command.new( "info" ) ) | def initialize( message )
@message = message
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_command(message)\n message = Message.new(params)\n @command = begin\n \"#{message.command.capitalize}Command\".constantize.new(message)\n rescue\n HelpCommand.new(message)\n end\n end",
"def init_message(message)\n command = command_factory.instance.build(message)\n ... | [
"0.7410036",
"0.67147076",
"0.63058007",
"0.61882806",
"0.6128849",
"0.61234385",
"0.61082715",
"0.60230625",
"0.60153383",
"0.60137707",
"0.5953627",
"0.59467757",
"0.5932159",
"0.59318167",
"0.59072393",
"0.58983487",
"0.5891732",
"0.5889023",
"0.5871787",
"0.5868956",
"0.5... | 0.5556036 | 40 |
update to add this in to items. This doesn't work | def on_landing_page?
link_text = locale('Stop Smoking Guide', 'Guía Para Dejar de Fumar')
find('a', text: link_text)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @@all_items[@id] = self\n end",
"def update(list, item, qty)\n add_item(list, item, qty)\nend",
"def add_or_update_item(list,new_items)\n list.merge!(new_items)\nend",
"def update_order_item\n \n end",
"def updated(item)\n end",
"def update!(**args)\n @items = ... | [
"0.73811",
"0.72207355",
"0.71282434",
"0.702074",
"0.6990576",
"0.69773734",
"0.69773734",
"0.69773734",
"0.69773734",
"0.69773734",
"0.69773734",
"0.69773734",
"0.69773734",
"0.69773734",
"0.6954292",
"0.69185364",
"0.6756871",
"0.67342347",
"0.67310286",
"0.6722685",
"0.67... | 0.0 | -1 |
this will only work for Home, Stop Smoking Guide and Cigarette Counter | def navigate_to(button)
find('.navbar-toggle').click unless has_css?('.glyphicon.glyphicon-cog')
find('.ng-binding', text: button).click
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def superweening_adorningly(counterstand_pyrenomycetales)\n end",
"def robot_counter\n\n\tend",
"def us_troops_available\n us_troop < coin_control_excess ? us_troop : coin_control_excess\n end",
"def battler_hue\n return 0\n end",
"def soft_ace\n # softy method refactor for when an ace is p... | [
"0.5726029",
"0.56404406",
"0.5627096",
"0.54890275",
"0.5480502",
"0.5444819",
"0.5440449",
"0.54349625",
"0.54349625",
"0.54049987",
"0.5381794",
"0.5361006",
"0.5329698",
"0.5322982",
"0.5297912",
"0.5294948",
"0.5291153",
"0.5278019",
"0.5277868",
"0.5266389",
"0.5254258"... | 0.0 | -1 |
this will work for set quit date, review consent, and sign out | def go_to(button)
find('.navbar-toggle').click unless has_css?('.glyphicon.glyphicon-cog')
find('.dropdown-toggle').click
find('.ng-binding', text: button).click
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_days_checkin(options = Hash.new)\n raise unless options[:date].present?\n options[:notify] ||= false\n options[:private] ||= false\n options[:share_twitter] ||= false\n options[:share_facebook] ||= false\n \n # Figure out what date we're answering questions for\n @todays_date = sel... | [
"0.5892683",
"0.5649029",
"0.56375986",
"0.54219",
"0.5409681",
"0.5395786",
"0.538308",
"0.53477335",
"0.53390795",
"0.53245574",
"0.53098416",
"0.5299804",
"0.5293742",
"0.5287283",
"0.52549624",
"0.52549624",
"0.52306736",
"0.5189639",
"0.5184601",
"0.5183032",
"0.51772493... | 0.0 | -1 |
This will only work for switching languages | def switch_language
language = locale('Español', 'English')
go_to language
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def language; end",
"def language; end",
"def language; end",
"def language; end",
"def lang(orig); end",
"def lang; end",
"def lang; end",
"def lang; end",
"def lang; end",
"def language_server; end",
"def verificar_locale\n \n end",
"def select_language\n I18n.backend.send(:init_tran... | [
"0.75204027",
"0.75204027",
"0.75204027",
"0.75204027",
"0.74501675",
"0.73938185",
"0.73938185",
"0.73938185",
"0.73938185",
"0.7377426",
"0.72867656",
"0.72524875",
"0.7218356",
"0.7210764",
"0.7185844",
"0.710356",
"0.7046074",
"0.70344025",
"0.70297027",
"0.70297027",
"0.... | 0.76059306 | 0 |
returns everywhere this item can be worn. | def worn_locs
arr = @type_attributes.select {|att| att.is_a?(EquipmentType) }
locs = []
arr.each do |att|
locs += att.worn.keys
end
return locs.uniq
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def worn_or_wielded? item\n object = @inventory.find item\n return false if object.nil?\n\n pos = position_of object\n\n return false if object.nil?\n\n if [:left_wield, :right_wield, :dual_wield].include? pos\n return \"You will need to unwield #{object.name} first.\"\n else\n return \... | [
"0.6814608",
"0.6522901",
"0.64822346",
"0.6469756",
"0.641332",
"0.63831747",
"0.636795",
"0.6363406",
"0.6339425",
"0.63063496",
"0.6290353",
"0.628202",
"0.6259389",
"0.62508565",
"0.62500757",
"0.6195417",
"0.6191886",
"0.61498815",
"0.6092678",
"0.6048875",
"0.60383105",... | 0.0 | -1 |
uncomment when you have `each` working and `Enumerable` included | def to_s
inject([]) { |acc, link| acc << "[#{link.key}, #{link.val}]" }.join(", ")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(*) end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
... | [
"0.729552",
"0.729552",
"0.729552",
"0.729552",
"0.729552",
"0.729552",
"0.7163506",
"0.7115632",
"0.7115632",
"0.7115632",
"0.7115632",
"0.7115632",
"0.7115632",
"0.7115632",
"0.7115632",
"0.7115632",
"0.7115632",
"0.7115632",
"0.70454085",
"0.70422536",
"0.6950336",
"0.67... | 0.0 | -1 |
set up the session context information, so that it gets logged with the job log lines also set up a unique tmpdir, which will get removed at the end of the job. | def configure_for_job(job)
previous_tmpdir = ENV.fetch("TMPDIR", nil)
self.class.running_job(job) do
dir = Dir.mktmpdir("job-#{job.id}-#{name.gsub(/[^\w.]/, ".")}-")
begin
ENV["TMPDIR"] = dir
yield
ensure
FileUtils.remove_entry(dir, true)
end
end
ensure
ENV["TMPDIR"] = previous_tmpdir
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup\n @current_session = new_session\n end",
"def prepare\n FileUtils.rm_rf(@tempdirs, secure: true) if @tempdirs\n @tempdirs = []\n @base_options = nil\n @mode_options = nil\n @user_recipients = nil\n @user_keys = nil\n @system_identifiers = nil\n ... | [
"0.6003464",
"0.5945935",
"0.5819618",
"0.5753736",
"0.569681",
"0.5682621",
"0.5508562",
"0.5484854",
"0.5477067",
"0.5477067",
"0.5443726",
"0.5436414",
"0.5398018",
"0.5394001",
"0.5382443",
"0.5358069",
"0.5342104",
"0.5337471",
"0.53160423",
"0.5294716",
"0.52557176",
... | 0.63703877 | 0 |
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.actionmailer.contact_mailer.notification.subject | def notification(contact)
@contact = contact
mail :to => @contact.email,
:subject => @contact.subject,
:body => @contact.body
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subject (recipient)\n subject_variables = alert_variables[:subject].dup\n subject_variables.merge!(recipient_details(recipient))\n subject = \"#{I18n.t(\"#{recipient_type.to_s}_subject_#{alert_name.to_s}\", subject_variables)}\"\n subject\n end",
"def translate(mapping, key)\n I... | [
"0.7243274",
"0.7023452",
"0.70085",
"0.6858497",
"0.6765852",
"0.67308056",
"0.6669901",
"0.6416116",
"0.6415689",
"0.6414621",
"0.64133817",
"0.64133346",
"0.636281",
"0.6346839",
"0.6248559",
"0.62042373",
"0.6184172",
"0.6164868",
"0.6082074",
"0.60807705",
"0.6056458",
... | 0.54320997 | 97 |
before_action :set_calendar_properties before_action :set_mentee_id | def index
@latest_resources = Ebook.order("created_at desc").limit(5)
@coach_events = @current_user.events.where("endtime >= ? and coach_mentee_relation_id is null", Time.now).order("starttime asc").page params[:page] if @current_user.events
@coach_meetings = @current_user.events.where("endtime >= ? and coach_mentee_relation_id is not null", Time.now).order("starttime asc").page params[:page]
@user = @current_user
@mentees = @user.mentees.page params[:page]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_calendar_action\n @calendar_action = CalendarAction.find(params[:id])\n end",
"def set_mentee\n @mentee = Mentee.find(params[:id])\n end",
"def set_meal_schedule\n @meal_schedule = current_owner.meal_schedules.find(params[:id])\n end",
"def set_calendar_event\n @calendar_even... | [
"0.6450391",
"0.62939703",
"0.6256227",
"0.6177849",
"0.6177849",
"0.6173744",
"0.614772",
"0.61113065",
"0.61035067",
"0.6067273",
"0.6054016",
"0.60212815",
"0.59946847",
"0.59946847",
"0.5960237",
"0.5957285",
"0.5943573",
"0.5926493",
"0.5924956",
"0.5924956",
"0.5924956"... | 0.0 | -1 |
The first indentation becomes the maximum indentation to remove. | def test_unindent_4()
string = <<-heredoc
one
two
three
heredoc
expected = "one\ntwo\n three\n"
result = string.unindent
assert_equal( expected, result )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unindent!\n gsub!(/^[ \\t]{#{minimum_leading_whitespace}}/, '')\n end",
"def unindent\n @__indent__ ||= 0\n @__indent__ -= indentation\n end",
"def reset_indentation!(modifier = 0)\n indent!(-find_least_indentation + modifier)\n end",
"def reset_indentation(modifier = 0)\n indent(... | [
"0.7653984",
"0.75669205",
"0.72395664",
"0.71688294",
"0.7151941",
"0.7103",
"0.70871073",
"0.699855",
"0.699855",
"0.6996303",
"0.69561476",
"0.68298674",
"0.68219024",
"0.6774511",
"0.6697048",
"0.6565999",
"0.6537174",
"0.6495629",
"0.6495629",
"0.64640224",
"0.6423903",
... | 0.5759754 | 74 |
Nonmatches are returned as a oneelement array. | def test_gpartition2_1()
string = 'This is a test'
expected = [ string ]
rx = %r{Not matching}
result = string.gpartition2( rx )
assert_equal_array( expected, result )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_a\n [self] + matches\n end",
"def matches\n @matches ||= []\n end",
"def aggressive\n\t# make a matches array. this returns the equivalent of the matches[] block above\n\tm=[]\n\n\n\t# return the matches array, even if it's emtpy\n\tm\nend",
"def remove_errant_matches_from(pot_ex_array... | [
"0.6602046",
"0.6199159",
"0.6160869",
"0.60641927",
"0.60401726",
"0.5936576",
"0.5919308",
"0.57038003",
"0.5664711",
"0.55451477",
"0.54877365",
"0.54728293",
"0.54172426",
"0.54122007",
"0.5356007",
"0.52644175",
"0.5238384",
"0.5234284",
"0.52290916",
"0.52195257",
"0.52... | 0.0 | -1 |
Matches are returned as a threeelement array. | def test_gpartition2_2
string = 'aaabbbcccddd'
expected = [ 'aaa', 'bbb', 'cccddd' ]
rx = %r{bbb}
result = string.gpartition2( rx )
assert_equal_array( expected, result )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matches\n @matches ||= []\n end",
"def to_a\n [self] + matches\n end",
"def mapped\n @matches.map(&:unpack)\n end",
"def match_result\n [match_x, match_y]\n end",
"def matches\n parse_file.lines.each_with_object([]) do |line, matches|\n matches << line.scan(REGEXP[:n... | [
"0.70891434",
"0.69736856",
"0.6655341",
"0.645374",
"0.63257414",
"0.626255",
"0.61811453",
"0.6101565",
"0.60626495",
"0.5934238",
"0.5926803",
"0.5817396",
"0.58093405",
"0.57898766",
"0.57182753",
"0.5699816",
"0.5683024",
"0.56393665",
"0.56289953",
"0.562126",
"0.560606... | 0.0 | -1 |
recurse down the hiearchy | def nested_subclasses(parent=self)
subclasses(parent).collect {|subclass|
{subclass => nested_subclasses(subclass)}
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recursive => nil",
"def traverse; end",
"def recursive_search(path,current_depth)\n # If we haven't hit our max depth\n if current_depth < @depth \n sub_hash = @wiki\n # Follow our path down the hash\n path.each do |node|\n sub_hash = sub_hash[node]\n end\n\n # Expand this node of the... | [
"0.6688524",
"0.6639508",
"0.65458906",
"0.6249526",
"0.61509085",
"0.6118658",
"0.60941094",
"0.6067594",
"0.6064181",
"0.60232764",
"0.6012892",
"0.5970194",
"0.59203327",
"0.58866405",
"0.58642113",
"0.58613795",
"0.58338946",
"0.5832352",
"0.581534",
"0.5802425",
"0.57779... | 0.0 | -1 |
Takes elapsed ms and turns it into HH:MM:SS | def benchmark_summary_str(prefix, elapsed_ms)
summary_time = Time.at(elapsed_ms / 1000).utc.strftime('%H:%M:%S')
"#{prefix} SUMMARY Elapsed: #{summary_time}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def elapsed\n add(:elapsed, '00:00:00', '%s') { |v,elapsed|\n sprintf('%02i:%02i:%02i', \n elapsed / 3600, # hours, \n elapsed / 60 % 60, #minutes, \n elapsed % 60 #seconds\n )\n }\n end",
"def time\n a=[1, 1000, 60000, 3600000]*2\n ms = duration\n \"%02d\" % ... | [
"0.7458337",
"0.7422375",
"0.74212736",
"0.7382089",
"0.7271856",
"0.72502214",
"0.7144826",
"0.71034366",
"0.7089622",
"0.7075168",
"0.7062447",
"0.70397794",
"0.7038349",
"0.7020916",
"0.7020913",
"0.7018163",
"0.6989756",
"0.69843936",
"0.697557",
"0.6966947",
"0.6938702",... | 0.0 | -1 |
Adds argument to list, along with link to previous node, which in turn has link to this new node. | def <<(data)
node = DoubleNode.new(:data => data)
# list has nodes, add this to last
if @tail
@tail.tail = node
node.head = @tail
# list empty, add first node
else
@head = node
end
# node always added to end of list
@tail = node
@size += 1
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push arg\n if @items.nil?\n\t @items = Link.new(arg)\n\telse\n\t n = Link.new(arg)\n\t n.next = @items\n\t @items = n\n\tend\n\treturn @items\n end",
"def add_to_front(node)\n node.next = self.head # previous head becomes second, after the node\n self.head = node # the node becomes the new head... | [
"0.6259902",
"0.62184787",
"0.6046957",
"0.6009113",
"0.6009113",
"0.6009113",
"0.5971723",
"0.59058404",
"0.5894818",
"0.58859855",
"0.58841693",
"0.5860966",
"0.58264726",
"0.58177996",
"0.5787734",
"0.5783298",
"0.578321",
"0.578321",
"0.57747746",
"0.57646984",
"0.5761623... | 0.0 | -1 |
Removes the last node. Returns: last node data if successful, nil if list is empty. | def pop
return nil unless @head && @tail
old_head = @tail.head
old_data = @tail.data
@tail = @tail.head
@tail.tail = nil if @tail
@size -= 1
old_data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_last\n raise 'Cannot remove element from an empty list.' if empty?\n\n # Extract the data off of the tail node\n # Move the tail to the previous node\n data = @tail.data\n @tail = @tail.prev_node\n @size -= 1\n\n # removes the same element from @head, if it was final element/node\n ... | [
"0.8167208",
"0.7734307",
"0.739937",
"0.739937",
"0.7346911",
"0.7330842",
"0.73251325",
"0.71692276",
"0.7151837",
"0.7147149",
"0.70847285",
"0.69072646",
"0.6769227",
"0.67589366",
"0.6745421",
"0.67409384",
"0.67336637",
"0.67242146",
"0.6721628",
"0.67189157",
"0.671279... | 0.649149 | 41 |
Private: Used by insert to replace old node with new node. | def insert_at!(data, position)
node, head, tail = set_insert_vars(data, position)
# before: head -> position -> tail
# after: head -> node -> tail
head.tail = node if head
node.tail = tail
tail.head = node if tail
node.head = head
# set @tail for list or it will use old tail
if position.tail?
@tail = node
end
# orphan the old node
position.head = nil
position.tail = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_node!(node)\n @store.remove(node.key)\n @store.append(node.key, node.val)\n end",
"def replace_head(node)\n self.head = node\n end",
"def update(node); end",
"def insertAfter(node, new_node)\n end",
"def update_children(node, new_node)\n\t\tleft \t= node.left\n\t\tright = node.right\... | [
"0.6948148",
"0.6616172",
"0.6540583",
"0.6531678",
"0.6491444",
"0.647986",
"0.6412449",
"0.6394911",
"0.6363294",
"0.6316136",
"0.6316136",
"0.62616694",
"0.62616694",
"0.62473536",
"0.62408864",
"0.62151796",
"0.6172578",
"0.6156053",
"0.61483955",
"0.6117277",
"0.6109629"... | 0.0 | -1 |
Private: Used by insert to add new node in specified position. | def insert_at(data, position)
node, head, tail = set_insert_vars(data, position)
# before: head -> position
# after: head -> node -> position
head.tail = node
node.tail = position
position.head = node
node.head = head
@size += 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert(node, position)\n node_before_position = index(position-1)\n node_at_position = index(position)\n node_before_position.next = node\n node.next = node_at_position\n @size += 1\n node\n # returns inserted node\n end",
"def insert(position, surname)\n new_node = Node.new(surname)... | [
"0.7950374",
"0.7509472",
"0.7481829",
"0.74788064",
"0.7257622",
"0.72214186",
"0.71629435",
"0.714674",
"0.71291023",
"0.7113394",
"0.70786136",
"0.70153815",
"0.6981719",
"0.6958616",
"0.6956231",
"0.6948699",
"0.6945686",
"0.69395214",
"0.6927987",
"0.6927987",
"0.6920860... | 0.7567862 | 1 |
Private: Variables common to insert_at and insert_at!. Returns: Array. | def set_insert_vars(data, position)
node = DoubleNode.new(:data => data)
head = position.head
tail = position.tail
[node, head, tail]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_(array, item, index)\n array = array.insert(index, item)\n puts array\n return array\n \nend",
"def values_at(*) end",
"def create_int_array\n [first.time_to_int, last.time_to_int]\n end",
"def to_a\n [ xnow, ynow ]\n end",
"def test_insert_negative_index_append... | [
"0.57874453",
"0.57719773",
"0.550062",
"0.54866475",
"0.5440545",
"0.54352283",
"0.5366205",
"0.5331532",
"0.5198489",
"0.51765555",
"0.51702535",
"0.515979",
"0.51575434",
"0.5148266",
"0.51380247",
"0.5136711",
"0.5123887",
"0.51232594",
"0.5112809",
"0.50788295",
"0.50757... | 0.0 | -1 |
POST /events POST /events.xml | def create
self.resource = new_resource
respond_to do |format|
if resource.save
format.html do
flash[:notice] = "#{resource_name.humanize} was successfully created."
redirect_to edit_challenge_attempt_path(resource.challenge, resource)
end
format.js
format.xml { render :xml => resource, :status => :created, :location => resource_url }
else
format.html { render :action => "new" }
format.js { render :action => "new" }
format.xml { render :xml => resource.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n Rails.logger.debug(\"Received event #{params[:event]}\")\n head :ok\n end",
"def create_event event, data={}\n data[:event] = event\n post '/event', data\n end",
"def save_event(event)\n method = (event.id == nil || event.id == '') ? :post : :put\n query_string ... | [
"0.6938859",
"0.6832928",
"0.6629996",
"0.6572941",
"0.65628463",
"0.64595443",
"0.644994",
"0.6432171",
"0.64178646",
"0.64178646",
"0.64178646",
"0.64178646",
"0.6415361",
"0.6409476",
"0.6409476",
"0.6409476",
"0.6409476",
"0.6409476",
"0.637794",
"0.6374196",
"0.633384",
... | 0.0 | -1 |
PUT /events/1 PUT /events/1.xml | def update
self.resource = find_resource
respond_to do |format|
if resource.update_attributes(params[resource_name])
format.html do
flash[:notice] = "#{resource_name.humanize} was successfully updated."
redirect_to challenge_attempt_path(resource.challenge, resource)
end
format.js
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.js { render :action => "edit" }
format.xml { render :xml => resource.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_event(event)\n method = (event.id == nil || event.id == '') ? :post : :put\n query_string = (method == :put) ? \"/#{event.id}\" : ''\n @connection.send(Addressable::URI.parse(events_url + query_string), method, event.to_xml)\n end",
"def put_events(args)\n\tapi_url = \"#{@base_url}/#{a... | [
"0.68006223",
"0.66227084",
"0.6586422",
"0.6582029",
"0.6582029",
"0.6582029",
"0.6582029",
"0.6582029",
"0.6582029",
"0.6582029",
"0.6538628",
"0.6528396",
"0.6528396",
"0.6528396",
"0.6528396",
"0.6504651",
"0.64950335",
"0.64886147",
"0.6481964",
"0.6477629",
"0.6464071",... | 0.0 | -1 |
===== ===== ===== ===== ===== | def create_tag_stage
self.tag_stages.create
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def schubert; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def operations; end",
"def operations; end",
"def suivre; end",
"def formation; end",
"def stderrs; end",
"def terpene; end",
"def verdi; end",
"def r... | [
"0.7783363",
"0.71039706",
"0.6781318",
"0.665193",
"0.665193",
"0.665193",
"0.665193",
"0.66294456",
"0.66294456",
"0.65280795",
"0.6499372",
"0.64624846",
"0.64504683",
"0.63405323",
"0.6339505",
"0.6308749",
"0.63046265",
"0.63046265",
"0.63043773",
"0.62257403",
"0.620838... | 0.0 | -1 |
Determine if there is a chapter after the current page | def next_chapter_path
return false unless current_page.is_a? Book::Chapter
current_page.next_chapter
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_chapter?()\n end",
"def whole_chapter?\n starting_bibleverse.verse.zero?\n end",
"def end_of_chapter\n end",
"def whole_book?\n starting_bibleverse.chapter.zero?\n end",
"def chapters?\n !chapters.empty?\n end",
"def last_page?; ! @doc.has_key? 'next' end",
"def last?\n ev... | [
"0.72224975",
"0.70645046",
"0.697479",
"0.65666264",
"0.6426701",
"0.63711345",
"0.63204855",
"0.6284475",
"0.6268844",
"0.62505114",
"0.6212323",
"0.6190456",
"0.615414",
"0.6149218",
"0.6134336",
"0.6120063",
"0.60991955",
"0.6035204",
"0.6030053",
"0.6027291",
"0.6017554"... | 0.7099606 | 1 |
return 0 where are you inserting values in into the hash? | def first_uniq_char(s)
hash = Hash.new
s.each_char do |i|
if hash.has_key?(i)
hash[i] += 1
else
hash[i] = 1
end
end
hash.each do |k,v|
return s.index(k) if v == 1
end
return -1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n 0\n end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() #:nodoc:\n prime = 31;\n result = 1;\n result = prime * result + @amount.to_i\n result = prime * result + @new_b... | [
"0.72909075",
"0.66508615",
"0.66508615",
"0.66508615",
"0.66508615",
"0.66508615",
"0.66508615",
"0.66508615",
"0.65098673",
"0.64389193",
"0.63296735",
"0.6272316",
"0.62533224",
"0.6248042",
"0.6236307",
"0.62136334",
"0.6212024",
"0.6177703",
"0.6177703",
"0.6177703",
"0.... | 0.0 | -1 |
Returns a string representing a null value. | def inspect
'null'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_value_to_null(_value)\n 'null'\n end",
"def process_nil(exp)\n return \"NULL\"\n end",
"def to_s\n res = \"\"\n self.each {|current| res << \" ( #{current.data} ) -> \" }\n res << \"nil\"\n end",
"def nil \n \"nil\" \n end",
"def inspect\n n... | [
"0.8211108",
"0.7048803",
"0.7043745",
"0.7012862",
"0.6994924",
"0.6943016",
"0.68878585",
"0.6871274",
"0.6862378",
"0.68563944",
"0.6749207",
"0.6742523",
"0.6727192",
"0.6701522",
"0.66402394",
"0.6625559",
"0.66101575",
"0.66003495",
"0.65823054",
"0.655089",
"0.6538632"... | 0.74179316 | 2 |
Create a new curation. | def create_curation(engine_name, options)
post("engines/#{engine_name}/curations", options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def curation\n end",
"def create\n @creative_configuration = CreativeConfiguration.new(creative_configuration_params)\n\n respond_to do |format|\n if @creative_configuration.save\n format.html { redirect_to @creative_configuration, notice: 'Creative configuration was successfully created.' }\n... | [
"0.59830225",
"0.5656284",
"0.5633999",
"0.5610203",
"0.55165726",
"0.54901475",
"0.537554",
"0.53699523",
"0.5369757",
"0.5313778",
"0.53126025",
"0.5297251",
"0.5281441",
"0.5280221",
"0.5263218",
"0.5260842",
"0.5231351",
"0.522741",
"0.5179663",
"0.5179619",
"0.5173434",
... | 0.0 | -1 |
Retrieve a curation by id. | def get_curation(engine_name, id)
get("engines/#{engine_name}/curations/#{id}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_category id\n\t\traw_output = @fred.category( nil, category_id: id.to_s )\n\n\t\traw_output.categories.category\n\tend",
"def get_category id\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.get CATEGORIES, id )\n\t\t\t\tend",
"def get(id)\n Basuco::Resource.get(id)\n end",
"def... | [
"0.65896475",
"0.65619564",
"0.64255977",
"0.6415461",
"0.6401644",
"0.63266253",
"0.61798376",
"0.61611754",
"0.60807693",
"0.60594165",
"0.605915",
"0.60541224",
"0.60415584",
"0.5925954",
"0.5925802",
"0.5916899",
"0.5915727",
"0.59109634",
"0.59063435",
"0.5904463",
"0.58... | 0.5528094 | 54 |
Update an existing curation. | def update_curation(engine_name, id, options)
put("engines/#{engine_name}/curations/#{id}", options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @creative_configuration.update(creative_configuration_params)\n format.html { redirect_to @creative_configuration, notice: 'Creative configuration was successfully updated.' }\n format.json { render :show, status: :ok, location: @creative_configuration... | [
"0.6198535",
"0.6106345",
"0.5916987",
"0.5887394",
"0.587999",
"0.5870782",
"0.5862843",
"0.5859483",
"0.5840661",
"0.5826392",
"0.58237153",
"0.5813764",
"0.5779657",
"0.5775433",
"0.57652825",
"0.575386",
"0.5753351",
"0.5749788",
"0.5748321",
"0.5747623",
"0.57404166",
... | 0.0 | -1 |
Delete a curation by id. | def destroy_curation(engine_name, id)
delete("engines/#{engine_name}/curations/#{id}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(id)\n call(:delete, path(id))\n end",
"def DeleteCategory id\n \n APICall(path: \"categories/#{id}.json\",method: 'DELETE')\n \n end",
"def delete(id)\n self.find(id).delete_\n end",
"def delete_category id\n\t\t\t\t\tFreshdesk::Api::Client.delete_... | [
"0.6870713",
"0.6780861",
"0.6739258",
"0.67305934",
"0.66910684",
"0.6630953",
"0.6616764",
"0.64736503",
"0.63640785",
"0.6355412",
"0.63428944",
"0.63265175",
"0.6326052",
"0.6304313",
"0.62988424",
"0.62863296",
"0.62769693",
"0.62695193",
"0.6247521",
"0.62436956",
"0.62... | 0.0 | -1 |
Creates the a connection with middleware for mapping errors, parsing json, and adding breakers functionality. | def connection
Faraday.new(base_path, headers: base_request_headers, request: request_options) do |faraday|
faraday.use :breakers
faraday.request :json
faraday.response :raise_error, error_prefix: service_name
faraday.response :betamocks if mock_enabled?
faraday.response :json
faraday.adapter Faraday.default_adapter
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def middleware\n connection.builder\n end",
"def middleware\n connection.builder\n end",
"def build_connection(options = FmRest.default_connection_settings, &block)\n base_connection(options) do |conn|\n conn.use RaiseErrors\n conn.use TokenSession, options\n\n ... | [
"0.6619057",
"0.6469058",
"0.6367527",
"0.61972255",
"0.541318",
"0.5399482",
"0.5399482",
"0.53215",
"0.5307481",
"0.52957994",
"0.52957994",
"0.5252612",
"0.52207494",
"0.51829106",
"0.51818836",
"0.5158717",
"0.5148091",
"0.5134475",
"0.51307386",
"0.507203",
"0.506408",
... | 0.49185988 | 30 |
Exists the value with key | def key?(key, options = {})
load(key, options) != nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exist?(key)\n\n end",
"def has_key?(key); end",
"def has_key?(key); end",
"def contains?(key)\n @key_data.has_key?(key)\n end",
"def has_key? k\n @values.has_key?(k)\n end",
"def has_value? val\n self.keys.each do |k|\n return true if self[k].include? val\n end\n return false\n... | [
"0.80646807",
"0.80363166",
"0.80363166",
"0.7857577",
"0.77786726",
"0.77577376",
"0.77553254",
"0.77261853",
"0.77232826",
"0.7650804",
"0.7647588",
"0.76156193",
"0.760623",
"0.75676227",
"0.756402",
"0.7547501",
"0.7494249",
"0.7471254",
"0.7462277",
"0.7452714",
"0.74445... | 0.0 | -1 |
Atomically decrement integer value with key This is just syntactic sugar for calling increment with a negative value. This method also accepts negative amounts. | def decrement(key, amount = 1, options = {})
increment(key, -amount, options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decr(key, value = 1)\n mon_synchronize do\n perform [\"decr\", key, value], proc: T_INT\n end\n end",
"def decr(key, value = 1)\n mon_synchronize do\n perform [\"decr\", key, value], :proc => T_INT\n end\n end",
"def decrby(key, decrement); end",
"def decrby(key, decrement); end"... | [
"0.7871098",
"0.786161",
"0.78296614",
"0.78296614",
"0.7819166",
"0.7782856",
"0.77813274",
"0.77317894",
"0.7664426",
"0.7406838",
"0.73124725",
"0.72700393",
"0.71659833",
"0.71587723",
"0.712504",
"0.7062982",
"0.70442504",
"0.70044357",
"0.69277936",
"0.69277936",
"0.692... | 0.8487073 | 0 |
Explicitly close the store | def close
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close\n persist\n end",
"def close\n save\n end",
"def close\n @mutex.synchronize do\n @thread.kill\n @store.each_value do |value|\n sess, _ = value\n sess.close(@context)\n end\n end\n end",
"def close\n persistent.close\n @_p... | [
"0.7390946",
"0.7045272",
"0.7006187",
"0.6908627",
"0.68650204",
"0.67675227",
"0.67595404",
"0.67539",
"0.67539",
"0.6706045",
"0.6706045",
"0.6706045",
"0.6706045",
"0.67027557",
"0.6678797",
"0.6666337",
"0.66630256",
"0.66630256",
"0.66630256",
"0.66630256",
"0.66630256"... | 0.6488989 | 60 |
Fetch value with key. Return nil if the key doesn't exist | def [](key)
load(key)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch(key)\n result.fetch(key)\n end",
"def get(key)\n position = find(key)\n if position != nil\n @values[position]\n else\n nil\n end\n end",
"def fetch_value( oid, key )\n\t\toid = normalize_oid( oid )\n\t\tkey = normalize_key( key )\n\t\tdata = @storage[ oid ] or return n... | [
"0.79272324",
"0.7913871",
"0.7818767",
"0.773995",
"0.76901126",
"0.76591283",
"0.76042455",
"0.75959903",
"0.7472178",
"0.7423738",
"0.73812675",
"0.7339555",
"0.7295559",
"0.72106206",
"0.72048056",
"0.71889734",
"0.718323",
"0.7164405",
"0.713149",
"0.71247166",
"0.711797... | 0.0 | -1 |
Store value with key | def []=(key, value)
store(key, value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put(key, value)\n \n end",
"def put(key, value); end",
"def save(key, value)\n storage.transaction {storage[key] = value}\n end",
"def store(calling_node, key, value)\n @router.touch(calling_node)\n return false unless key.class == DataKey\n @values[key.to_bin] = value\n return ... | [
"0.793792",
"0.7670004",
"0.762042",
"0.7580393",
"0.7576812",
"0.7569778",
"0.7558423",
"0.75272936",
"0.74716073",
"0.74465036",
"0.7438644",
"0.74326175",
"0.7432324",
"0.7432324",
"0.7399075",
"0.7397068",
"0.73658323",
"0.73658323",
"0.7349419",
"0.73077714",
"0.73077714... | 0.6945244 | 63 |
instance variables defined here can be used in corresponding view file contact_email.html | def contact_email(name, email, body)
@name = name
@email = email
@body = body
mail(from: email, subject: 'Contact Form Message')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def emailform\n end",
"def emailform\n end",
"def email; end",
"def email; end",
"def email; end",
"def email; end",
"def process_contact\n # inside of all controller actions you have access a `request` object that represents the request being made\n \n # In rails all the information from th... | [
"0.71770656",
"0.71770656",
"0.66224897",
"0.66224897",
"0.66224897",
"0.66224897",
"0.66215",
"0.6583589",
"0.6550911",
"0.65375525",
"0.64942867",
"0.6479006",
"0.6461117",
"0.6394578",
"0.6363429",
"0.6353733",
"0.630635",
"0.63044226",
"0.6297851",
"0.62754214",
"0.627332... | 0.59560525 | 82 |
String representation of the SID | def to_s
['S', revision, nt_authority, nt_non_unique, uuids].join('-')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sid_to_name(value)\n if Puppet::Util::Windows::SID.respond_to?(:sid_to_name)\n Puppet::Util::Windows::SID.sid_to_name(value)\n else\n Puppet::Util::Windows::Security.sid_to_name(value)\n end\n end",
"def cmd_getsid(*args)\n print_line(\"Server SID: #{client.sys.... | [
"0.6864902",
"0.68457276",
"0.6707173",
"0.66621685",
"0.6638018",
"0.6576314",
"0.6562179",
"0.65184605",
"0.65184605",
"0.64885587",
"0.6400933",
"0.6390441",
"0.63712615",
"0.6358722",
"0.63379276",
"0.6317314",
"0.6294879",
"0.6294879",
"0.6277553",
"0.625368",
"0.6235853... | 0.6638813 | 4 |
Given a hash with numeric values, return the key for the smallest value | def key_for_min_value(name_hash)
return nil if name_hash.empty?
min = 1000000000000
key = ""
name_hash.each do |name, number|
if number < min
min = number
key = name
end
end
key
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |key, value|\n if value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n... | [
"0.8821222",
"0.8777674",
"0.87769854",
"0.8745862",
"0.8689437",
"0.86553806",
"0.865241",
"0.86165065",
"0.8587693",
"0.8572328",
"0.85674095",
"0.8550907",
"0.8529734",
"0.8529734",
"0.85182345",
"0.84936565",
"0.8475531",
"0.8475531",
"0.8466132",
"0.8449126",
"0.84490585... | 0.0 | -1 |
Intend to be called by UI to display stdout. The stdout is stored in MiqTasktask_results or message if error Since the task_results may contain a large block of data, it is desired to remove the task upon receiving the data | def raw_stdout_via_worker(userid, format = 'txt')
unless MiqRegion.my_region.role_active?("embedded_ansible")
msg = "Cannot get standard output of this playbook because the embedded Ansible role is not enabled"
return MiqTask.create(
:name => 'ansible_stdout',
:userid => userid || 'system',
:state => MiqTask::STATE_FINISHED,
:status => MiqTask::STATUS_ERROR,
:message => msg
).id
end
options = {:userid => userid || 'system', :action => 'ansible_stdout'}
queue_options = {
:class_name => self.class,
:method_name => 'raw_stdout',
:instance_id => id,
:args => [format],
:priority => MiqQueue::HIGH_PRIORITY,
:role => nil
}
MiqTask.generic_action_with_callback(options, queue_options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def console_after_task\n miq_task = MiqTask.find(params[:task_id])\n unless miq_task.results_ready?\n add_flash(_(\"Console access failed: %{message}\") % {:message => miq_task.message}, :error)\n javascript_flash(:spinner_off => true)\n return\n end\n\n resource_type = miq_task.task_res... | [
"0.58596545",
"0.5707752",
"0.56536406",
"0.5635468",
"0.56230193",
"0.56183344",
"0.55817926",
"0.55460674",
"0.5534544",
"0.55055016",
"0.54950047",
"0.54717636",
"0.5460454",
"0.541473",
"0.5402201",
"0.53577036",
"0.5350234",
"0.5346105",
"0.5342154",
"0.5336531",
"0.5325... | 0.56261 | 4 |
display ingredients created or updated after the specified date. | def updated_after
update_selector { @ingredients = policy_scope(Ingredient.updated_after(@date)).order(:name) }
render :index
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @recipe = Recipe.all.order(\"created_at DESC\")\nend",
"def index\n @recipe = Recipe.all.order(\"created_at DESC\")\n end",
"def list_date(date)\n if date\n date = date.beginning_of_day\n if @list_date != date\n return content_tag(:h2, date.strftime(\"%m/%d/%Y\"))\n ... | [
"0.5571825",
"0.5557989",
"0.548803",
"0.5378808",
"0.53154016",
"0.53023547",
"0.528683",
"0.5278025",
"0.52607936",
"0.5249847",
"0.52494836",
"0.52359885",
"0.52355886",
"0.5233625",
"0.5232739",
"0.5232502",
"0.522944",
"0.5224436",
"0.5214373",
"0.52037644",
"0.51993275"... | 0.66590506 | 0 |
display a specific ingredient. | def show
@ingredient = Ingredient.find_by(id: params[:id])
authorize @ingredient
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @ingredient = Ingredient.find(params[:id])\n @page_title = \"#{@ingredeint.name}\"\n end",
"def show\n @ingredient = Ingredient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ingredient }\n end\n end",
"def show\n... | [
"0.77055633",
"0.7366918",
"0.7366918",
"0.73456264",
"0.7301745",
"0.7284073",
"0.7259103",
"0.7221823",
"0.7219814",
"0.7066479",
"0.7025839",
"0.6958041",
"0.68944234",
"0.6882323",
"0.6879223",
"0.6866469",
"0.6860951",
"0.6860951",
"0.68559027",
"0.6851901",
"0.67937565"... | 0.65009886 | 55 |
Creates a new label. | def create_label(project, name, color, options = {})
post("/projects/#{url_encode project}/labels", body: options.merge(name: name, color: color))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_label(node)\n if node.attributes['id'] and @labels[node.attributes['id']]\n label = @labels[node.attributes['id']]\n else\n label = @factory.new_label\n @labels[node.attributes['id']] = label\n end\n \n # Read all defined data fields\n ... | [
"0.75013953",
"0.71534044",
"0.7140698",
"0.7057874",
"0.7035276",
"0.6994237",
"0.69415545",
"0.6875589",
"0.68751764",
"0.68545467",
"0.6725328",
"0.672352",
"0.6695129",
"0.66658825",
"0.6658846",
"0.66065925",
"0.6557896",
"0.65385735",
"0.64709044",
"0.6469384",
"0.64668... | 0.7503175 | 0 |
Subscribes the user to a label to receive notifications | def subscribe_to_label(project, name)
post("/projects/#{url_encode project}/labels/#{url_encode name}/subscribe")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subscribe!\n # TODO: Implement\n end",
"def subscribe_to_group_label(group, name)\n post(\"/groups/#{url_encode group}/labels/#{url_encode name}/subscribe\")\n end",
"def subscribe\n \nend",
"def subscribe\n @bot.get_updates(fail_silently: true) do |message|\n parser = InputParser.ne... | [
"0.63506544",
"0.62950766",
"0.601759",
"0.60003644",
"0.5977762",
"0.59768397",
"0.5948324",
"0.5934377",
"0.5934377",
"0.5893909",
"0.58407027",
"0.5835649",
"0.57620066",
"0.574103",
"0.5732175",
"0.5712805",
"0.56882906",
"0.56356305",
"0.5599611",
"0.5559095",
"0.555835"... | 0.6934015 | 0 |
Unsubscribes the user from a label to not receive notifications from it | def unsubscribe_from_label(project, name)
post("/projects/#{url_encode project}/labels/#{url_encode name}/unsubscribe")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unsubscribed\n end",
"def unsubscribed\n end",
"def unsubscribed # :doc:\n # Override in subclasses\n end",
"def unsubscribe()\n end",
"def unsubscribed\n\tend",
"def unsubscribe; end",
"def unsubscribe()\n \n end",
"def unsubscribe\n end",
"def unsubscribed;... | [
"0.74282473",
"0.74282473",
"0.73546463",
"0.7275932",
"0.7241318",
"0.7214702",
"0.719606",
"0.7108885",
"0.7099188",
"0.6964429",
"0.6943778",
"0.6935913",
"0.68873686",
"0.6840175",
"0.68380415",
"0.67700136",
"0.67439806",
"0.67418534",
"0.6721957",
"0.67192537",
"0.66821... | 0.7034383 | 9 |
GET /jobs GET /jobs.xml | def index
@jobs = Job.by_department.paginate(:page => params[:page], :per_page => current_user.preferred_items_per_page)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @jobs }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def jobs\n doc = Nokogiri::XML open(@url)\n\n doc.search('//job').map { |node|\n Job.new(attributes_from(node))\n }\n end",
"def index\n @jobs = Job.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jobs }\n end\n end",
"d... | [
"0.73205507",
"0.72729135",
"0.71821696",
"0.7130482",
"0.7030642",
"0.7021925",
"0.6835374",
"0.68151474",
"0.68074626",
"0.673195",
"0.6662918",
"0.6662918",
"0.6662918",
"0.6662918",
"0.6662918",
"0.6662918",
"0.6662918",
"0.66599715",
"0.6652008",
"0.6643812",
"0.6624499"... | 0.0 | -1 |
GET /jobs/1 GET /jobs/1.xml | def show
@job = Job.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @job }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @jobs = Job.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jobs }\n end\n end",
"def getJobApi (options)\n uri = options[:job] + \"?depth=\" + options[:depth].to_s\n job_uri = URI.parse(uri)\n http = Net::HTTP.new(job_uri.hos... | [
"0.70364517",
"0.70221996",
"0.6980914",
"0.69193447",
"0.6905757",
"0.6723367",
"0.6706007",
"0.66702217",
"0.6625802",
"0.6585081",
"0.6570226",
"0.65692854",
"0.6521269",
"0.6514651",
"0.6487358",
"0.6487237",
"0.6476796",
"0.647277",
"0.645419",
"0.6435364",
"0.6434389",
... | 0.67135555 | 11 |
GET /jobs/new GET /jobs/new.xml | def new
@job = Job.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @job }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n createJobWithDefaults\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @job ... | [
"0.77074856",
"0.7576467",
"0.74736714",
"0.7434554",
"0.73134154",
"0.72839767",
"0.71261054",
"0.70906746",
"0.70906746",
"0.70574987",
"0.70574987",
"0.70574987",
"0.70574987",
"0.70119286",
"0.70008135",
"0.69807976",
"0.68773836",
"0.6870343",
"0.6854625",
"0.6851486",
"... | 0.7628772 | 9 |
POST /jobs POST /jobs.xml | def create
@job = Job.new(params[:job])
respond_to do |format|
if @job.save
format.html { redirect_to(edit_admin_job_path(@job), :notice => 'Job was successfully created. Now select the appropriate permissions.') }
format.xml { render :xml => @job, :status => :created, :location => @job }
else
format.html { render :action => "new" }
format.xml { render :xml => @job.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_job xml, name\n\t\t\tputs \"==> Creating job for project: '#{name}'\"\n\t\t\tbegin\n\t\t\t\tcreate_response = RestClient.post \"#{@jenkins_host}:#{@jenkins_port}/createItem/?name=#{name}\", xml , {:content_type => :xml}\n\t\t\t\treturn create_response.code.to_s\n\t\t\trescue Exception => e\n\t\t\t\tputs... | [
"0.6847216",
"0.6769806",
"0.6390787",
"0.6271662",
"0.62408996",
"0.623112",
"0.6220346",
"0.62202764",
"0.61930704",
"0.61842257",
"0.61842257",
"0.61842257",
"0.61842257",
"0.6176608",
"0.6159866",
"0.61387354",
"0.61259687",
"0.6044265",
"0.60097986",
"0.60044014",
"0.598... | 0.57868326 | 37 |
PUT /jobs/1 PUT /jobs/1.xml | def update
@job = Job.find(params[:id])
respond_to do |format|
if @job.update_attributes(params[:job])
format.html { redirect_to(edit_admin_job_path(@job), :notice => 'Job was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @job.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", {\"passed\" => success}.to_json, :content_type => :json\nend",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend",
"d... | [
"0.6630085",
"0.6558216",
"0.6558216",
"0.6558216",
"0.6536446",
"0.65334105",
"0.64888644",
"0.6390682",
"0.63784367",
"0.6359745",
"0.6359351",
"0.6359351",
"0.6359351",
"0.6358652",
"0.6320766",
"0.6320766",
"0.61899805",
"0.61413044",
"0.6108961",
"0.6103982",
"0.60902303... | 0.61285007 | 18 |
DELETE /jobs/1 DELETE /jobs/1.xml | def destroy
@job = Job.find(params[:id])
@job.deactivate!
flash[:notice] = "Job successfully deactivated."
respond_to do |format|
format.html { redirect_to(edit_admin_job_url(@job)) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n node = @job.nodes.find(params[:id])\n @job.nodes.delete(node)\n\n respond_to do |format|\n format.html { redirect_to job_url(@job) }\n format.xml { head :ok }\n end\n end",
"def delete(id)\n connection.delete do |req|\n req.url \"job/#{id}\"\n end\n ... | [
"0.7452083",
"0.7420717",
"0.7242453",
"0.7199983",
"0.7196661",
"0.713859",
"0.713859",
"0.713859",
"0.713859",
"0.713859",
"0.713859",
"0.713859",
"0.713859",
"0.7123496",
"0.7076762",
"0.70646775",
"0.6948848",
"0.6923701",
"0.6807619",
"0.6783894",
"0.67765754",
"0.6679... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_office
@office = Office.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.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.5... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def office_params
params.require(:office).permit(:author, :quote)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.63264... | 0.0 | -1 |
args 1. Symbol type return Proc | def get_validator(type)
return Validators[type] if Validators.key?(type)
method_name = type.to_s << '?'
return self.method(method_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def args(*) end",
"def to_proc() end",
"def to_proc() end",
"def call(*args); end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end... | [
"0.734637",
"0.67650247",
"0.67650247",
"0.6733311",
"0.6729541",
"0.6729541",
"0.6729541",
"0.6729541",
"0.6729541",
"0.6729541",
"0.6729541",
"0.6729541",
"0.6729541",
"0.6729541",
"0.6729541",
"0.6729541",
"0.6729541",
"0.6729541",
"0.6729541",
"0.6729541",
"0.6729541",
... | 0.0 | -1 |
args 1. Integer a 2. Integer b 3. Boolean include return Boolean | def gt(a, b, include)
include = true if include.nil?
if include
return a <= b
else
return a < b
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def and_b\n end",
"def and_a\n end",
"def any a,b=:true\n a.prove { b.prove { yield; return } }\n end",
"def one a,b=:true\n stands = false\n a.prove { \n b.prove {\n return if stands\n stands = true\n } \n }\n yield if stands\n end",
... | [
"0.6934407",
"0.67799205",
"0.6504718",
"0.64774984",
"0.64434856",
"0.64136",
"0.63797396",
"0.636456",
"0.6342704",
"0.6258398",
"0.62329227",
"0.6175189",
"0.6153777",
"0.61389214",
"0.61050546",
"0.60527074",
"0.6052375",
"0.60486716",
"0.6040725",
"0.6030278",
"0.5989392... | 0.0 | -1 |
args 1. Hash options return Boolean | def required(options)
default = true
return default unless options.is_a?(Hash)
return default unless options.key?(:required)
return options[:required]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def options_ok?\n end",
"def options?(*args)\r\n val = false\r\n options.each do |key, value|\r\n next unless args.include?(key.to_sym)\r\n val = options[key].nil? ? true : options[key]\r\n break\r\n end\r\n val\r\n end",
"def options?\n options.is_a?(Hash)\n end",
"d... | [
"0.7505308",
"0.747793",
"0.70112765",
"0.68758386",
"0.68532956",
"0.6824349",
"0.6808158",
"0.67836195",
"0.6748212",
"0.6745087",
"0.6730508",
"0.667533",
"0.6674993",
"0.6663398",
"0.6655912",
"0.6655912",
"0.6620455",
"0.6614967",
"0.6586616",
"0.65816814",
"0.65701663",... | 0.0 | -1 |
args 1. Object value 2. Hash options return Boolean | def int?(value, options = nil)
return true if value.nil? and not required(options)
return false unless value.is_a?(Integer)
return true unless options.is_a?(Hash)
if options.key?(:min)
return false unless gt(options[:min], value, options[:include])
end
if options.key?(:max)
return false unless gt(value, options[:max], options[:include])
end
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vash_valid_value?(x); self.class.option_value?(x); end",
"def options?(*args)\r\n val = false\r\n options.each do |key, value|\r\n next unless args.include?(key.to_sym)\r\n val = options[key].nil? ? true : options[key]\r\n break\r\n end\r\n val\r\n end",
"def value?(va... | [
"0.695029",
"0.6807112",
"0.67430145",
"0.6662309",
"0.66561747",
"0.6573999",
"0.6568521",
"0.6553517",
"0.6527092",
"0.6527092",
"0.638072",
"0.63655126",
"0.6269438",
"0.6244268",
"0.624202",
"0.6206484",
"0.61767805",
"0.61739814",
"0.60956895",
"0.60851175",
"0.60708857"... | 0.0 | -1 |
args 1. Object value 2. Hash options return Boolean | def numeric?(value, options = nil)
return true if value.nil? and not required(options)
return false unless value.is_a?(String)
return false unless value.to_i.to_s == value
return int?(value.to_i, options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vash_valid_value?(x); self.class.option_value?(x); end",
"def options?(*args)\r\n val = false\r\n options.each do |key, value|\r\n next unless args.include?(key.to_sym)\r\n val = options[key].nil? ? true : options[key]\r\n break\r\n end\r\n val\r\n end",
"def value?(va... | [
"0.695029",
"0.6807112",
"0.67430145",
"0.6662309",
"0.66561747",
"0.6573999",
"0.6568521",
"0.6553517",
"0.6527092",
"0.6527092",
"0.638072",
"0.63655126",
"0.6269438",
"0.6244268",
"0.624202",
"0.6206484",
"0.61767805",
"0.61739814",
"0.60956895",
"0.60851175",
"0.60708857"... | 0.0 | -1 |
args 1. Object value 2. Hash options return Boolean | def string?(value, options = nil)
return true if value.nil? and not required(options)
return false unless value.is_a?(String)
return true unless options.is_a?(Hash)
if options.key?(:min)
return false unless gt(options[:min], value.split("").size, options[:include])
end
if options.key?(:max)
return false unless gt(value.split("").size, options[:max], options[:include])
end
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vash_valid_value?(x); self.class.option_value?(x); end",
"def options?(*args)\r\n val = false\r\n options.each do |key, value|\r\n next unless args.include?(key.to_sym)\r\n val = options[key].nil? ? true : options[key]\r\n break\r\n end\r\n val\r\n end",
"def value?(va... | [
"0.695029",
"0.6807112",
"0.67430145",
"0.6662309",
"0.66561747",
"0.6573999",
"0.6568521",
"0.6553517",
"0.6527092",
"0.6527092",
"0.638072",
"0.63655126",
"0.6269438",
"0.6244268",
"0.624202",
"0.6206484",
"0.61767805",
"0.61739814",
"0.60956895",
"0.60851175",
"0.60708857"... | 0.0 | -1 |
args 1. Object value 2. Hash options return Boolean | def array?(value, options = nil)
return true if value.nil? and not required(options)
return false unless value.is_a?(Array)
return int?(value.size, options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vash_valid_value?(x); self.class.option_value?(x); end",
"def options?(*args)\r\n val = false\r\n options.each do |key, value|\r\n next unless args.include?(key.to_sym)\r\n val = options[key].nil? ? true : options[key]\r\n break\r\n end\r\n val\r\n end",
"def value?(va... | [
"0.6952393",
"0.68071306",
"0.6744828",
"0.66615355",
"0.6656824",
"0.6573961",
"0.6570582",
"0.6554166",
"0.65291166",
"0.65291166",
"0.63818747",
"0.6361414",
"0.62702626",
"0.62435734",
"0.6240289",
"0.6206032",
"0.6175554",
"0.6175176",
"0.60971296",
"0.60859525",
"0.6070... | 0.0 | -1 |
args 1. Object value 2. Hash option return Boolean | def member?(value, option)
if option.is_a?(Array)
options = {:items => option}
else
options = option
end
return true if value.nil? and not required(options)
return options[:items].member?(value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash_in_argument_hash\n argument_hash = {} if argument_hash.nil?\n return true\n end",
"def hash_or_parameter?(args)\n args.is_a?(Hash) || args.respond_to?(:to_unsafe_h)\n end",
"def include?(arg_)\n _get_objdata(arg_) ? true : false\n end",
"def value?(value) true end",
"d... | [
"0.68881786",
"0.66914606",
"0.66439974",
"0.66135806",
"0.64289385",
"0.64289385",
"0.64114344",
"0.63166",
"0.631603",
"0.62921715",
"0.6245153",
"0.6207265",
"0.6166599",
"0.61302173",
"0.6124946",
"0.6089859",
"0.60478973",
"0.60324436",
"0.60276306",
"0.60270244",
"0.602... | 0.0 | -1 |
args 1. Object value 2. Hash option return Boolean | def regexp?(value, option = nil)
if option.is_a?(Regexp)
options = {:regexp => option}
else
options = option
end
return true if value.nil? and not required(options)
return false unless value.is_a?(String)
raise TypeError.new("option :regexp is not Regexp.") unless options[:regexp].is_a?(Regexp)
return options[:regexp].match(value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash_in_argument_hash\n argument_hash = {} if argument_hash.nil?\n return true\n end",
"def hash_or_parameter?(args)\n args.is_a?(Hash) || args.respond_to?(:to_unsafe_h)\n end",
"def include?(arg_)\n _get_objdata(arg_) ? true : false\n end",
"def value?(value) true end",
"d... | [
"0.68881786",
"0.66914606",
"0.66439974",
"0.66135806",
"0.64289385",
"0.64289385",
"0.64114344",
"0.63166",
"0.631603",
"0.62921715",
"0.6245153",
"0.6207265",
"0.6166599",
"0.61302173",
"0.6124946",
"0.6089859",
"0.60478973",
"0.60324436",
"0.60276306",
"0.60270244",
"0.602... | 0.0 | -1 |
args 1. Object value 2. Hash option return Boolean | def alpha?(value, option = nil)
if option.is_a?(Symbol)
options = {:case => option}
else
options = option
end
return true if value.nil? and not required(options)
return false unless value.is_a?(String)
return value.match(/^[a-zA-Z]+$/) unless options.is_a?(Hash)
case
when options[:case] == :down
return value.match(/^[a-z]+$/)
when options[:case] == :up || options[:case] == :upper
return value.match(/^[A-Z]+$/)
else
raise ArgumentError.new("options must be :down or :up.")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash_in_argument_hash\n argument_hash = {} if argument_hash.nil?\n return true\n end",
"def hash_or_parameter?(args)\n args.is_a?(Hash) || args.respond_to?(:to_unsafe_h)\n end",
"def include?(arg_)\n _get_objdata(arg_) ? true : false\n end",
"def value?(value) true end",
"d... | [
"0.68881786",
"0.66914606",
"0.66439974",
"0.66135806",
"0.64289385",
"0.64289385",
"0.64114344",
"0.63166",
"0.631603",
"0.62921715",
"0.6245153",
"0.6207265",
"0.6166599",
"0.61302173",
"0.6124946",
"0.6089859",
"0.60478973",
"0.60324436",
"0.60276306",
"0.60270244",
"0.602... | 0.0 | -1 |
GET /translated_lines GET /translated_lines.json | def index
@translated_lines = TranslatedLine.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_translated_line\n @translated_line = TranslatedLine.find(params[:id])\n end",
"def create\n @translated_line = TranslatedLine.new(translated_line_params)\n\n respond_to do |format|\n if @translated_line.save\n @translated_lines = TranslatedLine.where(translation_code: @translate... | [
"0.6548335",
"0.6476807",
"0.63034403",
"0.60311884",
"0.60255754",
"0.59237367",
"0.589768",
"0.5782095",
"0.5773349",
"0.5766864",
"0.57553756",
"0.5752632",
"0.5752632",
"0.56929684",
"0.561968",
"0.5565931",
"0.55541885",
"0.5552106",
"0.55155766",
"0.5509043",
"0.5501729... | 0.79125476 | 0 |
GET /translated_lines/1 GET /translated_lines/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @translated_lines = TranslatedLine.all\n end",
"def set_translated_line\n @translated_line = TranslatedLine.find(params[:id])\n end",
"def create\n @translated_line = TranslatedLine.new(translated_line_params)\n\n respond_to do |format|\n if @translated_line.save\n @tr... | [
"0.76951754",
"0.68859345",
"0.65854",
"0.6497042",
"0.60961044",
"0.60878867",
"0.597386",
"0.59718657",
"0.5930492",
"0.5879088",
"0.5869152",
"0.5867966",
"0.5824931",
"0.58065444",
"0.58065444",
"0.5800783",
"0.5798388",
"0.5790964",
"0.5737335",
"0.56394184",
"0.56394184... | 0.0 | -1 |
POST /translated_lines POST /translated_lines.json | def create
@translated_line = TranslatedLine.new(translated_line_params)
respond_to do |format|
if @translated_line.save
@translated_lines = TranslatedLine.where(translation_code: @translated_line.translation_code)
format.html { redirect_to @translated_line, notice: 'Translated line was successfully created.' }
format.js {}
format.json { render :show, status: :created, location: @translated_line }
else
format.html { render :new }
format.js {}
format.json { render json: @translated_line.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def translated_line_params\n params.require(:translated_line).permit(:translation_code, :description)\n end",
"def index\n @translated_lines = TranslatedLine.all\n end",
"def create\n @textline = Textline.new(textline_params)\n\n respond_to do |format|\n if @textline.save\n format... | [
"0.6830107",
"0.6629822",
"0.6466715",
"0.6433577",
"0.64027274",
"0.6105049",
"0.6046207",
"0.603598",
"0.59943044",
"0.5929162",
"0.5917073",
"0.5837867",
"0.5811325",
"0.57427025",
"0.5715672",
"0.5670065",
"0.5664622",
"0.561393",
"0.5608419",
"0.55941063",
"0.5585981",
... | 0.73388076 | 0 |
PATCH/PUT /translated_lines/1 PATCH/PUT /translated_lines/1.json | def update
respond_to do |format|
if @translated_line.update(translated_line_params)
format.html { redirect_to @translated_line, notice: 'Translated line was successfully updated.' }
format.json { render :show, status: :ok, location: @translated_line }
else
format.html { render :edit }
format.json { render json: @translated_line.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @line = Line.find(params[:id])\n\n respond_to do |format|\n if @line.update_attributes(line_params)\n format.html { redirect_to new_line_path, notice: 'Line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render verb: \"edit\"... | [
"0.6875655",
"0.6616695",
"0.66020405",
"0.66011876",
"0.65923893",
"0.65765464",
"0.64645976",
"0.6454072",
"0.6415003",
"0.6323658",
"0.63188964",
"0.63166213",
"0.6307501",
"0.63050836",
"0.63040924",
"0.6275271",
"0.62743974",
"0.6273326",
"0.6273326",
"0.6273326",
"0.627... | 0.76529455 | 0 |
DELETE /translated_lines/1 DELETE /translated_lines/1.json | def destroy
@translated_line.destroy
respond_to do |format|
format.html { redirect_to translated_lines_url, notice: 'Translated line was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @line = Line.find(params[:id])\n @line.destroy\n\n respond_to do |format|\n format.html { redirect_to new_line_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line = Line.find_by_no(params[:id])\n @line.destroy\n\n respond_to do |format|\n ... | [
"0.70516783",
"0.70286965",
"0.70273167",
"0.6995233",
"0.69291437",
"0.68406737",
"0.67733943",
"0.67655706",
"0.6751633",
"0.67370576",
"0.67370576",
"0.67360646",
"0.67339957",
"0.67239946",
"0.6706351",
"0.66943514",
"0.66928524",
"0.6684665",
"0.6684665",
"0.6684665",
"0... | 0.7962743 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_translated_line
@translated_line = TranslatedLine.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 translated_line_params
params.require(:translated_line).permit(:translation_code, :description)
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 |
================================================================== Instance methods ================================================================== GET /org_invites/1?token=HJuiofjpa45A73255a74F534FDfds | def show
@current_user = current_user
@org_invite = MnoEnterprise::OrgInvite.active.where(id: params[:id], token: params[:token]).first
redirect_path = mnoe_home_path
if @org_invite && !@org_invite.expired? && @org_invite.accept!(current_user)
redirect_path = add_param_to_fragment(redirect_path.to_s, 'dhbRefId', @org_invite.organization.id)
message = { notice: "You are now part of #{@org_invite.organization.name}" }
yield(:success, @org_invite) if block_given?
elsif @org_invite && @org_invite.expired?
message = { alert: "It looks like this invite has expired. Please ask your company administrator to resend the invite." }
else
message = { alert: "Unfortunately, this invite does not seem to be valid." }
end
# Add flash msg in url fragment for the new frontend
type, msg = message.first
type = (type == :alert ? :error : :success)
redirect_path = add_param_to_fragment(redirect_path.to_s, 'flash', [{msg: msg, type: type}.to_json])
redirect_to redirect_path, message
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def invitations\n\t\t@invits = current_user.receive_invites.order(\"id DESC\")\n\tend",
"def show\n @invites = Invite.all\n end",
"def index\n @invites = Invite.all\n end",
"def index\n @invites = Invite.all\n end",
"def index\n @invites = Invite.all\n end",
"def index\n @invites = Inv... | [
"0.72609353",
"0.7234914",
"0.71487516",
"0.71487516",
"0.71487516",
"0.71487516",
"0.71487516",
"0.71000665",
"0.70881003",
"0.7022737",
"0.69611216",
"0.6955616",
"0.6916794",
"0.68843436",
"0.6850335",
"0.6827456",
"0.67587966",
"0.675016",
"0.6744818",
"0.6741207",
"0.668... | 0.62722063 | 45 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.