_id stringlengths 2 6 | title stringlengths 9 130 | partition stringclasses 3
values | text stringlengths 30 4.3k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q8800 | Regenerate.WebPage.initializePageObject | train | def initializePageObject(pageObject)
@pageObject = pageObject
pathDepth = @pathComponents.length-1
rootLinkPath = "../" * pathDepth
setPageObjectInstanceVar("@fileName", @fileName)
setPageObjectInstanceVar("@baseDir", File.dirname(@fileName))
setPageObjectInstanceVar("@baseFileName",... | ruby | {
"resource": ""
} |
q8801 | Regenerate.WebPage.startNewComponent | train | def startNewComponent(component, startComment = nil)
component.parentPage = self
@currentComponent = component
#puts "startNewComponent, @currentComponent = #{@currentComponent.inspect}"
| ruby | {
"resource": ""
} |
q8802 | Regenerate.WebPage.writeRegeneratedFile | train | def writeRegeneratedFile(outFile, makeBackup, checkNoChanges)
puts "writeRegeneratedFile, #{outFile}, makeBackup = #{makeBackup}, checkNoChanges = #{checkNoChanges}"
if makeBackup
backupFileName = makeBackupFile(outFile)
end
File.open(outFile, "w") do |f|
for component in @compon... | ruby | {
"resource": ""
} |
q8803 | Regenerate.WebPage.readFileLines | train | def readFileLines
puts "Reading source file #{@fileName} ..."
lineNumber = 0
File.open(@fileName).each_line do |line|
line.chomp!
lineNumber += 1 # track line numbers for when Ruby code needs to be executed (i.e. to populate stack traces)
#puts "line #{lineNumber}: #{line}"
... | ruby | {
"resource": ""
} |
q8804 | Regenerate.WebPage.regenerateToOutputFile | train | def regenerateToOutputFile(outFile, checkNoChanges = false)
executeRubyComponents
@pageObject.process
| ruby | {
"resource": ""
} |
q8805 | Regenerate.WebPage.executeRubyComponents | train | def executeRubyComponents
fileDir = File.dirname(@fileName)
#puts "Executing ruby components in directory #{fileDir} ..."
Dir.chdir(fileDir) do
for rubyComponent in @rubyComponents
rubyCode = rubyComponent.text
#puts ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
... | ruby | {
"resource": ""
} |
q8806 | Regenerate.PageObject.erb | train | def erb(templateFileName)
@binding = binding
fullTemplateFilePath = relative_path(@rootLinkPath + templateFileName)
File.open(fullTemplateFilePath, "r") do |input|
templateText = input.read
| ruby | {
"resource": ""
} |
q8807 | WhereWasI.Gpx.add_tracks | train | def add_tracks
@tracks = []
doc = Nokogiri::XML(@gpx_data)
doc.css('xmlns|trk').each do |trk|
track = Track.new
trk.css('xmlns|trkpt').each do |trkpt|
# https://en.wikipedia.org/wiki/GPS_Exchange_Format#Units
# decimal degrees, wgs84.
# elevation in meter... | ruby | {
"resource": ""
} |
q8808 | WhereWasI.Gpx.at | train | def at(time)
add_tracks if ! @tracks_added
if time.is_a?(String)
time = Time.parse(time)
end
time = time.to_i
location = nil
@tracks.each do |track|
location = track.at(time)
break if location
end
if ! location
case @intersegment_behavi... | ruby | {
"resource": ""
} |
q8809 | RsUserPolicy.User.clear_permissions | train | def clear_permissions(account_href, client, options={})
options = {:dry_run => false}.merge(options)
current_permissions = get_api_permissions(account_href)
if options[:dry_run]
Hash[current_permissions.map{|p| [p.href, p.role_title]}]
else | ruby | {
"resource": ""
} |
q8810 | RsUserPolicy.User.set_api_permissions | train | def set_api_permissions(permissions, account_href, client, options={})
options = {:dry_run => false}.merge(options)
existing_api_permissions_response = get_api_permissions(account_href)
existing_api_permissions = Hash[existing_api_permissions_response.map{|p| [p.role_title, p] }]
if permissions.... | ruby | {
"resource": ""
} |
q8811 | Hosties.UsesAttributes.finish | train | def finish
retval = {}
# Ensure all required attributes have been set
@attributes.each do |attr|
val = instance_variable_get "@#{attr}"
| ruby | {
"resource": ""
} |
q8812 | EM::Xmpp.Handler.run_xpath_handlers | train | def run_xpath_handlers(ctx, handlers, remover)
handlers.each do |h|
if (not ctx.done?) and (h.match?(ctx.stanza))
ctx['xpath.handler'] = h | ruby | {
"resource": ""
} |
q8813 | MtaJson.Wrapper.update_params | train | def update_params env, json
env[FORM_HASH] = json
env[BODY] = env[FORM_INPUT] | ruby | {
"resource": ""
} |
q8814 | MtaJson.Wrapper.verify_request_method | train | def verify_request_method env
allowed = ALLOWED_METHODS
allowed |= ALLOWED_METHODS_PRIVATE if whitelisted?(env)
if !allowed.include?(env[METHOD])
| ruby | {
"resource": ""
} |
q8815 | MtaJson.Wrapper.update_options | train | def update_options env, options
if options[:method] and (ALLOWED_METHODS | ALLOWED_METHODS_PRIVATE).include?(options[:method])
# (possibly) TODO - pass parameters for GET instead of POST in update_params then?
| ruby | {
"resource": ""
} |
q8816 | MtaJson.Wrapper.add_csrf_info | train | def add_csrf_info env
env[CSRF_TOKEN] = env[SESSION][:_csrf_token] | ruby | {
"resource": ""
} |
q8817 | Cerealizer.Base.read_keys | train | def read_keys
self.class.keys.inject Hash.new do |hash, key|
hash[key.name] = | ruby | {
"resource": ""
} |
q8818 | Cerealizer.Base.write_keys | train | def write_keys(attrs)
attrs.each { |key, value| | ruby | {
"resource": ""
} |
q8819 | Cerealizer.Base.proxy_writer | train | def proxy_writer(key, *args)
meth = "#{key}="
if self.respond_to? meth | ruby | {
"resource": ""
} |
q8820 | ActiveRecord.Fixtures.table_rows | train | def table_rows
now = ActiveRecord::Base.default_timezone == :utc ? Time.now.utc : Time.now
now = now.to_s(:db)
# allow a standard key to be used for doing defaults in YAML
fixtures.delete('DEFAULTS')
# track any join tables we need to insert later
rows = Hash.new { |h,table| h[tabl... | ruby | {
"resource": ""
} |
q8821 | Mimi.Core.use | train | def use(mod, opts = {})
raise ArgumentError, "#{mod} is not a Mimi module" unless mod | ruby | {
"resource": ""
} |
q8822 | Mimi.Core.require_files | train | def require_files(glob, root_path = app_root_path)
Pathname.glob(root_path.join(glob)).each | ruby | {
"resource": ""
} |
q8823 | RailsIdentity.User.valid_user | train | def valid_user
if (self.username.blank? || self.password_digest.blank?) &&
(self.oauth_provider.blank? || self.oauth_uid.blank?)
| ruby | {
"resource": ""
} |
q8824 | RailsIdentity.User.issue_token | train | def issue_token(kind)
session = Session.new(user: self, seconds: 3600)
session.save
if kind == :reset_token
self.reset_token = session.token
| ruby | {
"resource": ""
} |
q8825 | VirtualMonkey.ELBRunner.lookup_scripts | train | def lookup_scripts
scripts = [
[ 'connect', 'ELB connect' ],
[ 'disconnect', 'ELB disconnect' ]
]
# @scripts_to_run = {}
server = @servers.first
server.settings
st = ServerTemplate.find(server.server_template_href)
| ruby | {
"resource": ""
} |
q8826 | VirtualMonkey.ELBRunner.log_rotation_checks | train | def log_rotation_checks
detect_os
# this works for php
app_servers.each do |server|
server.settings
force_log_rotation(server) | ruby | {
"resource": ""
} |
q8827 | Guise.Introspection.has_guise? | train | def has_guise?(value)
value = value.to_s.classify
unless guise_options.values.include?(value)
raise ArgumentError, "no such guise #{value}"
end
association(guise_options.association_name).reader.any? do | ruby | {
"resource": ""
} |
q8828 | Technologist.YamlParser.instancify | train | def instancify(technology, rule)
class_name, attributes = send("parse_rule_of_type_#{rule.class.name.downcase}", | ruby | {
"resource": ""
} |
q8829 | FaviconParty.Fetcher.find_favicon_urls_in_html | train | def find_favicon_urls_in_html(html)
doc = Nokogiri.parse html
candidate_urls = doc.css(ICON_SELECTORS.join(",")).map {|e| e.attr('href') }.compact
candidate_urls.sort_by! {|href|
if href =~ /\.ico/
0
elsif href =~ /\.png/
1
else
2
end
... | ruby | {
"resource": ""
} |
q8830 | FaviconParty.Fetcher.final_url | train | def final_url
return @final_url if !@final_url.nil?
location = final_location(FaviconParty::HTTPClient.head(@query_url))
if !location.nil?
if location =~ /\Ahttp/
@final_url = URI.encode location
else
uri = URI @query_url
| ruby | {
"resource": ""
} |
q8831 | Kawaii.RoutingMethods.context | train | def context(path, &block)
ctx = RouteContext.new(self, path)
# @todo Is there a better way to keep ordering of routes?
# An alternative would be to enter each route in a context only once
# (with 'prefix' based on containing contexts).
# On the other hand, we're only doing that when compil... | ruby | {
"resource": ""
} |
q8832 | Kawaii.RoutingMethods.match | train | def match(env)
routes[env[Rack::REQUEST_METHOD]]
.lazy # Lazy to | ruby | {
"resource": ""
} |
q8833 | Glass.TimelineItem.insert! | train | def insert!(mirror=@client)
timeline_item = self
result = []
if file_upload?
for file in file_to_upload
media = Google::APIClient::UploadIO.new(file.contentUrl, file.content_type)
result << client.execute!(
:api_method => mirror.timeline.insert,
... | ruby | {
"resource": ""
} |
q8834 | SycLink.Link.select_defined | train | def select_defined(args)
args.select | ruby | {
"resource": ""
} |
q8835 | Disqussion.Exports.exportForum | train | def exportForum(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
if args.size == 1
options.merge!(:forum => args[0])
response = post('exports/exportForum', options)
| ruby | {
"resource": ""
} |
q8836 | ActiveRecord.Persistence.update_column | train | def update_column(name, value)
name = name.to_s
raise ActiveRecordError, "#{name} is marked as readonly" if self.class.readonly_attributes.include?(name)
raise ActiveRecordError, "can not update on a new record object" unless persisted?
| ruby | {
"resource": ""
} |
q8837 | ActiveCopy.Paths.source_path | train | def source_path options={}
@source_path ||= if options[:relative]
File.join collection_path, | ruby | {
"resource": ""
} |
q8838 | Cathode.UpdateRequest.default_action_block | train | def default_action_block
proc do
begin
record = if resource.singular
parent_model = resource.parent.model.find(parent_resource_id)
parent_model.send resource.name
else
record = model.find(params[:id])
... | ruby | {
"resource": ""
} |
q8839 | GroupDocsSignatureCloud.ApiClient.deserialize | train | def deserialize(response, return_type)
body = response.body
# handle file downloading - return the File instance processed in request callbacks
# note that response body is empty when the file is written in chunks in request on_body callback
return @tempfile if return_type == 'File'
retu... | ruby | {
"resource": ""
} |
q8840 | RailsIdentity.SessionsController.index | train | def index
@sessions = Session.where(user: @user)
expired = []
active = []
@sessions.each do |session|
if session.expired?
expired << session.uuid
else
active << session
| ruby | {
"resource": ""
} |
q8841 | RailsIdentity.SessionsController.create | train | def create
# See if OAuth is used first. When authenticated successfully, either
# the existing user will be found or a new user will be created.
# Failure will be redirected to this action but will not match this
# branch.
if (omniauth_hash = request.env["omniauth.auth"])
@user =... | ruby | {
"resource": ""
} |
q8842 | RailsIdentity.SessionsController.get_session | train | def get_session
session_id = params[:id]
if session_id == "current"
if @auth_session.nil?
raise Repia::Errors::NotFound
end
session_id = @auth_session.id
end
@session = find_object(Session, session_id)
| ruby | {
"resource": ""
} |
q8843 | HasEnumeration.ClassMethods.has_enumeration | train | def has_enumeration(enumeration, mapping, options = {})
unless mapping.is_a?(Hash)
# Recast the mapping as a symbol -> string hash
mapping_hash = {}
mapping.each {|m| mapping_hash[m] = m.to_s}
mapping = mapping_hash
end
# The underlying attribute
attribute = opti... | ruby | {
"resource": ""
} |
q8844 | SimilarityTree.Node.depth_first_recurse | train | def depth_first_recurse(node = nil, depth = 0, &block)
node = self if node == nil
yield node, depth
node.children.each do |child| | ruby | {
"resource": ""
} |
q8845 | Curl.ThreadPool.perform | train | def perform(async=false, &block)
@results = {}
@clients.each do |client|
@threads << Thread.new do
loop do
break if @reqs.empty?
req = @reqs.shift
break if req.nil? # can sometimes reach here due to a race condition. saw it a lot on travis
client.url = re... | ruby | {
"resource": ""
} |
q8846 | Curl.ThreadPool.collate_results | train | def collate_results(results)
ret = []
results.size.times do |i|
ret | ruby | {
"resource": ""
} |
q8847 | Kelp.XPaths.xpath_row_containing | train | def xpath_row_containing(texts)
texts = [texts] if texts.class == String
conditions = texts.collect do |text|
| ruby | {
"resource": ""
} |
q8848 | ResponseFor.ActionController.respond_to_action_responses | train | def respond_to_action_responses
if !respond_to_performed? && action_responses.any?
| ruby | {
"resource": ""
} |
q8849 | SengiriYaml.Loader.load_dir | train | def load_dir(src_dir)
merged_content = ""
Pathname.glob("#{src_dir}/*.yml").sort.each do |yaml_path|
content = yaml_path.read.gsub(/^---$/, "")
| ruby | {
"resource": ""
} |
q8850 | TranslateColumns.InstanceMethods.translation_locale | train | def translation_locale
locale = @translation_locale || I18n.locale.to_s
locale | ruby | {
"resource": ""
} |
q8851 | TranslateColumns.InstanceMethods.translation | train | def translation
if translation_enabled?
if !@translation || (@translation.locale != translation_locale)
raise MissingParent, "Cannot create translations without a stored parent" if new_record?
# try to find translation or build a new one
@translation = translations.where(:lo... | ruby | {
"resource": ""
} |
q8852 | TranslateColumns.InstanceMethods.attributes_with_locale= | train | def attributes_with_locale=(new_attributes, guard_protected_attributes = true)
return if new_attributes.nil?
attributes = new_attributes.dup
attributes.stringify_keys!
attributes = sanitize_for_mass_assignment(attributes) if guard_protected_attributes
send(:locale=, | ruby | {
"resource": ""
} |
q8853 | DataMapper.ValidationsExt.validate_parents | train | def validate_parents
parent_relationships.each do |relationship|
parent = relationship.get(self)
unless parent.valid?
unless errors[relationship.name].include?(parent.errors)
| ruby | {
"resource": ""
} |
q8854 | DataMapper.ValidationsExt.validate_children | train | def validate_children
child_associations.each do |collection|
if collection.dirty?
collection.each do |child|
unless child.valid?
relationship_errors = (errors[collection.relationship.name] ||= [])
| ruby | {
"resource": ""
} |
q8855 | NoSequel.Container.method_missing | train | def method_missing(meth, *args, &block)
| ruby | {
"resource": ""
} |
q8856 | NoSequel.Container.validate_key | train | def validate_key(key)
unless key.is_a?(Symbol) || key.is_a?(String)
raise | ruby | {
"resource": ""
} |
q8857 | SimpleInteraction.ClassMethods.run | train | def run(**options)
@options = options
fail RequirementsNotMet.new("#{self} requires the following parameters #{requirements}") unless requirements_met?
| ruby | {
"resource": ""
} |
q8858 | SimpleInteraction.ClassMethods.run! | train | def run!(**options)
interaction = run(options)
raise error_class.new(interaction.error) unless | ruby | {
"resource": ""
} |
q8859 | ChainOptions.OptionSet.add_option | train | def add_option(name, parameters)
self.class.handle_warnings(name, | ruby | {
"resource": ""
} |
q8860 | ChainOptions.OptionSet.option | train | def option(name)
config = chain_options[name] || raise_no_option_error(name)
Option.new(config).tap { |o| | ruby | {
"resource": ""
} |
q8861 | Brat.Request.set_request_defaults | train | def set_request_defaults(endpoint, private_token, sudo=nil)
raise Error::MissingCredentials.new("Please set an endpoint to API") unless endpoint
@private_token = private_token
| ruby | {
"resource": ""
} |
q8862 | Spell.Spell.best_match | train | def best_match(given_word)
words = (@word_list.is_a? Array) ? @word_list : @word_list.keys
word_bigrams = bigramate(given_word)
word_hash = words.map do |key|
| ruby | {
"resource": ""
} |
q8863 | Spell.Spell.num_matching | train | def num_matching(one_bigrams, two_bigrams, acc = 0)
return acc if one_bigrams.empty? || two_bigrams.empty?
one_two = one_bigrams.index(two_bigrams[0])
two_one = two_bigrams.index(one_bigrams[0])
if one_two.nil? && two_one.nil?
num_matching(one_bigrams.drop(1), two_bigrams.drop(1), acc)... | ruby | {
"resource": ""
} |
q8864 | Spell.Spell.bigram_compare | train | def bigram_compare(word1_bigrams, word2_bigrams)
most_bigrams = [word1_bigrams.count, | ruby | {
"resource": ""
} |
q8865 | Spell.Spell.apply_usage_weights | train | def apply_usage_weights(word_hash)
max_usage = @word_list.values.max.to_f
max_usage = 1 if max_usage == 0
weighted_array = word_hash.map do |word, bigram_score|
usage_score = @word_list[word].to_f / max_usage
| ruby | {
"resource": ""
} |
q8866 | Aker::Rack.Failure.call | train | def call(env)
conf = configuration(env)
if login_required?(env)
if interactive?(env)
::Warden::Strategies[conf.ui_mode].new(env).on_ui_failure.finish
else
headers = {}
headers["WWW-Authenticate"] =
conf.api_modes.collect { |mode_key|
::Wa... | ruby | {
"resource": ""
} |
q8867 | Xmms.Client.shuffle_by | train | def shuffle_by(playlist, field)
pl = playlist.entries.wait.value
artists = Hash.new
rnd = Random.new
playlist.clear.wait
field = field.to_sym
pl.each do |id|
infos = self.medialib_get_info(id).wait.value
a = infos[fi... | ruby | {
"resource": ""
} |
q8868 | Xmms.Client.extract_medialib_info | train | def extract_medialib_info(id, *fields)
infos = self.medialib_get_info(id).wait.value
res = Hash.new
if !infos.nil?
fields = fields.map! {|f| f.to_sym }
fields.each do |field|
values = infos[field]
if not values.n... | ruby | {
"resource": ""
} |
q8869 | Releaselog.Change.check_scope | train | def check_scope(scope = nil)
# If no scope is requested or the change has no scope include this change unchanged
return self unless scope
change_scope = /^\s*\[\w+\]/.match(@note)
return self unless change_scope
# change_scope is a string of format `[scope]`, need to strip the `[]` to com... | ruby | {
"resource": ""
} |
q8870 | VcenterLib.Vcenter.vms | train | def vms
logger.debug "get all VMs in all datacenters: begin"
result = dcs.inject([]) do |r, dc|
r + serviceContent.viewManager.CreateContainerView(
| ruby | {
"resource": ""
} |
q8871 | Sevendigital.Artist.various? | train | def various?
joined_names = "#{name} #{appears_as}".downcase
various_variations = ["vario", "v???????????????rio", "v.a", "vaious", "varios" "vaious", "varoius", "variuos", \
"soundtrack", "karaoke", "original cast", "diverse | ruby | {
"resource": ""
} |
q8872 | Weechat.Helper.command_callback | train | def command_callback(id, buffer, args)
Weechat::Command.find_by_id(id).call(Weech | ruby | {
"resource": ""
} |
q8873 | Weechat.Helper.command_run_callback | train | def command_run_callback(id, buffer, command)
Weechat::Hooks::CommandRunHook.find_by_id(id) | ruby | {
"resource": ""
} |
q8874 | Weechat.Helper.timer_callback | train | def timer_callback(id, remaining)
| ruby | {
"resource": ""
} |
q8875 | Weechat.Helper.input_callback | train | def input_callback(method, buffer, input)
| ruby | {
"resource": ""
} |
q8876 | Weechat.Helper.bar_build_callback | train | def bar_build_callback(id, item, window)
| ruby | {
"resource": ""
} |
q8877 | Weechat.Helper.info_callback | train | def info_callback(id, info, arguments)
| ruby | {
"resource": ""
} |
q8878 | Weechat.Helper.print_callback | train | def print_callback(id, buffer, date, tags, displayed, highlight, prefix, message)
buffer = Weechat::Buffer.from_ptr(buffer)
date = Time.at(date.to_i)
tags = tags.split(",")
displayed = Weechat.integer_to_bool(displayed)
| ruby | {
"resource": ""
} |
q8879 | Weechat.Helper.signal_callback | train | def signal_callback(id, signal, data)
data = Weechat::Utilities.apply_transformation(signal, | ruby | {
"resource": ""
} |
q8880 | Weechat.Helper.config_callback | train | def config_callback(id, option, value)
ret | ruby | {
"resource": ""
} |
q8881 | Weechat.Helper.process_callback | train | def process_callback(id, command, code, stdout, stderr)
code = case code
when Weechat::WEECHAT_HOOK_PROCESS_RUNNING
:running
when Weechat::WEECHAT_HOOK_PROCESS_ERROR
:error
else
code
end
process = Weechat::Proc... | ruby | {
"resource": ""
} |
q8882 | Weechat.Helper.modifier_callback | train | def modifier_callback(id, modifier, modifier_data, s)
classes = Weechat::Hook.hook_classes
modifier_data = Weechat::Utilities.apply_transformation(modifier, modifier_data, ModifierCallbackTransformations)
modifier_data = [modifier_data] unless modifier_data.is_a?(Array)
args = modifier_data + [W... | ruby | {
"resource": ""
} |
q8883 | Basecampeverest.Connect.auth= | train | def auth=(authorization)
clensed_auth_hash = {}
authorization.each {|k, v|
clensed_auth_hash[k.to_sym] = v
}
# nice and pretty now
authorization = clensed_auth_hash
if authorization.has_key? :access_token
# clear the basic_auth, if it's set
self.class.def... | ruby | {
"resource": ""
} |
q8884 | Ponder.UserList.kill_zombie_users | train | def kill_zombie_users(users)
@mutex.synchronize do
(@users - users - Set.new([@thaum_user])).each do |user|
| ruby | {
"resource": ""
} |
q8885 | Annotator.Attributes.lines | train | def lines
ret = [Attributes::HEADER]
# Sort by name, but id goes first
@attrs.sort_by{|x| x[:name] == 'id' ? '_' : x[:name]}.each do |row|
line = "# * #{row[:name]} [#{row[:type]}]#{row[:desc].to_s.empty? ? "" | ruby | {
"resource": ""
} |
q8886 | Annotator.Attributes.update! | train | def update!
@model.columns.each do |column|
if row = @attrs.find {|x| x[:name] == column.name}
if row[:type] != type_str(column)
puts " M #{@model}##{column.name} [#{row[:type]} -> #{type_str(column)}]"
row[:type] = type_str(column)
elsif row[:desc] == InitialD... | ruby | {
"resource": ""
} |
q8887 | Annotator.Attributes.parse | train | def parse
@lines.each do |line|
if m = line.match(R_ATTRIBUTE)
@attrs << {:name => m[1].strip, :type | ruby | {
"resource": ""
} |
q8888 | Annotator.Attributes.truncate_default | train | def truncate_default(str)
return str unless str.kind_of? String
str.sub!(/^'(.*)'$/m,'\1')
| ruby | {
"resource": ""
} |
q8889 | Annotator.Attributes.type_str | train | def type_str(c)
ret = c.type.to_s
ret << ", primary" if c.primary
ret << ", default=#{truncate_default(c.default)}" if c.default
ret << ", not null" unless c.null
| ruby | {
"resource": ""
} |
q8890 | Bitsa.BitsaApp.run | train | def run(global_opts, cmd, search_data)
settings = load_settings(global_opts)
process_cmd(cmd, search_data, settings.login, settings.password,
| ruby | {
"resource": ""
} |
q8891 | Bitsa.BitsaApp.load_settings | train | def load_settings(global_opts)
settings = Settings.new
| ruby | {
"resource": ""
} |
q8892 | Bitsa.BitsaApp.search | train | def search(cache, search_data)
puts '' # Force first entry to be displayed in mutt
# Write out as EMAIL <TAB> NAME
| ruby | {
"resource": ""
} |
q8893 | Aker::Form.LoginFormAssetProvider.asset_root | train | def asset_root
File.expand_path(File.join(File.dirname(__FILE__),
%w(.. .. ..),
| ruby | {
"resource": ""
} |
q8894 | Aker::Form.LoginFormAssetProvider.login_html | train | def login_html(env, options = {})
login_base = env['SCRIPT_NAME'] + login_path(env)
template = File.read(File.join(asset_root, | ruby | {
"resource": ""
} |
q8895 | PuppetBox.Result.passed? | train | def passed?
passed = nil
@report.each { |r|
if passed == nil
passed = (r[:status] == PS_OK)
else
| ruby | {
"resource": ""
} |
q8896 | RailsExceptionLogger.LoggedExceptionsController.get_auth_data | train | def get_auth_data
auth_key = @@http_auth_headers.detect { |h| request.env.has_key?(h) }
auth_data = request.env[auth_key].to_s.split unless auth_key.blank?
return | ruby | {
"resource": ""
} |
q8897 | Mongolicious.Backup.parse_jobfile | train | def parse_jobfile(jobfile)
YAML.load(File.read(jobfile))
rescue Errno::ENOENT
Mongolicious.logger.error("Could not find job file at #{ARGV[0]}")
exit
rescue | ruby | {
"resource": ""
} |
q8898 | Mongolicious.Backup.schedule_jobs | train | def schedule_jobs(jobs)
scheduler = Rufus::Scheduler.start_new
jobs.each do |job|
if job['cron']
Mongolicious.logger.info("Scheduled new job for #{job['db'].split('/').last} with cron: #{job['cron']}")
| ruby | {
"resource": ""
} |
q8899 | Kanpachi.ResourceList.add | train | def add(resource)
if @list.key? resource.route
raise DuplicateResource, "A resource accessible via #{resource.http_verb} #{resource.url} | 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.