_id stringlengths 2 6 | title stringlengths 9 130 | partition stringclasses 3
values | text stringlengths 30 4.3k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q9600 | Aker::Authorities.Composite.poll | train | def poll(method, *args)
authorities.select { |a|
a.respond_to?(method)
}.collect { | ruby | {
"resource": ""
} |
q9601 | Megaphone.Client.publish! | train | def publish!(topic, subtopic, schema, partition_key, payload)
event = Event.new(topic, subtopic, origin, schema, partition_key, payload)
raise MegaphoneInvalidEventError.new(event.errors.join(', ')) unless event.valid?
unless logger.post(topic, event.to_hash)
if | ruby | {
"resource": ""
} |
q9602 | Npolar::Api::Client.NpolarApiCommand.run | train | def run
@client = JsonApiClient.new(uri)
@client.log = log
@client.header = header
@client.param = parameters
if param[:concurrency]
@client.concurrency = param[:concurrency].to_i
end
if param[:slice]
@client.slice = param[:slice].to_i
end
if uri =~... | ruby | {
"resource": ""
} |
q9603 | Vigilem::Core::Hooks.ConditionalHook.enumerate | train | def enumerate(args={}, &block)
passed, failed = [], []
hook = self
super do |callback|
if hook.condition.call(*callback.options[:condition_args])
hook.passed << callback
| ruby | {
"resource": ""
} |
q9604 | Poltergeist::ScreenshotOverview.Manager.add_image_from_rspec | train | def add_image_from_rspec(argument, example, url_path)
blob = caller.find{|i| i[ example.file_path.gsub(/:\d*|^\./,"") ]}
file_with_line = blob.split(":")[0,2].join(":")
filename = [example.description, argument, file_with_line, SecureRandom.hex(6) ].join(" ").gsub(/\W+/,"_") + ".jpg"
full_name ... | ruby | {
"resource": ""
} |
q9605 | AudioVision.Client.get | train | def get(path, params={})
connection.get do |request|
request.url path
| ruby | {
"resource": ""
} |
q9606 | TodoLint.ConfigFile.read_config_file | train | def read_config_file(file)
@config_hash = YAML.load_file(file)
@starting_path = File.expand_path(File.split(file).first)
@config_options = {}
load_tags
| ruby | {
"resource": ""
} |
q9607 | TodoLint.ConfigFile.load_file_exclusions | train | def load_file_exclusions
return unless config_hash["Exclude Files"]
config_options[:excluded_files] = []
config_hash["Exclude Files"].each do |short_file|
| ruby | {
"resource": ""
} |
q9608 | TodoLint.ConfigFile.load_tags | train | def load_tags
config_options[:tags] = {}
return unless config_hash["Tags"]
config_hash["Tags"].each do |tag, due_date|
unless due_date.is_a? Date
| ruby | {
"resource": ""
} |
q9609 | Automodel.SchemaInspector.columns | train | def columns(table_name)
table_name = table_name.to_s
@columns ||= {}
@columns[table_name] ||= if @registration[:columns].present?
@registration[:columns].call(@connection, table_name)
| ruby | {
"resource": ""
} |
q9610 | Automodel.SchemaInspector.primary_key | train | def primary_key(table_name)
table_name = table_name.to_s
@primary_keys ||= {}
@primary_keys[table_name] ||= if @registration[:primary_key].present?
| ruby | {
"resource": ""
} |
q9611 | Automodel.SchemaInspector.foreign_keys | train | def foreign_keys(table_name)
table_name = table_name.to_s
@foreign_keys ||= {}
@foreign_keys[table_name] ||= begin
if @registration[:foreign_keys].present?
@registration[:foreign_keys].call(@connection, table_name)
else
begin
@connection.foreign_keys(ta... | ruby | {
"resource": ""
} |
q9612 | Naming.NameSet.others | train | def others(array)
array.select{|elt| | ruby | {
"resource": ""
} |
q9613 | Tay.ManifestGenerator.spec_as_json | train | def spec_as_json
json = {
:name => spec.name,
:version => spec.version,
:manifest_version => calculate_manifest_version
}
json[:description] = spec.description if spec.description
json[:icons] = spec.icons
json[:default_locale] = spec.default_locale if spec.default... | ruby | {
"resource": ""
} |
q9614 | Tay.ManifestGenerator.action_as_json | train | def action_as_json(action)
json = {}
json[:default_title] = action.title if action.title
| ruby | {
"resource": ""
} |
q9615 | Tay.ManifestGenerator.packaged_app_as_json | train | def packaged_app_as_json
app = spec.packaged_app
json = {
:local_path => app.page
}
unless app.container.nil?
| ruby | {
"resource": ""
} |
q9616 | Tay.ManifestGenerator.content_scripts_as_json | train | def content_scripts_as_json
spec.content_scripts.map do |cs|
cs_json = {
:matches => cs.include_patterns
}
cs_json[:exclude_matches] = cs.exclude_patterns unless cs.exclude_patterns.empty?
| ruby | {
"resource": ""
} |
q9617 | Tay.ManifestGenerator.web_intents_as_json | train | def web_intents_as_json
spec.web_intents.map do |wi|
{
:action => wi.action,
:title => wi.title,
:href => wi.href,
:types => | ruby | {
"resource": ""
} |
q9618 | Logsly::Logging182::Appenders.Email.canonical_write | train | def canonical_write( str )
### build a mail header for RFC 822
rfc822msg = "From: #{@from}\n"
rfc822msg << "To: #{@to.join(",")}\n"
rfc822msg << "Subject: #{@subject}\n"
rfc822msg << "Date: #{Time.new.rfc822}\n"
rfc822msg << "Message-Id: <#{"%.8f" % Time.now.to_f}@#{@domain}>\n\n"
... | ruby | {
"resource": ""
} |
q9619 | SeleniumStandaloneDSL.Base.click | train | def click(selector, find_by: :link_text)
sleep Random.new.rand(1..2)
with_frame do
| ruby | {
"resource": ""
} |
q9620 | BlogBasic.BlogPost.replace_blog_image_tags | train | def replace_blog_image_tags
@resaving = true
self.body.gsub!(/[{]blog_image:upload[0-9]+:[a-zA-Z]+[}]/) do |image_tag|
random_id, size = image_tag.scan(/upload([0-9]+)[:]([a-zA-Z]+)/).flatten
new_id = random_id
matching_image = self.blog_images.reject {|bi| !bi.random_id || bi.rand... | ruby | {
"resource": ""
} |
q9621 | Versed.Schedule.incomplete_tasks | train | def incomplete_tasks
# TODO: refactor with reject
incomplete = []
categories.each { |c| incomplete << c if c.incomplete? }
| ruby | {
"resource": ""
} |
q9622 | Versed.Schedule.category_ids | train | def category_ids(entries)
category_ids = []
entries.each do |day, tasks|
| ruby | {
"resource": ""
} |
q9623 | VCSToolkit.Merge.combine_diffs | train | def combine_diffs(diff_one, diff_two)
Hash.new { |hash, key| hash[key] = [[], []] }.tap do |combined_diff|
diff_one.each do |change|
| ruby | {
"resource": ""
} |
q9624 | SDL4R.Tag.children_values | train | def children_values(name = nil)
children_values = []
each_child(false, name) { |child|
case child.values.size
when 0
children_values << nil
when 1
children_values << | ruby | {
"resource": ""
} |
q9625 | SDL4R.Tag.each_child | train | def each_child(recursive = false, namespace = nil, name = :DEFAULT, &block)
if name == :DEFAULT
name = namespace
namespace = nil
end
@children.each do |child|
if (name.nil? or child.name == name) and
(namespace.nil? or child.namespace == namespace)
| ruby | {
"resource": ""
} |
q9626 | SDL4R.Tag.remove_value | train | def remove_value(v)
index = @values.index(v)
if index
return | ruby | {
"resource": ""
} |
q9627 | SDL4R.Tag.has_attribute? | train | def has_attribute?(namespace = nil, key = nil)
namespace, key = to_nns namespace, key
if namespace or key
attributes = | ruby | {
"resource": ""
} |
q9628 | SDL4R.Tag.each_attribute | train | def each_attribute(namespace = nil, &block) # :yields: namespace, key, value
if namespace.nil?
@attributesByNamespace.each_key { |a_namespace| each_attribute(a_namespace, &block) }
else
attributes = @attributesByNamespace[namespace]
| ruby | {
"resource": ""
} |
q9629 | SDL4R.Tag.namespace= | train | def namespace=(a_namespace)
a_namespace = a_namespace.to_s
| ruby | {
"resource": ""
} |
q9630 | SDL4R.Tag.read | train | def read(input)
if input.is_a? String
read_from_io(true) { StringIO.new(input) }
elsif input.is_a? Pathname
read_from_io(true) { input.open("r:UTF-8") }
elsif input.is_a? URI
| ruby | {
"resource": ""
} |
q9631 | SDL4R.Tag.read_from_io | train | def read_from_io(close_io)
io = yield
begin
Parser.new(io).parse.each do |tag|
add_child(tag)
end
ensure
| ruby | {
"resource": ""
} |
q9632 | SDL4R.Tag.children_to_string | train | def children_to_string(line_prefix = "", s = "")
@children.each do |child|
| ruby | {
"resource": ""
} |
q9633 | Cyclical.Occurrence.list_occurrences | train | def list_occurrences(from, direction = :forward, &block)
raise ArgumentError, "From #{from} not matching the rule #{@rule} and start time #{@start_time}" unless @rule.match?(from, @start_time)
results = []
n, current = init_loop(from, direction)
loop do
# Rails.logger.debug("Listing oc... | ruby | {
"resource": ""
} |
q9634 | ICU.Team.add_member | train | def add_member(number)
pnum = number.to_i
raise "'#{number}' is not a valid as a team member player number" if pnum | ruby | {
"resource": ""
} |
q9635 | ICU.Team.renumber | train | def renumber(map)
@members.each_with_index do |pnum, index|
raise "player number #{pnum} not found in renumbering hash" unless map[pnum] | ruby | {
"resource": ""
} |
q9636 | Cany.Dependency.define_on_distro_release | train | def define_on_distro_release(distro, release, name, version=nil)
| ruby | {
"resource": ""
} |
q9637 | XivelyConnector.Connection.set_httparty_options | train | def set_httparty_options(options={})
if options[:ssl_ca_file]
ssl_ca_file opts[:ssl_ca_file]
if options[:pem_cert_pass]
| ruby | {
"resource": ""
} |
q9638 | NSICloudooo.Client.granulate | train | def granulate(options = {})
@request_data = Hash.new
if options[:doc_link]
insert_download_data options
else
file_data = {:doc => options[:file], :filename => options[:filename]}
@request_data.merge! file_data
| ruby | {
"resource": ""
} |
q9639 | Scalaroid.JSONReqList.add_write | train | def add_write(key, value, binary = false)
if (@is_commit)
raise RuntimeError.new('No further request supported after a commit!')
end
| ruby | {
"resource": ""
} |
q9640 | Scalaroid.JSONReqList.add_add_del_on_list | train | def add_add_del_on_list(key, to_add, to_remove)
if (@is_commit)
raise RuntimeError.new('No further request supported after a commit!')
end
| ruby | {
"resource": ""
} |
q9641 | Handcart.ControllerAdditions.allow_or_reject | train | def allow_or_reject
# We assume the the rejection action is going to be on the public controller
# since we wouldn't want to forward the rejection to the handcart
my_rejection_url = main_app.url_for({
# subdomain: '',
host: Handcart::DomainConstraint.default_constraint.domain,
... | ruby | {
"resource": ""
} |
q9642 | Palimpsest.Environment.copy | train | def copy(destination: site.path, mirror: false)
fail 'Must specify a destination' if destination.nil?
exclude = options[:copy_exclude]
| ruby | {
"resource": ""
} |
q9643 | Palimpsest.Environment.populate | train | def populate(from: :auto)
return if populated
fail "Cannot populate without 'site'" if site.nil?
case from
when :auto
if site.respond_to?(:repository) ? site.repository : nil
populate from: :repository
else
populate from: :source
end
when :repos... | ruby | {
"resource": ""
} |
q9644 | Palimpsest.Environment.validate_config | train | def validate_config
message = 'bad path in config'
# Checks the option in the asset key.
def validate_asset_options(opts)
opts.each do |k, v|
fail 'bad option in config' if k == :sprockets_options
fail message if k == :output && !Utils.safe_path?(v)
end
end
... | ruby | {
"resource": ""
} |
q9645 | Redstruct.TimeSeries.get | train | def get(options = {})
lower = nil
upper = nil
if options[:in].nil?
lower = options[:after].nil? ? '-inf' : coerce_time_milli(options[:after])
upper = options[:before].nil? ? '+inf' : [0, coerce_time_milli(options[:before])].max
else
lower = coerce_time_milli(options[:in]... | ruby | {
"resource": ""
} |
q9646 | Spirit.Logger.record | train | def record(action, *args)
msg = ''
msg << color(ACTION_COLORS[action])
| ruby | {
"resource": ""
} |
q9647 | Spirit.Logger.max_action_length | train | def max_action_length
@max_action_length ||= actions.reduce(0) { |m, | ruby | {
"resource": ""
} |
q9648 | ViewFu.BrowserDetect.browser_name | train | def browser_name
@browser_name ||= begin
ua = request.user_agent.to_s.downcase
if ua.index('msie') && !ua.index('opera') && !ua.index('webtv')
'ie'+ua[ua.index('msie')+5].chr
elsif ua.index('gecko/')
'gecko'
elsif ua.index('opera')
'opera'
els... | ruby | {
"resource": ""
} |
q9649 | Empyrean.ConfigLoader.load | train | def load(file)
if File.exist? file
symbolize_keys(YAML.load_file(File.expand_path('.', | ruby | {
"resource": ""
} |
q9650 | Empyrean.ConfigLoader.load_config | train | def load_config(file = @options.config)
config = load(file)
config[:timezone_difference] = 0 if config[:timezone_difference].nil?
config[:mentions] = {} if config[:mentions].nil?
config[:mentions][:enabled] = true if config[:mentions][:enabled].nil?
config[:men... | ruby | {
"resource": ""
} |
q9651 | ProjectEulerCli.ArchiveViewer.display_recent | train | def display_recent
load_recent
puts
(Problem.total).downto(Problem.total - 9) do |i|
| ruby | {
"resource": ""
} |
q9652 | ProjectEulerCli.ArchiveViewer.display_page | train | def display_page(page)
load_page(page)
puts
start = (page - 1) * Page::LENGTH + 1
start.upto(start + Page::LENGTH - 1) do |i|
| ruby | {
"resource": ""
} |
q9653 | ProjectEulerCli.ArchiveViewer.display_problem | train | def display_problem(id)
load_problem_details(id)
puts
puts "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
puts
puts Problem[id].title.upcase
puts "Problem #{id}"
| ruby | {
"resource": ""
} |
q9654 | RFGraph.Auth.authorize | train | def authorize(callback_url, code)
data = open("#{BASE_URL}/oauth/access_token?client_id=#{app_id}&redirect_uri=#{CGI.escape callback_url}&client_secret=#{app_secret}&code=#{CGI.escape code}").read
# | ruby | {
"resource": ""
} |
q9655 | ActionDispatch::Routing.Mapper.devise_for | train | def devise_for(*resources)
@devise_finalized = false
options = resources.extract_options!
options[:as] ||= @scope[:as] if @scope[:as].present?
options[:module] ||= @scope[:module] if @scope[:module].present?
options[:path_prefix] ||= @scope[:path] if @scope[:path].pres... | ruby | {
"resource": ""
} |
q9656 | Ponder.ChannelList.remove | train | def remove(channel_or_channel_name)
@mutex.synchronize do
if channel_or_channel_name.is_a?(String)
| ruby | {
"resource": ""
} |
q9657 | Ponder.ChannelList.remove_user | train | def remove_user(nick)
@mutex.synchronize do
channels = Set.new
@channels.each do |channel|
if channel.remove_user(nick)
| ruby | {
"resource": ""
} |
q9658 | Ponder.ChannelList.users | train | def users
users = Set.new
@channels.each do |channel|
| ruby | {
"resource": ""
} |
q9659 | Pingback.Client.ping | train | def ping(source_uri, target_uri)
header = request_header target_uri
pingback_server = header['X-Pingback']
unless pingback_server
doc = Nokogiri::HTML(request_all(target_uri).body)
link = doc.xpath('//link[@rel="pingback"]/attribute::href').first
| ruby | {
"resource": ""
} |
q9660 | SimpleMetarParser.Wind.decode_wind | train | def decode_wind(s)
if s =~ /(\d{3})(\d{2})G?(\d{2})?(KT|MPS|KMH)/
# different units
wind = case $4
when "KT" then
$2.to_f * KNOTS_TO_METERS_PER_SECOND
when "MPS" then
$2.to_f
when "KMH" then
... | ruby | {
"resource": ""
} |
q9661 | SimpleMetarParser.Wind.recalculate_winds | train | def recalculate_winds
wind_sum = @winds.collect { |w| w[:wind] }.inject(0) { |b, i| b + i }
@wind = wind_sum.to_f / @winds.size
if @winds.size == 1
| ruby | {
"resource": ""
} |
q9662 | Fwissr.Registry.add_source | train | def add_source(source)
@semaphore.synchronize do
@sources << source
end
if @registry.frozen?
# already frozen, must reload everything
self.reload!
else
@semaphore.synchronize do
| ruby | {
"resource": ""
} |
q9663 | Fwissr.Registry.get | train | def get(key)
# split key
key_ary = key.split('/')
# remove first empty part
key_ary.shift if (key_ary.first == '')
cur_hash = self.registry
| ruby | {
"resource": ""
} |
q9664 | ActiveModel.Hints.hints_for | train | def hints_for(attribute)
result = Array.new
@base.class.validators_on(attribute).map do |v|
validator = v.class.to_s.split('::').last.underscore.gsub('_validator','')
if v.options[:message].is_a?(Symbol)
message_key = [validator, v.options[:message]].join('.') # if a message was s... | ruby | {
"resource": ""
} |
q9665 | DohDb.Handle.select | train | def select(statement, build_arg = nil)
result_set = generic_query(statement)
DohDb.logger.call('result', | ruby | {
"resource": ""
} |
q9666 | DohDb.Handle.select_row | train | def select_row(statement, build_arg = nil)
rows = select(statement, build_arg) | ruby | {
"resource": ""
} |
q9667 | DohDb.Handle.select_optional_row | train | def select_optional_row(statement, build_arg = nil)
rows = select(statement, build_arg)
| ruby | {
"resource": ""
} |
q9668 | DohDb.Handle.select_transpose | train | def select_transpose(statement, build_arg = nil)
rows = select(statement, build_arg)
return {} if rows.empty?
field_count = rows.first.size
if field_count < 2
raise UnexpectedQueryResult, "must select at least 2 fields in order to transpose"
elsif field_count == 2
Doh.array_to_hash(rows)... | ruby | {
"resource": ""
} |
q9669 | Redstruct.Hash.get | train | def get(*keys)
return self.connection.hget(@key, keys.first) if keys.size == 1
| ruby | {
"resource": ""
} |
q9670 | Redstruct.Hash.set | train | def set(key, value, overwrite: true)
result = if overwrite
self.connection.hset(@key, key, | ruby | {
"resource": ""
} |
q9671 | Redstruct.Hash.increment | train | def increment(key, by: 1)
if by.is_a?(Float)
self.connection.hincrbyfloat(@key, key, | ruby | {
"resource": ""
} |
q9672 | ControllerExtensions.UrlExt.url_for | train | def url_for(options = {})
options = case options
when String
uri = Addressable::URI.new
uri.query_values = @hash_of_additional_params
| ruby | {
"resource": ""
} |
q9673 | Aker.Group.include? | train | def include?(other)
other_name =
case other
when Group; other.name;
else other.to_s;
| ruby | {
"resource": ""
} |
q9674 | Aker.Group.marshal_load | train | def marshal_load(dumped_tree_array)
nodes = { }
for node_hash in dumped_tree_array do
name = node_hash[:name]
parent_name = node_hash[:parent]
content = Marshal.load(node_hash[:content])
if parent_name then
nodes[name] = current_node = self.class.new(na... | ruby | {
"resource": ""
} |
q9675 | SycLink.Chrome.read | train | def read
serialized = File.read(path)
| ruby | {
"resource": ""
} |
q9676 | SycLink.Chrome.extract_children | train | def extract_children(tag, children)
children.map do |child|
if child["children"]
extract_children("#{tag},#{child['name']}", child["children"])
| ruby | {
"resource": ""
} |
q9677 | Handlebarer.Template.evaluate | train | def evaluate(scope, locals, &block)
| ruby | {
"resource": ""
} |
q9678 | PutText.Cmdline.run | train | def run(args)
options = parse_args(args)
po_file = Extractor.new.extract(options[:path])
if options[:output_file]
| ruby | {
"resource": ""
} |
q9679 | GroupDocsComparisonCloud.ChangesApi.put_changes_document_stream_with_http_info | train | def put_changes_document_stream_with_http_info(request)
raise ArgumentError, 'Incorrect request type' unless request.is_a? PutChangesDocumentStreamRequest
@api_client.config.logger.debug 'Calling API: ChangesApi.put_changes_document_stream ...' if @api_client.config.debugging
# resource path
lo... | ruby | {
"resource": ""
} |
q9680 | GroupDocsComparisonCloud.ChangesApi.put_changes_images_with_http_info | train | def put_changes_images_with_http_info(request)
raise ArgumentError, 'Incorrect request type' unless request.is_a? PutChangesImagesRequest
@api_client.config.logger.debug 'Calling API: ChangesApi.put_changes_images ...' if @api_client.config.debugging
# resource path
local_var_path = '/compariso... | ruby | {
"resource": ""
} |
q9681 | BoxGrinder.ApplianceDefinitionHelper.read_definitions | train | def read_definitions(definition, content_type = nil)
@appliance_parser.load_schemas
if File.exists?(definition)
definition_file_extension = File.extname(definition)
appliance_config =
case definition_file_extension
when '.appl', '.yml', '.yaml'
@app... | ruby | {
"resource": ""
} |
q9682 | Aker::Rack.Authenticate.call | train | def call(env)
configuration = configuration(env)
warden = env['warden']
if interactive?(env)
warden.authenticate(configuration.ui_mode)
else
warden.authenticate(*configuration.api_modes)
| ruby | {
"resource": ""
} |
q9683 | Localization.Middleware.locale_from_url | train | def locale_from_url path_info = nil
@locale_set ||= begin
@locale ||= (match = (path_info || @env['PATH_INFO']).match(locale_pattern)) ? | ruby | {
"resource": ""
} |
q9684 | HasPrice.Price.method_missing | train | def method_missing(meth, *args, &blk)
value = select{|k,v| k.underscore == meth.to_s}.first
| ruby | {
"resource": ""
} |
q9685 | Qtc.Client.get | train | def get(path, params = nil, headers = {})
response = http_client.get(request_uri(path), params, request_headers(headers))
if response.status == 200
| ruby | {
"resource": ""
} |
q9686 | Chronic.Handler.match | train | def match(tokens, definitions)
token_index = 0
@pattern.each do |element|
name = element.to_s
optional = name[-1, 1] == '?'
name = name.chop if optional
case element
when Symbol
if tags_match?(name, tokens, token_index)
token_index += 1
... | ruby | {
"resource": ""
} |
q9687 | Triton.Messenger.add_listener | train | def add_listener(type, once=false, &callback)
listener = Listener.new(type, callback, once)
listeners[type] ||= []
listeners[type] << listener | ruby | {
"resource": ""
} |
q9688 | Triton.Messenger.remove_listener | train | def remove_listener(listener)
type = listener.type
if listeners.has_key? type
listeners[type].delete(listener)
| ruby | {
"resource": ""
} |
q9689 | Triton.Messenger.emit | train | def emit(type, sender=nil, *args)
listeners[type].each | ruby | {
"resource": ""
} |
q9690 | Analysand.ChangeWatcher.changes_feed_uri | train | def changes_feed_uri
query = {
'feed' => 'continuous',
'heartbeat' => '10000'
}
| ruby | {
"resource": ""
} |
q9691 | Analysand.ChangeWatcher.waiter_for | train | def waiter_for(id)
@waiting[id] = true
Waiter.new do
loop do
| ruby | {
"resource": ""
} |
q9692 | Guard.RSpectacle.reload | train | def reload
Dir.glob('**/*.rb').each { |file| Reloader.reload_file(file) | ruby | {
"resource": ""
} |
q9693 | ActiveRecord.CounterCache.reset_counters | train | def reset_counters(id, *counters)
object = find(id)
counters.each do |association|
has_many_association = reflect_on_association(association.to_sym)
if has_many_association.options[:as]
has_many_association.options[:as].to_s.classify
else
self.name
end
... | ruby | {
"resource": ""
} |
q9694 | DealRedemptions.Admin::RedeemCodesController.build_search_query | train | def build_search_query
string = params[:search].split ' '
redeem_codes = DealRedemptions::RedeemCode.arel_table
companies = DealRedemptions::Company.arel_table
query = redeem_codes.project(
redeem_codes[:id],
| ruby | {
"resource": ""
} |
q9695 | Mango.Runner.create | train | def create(path)
self.destination_root = path
copy_file(".gitignore")
copy_file("config.ru")
| ruby | {
"resource": ""
} |
q9696 | Raca.Server.details | train | def details
data = servers_client.get(server_path, | ruby | {
"resource": ""
} |
q9697 | CrateAPI.Crates.add | train | def add(name)
response = JSON.parse(CrateAPI::Base.call("#{CrateAPI::Base::CRATES_URL}/#{CRATE_ACTIONS[:add]}", :post, {:body => {:name => name}}))
| ruby | {
"resource": ""
} |
q9698 | Oshpark.Client.authenticate | train | def authenticate email, credentials={}
if password = credentials[:with_password]
refresh_token email: email, password: password
elsif secret = credentials[:with_api_secret]
api_key = OpenSSL::Digest::SHA256.new("#{email}:#{secret}:#{token.token}").to_s
| ruby | {
"resource": ""
} |
q9699 | Oshpark.Client.pricing | train | def pricing width, height, pcb_layers, quantity = nil
post_request "pricing", {width_in_mils: width, height_in_mils: | ruby | {
"resource": ""
} |
Subsets and Splits
SQL Console for CoIR-Retrieval/CodeSearchNet-ccr-ruby-queries-corpus
Retrieves a large number of entries in the 'ruby' language, providing basic information but limited analytical value.