_id stringlengths 2 6 | title stringlengths 9 130 | partition stringclasses 3
values | text stringlengths 30 4.3k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q7100 | Jinx.Inverse.detect_inverse_attribute | train | def detect_inverse_attribute(klass)
# The candidate attributes return the referencing type and don't already have an inverse.
candidates = domain_attributes.compose { |prop| klass <= prop.type and prop.inverse.nil? | ruby | {
"resource": ""
} |
q7101 | Jinx.Inverse.delegate_writer_to_inverse | train | def delegate_writer_to_inverse(attribute, inverse)
prop = property(attribute)
# nothing to do if no inverse
inv_prop = prop.inverse_property || return
logger.debug { "Delegating #{qp}.#{attribute} update to the inverse #{prop.type.qp}.#{inv_prop}..." }
# redefine the write to set | ruby | {
"resource": ""
} |
q7102 | Jinx.Inverse.restrict_attribute_inverse | train | def restrict_attribute_inverse(prop, inverse)
logger.debug { "Restricting #{prop.declarer.qp}.#{prop} to #{qp} with inverse #{inverse}..." }
rst_prop = prop.restrict(self, :inverse => inverse)
| ruby | {
"resource": ""
} |
q7103 | Jinx.Inverse.add_inverse_updater | train | def add_inverse_updater(attribute)
prop = property(attribute)
# the reader and writer methods
rdr, wtr = prop.accessors
# the inverse attribute metadata
inv_prop = prop.inverse_property
# the inverse attribute reader and writer
inv_rdr, inv_wtr = inv_accessors = inv_prop.access... | ruby | {
"resource": ""
} |
q7104 | Epicmix.Client.login | train | def login
url = 'https://www.epicmix.com/vailresorts/sites/epicmix/api/mobile/authenticate.ashx'
options = { :query => { :loginID => username, :password => password }}
response = | ruby | {
"resource": ""
} |
q7105 | Epicmix.Client.season_stats | train | def season_stats
url = 'https://www.epicmix.com/vailresorts/sites/epicmix/api/mobile/userstats.ashx'
options = { :timetype => 'season', :token => token }
response = HTTParty.get(url, | ruby | {
"resource": ""
} |
q7106 | Mousevc.Validation.min_length? | train | def min_length?(value, length)
has_min_length = coerce_bool (value.length >= length)
unless has_min_length
@error = "Error, expected | ruby | {
"resource": ""
} |
q7107 | Mousevc.Validation.max_length? | train | def max_length?(value, length)
has_max_length = coerce_bool (value.length <= length)
unless has_max_length
@error = "Error, expected | ruby | {
"resource": ""
} |
q7108 | Mousevc.Validation.exact_length? | train | def exact_length?(value, length)
has_exact_length = coerce_bool (value.length == length)
unless has_exact_length
@error = "Error, expected | ruby | {
"resource": ""
} |
q7109 | BetaInvite.BetaInvitesController.create | train | def create
email = params[:beta_invite][:email]
beta_invite = BetaInvite.new( email: email, token: SecureRandom.hex(10) )
if beta_invite.save
flash[:success] = "#{email} has been registered for beta invite"
# send an email if configured
if BetaInviteSetup.send_email_to_admins... | ruby | {
"resource": ""
} |
q7110 | Spockets.Watcher.stop | train | def stop
if(@runner.nil? && @stop)
raise NotRunning.new
elsif(@runner.nil? || !@runner.alive?)
@stop = true
@runner = nil
else
@stop = true
if(@runner)
@runner.raise Resync.new if @runner.alive? && @runner.stop?
| ruby | {
"resource": ""
} |
q7111 | Spockets.Watcher.watch | train | def watch
until(@stop)
begin
resultset = Kernel.select(@sockets.keys, nil, nil, nil)
for sock in resultset[0]
string = sock.gets
if(sock.closed? || string.nil?)
if(@sockets[sock][:closed])
@sockets[sock][:closed].each do |pr|
... | ruby | {
"resource": ""
} |
q7112 | Hoodie.FileHelper.command_in_path? | train | def command_in_path?(command)
found = ENV['PATH'].split(File::PATH_SEPARATOR).map do |p|
| ruby | {
"resource": ""
} |
q7113 | Ducktrap.PrettyDump.pretty_inspect | train | def pretty_inspect
io = StringIO.new
formatter | ruby | {
"resource": ""
} |
q7114 | Fixer.Response.method_missing | train | def method_missing(method_name, *args, &block)
if self.has_key?(method_name.to_s)
self.[](method_name, &block)
elsif self.body.respond_to?(method_name)
self.body.send(method_name, *args, &block)
elsif | ruby | {
"resource": ""
} |
q7115 | SK::SDK.Sync.update | train | def update(side, flds=nil)
raise ArgumentError, 'The side to update must be :l or :r' unless [:l, :r].include?(side)
target, source = (side==:l) ? [:l, :r] : [:r, :l]
# use set field/s or update all
flds ||= fields
target_obj = self.send("#{target}_obj")
source_obj = self.send("#{sou... | ruby | {
"resource": ""
} |
q7116 | Pith.Input.ignorable? | train | def ignorable?
@ignorable ||= path.each_filename do |path_component|
project.config.ignore_patterns.each do | ruby | {
"resource": ""
} |
q7117 | Pith.Input.render | train | def render(context, locals = {}, &block)
return file.read if !template?
ensure_loaded
pipeline.inject(@template_text) do |text, processor|
| ruby | {
"resource": ""
} |
q7118 | Pith.Input.load | train | def load
@load_time = Time.now
@meta = {}
if template?
logger.debug "loading #{path}"
| ruby | {
"resource": ""
} |
q7119 | Utf8Sanitizer.UTF.process_hash_row | train | def process_hash_row(hsh)
if @headers.any?
keys_or_values = hsh.values
@row_id = hsh[:row_id]
else
keys_or_values = hsh.keys.map(&:to_s)
end
file_line = | ruby | {
"resource": ""
} |
q7120 | Utf8Sanitizer.UTF.line_parse | train | def line_parse(validated_line)
return unless validated_line
row = validated_line.split(',')
return unless row.any?
if @headers.empty?
@headers = row
else
| ruby | {
"resource": ""
} |
q7121 | Shells.ShellBase.wait_for_prompt | train | def wait_for_prompt(silence_timeout = nil, command_timeout = nil, timeout_error = true) #:doc:
raise Shells::NotRunning unless running?
silence_timeout ||= options[:silence_timeout]
command_timeout ||= options[:command_timeout]
# when did we send a NL and how many have we sent while wait... | ruby | {
"resource": ""
} |
q7122 | Shells.ShellBase.temporary_prompt | train | def temporary_prompt(prompt) #:doc:
raise Shells::NotRunning unless running?
old_prompt = prompt_match
begin
self.prompt_match = prompt
| ruby | {
"resource": ""
} |
q7123 | Rails::Generator::Commands.Base.next_migration_string | train | def next_migration_string(padding = 3)
@s = (!@s.nil?)? @s.to_i + 1 : if ActiveRecord::Base.timestamped_migrations
| ruby | {
"resource": ""
} |
q7124 | Rozi.Shared.interpret_color | train | def interpret_color(color)
if color.is_a? String
# Turns RRGGBB into BBGGRR for hex | ruby | {
"resource": ""
} |
q7125 | Mousevc.App.listen | train | def listen
begin
clear_view
@router.route unless Input.quit?
reset if | ruby | {
"resource": ""
} |
q7126 | Jinx.MultilineLogger.format_message | train | def format_message(severity, datetime, progname, msg)
if String === msg then
msg.inject('') { |s, line| s | ruby | {
"resource": ""
} |
q7127 | UserInput.TypeSafeHash.each_pair | train | def each_pair(type, default = nil)
real_hash.each_key() { |key|
value = fetch(key, type, default) | ruby | {
"resource": ""
} |
q7128 | UserInput.TypeSafeHash.each_match | train | def each_match(regex, type, default = nil)
real_hash.each_key() { |key|
if (matchinfo = regex.match(key))
value = fetch(key, type, default)
if | ruby | {
"resource": ""
} |
q7129 | ScopedSerializer.Serializer.attributes_hash | train | def attributes_hash
attributes = @scope.attributes.collect do |attr|
value = fetch_property(attr)
if value.kind_of?(BigDecimal)
| ruby | {
"resource": ""
} |
q7130 | ScopedSerializer.Serializer.associations_hash | train | def associations_hash
hash = {}
@scope.associations.each do |association, options|
| ruby | {
"resource": ""
} |
q7131 | ScopedSerializer.Serializer.render_association | train | def render_association(association_data, options={})
hash = {}
if association_data.is_a?(Hash)
association_data.each do |association, association_options|
data = render_association(association, options.merge(:include => association_options))
hash.merge!(data) if data
end... | ruby | {
"resource": ""
} |
q7132 | ScopedSerializer.Serializer.fetch_property | train | def fetch_property(property)
return nil unless property
unless respond_to?(property)
object | ruby | {
"resource": ""
} |
q7133 | ScopedSerializer.Serializer.fetch_association | train | def fetch_association(name, includes=nil)
association = fetch_property(name)
if includes.present? && ! @resource.association(name).loaded?
| ruby | {
"resource": ""
} |
q7134 | Remi.Job.execute | train | def execute(*components)
execute_transforms if components.empty? || components.include?(:transforms)
execute_sub_jobs if components.empty? || components.include?(:sub_jobs)
| ruby | {
"resource": ""
} |
q7135 | KeytechKit.User.load | train | def load(username)
options = {}
options[:basic_auth] = @auth
response = self.class.get("/user/#{username}", options)
if response.success?
self.response | ruby | {
"resource": ""
} |
q7136 | Jinx.Dependency.add_dependent_property | train | def add_dependent_property(property, *flags)
logger.debug { "Marking #{qp}.#{property} as a dependent attribute of type #{property.type.qp}..." }
flags << :dependent unless flags.include?(:dependent)
property.qualify(*flags)
inv = property.inverse
inv_type = property.type
# example: ... | ruby | {
"resource": ""
} |
q7137 | Jinx.Dependency.add_owner | train | def add_owner(klass, inverse, attribute=nil)
if inverse.nil? then
raise ValidationError.new("Owner #{klass.qp} missing dependent attribute for dependent #{qp}")
end
logger.debug { "Adding #{qp} owner #{klass.qp}#{' attribute ' + attribute.to_s if attribute} with inverse #{inverse}..." }
... | ruby | {
"resource": ""
} |
q7138 | Jinx.Dependency.add_owner_attribute | train | def add_owner_attribute(attribute)
prop = property(attribute)
otype = prop.type
hash = local_owner_property_hash
if hash.include?(otype) then
oa = hash[otype]
| ruby | {
"resource": ""
} |
q7139 | NRSER.AbstractMethodError.method_instance | train | def method_instance
lazy_var :@method_instance do
# Just drop a warning if we can't get the method object
logger.catch.warn(
"Failed to get method",
| ruby | {
"resource": ""
} |
q7140 | GHULS.Lib.get_user_and_check | train | def get_user_and_check(user)
user_full = @octokit.user(user)
{
username: user_full[:login],
| ruby | {
"resource": ""
} |
q7141 | GHULS.Lib.get_forks_stars_watchers | train | def get_forks_stars_watchers(repository)
{
forks: @octokit.forks(repository).length,
| ruby | {
"resource": ""
} |
q7142 | GHULS.Lib.get_followers_following | train | def get_followers_following(username)
{
following: @octokit.following(username).length,
followers: | ruby | {
"resource": ""
} |
q7143 | GHULS.Lib.get_user_langs | train | def get_user_langs(username)
repos = get_user_repos(username)
langs = {}
repos[:public].each do |r|
next if repos[:forks].include? r
repo_langs = @octokit.languages(r)
repo_langs.each do |l, b|
if langs[l].nil? | ruby | {
"resource": ""
} |
q7144 | GHULS.Lib.get_org_langs | train | def get_org_langs(username)
org_repos = get_org_repos(username)
langs = {}
org_repos[:public].each do |r|
next if org_repos[:forks].include? r
repo_langs = @octokit.languages(r)
repo_langs.each do |l, b|
if langs[l].nil? | ruby | {
"resource": ""
} |
q7145 | GHULS.Lib.get_color_for_language | train | def get_color_for_language(lang)
color_lang = @colors[lang]
color = color_lang['color']
if color_lang.nil? || color.nil?
| ruby | {
"resource": ""
} |
q7146 | GHULS.Lib.get_language_percentages | train | def get_language_percentages(langs)
total = 0
langs.each { |_, b| total += b }
lang_percents = {}
langs.each do |l, b|
| ruby | {
"resource": ""
} |
q7147 | YumRepo.Repomd.filelists | train | def filelists
fl = []
@repomd.xpath("/xmlns:repomd/xmlns:data[@type=\"filelists\"]/xmlns:location").each do |f|
| ruby | {
"resource": ""
} |
q7148 | Xpay.Payment.rewrite_request_block | train | def rewrite_request_block(auth_type="ST3DAUTH")
# set the required AUTH type
REXML::XPath.first(@request_xml, "//Request").attributes["Type"] = auth_type
# delete term url and merchant name
ops = REXML::XPath.first(@request_xml, "//Operation")
["TermUrl", "MerchantName"].each { |e| ops.d... | ruby | {
"resource": ""
} |
q7149 | Skeletor.CLI.clean | train | def clean
print 'Are you sure you want to clean this project directory? (Y|n): '
confirm = $stdin.gets.chomp
if confirm != | ruby | {
"resource": ""
} |
q7150 | Layabout.FileUpload.wrap | train | def wrap(http_response)
OpenStruct.new.tap do |obj|
obj.code = http_response.code.to_i
obj.body = http_response.body
| ruby | {
"resource": ""
} |
q7151 | Montage.OrderParser.clause_valid? | train | def clause_valid?
if @clause.is_a?(Hash)
@clause.flatten.find do |e|
return true unless (/\basc\b|\bdesc\b/).match(e).nil?
end
| ruby | {
"resource": ""
} |
q7152 | Montage.OrderParser.parse_hash | train | def parse_hash
direction = clause.values.first
field = clause.keys.first.to_s
| ruby | {
"resource": ""
} |
q7153 | Montage.OrderParser.parse_string | train | def parse_string
direction = clause.split[1]
field = clause.split[0]
direction = "asc" | ruby | {
"resource": ""
} |
q7154 | ZendeskTools.CleanSuspended.run | train | def run
@client.suspended_tickets.each do |suspended_ticket|
if should_delete?(suspended_ticket)
log.info "Deleting: #{suspended_ticket.subject}"
suspended_ticket.destroy
| ruby | {
"resource": ""
} |
q7155 | SimpleCLI.Command.summary | train | def summary
if @summary.nil?
match = Command::SummaryMatcher.match documentation
| ruby | {
"resource": ""
} |
q7156 | HueBridge.LightBulb.set_color | train | def set_color(opts = {})
color = Color.new(opts)
response = put('state', color.to_h)
| ruby | {
"resource": ""
} |
q7157 | HueBridge.LightBulb.store_state | train | def store_state
response = get
success = !!(response.body =~ %r(state))
| ruby | {
"resource": ""
} |
q7158 | CruLib.Async.perform | train | def perform(id, method, *args)
if id
begin
self.class.find(id).send(method, *args)
rescue ActiveRecord::RecordNotFound
# If the record was deleted after the | ruby | {
"resource": ""
} |
q7159 | Gitolite.Utils.is_subset? | train | def is_subset?(array1, array2)
result = array1 & array2
| ruby | {
"resource": ""
} |
q7160 | Gitolite.Utils.gitolite_friendly | train | def gitolite_friendly(permission)
if permission.empty?
return nil
elsif permission.match(/^RWDP?/)
| ruby | {
"resource": ""
} |
q7161 | Bebox.EnvironmentWizard.create_new_environment | train | def create_new_environment(project_root, environment_name)
# Check if the environment exist
return error(_('wizard.environment.name_exist')%{environment: environment_name}) if Bebox::Environment.environment_exists?(project_root, environment_name)
# Environment creation
environment = | ruby | {
"resource": ""
} |
q7162 | Bebox.EnvironmentWizard.remove_environment | train | def remove_environment(project_root, environment_name)
# Check if the environment exist
return error(_('wizard.environment.name_not_exist')%{environment: environment_name}) unless Bebox::Environment.environment_exists?(project_root, environment_name)
| ruby | {
"resource": ""
} |
q7163 | Asset.Item.write_cache | train | def write_cache
compressed.tap{|c| | ruby | {
"resource": ""
} |
q7164 | Asset.Item.compressed | train | def compressed
@compressed ||= case @type
when 'css'
Sass::Engine.new(joined, :syntax => :scss, :cache => false, :style => :compressed).render rescue joined
when 'js'
| ruby | {
"resource": ""
} |
q7165 | Asset.Item.joined | train | def joined
@joined ||= files.map{|f| | ruby | {
"resource": ""
} |
q7166 | Zomato2.Zomato.locations | train | def locations(params={})
args = [ :query, :lat, :lon, :count ]
params.each do |k,v|
if !args.include?(k)
raise ArgumentError.new 'Search term not allowed: ' + k.to_s
end
end
if !params.include?(:query)
raise ArgumentError.new '"query" term with location name is... | ruby | {
"resource": ""
} |
q7167 | Zomato2.Zomato.restaurants | train | def restaurants(params={})
args = [ :entity_id, :entity_type, # location
:q, :start, :count, :lat, :lon,
:radius, :cuisines, :establishment_type,
:collection_id, :category, :sort, :order,
:start, :count ]
params.each do |k,v|
if !args.incl... | ruby | {
"resource": ""
} |
q7168 | Resumator.Client.get | train | def get(object, options = {})
if options[:all_pages]
options.delete(:all_pages)
options[:page] = 1
out = []
begin
data = get(object, options)
out = out | data
options[:page] += 1
end while data.count >= 100
| ruby | {
"resource": ""
} |
q7169 | IRCSupport.Masks.matches_mask_array | train | def matches_mask_array(masks, strings, casemapping = :rfc1459)
results = {}
masks.each do |mask|
strings.each do |string|
| ruby | {
"resource": ""
} |
q7170 | ScopedSerializer.Scope.merge! | train | def merge!(scope)
@options.merge!(scope.options)
@attributes += | ruby | {
"resource": ""
} |
q7171 | ScopedSerializer.Scope._association | train | def _association(args, default_options={})
return if options.nil?
options = args.first
if options.is_a?(Hash)
options = {}.merge(options)
name = options.keys.first
| ruby | {
"resource": ""
} |
q7172 | Pocus.Resource.get | train | def get(request_path, klass)
response = session.send_request('GET', path + request_path)
data = response.fetch(klass.tag)
| ruby | {
"resource": ""
} |
q7173 | Pocus.Resource.reload | train | def reload
response = session.send_request('GET', path)
| ruby | {
"resource": ""
} |
q7174 | MMETools.Enumerable.compose | train | def compose(*enumerables)
res=[]
enumerables.map(&:size).max.times do
tupla=[]
for enumerable in enumerables
tupla << enumerable.shift
| ruby | {
"resource": ""
} |
q7175 | SpiderCore.FieldDSL.field | train | def field(display, pattern, opts = {}, &block)
actions << lambda {
| ruby | {
"resource": ""
} |
q7176 | Encruby.Message.encrypt | train | def encrypt(message)
raise Error, "data must not be empty" if message.to_s.strip.empty?
# 1
@cipher.reset
@cipher.encrypt
aes_key = @cipher.random_key
aes_iv = @cipher.random_iv
encrypted = @cipher.update(message) + @cipher.final
# 2
rsa_encrypted_aes_key = @r... | ruby | {
"resource": ""
} |
q7177 | Encruby.Message.decrypt | train | def decrypt(message, hash: nil)
# 0
message = Base64.decode64(message)
hmac = message[0..63] # 64 bits of hmac signature
case
when hash && hmac != hash
raise Error, "Provided hash mismatch for encrypted file!"
when hmac != hmac_signature(message[64..-1])
raise Error,... | ruby | {
"resource": ""
} |
q7178 | RefBiblio.Referencia.titulo | train | def titulo (titulo)
tit = titulo.split(' ')
tit.each do |word|
if word.length > 3
word.capitalize!
else
word.downcase!
end
if word == tit[0]
word.capitalize!
end
@titulo = tit.join(' ')
end
# Metodo para guardar el editorial de la referencia
# @param [editorial] editorial E... | ruby | {
"resource": ""
} |
q7179 | RefBiblio.ArtPeriodico.to_s | train | def to_s
string = ""
string << @autor << " (" << Date::MONTHNAMES[get_publicacion.month] << " " << get_publicacion.day.to_s << ", " << get_publicacion.year.to_s << "). " << | ruby | {
"resource": ""
} |
q7180 | RefBiblio.DocElectronico.to_s | train | def to_s
string = ""
string << @autor << " (" << Date::MONTHNAMES[get_publicacion.month] << " " << get_publicacion.day.to_s << ", " << get_publicacion.year.to_s << "). " << @titulo << @formato << ". " << @editorial << ": " << @edicion << | ruby | {
"resource": ""
} |
q7181 | Evvnt.PathHelpers.nest_path_within_parent | train | def nest_path_within_parent(path, params)
return path unless params_include_parent_resource_id?(params)
params.symbolize_keys!
parent_resource = parent_resource_name(params)
parent_id | ruby | {
"resource": ""
} |
q7182 | DynamicRegistrar.Registrar.dispatch | train | def dispatch name, namespace = nil
responses = Hash.new
namespaces_to_search = namespace ? [namespace] : namespaces
namespaces_to_search.each do |namespace|
responses[namespace] ||= Hash.new
| ruby | {
"resource": ""
} |
q7183 | DynamicRegistrar.Registrar.registered? | train | def registered? name
registration_map = namespaces.map do |namespace|
registered_in_namespace? | ruby | {
"resource": ""
} |
q7184 | EasyTag.MP3AttributeAccessors.read_all_tags | train | def read_all_tags(taglib, id3v2_frames, id3v1_tag = nil, **opts)
frames = []
id3v2_frames.each { |frame_id| frames += id3v2_frames(taglib, frame_id) }
data = []
# only check id3v1 if no id3v2 frames found
if frames.empty?
data << id3v1_tag(taglib, id3v1_tag) | ruby | {
"resource": ""
} |
q7185 | RComp.Runner.run | train | def run(suite, type, options={})
@conf = Conf.instance
reporter = Reporter.new(type)
reporter.header
suite.each do |test|
case type
when :test
run_test(test) if expected_exists?(test)
when :generate
if expected_exists?(test)
| ruby | {
"resource": ""
} |
q7186 | RComp.Runner.cmp_output | train | def cmp_output(test)
# test out and err
if test.expected_out_exists? && test.expected_err_exists?
cmp_out(test)
cmp_err(test)
return :success if (test.out_result && test.err_result)
# test only out
elsif test.expected_out_exists?
cmp_out(test)
| ruby | {
"resource": ""
} |
q7187 | RComp.Runner.cmp_out | train | def cmp_out(test)
test.out_result = FileUtils.cmp(test.expected_out_path,
| ruby | {
"resource": ""
} |
q7188 | RComp.Runner.cmp_err | train | def cmp_err(test)
test.err_result = FileUtils.cmp(test.expected_err_path,
| ruby | {
"resource": ""
} |
q7189 | ScopedSerializer.BaseSerializer.default_root_key | train | def default_root_key(object_class)
if (serializer = ScopedSerializer.find_serializer_by_class(object_class))
root_key = serializer.find_scope(:default).options[:root]
| ruby | {
"resource": ""
} |
q7190 | Garcon.TimerSet.post | train | def post(delay, *args, &task)
raise ArgumentError, 'no block given' unless block_given?
delay = TimerSet.calculate_delay!(delay)
mutex.synchronize do
return false unless running?
if (delay) <= 0.01
@task_executor.post(*args, &task)
else
| ruby | {
"resource": ""
} |
q7191 | Garcon.TimerSet.process_tasks | train | def process_tasks
loop do
task = mutex.synchronize { @queue.peek }
break unless task
now = Garcon.monotonic_time
diff = task.time - now
if diff <= 0
# We need to remove the task from the queue before passing it to the
# executor, to avoid race conditio... | ruby | {
"resource": ""
} |
q7192 | Roroacms.Admin::AdministratorsController.create | train | def create
@admin = Admin.new(administrator_params)
respond_to do |format|
if @admin.save
profile_images(params, @admin)
Emailer.profile(@admin).deliver
format.html { redirect_to admin_administrators_path, notice: I18n.t("controllers.admin.administrators.create.flash... | ruby | {
"resource": ""
} |
q7193 | Roroacms.Admin::AdministratorsController.edit | train | def edit
@admin = current_admin.id == params[:id].to_i ? @current_admin : Admin.find(params[:id])
# add breadcrumb and set title
set_title(I18n.t("controllers.admin.administrators.edit.title", username: @admin.username))
add_breadcrumb I18n.t("controllers.admin.administrators.edit.breadcrumb")
... | ruby | {
"resource": ""
} |
q7194 | Roroacms.Admin::AdministratorsController.update | train | def update
@admin = Admin.find(params[:id])
@admin.deal_with_cover params
respond_to do |format|
admin_passed =
if params[:admin][:password].blank?
@admin.update_without_password(administrator_params)
else
@admin.update_attributes(administrator... | ruby | {
"resource": ""
} |
q7195 | Roroacms.Admin::AdministratorsController.destroy | train | def destroy
@admin = Admin.find(params[:id])
@admin.destroy if @admin.overlord == 'N'
respond_to do | ruby | {
"resource": ""
} |
q7196 | Shells.PfShellWrapper.exec | train | def exec(*commands)
ret = ''
commands.each | ruby | {
"resource": ""
} |
q7197 | Shells.PfShellWrapper.set_config_section | train | def set_config_section(section_name, values, message = '')
current_values = get_config_section(section_name)
changes = generate_config_changes("$config[#{section_name.to_s.inspect}]", current_values, values)
if changes&.any?
if message.to_s.strip == ''
message = "Updating #{sect... | ruby | {
"resource": ""
} |
q7198 | Shells.PfShellWrapper.enable_cert_auth | train | def enable_cert_auth(public_key = '~/.ssh/id_rsa.pub')
cert_regex = /^ssh-[rd]sa (?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)? \S*$/m
# get our cert unless the user provided a full cert for us.
unless public_key =~ cert_regex
public_key = File.expand_path(public_key)
... | ruby | {
"resource": ""
} |
q7199 | BarkestCore.HtmlHelper.glyph | train | def glyph(name, size = nil)
size = size.to_s.downcase
if %w(small smaller big bigger).include?(size)
size = ' glyph-' + size
else
size = ''
| 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.