query stringlengths 7 9.5k | document stringlengths 10 1.07M | negatives listlengths 19 19 | metadata dict |
|---|---|---|---|
Fetches install.sh file to the Host's Vagrant TMP directory. Mostly lifted from: mitchellh/vagrant/blob/master/lib/vagrant/action/builtin/box_add.rb | def fetch_install_sh(env)
@install_sh_temp_path =
env[:tmp_path].join(Time.now.to_i.to_s + '-install.sh')
@logger.info("Downloading install.sh to: #{@install_sh_temp_path}")
url = INSTALL_SH
if File.file?(url) || url !~ /^[a-z0-9]+:.*$/i
@logger.info('Ass... | [
"def fetch_or_create_install_script(env)\n @script_tmp_path =\n env[:tmp_path].join(\"#{Time.now.to_i}-#{install_script_name}\")\n\n @logger.info(\"Generating install script at: #{@script_tmp_path}\")\n\n url = @install_script\n\n if File.file?(url) || url !~ /^[a-z0-9... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /nha_xuat_bans or /nha_xuat_bans.json | def index
@nha_xuat_bans = NhaXuatBan.all
end | [
"def index\n @nhaxuatbans = Nhaxuatban.all\n end",
"def index\n\n @bans = @cloud.bans.where(\n params.select { |k,v| [:offender_id,:enforcer_id].include?(k.to_sym) }\n ).order_by(due: :desc)\n\n render status: 200\n end",
"def get_all_bans(username)\n response = get(\"http://api.fishbans.c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /nha_xuat_bans or /nha_xuat_bans.json | def create
@nha_xuat_ban = NhaXuatBan.new(nha_xuat_ban_params)
respond_to do |format|
if @nha_xuat_ban.save
format.html { redirect_to @nha_xuat_ban, notice: "Nha xuat ban was successfully created." }
format.json { render :show, status: :created, location: @nha_xuat_ban }
else
... | [
"def create\n @nhaxuatban = Nhaxuatban.new(nhaxuatban_params)\n\n respond_to do |format|\n if @nhaxuatban.save\n format.html { redirect_to @nhaxuatban, notice: \"Nhaxuatban was successfully created.\" }\n format.json { render :show, status: :created, location: @nhaxuatban }\n else\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PATCH/PUT /nha_xuat_bans/1 or /nha_xuat_bans/1.json | def update
respond_to do |format|
if @nha_xuat_ban.update(nha_xuat_ban_params)
format.html { redirect_to @nha_xuat_ban, notice: "Nha xuat ban was successfully updated." }
format.json { render :show, status: :ok, location: @nha_xuat_ban }
else
format.html { render :edit, status: :... | [
"def update\n respond_to do |format|\n if @nhaxuatban.update(nhaxuatban_params)\n format.html { redirect_to @nhaxuatban, notice: \"Nhaxuatban was successfully updated.\" }\n format.json { render :show, status: :ok, location: @nhaxuatban }\n else\n format.html { render :edit, status... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /nha_xuat_bans/1 or /nha_xuat_bans/1.json | def destroy
@nha_xuat_ban.destroy
respond_to do |format|
format.html { redirect_to nha_xuat_bans_url, notice: "Nha xuat ban was successfully destroyed." }
format.json { head :no_content }
end
end | [
"def destroy\n @nhaxuatban.destroy\n respond_to do |format|\n format.html { redirect_to nhaxuatbans_url, notice: \"Nhaxuatban was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bahan = Bahan.find(params[:id])\n @bahan.destroy\n\n respond_t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the UCS codepoint of this character. (This string must contain only one character.) Currently only UTF8 encoding is supported. | def codepoint
unless $KCODE =~ /^u/i
raise ArgumentError, "unsupported encoding (#{$KCODE})"
end
unless jlength == 1
raise RangeError, "string must be exactly one character long"
end
case self.length
when 1
UCSCodepoint.new(self[0])
when 2
UCSCodepoint.new(
((s... | [
"def codepoint_of(character)\n character.unpack('U*').first\nend",
"def get_codepoint(character)\n \"%04x\" % character.unpack(\"U\")[0]\n end",
"def char_to_codepoint(c)\n codepoint = charset.index c\n if codepoint.nil?\n fail NotInCharset, \"Char \\\"#{c}\\\" not part of the supp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /admin/counter_agents GET /admin/counter_agents.json | def index
@admin_counter_agents = CounterAgent.order(created_at: :desc).page params[:page]
end | [
"def agents\n @response_data[\"agents\"]\n end",
"def index\n @registered_agents = RegisteredAgent.all\n end",
"def index\n @user_agents = UserAgent.all.order(:counter)\n respond_to do |format|\n format.html\n format.json {\n render json: @user_agents\n }\n end\n end",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /admin/counter_agents POST /admin/counter_agents.json | def create
@admin_counter_agent = CounterAgent.new(admin_counter_agent_params)
@admin_counter_agent.user.set_user_password
@admin_counter_agent.user.set_role("counter_agent")
respond_to do |format|
if @admin_counter_agent.save
format.html { redirect_to [:admin, @admin_counter_agent], noti... | [
"def create\n @agent = current_user.agents.new(agent_params)\n\n respond_to do |format|\n if @agent.save\n format.html { redirect_to @agent, notice: 'Agent was successfully created.' }\n format.json { render action: 'show', status: :created, location: @agent }\n else\n format.ht... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PATCH/PUT /admin/counter_agents/1 PATCH/PUT /admin/counter_agents/1.json | def update
respond_to do |format|
if (@admin_counter_agent.update(number: admin_counter_agent_params[:number],
centre: admin_counter_agent_params[:centre], country_iso_code: admin_counter_agent_params[:country_iso_code]) && @admin_counter_agent.user.update_without_passwor... | [
"def update\n @custom_agent = CustomAgent.find(params[:id])\n\n respond_to do |format|\n if @custom_agent.update_attributes(params[:custom_agent])\n format.html { redirect_to @custom_agent, notice: 'Custom agent was successfully updated.' }\n format.json { head :no_content }\n else\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /admin/counter_agents/1 DELETE /admin/counter_agents/1.json | def destroy
@admin_counter_agent.destroy
respond_to do |format|
format.html { redirect_to admin_counter_agents_url, notice: "Counter agent was successfully destroyed." }
format.json { head :no_content }
end
end | [
"def delete_agent id\n\t\t\t\t\tbegin\n\t\t\t\t\t\t( @connection.delete AGENTS, id ).code\n\t\t\t\t\trescue Freshdesk::Api::ServerError\n\t\t\t\t\t\t200\n\t\t\t\t\tend\n\t\t\t\tend",
"def destroy\n @agent.destroy\n respond_to do |format|\n format.html { redirect_to agents_url }\n format.json { hea... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a new FuzzyTime clock, intialized to the given time. If no intial time is specified, the current time is used. The default fuzz is 1 digit; the default wobble is 5 minutes; times are represented in 12hour style by default. | def initialize ( actual=nil )
@actual = actual || Time.new() # the actual time (Time)
@current = nil # the time that we report (Time)
@updated = Time.new # when @current was last updated (Time)
@wobble = 5 # the maximum error in @current (minutes)
... | [
"def fuzzy_time\n fuzzy_seconds = @fuzzy_factor * 60\n\n # Raise the low watermark if it is lower than allowed, if we\n # advanced by a huge degree, etc.\n @low_water_mark =\n [@low_water_mark, @current_time - fuzzy_seconds].max\n\n # Compute a new random time, and set it to be the fuzzy time if... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Advance the actual time to account for the time since it was last changed. (The reported time may or may not change.) | def update
advance( (Time.new - @updated).to_i )
end | [
"def update_time\n @current = (Time.now - @initial).round 2\n end",
"def update_time\n delta = Gosu.milliseconds - @last_ms\n @last_ms = Gosu.milliseconds\n delta\n end",
"def advance(secs)\n @actual += secs\n @current_systime = Time.new\n end",
"def update_time\n sel... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a string representation of the fuzzy time. The number of digits obscured by tildes is controlled by the 'fuzz' attribute. Whether the time is in 12 or 24hour style is controlled by 'am_pm'. | def to_s
if @am_pm
display = @current.strftime("%I:%M")
else
display = @current.strftime("%H:%M")
end
@fuzz.times { display.sub!(/\d(\D*)$/, '~\1') } if @fuzz > 0
display
end | [
"def to_s\n ft = fuzzy_time\n s = ft.strftime(\"%H:%M\")\n s[4] = '~'\n s\n end",
"def fuzzy_time\n fuzzy_seconds = @fuzzy_factor * 60\n\n # Raise the low watermark if it is lower than allowed, if we\n # advanced by a huge degree, etc.\n @low_water_mark =\n [@low_water_mark, @current... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create an Excel file from list of ActiveRecord objects, includes relationships Association Options See lib/exporters/configuration.rb | def export_with_associations(file_name, klass, records)
@file_name = file_name
start_excel(klass)
klass_to_headers(klass)
excel.set_headers( headers )
logger.info("Wrote headers for #{klass} to Excel")
row = 1
logger.info("Processing #{records.size} records to Excel")
... | [
"def export(file, export_records, options = {})\n records = [*export_records]\n\n if records.blank?\n logger.warn('Excel Export - No objects supplied for export - no file written')\n return\n end\n\n first = records[0]\n\n raise(ArgumentError, 'Please supply set of ActiveRecor... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate a cachebusted URL for assets. | def asset_path(url)
"/assets/cb#{settings.cachebust}/#{url}"
end | [
"def asset_url(application_id, asset_id, format = 'webp')\n \"#{cdn_url}/app-assets/#{application_id}/#{asset_id}.#{format}\"\n end",
"def asset_url(asset_name)\n \"#{@server.base_uri}?sabreAction=asset&assetName=#{URI.escape(asset_name)}\"\n end",
"def generate_asset_url(asset)\n signed_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Public: Get a node from the database. fqn String Node FQN. Returns a Config::Node or nil. | def get_node(fqn)
@database.all_nodes.find { |node| node.fqn == fqn }
end | [
"def get_node(fqn)\n node = @nodes.get_node(fqn)\n node if context?(node)\n end",
"def node\n datasource.document.xpath(xpath).first\n end",
"def node(name)\n nodes.fetch(name)\n end",
"def get_node(node_name)\n raise UnkownNodeError, \"Node #{node_name} is not defined\" unless... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Public: Find a single node. args TBD parameters to match against. Returns a Config::Node or nil. Raises AmbiguousNode if more than one node matches the parameters. | def find_node(*args)
nodes = find_all_nodes(*args)
raise AmbiguousNode if nodes.size > 1
nodes.first
end | [
"def find_node(*args)\n node = @nodes.find_node(*args)\n node if context?(node)\n end",
"def find(node)\n @nodes.find {|x| x == node}\n end",
"def find(args)\n if args.length == 1\n return find_id(args[:id]) if (args[:id])\n return find_with_status(args[:status]) if (args[:stat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Public: Find all nodes. args TBD parameters to match against. Returns an Array of Config::Node. | def find_all_nodes(*args)
raise NotImplementedError
nodes = @database.all_nodes
# TODO: design node finder syntax
nodes
end | [
"def find_all_nodes(*args)\n nodes = @nodes.find_all_nodes(*args)\n nodes.find_all { |n| context?(n) }\n end",
"def all_nodes\n Pathname.glob(node_file(\"*\", false)).map do |file|\n json = JSON.parse(file.read)\n Config::Node.from_json(json)\n end\n end",
"def find_all\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Public: Update the stored node data by inspecting the current execution environment. fqn String Node FQN. facts Config::Facts to store for the node. Returns a Config::Node. | def update_node(fqn, facts)
node = get_node(fqn) || Config::Node.from_fqn(fqn)
node.facts = facts
@database.update_node(node)
node
end | [
"def node\n Puppet::Node.new(nodename, :facts => Puppet::Node::Facts.new('facts', fact_values))\n end",
"def _update_chef_node\n step(\" updating chef node\", :blue)\n set_chef_node_attributes\n set_chef_node_environment\n sync_ipconfig_attribute\n sync_volume_attributes\n chef_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Public: Remove the node from the database. fqn String Node FQN. Returns nothing. | def remove_node(fqn)
node = get_node(fqn)
@database.remove_node(node) if node
nil
end | [
"def remove(node)\n node = node.name if Node === node\n riak_admin 'remove', node\n end",
"def remove_node\n # Interface method\n end",
"def delete_node\n delete(@nodename)\n end",
"def delete node\n end",
"def remove_node(index)\n nodes.data.delete_at(inde... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add druid: prefix to list of pids if it doesn't have it yet | def pids_with_prefix(pids)
return pids if pids.blank?
pids.split.flatten.map { |pid| pid.start_with?('druid:') ? pid : "druid:#{pid}" }.join("\n")
end | [
"def prefix_id\n @prefix_id ||= 0\n end",
"def prefixed(p)\n condition { env['enron.api.prefix'] == p }\n end",
"def use_prefix\n prefix, @prefix = @prefix, nil\n @res << prefix if prefix\n\n prefix\n end",
"def on_prefix(prefix_node)\n prefix = prefix_node.identifier\n bel... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Physical ID of the resource created | def physical_resource_id
"#{self.class.name.split('::').last}-#{Carnivore.uuid}"
end | [
"def resource_id\n return \"%s:%s\" % [self.resource_type, self.id]\n end",
"def resource_id\n '%s:%s' % [resource_type, id]\n end",
"def get_id \n self.resource_id\n end",
"def resource_id\n return @resource_id\n end",
"def new_resource_id... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Unpack message and create payload | def unpack(message)
payload = super
if(self.is_a?(Jackal::Cfn::Resource))
begin
if(payload['Message'])
payload = MultiJson.load(payload['Message']).to_smash
payload = transform_parameters(payload)
payload[:origin_type] = message[:message].g... | [
"def unpack(message_payload)\n # TODO make the unpacker (maybe need a different name for this) it's own thing that can be plugged in\n # this example uses Marshal.load ...which assumes Marshal.dump was used to send the message...but maybe it wasn't\n # either way, ultimately the thing that packages u... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Custom wrap to send resource failure | def failure_wrap(message)
begin
payload = unpack(message)
yield payload
rescue => e
error "Unexpected error encountered processing custom resource - #{e.class}: #{e.message}"
debug "#{e.class}: #{e}\n#{e.backtrace.join("\n")}"
cfn_resource = payload.get(... | [
"def wrapped_exception; end",
"def resource_failed_retriable(resource, action, retry_count, exception); end",
"def wrap(response)\n raise_throttling_error(response) if response.status == 429\n return failure(response) if response.status >= 300\n\n catch_upload_errors(response)\n succ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initializes balance to equal 0 and in_journey is false | def initialize
@balance = 0
@in_journey = false
@entry_station != nil
end | [
"def initialize\n @balance = 0\n @journey = nil\n end",
"def set_default_balance\n self.balance ||= 0\n end",
"def set_defaults\n self.balance ||= 0\n end",
"def set_balance!(value)\n\t\t@balance.balance = value\n\t\t@bet = 0 \n\tend",
"def initialize\n @running_balance = {}\n ru... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Width in pixels when in expanded state | def expanded_width
source_node[:expandedWidth].to_i
end | [
"def expand_width?\n e = self.expand\n e == :width || (e.respond_to?(:include?) && e.include?(:width))\n end",
"def transition_width\r\n 5.5 / @size\r\n end",
"def width\n return @window_width # outer width\nend",
"def expanded_height\n source_node[:expandedHeight].to_i\n end",... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Height in pixels when in expanded state | def expanded_height
source_node[:expandedHeight].to_i
end | [
"def expand_height?\n e = self.expand\n e == :height || (e.respond_to?(:include?) && e.include?(:height))\n end",
"def visible_height\n @win.maxy - 2\n end",
"def fullheight\n return self.bitmap.height.to_f * self.zoom_y\n end",
"def height\n self[\"height\"] = DEFAULT_HEIGHT unless ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Whether the mediafile must have its aspect ratio maintained when scaled | def maintain_aspect_ratio?
source_node[:maintainAspectRatio]=="true"
end | [
"def scaling?\n @av_codec_ctx[:width] != @width or\n @av_codec_ctx[:height] != @height or\n @av_codec_ctx[:pix_fmt] != @pixel_format\n end",
"def reduce?\n case size\n when IIIF::Image::Size::Full, IIIF::Image::Size::Max\n false\n when IIIF::Image::Size::Absolute\n aspec... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
MIDPOINTS Half way point between two points. Returns coordinates array [lat, lon] of the mid point within a great cirle path (shortest surface path) | def orthodrome_midpoint(lat1, lon1, lat2, lon2)
dlon = (lon2 - lon1) * RAD_PER_DEG
cola1 = Math.cos(lat1 * RAD_PER_DEG)
sila1 = Math.sin(lat1 * RAD_PER_DEG)
cola2 = Math.cos(lat2 * RAD_PER_DEG)
sila2 = Math.sin(lat2 * RAD_PER_DEG)
x = cola2 * Math.cos(dlon)
y = cola2 * Math.sin... | [
"def midpoint\n Point.new((x1 + x2) / 2, (y1 + y2) / 2)\n end",
"def middlePoint(point1, point2)\r\n [(point1[0] + point2[0]) / 2.0, (point1[1] + point2[1]) / 2.0]\r\n end",
"def jbpMidPoint(first_point, second_point)\n jbpMult(jbpAdd(first_point, second_point), 0.5)\n end",
"def midpoint(lat1... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the method to call on identifiers going into the database: DB[:items] SELECT FROM items DB.identifier_input_method = :upcase DB[:items] SELECT FROM ITEMS | def identifier_input_method=(v)
reset_default_dataset
@identifier_input_method = v
end | [
"def reset_identifier_mangling\n # SEQUEL5: Stop checking Database.*\n @quote_identifiers = @opts.fetch(:quote_identifiers){(qi = Database.quote_identifiers).nil? ? quote_identifiers_default : qi}\n @identifier_input_method = @opts.fetch(:identifier_input_method){(iim = Database.identifier_inpu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set whether to quote identifiers (columns and tables) for this database: DB[:items] SELECT FROM items DB.quote_identifiers = true DB[:items] SELECT FROM "items" | def quote_identifiers=(v)
reset_default_dataset
@quote_identifiers = v
end | [
"def quote_identifiers?\n @opts.fetch(:quote_identifiers, db.quote_identifiers?)\n end",
"def quote_identifiers=(v)\n reset_default_dataset\n @quote_identifiers = v\n end",
"def quote_identifiers?\n return @quote_identifiers unless @quote_identifiers.nil?\n @quote_identifiers ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if the database quotes identifiers. | def quote_identifiers?
@quote_identifiers
end | [
"def quote_identifiers?\n @opts.fetch(:quote_identifiers, db.quote_identifiers?)\n end",
"def quote_identifiers?\n @quote_identifiers\n end",
"def quote_identifiers?\n return @quote_identifiers unless @quote_identifiers.nil?\n @quote_identifiers = @opts.fetch(:quote_identifiers, (@... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a dataset that uses the default identifier input and output methods for this database. Used when parsing metadata so that column symbols are returned as expected. | def _metadata_dataset
super.
with_identifier_input_method(identifier_input_method_default).
with_identifier_output_method(identifier_output_method_default)
end | [
"def metadata_dataset\n return @metadata_dataset if @metadata_dataset\n ds = dataset\n ds.identifier_input_method = identifier_input_method_default\n ds.identifier_output_method = identifier_output_method_default\n @metadata_dataset = ds\n end",
"def metadata_dataset\n ds = supe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reset the identifier mangling options. Overrides any already set on the instance. Only for internal use by shared adapters. | def reset_identifier_mangling
# SEQUEL5: Stop checking Database.*
@quote_identifiers = @opts.fetch(:quote_identifiers){(qi = Database.quote_identifiers).nil? ? quote_identifiers_default : qi}
@identifier_input_method = @opts.fetch(:identifier_input_method){(iim = Database.identifier_input_method... | [
"def reset_identifier_mangling\n @quote_identifiers = @opts.fetch(:quote_identifiers){(qi = Database.quote_identifiers).nil? ? quote_identifiers_default : qi}\n @identifier_input_method = @opts.fetch(:identifier_input_method){(iim = Database.identifier_input_method).nil? ? identifier_input_method_default ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check with the database to see if identifier quoting is enabled | def quote_identifiers?
@opts.fetch(:quote_identifiers, db.quote_identifiers?)
end | [
"def quote_identifiers?\n @quote_identifiers\n end",
"def quote_identifiers?\n @quote_identifiers\n end",
"def quote_identifiers?\n return @quote_identifiers unless @quote_identifiers.nil?\n @quote_identifiers = @opts.fetch(:quote_identifiers, (@@quote_identifiers.nil? ? quote_iden... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a modified dataset with identifier_output_method set. | def with_identifier_output_method(meth)
clone(:identifier_output_method=>meth)
end | [
"def output_identifier_meth(ds=nil)\n (ds || dataset).method(:output_identifier)\n end",
"def _metadata_dataset\n super.\n with_identifier_input_method(identifier_input_method_default).\n with_identifier_output_method(identifier_output_method_default)\n end",
"def metadata_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert the identifier to the version used in the database via identifier_input_method. | def input_identifier(v)
(i = identifier_input_method) ? v.to_s.send(i) : v.to_s
end | [
"def convert_identifier(identifier)\n case identifier\n when SQL::Identifier\n identifier.value.to_s\n else\n identifier\n end\n end",
"def identifier_hash_for identifier_hash\n identifier_hash.is_a?(String) ? latest_version_for(identifier_hash) : identifier... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Translates the input text and stores it to the output text At some point, it will do the actual translation, for now it does nothign | def translate_input_text
if self.language
self.output_text = self.language.translate(self.input_text)
else
self.output_text = self.input_text
end
end | [
"def translate text\r\n\r\n text = text.to_s\r\n \r\n return text unless @translations_enabled\r\n \r\n @no_translate_patterns.each do |pattern|\r\n return text if text =~ pattern\r\n end\r\n \r\n key = nil\r\n \r\n en_bundles = @bundles[:en]\r\n \r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /st_has_deps GET /st_has_deps.json | def index
@st_has_deps = StHasDep.all
end | [
"def dependencies_satisfied?\n missing_dependencies.empty?\n end",
"def dependencies_satisfied?(deps)\n deps.all? do |dep|\n depprop = Proposal.where(barclamp: dep[\"barclamp\"], name: dep[\"inst\"]).first\n depprop_queued = depprop[\"deployment\"][dep[\"barclamp\"]][\"crowbar-queued\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PATCH/PUT /st_has_deps/1 PATCH/PUT /st_has_deps/1.json | def update
respond_to do |format|
if @st_has_dep.update(st_has_dep_params)
format.html { redirect_to @st_has_dep, notice: 'St has dep was successfully updated.' }
format.json { render :show, status: :ok, location: @st_has_dep }
else
format.html { render :edit }
format.jso... | [
"def update\n @service = Service.find(params[:id])\n\n update_depending(params[\"service\"][\"dependings\"])\n update_dependant(params[\"service\"][\"inverse_dependings\"])\n\n respond_to do |format|\n if @service.update_attributes(service_params)\n format.html { redirect_to services_path(:a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /st_has_deps/1 DELETE /st_has_deps/1.json | def destroy
@st_has_dep.destroy
respond_to do |format|
format.html { redirect_to st_has_deps_url, notice: 'St has dep was successfully destroyed.' }
format.json { head :no_content }
end
end | [
"def destroy\n @depend.destroy\n respond_to do |format|\n format.html { redirect_to depends_url, notice: 'Depend was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stu_has_dep.destroy\n respond_to do |format|\n format.html { redirect_to s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
duplicates a data criteria. This is important because we may be modifying source data criteria like patient characteristic birthdate to add restrictions the restrictions added may be different for the numerator, denominator, different IPP_1, IPP_2, etc. | def duplicate_data_criteria(data_criteria, parent_id)
if (data_criteria.is_a? HQMF::Converter::SimpleDataCriteria and data_criteria.precondition_id == parent_id)
new_data_criteria = data_criteria
else
new_data_criteria = HQMF::Converter::SimpleDataCriteria.from_data_criteria(data_crit... | [
"def update_data_criteria(data_criteria, source_data_criteria)\n # step through each criteria and look for groupers (type derived) with one child\n data_criteria.map do |criteria|\n if criteria.type == \"derived\".to_sym && criteria.children_criteria.length == 1\n source_data_criteria.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
make sure that if a data criteria is used as a target, that it is not deleted by someone else. this is required for birthdate in NQF0106 | def validate_not_deleted(target)
@v2_data_criteria_to_delete[target] = false
end | [
"def unsubstituable_data_criteria?(data_criteria)\n cr = data_criteria\n cr['negation'] || cr['definition'] == 'derived' || cr['type'] == 'derived' || (cr['type'] == 'characteristic' && cr['property'] == 'birthtime')\n end",
"def remove_assessment_data_if_employee_not_assessed\n # if is_not_assessed?\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
grouping data criteria are used to allow a single reference off of a temporal reference or subset operator grouping data criteria can reference either regular data criteria as children, or other grouping data criteria | def create_group_data_criteria(preconditions, type, value, parent_id, id, standard_category, qds_data_type)
extract_group_data_criteria_tree(HQMF::DataCriteria::UNION,preconditions, type, parent_id)
end | [
"def extract_group_data_criteria_tree(conjunction, preconditions, type, parent_id)\n \n children = []\n preconditions.each do |precondition|\n if (precondition.comparison?) \n if (precondition.reference.id == HQMF::Document::MEASURE_PERIOD_ID)\n children << measure_period_c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
pull the children data criteria out of a set of preconditions | def extract_group_data_criteria_tree(conjunction, preconditions, type, parent_id)
children = []
preconditions.each do |precondition|
if (precondition.comparison?)
if (precondition.reference.id == HQMF::Document::MEASURE_PERIOD_ID)
children << measure_period_criteria
... | [
"def conditions_for_all_children\n pk = \"#{self.class.table_name} WHERE id = #{self.id}\"\n inner_r = \"(SELECT #{root_column} FROM #{pk})\"\n inner_d = \"(SELECT #{depth_column} FROM #{pk})\"\n inner_l = \"(SELECT #{left_col_name} FROM #{pk})\"\n inner_r = \"(SELECT #{... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this method creates V1 data criteria for the measurement period. These data criteria can be referenced properly within the restrictions | def create_measure_period_v1_data_criteria(doc,measure_period,v1_data_criteria_by_id)
attributes = doc[:attributes]
attributes.keys.each {|key| attributes[key.to_s] = attributes[key]}
measure_period_key = attributes['MEASUREMENT_PERIOD'][:id]
measure_start_key = attributes['MEASUREMENT_S... | [
"def get_criteria\n parameters = params[:analysis] ? params[:analysis] : params\n criteria = { name: parameters[:name] }\n criteria[:collection] = parameters[:collection] if parameters[:collection].present?\n if parameters[:date_from].present?\n criteria[:attribute] = :date\n criteria[:value] ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Send a DNS NOTIFY to all slaves. Fails when zone kind is not Master or Slave, or master and slave are disabled in the configuration. Only works for Slave if renotify is on. Clients MUST NOT send a body. | def notify_zone(server_id, zone_id, opts = {})
notify_zone_with_http_info(server_id, zone_id, opts)
nil
end | [
"def notify \n hosts = get_entity(\"hoststatus\")\n services = get_entity(\"servicestatus\")\n \n unless hosts.empty? and services.empty?\n @config[:subscribers].each do |subscriber|\n Notifier.send_notification({\n :hosts => hosts,\n :services => services,\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Modifies basic zone data (metadata). Allowed fields in client body: all except id, url and name. Returns 204 No Content on success. | def put_zone_with_http_info(server_id, zone_id, zone_struct, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ZonesApi.put_zone ...'
end
# verify the required parameter 'server_id' is set
if @api_client.config.client_side_validation && server_id.ni... | [
"def zones_modify zID:, name: nil, adformat: nil, zgID: nil \n call_adglare_api 'zones_modify', {zID: zID, zgID: zgID, adformat: adformat, name: name}\n end",
"def update\n @zone = Zone.find(params[:id])\n\n if @zone.update(zone_params)\n head :no_content\n else\n render json: @zone.errors,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Rectify the zone data. This does not take into account the APIRECTIFY metadata. Fails on slave zones and zones that do not have DNSSEC. | def rectify_zone(server_id, zone_id, opts = {})
data, _status_code, _headers = rectify_zone_with_http_info(server_id, zone_id, opts)
data
end | [
"def rectify_zone_with_http_info(server_id, zone_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ZonesApi.rectify_zone ...'\n end\n # verify the required parameter 'server_id' is set\n if @api_client.config.client_side_validation && server_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Rectify the zone data. This does not take into account the APIRECTIFY metadata. Fails on slave zones and zones that do not have DNSSEC. | def rectify_zone_with_http_info(server_id, zone_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ZonesApi.rectify_zone ...'
end
# verify the required parameter 'server_id' is set
if @api_client.config.client_side_validation && server_id.nil?
... | [
"def rectify_zone(server_id, zone_id, opts = {})\n data, _status_code, _headers = rectify_zone_with_http_info(server_id, zone_id, opts)\n data\n end",
"def clean_air_zones_data\n ComplianceCheckerApi.clean_air_zones\n end",
"def normalize_zone(name,zones,rules,leaps) \n # here is our logic:\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Strings representaion of provider's box | def provider_box
strings = []
strings << @document.provider_name
strings << @labels[:provider]
@document.provider_lines.split("\n").each do |line|
strings << line
end
strings << "#{@labels[:tax_id]}: #{@document.provider_tax_id}" \
unless @document.provider_tax_id.... | [
"def bounding_box_str\n return nil unless longitude && latitude\n\n \"#{longitude} #{latitude} #{longitude} #{latitude}\"\n end",
"def get_box(name)\n if current_provider.nil?\n raise \"Provider is unset in the environment.\"\n else\n providers[current_provider].get_box(name)\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Strings representaion of purchaser's box | def purchaser_box
strings = []
strings << @document.purchaser_name
strings << @labels[:purchaser]
@document.purchaser_lines.split("\n").each do |line|
strings << line
end
strings << "#{@labels[:tax_id]}: #{@document.purchaser_tax_id}" \
unless @document.purchaser_t... | [
"def brief_inventory\n self.seed_bag_count_hash(0).each do |crop_name, amount|\n puts \"#{crop_name}\".upcase.bold + \" x#{amount}\"\n end\n #=> TURNIP x4\n #=> TOMATO x1\n end",
"def print_boxes\n puts \"\\nThe following boxes are still in the game:\"\n puts \"\\t[ #{ @remaining_boxes.join( '... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Strings representaion of account's box | def account_box
strings = []
if @document.bank_account_number.nil?
strings << @labels[:payment_in_cash]
else
strings << @labels[:payment_by_transfer]
end
strings << "#{@labels[:account_number]}"
strings << @document.bank_account_number
strings << "#{@labels[:swi... | [
"def po_box\n \"PO BOX #{po_box_number}\" unless po_box_number.vacant?\n end",
"def print_boxes\n puts \"\\nThe following boxes are still in the game:\"\n puts \"\\t[ #{ @remaining_boxes.join( ' ' ) } ]\"\nend",
"def account_name_balance\n name + ' (' + current_balance_display + ')'\n end",
"def bou... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Strings representaion of dates box | def dates_box
strings = []
strings << "#{@labels[:issue_date]}"
strings << @document.issue_date
strings << "#{@labels[:due_date]}"
strings << @document.due_date
strings
end | [
"def to_s\n names = @long ? LONG_NAMES : SHORT_NAMES\n result = []\n @days.each do |d|\n case d\n when Integer\n result << names[d]\n when Range\n result << names[d.first] + \"-\" + names[d.last]\n end\n end\n result.join(\", \")\n end... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Strings representaion of items table | def items_table
strings = []
strings << @labels[:item] if determine_items_structure[:names]
strings << @labels[:quantity] if determine_items_structure[:quantities]
strings << @labels[:unit] if determine_items_structure[:units]
strings << @labels[:price_per_item] if determine_items_structur... | [
"def items_human\n if self.items\n self.items.join(', ')\n else\n \"\"\n end\n end",
"def items_as_string\n str = \"\"\n @items_hash.each do |key, value|\n this_is_wrong = \"fix_me_please\"\n # HINT: the next line is not correctly displaying the count\n # of each item.\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Strings representaion of totals table | def totals_table
strings = []
strings << "#{@labels[:subtotal]}:"
strings << @document.subtotal
strings << "#{@labels[:tax]}:"
strings << @document.tax
strings << "#{@labels[:tax2]}:"
strings << @document.tax2
strings << "#{@labels[:tax3]}:"
strings << @document.tax... | [
"def spending_table(hash, total)\n puts \"\".center(80, \"_\")\n hash.each{ |item, value| puts tabled_format(item, value) }\n puts \"\".center(80, \"_\")\n total = hash.values.inject(:+)\n puts tabled_format(\"Total\", total)\n end",
"def print_totals(col)\n return if col.empty?\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert document +item+ to a single string array | def item_to_a(item)
ary = []
ary << item.name
ary << item.quantity
ary << item.unit
ary << item.price
ary << item.tax
ary << item.tax2
ary << item.tax3
ary << item.amount
ary.compact
end | [
"def convert_all_item\n item_json = @data.collect { |item| convert_single_item(item) }\n return item_json\n end",
"def _getarray\n if @document.nil?\n return @list\n else\n return @document.native_text\n end\n end",
"def item_to_xref(item)\n item.select { |field... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns false if either review has been made or user is trying to post a review to a job he created | def job_creator
@job.reviews.empty? && @job.user.id != current_user.id
end | [
"def post_review?(next_review, user)\n\n (next_review && \n !self.review_locked? && \n next_review.designer_id == user.id &&\n next_review.review_type_id == next_review.design.phase_id)\n\n end",
"def wasReviewed?(user)\n return true\n tivit_user_status ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds a message and callback to the batch. The method will indicate how the message is added. It will either be added to the active list of items, it will be queued to be picked up once the active publishing job has been completed, or it will indicate that the batch is full and a publishing job should be created. | def add msg, callback
synchronize do
raise AsyncPublisherStopped if @stopping
raise OrderingKeyError, @ordering_key if @canceled
if @publishing
queue_add msg, callback
:queued
elsif try_add msg, callback
... | [
"def add_message_callback(priority = 0, ref = nil, &block)\n @messagecbs.add(priority, ref, block)\n end",
"def add_message_callback(priority = 0, ref = nil, proc=nil, &block)\n block = proc if proc\n @messagecbs.add(priority, ref, block)\n end",
"def add(item)\n @batch << item\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Indicates whether the batch has an active publishing job. | def publishing?
# This probably does not need to be synchronized
@publishing
end | [
"def is_published?\n self.publishing_state == PublishingState::PUBLISHED\n end",
"def has_pending?\n self.class.job_run_class.has_pending?(@job, @batch)\n end",
"def has_jobs?\n @em_lock.synchronize{\n @em_jobs > 0\n }\n end",
"def publish?\n published\n end",
"def active?\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Resets the batch after a successful publish. This clears the active item list and moves the queued items that will fit into the active item list. If the batch has enough queued items to fill the batch again, the publishing job should continue to publish the reset batch until the batch indicated it should stop. This met... | def reset!
synchronize do
@items = []
@total_message_bytes = @default_message_bytes
if @canceled
@queue = []
@publishing = false
return false
end
refill_items
return false u... | [
"def flush_batch\n if @batching && @batch_queue.size > 0\n flush_batch_queue()\n end\n end",
"def clearance_items!\n return if @batch_ids.empty?\n @batch.save!\n @batch_ids.each do |item_id|\n item = Item.find(item_id)\n item.clearance!\n # NOTE: Considered adding a catch here ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
representing the number of rows to print, and prints out a right triangle consisting of characters, one line per row. | def print_triangle(rows)
n = 1
while n <= rows
n += 1
x = 1
while x < n
print "*"
x += 1
end
puts ' '
end
end | [
"def print_triangle (rows)\n counter = 1\n while counter <=rows\n puts '*' * counter\n counter=counter+1\n end\nend",
"def print_triangle(rows)\n 1.upto(rows) do |i|\n puts \"*\" * i\n end\nend",
"def print_triangle(rows)\n\tif 1.upto (rows) do |i|\n\t\tputs \"*\" * i\n\t\tend\n\telse\n\t\treturn ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This check will be executed on each user that have not registration log or credit for registration log, in order to exclude the possibility that his logs haven't been stocked yet. To do so, we will throw errors only if user's updated_at time goes back more than 1 minute before last event timestamp. | def check_if_user_has_been_updated_recently(conn, user_ids, max_events_timestamp)
users_with_errors = []
conn.exec("SELECT id, updated_at FROM users WHERE id IN (#{user_ids.join(",")})").each do |user|
if DateTime.parse(user["updated_at"]) < DateTime.parse(max_events_timestamp) - 1.minutes
users_with_erro... | [
"def check_timestamp\n @recent.save! if Time.now - @recent.updated_at >= 600\n end",
"def allow_update_guardian?\r\n return true if guardian_updated_at.nil?\r\n\r\n guardian_updated_at.utc < (DateTime.now - 30.minutes).utc\r\n end",
"def triggered_at_check\n return if triggered_at.nil?\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets autoloads in the root namespace. | def setup
mutex.synchronize do
break if @setup
actual_root_dirs.each do |root_dir, namespace|
set_autoloads_in_dir(root_dir, namespace)
end
on_setup_callbacks.each(&:call)
@setup = true
end
end | [
"def setup\n mutex.synchronize do\n break if @setup\n\n actual_root_dirs.each do |root_dir, namespace|\n set_autoloads_in_dir(root_dir, namespace)\n end\n do_preload\n\n @setup = true\n end\n end",
"def on_namespace_loaded(namespace)\n if subdirs = lazy_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Eager loads all files in the root directories, recursively. Files do not need to be in `$LOAD_PATH`, absolute file names are used. Ignored files are not eager loaded. You can optout specifically in specific files and directories with `do_not_eager_load`, and that can be overridden passing `force: true`. | def eager_load(force: false)
mutex.synchronize do
break if @eager_loaded
log("eager load start") if logger
honour_exclusions = !force
queue = []
actual_root_dirs.each do |root_dir, namespace|
queue << [namespace, root_dir] unless honour_exclusions && excluded_f... | [
"def eager_load\n mutex.synchronize do\n break if @eager_loaded\n\n queue = []\n actual_root_dirs.each do |root_dir, namespace|\n queue << [namespace, root_dir] unless eager_load_exclusions.member?(root_dir)\n end\n\n while to_eager_load = queue.shift\n name... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Says if the given constant path would be unloaded on reload. This predicate returns `false` if reloading is disabled. | def unloadable_cpath?(cpath)
to_unload.key?(cpath)
end | [
"def reload?\n return true unless loaded?\n return false unless Gretel.reload_environments.include?(Rails.env)\n\n loaded_file_mtimes != breadcrumb_files.map { |file| File.mtime(file) }\n end",
"def reload?\n return @state == :reload\n end",
"def constants_loaded?\n @const... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns an array with the constant paths that would be unloaded on reload. This predicate returns an empty array if reloading is disabled. | def unloadable_cpaths
to_unload.keys.freeze
end | [
"def all_reload_files\n files = Array[$0, *$LOADED_FEATURES]\n paths = Array['./', *$LOAD_PATH]\n\n unless [@files, @paths] == [files, paths]\n @files, @paths = files.dup, paths.dup\n\n @map = files.map{|file|\n if Pathname.new(file).absolute?\n file\n else\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is a shortcut for require "zeitwerk" loader = Zeitwerk::Loader.new loader.tag = File.basename(__FILE__, ".rb") loader.inflector = Zeitwerk::GemInflector.new(__FILE__) loader.push_dir(__dir__) except that this method returns the same object in subsequent calls from the same file, in the unlikely case the gem wants ... | def for_gem
called_from = caller_locations(1, 1).first.path
Registry.loader_for_gem(called_from)
end | [
"def loader_for_gem(root_file)\n loaders_managing_gems[root_file] ||= begin\n Loader.new.tap do |loader|\n loader.tag = File.basename(root_file, \".rb\")\n loader.inflector = GemInflector.new(root_file)\n loader.push_dir(File.dirname(root_file))\n end\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Broadcasts `eager_load` to all loaders. | def eager_load_all
Registry.loaders.each(&:eager_load)
end | [
"def before_eager_load(&block); end",
"def eager_load; end",
"def eager_load=(_arg0); end",
"def do_not_eager_load(*paths)\n mutex.synchronize { eager_load_exclusions.merge(expand_paths(paths)) }\n end",
"def rake_eager_load; end",
"def eager_load_paths=(_arg0); end",
"def eager_autoload!; end",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns an array with the absolute paths of the root directories of all registered loaders. This is a readonly collection. | def all_dirs
Registry.loaders.flat_map(&:dirs).freeze
end | [
"def all_load_paths\n result = []\n Gem.path.each do |gemdir|\n each_load_path(all_partials(gemdir)) do |load_path|\n result << load_path\n end\n end\n result\n end",
"def paths\n map{ |dir| Pathname.new(dir) }\n end",
"def all_paths\n list(\".\").map... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This sort logic is critical for determining the encoding index, which is internally used in String. It must be IDENTICAL to MRI's counterpart logic. | def sort_by_encoding_index(files)
files.sort_by do |file|
token_pairs = file.scan(/(\D+)|(\d+)/)
sort_key = token_pairs.map do |letters, digits|
if letters
letters
else
padded_numeric_sort_key(digits)
end
end
sort_key.flatten
end
end | [
"def sort_titles_by_index\n validate_titles.sort_by { |titles| titles.second.to_i }\n end",
"def uid_sort(sort_keys, search_keys, charset); end",
"def sort_tokens\n @string_tokens.sort! { |a, b| b.string.length <=> a.string.length }\n end",
"def sort_key\n # Make sure sequence is at l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /feelings GET /feelings.json | def index
@feelings = Feeling.where(user: current_user).all
end | [
"def show\n @feeling = Feeling.find(params[:id])\n @sake = Sake.find(params[:sake_id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feeling }\n end\n end",
"def index\n @given_time_feelings = GivenTimeFeeling.all\n end",
"def update\n feel... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /feelings POST /feelings.json | def create
@feeling = Feeling.new(feeling_params)
respond_to do |format|
if @feeling.save
format.html { redirect_to new_feeling_path }
#format.js
format.json { render :show, status: :created, location: @feeling }
else
format.html { render :new }
#format.json ... | [
"def create\n @survey = Survey.find(params[:survey_id])\n emoji = params[:emoji]\n mood = params[:mood]\n @feeling = Feeling.new(mood: mood, emoji: emoji)\n @survey.feelings << @feeling\n\n if @feeling.save\n render :ok, json: @feeling\n else\n @errors = @feelings.error.full_messages... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PATCH/PUT /feelings/1 PATCH/PUT /feelings/1.json | def update
puts "update #{@feeling.as_json} #{updated_params.as_json}"
respond_to do |format|
if @feeling.update(updated_params)
puts "brucep update success"
#format.html { redirect_to @feeling, notice: 'Feeling was successfully updated.' }
format.html { redirect_to new_feeling_pat... | [
"def update\n feeling = Feeling.find(params[:id])\n feeling.update(feeling_params)\n render json: feeling\n end",
"def update\n @feeling = Feeling.find(params[:id])\n\n respond_to do |format|\n if @feeling.update_attributes(params[:feeling])\n format.html { redirect_to @feeling... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /configattribmasters POST /configattribmasters.json | def create
@configattribmaster = Configattribmaster.new(configattribmaster_params)
@configattribmaster.configattrib_id=session[:configattrib_id]
respond_to do |format|
if @configattribmaster.save
format.html { redirect_to @configattribmaster, notice: 'Configattribmaster was successfully create... | [
"def create\n @configattrib = Configattrib.new(configattrib_params)\n @configattrib.configdb_id=session[:configdb_id]\n respond_to do |format|\n if @configattrib.save\n format.html { redirect_to @configattrib, notice: 'Configattrib was successfully created.' }\n format.json { render :sho... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PATCH/PUT /configattribmasters/1 PATCH/PUT /configattribmasters/1.json | def update
respond_to do |format|
if @configattribmaster.update(configattribmaster_params)
format.html { redirect_to @configattribmaster, notice: 'Configattribmaster was successfully updated.' }
format.json { render :show, status: :ok, location: @configattribmaster }
else
format.... | [
"def update\n respond_to do |format|\n if @configattrib.update(configattrib_params)\n format.html { redirect_to @configattrib, notice: 'Configattrib was successfully updated.' }\n format.json { render :show, status: :ok, location: @configattrib }\n else\n format.html { render :edit... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /configattribmasters/1 DELETE /configattribmasters/1.json | def destroy
@configattribmaster.destroy
respond_to do |format|
format.html { redirect_to configattribmasters_url, notice: 'Configattribmaster was successfully destroyed.' }
format.json { head :no_content }
end
end | [
"def destroy\n @configattrib.destroy\n respond_to do |format|\n format.html { redirect_to configattribs_url, notice: 'Configattrib was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @configattribexcl.destroy\n respond_to do |format|\n form... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the invite code for the user | def invite_code
res = {}
user = User.find_by_token(params[:token])
if user
res[:status] = "0"
res[:invite_code] = user.invite_code
else
res[:status] = "1"
end
render json: res
end | [
"def guest_invite_code\n load\n @active_token_value\n end",
"def invite_user_id\n User.find_by_email(self.email).try(:id)\n end",
"def generate_invite_code\n self.invite_code = SecureRandom.hex(3)\n end",
"def get_invitation_code\n session[:invitation_code] || params[:code]\n end",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Merge the various header hashes and make sure we carry all of the attributes through instead of overwriting them. | def merge_headers(*headers)
hdr = {}
headers.each do |h|
hdr.merge!(h) do |k, v1, v2|
v1.merge!(v2) if k == :attributes!
end
end
hdr
end | [
"def merge_headers(*headers)\r\n hdr = {}\r\n headers.each do |h|\r\n hdr.merge!(h) do |k,v1,v2|\r\n v1.merge!(v2) if k == :attributes!\r\n end\r\n end\r\n hdr\r\n end",
"def headers=(hash); end",
"def merge!(headers_or_env); end",
"def make_header\n @edi_log.w... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
User was redirected to one of the standard Goldberg pages, as specified by :page_name. | def assert_redirected_to(page_name)
assert_match(/#{Goldberg.settings.send(page_name).url}$/,
response.redirected_to)
end | [
"def legacy_page_redirect_url\n page = last_legacy_url.page\n return unless page\n\n alchemy.show_page_path(\n locale: prefix_locale? ? page.language_code : nil,\n urlname: page.urlname\n )\n end",
"def page_redirect?(title)\n page_info_contains_key(title, 'redirect')... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /clientes/batch_destroy?ids[]=1&ids[]=2 DELETE /clientes/batch_destroy.json?ids[]=1&ids[]=2 | def batch_destroy
if params[:ids]
if Cliente.destroy_all(id: params[:ids])
flash[:notice] = t('general.messages.delete_success', model_name: t('activerecord.models.cliente'))
else
flash[:error] = t('general.messages.delete_error')
end
end
respond_to do |format|
forma... | [
"def batch_destroy \n if params[:ids]\n if Escritorio.destroy_all(id: params[:ids])\n flash[:notice] = t('general.messages.delete_success', model_name: t('activerecord.models.escritorio'))\n else\n flash[:error] = t('general.messages.delete_error')\n end\n end\n respond_to do |... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
def string_to_signed_integer(str) if DIGITS.keys.include?(str[0]) string_to_integer(str) elsif str[0] == '' string_to_integer(str[1..1]) elsif str[0] == '+' string_to_integer(str[1..1]) end end Solution | def string_to_signed_integer(str)
str = '+' + str if DIGITS.keys.include?(str[0])
case str[0]
when '-'
-string_to_integer(str[1..-1])
when '+'
string_to_integer(str[1..-1])
end
end | [
"def string_to_signed_integer(str)\n case str[0]\n when '-' then -string_to_integer(str[1..-1])\n when '+' then string_to_integer(str[1..-1])\n else string_to_integer(str)\n end\nend",
"def string_to_signed_integer(number_string) \n if number_string.start_with?(\"-\")\n -string_to_integer(number... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a new user registration. Signups must be enabled in the application config, otherwise the user is redirected to the landing page instead. | def create
if Feedbunch::Application.config.signups_enabled
super
else
Rails.logger.warn "Creation of new user attempted, but signups are disabled"
redirect_to root_path
end
end | [
"def create_new_user \n User.create(sign_up_prompt)\n end",
"def create_account\n @user = User.new(user_params)\n if !@user.valid?\n render :sign_up\n elsif @user.save!\n create\n else\n render :sign_up\n end\n end",
"def registerNewUser\n end",
"def signup(email, pa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Delete a user's profile. A password parameter must be submitted. The method validates that the submitted password is actually the user's password, otherwise an error is returned. | def destroy
Rails.logger.warn "User #{current_user.id} - #{current_user.email} has requested account deletion"
password = profiles_controller_destroy_params[:password]
if current_user.valid_password? password
Rails.logger.warn "User #{current_user.id} - #{current_user.email} provided correct password ... | [
"def delete\n @profile.destroy\n redirect_to user_page_path(current_user)\n end",
"def deleteprofile!\n\t\t\tif current_user.admin == nil\n\t\t\t flash[:error] = \"Please email the admin for profile deletion - Error Code: #{response.status}\"\n\t\t\t redirect '/home'\n\t\t\tend\n\t\tend",
"de... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
As the params are returned as an array, the splat operator must be used ! e.g. execute(execute_dotenv_params, 'env') Note: we first do an echo, to avoid command map issues with the bash source command | def execute_dotenv_params(dotenv_path = '.env')
# The .dot env file
dotenv_file = deploy_path.join(dotenv_path)
dotenv_keys = "$(cut --delimiter== --fields=1 #{dotenv_file})"
['echo', '.env', '&&', '.', dotenv_file, '&&', 'export', dotenv_keys, '&&']
end | [
"def args_evaled\n args.map do |arg|\n arg.resolve_and_eval(env)\n end\n end",
"def get_call_args\n \" \" + Array(@config.salt_call_args).join(\" \")\n end",
"def env_cmd cmd, env_hash=@env\n if env_hash && !env_hash.empty?\n env_vars = env_hash.map{|e| e.join(\"=\")}... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /wks POST /wks.json | def create
@wk = Wk.new(wk_params)
respond_to do |format|
if @wk.save
format.html { redirect_to @wk, notice: 'Wk was successfully created.' }
format.json { render :show, status: :created, location: @wk }
else
format.html { render :new }
format.json { render json: @wk... | [
"def create\n puts 'Received POST request (create)'\n @whiskey = Whiskey.new(whiskey_params)\n\n if @whiskey.save\n render json: @whiskey\n else\n render json: @whiskey.errors\n end\n end",
"def create\n @wk = Wk.new(params[:wk])\n\n respond_to do |format|\n if @wk.save\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
nombre, nit, empleados, direccion, accionistas, jefe clientes, proveedores, proyectos | def initialize attributes = {}
@nombre = attributes[:nombre]
@nit = attributes[:nit]
@empleados = []
@clientes = []
end | [
"def cria_cliente(nome, cpf)\n # propriedades, atributos...\n { nome: nome, cpf: cpf }\nend",
"def alumnos_proyecto\n cadena = \"\"\n self.alumnos.each do |alumno|\n cadena += \"#{alumno.no_control} #{alumno.apellido_paterno} #{alumno.apellido_materno} #{alumno.nombre} | \"\n end\n cadena\n en... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Define the columns necessary for a trendable model | def trendables
key :divergence, Float
key :obp, Float
end | [
"def available_columns\n super\n\n index_tyear = @available_columns.find_index {|column| column.name == :tyear}\n\n # Already overriden\n return @available_columns if index_tyear\n\n ################\n # Smile Specific #379708 Liste entrées de temps : colonne se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Define the baseline class for this trend | def baseline(klass)
@baseline_klass = klass
end | [
"def baseline_for(klass)\n @baseline_for = klass\n end",
"def baseline( val )\n case val\n when :d; @baseline = \"text-before-edge\"\n when :u; @baseline = \"text-after-edge\"\n else @baseline = \"middle\"\n # else @baseline = \"auto\"\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Define the class for trends | def trends_class(klass)
@trends_klass = klass
end | [
"def trend_class(klass)\n @trend_class = klass\n end",
"def trending=(value)\n @trending = value\n end",
"def trends(trend)\n \"How is #{self.name} approaching #{trend}?\"\n end",
"def trending\n return @trending\n end",
"def feedback_trend\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Aggregates and attempts to store it into the database. This would only work if the class that extends Octo::Counter includes from Cequel::Record | def aggregate!(ts = Time.now.floor)
unless self.ancestors.include?MongoMapper::Document
raise NoMethodError, 'aggregate! not defined for this counter'
end
aggr = aggregate(ts)
sum = aggregate_sum(aggr)
aggr.each do |_ts, counterVals|
counterVals.each do |obj, count|
... | [
"def aggregate!(ts = Time.now.floor)\n unless self.ancestors.include?MongoMapper::Document\n raise NoMethodError, \"aggregate! not defined for this counter\"\n end\n\n aggr = aggregate(ts)\n aggr.each do |_ts, counterVals|\n counterVals.each do |obj, count|\n args = gen_ar... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Aggregates to find the sum of all counters for an enterprise at a time | def aggregate_sum(aggr)
sum = {}
aggr.each do |ts, counterVals|
sum[ts] = {} unless sum.has_key?ts
counterVals.each do |obj, count|
if obj.respond_to?(:enterprise_id)
eid = obj.public_send(:enterprise_id).to_s
sum[ts][eid] = sum[ts].fetch(eid, 0) + count
... | [
"def calculate_aggregate(cells)\n value = Array.new(cells.first.value.length, 0)\n cells.each do |c|\n c.value.each_with_index do |v, index|\n value[index] += v\n end\n end\n value\n end",
"def aggregate_results\n total_info = 0\n total_warni... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the baseline value for an object. | def get_baseline_value(baseline_type, object)
clazz = @baseline_klass.constantize
clazz.public_send(:get_baseline_value, baseline_type, object)
end | [
"def baseline( val )\n case val\n when :d; @baseline = \"text-before-edge\"\n when :u; @baseline = \"text-after-edge\"\n else @baseline = \"middle\"\n # else @baseline = \"auto\"\n end\n self\n end",
"def baseline_value=(n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /tipomedallas/1 GET /tipomedallas/1.json | def show
@tipomedalla = Tipomedalla.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @tipomedalla }
end
end | [
"def new\n @tipomedalla = Tipomedalla.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipomedalla }\n end\n end",
"def index\n @itemtipos = Itemtipo.all\n\n render json: @itemtipos\n end",
"def index\n @tippers = Tipper.all\n json_respon... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /tipomedallas/new GET /tipomedallas/new.json | def new
@tipomedalla = Tipomedalla.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @tipomedalla }
end
end | [
"def new\n @tip_so = TipSo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tip_so }\n end\n end",
"def create\n @tipomedalla = Tipomedalla.new(params[:tipomedalla])\n\n respond_to do |format|\n if @tipomedalla.save\n format.html { red... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /tipomedallas POST /tipomedallas.json | def create
@tipomedalla = Tipomedalla.new(params[:tipomedalla])
respond_to do |format|
if @tipomedalla.save
format.html { redirect_to @tipomedalla, notice: 'Tipomedalla was successfully created.' }
format.json { render json: @tipomedalla, status: :created, location: @tipomedalla }
e... | [
"def create\n @tipos_dato = TiposDato.new(tipos_dato_params)\n\n respond_to do |format|\n if @tipos_dato.save\n format.html { redirect_to @tipos_dato, notice: 'Tipos dato was successfully created.' }\n format.json { render :show, status: :created, location: @tipos_dato }\n else\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PUT /tipomedallas/1 PUT /tipomedallas/1.json | def update
@tipomedalla = Tipomedalla.find(params[:id])
respond_to do |format|
if @tipomedalla.update_attributes(params[:tipomedalla])
format.html { redirect_to @tipomedalla, notice: 'Tipomedalla was successfully updated.' }
format.json { head :no_content }
else
format.html ... | [
"def update\n respond_to do |format|\n if @tipos_saida.update(tipos_saida_params)\n format.html { redirect_to tipos_saidas_url, notice: 'Tipos de saida foi atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @tipos_saida }\n else\n format.html { render :... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /tipomedallas/1 DELETE /tipomedallas/1.json | def destroy
@tipomedalla = Tipomedalla.find(params[:id])
@tipomedalla.destroy
respond_to do |format|
format.html { redirect_to tipomedallas_url }
format.json { head :no_content }
end
end | [
"def destroy\n @tiposuario.destroy\n respond_to do |format|\n format.html { redirect_to tiposuarios_url }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @tipos_saida.de... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Perform actual move of a description from one name to another. | def move_description
if @delete_after
move_description_to_another_name
else
clone_description_to_another_name
end
end | [
"def merge(old_name)\n return if old_name == self\n\n xargs = {}\n\n # Move all observations over to the new name.\n old_name.observations.each do |obs|\n obs.name = self\n obs.save\n end\n\n # Move all namings over to the new name.\n old_name.namings.each do |name|\n name.name =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /canvases POST /canvases.json | def create
# byebug
@canvas = Canvas.create(canvas_params)
end | [
"def index\n @api_v1_canvases = Api::V1::Canvas.all\n render json: @api_v1_canvases\n end",
"def create\n @canvas = Canvas.new(params[:canvas])\n\n respond_to do |format|\n if @canvas.save\n format.html { redirect_to @canvas, notice: 'Canvas was successfully created.' }\n format.js... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.