_id stringlengths 2 6 | title stringlengths 9 130 | partition stringclasses 3
values | text stringlengths 30 4.3k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q21300 | RConfig.LoadPaths.add_load_path | train | def add_load_path(path)
if path = parse_load_paths(path).first # only accept first one.
self.load_paths << path
self.load_paths.uniq!
| ruby | {
"resource": ""
} |
q21301 | RConfig.Reload.enable_reload= | train | def enable_reload=(reload)
raise ArgumentError, 'Argument must be true or false.' | ruby | {
"resource": ""
} |
q21302 | RConfig.Reload.reload_interval= | train | def reload_interval=(interval)
raise ArgumentError, 'Argument must be Integer.' unless interval.kind_of?(Integer)
self.enable_reload = | ruby | {
"resource": ""
} |
q21303 | RConfig.Reload.reload | train | def reload(force=false)
raise ArgumentError, 'Argument must be true or false.' unless [true, | ruby | {
"resource": ""
} |
q21304 | IsoDoc::Function.Utils.noko | train | def noko(&block)
doc = ::Nokogiri::XML.parse(NOKOHEAD)
fragment = doc.fragment("")
::Nokogiri::XML::Builder.with | ruby | {
"resource": ""
} |
q21305 | IsoDoc::Function.XrefGen.anchor_names | train | def anchor_names(docxml)
initial_anchor_names(docxml)
back_anchor_names(docxml)
# preempt clause notes with all other types of note
note_anchor_names(docxml.xpath(ns("//table | //example | //formula | "\
| ruby | {
"resource": ""
} |
q21306 | IsoDoc::Function.Cleanup.figure_cleanup | train | def figure_cleanup(docxml)
docxml.xpath(FIGURE_WITH_FOOTNOTES).each do |f|
key = figure_get_or_make_dl(f)
f.xpath(".//aside").each do |aside|
| ruby | {
"resource": ""
} |
q21307 | IsoDoc::Function.XrefSectGen.preface_names | train | def preface_names(clause)
return if clause.nil?
@anchors[clause["id"]] =
{ label: nil, level: 1, xref: preface_clause_name(clause), type: "clause" }
clause.xpath(ns("./clause | ./terms | ./term | ./definitions | ./references")).each_with_index do |c, | ruby | {
"resource": ""
} |
q21308 | Strainer.Sandbox.destroy_sandbox | train | def destroy_sandbox
if File.directory?(Strainer.sandbox_path)
Strainer.ui.debug " Destroying sandbox at '#{Strainer.sandbox_path}'"
FileUtils.rm_rf(Strainer.sandbox_path)
| ruby | {
"resource": ""
} |
q21309 | Strainer.Sandbox.create_sandbox | train | def create_sandbox
unless File.directory?(Strainer.sandbox_path)
Strainer.ui.debug " Creating sandbox at | ruby | {
"resource": ""
} |
q21310 | Strainer.Sandbox.load_cookbooks | train | def load_cookbooks(cookbook_names)
Strainer.ui.debug "Sandbox#load_cookbooks(#{cookbook_names.inspect})" | ruby | {
"resource": ""
} |
q21311 | Strainer.Sandbox.load_cookbook | train | def load_cookbook(cookbook_name)
Strainer.ui.debug "Sandbox#load_cookbook('#{cookbook_name.inspect}')"
cookbook_path = cookbooks_paths.find { |path| path.join(cookbook_name).exist? }
cookbook = if cookbook_path
path = cookbook_path.join(cookbook_name)
Strainer.ui.debug " fo... | ruby | {
"resource": ""
} |
q21312 | Strainer.Sandbox.load_self | train | def load_self
Strainer.ui.debug "Sandbox#load_self"
begin
Berkshelf::CachedCookbook.from_path(File.expand_path('.'))
rescue Berkshelf::CookbookNotFound
| ruby | {
"resource": ""
} |
q21313 | Strainer.Sandbox.cookbooks_and_dependencies | train | def cookbooks_and_dependencies
loaded_dependencies = Hash.new(false)
dependencies = @cookbooks.dup
dependencies.each do |cookbook|
loaded_dependencies[cookbook.cookbook_name] = true
cookbook.metadata.dependencies.keys.each do |dependency_name|
unless loaded_depe... | ruby | {
"resource": ""
} |
q21314 | Strainer.Sandbox.chef_repo? | train | def chef_repo?
@_chef_repo ||= begin
chef_folders = %w(.chef certificates config cookbooks data_bags environments roles)
| ruby | {
"resource": ""
} |
q21315 | Strainer.Sandbox.root_folders | train | def root_folders
@root_folders ||= Dir.glob("#{Dir.pwd}/*", File::FNM_DOTMATCH).collect do |f|
File.basename(f) if File.directory?(f)
| ruby | {
"resource": ""
} |
q21316 | Strainer.Runner.run! | train | def run!
@cookbooks.each do |name, c|
cookbook = c[:cookbook]
strainerfile = c[:strainerfile]
Strainer.ui.debug "Starting Runner for #{cookbook.cookbook_name} (#{cookbook.version})"
Strainer.ui.header("# Straining '#{cookbook.cookbook_name} (v#{cookbook.version})'")
strai... | ruby | {
"resource": ""
} |
q21317 | Strainer.Strainerfile.commands | train | def commands
@commands ||= if @options[:except]
@all_commands.reject{ |command| @options[:except].include?(command.label) }
elsif @options[:only]
@all_commands.select{ | ruby | {
"resource": ""
} |
q21318 | Strainer.Strainerfile.load! | train | def load!
return if @all_commands
contents = File.read @strainerfile
contents.strip!
contents.gsub! '$COOKBOOK', @cookbook.cookbook_name
contents.gsub! '$SANDBOX', Strainer.sandbox_path.to_s
# Drop empty lines and comments
lines = contents.split("\n")
lines.reject!{ |li... | ruby | {
"resource": ""
} |
q21319 | Strainer.Command.speak | train | def speak(message, options = {})
message.to_s.strip.split("\n").each do |line|
next if line.strip.empty?
| ruby | {
"resource": ""
} |
q21320 | Strainer.Command.inside_sandbox | train | def inside_sandbox(&block)
Strainer.ui.debug "Changing working directory to '#{Strainer.sandbox_path}'"
original_pwd = ENV['PWD']
ENV['PWD'] = Strainer.sandbox_path.to_s
success = Dir.chdir(Strainer.sandbox_path, &block)
| ruby | {
"resource": ""
} |
q21321 | Strainer.Command.inside_cookbook | train | def inside_cookbook(&block)
cookbook_path = File.join(Strainer.sandbox_path.to_s, @cookbook.cookbook_name)
Strainer.ui.debug "Changing working directory to '#{cookbook_path}'"
original_pwd = ENV['PWD']
ENV['PWD'] = | ruby | {
"resource": ""
} |
q21322 | Strainer.Command.run_as_pty | train | def run_as_pty(command)
Strainer.ui.debug 'Using PTY'
PTY.spawn(command) do |r, _, pid|
begin
r.sync
r.each_line { |line| | ruby | {
"resource": ""
} |
q21323 | Strainer.UI.error | train | def error(message, color = :red)
Strainer.log.error(message)
| ruby | {
"resource": ""
} |
q21324 | Tr8n.Token.token_value | train | def token_value(object, options, language)
# token is an array
if object.is_a?(Array)
# if you provided an array, it better have some values
if object.empty?
return raise Tr8n::TokenException.new("Invalid array value for a token: #{full_name}")
end
# if the first v... | ruby | {
"resource": ""
} |
q21325 | Tr8n.LanguageController.update_rules | train | def update_rules
@rules = rules_by_dependency(parse_language_rules)
unless params[:rule_action]
return render(:partial => "edit_rules")
end
if params[:rule_action].index("add_at")
position = params[:rule_action].split("_").last.to_i
cls = Tr8n::Config.language_rule_... | ruby | {
"resource": ""
} |
q21326 | Tr8n.LanguageController.update_language_cases | train | def update_language_cases
@cases = parse_language_cases
unless params[:case_action]
return render(:partial => "edit_cases")
end
if params[:case_action].index("add_at")
position = params[:case_action].split("_").last.to_i
@cases.insert(position, Tr8n::LanguageCase.... | ruby | {
"resource": ""
} |
q21327 | Tr8n.LanguageController.update_language_case_rules | train | def update_language_case_rules
cases = parse_language_cases
case_index = params[:case_index].to_i
lcase = cases[case_index]
if params[:case_action].index("add_rule_at")
position = params[:case_action].split("_").last.to_i
rule_data = params[:edit_rule].merge(:language => tr8n_cu... | ruby | {
"resource": ""
} |
q21328 | Tr8n.LanguageController.select | train | def select
@inline_translations_allowed = false
@inline_translations_enabled = false
if tr8n_current_user_is_translator?
unless tr8n_current_translator.blocked?
@inline_translations_allowed = true
@inline_translations_enabled = tr8n_current_translator.enable_inline_tr... | ruby | {
"resource": ""
} |
q21329 | Tr8n.LanguageController.switch | train | def switch
language_action = params[:language_action]
return redirect_to_source if tr8n_current_user_is_guest?
if tr8n_current_user_is_translator? # translator mode
if language_action == "toggle_inline_mode"
if tr8n_current_translator.enable_inline_translations?
... | ruby | {
"resource": ""
} |
q21330 | Tr8n.LanguageController.parse_language_rules | train | def parse_language_rules
rulz = []
return rulz unless params[:rules]
Tr8n::Config.language_rule_classes.each do |cls|
next unless params[:rules][cls.dependency]
index = 0
while params[:rules][cls.dependency]["#{index}"]
rule_params = params[:rules][cls.depend... | ruby | {
"resource": ""
} |
q21331 | Tr8n.LanguageCasesController.index | train | def index
@maps = Tr8n::LanguageCaseValueMap.where("language_id = ? and (reported is null or reported = ?)", tr8n_current_language.id, false)
@maps = | ruby | {
"resource": ""
} |
q21332 | Tr8n.BaseController.validate_current_translator | train | def validate_current_translator
if tr8n_current_user_is_translator? and tr8n_current_translator.blocked?
trfe("Your translation privileges have been revoked. Please contact the site administrator for more details.")
return redirect_to(Tr8n::Config.default_url) | ruby | {
"resource": ""
} |
q21333 | Tr8n.BaseController.validate_language_management | train | def validate_language_management
# admins can do everything
return if tr8n_current_user_is_admin?
if tr8n_current_language.default?
trfe("Only administrators can modify this language")
return | ruby | {
"resource": ""
} |
q21334 | Elasticsearch.Drain.client | train | def client
return @client unless @client.nil?
@client = ::Elasticsearch::Client.new(
| ruby | {
"resource": ""
} |
q21335 | Tr8n.ActionViewExtension.tr8n_client_sdk_tag | train | def tr8n_client_sdk_tag(opts = {})
# opts[:default_source] ||= tr8n_default_client_source
opts[:scheduler_interval] ||= Tr8n::Config.default_client_interval
opts[:enable_inline_translations] = (Tr8n::Config.current_user_is_translator? and Tr8n::Config.current_translator.enable_inline_... | ruby | {
"resource": ""
} |
q21336 | Rebi.ZipHelper.gen | train | def gen
log("Creating zip archivement", env_conf.name)
start = Time.now
ebextensions = env_conf.ebextensions
tmp_file = raw_zip_archive
tmp_folder = Dir.mktmpdir
Zip::File.open(tmp_file.path) do |z|
ebextensions.each do |ex_folder|
z.remove_folder ex_folder unless e... | ruby | {
"resource": ""
} |
q21337 | Liquid.Configuration.reload! | train | def reload!
clear
@mixins.each do |file|
mixin(file)
| ruby | {
"resource": ""
} |
q21338 | Liquid.Logger.called_from | train | def called_from
location = caller.detect('unknown:0') do |line|
line.match(/\/liquid(-|\/)ext/).nil?
| ruby | {
"resource": ""
} |
q21339 | LogBuddy.Utils.read_line | train | def read_line(frame)
file, line_number = frame.split(/:/, 2)
line_number = line_number.to_i
| ruby | {
"resource": ""
} |
q21340 | Symbiont.PublicTrigger.method | train | def method(method_name)
__context__ = __actual_context__(method_name)
# NOTE:
# block is used cuz #__actual_context__can raise
# ::NoMethodError (ContextNoMethodError) too (and we should raise it)
begin
__context__.method(method_name)
rescue ::NoMethodError
| ruby | {
"resource": ""
} |
q21341 | Symbiont.Isolator.public_method | train | def public_method(method_name, *required_contexts, direction: default_direction)
| ruby | {
"resource": ""
} |
q21342 | Symbiont.Isolator.private_method | train | def private_method(method_name, *required_contexts, direction: default_direction)
| ruby | {
"resource": ""
} |
q21343 | Symbiont.Isolator.public_trigger | train | def public_trigger(*required_contexts, direction: default_direction) | ruby | {
"resource": ""
} |
q21344 | Symbiont.Isolator.private_trigger | train | def private_trigger(*required_contexts, direction: default_direction)
| ruby | {
"resource": ""
} |
q21345 | Potracer.Trace.trace | train | def trace(bitmap = nil, params = nil, &block)
if block_given?
do_trace(bitmap || @bitmap, params || @params, &block)
else
| ruby | {
"resource": ""
} |
q21346 | Railjet.Context.method_missing | train | def method_missing(name, *args, &block)
getter_name = name[0..-2]
if name =~ /^[a-z]+=$/ && !respond_to?(getter_name)
| ruby | {
"resource": ""
} |
q21347 | Sprout::Executable.Session.handle_user_input | train | def handle_user_input
while true
begin
break if !wait_for_prompt
input = $stdin.gets.chomp!
execute_action(input, true)
| ruby | {
"resource": ""
} |
q21348 | Sprout::Executable.Session.execute_action | train | def execute_action action, silence=false
action = action.strip
if wait_for_prompt
stdout.puts(action) unless silence
| ruby | {
"resource": ""
} |
q21349 | GovukMessageQueueConsumer.Consumer.run | train | def run(subscribe_opts: {})
@rabbitmq_connection.start
subscribe_opts = { block: true, manual_ack: true}.merge(subscribe_opts)
queue.subscribe(subscribe_opts) do |delivery_info, headers, payload|
begin
message = Message.new(payload, headers, delivery_info)
@statsd_client.i... | ruby | {
"resource": ""
} |
q21350 | Sprout.ProcessRunner.update_status | train | def update_status sig=0
pid_int = Integer("#{ @pid }")
begin
Process::kill sig, pid_int
| ruby | {
"resource": ""
} |
q21351 | RandomSources.HotBits.bytes | train | def bytes(num=10)
num = [[2048, num.to_i].min , 0].max
numbers = []
response = REXML::Document.new( open("https://www.fourmilab.ch/cgi-bin/Hotbits?fmt=xml&nbytes=#{num}"))
status = REXML::XPath.first( response, "//status")
case status.attributes['result'].to_i
when | ruby | {
"resource": ""
} |
q21352 | Sprout::System.UnixSystem.should_repair_executable | train | def should_repair_executable path
return (File.exists?(path) | ruby | {
"resource": ""
} |
q21353 | RandomSources.RandomOrg.integers | train | def integers(options = {})
url_params = { max: clean(options[:max]) || 100,
min: clean(options[:min]) || 1,
num: clean(options[:num]) || 10,
base: clean(options[:base]) || 10,
rnd: 'new',
format: 'plain',
... | ruby | {
"resource": ""
} |
q21354 | RandomSources.RandomOrg.sequence | train | def sequence(min, max)
url_params = { max: clean(max) || 10,
min: clean(min) || 1,
rnd: 'new',
format: 'plain',
col: 1
}
sequence_numbers=[]
| ruby | {
"resource": ""
} |
q21355 | RandomSources.RandomOrg.strings | train | def strings(options = {})
url_params = { num: clean(options[:num]) || 10,
len: clean(options[:len]) || 8,
digits: check_on_off(options[:digits]) || 'on',
unique: check_on_off(options[:unique]) || 'on',
upperalpha: check_on_off(opt... | ruby | {
"resource": ""
} |
q21356 | Sprout.FileTarget.add_library | train | def add_library name, path
if path.is_a?(Array)
path = path.collect { |p| expand_local_path(p) }
else
path = expand_local_path path
end
| ruby | {
"resource": ""
} |
q21357 | Sprout.FileTarget.add_executable | train | def add_executable name, path
path = expand_local_path path
executables << OpenStruct.new( | ruby | {
"resource": ""
} |
q21358 | Sprout::System.BaseSystem.execute | train | def execute(tool, options='')
Sprout.stdout.puts("#{tool} #{options}")
runner = get_and_execute_process_runner(tool, options)
error = runner.read_err
result = runner.read
if(result.size > 0)
Sprout.stdout.puts result
end | ruby | {
"resource": ""
} |
q21359 | Sprout::System.BaseSystem.execute_thread | train | def execute_thread tool, options='', prompt=nil, &block
t = Thread.new do
Thread.current.abort_on_exception = true
runner = execute_silent(tool, options)
Thread.current['runner'] = runner
out = read_from runner.r, prompt, &block
| ruby | {
"resource": ""
} |
q21360 | Sprout::System.BaseSystem.get_and_execute_process_runner | train | def get_and_execute_process_runner tool, options=nil
runner | ruby | {
"resource": ""
} |
q21361 | Sprout::System.WinSystem.get_and_execute_process_runner | train | def get_and_execute_process_runner tool, options=nil
tool = clean_path find_tool(tool) | ruby | {
"resource": ""
} |
q21362 | ShellSpinner.Runner.build_new_exception | train | def build_new_exception e
e.class.new(e.message)
| ruby | {
"resource": ""
} |
q21363 | GithubStats.User.streak | train | def streak
return [] if streaks.empty?
streaks.last.last.date | ruby | {
"resource": ""
} |
q21364 | GithubStats.User.guess_user | train | def guess_user(names = [])
names << Rugged::Config.global['github.user'] if USE_RUGGED
names << ENV['USER']
names.find { | ruby | {
"resource": ""
} |
q21365 | GithubStats.User.real_streak_rewind | train | def real_streak_rewind(partial_streak)
new_data = download(partial_streak.first.date - 1)
old_data = partial_streak.map(&:to_a)
new_stats = GithubStats::Data.new(new_data + old_data)
partial_streak = new_stats.streaks.last
| ruby | {
"resource": ""
} |
q21366 | GithubStats.User.download | train | def download(to_date = nil)
url = to_date ? @url + "?to=#{to_date.strftime('%Y-%m-%d')}" : @url
res = Curl::Easy.perform(url)
code = res.response_code
raise("Failed loading data from GitHub: #{url} #{code}") if code != 200
| ruby | {
"resource": ""
} |
q21367 | Renalware.Patient.to_s | train | def to_s(format = :default)
title_suffix = " (#{title})" if has_title?
formatted_name = "#{family_name.upcase}, #{given_name}#{title_suffix}"
formatted_nhs_number = " (#{nhs_number})" if nhs_number.present?
case | ruby | {
"resource": ""
} |
q21368 | CloudProviders.Connections.ssh_cleanup_known_hosts! | train | def ssh_cleanup_known_hosts!(hosts=[host, public_ip])
hosts = [hosts] unless hosts.respond_to? :each
hosts.compact.each | ruby | {
"resource": ""
} |
q21369 | GithubStats.Data.to_h | train | def to_h
@raw.reduce(Hash.new(0)) do |acc, elem|
| ruby | {
"resource": ""
} |
q21370 | GithubStats.Data.streaks | train | def streaks
streaks = @raw.each_with_object(Array.new(1, [])) do |point, acc|
point.score.zero? ? acc << [] : acc.last << point
| ruby | {
"resource": ""
} |
q21371 | GithubStats.Data.outliers | train | def outliers
return [] if scores.uniq.size < 5
scores.select { |x| ((mean - | ruby | {
"resource": ""
} |
q21372 | GithubStats.Data.quartiles | train | def quartiles
quartiles = Array.new(5) { [] }
@raw.each_with_object(quartiles) do |elem, acc|
| ruby | {
"resource": ""
} |
q21373 | GithubStats.Data.quartile | train | def quartile(score)
return nil if score < 0 || score | ruby | {
"resource": ""
} |
q21374 | GithubStats.Data.pad | train | def pad(fill_value = -1, data = @raw.clone)
data = _pad data, 0, fill_value, 0
| ruby | {
"resource": ""
} |
q21375 | Renalware.ApplicationHelper.page_title | train | def page_title(separator = Renalware.config.page_title_spearator)
[
| ruby | {
"resource": ""
} |
q21376 | CloudProviders.Ec2Instance.make_image | train | def make_image(opts={})
opts = {:volume => '/',
:size => 6000,
:destination => '/mnt/bundle',
:exclude => nil
}.merge(opts)
image_file = File.join(opts[:destination], opts[:prefix] )
cmds = ["mkdir -p #{opts[:destination]}"]
... | ruby | {
"resource": ""
} |
q21377 | CloudProviders.ElasticAutoScaler.teardown | train | def teardown
triggers.each do |trigger|
trigger.teardown
end
if autoscaling_groups.select {|n| n.name == name }.empty?
puts "Cloud #{cloud.name} autoscaling group does not exist"
else
self.minimum_instances = 0
self.maximum_instances = 0
@new_launch_config... | ruby | {
"resource": ""
} |
q21378 | Sapience.Configuration.map_levels | train | def map_levels
return [] unless defined?(::Logger::Severity)
@@map_levels ||=
::Logger::Severity.constants.each_with_object([]) do |constant, levels|
| ruby | {
"resource": ""
} |
q21379 | Renalware.Broadcasting.broadcasting_to_configured_subscribers | train | def broadcasting_to_configured_subscribers
subscribers = Array(Renalware.config.broadcast_subscription_map[self.class.name])
subscribers.each do |subscriber|
# Support String subscribers eg a simple class name as well as Subscriber instances.
| ruby | {
"resource": ""
} |
q21380 | PoolParty.Chef.recipe | train | def recipe(recipe_name, hsh={})
_recipes << recipe_name unless _recipes.include?(recipe_name)
head = {}
tail = head
recipe_name.split("::").each do |key|
unless key == "default"
n = {}
| ruby | {
"resource": ""
} |
q21381 | Sapience.LogMethods.measure | train | def measure(level, message, params = {}, &block)
index = Sapience.config.level_to_index(level)
if level_index <= index
measure_internal(level, | ruby | {
"resource": ""
} |
q21382 | Renalware.PDRegimesHelper.available_pd_treatments_for | train | def available_pd_treatments_for(regime)
scope = "renalware.pd.treatments"
key = regime.capd? | ruby | {
"resource": ""
} |
q21383 | Sapience.Logger.log | train | def log(log, message = nil, progname = nil, &block)
# Compatibility with ::Logger
return add(log, message, progname, &block) unless log.is_a?(Sapience::Log)
if @@appender_thread
@@appender_thread << lambda do
Sapience.appenders.each do |appender|
next unless appender.vali... | ruby | {
"resource": ""
} |
q21384 | Sapience.Base.with_payload | train | def with_payload(payload)
current_payload = self.payload
Thread.current[:sapience_payload] = current_payload ? current_payload.merge(payload) : payload
| ruby | {
"resource": ""
} |
q21385 | Sapience.Base.include_message? | train | def include_message?(log)
return true if @filter.nil?
if @filter.is_a?(Regexp)
!(@filter =~ log.name).nil?
elsif | ruby | {
"resource": ""
} |
q21386 | Sapience.Base.extract_backtrace | train | def extract_backtrace
stack = caller
while (first = stack.first) && first.include?(SELF_PATTERN)
| ruby | {
"resource": ""
} |
q21387 | DataPackage.Helpers.dereference_descriptor | train | def dereference_descriptor(resource, base_path: nil, reference_fields: nil)
options = {
base_path: base_path,
reference_fields: reference_fields,
}
case resource
when Hash
resource.inject({}) do |new_resource, (key, val)|
if reference_fields.nil? || reference_fi... | ruby | {
"resource": ""
} |
q21388 | CloudProviders.Ec2.describe_instances | train | def describe_instances(id=nil)
begin
@describe_instances = ec2.describe_instances.reservationSet.item.map do |r|
r.instancesSet.item.map do |i|
inst_options = i.merge(r.merge(:cloud => cloud)).merge(cloud.cloud_provider.dsl_options)
Ec2Instance.new(inst_options)
... | ruby | {
"resource": ""
} |
q21389 | CloudProviders.Ec2.aws_options | train | def aws_options(opts={})
uri=URI.parse(ec2_url)
{ :access_key_id => access_key,
:secret_access_key=> secret_access_key,
:use_ssl => (uri.scheme=='https'),
:path | ruby | {
"resource": ""
} |
q21390 | CloudProviders.Ec2.ec2 | train | def ec2
@ec2 ||= begin
AWS::EC2::Base.new( aws_options )
rescue AWS::ArgumentError => e # AWS credentials missing?
puts "Error contacting AWS: #{e}"
| ruby | {
"resource": ""
} |
q21391 | CloudProviders.Ec2.credential_file | train | def credential_file(file=nil)
unless file.nil?
dsl_options[:credential_file]=file | ruby | {
"resource": ""
} |
q21392 | CFA.BaseModel.generic_set | train | def generic_set(key, value, tree = data)
modify(key, value, tree) || uncomment(key, | ruby | {
"resource": ""
} |
q21393 | PaperTrailScrapbook.Chapter.story | train | def story
updates = changes
return unless tell_story?(updates)
[preface, (updates | ruby | {
"resource": ""
} |
q21394 | CFA.AugeasWriter.report_error | train | def report_error
return if yield
error = aug.error
# zero is no error, so problem in lense
if aug.error[:code].nonzero?
raise "Augeas error #{error[:message]}. Details: #{error[:details]}."
end
| ruby | {
"resource": ""
} |
q21395 | PaperTrailScrapbook.Changes.change_log | train | def change_log
text =
changes
.map { |k, v| digest(k, v) }
.compact
.join("\n")
| ruby | {
"resource": ""
} |
q21396 | ConfigVar.Context.method_missing | train | def method_missing(name, *args)
value = @values[name]
if value.nil? && !@values.has_key?(name)
address = "<#{self.class.name}:0x00#{(self.object_id << 1).to_s(16)}>"
| ruby | {
"resource": ""
} |
q21397 | ConfigVar.Context.required_string | train | def required_string(name)
required_custom(name) do |env|
if value = env[name.to_s.upcase]
| ruby | {
"resource": ""
} |
q21398 | ConfigVar.Context.required_int | train | def required_int(name)
required_custom(name) do |env|
if value = env[name.to_s.upcase]
{name => parse_int(name, value)}
else
| ruby | {
"resource": ""
} |
q21399 | ConfigVar.Context.required_bool | train | def required_bool(name)
required_custom(name) do |env|
if value = env[name.to_s.upcase]
{name => parse_bool(name, value)}
else
| 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.