_id stringlengths 2 6 | title stringlengths 9 130 | partition stringclasses 3
values | text stringlengths 30 4.3k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q24100 | Phys.Unit.inverse | train | def inverse
check_operable
dims = dimension_uop{|a| | ruby | {
"resource": ""
} |
q24101 | Phys.Unit.** | train | def **(x)
check_operable
m = Utils.as_numeric(x)
dims = dimension_uop{|a| | ruby | {
"resource": ""
} |
q24102 | Openfoodfacts.Country.products | train | def products(page: -1)
Product.from_website_page(url, page: page, | ruby | {
"resource": ""
} |
q24103 | Jackpot.Notifier.send_receipt | train | def send_receipt(payment)
@payment = payment
@payment_url = public_receipt_payment_url(:payment_id => @payment.id,
:public_token => @payment.public_token)
| ruby | {
"resource": ""
} |
q24104 | Plaintext.Resolver.text | train | def text
if handler = find_handler and
text = handler.text(@file, max_size: max_plaintext_bytes)
text.gsub!(/\s+/m, ' ')
| ruby | {
"resource": ""
} |
q24105 | Kondate.RoleFile.explore | train | def explore
paths = if Config.explore_role_files?
possible_paths
else
[get_path]
| ruby | {
"resource": ""
} |
q24106 | Djatoka.ViewHelpers.djatoka_init_openlayers | train | def djatoka_init_openlayers(rft_id, div_identifier, params={})
resolver = determine_resolver(params)
metadata_url = resolver.metadata_url(rft_id)
%Q|<script type="text/javascript">
| ruby | {
"resource": ""
} |
q24107 | I18nRouting.Mapper.localized_resources | train | def localized_resources(type = :resources, *resources, &block)
localizable_route = nil
if @locales
res = resources.clone
options = res.extract_options!
r = res.first
resource = resource_from_params(type, r, options.dup)
# Check for translated resource
stor... | ruby | {
"resource": ""
} |
q24108 | I18nRouting.RackMountRoute.initialize_with_i18n_routing | train | def initialize_with_i18n_routing(app, conditions, defaults, name)
@locale = if conditions.key?(:i18n_locale)
c = conditions.delete(:i18n_locale)
# In rails 3.0 it's a regexp otherwise it's a string, so we need to call source on the regexp | ruby | {
"resource": ""
} |
q24109 | I18nRouting.RackMountRoute.generate_with_i18n_routing | train | def generate_with_i18n_routing(method, params = {}, recall = {}, options = {})
return nil if @locale and @locale != I18n.locale.to_sym
| ruby | {
"resource": ""
} |
q24110 | Wavefront.MaintenanceWindow.pending | train | def pending(hours = 24)
cutoff = Time.now.to_i + hours * 3600
windows_in_state(:pending).tap do |r|
| ruby | {
"resource": ""
} |
q24111 | BoxGrinder.S3Plugin.constraint_equal? | train | def constraint_equal?(region, constraint)
[region, constraint].collect{ |v| v.nil? || | ruby | {
"resource": ""
} |
q24112 | RbGCCXML.Type.check_sub_type_without | train | def check_sub_type_without(val, delim)
return false unless val =~ delim
| ruby | {
"resource": ""
} |
q24113 | CucumberAnalytics.Feature.to_s | train | def to_s
text = ''
text << tag_output_string + "\n" unless tags.empty?
text << "Feature:#{name_output_string}"
text << | ruby | {
"resource": ""
} |
q24114 | BoxGrinder.OpenStackPlugin.get_images | train | def get_images(params = {})
@log.trace "Listing images with params = #{params.to_json}..."
data = JSON.parse(RestClient.get("#{url}/v1/images", | ruby | {
"resource": ""
} |
q24115 | Wavefront.Alert.versions | train | def versions(id)
wf_alert_id?(id)
resp = api.get([id, 'history'].uri_concat)
versions = | ruby | {
"resource": ""
} |
q24116 | I18nRailsHelpers.ModelHelpers.define_enum_t_methods | train | def define_enum_t_methods
defined_enums.each do |enum_attr, values|
self.class.send(:define_method, "#{enum_attr}_t") { t_enum(enum_attr) }
| ruby | {
"resource": ""
} |
q24117 | Wavefront.Mixins.parse_time | train | def parse_time(time, in_ms = false)
return relative_time(time, in_ms) if time =~ /^[\-+]/
| ruby | {
"resource": ""
} |
q24118 | Wavefront.Mixins.relative_time | train | def relative_time(time, in_ms = false, ref = Time.now)
ref = in_ms | ruby | {
"resource": ""
} |
q24119 | Wavefront.Mixins.time_multiplier | train | def time_multiplier(suffix)
u = { s: 1, m: 60, h: 3600, d: 86_400, w: 604_800, y: 31_536_000 }
| ruby | {
"resource": ""
} |
q24120 | Echochamber.Client.create_agreement | train | def create_agreement(agreement)
agreement_response = Echochamber::Request.create_agreement(agreement, token, agreement.user_id, | ruby | {
"resource": ""
} |
q24121 | Echochamber.Client.agreement_documents | train | def agreement_documents(agreement_id, recipient_email, format, version_id=nil)
| ruby | {
"resource": ""
} |
q24122 | Echochamber.Client.agreement_document_file | train | def agreement_document_file(agreement_id, document_id, file_path=nil)
response = Echochamber::Request.agreement_document_file(token, agreement_id, document_id)
unless file_path.nil?
file = | ruby | {
"resource": ""
} |
q24123 | Echochamber.Client.agreement_combined_pdf | train | def agreement_combined_pdf(agreement_id, file_path=nil, versionId=nil, participantEmail=nil, attachSupportingDocuments=true, auditReport=false)
response = Echochamber::Request.agreement_combined_pdf(token, agreement_id, versionId, participantEmail, attachSupportingDocuments, auditReport)
| ruby | {
"resource": ""
} |
q24124 | Wavefront.Validators.wf_link_template? | train | def wf_link_template?(template)
if template.is_a?(String) &&
template.start_with?('http://', 'https://') | ruby | {
"resource": ""
} |
q24125 | Wavefront.Validators.wf_name? | train | def wf_name?(name)
return true if name.is_a?(String) && name.size < 1024 && name =~ /^\w+$/
| ruby | {
"resource": ""
} |
q24126 | Wavefront.Validators.wf_string? | train | def wf_string?(str)
#
# Only allows PCRE "word" characters, spaces, full-stops and
# commas in tags and descriptions. This might be too restrictive,
# but if it is, this is the only place we need to change it.
#
if str.is_a?(String) | ruby | {
"resource": ""
} |
q24127 | Wavefront.Validators.wf_ts? | train | def wf_ts?(timestamp)
return true if timestamp.is_a?(Time) || timestamp.is_a?(Date)
raise | ruby | {
"resource": ""
} |
q24128 | Wavefront.Validators.wf_epoch? | train | def wf_epoch?(timestamp)
return true if timestamp.is_a?(Numeric) | ruby | {
"resource": ""
} |
q24129 | Wavefront.Validators.wf_value? | train | def wf_value?(value)
return true if value.is_a?(Numeric) | ruby | {
"resource": ""
} |
q24130 | Wavefront.Validators.wf_version? | train | def wf_version?(version)
version = version.to_i if version.is_a?(String) && version =~ /^\d+$/
return | ruby | {
"resource": ""
} |
q24131 | Wavefront.Validators.wf_alert_id? | train | def wf_alert_id?(id)
id = id.to_s if id.is_a?(Numeric)
return | ruby | {
"resource": ""
} |
q24132 | Wavefront.Validators.wf_dashboard_id? | train | def wf_dashboard_id?(id)
return true if id.is_a?(String) && id.size < 256 && id.match(/^[\w\-]+$/)
| ruby | {
"resource": ""
} |
q24133 | Wavefront.Validators.wf_derivedmetric_id? | train | def wf_derivedmetric_id?(id)
id = id.to_s if id.is_a?(Numeric)
return true if id.is_a?(String) && id =~ /^\d{13}$/
| ruby | {
"resource": ""
} |
q24134 | Wavefront.Validators.wf_link_id? | train | def wf_link_id?(id)
return true if id.is_a?(String) && id =~ /^\w{16}$/
| ruby | {
"resource": ""
} |
q24135 | Wavefront.Validators.wf_maintenance_window_id? | train | def wf_maintenance_window_id?(id)
id = id.to_s if id.is_a?(Numeric)
return true if id.is_a?(String) && id =~ /^\d{13}$/
| ruby | {
"resource": ""
} |
q24136 | Wavefront.Validators.wf_alert_severity? | train | def wf_alert_severity?(severity)
return true if %w[INFO SMOKE WARN SEVERE].include?(severity)
raise | ruby | {
"resource": ""
} |
q24137 | Wavefront.Validators.wf_message_id? | train | def wf_message_id?(id)
return true if id.is_a?(String) && id =~ /^\w+::\w+$/
| ruby | {
"resource": ""
} |
q24138 | Wavefront.Validators.wf_granularity? | train | def wf_granularity?(granularity)
return true if %w[d h m | ruby | {
"resource": ""
} |
q24139 | Wavefront.Validators.wf_savedsearch_id? | train | def wf_savedsearch_id?(id)
return true if id.is_a?(String) && id =~ /^\w{8}$/
| ruby | {
"resource": ""
} |
q24140 | Wavefront.Validators.wf_savedsearch_entity? | train | def wf_savedsearch_entity?(id)
return true if %w[DASHBOARD ALERT MAINTENANCE_WINDOW
NOTIFICANT EVENT SOURCE EXTERNAL_LINK AGENT
| ruby | {
"resource": ""
} |
q24141 | Wavefront.Validators.wf_source_id? | train | def wf_source_id?(source)
if source.is_a?(String) && source.match(/^[\w\.\-]+$/) &&
source.size < 1024
| ruby | {
"resource": ""
} |
q24142 | Wavefront.Validators.wf_user_id? | train | def wf_user_id?(user)
return true if user.is_a?(String) && user.length < 256 && !user.empty?
| ruby | {
"resource": ""
} |
q24143 | Wavefront.Validators.wf_webhook_id? | train | def wf_webhook_id?(id)
return true if id.is_a?(String) && id =~ /^[a-zA-Z0-9]{16}$/
| ruby | {
"resource": ""
} |
q24144 | Wavefront.Validators.wf_distribution? | train | def wf_distribution?(dist)
wf_metric_name?(dist[:path])
wf_distribution_values?(dist[:value])
| ruby | {
"resource": ""
} |
q24145 | Wavefront.Validators.wf_distribution_values? | train | def wf_distribution_values?(vals)
vals.each do |times, val|
wf_distribution_count?(times) | ruby | {
"resource": ""
} |
q24146 | Wavefront.Validators.wf_notificant_id? | train | def wf_notificant_id?(id)
return true if id.is_a?(String) && id =~ /^\w{16}$/
| ruby | {
"resource": ""
} |
q24147 | Wavefront.Validators.wf_integration_id? | train | def wf_integration_id?(id)
return true if id.is_a?(String) && id =~ /^[a-z0-9]+$/
| ruby | {
"resource": ""
} |
q24148 | Wavefront.Validators.wf_distribution_interval? | train | def wf_distribution_interval?(interval)
return true if %i[m h d].include?(interval)
raise | ruby | {
"resource": ""
} |
q24149 | Wavefront.Validators.wf_distribution_count? | train | def wf_distribution_count?(count)
return true if count.is_a?(Integer) && count.positive?
raise | ruby | {
"resource": ""
} |
q24150 | Wavefront.Query.response_shim | train | def response_shim(body, status)
resp, err_msg = parsed_response(body)
{ response: resp,
status: { result: status == 200 ? 'OK' : 'ERROR',
| ruby | {
"resource": ""
} |
q24151 | Wavefront.Query.parsed_response | train | def parsed_response(body)
[JSON.parse(body), '']
rescue | ruby | {
"resource": ""
} |
q24152 | Wavefront.Credentials.populate | train | def populate(raw)
@config = Map(raw)
@creds = Map(raw.select { |k, _v| %i[endpoint token].include?(k) })
@proxy = Map(raw.select { |k, _v| %i[proxy port].include?(k) })
| ruby | {
"resource": ""
} |
q24153 | BoxGrinder.GuestFSHelper.log_hack | train | def log_hack
read_stderr, write_stderr = IO.pipe
fork do
write_stderr.close
read_stderr.each do |l|
@log.trace "GFS: #{l.chomp.strip}"
end
read_stderr.close
end
old_stderr = STDERR.clone
STDERR.reopen(write_stderr)
STDERR.sync = true
| ruby | {
"resource": ""
} |
q24154 | BoxGrinder.GuestFSHelper.mount_partitions | train | def mount_partitions(device, mount_prefix = '')
@log.trace "Mounting partitions..."
partitions = mountable_partitions(device)
mount_points = LinuxHelper.new(:log => @log).partition_mount_points(@appliance_config.hardware.partitions)
# https://issues.jboss.org/browse/BGBUILD-307
# We don't... | ruby | {
"resource": ""
} |
q24155 | BoxGrinder.GuestFSHelper.umount_partitions | train | def umount_partitions(device)
partitions = mountable_partitions(device)
@log.trace "Unmounting partitions..."
partitions.reverse.each | ruby | {
"resource": ""
} |
q24156 | Wavefront.Search.body | train | def body(query, options)
ret = { limit: options[:limit] || 10,
offset: options[:offset] || 0 }
if query && !query.empty?
ret[:query] = [query].flatten.map do |q|
| ruby | {
"resource": ""
} |
q24157 | BoxGrinder.ElasticHostsPlugin.create_server | train | def create_server
@log.info "Creating new server..."
memory = ((is_cloudsigma? and @appliance_config.hardware.memory < 512) ? 512 : @appliance_config.hardware.memory)
body = hash_to_request(
'name' => "#{@appliance_config.name}-#{@appliance_config.version}.#{@appliance_config.release}",
... | ruby | {
"resource": ""
} |
q24158 | BoxGrinder.Appliance.initialize_plugins | train | def initialize_plugins
@plugin_chain = []
os_plugin, os_plugin_info = PluginManager.instance.initialize_plugin(:os, @appliance_config.os.name.to_sym)
initialize_plugin(os_plugin, os_plugin_info)
if platform_selected?
platform_plugin, platform_plugin_info = PluginManager.instance.initia... | ruby | {
"resource": ""
} |
q24159 | BoxGrinder.Appliance.initialize_plugin | train | def initialize_plugin(plugin, plugin_info, options = {})
options = {
:log => @log
}.merge(options)
unless @plugin_chain.empty?
options.merge!(:previous_plugin => @plugin_chain.last[:plugin])
end
plugin.init(@config, @appliance_config, plugin_info, options)
# Execut... | ruby | {
"resource": ""
} |
q24160 | BoxGrinder.Appliance.create | train | def create
@log.debug "Launching new build..."
@log.trace "Used configuration: #{@config.to_yaml.gsub(/(\S*(key|account|cert|username|host|password)\S*).*:(.*)/, '\1' + ": <REDACTED>")}"
| ruby | {
"resource": ""
} |
q24161 | BoxGrinder.LibvirtCapabilities.determine_capabilities | train | def determine_capabilities(conn, previous_plugin_info)
plugin = get_plugin(previous_plugin_info)
root = Nokogiri::XML.parse(conn.capabilities)
guests = root.xpath("//guest/arch[@name='x86_64']/..")
guests = guests.sort do |a, b|
dom_maps = [a,b].map { |x| plugin.domain_map[xpath_first_i... | ruby | {
"resource": ""
} |
q24162 | BoxGrinder.LibvirtCapabilities.get_plugin | train | def get_plugin(previous_plugin_info)
if previous_plugin_info[:type] == :platform
if PLUGINS.has_key?(previous_plugin_info[:name])
@log.debug("Using #{previous_plugin_info[:name]} mapping")
return PLUGINS[previous_plugin_info[:name]]
else
@log.debug("This plugin does n... | ruby | {
"resource": ""
} |
q24163 | Spree.BitpayController.pay_now | train | def pay_now
order = current_order || raise(ActiveRecord::RecordNotFound)
session[:order_number] = current_order.number
| ruby | {
"resource": ""
} |
q24164 | Spree.BitpayController.payment_sent | train | def payment_sent
order_number = session[:order_number]
session[:order_number] = nil
order = Spree::Order.find_by_number(order_number) | ruby | {
"resource": ""
} |
q24165 | Spree.BitpayController.notification | train | def notification
begin
posData = JSON.parse(params["posData"])
order_id = posData["orderID"]
payment_id = posData["paymentID"]
order = Spree::Order.find_by_number(order_id) || raise(ActiveRecord::RecordNotFound)
begin
order.process_bitpay_ipn payment_id
... | ruby | {
"resource": ""
} |
q24166 | Spree.BitpayController.refresh | train | def refresh
payment = Spree::Payment.find(params[:payment]) # Retrieve payment by ID
old_state = payment.state
payment.process_bitpay_ipn
new_state | ruby | {
"resource": ""
} |
q24167 | BoxGrinder.EC2Plugin.add_ec2_user | train | def add_ec2_user(guestfs)
@log.debug "Adding ec2-user user..."
# We need to add ec2-user only when it doesn't exists
#
# https://issues.jboss.org/browse/BGBUILD-313
unless guestfs.fgrep("ec2-user", "/etc/passwd").empty?
@log.debug("ec2-user already exists, skipping.")
retu... | ruby | {
"resource": ""
} |
q24168 | CucumberAnalytics.Step.step_text | train | def step_text(options = {})
options = {:with_keywords => true,
:with_arguments => true,
:left_delimiter => self.left_delimiter,
:right_delimiter => self.right_delimiter}.merge(options)
final_step = []
step_text = ''
step_text += "#{@keyword} "... | ruby | {
"resource": ""
} |
q24169 | CucumberAnalytics.Step.scan_arguments | train | def scan_arguments(*how)
if how.count == 1
pattern = how.first
else
left_delimiter = how[0] || self.left_delimiter
right_delimiter = how[1] || self.right_delimiter
return [] unless left_delimiter && right_delimiter
| ruby | {
"resource": ""
} |
q24170 | CucumberAnalytics.Step.stripped_step | train | def stripped_step(step, left_delimiter, right_delimiter)
unless left_delimiter.nil? || right_delimiter.nil?
pattern = Regexp.new(Regexp.escape(left_delimiter) + '.*?' + Regexp.escape(right_delimiter))
| ruby | {
"resource": ""
} |
q24171 | BoxGrinder.RPMBasedOSPlugin.substitute_vars | train | def substitute_vars(str)
return if str.nil?
@appliance_config.variables.keys.each do |var|
| ruby | {
"resource": ""
} |
q24172 | BoxGrinder.RPMBasedOSPlugin.install_files | train | def install_files(guestfs)
@log.debug "Installing files specified in appliance definition file..."
@appliance_config.files.each do |dir, files|
@log.debug "Proceding files for '#{dir}' destination directory..."
local_files = []
# Create the directory if it doesn't exists
... | ruby | {
"resource": ""
} |
q24173 | Echochamber.Client.get_library_document_file | train | def get_library_document_file(library_document_id, file_id, file_path=nil)
response = Echochamber::Request.get_library_document_file(token, library_document_id, file_id)
unless file_path.nil?
| ruby | {
"resource": ""
} |
q24174 | Echochamber.Client.library_combined_document | train | def library_combined_document(library_document_id, file_path=nil, auditReport=false)
response = Echochamber::Request.library_combined_document(token, library_document_id, auditReport)
unless file_path.nil?
| ruby | {
"resource": ""
} |
q24175 | UserQ.Queue.enter_into_queue? | train | def enter_into_queue? # Check if enough space in queue
current_limit = queue_constraints[:capacity].to_i
current_usage | ruby | {
"resource": ""
} |
q24176 | Kairos.Client.gallery_list_all | train | def gallery_list_all
# ToDo: Research why Typhoeus works better than Faraday for this endpoint
request = Typhoeus::Request.new(
"#{Kairos::Configuration::GALLERY_LIST_ALL}",
method: :post,
headers: { "Content-Type" => "application/x-www-form-urlencoded",
"app_id" | ruby | {
"resource": ""
} |
q24177 | RbGCCXML.QueryResult.method_missing | train | def method_missing(name, *args)
if self[0].respond_to?(name)
self.inject(QueryResult.new) do |memo, node|
ret = node.send(name, *args)
| ruby | {
"resource": ""
} |
q24178 | SyncAttr.Attributes.sync_attr_sync | train | def sync_attr_sync(attribute, &block)
mutex_var_name = "@sync_attr_#{attribute}".to_sym
instance_variable_set(mutex_var_name, Mutex.new) unless | ruby | {
"resource": ""
} |
q24179 | BoxGrinder.EC2Helper.wait_for_instance_death | train | def wait_for_instance_death(instance, opts={})
wait_for_instance_status(:terminated, | ruby | {
"resource": ""
} |
q24180 | Echochamber.Client.get_widget_documents | train | def get_widget_documents(widget_id, version_id=nil, participant_email=nil)
| ruby | {
"resource": ""
} |
q24181 | Echochamber.Client.get_widget_document_file | train | def get_widget_document_file(widget_id, document_id, file_path=nil)
response = Echochamber::Request.get_widget_document_file(token, widget_id, document_id)
unless file_path.nil?
| ruby | {
"resource": ""
} |
q24182 | I18nRailsHelpers.ControllerHelpers.redirect_notice | train | def redirect_notice(record = nil)
{ notice: I18n.t("crud.notices.#{action_name}", model: helpers.t_model,
| ruby | {
"resource": ""
} |
q24183 | I18nRouting.JourneyRoute.initialize_with_i18n_routing | train | def initialize_with_i18n_routing(name, app, path, constraints, defaults = {})
@locale = if constraints.key?(:i18n_locale)
c = constraints.delete(:i18n_locale)
# | ruby | {
"resource": ""
} |
q24184 | Wavefront.Response.raw_response | train | def raw_response(json, status)
json.empty? ? {} : JSON.parse(json, | ruby | {
"resource": ""
} |
q24185 | Userq.InstallGenerator.do_migration | train | def do_migration
migration_exists = Dir["db/migrate/*_create_user_queues.rb"].count > 0
if migration_exists and installing?
puts "UserQ is already installed. Maybe a 'rake db:migrate' command might help?"
return
end
create_migration
puts "Success! UserQ is installed. You... | ruby | {
"resource": ""
} |
q24186 | Echochamber.Client.create_user | train | def create_user(user)
user_response = Echochamber::Request.create_user(user, token)
| ruby | {
"resource": ""
} |
q24187 | Echochamber.Client.create_transient_document | train | def create_transient_document(file_name, mime_type, file_handle)
transient_document_response = Echochamber::Request.create_transient_document(token, file_name, file_handle, | ruby | {
"resource": ""
} |
q24188 | IRT.Utils.ask_run_new_file | train | def ask_run_new_file(new_file_path, source_path, tmp)
return if tmp && IRT.rails_server
| ruby | {
"resource": ""
} |
q24189 | Wavefront.User.response_shim | train | def response_shim(body, status)
items = JSON.parse(body, symbolize_names: true)
{ response: { items: items,
offset: 0,
limit: items.size,
| ruby | {
"resource": ""
} |
q24190 | BoxGrinder.AWSHelper.parse_opts | train | def parse_opts(opts_in, opts_defaults)
diff_id = opts_in.keys - opts_defaults.keys
raise ArgumentError, "Unrecognised argument(s): #{diff_id.join(", ")}" if diff_id.any?
(opts_in.keys & opts_defaults.keys).each do |k|
raise ArgumentError, "Argument #{k.to_s} must not be nil" if opts_defaults[... | ruby | {
"resource": ""
} |
q24191 | BoxGrinder.LibvirtPlugin.determine_remotely | train | def determine_remotely
# Remove password field from URI, as libvirt doesn't support it directly. We can use it for passphrase if needed.
lv_uri = URI::Generic.build(:scheme => @connection_uri.scheme, :userinfo => @connection_uri.user,
:host => @connection_uri.host, :path =>... | ruby | {
"resource": ""
} |
q24192 | BoxGrinder.LibvirtPlugin.determine_locally | train | def determine_locally
domain = @libvirt_capabilities.get_plugin(@previous_plugin_info).domain_rank.last
generate_xml(OpenStruct.new({
:domain_type => domain.name, | ruby | {
"resource": ""
} |
q24193 | BoxGrinder.LibvirtPlugin.upload_image | train | def upload_image
uploader = SFTPHelper.new(:log => @log)
#SFTP library automagically uses keys registered with the OS first before trying a password.
uploader.connect(@image_delivery_uri.host,
(@image_delivery_uri.user || Etc.getlogin),
| ruby | {
"resource": ""
} |
q24194 | BoxGrinder.LibvirtPlugin.build_xml | train | def build_xml(opts = {})
opts = {:bus => @bus, :os_type => :hvm}.merge!(opts)
builder = Builder::XmlMarkup.new(:indent => 2)
xml = builder.domain(:type => opts[:domain_type].to_s) do |domain|
domain.name(@appliance_name)
domain.description(@appliance_config.summary)
domain.me... | ruby | {
"resource": ""
} |
q24195 | BoxGrinder.LibvirtPlugin.get_existing_domain | train | def get_existing_domain(conn, name)
return conn.lookup_domain_by_name(name)
rescue Libvirt::Error => e
| ruby | {
"resource": ""
} |
q24196 | BoxGrinder.LibvirtPlugin.undefine_domain | train | def undefine_domain(dom)
case dom.info.state
when Libvirt::Domain::RUNNING, | ruby | {
"resource": ""
} |
q24197 | BoxGrinder.LibvirtPlugin.write_xml | train | def write_xml(xml)
fname = "#{@appliance_name}.xml"
File.open("#{@dir.tmp}/#{fname}", | ruby | {
"resource": ""
} |
q24198 | Ddr::Models.WithContentFile.with_temp_file | train | def with_temp_file
filename = original_filename || content.default_file_name
basename = [ File.basename(filename, ".*"), File.extname(filename) ]
infile = Tempfile.open(basename, Ddr::Models.tempdir, encoding: 'ascii-8bit')
begin
infile.write(content.content)
infile.close
| ruby | {
"resource": ""
} |
q24199 | Ddr::Auth.AuthContext.member_of? | train | def member_of?(group)
if group.is_a? Group
groups.include? group | 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.