_id stringlengths 2 6 | title stringlengths 9 130 | partition stringclasses 3
values | text stringlengths 30 4.3k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q23200 | Android.Apk.digest | train | def digest(type = :sha1)
case type
when :sha1
Digest::SHA1.hexdigest(@bindata)
when :sha256
Digest::SHA256.hexdigest(@bindata)
when :md5 | ruby | {
"resource": ""
} |
q23201 | Android.Apk.entry | train | def entry(name)
entry = @zip.find_entry(name)
| ruby | {
"resource": ""
} |
q23202 | Android.Apk.find | train | def find(&block)
found = []
self.each_file do |name, data|
ret = block.call(name, data)
| ruby | {
"resource": ""
} |
q23203 | Android.Apk.icon | train | def icon
icon_id = @manifest.doc.elements['/manifest/application'].attributes['icon']
if /^@(\w+\/\w+)|(0x[0-9a-fA-F]{8})$/ =~ icon_id
drawables = @resource.find(icon_id)
| ruby | {
"resource": ""
} |
q23204 | Android.Apk.signs | train | def signs
signs = {}
self.each_file do |path, data|
# find META-INF/xxx.{RSA|DSA}
| ruby | {
"resource": ""
} |
q23205 | Android.Apk.certificates | train | def certificates
return Hash[self.signs.map{|path, sign| [path, | ruby | {
"resource": ""
} |
q23206 | Android.Manifest.version_name | train | def version_name(lang=nil)
vername = @doc.root.attributes['versionName']
unless @rsc.nil?
if /^@(\w+\/\w+)|(0x[0-9a-fA-F]{8})$/ =~ vername
opts = {}
| ruby | {
"resource": ""
} |
q23207 | Android.Manifest.to_xml | train | def to_xml(indent=4)
xml =''
formatter = REXML::Formatters::Pretty.new(indent)
| ruby | {
"resource": ""
} |
q23208 | Android.AXMLParser.parse_attribute | train | def parse_attribute
ns_id, name_id, val_str_id, flags, val = @io.read(4*5).unpack("V*")
key = @strings[name_id]
unless ns_id == 0xFFFFFFFF
ns = @strings[ns_id]
prefix = ns.sub(/.*\//,'')
unless @ns.include? ns
@ns << ns | ruby | {
"resource": ""
} |
q23209 | PageValidations.HTMLValidation.each_exception | train | def each_exception
Dir.chdir(@data_folder)
Dir.glob("*.exceptions.txt").each do |file|
if File.open(File.join(@data_folder, file), | ruby | {
"resource": ""
} |
q23210 | Rumonade.Monad.map_with_monad | train | def map_with_monad(lam = nil, &blk)
bind { |v| | ruby | {
"resource": ""
} |
q23211 | Rumonade.Monad.select | train | def select(lam = nil, &blk)
bind { |x| (lam | ruby | {
"resource": ""
} |
q23212 | HMAC.Signer.generate_signature | train | def generate_signature(params)
secret = params.delete(:secret)
# jruby stumbles over empty secrets, we regard them as invalid anyways, so we return an empty digest if no scret was given
if '' == secret.to_s
nil
| ruby | {
"resource": ""
} |
q23213 | HMAC.Signer.validate_url_signature | train | def validate_url_signature(url, secret, opts = {})
opts = default_opts.merge(opts)
opts[:query_based] = true
uri = parse_url(url)
query_values = Rack::Utils.parse_nested_query(uri.query)
return false unless query_values
auth_params = query_values.delete(opts[:auth_param])
ret... | ruby | {
"resource": ""
} |
q23214 | HMAC.Signer.canonical_representation | train | def canonical_representation(params)
rep = ""
rep << "#{params[:method].upcase}\n"
rep << "date:#{params[:date]}\n"
rep << "nonce:#{params[:nonce]}\n"
(params[:headers] || {}).sort.each do |pair|
name,value = *pair
rep << "#{name.downcase}:#{value}\n"
| ruby | {
"resource": ""
} |
q23215 | HMAC.Signer.sign_request | train | def sign_request(url, secret, opts = {})
opts = default_opts.merge(opts)
uri = parse_url(url)
headers = opts[:headers] || {}
date = opts[:date] || Time.now.gmtime
date = date.gmtime.strftime('%a, %d %b %Y %T GMT') if date.respond_to? :strftime
method = opts[:method] ? opts[:method... | ruby | {
"resource": ""
} |
q23216 | HMAC.Signer.sign_url | train | def sign_url(url, secret, opts = {})
opts = default_opts.merge(opts)
| ruby | {
"resource": ""
} |
q23217 | Playful.Device.start | train | def start
EM.synchrony do
web_server = Thin::Server.start('0.0.0.0', 3000) do
use Rack::CommonLogger
use Rack::ShowExceptions
map '/presentation' do
use Rack::Lint
| ruby | {
"resource": ""
} |
q23218 | Satyr.Report.stacktrace | train | def stacktrace
stacktrace = @struct[:stacktrace]
return nil if stacktrace.null?
# There's no sr_stacktrace_dup in libsatyr.so.3, we've got to find out
# the type ourselves.
dup = case @struct[:type]
when :core
Satyr::FFI.sr_core_stacktrace_dup(stacktrace)
when :python
... | ruby | {
"resource": ""
} |
q23219 | Satyr.Stacktrace.find_crash_thread | train | def find_crash_thread
pointer = Satyr::FFI.sr_stacktrace_find_crash_thread @struct.to_ptr
raise SatyrError, "Could not find crash thread" if pointer.null?
dup = Satyr::FFI.sr_thread_dup(pointer)
| ruby | {
"resource": ""
} |
q23220 | Rumonade.Option.get_or_else | train | def get_or_else(val_or_lam = nil, &blk)
v_or_f = val_or_lam || blk
if !empty? | ruby | {
"resource": ""
} |
q23221 | Subroutine.Op.inherit_errors | train | def inherit_errors(error_object)
error_object = error_object.errors if error_object.respond_to?(:errors)
error_object.each do |k, v|
next if _error_ignores[k.to_sym]
if respond_to?(k)
errors.add(k, v)
elsif _error_map[k.to_sym]
| ruby | {
"resource": ""
} |
q23222 | Subroutine.Op.sanitize_params | train | def sanitize_params(inputs)
out = {}.with_indifferent_access
_fields.each_pair do |field, config|
next unless inputs.key?(field)
| ruby | {
"resource": ""
} |
q23223 | Rumonade.PartialFunction.or_else | train | def or_else(other)
PartialFunction.new(lambda { |x| self.defined_at?(x) || other.defined_at?(x) },
| ruby | {
"resource": ""
} |
q23224 | Rumonade.PartialFunction.and_then | train | def and_then(func)
PartialFunction.new(@defined_at_proc, | ruby | {
"resource": ""
} |
q23225 | Uploadcare.RawApi.request | train | def request(method = :get, path = '/files/', params = {})
response = @api_connection.send | ruby | {
"resource": ""
} |
q23226 | Uploadcare.UploadingApi.upload | train | def upload(object, options = {})
if file?(object) then upload_file(object, options)
elsif object.is_a?(Array) then upload_files(object, options)
elsif object.is_a?(String) then upload_url(object, options)
| ruby | {
"resource": ""
} |
q23227 | Uploadcare.UploadingApi.upload_files | train | def upload_files(files, options = {})
data = upload_params(options).for_file_upload(files)
response = @upload_connection.post('/base/', data)
| ruby | {
"resource": ""
} |
q23228 | Uploadcare.UploadingApi.upload_url | train | def upload_url(url, options = {})
params = upload_params(options).for_url_upload(url)
token = request_file_upload(params)
upload_status = poll_upload_result(token)
if upload_status['status'] == 'error'
| ruby | {
"resource": ""
} |
q23229 | OandaAPI.Throttling.restore_original_new_method | train | def restore_original_new_method(klass)
klass.define_singleton_method :new do |*args, &block|
| ruby | {
"resource": ""
} |
q23230 | OandaAPI.Throttling.throttle_connection_rate | train | def throttle_connection_rate
now = Time.now
delta = now - (last_new_connection_at || now)
_throttle(delta, now) if delta < OandaAPI.configuration.min_new_connection_interval &&
| ruby | {
"resource": ""
} |
q23231 | RailsBootstrapHelpers::Renderers.AbstractLinkRenderer.append_class | train | def append_class (cls)
return unless cls
if c = html_options["class"]
html_options["class"] << " " + cls.to_s
else
if c = has_option?("class")
c << " " + | ruby | {
"resource": ""
} |
q23232 | Darrrr.RecoveryProvider.countersign_token | train | def countersign_token(token:, context: nil, options: 0x00)
begin
account_provider = RecoveryToken.account_provider_issuer(token)
rescue RecoveryTokenSerializationError, UnknownProviderError
raise TokenFormatError, "Could not determine provider"
end
counter_recovery_token = Recov... | ruby | {
"resource": ""
} |
q23233 | Darrrr.RecoveryProvider.validate_recovery_token! | train | def validate_recovery_token!(token, context = {})
errors = []
# 1. Authenticate the User. The exact nature of how the Recovery Provider authenticates the User is beyond the scope of this specification.
# handled in before_filter
# 4. Retrieve the Account Provider configuration as described in ... | ruby | {
"resource": ""
} |
q23234 | Darrrr.AccountProvider.generate_recovery_token | train | def generate_recovery_token(data:, audience:, context: nil, options: 0x00)
token = RecoveryToken.build(issuer: self, audience: audience, type: RECOVERY_TOKEN_TYPE, options: options)
| ruby | {
"resource": ""
} |
q23235 | Darrrr.AccountProvider.dangerous_unverified_recovery_token | train | def dangerous_unverified_recovery_token(countersigned_token)
parsed_countersigned_token | ruby | {
"resource": ""
} |
q23236 | Darrrr.AccountProvider.validate_countersigned_recovery_token! | train | def validate_countersigned_recovery_token!(countersigned_token, context = {})
# 5. Validate the the issuer field is present in the token,
# and that it matches the audience field in the original countersigned token.
begin
recovery_provider = RecoveryToken.recovery_provider_issuer(Base64.strict... | ruby | {
"resource": ""
} |
q23237 | Darrrr.CryptoHelper.seal | train | def seal(token, context = nil)
raise RuntimeError, "signing private key must be set" unless self.instance_variable_get(:@signing_private_key)
| ruby | {
"resource": ""
} |
q23238 | Darrrr.CryptoHelper.unseal | train | def unseal(token_and_signature, context = nil)
token = RecoveryToken.parse(token_and_signature)
unless token.version.to_i == PROTOCOL_VERSION
raise TokenFormatError, "Version field must be #{PROTOCOL_VERSION}"
end
token_data, signature = partition_signed_token(token_and_signature, toke... | ruby | {
"resource": ""
} |
q23239 | RSpec.Repeat.repeat | train | def repeat(ex, count, options = {})
| ruby | {
"resource": ""
} |
q23240 | AmCharts.Chart.method_missing | train | def method_missing(name, *args, &block)
return type.send(name) | ruby | {
"resource": ""
} |
q23241 | Rye.Rap.add_stderr | train | def add_stderr(*args)
args = args.flatten.compact
args = args.first.split($/) if args.size == 1
@stderr ||= []
| ruby | {
"resource": ""
} |
q23242 | RecordCache.Dispatcher.parse | train | def parse(options)
# find the record store, possibly based on the :store option
store = record_store(options.delete(:store))
# dispatch the parse call to all known strategies
Dispatcher.strategy_classes.map{ |klass| klass.parse(@base, store, options) }.flatten.compact.each do |strategy|
... | ruby | {
"resource": ""
} |
q23243 | RecordCache.Dispatcher.invalidate | train | def invalidate(strategy, value = nil)
(value = strategy; strategy = :id) unless strategy.is_a?(Symbol)
# call the invalidate method of the chosen strategy
| ruby | {
"resource": ""
} |
q23244 | Rye.Set.run_command | train | def run_command(meth, *args, &block)
runner = @parallel ? :run_command_parallel | ruby | {
"resource": ""
} |
q23245 | Rye.Set.run_command_parallel | train | def run_command_parallel(meth, *args, &block)
debug "P: #{meth} on #{@boxes.size} boxes (#{@boxes.collect {|b| b.host }.join(', ')})"
threads = []
raps = Rye::Rap.new(self)
(@boxes || []).each do |box|
threads << Thread.new do
Thread.current[:rap] = box.send(meth, *args, &bloc... | ruby | {
"resource": ""
} |
q23246 | Rye.Set.run_command_serial | train | def run_command_serial(meth, *args, &block)
debug "S: #{meth} on #{@boxes.size} boxes (#{@boxes.collect {|b| b.host }.join(', ')})"
raps = Rye::Rap.new(self)
| ruby | {
"resource": ""
} |
q23247 | ActiveRecord::ConnectionAdapters.PostgreSQLAdapter.quote | train | def quote(value, column = nil)
if value.kind_of?(GeoRuby::SimpleFeatures::Geometry)
| ruby | {
"resource": ""
} |
q23248 | ActiveRecord::ConnectionAdapters.PostgreSQLAdapter.add_index | train | def add_index(table_name, column_name, options = {})
column_names = Array(column_name)
index_name = index_name(table_name, :column => column_names)
if Hash === options # legacy support, since this param was a string
index_type = options[:unique] ? "UNIQUE" : ""
| ruby | {
"resource": ""
} |
q23249 | Rye.Box.ostype | train | def ostype
return @rye_ostype if @rye_ostype # simple cache
os = self.quietly { uname.first } rescue nil
| ruby | {
"resource": ""
} |
q23250 | Rye.Box.unsafely | train | def unsafely(*args, &block)
previous_state = @rye_safe
disable_safe_mode
ret = self.instance_exec | ruby | {
"resource": ""
} |
q23251 | Rye.Box.quietly | train | def quietly(*args, &block)
previous_state = @rye_quiet
enable_quiet_mode
ret = self.instance_exec | ruby | {
"resource": ""
} |
q23252 | Rye.Box.sudo | train | def sudo(*args, &block)
if block.nil?
run_command('sudo', args);
else
previous_state = @rye_sudo
enable_sudo
| ruby | {
"resource": ""
} |
q23253 | Rye.Box.prepend_env | train | def prepend_env(cmd)
return cmd unless @rye_current_environment_variables.is_a?(Hash)
env = ''
| ruby | {
"resource": ""
} |
q23254 | Rye.Box.run_command | train | def run_command(*args, &blk)
debug "run_command"
cmd, args = prep_args(*args)
#p [:run_command, cmd, blk.nil?]
connect if !@rye_ssh || @rye_ssh.closed?
raise Rye::NotConnected, @rye_host unless @rye_ssh && !@rye_ssh.closed?
cmd_clean = Rye.escape(@rye_safe... | ruby | {
"resource": ""
} |
q23255 | RecordCache.Query.where_values | train | def where_values(attribute, type = :integer)
return @where_values[attribute] | ruby | {
"resource": ""
} |
q23256 | RecordCache.Query.where_value | train | def where_value(attribute, type = :integer)
values = where_values(attribute, type)
return nil | ruby | {
"resource": ""
} |
q23257 | Rye.Cmd.file_append | train | def file_append(filepath, newcontent, backup=false)
content = StringIO.new
if self.file_exists?(filepath)
self.cp filepath, "#{filepath}-previous" if backup
content = self.file_download filepath
end
if newcontent.is_a?(StringIO)
| ruby | {
"resource": ""
} |
q23258 | Rye.Cmd.file_write | train | def file_write(filepath, newcontent, backup=false)
if self.file_exists?(filepath)
self.cp filepath, "#{filepath}-previous" if backup
end
| ruby | {
"resource": ""
} |
q23259 | Rye.Cmd.template_upload | train | def template_upload(*paths)
remote_path = paths.pop
templates = []
paths.collect! do |path|
if StringIO === path
path.rewind
template = Rye::Tpl.new(path.read, "inline-template")
elsif String === path
raise "No such file: #{Dir.pwd}/#{path}" unless F... | ruby | {
"resource": ""
} |
q23260 | Rye.Cmd.file_exists? | train | def file_exists?(path)
begin
ret = self.quietly { ls(path) }
rescue Rye::Err => ex
ret = ex.rap
end
# "ls" returns a 0 exit code regardless of success in | ruby | {
"resource": ""
} |
q23261 | Rye.Hop.fetch_port | train | def fetch_port(host, port = 22, localport = nil)
connect unless @rye_ssh
if localport.nil?
port_used = next_port
else
port_used = localport
end
# i would like to check if the port and host
# are already an active_locals forward, but that
# info does not get re... | ruby | {
"resource": ""
} |
q23262 | Rye.Hop.connect | train | def connect(reconnect=true)
raise Rye::NoHost unless @rye_host
return if @rye_ssh && !reconnect
disconnect if @rye_ssh
if @rye_via
debug "Opening connection to #{@rye_host} as #{@rye_user}, via #{@rye_via.host}"
else
debug "Opening connection to #{@rye_host} as #{@rye_user... | ruby | {
"resource": ""
} |
q23263 | Rye.Hop.remove_hops! | train | def remove_hops!
return unless @rye_ssh && @rye_ssh.forward.active_locals.count > 0
@rye_ssh.forward.active_locals.each {|fport, fhost|
@rye_ssh.forward.cancel_local(fport, fhost)
}
if !@rye_ssh.channels.empty?
| ruby | {
"resource": ""
} |
q23264 | Rye.Hop.disconnect | train | def disconnect
return unless @rye_ssh && !@rye_ssh.closed?
begin
debug "removing active forwards"
remove_hops!
debug "killing port_loop @rye_port_thread"
@rye_port_thread.kill
if @rye_ssh.busy?;
info "Is something still running? (ctrl-C to exit)"
T... | ruby | {
"resource": ""
} |
q23265 | Rye.Hop.next_port | train | def next_port
port = @next_port
@next_port -= 1
@next_port = MAX_PORT if @next_port < MIN_PORT
# check if the port is in use, if so | ruby | {
"resource": ""
} |
q23266 | RecordCache.VersionStore.current_multi | train | def current_multi(id_key_map)
current_versions = @store.read_multi(*(id_key_map.values))
| ruby | {
"resource": ""
} |
q23267 | Synvert.CLI.run | train | def run(args)
run_option_parser(args)
case @options[:command]
when 'list'
load_rewriters
list_available_rewriters
when 'open'
open_rewriter
when 'query'
load_rewriters
query_available_rewriters
when 'show'
load_rewriters
show_r... | ruby | {
"resource": ""
} |
q23268 | Synvert.CLI.run_option_parser | train | def run_option_parser(args)
optparse = OptionParser.new do |opts|
opts.banner = 'Usage: synvert [project_path]'
opts.on '-d', '--load SNIPPET_PATHS', 'load custom snippets, snippet paths can be local file path or remote http url' do |snippet_paths|
@options[:custom_snippet_paths] = snipp... | ruby | {
"resource": ""
} |
q23269 | Synvert.CLI.load_rewriters | train | def load_rewriters
Dir.glob(File.join(default_snippets_path, 'lib/**/*.rb')).each { |file| require file }
@options[:custom_snippet_paths].each do |snippet_path|
if snippet_path =~ /^http/
uri = URI.parse snippet_path
| ruby | {
"resource": ""
} |
q23270 | Synvert.CLI.list_available_rewriters | train | def list_available_rewriters
if Core::Rewriter.availables.empty?
puts 'There is no snippet under ~/.synvert, please run `synvert --sync` to fetch snippets.'
else
Core::Rewriter.availables.each do |group, rewriters|
puts group
| ruby | {
"resource": ""
} |
q23271 | Synvert.CLI.open_rewriter | train | def open_rewriter
editor = [ENV['SYNVERT_EDITOR'], ENV['EDITOR']].find { |e| !e.nil? && !e.empty? }
return puts 'To open a synvert snippet, set $EDITOR or $SYNVERT_EDITOR' unless editor
| ruby | {
"resource": ""
} |
q23272 | Synvert.CLI.query_available_rewriters | train | def query_available_rewriters
Core::Rewriter.availables.each do |group, rewriters|
if group.include? @options[:query]
puts group
rewriters.each do |name, rewriter|
| ruby | {
"resource": ""
} |
q23273 | Synvert.CLI.show_rewriter | train | def show_rewriter
group, name = @options[:snippet_name].split('/')
rewriter = Core::Rewriter.fetch(group, name)
if rewriter
rewriter.process_with_sandbox
puts rewriter.description
rewriter.sub_snippets.each do |sub_rewriter|
puts
puts '=' * 80 | ruby | {
"resource": ""
} |
q23274 | Jiralicious.Session.request | train | def request(method, *options)
response_handler = if options.last.is_a?(Hash) && options.last[:handler]
options.last.delete(:handler)
else
| ruby | {
"resource": ""
} |
q23275 | Staypuft.Deployment.update_hostgroup_list | train | def update_hostgroup_list
old_deployment_role_hostgroups = deployment_role_hostgroups.to_a
new_deployment_role_hostgroups = layout.layout_roles.map do |layout_role|
deployment_role_hostgroup = deployment_role_hostgroups.where(:role_id => layout_role.role).first_or_initialize do |drh|
drh.h... | ruby | {
"resource": ""
} |
q23276 | Jiralicious.Version.update | train | def update(details)
details.each do |k, v|
| ruby | {
"resource": ""
} |
q23277 | Jiralicious.OauthSession.get_secret | train | def get_secret
if Jiralicious.oauth_secret.nil?
IO.read(Jiralicious.config_path + Jiralicious.oauth_secret_filename)
| ruby | {
"resource": ""
} |
q23278 | Jiralicious.OauthSession.handler | train | def handler
proc do |response|
case response.code
when 200..204
response
else
message = response.body
| ruby | {
"resource": ""
} |
q23279 | Jiralicious.CookieSession.after_request | train | def after_request(response)
unless @authenticating
if captcha_required(response) # rubocop:disable Style/GuardClause
raise Jiralicious::CaptchaRequired, "Captacha is required. Try logging into Jira via the web interface"
elsif cookie_invalid(response)
# Can usually be fixed by | ruby | {
"resource": ""
} |
q23280 | Jiralicious.CookieSession.login | train | def login
@authenticating = true
handler = proc do |response|
if response.code == 200
@session = response["session"]
@login_info = response["loginInfo"]
self.class.cookies(session["name"] => session["value"])
else
clear_session
case response.... | ruby | {
"resource": ""
} |
q23281 | Jiralicious.CookieSession.logout | train | def logout
handler = proc do
if response.code == 204
clear_session
else
case response.code
when 401 then
raise Jiralicious::NotLoggedIn, "Not logged in"
else
# Give Net::HTTP reason
| ruby | {
"resource": ""
} |
q23282 | Jiralicious.Issue.save | train | def save
if loaded?
self.class.update(@fields.format_for_update, jira_key)
else
response = self.class.create(@fields.format_for_create)
| ruby | {
"resource": ""
} |
q23283 | Danger.DangerEslint.lint_results | train | def lint_results
bin = eslint_path
raise 'eslint is not installed' unless bin
return run_lint(bin, '.') unless filtering
((git.modified_files - git.deleted_files) + git.added_files)
| ruby | {
"resource": ""
} |
q23284 | Danger.DangerEslint.send_comment | train | def send_comment(results)
dir = "#{Dir.pwd}/"
results['messages'].each do |r|
filename = results['filePath'].gsub(dir, '')
method = r['severity'] > 1 ? 'fail' : 'warn' | ruby | {
"resource": ""
} |
q23285 | Jiralicious.Component.update | train | def update(details)
details.each do |k, v|
| ruby | {
"resource": ""
} |
q23286 | Jiralicious.Base.method_missing | train | def method_missing(meth, *args, &block)
if !loaded?
self.loaded = true
reload
| ruby | {
"resource": ""
} |
q23287 | Jiralicious.Configuration.options | train | def options
VALID_OPTIONS.inject({}) do |option, key|
| ruby | {
"resource": ""
} |
q23288 | Jiralicious.Configuration.reset | train | def reset
self.username = DEFAULT_USERNAME
self.password = DEFAULT_PASSWORD
self.uri = DEFAULT_URI
self.api_version = DEFAULT_API_VERSION
| ruby | {
"resource": ""
} |
q23289 | Jiralicious.Configuration.load_yml | train | def load_yml(yml_file, mode = nil)
if File.exist?(yml_file)
yml_cfg = OpenStruct.new(YAML.load_file(yml_file))
if mode.nil? || mode =~ /production/i
yml_cfg.jira.each do |k, v|
instance_variable_set("@#{k}", v)
end
| ruby | {
"resource": ""
} |
q23290 | Staypuft.InterfaceAssigner.unassign_physical | train | def unassign_physical(interface)
interface.ip = nil if interface.subnet.ipam?
interface.subnet_id = nil
unless interface.save
| ruby | {
"resource": ""
} |
q23291 | Humidifier.Loader.load | train | def load
parsed = JSON.parse(File.read(SPECPATH))
structs = StructureContainer.new(parsed['PropertyTypes'])
parsed['ResourceTypes'].each do |key, spec|
| ruby | {
"resource": ""
} |
q23292 | ActiveRecord.Base.find_each_with_progress | train | def find_each_with_progress(options = {})
Progress.start(name.tableize, count(options)) do
find_each do |model|
| ruby | {
"resource": ""
} |
q23293 | ActiveRecord.Base.find_in_batches_with_progress | train | def find_in_batches_with_progress(options = {})
Progress.start(name.tableize, count(options)) do
find_in_batches do |batch|
| ruby | {
"resource": ""
} |
q23294 | Humidifier.Resource.method_missing | train | def method_missing(name, *args)
if !valid_accessor?(name)
super
elsif self.class.prop?(name.to_s)
| ruby | {
"resource": ""
} |
q23295 | Humidifier.Resource.update | train | def update(properties, raw = false)
properties.each do |property, value|
| ruby | {
"resource": ""
} |
q23296 | Humidifier.Resource.update_property | train | def update_property(property, value, raw = false)
property = property.to_s
property = validate_property(property, raw)
| ruby | {
"resource": ""
} |
q23297 | Panda.Scope.find_by_path | train | def find_by_path(url, map={})
object = find_object_by_path(url, map)
if object.is_a?(Array)
object.map{|o| klass.new(o.merge('cloud_id' => cloud.id))}
elsif object['id']
| ruby | {
"resource": ""
} |
q23298 | Impala.Connection.open | train | def open
return if @connected
socket = Thrift::Socket.new(@host, @port, @options[:timeout])
if @options[:kerberos]
@transport = SASLTransport.new(socket, :GSSAPI, @options[:kerberos])
elsif @options[:sasl]
@transport = SASLTransport.new(socket, :PLAIN, @options[:sasl])
el... | ruby | {
"resource": ""
} |
q23299 | Impala.Connection.execute | train | def execute(query, query_options = {})
raise ConnectionError.new("Connection closed") unless | 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.