query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
context.frame_class(frame_position) > obj Returns the real class of the frame. It could be different than context.frame_self(frame).class | def frame_class(frame_position)
#This is a stub, used for indexing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def class\n __getobj__.class\n end",
"def class_obj\n self.class\n end",
"def class\n @object.class\n end",
"def frame_type\n if compiled_code.for_module_body?\n :class\n elsif compiled_code.for_eval?\n :eval\n elsif compiled_code.is_block?\n :block\n ... | [
"0.6841166",
"0.67844445",
"0.66431594",
"0.6633035",
"0.6503256",
"0.6495862",
"0.6471656",
"0.64012927",
"0.64012927",
"0.6306069",
"0.61964923",
"0.60963947",
"0.6046081",
"0.6035812",
"0.6008816",
"0.59466666",
"0.59452647",
"0.59182566",
"0.5909716",
"0.5890969",
"0.5877... | 0.8091036 | 0 |
context.frame_file(frame_position) > string Returns the name of the file. | def frame_file(frame_position)
#This is a stub, used for indexing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_name\n @file_name\n end",
"def file_name\n return unless @file\n\n @file.absolute_name\n end",
"def file_name\n return @file_name\n end",
"def file_name\n return @file_name\n end",
"def filename\n @file.basename.to_s\n ... | [
"0.6973043",
"0.6971838",
"0.6965045",
"0.6965045",
"0.6932965",
"0.69196784",
"0.6850235",
"0.6848409",
"0.6830814",
"0.682201",
"0.68213594",
"0.6813869",
"0.6743784",
"0.6719572",
"0.6713573",
"0.6713573",
"0.67050445",
"0.6685707",
"0.6670357",
"0.66693175",
"0.663121",
... | 0.81086636 | 0 |
context.frame_line(frame_position) > int Returns the line number in the file. | def frame_line(frame_position)
#This is a stub, used for indexing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line_number(pos=pos())\n line_index(pos) + 1\n end",
"def line_number\n\t\t\t@line_index + 1\n\t\tend",
"def line_number(pos=pos)\n line_index(pos) + 1\n end",
"def get_lineno\n RubyVM::Frame.get(1).source_location[0]\n end",
"def line_number\n return unless backtrace and backt... | [
"0.78055876",
"0.7755992",
"0.7704092",
"0.75576514",
"0.7490378",
"0.73755527",
"0.73755527",
"0.73755527",
"0.73755527",
"0.73755527",
"0.73755527",
"0.73755527",
"0.7347998",
"0.7309536",
"0.72831947",
"0.72744715",
"0.72093606",
"0.7189329",
"0.7166153",
"0.71587354",
"0.... | 0.8047079 | 0 |
context.frame_locals(frame) > hash Returns frame's local variables. | def frame_locals(frame)
#This is a stub, used for indexing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def locals; list_all :local_variables; end",
"def thread_variables\n _locals.keys\n end",
"def locals; end",
"def locals; end",
"def locals; end",
"def __locals__\n\t\t\treturn @locals\n\t\tend",
"def locals\n @locals\n end",
"def locals\n @locals ||= var_names.inject({}) { |... | [
"0.77082175",
"0.76400006",
"0.72611445",
"0.72611445",
"0.72611445",
"0.7157868",
"0.7102354",
"0.7015761",
"0.6967654",
"0.6944298",
"0.6852519",
"0.6723926",
"0.670076",
"0.6495826",
"0.6437939",
"0.6430348",
"0.6403234",
"0.63445",
"0.6321381",
"0.618346",
"0.61575264",
... | 0.84521586 | 0 |
context.frame_self(frame_postion=0) > obj Returns self object of the frame. | def frame_self(frame_postion=0)
#This is a stub, used for indexing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def frame\n context.frame\n end",
"def parent_frame; end",
"def current_frame\n @current_frame\n end",
"def frame; end",
"def current_frame\n @callstack.top\n end",
"def framing\n previous, klass.current_frame = klass.current_frame, self unless @delegate_to_klass\n y... | [
"0.6888421",
"0.66337323",
"0.6450572",
"0.62021834",
"0.60720646",
"0.5795501",
"0.5717279",
"0.57076037",
"0.56626725",
"0.5636085",
"0.5621443",
"0.5617217",
"0.54911166",
"0.5490457",
"0.5472701",
"0.54706264",
"0.5400071",
"0.53982496",
"0.53850675",
"0.5377918",
"0.5377... | 0.8206493 | 0 |
context.breakpoint > breakpoint Returns a contextspecific temporary Breakpoint object. | def breakpoint()
#This is a stub, used for indexing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trigger_breakpoint\n local_var = 6 * 7\n local_var\n end",
"def breakpoint_recipe\n recipe = tag_value(BREAKPOINT_TAG)\n end",
"def breakpoint?\n type == :breakpoint\n end",
"def at_breakpoint(_context, breakpoint)\n @pry ||= Pry.new\n\n output.puts bold(\"\\n ... | [
"0.5904971",
"0.5815545",
"0.5795219",
"0.5714498",
"0.5683567",
"0.56551725",
"0.558995",
"0.5456799",
"0.5372047",
"0.5334532",
"0.5299026",
"0.52380884",
"0.52353644",
"0.5232896",
"0.51969177",
"0.5178399",
"0.5041989",
"0.4962011",
"0.4955807",
"0.4946382",
"0.49107388",... | 0.5933007 | 0 |
context.set_breakpoint(source, pos, condition = nil) > breakpoint Sets a contextspecific temporary breakpoint, which can be used to implement 'Run to Cursor' debugger function. When this breakpoint is reached, it will be cleared out. source is a name of a file or a class. pos is a line number or a method name if source... | def set_breakpoint(source, pos, condition = nil)
#This is a stub, used for indexing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_breakpoint(ip, obj)\n Rubinius.primitive :compiledmethod_set_breakpoint\n raise ArgumentError, \"Unable to set breakpoint on #{inspect} at invalid bytecode address #{ip}\"\n end",
"def set_breakpoint(cm, ip, condition=nil)\n @breakpoint_tracker.on(cm, :ip => ip, :condition => condition)... | [
"0.65271884",
"0.64223367",
"0.6004352",
"0.5726392",
"0.571453",
"0.5707155",
"0.55803555",
"0.5499485",
"0.54797536",
"0.5444156",
"0.5350357",
"0.53241324",
"0.5284938",
"0.5269735",
"0.5241717",
"0.51789045",
"0.51789045",
"0.517114",
"0.517083",
"0.5162147",
"0.51480013"... | 0.83013994 | 0 |
context.jump(line, file) > bool Returns +true+ if jump to +line+ in filename +file+ was successful. | def jump(line, file)
#This is a stub, used for indexing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perform_jump target_position \n if valid_jump?(target_position) \n move!(target_position)\n return true\n else\n return false\n end \n end",
"def jump(line)\n return line[/(JGT)|(JEQ)|(JGE)|(JLT)|(JNE)|(JLE)|(JMP)/]\n end",
"def jump(x)\n @memory_positio... | [
"0.6069243",
"0.5998537",
"0.5541006",
"0.5540809",
"0.5530144",
"0.5520676",
"0.5498452",
"0.53928334",
"0.53591007",
"0.5335214",
"0.5335214",
"0.5335214",
"0.5328756",
"0.5308026",
"0.5305975",
"0.52961266",
"0.5288643",
"0.5285649",
"0.52650374",
"0.52254456",
"0.5215955"... | 0.785503 | 0 |
POST /oeuvres POST /oeuvres.json | def create
@oeuvre = Oeuvre.new(oeuvre_params)
respond_to do |format|
if @oeuvre.save
format.html { redirect_to oeuvres_url, notice: 'Oeuvre was successfully created.' }
format.json { render :show, status: :created, location: @oeuvre }
else
format.html { render :new }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @eou = Eou.new(params[:eou])\n\n respond_to do |format|\n if @eou.save\n format.html { redirect_to @eou, :notice => 'Eou was successfully created.' }\n format.json { render :json => @eou, :status => :created, :location => @eou }\n else\n format.html { render :actio... | [
"0.65751946",
"0.6121014",
"0.6015937",
"0.5962933",
"0.59413034",
"0.5875519",
"0.58721125",
"0.58629787",
"0.5771861",
"0.5770713",
"0.5741544",
"0.57217324",
"0.57146966",
"0.5704892",
"0.5699557",
"0.56834674",
"0.5683171",
"0.5682106",
"0.5682001",
"0.56388855",
"0.56314... | 0.705001 | 0 |
PATCH/PUT /oeuvres/1 PATCH/PUT /oeuvres/1.json | def update
respond_to do |format|
if @oeuvre.update(oeuvre_params)
format.html { redirect_to oeuvres_url, notice: 'Oeuvre was successfully updated.' }
format.json { render :show, status: :ok, location: @oeuvre }
else
format.html { render :edit }
format.json { render json:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_j... | [
"0.6602089",
"0.64328027",
"0.64328027",
"0.63856256",
"0.63209045",
"0.6279602",
"0.6263304",
"0.6230885",
"0.6223406",
"0.62230164",
"0.6217524",
"0.6205897",
"0.61967963",
"0.6174193",
"0.6151592",
"0.61368465",
"0.6135063",
"0.6130397",
"0.6130397",
"0.6126867",
"0.611622... | 0.6475902 | 1 |
DELETE /oeuvres/1 DELETE /oeuvres/1.json | def destroy
@oeuvre.destroy
respond_to do |format|
format.html { redirect_to oeuvres_url, notice: 'Oeuvre was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @eou = Eou.find(params[:id])\n @eou.destroy\n\n respond_to do |format|\n format.html { redirect_to eous_url }\n format... | [
"0.7081451",
"0.70353186",
"0.7027126",
"0.69298726",
"0.6929632",
"0.6922146",
"0.6904657",
"0.6898908",
"0.68711233",
"0.6864661",
"0.6844306",
"0.6844214",
"0.6801516",
"0.67987704",
"0.67898566",
"0.67778903",
"0.6774174",
"0.67641497",
"0.6762674",
"0.6760893",
"0.675248... | 0.706301 | 1 |
Represent topic name into more subdomain computable name ie. convert "some_sub_domain" => "some.sub.domain" | def subdomain
self.name.gsub('_', '.')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subscription_name(topic)\n [\n Cloudenvoy.config.gcp_sub_prefix.tr('.', '-'),\n to_s.underscore,\n topic\n ].join('.')\n end",
"def subdomain\n ([self.short_name] + self.class.dalianshops.domain.split('.')[1..-1]).join('.')\n end",
"def kafka_topic\n ... | [
"0.72965014",
"0.6988587",
"0.6768562",
"0.6627067",
"0.6584972",
"0.65301865",
"0.6466345",
"0.6387129",
"0.6382305",
"0.6339963",
"0.62927586",
"0.6291936",
"0.62900627",
"0.62449116",
"0.6220833",
"0.6210845",
"0.61967146",
"0.6188476",
"0.61666447",
"0.61618036",
"0.61551... | 0.7384525 | 0 |
Retrieve configuration for the specific +bind_column+ Parameters +bind_column+ this column must be database specific column which are mapped over topic module editor | def module_conf(bind_column)
(self.modules && self.modules.reject{|m| m['bind_column'] != bind_column} || []).first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attributes_from_column_definition\n connection.columns(self.class.table_name, \"#{self.class.name} Columns\").inject({}) do |attributes, column| \n attributes[column.name] = column.default unless column.name == self.class.primary_key\n attributes\n end\n end",
"def param_... | [
"0.607832",
"0.5938183",
"0.5938183",
"0.5878744",
"0.5772138",
"0.5627764",
"0.56144506",
"0.5562231",
"0.551527",
"0.54989916",
"0.5496054",
"0.54786575",
"0.5478362",
"0.5466566",
"0.54485303",
"0.54111636",
"0.54111636",
"0.54060495",
"0.53760076",
"0.5370765",
"0.5370765... | 0.78422457 | 0 |
Determine the default host, right now the implementation is based on the +self.host_list+ array pop | def default_host
host_list.first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __default_network_host\n case version\n when /^0|^1/\n '0.0.0.0'\n when /^2/\n '_local_'\n when /^5|^6|^7/\n '_local_'\n else\n raise RuntimeError, \"Cannot determine default network host ... | [
"0.72735935",
"0.6941687",
"0.6821452",
"0.6769229",
"0.66150844",
"0.6552732",
"0.6551716",
"0.6485285",
"0.64794743",
"0.64747006",
"0.647166",
"0.6450836",
"0.6328337",
"0.6321317",
"0.62927413",
"0.62217975",
"0.62217975",
"0.6194194",
"0.61882544",
"0.6160568",
"0.614671... | 0.8442449 | 0 |
To convert +self.hosts+ string into an array of hosts Space and Comma will be used for splitting host string | def host_list
return @host_list if defined?(@host_list)
if !self.hosts.blank?
@host_list = self.hosts.split(/[,\s]+/).compact
else
@host_list = []
end
@host_list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hosts\n @hosts ||= match[5].split(\",\")\n end",
"def hosts\n @hosts ||= match[5].split(\",\")\n end",
"def parse_host\n args = ENV['host'].split(',')\n hosts = []\n args.each do |arg|\n if XP5K::Role.listnames.include? arg\n hosts << roles(arg)\n else\n hosts << arg\... | [
"0.7645588",
"0.7611563",
"0.69714254",
"0.69393563",
"0.68265784",
"0.6807716",
"0.667483",
"0.66286397",
"0.6544973",
"0.64959383",
"0.6479369",
"0.6462997",
"0.640546",
"0.63898665",
"0.63881177",
"0.63881177",
"0.6363278",
"0.62512976",
"0.62368053",
"0.61782664",
"0.6169... | 0.76323605 | 1 |
private. if json_item is a tweet, yield the screen_name/tweet_text/created_at and stop the event loop if block returns true | def yield_if_tweet event_machine, json_item, &block
raise "expecting a block" unless block_given?
parsed_item = JSON.parse json_item rescue nil
screen_name = parsed_item['user']['screen_name'] rescue nil
tweet_text = parsed_item['text'] rescue nil
created_at = parsed_item['created_at'] rescue nil
yield scre... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def yield_if_tweet_expected_result event_machine, tweet_json, block\n if VALID_TWEET_JSONS.include? tweet_json\n tweet = JSON.parse tweet_json\n block.should_receive(:call).with(\n tweet['user']['screen_name'],\n tweet['text'],\n ... | [
"0.6949207",
"0.64927477",
"0.60019374",
"0.5947612",
"0.59278",
"0.5870051",
"0.5854295",
"0.5805398",
"0.5805398",
"0.57716703",
"0.5763828",
"0.572082",
"0.5703999",
"0.5678686",
"0.5584568",
"0.55102164",
"0.5506693",
"0.54874146",
"0.5452923",
"0.5438115",
"0.54080975",
... | 0.8055968 | 0 |
synchronously consume a twitter stream and pass each received json_item to yield_if_tweet must be called inside EventMachine::run | def twitter_stream twitter_login, content, &block
raise "expecting a block" unless block_given?
stream = Twitter::JSONStream.connect(
:path => "/1/statuses/filter.json?#{content}",
:auth => twitter_login,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def yield_if_tweet_expected_result event_machine, tweet_json, block\n if VALID_TWEET_JSONS.include? tweet_json\n tweet = JSON.parse tweet_json\n block.should_receive(:call).with(\n tweet['user']['screen_name'],\n tweet['text'],\n ... | [
"0.7256029",
"0.70286655",
"0.646895",
"0.63333905",
"0.62585324",
"0.62279046",
"0.6098446",
"0.6029502",
"0.5943028",
"0.58155",
"0.57994074",
"0.5742635",
"0.5619084",
"0.560768",
"0.560768",
"0.55853134",
"0.55839205",
"0.55636984",
"0.5503414",
"0.5481706",
"0.54537183",... | 0.76845294 | 0 |
GET admin/subcategorias/1 GET admin/subcategorias/1.json | def show
@subcategoria = Subcategoria.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @subcategoria }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_subcategories\r\n sub_categories = Taxonomy.get_subcategories\r\n render json: sub_categories, root: 'categories', adapter: :json, status: :ok\r\n end",
"def index\n @subcategoria = Subcategorium.all\n end",
"def index\n @subcategorias = Subcategoria.where(:status_id => Status.find_by_des... | [
"0.78520715",
"0.72496635",
"0.7060617",
"0.69838023",
"0.69838023",
"0.6981387",
"0.69262105",
"0.68186426",
"0.67675656",
"0.6748878",
"0.67262447",
"0.67148143",
"0.66815466",
"0.66184074",
"0.6611248",
"0.6583696",
"0.6575992",
"0.65722144",
"0.65720403",
"0.65720403",
"0... | 0.7329704 | 1 |
GET admin/subcategorias/new GET admin/subcategorias/new.json | def new
@subcategoria = Subcategoria.new
@subcategoria.status = Status.find_by_descricao('Ativo')
respond_to do |format|
format.html # new.html.erb
format.json { render :json => @subcategoria }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @subcategoria = Subcategoria.new(params[:subcategoria])\n\n respond_to do |format|\n if @subcategoria.save\n format.html { redirect_to [:admin, @subcategoria], :notice => 'Subcategorias was successfully created.' }\n format.json { render :json => @subcategoria, :status => :cre... | [
"0.7911613",
"0.743415",
"0.7307682",
"0.72365785",
"0.7197062",
"0.7120203",
"0.71024257",
"0.7053368",
"0.6982711",
"0.69136745",
"0.6885708",
"0.68805534",
"0.6874008",
"0.68499976",
"0.6820402",
"0.681752",
"0.6784847",
"0.67815685",
"0.6745871",
"0.6700839",
"0.6664444",... | 0.75399053 | 1 |
POST admin/subcategorias POST admin/subcategorias.json | def create
@subcategoria = Subcategoria.new(params[:subcategoria])
respond_to do |format|
if @subcategoria.save
format.html { redirect_to [:admin, @subcategoria], :notice => 'Subcategorias was successfully created.' }
format.json { render :json => @subcategoria, :status => :created, :loca... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_subcategories\r\n sub_categories = Taxonomy.get_subcategories\r\n render json: sub_categories, root: 'categories', adapter: :json, status: :ok\r\n end",
"def create\n @subcategoriaproduto = Subcategoriaproduto.new(subcategoriaproduto_params)\n\n respond_to do |format|\n if @subcategoria... | [
"0.7047645",
"0.6847077",
"0.679358",
"0.6687973",
"0.6637772",
"0.6606623",
"0.6606623",
"0.655284",
"0.64979273",
"0.64876026",
"0.63719493",
"0.63631874",
"0.63612616",
"0.636099",
"0.6360084",
"0.6335856",
"0.63269174",
"0.63246834",
"0.6304423",
"0.6275888",
"0.62607706"... | 0.7745041 | 0 |
PUT admin/subcategorias/1 PUT admin/subcategorias/1.json | def update
@subcategoria = Subcategoria.find(params[:id])
respond_to do |format|
if @subcategoria.update_attributes(params[:subcategoria])
format.html { redirect_to [:admin, @subcategoria], :notice => 'Exemplo was successfully updated.' }
format.json { head :ok }
else
format... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_subcategoriaproduto\n @subcategoriaproduto = Subcategoriaproduto.find(params[:id])\n end",
"def destroy\n @subcategoria = Subcategoria.find(params[:id])\n @subcategoria.update_attributes :status => Status.find_by_descricao('Inativo')\n\n respond_to do |format|\n format.html { redire... | [
"0.67660546",
"0.6665121",
"0.6589681",
"0.6530966",
"0.6484948",
"0.6484031",
"0.642324",
"0.63102955",
"0.62614506",
"0.62503475",
"0.62429935",
"0.622766",
"0.6195117",
"0.6191038",
"0.61899304",
"0.6177532",
"0.6157294",
"0.61142164",
"0.6073973",
"0.60616064",
"0.6054414... | 0.7165695 | 0 |
DELETE admin/subcategorias/1 DELETE admin/subcategorias/1.json | def destroy
@subcategoria = Subcategoria.find(params[:id])
@subcategoria.update_attributes :status => Status.find_by_descricao('Inativo')
respond_to do |format|
format.html { redirect_to admin_subcategorias_path }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @subcategorium.destroy\n respond_to do |format|\n format.html { redirect_to subcategoria_url, notice: 'Subcategorium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subcategoriaproduto.destroy\n respond_to do |format|\n ... | [
"0.75051934",
"0.74020326",
"0.72237676",
"0.7208124",
"0.7116253",
"0.707014",
"0.7044123",
"0.7037415",
"0.701259",
"0.69816613",
"0.69666797",
"0.69357365",
"0.6919372",
"0.69000286",
"0.68934655",
"0.68713176",
"0.68713176",
"0.6838041",
"0.6804099",
"0.6800271",
"0.67993... | 0.7596678 | 0 |
=== Get dam asset locations. Get an asset locations in dam. ==== Parameters options:: (Hash) List of Resource Collection Options shown above can be used as parameter. ==== Example | def get_dam_asset_locations(options)
return @client.raw("get", "/content/dam/asset-locations", options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dam_asset_locations(options)\n @client.raw('get', '/content/dam/asset-locations', options)\n end",
"def get_locations\n response = execute_get(\"/reference/location\")\n Location.from_array(decode(response))\n end",
"def locations\n get('locations')\n end",
"def locations\n locati... | [
"0.8488438",
"0.57955",
"0.5677553",
"0.55002034",
"0.54844093",
"0.54472375",
"0.5442431",
"0.5437008",
"0.5427946",
"0.53901917",
"0.5362195",
"0.53513926",
"0.532409",
"0.5278933",
"0.52642304",
"0.52588516",
"0.523901",
"0.5216819",
"0.51875335",
"0.51777947",
"0.5163046"... | 0.85243255 | 0 |
GET /meter_readings/1 GET /meter_readings/1.json | def show
@meter_reading = MeterReading.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @meter_reading }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n\n @breadcrumb = 'read'\n @meter_detail = MeterDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meter_detail }\n end\n end",
"def get_reading\n\t\turi = URI.parse('http://localhost:5000/thermometers.json... | [
"0.7321423",
"0.7047203",
"0.65984094",
"0.6315445",
"0.6308911",
"0.62986785",
"0.6194976",
"0.6190155",
"0.615303",
"0.6105525",
"0.6070515",
"0.6067238",
"0.6043172",
"0.6040204",
"0.601301",
"0.5969378",
"0.5967162",
"0.59396607",
"0.5920596",
"0.59110016",
"0.5902001",
... | 0.72620803 | 1 |
GET /meter_readings/new GET /meter_readings/new.json | def new
@meter_reading = MeterReading.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @meter_reading }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @breadcrumb = 'create'\n @meter_detail = MeterDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meter_detail }\n end\n end",
"def new\n @meter = Meter.new\n\n respond_to do |format|\n format.html # new.html.e... | [
"0.77021813",
"0.7653779",
"0.7373608",
"0.7189721",
"0.70060384",
"0.69531983",
"0.68428296",
"0.6835296",
"0.6794437",
"0.6791819",
"0.67398715",
"0.67276716",
"0.6721902",
"0.6653376",
"0.6624761",
"0.66114044",
"0.6595114",
"0.6571319",
"0.6571319",
"0.6561486",
"0.655079... | 0.80487096 | 0 |
PUT /meter_readings/1 PUT /meter_readings/1.json | def update
@meter_reading = MeterReading.find(params[:id])
respond_to do |format|
if @meter_reading.update_attributes(params[:meter_reading])
format.html { redirect_to @meter_reading, notice: 'Meter reading was successfully updated.' }
format.json { head :no_content }
else
f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @breadcrumb = 'update'\n @reading = Reading.find(params[:id])\n @meter = @reading.meter\n if !@meter.blank?\n # All associations\n @subscriber = Subscriber.find(params[:reading][:subscriber_id]) rescue nil\n @service_point = ServicePoint.find(params[:reading][:... | [
"0.65169436",
"0.6498924",
"0.6498924",
"0.6389953",
"0.6335035",
"0.62145007",
"0.61789846",
"0.6128459",
"0.61075324",
"0.605506",
"0.60500616",
"0.6036591",
"0.6012739",
"0.6010731",
"0.59051543",
"0.5899968",
"0.5878855",
"0.5832523",
"0.58069897",
"0.5760235",
"0.5757625... | 0.6789502 | 0 |
DELETE /meter_readings/1 DELETE /meter_readings/1.json | def destroy
@meter_reading = MeterReading.find(params[:id])
@meter_reading.destroy
respond_to do |format|
format.html { redirect_to meter_readings_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @meter = Meter.find(params[:id])\n @meter.destroy\n\n respond_to do |format|\n format.html { redirect_to meters_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @meter_detail = MeterDetail.find(params[:id])\n @meter_detail.destroy\n\n respo... | [
"0.71170205",
"0.6979495",
"0.6908651",
"0.6817422",
"0.67399347",
"0.6729359",
"0.66951615",
"0.66951436",
"0.66698533",
"0.6635528",
"0.6617531",
"0.66143924",
"0.65584147",
"0.6533191",
"0.6533191",
"0.6508556",
"0.6496336",
"0.6466591",
"0.64661485",
"0.6452018",
"0.64506... | 0.7674331 | 0 |
Call delete attachment method of message to delete document from backoffice | def delete_document(doc_refno)
@message.delete_attachment(current_user, doc_refno)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n model.delete_attachment(@path)\n end",
"def destroy_attachment\n a = Attachment.find(1) rescue nil\n if !a.nil?\n a.destroy\n end\n end",
"def documentremove\n if self.documents.attached?\n document_urls = self.documents.map do |adoc| \n Rails.applic... | [
"0.768501",
"0.71587837",
"0.71533173",
"0.713661",
"0.7131105",
"0.71274954",
"0.70092916",
"0.69691586",
"0.6954067",
"0.69525635",
"0.69525635",
"0.6822212",
"0.6814294",
"0.6794063",
"0.6794063",
"0.6794063",
"0.6793872",
"0.67922664",
"0.67784137",
"0.6775853",
"0.677585... | 0.76360685 | 1 |
Retrieve file from backoffice | def retrieve_file_attachment
return unless params[:doc_refno] || params[:type]
success, attachments = retrieve_file_details_from_backoffice
return unless success
send_file_from_attachment(attachments[:attachment])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retrieve_file_details_from_backoffice\n Message.retrieve_file_attachment(current_user, params[:doc_refno], params[:type])\n end",
"def get\n file\n end",
"def get_file(foreign_ref)\n set_client\n\n # return file data\n if service.downcase.include? \"dropbox\"\n begin\n ... | [
"0.82037985",
"0.71418154",
"0.6986108",
"0.67921126",
"0.6694361",
"0.6694361",
"0.6661249",
"0.6661249",
"0.6661249",
"0.6661249",
"0.66477317",
"0.66423404",
"0.6641619",
"0.66347486",
"0.66117734",
"0.66040397",
"0.66033584",
"0.6547102",
"0.65322673",
"0.65019375",
"0.64... | 0.75429785 | 1 |
which file types are allowed to be uploaded. | def content_type_allowlist
Rails.configuration.x.file_upload_content_type_allowlist.split(/\s*,\s*/)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_file_types\n Rails.configuration.allowed_file_types\n end",
"def can_upload?\n klass.model_class && mime_types && mime_types.keys.include?(file_mime_type)\n end",
"def supported(files)\n files.select { |f| SUPPORTED_TYPES.include?(f.extname.delete('.')) }\n end",
"def accepted... | [
"0.8067096",
"0.7317975",
"0.7197458",
"0.7190943",
"0.6985637",
"0.69696194",
"0.69696194",
"0.69696194",
"0.69696194",
"0.69696194",
"0.69696194",
"0.6968352",
"0.6929568",
"0.68622184",
"0.67643386",
"0.6759797",
"0.67569244",
"0.67030466",
"0.6698979",
"0.6690163",
"0.666... | 0.7837272 | 1 |
Used specifically for show method to filter message | def show_message_filter
MessageFilter.new(selected_message_smsg_refno: @message.smsg_refno,
smsg_original_refno: @message.original_smsg_refno)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n begin\n @message = Message.find(params[:id])\n rescue\n not_found and return\n end\n @message.visible_to = @message.flaggings.with_flag(:visible_to)\n @message.ip_info.gsub!(/,|:/, \"\\\\0 \").gsub!('\"\"', '(n/a)').gsub!(/\\{|\\}|\"/, \"\") unless @message.ip_info.nil?\n\n i... | [
"0.6923018",
"0.6533215",
"0.64087355",
"0.6391774",
"0.6131135",
"0.6029347",
"0.60043466",
"0.59961784",
"0.59619915",
"0.59567344",
"0.59397507",
"0.5935453",
"0.5902581",
"0.5849988",
"0.58453596",
"0.5834901",
"0.5834901",
"0.5834901",
"0.5817324",
"0.5817324",
"0.581732... | 0.755372 | 0 |
POST /pm/nodes POST /pm/nodes.json | def create
@pm_node = Pm::Node.new(pm_node_params)
respond_to do |format|
if @pm_node.save
format.html { redirect_to @pm_node, notice: 'Node was successfully created.' }
format.json { render :show, status: :created, location: @pm_node }
else
format.html { render :new }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_missing(method, *args, &block)\n data = { method: method, parameters: args }\n request.post(path: nodes_path, data: data, auth_token: auth_token)\n end",
"def create_nodes(nodes)\n nodes.each do |node|\n (raise CloudLB::Exception::MissingArgument, \"Must provide :address for a... | [
"0.7167608",
"0.6996519",
"0.69445604",
"0.68515563",
"0.68202585",
"0.6769154",
"0.67286754",
"0.66552764",
"0.66552764",
"0.66552764",
"0.6629944",
"0.66239005",
"0.65775156",
"0.65345186",
"0.65146667",
"0.64988273",
"0.64807045",
"0.6459999",
"0.64433324",
"0.6435111",
"0... | 0.7191648 | 0 |
PATCH/PUT /pm/nodes/1 PATCH/PUT /pm/nodes/1.json | def update
respond_to do |format|
if @pm_node.update(pm_node_params)
format.html { redirect_to @pm_node, notice: 'Node was successfully updated.' }
format.json { render :show, status: :ok, location: @pm_node }
else
format.html { render :edit }
format.json { render json: @... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n authorize! :manage, @node\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to @node, notice: 'Node was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n ... | [
"0.6675063",
"0.6586168",
"0.6581259",
"0.65767145",
"0.65767145",
"0.65767145",
"0.65448654",
"0.65425414",
"0.6540101",
"0.6540101",
"0.6540101",
"0.6479884",
"0.64760935",
"0.6446388",
"0.6410545",
"0.6367041",
"0.634948",
"0.6241918",
"0.62344617",
"0.6227126",
"0.6224563... | 0.69978875 | 0 |
DELETE /pm/nodes/1 DELETE /pm/nodes/1.json | def destroy
@pm_node.destroy
respond_to do |format|
format.html { redirect_to pm_nodes_url, notice: 'Node was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @node = Node.find_key(params[:id] || params[:name])\n @node.destroy\n respond_to do |format|\n format.html { redirect_to deployment_path(@node.deployment_id) }\n format.json { render api_delete @node }\n end\n end",
"def destroy\n chef_server_rest.delete(\"nodes/#{name}\... | [
"0.7258929",
"0.725263",
"0.71837646",
"0.71633816",
"0.7111229",
"0.71105987",
"0.71105987",
"0.71105987",
"0.70422876",
"0.7019231",
"0.69978327",
"0.6996421",
"0.69772583",
"0.6964292",
"0.6924297",
"0.69151676",
"0.69066286",
"0.68442446",
"0.6842221",
"0.6842221",
"0.684... | 0.7406122 | 0 |
Update token sale ended variable Author:Aman Date: 31/10/2017 Reviewed By: Kedar | def update_token_sale_ended_data
sale_variable_obj = SaleGlobalVariable.sale_ended.first
sale_variable_obj.variable_data = '1'
sale_variable_obj.save!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_token\n update_columns(token: set_token, updated_at: Time.current)\n end",
"def new_token\n update_columns(token: set_token, updated_at: Time.current)\n end",
"def perform\n _perform do\n update_token_sale_ended_data\n end\n end",
"def update_token(token)\n DB[:Toke... | [
"0.6041524",
"0.6040474",
"0.6026158",
"0.58346725",
"0.57031304",
"0.556283",
"0.55573416",
"0.5529503",
"0.55120885",
"0.54810435",
"0.54792607",
"0.54792607",
"0.54490316",
"0.539904",
"0.53811127",
"0.5368417",
"0.535266",
"0.5350358",
"0.53451127",
"0.53348583",
"0.53060... | 0.7427053 | 0 |
Returns the path to the response file | def response_file
@notifier_engine.response_file
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def response_uri(file)\n file.base_uri\n end",
"def get_file_path\n @path\n end",
"def path\n metadata.fetch(:path) do\n return if request_response_pairs.empty?\n request_response_pairs.first.first.path\n end\n end",
"def path\n file.url\n end",
... | [
"0.69164526",
"0.68736947",
"0.6842221",
"0.67960364",
"0.67575",
"0.6753498",
"0.6738247",
"0.6712754",
"0.6701456",
"0.6618752",
"0.6607714",
"0.656819",
"0.6522459",
"0.65216684",
"0.65156937",
"0.65154207",
"0.65076214",
"0.64752626",
"0.64742196",
"0.6417601",
"0.6416827... | 0.77882975 | 0 |
Adds a lock file to mark the given file as locked | def lock_file file
file_lock = file + ".lock"
open(file_lock, "w") {}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_lock\n FileUtils.touch(@lock_file)\n end",
"def set_lock\n if File.exists? lock_file_name\n false\n else\n FileUtils.touch lock_file_name\n true\n end\n end",
"def lock(name)\n lock_file = $lock_dir + '/' + name\n unless FileTest.exist?(lock_file)\n ... | [
"0.74842393",
"0.723057",
"0.69049996",
"0.6763062",
"0.6742792",
"0.66182196",
"0.6540233",
"0.6536679",
"0.6534776",
"0.6415368",
"0.6392145",
"0.637959",
"0.6365999",
"0.6349172",
"0.6322275",
"0.63093495",
"0.62923115",
"0.6253187",
"0.6200376",
"0.6192895",
"0.6117079",
... | 0.7412491 | 1 |
Deletes a lock file to mark the given file as unlocked | def unlock_file file
file_lock = file + ".lock"
File.delete(file_lock) if FileTest::file? file_lock
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unlock!\n FileUtils.rm_f @path\n end",
"def remove_lock\n File.delete(@lock_file)\n end",
"def delete\n File::unlink @path+\".lock\" rescue nil\n File::unlink @path+\".new\" rescue nil\n File::unlink @path rescue nil\n end",
"def delete\n File::unlink @path+\".loc... | [
"0.80032617",
"0.79791397",
"0.7829483",
"0.78129536",
"0.7449344",
"0.7435107",
"0.7431346",
"0.7348802",
"0.73211664",
"0.7310665",
"0.7248773",
"0.7200551",
"0.7200551",
"0.7197581",
"0.7130013",
"0.7085734",
"0.70229983",
"0.6945256",
"0.6914487",
"0.69054306",
"0.6878646... | 0.80220586 | 0 |
Checks for a lock file to see if the given file is marked as locked | def is_locked? file
file_lock = file + ".lock"
FileTest::file? file_lock
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def locked?\n File.exist?(lock_file)\n end",
"def locked?\n File.exist?(lock_file)\n end",
"def unlocked?\n ! File.exist?(lock_file)\n end",
"def lock_file_present?(lfname)\n begin\n # TODO check lock file age and send a warning if it is older than a\n # given thr... | [
"0.8242603",
"0.8170683",
"0.7804606",
"0.77444834",
"0.7585008",
"0.745492",
"0.7408756",
"0.7318413",
"0.725163",
"0.7199684",
"0.7184479",
"0.6885824",
"0.684168",
"0.6773479",
"0.6763866",
"0.67473966",
"0.6743399",
"0.67100096",
"0.66962045",
"0.6685964",
"0.6681089",
... | 0.84481305 | 0 |
Removes emails that have lived in the queue for too long. If max_age is set to 0, no emails will be removed. | def cleanup
return if @max_age == 0
timeout = Time.now - @max_age
conditions = ['last_send_attempt > 0 and created_on < ?', timeout]
mail = ActionMailer::Base.email_class.destroy_all conditions
log "expired #{mail.length} emails from the queue"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def purge\n t = Time.now\n expired = []\n @queue.each do |identity,worker|\n expired << identity if t > worker.expiry\n end\n expired.each do |identity|\n @queue.delete identity\n end\n end",
"def check_message_age\n return unless @mode == :max_age\n\n @history_mutex.synchroniz... | [
"0.63043463",
"0.6104571",
"0.60924995",
"0.59141535",
"0.58153975",
"0.5702343",
"0.5679355",
"0.56576204",
"0.56454504",
"0.55729336",
"0.5532184",
"0.5510853",
"0.54192036",
"0.53731483",
"0.53593457",
"0.52464926",
"0.52125144",
"0.5202066",
"0.5199674",
"0.51825273",
"0.... | 0.7539608 | 0 |
Installs signal handlers to gracefully exit. | def install_signal_handlers
trap 'TERM' do do_exit end
trap 'INT' do do_exit end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register_signal_handlers\n trap('TERM') { shutdown }\n trap('INT') { shutdown }\n trap('QUIT') { shutdown }\n trap 'SIGHUP', 'IGNORE'\n end",
"def register_signal_handlers!\n trap('TERM') { shutdown }\n trap('INT') { shutdown }\n end",
"def register_signal_handlers\r... | [
"0.8189762",
"0.8168444",
"0.8119747",
"0.80708",
"0.7970652",
"0.78447163",
"0.7837409",
"0.7819602",
"0.77881527",
"0.7617676",
"0.7567327",
"0.7396383",
"0.7375882",
"0.7375882",
"0.73699605",
"0.723577",
"0.7232138",
"0.7231227",
"0.7207219",
"0.71948266",
"0.71801347",
... | 0.83130765 | 0 |
Scans for emails and delivers them every delay seconds. Only returns if once is true. | def run
install_signal_handlers
loop do
begin
cleanup
emails = find_emails
deliver(emails) unless emails.empty?
rescue ActiveRecord::Transactions::TransactionError
end
break if @once
sleep @delay
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mail_flush\n @mails_mutex.synchronize do\n self.log_puts(\"Flushing mails.\") if @debug\n \n if @mails_waiting.empty?\n self.log_puts(\"No mails to flush - skipping.\") if @debug\n return false\n end\n \n self.log_puts(\"Trying to ping Google to figure out if we a... | [
"0.63550395",
"0.6347368",
"0.626558",
"0.59199774",
"0.5908429",
"0.587785",
"0.5820501",
"0.5771507",
"0.57566583",
"0.57563657",
"0.57034516",
"0.5688156",
"0.56687874",
"0.5662345",
"0.5656551",
"0.56368244",
"0.56352085",
"0.56224275",
"0.5572542",
"0.5552031",
"0.554981... | 0.6537431 | 0 |
Proxy to ActionMailer::Base::smtp_settings. See for instructions on how to configure ActionMailer's SMTP server. Falls back to ::server_settings if ::smtp_settings doesn't exist for backwards compatibility. | def smtp_settings
ActionMailer::Base.smtp_settings rescue ActionMailer::Base.server_settings
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def smtp_settings\n {\n address: smtp_host,\n password: smtp_password,\n port: smtp_port,\n user_name: smtp_username\n }\n end",
"def ar_mailer_smtp_settings(new_settings = nil)\n ar_mailer_setting(:smtp_settings, new_settings)\n end",
"def config_mail\n ActionMailer::Base.rai... | [
"0.7337555",
"0.70797634",
"0.6887633",
"0.68011665",
"0.647581",
"0.61760986",
"0.61746866",
"0.6158605",
"0.61229014",
"0.61000836",
"0.5971139",
"0.5930409",
"0.5810709",
"0.5719685",
"0.5672785",
"0.56592274",
"0.5651816",
"0.5587288",
"0.55766714",
"0.55448157",
"0.55086... | 0.7799035 | 0 |
Returns the configured user name or the user name of the authenticated user | def get_username
@user_name ||= self.user.username
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hubssolib_get_user_name\n user = self.hubssolib_current_user\n user ? user.user_real_name : nil\n end",
"def current_user_name\n logged_in? ? (user_name(current_user_id) || current_user_id) : nil\n end",
"def user_name\n user ? user.name : ''\n end",
"def user_name\n user ? user.n... | [
"0.78359973",
"0.78038925",
"0.7777572",
"0.7777572",
"0.7777572",
"0.7777572",
"0.7777572",
"0.7777572",
"0.7777572",
"0.7777572",
"0.7777572",
"0.7777572",
"0.7578591",
"0.75677633",
"0.7562504",
"0.75109655",
"0.75097305",
"0.7488156",
"0.7485541",
"0.74659586",
"0.7445601... | 0.78224754 | 1 |
POST /post117s POST /post117s.xml | def create
@post117 = Post117.new(params[:post117])
respond_to do |format|
if @post117.save
format.html { redirect_to(@post117, :notice => 'Post117 was successfully created.') }
format.xml { render :xml => @post117, :status => :created, :location => @post117 }
else
format.h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end",
"def create\n @post168 = Post168.new(params[:post168])\n\n respond_to do |format|\n if @post168.save\n format.html { redirect_to(@post168, :notice => 'Post168... | [
"0.6150349",
"0.6100429",
"0.60998875",
"0.6057699",
"0.6021955",
"0.5993395",
"0.59479654",
"0.5913706",
"0.5904326",
"0.5886781",
"0.5860558",
"0.5848142",
"0.5830541",
"0.58173597",
"0.5811431",
"0.5805381",
"0.58032405",
"0.5795835",
"0.5795161",
"0.57806975",
"0.5775407"... | 0.61656487 | 0 |
Was this notification signalled? | def signalled?
@signalled
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signalled event\n @signalled_actions and @signalled_actions[event]\n end",
"def notification?\n false\n end",
"def notify?\n true\n end",
"def notify?\n false\n end",
"def notify?\n @notify == true\n end",
"def stalled?\n @stalled_fibers.any?\n end"... | [
"0.7490718",
"0.69758767",
"0.6685281",
"0.6678424",
"0.66641176",
"0.655563",
"0.65138483",
"0.6501493",
"0.64942354",
"0.6467567",
"0.6364986",
"0.63618726",
"0.63499457",
"0.6311807",
"0.6297406",
"0.6202629",
"0.6202183",
"0.61276287",
"0.6102364",
"0.6080565",
"0.6070049... | 0.81212234 | 0 |
Grows the set to a larger number of bits. | def grow_to_include(bit)
new_size = Math.max(@bits.attr_length << 1, num_words_to_hold(bit))
newbits = Array.typed(::Java::Long).new(new_size) { 0 }
System.arraycopy(@bits, 0, newbits, 0, @bits.attr_length)
@bits = newbits
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_bits\n bits = []\n 0.upto(63) {|i| bits << i if set?(i)}\n bits\n end",
"def set_size(nwords)\n newbits = Array.typed(::Java::Long).new(nwords) { 0 }\n n = Math.min(nwords, @bits.attr_length)\n System.arraycopy(@bits, 0, newbits, 0, n)\n @bits = newbits\n end",
"def bit... | [
"0.622211",
"0.610392",
"0.59478194",
"0.5849461",
"0.5742779",
"0.57421404",
"0.5702256",
"0.56541765",
"0.56541765",
"0.56228447",
"0.56228447",
"0.56068176",
"0.55627155",
"0.55414575",
"0.5527268",
"0.54543406",
"0.54463017",
"0.54258037",
"0.5410018",
"0.54065776",
"0.54... | 0.6301504 | 0 |
complement bits in the range minBit..maxBit. | def not_in_place(min_bit, max_bit)
# make sure that we have room for maxBit
grow_to_include(max_bit)
i = min_bit
while i <= max_bit
n = word_number(i)
@bits[n] ^= bit_mask(i)
i += 1
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def complement(bit)\n bit.succ % 2\n end",
"def not_in_place(max_bit)\n not_in_place(0, max_bit)\n end",
"def find_complement(num)\n result = 0\n\n num_bits = num.to_s(2).chars.map(&:to_i) # Convert to binary (base 2) and map to integers\n\n num_bits.reverse.each_with_index do |n, idx|\n ... | [
"0.73468924",
"0.64074695",
"0.6378878",
"0.61401385",
"0.608787",
"0.6007887",
"0.5979869",
"0.5874152",
"0.58718616",
"0.58137965",
"0.5782279",
"0.5641064",
"0.56012654",
"0.55617464",
"0.55020106",
"0.548051",
"0.54768574",
"0.54601836",
"0.54323894",
"0.5398898",
"0.5339... | 0.7348808 | 0 |
Subtract the elements of 'a' from 'this' inplace. Basically, just turn off all bits of 'this' that are in 'a'. | def subtract_in_place(a)
if ((a).nil?)
return
end
# for all words of 'a', turn off corresponding bits of 'this'
i = 0
while i < @bits.attr_length && i < a.attr_bits.attr_length
@bits[i] &= ~a.attr_bits[i]
i += 1
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def -(*others)\n self.dup.sub!(*others)\n end",
"def -(other)\n self & other.complement\n end",
"def -(a)\n diff = Vector.new\n self.each_index{|k| diff[k] = self[k]-a[k]}\n diff\n end",
"def -(other)\n entries - comparable(other)\n end",
"def subtract!(rhs)\n subtract ... | [
"0.6902598",
"0.6783287",
"0.66669285",
"0.66112226",
"0.6488639",
"0.6442295",
"0.6438208",
"0.6313281",
"0.625069",
"0.61773497",
"0.6151467",
"0.61400205",
"0.61400205",
"0.6126295",
"0.6089939",
"0.60820276",
"0.60635346",
"0.60316056",
"0.6028249",
"0.6013448",
"0.600436... | 0.8012475 | 0 |
Create a string representation where instead of integer elements, the ith element of vocabulary is displayed instead. Vocabulary is a Vector of Strings. separator The string to put in between elements | def to_s(separator, vocabulary)
if ((vocabulary).nil?)
return to_s(nil)
end
str = ""
i = 0
while i < (@bits.attr_length << LOG_BITS)
if (member(i))
if (str.length > 0)
str += separator
end
if (i >= vocabulary.size)
str +... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s(separator=\":\")\n return self.to_a.collect {|x| x.to_s.rjust(2).gsub(/ /, \"0\")}.join(\":\")\n end",
"def humanize_list terms, separator: ', ', conjunction: ' and '\n *all_but_last, last = terms\n return last if all_but_last.empty?\n\n [ all_but_last.join(separator), last ].join conjuncti... | [
"0.53777874",
"0.53327453",
"0.52480674",
"0.52415013",
"0.51935035",
"0.5172291",
"0.5128371",
"0.51173854",
"0.5090287",
"0.50711614",
"0.50691605",
"0.5051663",
"0.50398797",
"0.5031539",
"0.5009744",
"0.5007542",
"0.5006006",
"0.50013644",
"0.4922791",
"0.49165013",
"0.49... | 0.7126704 | 0 |
Dump a commaseparated list of the words making up the bit set. Split each 64 bit number into two more manageable 32 bit numbers. This generates a commaseparated list of C++like unsigned long constants. | def to_string_of_half_words
s = StringBuffer.new
i = 0
while i < @bits.attr_length
if (!(i).equal?(0))
s.append(", ")
end
tmp = @bits[i]
tmp &= 0xffffffff
s.append(tmp)
s.append("UL")
s.append(", ")
tmp = @bits[i] >> 32
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_string_of_words\n s = StringBuffer.new\n i = 0\n while i < @bits.attr_length\n if (!(i).equal?(0))\n s.append(\", \")\n end\n s.append(@bits[i])\n s.append(\"L\")\n i += 1\n end\n return s.to_s\n end",
"def dump_memory_list\r\n lis... | [
"0.5892362",
"0.559535",
"0.55027044",
"0.55027044",
"0.54306203",
"0.52934587",
"0.5257748",
"0.5241507",
"0.5190763",
"0.5145993",
"0.5139401",
"0.5136722",
"0.5134747",
"0.51137364",
"0.51130307",
"0.5045035",
"0.50208795",
"0.49906358",
"0.49779785",
"0.49544388",
"0.4949... | 0.61334383 | 0 |
Dump a commaseparated list of the words making up the bit set. This generates a commaseparated list of Javalike long int constants. | def to_string_of_words
s = StringBuffer.new
i = 0
while i < @bits.attr_length
if (!(i).equal?(0))
s.append(", ")
end
s.append(@bits[i])
s.append("L")
i += 1
end
return s.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_string_of_half_words\n s = StringBuffer.new\n i = 0\n while i < @bits.attr_length\n if (!(i).equal?(0))\n s.append(\", \")\n end\n tmp = @bits[i]\n tmp &= 0xffffffff\n s.append(tmp)\n s.append(\"UL\")\n s.append(\", \")\n tmp = ... | [
"0.58315533",
"0.57714975",
"0.5598301",
"0.55260336",
"0.55224717",
"0.54917103",
"0.5437852",
"0.54302484",
"0.54260695",
"0.5402459",
"0.5402459",
"0.5370801",
"0.535706",
"0.5354086",
"0.5335332",
"0.5335332",
"0.53127104",
"0.5310909",
"0.5310909",
"0.53037834",
"0.52779... | 0.6290849 | 0 |
GET /release_loans/1 GET /release_loans/1.json | def show
@release_loan = ReleaseLoan.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @release_loan }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @release_loan = ReleaseLoan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @release_loan }\n end\n end",
"def loans\n url = \"#{LOANS_PATH}/pre-approved\"\n data = perform_get(url)\n data || {}\n end",
"de... | [
"0.65779734",
"0.64447767",
"0.61666363",
"0.61097944",
"0.60500455",
"0.60178524",
"0.601515",
"0.6006315",
"0.6006315",
"0.60000205",
"0.5974195",
"0.5943659",
"0.5926613",
"0.5922706",
"0.5915611",
"0.58959275",
"0.58763134",
"0.5850821",
"0.5830902",
"0.5820456",
"0.58078... | 0.6997902 | 0 |
GET /release_loans/new GET /release_loans/new.json | def new
@release_loan = ReleaseLoan.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @release_loan }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @lost = Lost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lost }\n end\n end",
"def new\n @release = Release.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @release }\n end\n e... | [
"0.7120017",
"0.7102812",
"0.7056036",
"0.7038341",
"0.7010651",
"0.6829084",
"0.6829084",
"0.6810086",
"0.6808071",
"0.67365116",
"0.6729013",
"0.66943383",
"0.66585845",
"0.66392756",
"0.66392756",
"0.66368014",
"0.66124094",
"0.6606484",
"0.6605926",
"0.6601252",
"0.659051... | 0.7535736 | 0 |
POST /release_loans POST /release_loans.json | def create
@release_loan = ReleaseLoan.new(params[:release_loan])
respond_to do |format|
if @release_loan.save
format.html { redirect_to @release_loan, notice: 'Release loan was successfully created.' }
format.json { render json: @release_loan, status: :created, location: @release_loan }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @release_loan = ReleaseLoan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @release_loan }\n end\n end",
"def loans\n url = \"#{LOANS_PATH}/pre-approved\"\n data = perform_get(url)\n data || {}\n end",
"de... | [
"0.6025203",
"0.5773867",
"0.5728883",
"0.5720152",
"0.5634739",
"0.5584936",
"0.5515859",
"0.5504758",
"0.55025077",
"0.5491573",
"0.5488336",
"0.54790246",
"0.5446512",
"0.5418494",
"0.5416051",
"0.53619957",
"0.5348527",
"0.53414464",
"0.5328799",
"0.52890575",
"0.52852386... | 0.66710174 | 0 |
PUT /release_loans/1 PUT /release_loans/1.json | def update
@release_loan = ReleaseLoan.find(params[:id])
respond_to do |format|
if @release_loan.update_attributes(params[:release_loan])
format.html { redirect_to @release_loan, notice: 'Release loan was successfully updated.' }
format.json { head :no_content }
else
format.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @release_loan = ReleaseLoan.new(params[:release_loan])\n\n respond_to do |format|\n if @release_loan.save\n format.html { redirect_to @release_loan, notice: 'Release loan was successfully created.' }\n format.json { render json: @release_loan, status: :created, location: @rele... | [
"0.609197",
"0.5708468",
"0.5613374",
"0.55026466",
"0.5499115",
"0.54883105",
"0.5460921",
"0.54535025",
"0.5446856",
"0.5441261",
"0.53988326",
"0.5381921",
"0.53722507",
"0.5350656",
"0.5334729",
"0.53315985",
"0.5296379",
"0.5296379",
"0.5291428",
"0.5290996",
"0.5288257"... | 0.63873297 | 0 |
DELETE /release_loans/1 DELETE /release_loans/1.json | def destroy
@release_loan = ReleaseLoan.find(params[:id])
@release_loan.destroy
respond_to do |format|
format.html { redirect_to release_loans_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @client_release = ClientRelease.find(params[:id])\n @client_release.destroy\n\n ... | [
"0.7100835",
"0.6832401",
"0.672356",
"0.6696524",
"0.66841304",
"0.6681314",
"0.6584477",
"0.6582933",
"0.6579868",
"0.6565128",
"0.65610313",
"0.6549521",
"0.65331197",
"0.65145177",
"0.6507528",
"0.64937526",
"0.647958",
"0.6479154",
"0.64726716",
"0.64711344",
"0.6467382"... | 0.72731197 | 0 |
Root breadcrumbs setup method. May be overridden or augmented by subclasses | def set_breadcrumbs
@breadcrumbs = []
add_breadcrumb "Home", root_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def auto_set_breadcrumb\n ariane.add(\"Home\", root_path, 1) if ariane.crumbs.empty? \n \n if self.action_name == \"index\"\n name = controller_name.titleize\n level = get_level || 2\n else\n name = \"#{action_name.titleize} #{controller_name.singularize.titleize}\"\n ... | [
"0.7122897",
"0.69954604",
"0.69638413",
"0.6900299",
"0.68838817",
"0.6865224",
"0.67939645",
"0.67313737",
"0.6623273",
"0.65754205",
"0.65553534",
"0.6537324",
"0.65344507",
"0.652361",
"0.65156025",
"0.648781",
"0.648781",
"0.6337952",
"0.63268906",
"0.6270689",
"0.62135"... | 0.7764661 | 1 |
Log action, along with record_id, section, and id from params, plus any optional params (which overwrite the default params if there are duplicates) | def audit_log(action, optional_params = {})
description = params.slice(:record_id, :section, :id).merge(optional_params).map { |key, value| "#{key}:#{value}"}.join('|')
requester = current_user.try(:email) || 'NONE'
AuditLog.create(event: action, description: description, requester_info: requester)
desc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def record(action, *arguments)\n log \"#{action_padding(action)}#{action} #{arguments.join(' ')}\"\n end",
"def log_action(action, user, record, model)\n begin\n # Create a new ActionLog Object\n event = ActionLog.new()\n \n # Add the user to this object\n event.user = user\n ... | [
"0.69043815",
"0.6187379",
"0.61687094",
"0.6154826",
"0.6057162",
"0.6057162",
"0.6009562",
"0.59668994",
"0.5951249",
"0.5904017",
"0.582372",
"0.58196425",
"0.5728946",
"0.5704486",
"0.5697666",
"0.5654343",
"0.56509435",
"0.5620393",
"0.56200576",
"0.55629987",
"0.5551833... | 0.7261586 | 0 |
input: array of integers output: array containing running total for each element data structure: integer array algorithim: initialise `sum` equal to `0` initialise `running_total` empty array iterate over array argument increment `sum` by current element append `sum` to `running_total` return `running_total` Examples: | def running_total(array)
sum = 0
running_total = []
array.each do |element|
sum += element
running_total << sum
end
running_total
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def running_total arr\n totals = []\n sum = 0\n arr.each do |elm|\n sum += elm\n totals << sum\n end\n totals\nend",
"def running_total(array)\n sum = 0\n array.each_with_object([]) do |el, new_array|\n new_array << sum += el\n end\nend",
"def running_total(arr)\n res = []\n running_total = ... | [
"0.88819605",
"0.8881816",
"0.87973315",
"0.87761205",
"0.87680596",
"0.87643987",
"0.8719478",
"0.871287",
"0.8707647",
"0.8707366",
"0.86850494",
"0.868466",
"0.868466",
"0.868466",
"0.86779493",
"0.86539716",
"0.862774",
"0.86248994",
"0.86165947",
"0.8607811",
"0.8600865"... | 0.8890326 | 0 |
POST /feed_entries POST /feed_entries.xml | def create
@feed_entry = FeedEntry.new(params[:feed_entry])
respond_to do |format|
if @feed_entry.save
flash[:notice] = 'FeedEntry was successfully created.'
format.html { redirect_to(@feed_entry) }
format.xml { render :xml => @feed_entry, :status => :created, :location => @feed_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @feed = Feed.find(params[:feed_id])\n @entry = @feed.entries.new(params[:entry])\n\n respond_to do |format|\n if @entry.save\n @entry.author.save\n format.html { redirect_to feed_entry_path(@feed,@entry), notice: 'Entry was successfully created.' }\n format.json { re... | [
"0.65413153",
"0.64110947",
"0.63338536",
"0.632252",
"0.6309666",
"0.6291664",
"0.6263487",
"0.62322825",
"0.6198932",
"0.61660373",
"0.61660373",
"0.61660373",
"0.61660373",
"0.61290556",
"0.61201435",
"0.61101353",
"0.6048387",
"0.60270894",
"0.5977057",
"0.5966648",
"0.59... | 0.6461824 | 1 |
DELETE /feed_entries/1 DELETE /feed_entries/1.xml | def destroy
@feed_entry = FeedEntry.find(params[:id])
@feed_entry.destroy
respond_to do |format|
format.html { redirect_to(feed_entries_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @entry = Entry.find(params[:id])\n @feed = @entry.feed\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to feed_path(@feed) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @feed = Feed.find(params[:id])\n @feed.destroy\n\n res... | [
"0.71579355",
"0.7028766",
"0.70177007",
"0.6973815",
"0.6934134",
"0.6934134",
"0.6934134",
"0.6934134",
"0.6934134",
"0.6912192",
"0.69084364",
"0.690329",
"0.6856918",
"0.68258643",
"0.6805577",
"0.6785518",
"0.67805064",
"0.6753707",
"0.67425853",
"0.6725857",
"0.6715022"... | 0.74111605 | 0 |
Laptops fleet_type Can be: :all, :spares, :staff, :archived Return a table of inwarranty laptops. | def print_laptops(fleet_type)
simple_print(@snipe.laptops(fleet_type), %w(asset_tag serial name assigned_to.username), 'asset_tag', ['Asset Tag', 'Serial', 'Asset Name', 'Assigned To'])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_laptops_in_warranty(fleet_type)\n laptops = @snipe.laptops(fleet_type)\n data = laptops.find_all {|i| i['in_warranty'] }\n simple_print(data, %w(warranty_expires.formatted asset_tag serial name assigned_to.username), 'warranty_expires.formatted', ['Warranty Expires', 'Asset Tag', 'Serial', 'Asse... | [
"0.70259136",
"0.53149456",
"0.515949",
"0.5121093",
"0.50394136",
"0.5028877",
"0.501755",
"0.49732032",
"0.48626444",
"0.48626444",
"0.4861469",
"0.48566943",
"0.48566943",
"0.48486102",
"0.48301536",
"0.4811267",
"0.4800878",
"0.47946212",
"0.47769666",
"0.47404608",
"0.47... | 0.6492 | 1 |
Return a table of inwarranty laptops. | def print_laptops_in_warranty(fleet_type)
laptops = @snipe.laptops(fleet_type)
data = laptops.find_all {|i| i['in_warranty'] }
simple_print(data, %w(warranty_expires.formatted asset_tag serial name assigned_to.username), 'warranty_expires.formatted', ['Warranty Expires', 'Asset Tag', 'Serial', 'Asset Name',... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @warranties = Warranty.all\n\n end",
"def working_items_table\n contract_info_tables = page.all(\"table.table-hover.table-bordered.table-striped\", visible: true)\n unless contract_info_tables[1].nil?\n return Helpers::OpsUiHelper::TableHelper.new(node: contract_info_tables[1])\n en... | [
"0.5743786",
"0.5688127",
"0.5435192",
"0.5398771",
"0.5393867",
"0.5357076",
"0.52888983",
"0.5271688",
"0.523566",
"0.5212356",
"0.5120372",
"0.51030827",
"0.50963885",
"0.50513303",
"0.50475675",
"0.50425494",
"0.5040569",
"0.50213844",
"0.5014964",
"0.50043285",
"0.499424... | 0.6875968 | 0 |
Return a table of laptops sorted by age. Age is approximate. This method does not calculate the intricacies of leap years, etc. | def print_laptops_by_age(fleet_type, older_than_years = 0.0)
laptops = @snipe.laptops(fleet_type)
older_than_years = older_than_years.to_f
data = []
# Do not include these very old assets if filtering by age
if older_than_years == 0.0
# Format assets that have word based asset_tags, such as '... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sorted_by_age(people)\nend",
"def index\n @laws = Law.order(cached_votes_up: :desc).each\n end",
"def sort_tenants_by_age tenants\n return tenants.sort_by { |tenant| tenant.age }\n end",
"def elements_sorted_by_experience\n collection.sort_by{|person| person[:years_experience]}\n end",
"def... | [
"0.65759236",
"0.5627051",
"0.55942386",
"0.5504107",
"0.53523934",
"0.523864",
"0.52038014",
"0.5146799",
"0.51239246",
"0.5108985",
"0.5104057",
"0.50993574",
"0.50917935",
"0.5044814",
"0.50363946",
"0.50363946",
"0.50363946",
"0.5031838",
"0.50164354",
"0.5011932",
"0.500... | 0.6540366 | 1 |
Delete any old channel requests (since they were approved) | def destroy_channel_request
channel_request = ChannelRequest.where(:user_id => self.subscriber_id, :channel_id => self.channel_id).first
channel_request.destroy unless channel_request.blank?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_requests\n self.requests.each {|request| request.destroy}\n end",
"def delete_old_requests\n Request.where('created_at < ?', Time.now - 15.minutes).delete_all\n end",
"def remove_all_requests\n return if params[:request_ids].blank?\n requests = params[:request_ids].split(',')\n requ... | [
"0.70704406",
"0.64151096",
"0.614683",
"0.6117218",
"0.60943437",
"0.5942399",
"0.5942253",
"0.5922376",
"0.59148246",
"0.5883685",
"0.5854346",
"0.58487946",
"0.58487946",
"0.5841473",
"0.58020866",
"0.5789247",
"0.57869005",
"0.5782026",
"0.57478416",
"0.5705308",
"0.57034... | 0.67095536 | 1 |
POST /kpi_types POST /kpi_types.json | def create
@kpi_type = KpiType.new(kpi_type_params)
if @kpi_type.save
flash[:success] = 'KPI Type was successfully created.'
redirect_to :back
else
flash[:danger] = 'KPI Type was not created.'
redirect_to :back
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kpi_type_params\n params.require(:kpi_type).permit(:name,:code)\n end",
"def type_params\n params.from_jsonapi.require(:type).permit(:name)\n end",
"def add_dummy_type\n params[:data] ||= {}\n params[:data][:type] = resource_klass._type.to_s\n end",
"def create_types\n\t\t[]\n\tend",
... | [
"0.67659",
"0.6282521",
"0.6281636",
"0.6183373",
"0.6183373",
"0.6123466",
"0.6123466",
"0.60953045",
"0.6090268",
"0.598207",
"0.5931976",
"0.5849073",
"0.5815785",
"0.5815785",
"0.5742959",
"0.5721692",
"0.57141656",
"0.5691886",
"0.5669951",
"0.5633514",
"0.56115025",
"... | 0.6586921 | 1 |
PATCH/PUT /kpi_types/1 PATCH/PUT /kpi_types/1.json | def update
if @kpi_type.update(kpi_type_params)
flash[:success] = 'KPI Type was successfully updated.'
redirect_to :back
else
flash[:danger] = 'KPI Type was not updated.'
redirect_to :back
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_type\n\t\t\trender json: User.update_type_by_id(params[:id], params[:type], params[:is])\n\t\tend",
"def update\n @type.update(type_params)\n end",
"def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise Argumen... | [
"0.64834076",
"0.63348955",
"0.6264754",
"0.61594623",
"0.6146158",
"0.6144301",
"0.6132821",
"0.6126535",
"0.6126196",
"0.61250424",
"0.61238486",
"0.61134434",
"0.6110178",
"0.60877174",
"0.6074158",
"0.60712737",
"0.60435665",
"0.6040991",
"0.60351515",
"0.6022848",
"0.600... | 0.6594203 | 0 |
DELETE /kpi_types/1 DELETE /kpi_types/1.json | def destroy
@kpi_type.destroy
flash[:success] = 'KPI Type was successfully deleted.'
redirect_to :back
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @type = Type.find(params[:id])\n @type.destroy\n\n respond_to do |format|\n format.html { redirect_to types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @itype = Itype.find(params[:id])\n @itype.destroy\n\n respond_to do |format|\n forma... | [
"0.6899133",
"0.68929327",
"0.6790414",
"0.677679",
"0.676806",
"0.6766484",
"0.6763869",
"0.6734256",
"0.6725124",
"0.6722001",
"0.67125696",
"0.67114246",
"0.67042875",
"0.6697558",
"0.6692546",
"0.6691969",
"0.66915977",
"0.6684318",
"0.6658651",
"0.66412884",
"0.66391337"... | 0.6970028 | 0 |
add_suffix "somefile.xml", "_1234" => somefile_1234.xml"" | def add_suffix filename, suffix
parts = filename.split("\.")
base = parts[0..-2]
parts2 = base << suffix << parts[-1]
fn = parts2.join(".")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_suffix\n file_name.split('.').last \n end",
"def suffix(num)\n namespace + '_suffix_' + num.to_s\n end",
"def suffix; end",
"def suffix; end",
"def suffix; end",
"def suffix; end",
"def suffix; end",
"def formatted_filename(name, version, suffix, extension)\n name.gsub(\"#{vers... | [
"0.7029925",
"0.6958982",
"0.69057006",
"0.69057006",
"0.69057006",
"0.69057006",
"0.69057006",
"0.67959976",
"0.66103756",
"0.655469",
"0.6530568",
"0.64537233",
"0.6397378",
"0.6339435",
"0.630913",
"0.61896306",
"0.61211896",
"0.611881",
"0.609876",
"0.59724325",
"0.595064... | 0.76751864 | 0 |
PATCH/PUT /audits/1 PATCH/PUT /audits/1.json | def update
respond_to do |format|
if @audit.update(audit_params)
format.html { redirect_to @audit, notice: 'Audit was successfully updated.' }
format.json { render :show, status: :ok, location: @audit }
else
format.html { render :edit }
format.json { render json: @audit.e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @recording = Recording.find(params[:id])\n\n respond_to do |format|\n if @recording.update_attributes(params[:recording])\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n end\n end\n end",
"def update\n id = params[:id]\n... | [
"0.62754935",
"0.61398065",
"0.61359316",
"0.6010058",
"0.59871",
"0.5985566",
"0.59275275",
"0.58998513",
"0.58940655",
"0.58903617",
"0.5878485",
"0.5874587",
"0.58714235",
"0.5835737",
"0.5824104",
"0.5819092",
"0.5807568",
"0.57836604",
"0.5762287",
"0.57359064",
"0.57198... | 0.651764 | 0 |
DELETE /audits/1 DELETE /audits/1.json | def destroy
@audit.destroy
respond_to do |format|
format.html { redirect_to audits_url, notice: 'Audit was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n \n @audit = current_user.audits.find(params[:id])\n @audit.destroy\n \n UserMailer.audit_deleted_auditor(@audit,current_user).deliver\n UserMailer.audit_deleted_auditee(@audit,current_user).deliver\n respond_to do |format|\n format.html { redirect_to audits_url }\n format.... | [
"0.7506409",
"0.72189516",
"0.69374704",
"0.6898264",
"0.6835532",
"0.67364204",
"0.67183477",
"0.67174584",
"0.6707446",
"0.6698856",
"0.66728926",
"0.66654",
"0.66302913",
"0.66241074",
"0.65913737",
"0.65548253",
"0.6525144",
"0.65009105",
"0.6457753",
"0.644951",
"0.64312... | 0.7294166 | 1 |
Renders a notification field for a Redmine::Notifiable option | def notification_field(notifiable)
tag_data =
if notifiable.parent.present?
{:parent_notifiable => notifiable.parent}
else
{:disables => "input[data-parent-notifiable=#{notifiable.name}]"}
end
tag = check_box_tag('settings[notified_events][]',
notifiable... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notification_text(notification)\n notifiable = notification.notifiable\n text = if notification.medium?\n t('notifications.new_medium')\n elsif notification.course?\n course_notification_card_text(notifiable)\n elsif notification.lecture?\n lecture_... | [
"0.6050053",
"0.5751158",
"0.5661299",
"0.55503964",
"0.55464524",
"0.5511461",
"0.5509745",
"0.54960275",
"0.54883045",
"0.54687226",
"0.54348433",
"0.54084367",
"0.54008037",
"0.53999835",
"0.53223747",
"0.52933663",
"0.52825105",
"0.52367043",
"0.52354634",
"0.52270263",
"... | 0.7223191 | 0 |
Returns the options for the date_format setting | def date_format_setting_options(locale)
Setting::DATE_FORMATS.map do |f|
today = ::I18n.l(User.current.today, :locale => locale, :format => f)
format = f.delete('%').gsub(/[dmY]/) do
{'d' => 'dd', 'm' => 'mm', 'Y' => 'yyyy'}[$&]
end
["#{today} (#{format})", f]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_format_options\n DATE_FORMATS.collect {|f| [\"#{Date.today.strftime(f)} - #{f}\", f]}\n end",
"def default_options_date_format(format)\n format || '%Y-%m-%d - %l:%M:%S%p'\n end",
"def date_format\n return @date_format\n end",
"def datepicker_options(format, valu... | [
"0.8548332",
"0.77671754",
"0.72053105",
"0.71642554",
"0.6801605",
"0.6669466",
"0.6666883",
"0.6627941",
"0.66279304",
"0.65945774",
"0.6588877",
"0.6540272",
"0.6439241",
"0.6423599",
"0.6423166",
"0.63802356",
"0.6343782",
"0.63327307",
"0.63242227",
"0.63144076",
"0.6295... | 0.7815651 | 1 |
GET /orf_models/1 GET /orf_models/1.json | def show
@orf_model = OrfModel.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @orf_model }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def model\r\n\t\t\t@model ||= json['model']\r\n\t\tend",
"def index\n @oid_models = OidModel.all\n end",
"def get_model\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/model'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepar... | [
"0.65786946",
"0.6238855",
"0.61046416",
"0.6029444",
"0.60079145",
"0.59760475",
"0.59760475",
"0.59065425",
"0.59057623",
"0.58922684",
"0.5887183",
"0.5846745",
"0.5807929",
"0.5745284",
"0.57041675",
"0.56968236",
"0.5691075",
"0.5687457",
"0.56665486",
"0.56414896",
"0.5... | 0.7106116 | 0 |
Called before a task is created, sends a request to the Scale API | def create_task
#Assign url
url="https://api.scaleapi.com/v1/task/phonecall"
#Auth credentials setup
auth = {:username=>ENV["SCALE_API_KEY"], :password=>""}
#Assign headers
headers = {"Content-Type"=>"application/json"}
#Create payload
params = {callback_url: 'https://mysterious-... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n GpsJob.perform_later(request_params)\n head(:ok)\n end",
"def tasks\n uri = URI(BASE_URL + TASKS_ENDPOINT)\n\n make_request(uri)\n end",
"def create\n @task = Task.new(task_state: TaskState.where(name: \"Pending\")[0] )\n\n if params[:all]\n # get task IDs from system, map... | [
"0.6006873",
"0.596223",
"0.5961344",
"0.5896093",
"0.58250946",
"0.5758471",
"0.575588",
"0.5752058",
"0.5737704",
"0.5719859",
"0.57064813",
"0.5706156",
"0.57034546",
"0.5687715",
"0.56832296",
"0.5666971",
"0.5622342",
"0.56175256",
"0.56154364",
"0.55883",
"0.55785984",
... | 0.6873843 | 0 |
Parse callback from Scale on the survey and assign response to a model | def parse_response(response)
if response["outcome"]=="success"
#Assign calorie counts and grams breakdown
self.total_calories=response["fields"]["total_calories"].to_i
self.protein_grams=response["fields"]["total_calories"].to_i
self.fat_grams=response["fields"]["fat_grams"].to_i
sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse(savon_response)\n new(savon_response)\n end",
"def parse(savon_response)\n response = new(savon_response)\n response.raw[\"#{key}_response\".to_sym][\"#{key}_result\".to_sym][:response_type]\n end",
"def set_survey_response\n @survey_response = SurveyRespon... | [
"0.5876006",
"0.5854425",
"0.58517605",
"0.5786045",
"0.5706179",
"0.5706179",
"0.5706179",
"0.5706179",
"0.5638147",
"0.5517288",
"0.54785043",
"0.54246616",
"0.5389937",
"0.5389937",
"0.5389937",
"0.53821015",
"0.5318267",
"0.53106934",
"0.53016645",
"0.52799904",
"0.526871... | 0.64945865 | 0 |
execute a command against a remote windows machine using psexec | def psexec(host, command)
exec = "psexec \\\\#{Array(host).join ','}"
if @options[:user]
exec << " -u \"#{@options[:user]}\""
@options[:password] = ask("--> Enter password for #{@options[:user]}@#{host}: ") {|q| q.echo = '*'} unless @options[:password]
exec << " -p \"#{@opt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute_interactively(host, command)\n user = host.user\n hostname = host.hostname\n port = host.port || 22\n\n # execute in shell\n exec \"ssh -l #{user} #{hostname} -p #{port} -t '#{command}'\"\nend",
"def execute_ssh_command(command)\n\t\tresult = ''\n\t\tNet::SSH.start(ip_string, settings.ss... | [
"0.6539553",
"0.64589566",
"0.64333165",
"0.641589",
"0.63199073",
"0.63082355",
"0.6295611",
"0.6227712",
"0.6208858",
"0.6194346",
"0.6190223",
"0.6181252",
"0.6148918",
"0.6134624",
"0.6109485",
"0.61044806",
"0.6086549",
"0.607344",
"0.60497504",
"0.6021373",
"0.60177416"... | 0.7518728 | 0 |
returns the number of students in this section | def count_students
students.size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_students\n self.students.count\n end",
"def num_grades (student)\n @grades[student].length\n end",
"def active_student_count\n if self.students.present?\n self.students.select { |s| s.sign_in_count > 0 }.size\n else\n 0\n end\n end",
"def total_students\n students... | [
"0.7621935",
"0.75866854",
"0.72421867",
"0.7111609",
"0.69339824",
"0.68719083",
"0.68649083",
"0.6856613",
"0.679039",
"0.66600674",
"0.6588708",
"0.6538169",
"0.65213126",
"0.6463719",
"0.63386285",
"0.6333991",
"0.62659514",
"0.62336826",
"0.6223881",
"0.61278695",
"0.611... | 0.78057146 | 1 |
Calculate the checksum from the page (or the pre packed data) If data it supplied it will be updated to record the checksum value | def compute_checksum(data_)
data = data_.dup
data[22..25] = [0].pack("V")
crc = 0
data.each_byte do |byte|
crc = (crc << 8)^CHECKSUM_TABLE[((crc >> 24)&0xff) ^ byte]
crc = crc & 0xffffffff
end
crc
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_checksum\n # Checksum is only on header, so cannot use IP.sum16,\n # which also calculates checksum on #body.\n nb_words = ihl * 2\n self.checksum = 0\n checksum = to_s.unpack(\"n#{nb_words}\").sum\n self[:checksum].value = IP.reduce_checksum(checksum)\n end"... | [
"0.70415354",
"0.69379395",
"0.6750849",
"0.65638494",
"0.65250707",
"0.6514308",
"0.6493108",
"0.64663786",
"0.64663786",
"0.64651674",
"0.643656",
"0.64114666",
"0.64114666",
"0.6371721",
"0.6342957",
"0.63137287",
"0.6259493",
"0.623863",
"0.62170446",
"0.61951697",
"0.614... | 0.6949942 | 1 |
POST /mergegraphs POST /mergegraphs.json | def create
@mergegraph = Admin::Mergegraph.new(mergegraph_params)
respond_to do |format|
if @mergegraph.save
format.html { redirect_to @mergegraph, notice: 'Mergegraph was successfully created.' }
format.json { render action: 'show', status: :created, location: @mergegraph }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mergegraph_params\n params.require(:admin_mergegraph).permit(:merge_id, :graph_id, :side, :y, :vieworder)\n end",
"def create\n @graph = Graph.new(params[:graph])\n\n respond_to do |format|\n if @graph.save\n Action.log :controller => params[:controller], :action => params[:action],... | [
"0.6566948",
"0.6156067",
"0.6021743",
"0.57612205",
"0.56907773",
"0.5583179",
"0.5575224",
"0.5553395",
"0.5533411",
"0.5502257",
"0.5488648",
"0.5474937",
"0.5474751",
"0.5455107",
"0.53372693",
"0.5304352",
"0.53030854",
"0.5257971",
"0.5254713",
"0.5199494",
"0.5150038",... | 0.7047132 | 0 |
PATCH/PUT /mergegraphs/1 PATCH/PUT /mergegraphs/1.json | def update
respond_to do |format|
if @mergegraph.update(mergegraph_params)
format.html { redirect_to @mergegraph, notice: 'Mergegraph was successfully updated.' }
format.json { head :no_content }
else
@merge = Admin::Merge.find(@mergegraph.merge_id)
format.html { render a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @graph = Graph.includes(:nodes).find(params[:id])\n\n respond_to do |format|\n if @graph.update_attributes(params[:graph])\n Action.log :controller => params[:controller], :action => params[:action], :target_id => params[:id], :user => current_user\n format.html { redirect_to ... | [
"0.64218163",
"0.64172655",
"0.6268077",
"0.6160597",
"0.6127228",
"0.60015076",
"0.599179",
"0.59568465",
"0.59373266",
"0.5828153",
"0.5791312",
"0.5738112",
"0.5738001",
"0.57048553",
"0.57011706",
"0.56929356",
"0.5603972",
"0.5590948",
"0.5532756",
"0.55309254",
"0.54936... | 0.710164 | 0 |
DELETE /mergegraphs/1 DELETE /mergegraphs/1.json | def destroy
@mergegraph.destroy
respond_to do |format|
format.html { redirect_to admin_mergegraph_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @graph.destroy\n\n respond_to do |format|\n format.html { redirect_to graphs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @graph.destroy\n respond_to do |format|\n format.html { redirect_to graphs_url }\n format.json { head :no_content }\... | [
"0.70091116",
"0.69834864",
"0.68997496",
"0.68341494",
"0.6780763",
"0.6780763",
"0.6719513",
"0.67140996",
"0.6644761",
"0.66418374",
"0.6597057",
"0.6595819",
"0.65829927",
"0.6466911",
"0.6449677",
"0.6436914",
"0.6348817",
"0.6288825",
"0.6287741",
"0.6237578",
"0.621974... | 0.7861553 | 0 |
Redefines an object's method with a Command of the same name. | def redefine_command(obj, command)
cmd_block = redefine_command_block(obj, command)
@no_option_commands << command if command.options.nil?
[command.name, command.alias].compact.each {|e|
obj.singleton_class.send(:define_method, e, cmd_block)
}
rescue Error
warn "Error: #{$!.mes... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def redefine_command(obj, command)\n cmd_block = redefine_command_block(obj, command)\n @no_option_commands << command if command.options.nil?\n [command.name, command.alias].compact.each {|e|\n obj.instance_eval(\"class<<self;self;end\").send(:define_method, e, cmd_block)\n }\n end",... | [
"0.8310975",
"0.7890691",
"0.6899113",
"0.66847795",
"0.6453737",
"0.641819",
"0.6383475",
"0.6363545",
"0.6350759",
"0.6343646",
"0.62662417",
"0.62594396",
"0.6251353",
"0.62326586",
"0.62326586",
"0.62326586",
"0.62010646",
"0.6198705",
"0.61512995",
"0.6123135",
"0.612167... | 0.81944 | 1 |
Returns hash of methods for an object | def object_methods(obj)
@object_methods[obj] ||= {}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash #:nodoc:\n __getobj__.hash ^ self.class.hash\n end",
"def to_hash\n ret = {}\n \n self.methods.select{ |it| it.id2name[-1] == '=' and !['==', '!='].include?(it.id2name) }.each do |method|\n name = method.id2name.gsub('=', '')\n \n ... | [
"0.70811844",
"0.6702198",
"0.6667372",
"0.6595375",
"0.6525205",
"0.65250003",
"0.6520784",
"0.64524466",
"0.64524466",
"0.64524466",
"0.64524466",
"0.64524466",
"0.64524466",
"0.64524466",
"0.64149994",
"0.64149994",
"0.64149994",
"0.64149994",
"0.64149994",
"0.64149994",
"... | 0.67921484 | 1 |
option command for given command | def option_command(cmd=@command)
@option_commands[cmd] ||= OptionCommand.new(cmd)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def command\n return @command if !@opt_set && @command\n @opt_set = false\n @command = [@binary, options]\n end",
"def option(option)\n \"--\" << option.to_s.gsub('_', '-')\n end",
"def command\n return \"#{@command} #{options}\"\n end",
"def treat_as_option doption\n o... | [
"0.7271766",
"0.71792614",
"0.7144048",
"0.7092695",
"0.7064922",
"0.7041221",
"0.7025596",
"0.7024947",
"0.6922264",
"0.6918408",
"0.69139236",
"0.6825444",
"0.6771537",
"0.6750897",
"0.66939247",
"0.66923183",
"0.6692272",
"0.6679929",
"0.6652789",
"0.6635822",
"0.66274226"... | 0.8038478 | 0 |
A name is valid is if satisfies all of the following: contains at least a first name and last name, separated by spaces each part of the name should be capitalized Hint: use str.upcase or str.downcase "a".upcase => "A" | def is_valid_name(str)
str_arr = str.split
check = []
str_arr.each do |ele|
formatted = ele[0].upcase + ele[1..-1].downcase
check << formatted
end
if check.length < 2 || check.join(" ") != str
return false
else
return true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid_name(str)\n split_name = str.split(' ')\n\n first_and_last_name = split_name.length > 1; # Has a first and last name ?\n capitalized = true; # Each part of the name is properly capitalized ?\n\n split_name.each do | word |\n capitalized = word[0] == word[0].upcase && word[1..-1] == word[1..-1].... | [
"0.8481082",
"0.786001",
"0.783987",
"0.77975756",
"0.77851516",
"0.77706265",
"0.7735286",
"0.7680342",
"0.76645744",
"0.7569165",
"0.7556697",
"0.7246888",
"0.7231729",
"0.7164296",
"0.71579325",
"0.71579325",
"0.7156234",
"0.70890385",
"0.7019955",
"0.7015272",
"0.6993298"... | 0.80682504 | 1 |
Sets the owner attributes on the given record | def set_owner_attributes(record)
if @owner.persisted?
construct_owner_attributes.each { |key, value| record[key] = value }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def owner=(v) self['Owner'] = v end",
"def owner=(new_owner)\n if new_owner\n attributes[:owner] = {\n :display_name => new_owner['DisplayName'],\n :id => new_owner['ID']\n }\n end\n end",
"def set_owner(id)\n self.ow... | [
"0.7617755",
"0.719221",
"0.7087667",
"0.68537277",
"0.68537277",
"0.6841061",
"0.68264353",
"0.67995536",
"0.6788768",
"0.67817754",
"0.67817754",
"0.67817754",
"0.67817754",
"0.67817754",
"0.67817754",
"0.67817754",
"0.67578393",
"0.67467326",
"0.67467326",
"0.67467326",
"0... | 0.8964834 | 0 |
Returns a hash linking the owner to the association represented by the reflection | def construct_owner_attributes(reflection = @reflection)
attributes = {}
if reflection.macro == :belongs_to
attributes[reflection.association_primary_key] = @owner.send(reflection.primary_key_name)
else
attributes[reflection.primary_key_name] = @owner.send(reflectio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n [_hash, name, owner].hash\n end",
"def owner_association\n owner_ref(self).send(owner_association_name.to_sym)\n end",
"def hash\n [principals, relation].hash\n end",
"def association_owner_key(assoc, key)\n k = 'activerecord.associations.models.'\n k << assoc.active_... | [
"0.68757844",
"0.6538791",
"0.6401935",
"0.6383943",
"0.6272353",
"0.62587225",
"0.6254022",
"0.62203896",
"0.619685",
"0.61707145",
"0.6166494",
"0.61453474",
"0.59729564",
"0.5965282",
"0.59565276",
"0.59565276",
"0.5937785",
"0.59173775",
"0.5905549",
"0.58312654",
"0.5811... | 0.66429985 | 1 |
Private: checks the mapper policy against its class opts The Hash containing the policy filter data. Return: true if it fulfills the policy and false if it does not. | def verify_policy(opts)
result = policy.constantize.call(opts)
rescue NameError
result = true
ensure
return result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_policy(hosts, facts, classes)\n if hosts and not parse_hosts(hosts)\n return false\n end\n if not classes\n return parse_compound(facts)\n else\n return parse_facts(facts) && parse_classes(classes)\n end\n end",
"def meets_restrictions?... | [
"0.55878156",
"0.5470052",
"0.5415447",
"0.53895444",
"0.5330231",
"0.5261278",
"0.5173917",
"0.5155703",
"0.51412326",
"0.5125277",
"0.51230836",
"0.5112458",
"0.508078",
"0.50254714",
"0.49620473",
"0.4951802",
"0.49440658",
"0.48520997",
"0.48173445",
"0.48167518",
"0.4812... | 0.633603 | 0 |
publishes to a channel some data (can be anything) | def publish(channel, data)
send_action('publish', channel, data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def publish(data)\n @consumer_channel.push data\n end",
"def publish_to(channel, data)\n\t\t\tpublish_message(message(channel, data))\n\t\tend",
"def publish_to(channel, data)\n publish_message(message(channel, data))\n end",
"def publish(channel, data, id=nil, prev_id=nil)\n @pub.publish(channel,... | [
"0.84043056",
"0.82010657",
"0.81019866",
"0.80586153",
"0.80376184",
"0.7995907",
"0.79003143",
"0.79003143",
"0.7818992",
"0.7472918",
"0.7419547",
"0.7326863",
"0.73206365",
"0.7292828",
"0.7282665",
"0.72237986",
"0.719854",
"0.70937556",
"0.7073669",
"0.70231277",
"0.699... | 0.8230917 | 1 |
unsubscribes all clients subscribed to a channel | def unsubscribe_clients(channel)
send_action('unsubscribe_clients', channel)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unsubscribed\n # Any cleanup needed when channel is unsubscribed\n stop_all_streams\n end",
"def unsubscribed\n # Any cleanup needed when channel is unsubscribed\n stop_all_streams\n end",
"def unsubscribe(*channels); end",
"def unsubscribe_from_channel; end",
"def punsubscribe(*channels)... | [
"0.77854276",
"0.77854276",
"0.7680194",
"0.7469042",
"0.74636924",
"0.7463368",
"0.7217584",
"0.71967125",
"0.70995325",
"0.7059307",
"0.7048241",
"0.699649",
"0.6902584",
"0.6890386",
"0.6890386",
"0.6877078",
"0.6845015",
"0.67963475",
"0.6792432",
"0.6766172",
"0.67391133... | 0.8085907 | 0 |
method used to send messages to the webserver checks too see if the message is a hash and if it is it will transform it to JSON and send it to the webser otherwise will construct a JSON object that will have the key action with the value 'message" and the key message witth the parameter's value | def chat(message)
final_message = nil
if message.is_a?(Hash)
final_message = message.to_json
else
final_message = JSON.dump(action: 'message', message: message)
end
log_to_file("#{self.class} sends JSON #{final_message}")
send_data(final_message)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_message(message_hash)\n socket_id = message_hash[\"socket_id\"]\n message = message_hash[\"message\"]\n type = message[\"type\"]\n\n post(send(type, message_hash))\n end",
"def send(hash)\n Hammer.logger.debug \"Websocket sending: #{hash}\" if config[:logger][:show_traffic]\n ... | [
"0.64630187",
"0.6411132",
"0.63846236",
"0.6372812",
"0.63547486",
"0.6353235",
"0.63348615",
"0.6319651",
"0.6243127",
"0.6243127",
"0.6239985",
"0.62027514",
"0.618329",
"0.6130725",
"0.6118807",
"0.6084757",
"0.60483766",
"0.6025956",
"0.59947616",
"0.5980335",
"0.5980298... | 0.6747904 | 0 |
Send the data given by the data param if running on a posix system this uses Ruby's fork method to send if on windows fork won't be attempted. +data+:: the data to send +type+:: :text or :binary, defaults to :text | def send_data(data, type = :text)
pid = Thread.new do
do_send(data, type)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _send_data(data)\n send_data(data + \"\\r\\n\")\n end",
"def send_data(data)\n str_data = data.pack('C*')\n super(str_data)\n end",
"def send_data(data)\n case data\n when nil\n put_string(\"NIL\")\n when String\n send_string_data(data)\n w... | [
"0.7245496",
"0.71410024",
"0.7053566",
"0.7043369",
"0.701183",
"0.68845046",
"0.68845046",
"0.6847166",
"0.68200195",
"0.67849225",
"0.6743939",
"0.667417",
"0.6670131",
"0.6663493",
"0.6640174",
"0.6599512",
"0.65946305",
"0.6562405",
"0.6481626",
"0.6396668",
"0.6396668",... | 0.77660716 | 0 |
this method is lifted from image_processing gem copies the original image to a tempfile because we don't want to mess with the original | def _copy_to_tempfile(file)
args = [File.basename(file.path, ".*"), File.extname(file.path)] if file.respond_to?(:path)
tempfile = Tempfile.new(args || "image", binmode: true)
IO.copy_stream(file, tempfile.path)
file.rewind
tempfile
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tempfile\n @tempfile ||= ::Tempfile.new(filename, tempfile_path).tap do |t|\n t.close\n image.write(t.path)\n end\n end",
"def _copy_to_tempfile(file)\n args = [File.basename(file.path, \".*\"), File.extname(file.path)] if file.respond_to?(:path)\n tem... | [
"0.7118234",
"0.68954945",
"0.68207026",
"0.67693514",
"0.6742517",
"0.6735271",
"0.6435347",
"0.6431835",
"0.636968",
"0.63153666",
"0.62780744",
"0.62558055",
"0.6225623",
"0.6166958",
"0.6164401",
"0.61597097",
"0.61592823",
"0.61592823",
"0.6159278",
"0.6117659",
"0.61027... | 0.7130066 | 0 |
playing one round of game till the word is not found in the dictionary | def play_round
until dictionary.include?(fragment) && fragment != ""
puts "Current player : #{current_player.name}"
add_letter(current_player)
print "Current fragment of a word: "
puts "'#{fragment}'".green
next_player!
end
if losses[previous_player] + 1 == "ghost".length
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def play\n while @tries.positive?\n print_guesses_remaining\n print_used_letters\n print_word\n\n input = scan_letter\n\n result = process_letter(input)\n\n if %w[save exit].include? result\n process_forced_exit(result)\n return\n end\n\n next unless win?\n\... | [
"0.7017566",
"0.68730474",
"0.6781907",
"0.6778089",
"0.6763997",
"0.6715527",
"0.66985714",
"0.6687126",
"0.66843826",
"0.6584243",
"0.6571828",
"0.6564845",
"0.6538154",
"0.6507142",
"0.64864975",
"0.64619064",
"0.6456214",
"0.6431511",
"0.6415187",
"0.6371767",
"0.63660717... | 0.74488264 | 0 |
End of test method test_Currency_001_CommaDelimit =========================================================================== Testcase method: test_Currency_002_Format_To_Amount Description: Tests WatirWorks method: format_to_currency(...) Attempts to convert strings to amounts =========================================... | def test_Currency_002_Format_To_Amount
puts2("")
puts2("#######################")
puts2("Testcase: test_Currency_002_Format_To_Amount")
puts2("#######################")
begin # convert_ToCurrency
############################
sThisTaskName = "1000 to $1,000.00"
puts2(" # BEGIN: "... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_Currency_003_Format_From_Amount\n\n\n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_Currency_003_Format_From_Amount\")\n puts2(\"#######################\")\n\n begin # convert_StringFromCurrency\n\n\n ############################\n sThisTaskName = \"$1,... | [
"0.75067717",
"0.6833451",
"0.6640417",
"0.6573491",
"0.64119256",
"0.5991208",
"0.59187347",
"0.58869374",
"0.58498573",
"0.577752",
"0.57726",
"0.5769322",
"0.5752853",
"0.571004",
"0.5699625",
"0.5643189",
"0.56113106",
"0.5605286",
"0.560388",
"0.56036747",
"0.55952466",
... | 0.7295269 | 1 |
End of test method test_Currency_002_Format_To_Amount ============================================================================= Testcase method: test_Currency_003_Format_From_Amount Description: Tests WatirWorks method: format_from_currency(...) Attempts to convert amounts to strings ===============================... | def test_Currency_003_Format_From_Amount
puts2("")
puts2("#######################")
puts2("Testcase: test_Currency_003_Format_From_Amount")
puts2("#######################")
begin # convert_StringFromCurrency
############################
sThisTaskName = "$1,000 to 1000"
puts2("... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_Currency_002_Format_To_Amount\n\n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_Currency_002_Format_To_Amount\")\n puts2(\"#######################\")\n\n begin # convert_ToCurrency\n\n ############################\n sThisTaskName = \"1000 to $1,000.00\"... | [
"0.7666352",
"0.6993375",
"0.6877273",
"0.65676624",
"0.64904284",
"0.6437494",
"0.6318273",
"0.63112074",
"0.6294731",
"0.6290442",
"0.62497383",
"0.6223843",
"0.6213673",
"0.61882263",
"0.6166752",
"0.61393404",
"0.61085856",
"0.6106045",
"0.6091225",
"0.6088542",
"0.606385... | 0.7910124 | 0 |
GET /tipo_actividads GET /tipo_actividads.json | def index
@tipo_actividads = TipoActividad.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @tipo_actividad = TipoActividad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_actividad }\n end\n end",
"def index\n @actividads = Actividad.all\n end",
"def show\n @activo = Activo.find(params[:id])\n\n re... | [
"0.7129683",
"0.6676199",
"0.66501236",
"0.66076255",
"0.6606381",
"0.6558203",
"0.65266496",
"0.65253615",
"0.64946395",
"0.644516",
"0.64268714",
"0.64155716",
"0.63872033",
"0.6355061",
"0.63419795",
"0.6315225",
"0.62956417",
"0.62670964",
"0.62420577",
"0.6238409",
"0.62... | 0.72707134 | 0 |
POST /tipo_actividads POST /tipo_actividads.json | def create
@tipo_actividad = TipoActividad.new(tipo_actividad_params)
respond_to do |format|
if @tipo_actividad.save
format.html { redirect_to @tipo_actividad, notice: 'Tipo actividad se creó correctamente.' }
format.json { render :show, status: :created, location: @tipo_actividad }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @tipo_actividad = TipoActividad.new(params[:tipo_actividad])\n\n respond_to do |format|\n if @tipo_actividad.save\n format.html { redirect_to @tipo_actividad, notice: 'Tipo actividad was successfully created.' }\n format.json { render json: @tipo_actividad, status: :created, l... | [
"0.67348546",
"0.6442891",
"0.62742347",
"0.6253749",
"0.62522805",
"0.6203949",
"0.6197207",
"0.61944884",
"0.61769533",
"0.61542404",
"0.6140967",
"0.6110963",
"0.60681707",
"0.6025925",
"0.60028255",
"0.5994297",
"0.5980875",
"0.59744686",
"0.5971107",
"0.59681594",
"0.595... | 0.6750269 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.