_id stringlengths 2 6 | title stringlengths 9 130 | partition stringclasses 3
values | text stringlengths 30 4.3k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q18900 | Nexpose.Connection.list_device_vulns | train | def list_device_vulns(dev_id)
parameters = { 'devid' => dev_id,
'table-id' => 'vulnerability-listing' }
json = DataTable._get_json_table(self,
| ruby | {
"resource": ""
} |
q18901 | Nexpose.Connection.incomplete_assets | train | def incomplete_assets(scan_id)
uri = "/data/asset/scan/#{scan_id}/incomplete-assets"
AJAX.preserving_preference(self, 'scan-incomplete-assets') do
| ruby | {
"resource": ""
} |
q18902 | Nexpose.Alert.delete | train | def delete(nsc, site_id)
uri = "/api/2.1/site_configurations/#{site_id}/alerts/#{id}"
| ruby | {
"resource": ""
} |
q18903 | Nexpose.Alert.save | train | def save(nsc, site_id)
validate
uri = "/api/2.1/site_configurations/#{site_id}/alerts"
id = | ruby | {
"resource": ""
} |
q18904 | Nexpose.Connection.list_silo_users | train | def list_silo_users
r = execute(make_xml('MultiTenantUserListingRequest'), '1.2')
arr = []
if r.success
r.res.elements.each('MultiTenantUserListingResponse/MultiTenantUserSummaries/MultiTenantUserSummary') | ruby | {
"resource": ""
} |
q18905 | Nexpose.Connection.delete_engine | train | def delete_engine(engine_id, scope = 'silo')
xml = make_xml('EngineDeleteRequest', { 'engine-id' => engine_id, 'scope' => scope })
| ruby | {
"resource": ""
} |
q18906 | Nexpose.Connection.engine_activity | train | def engine_activity(engine_id)
xml = make_xml('EngineActivityRequest', { 'engine-id' => engine_id })
r = execute(xml)
arr = []
if r.success
| ruby | {
"resource": ""
} |
q18907 | Nexpose.Connection.list_engines | train | def list_engines
response = execute(make_xml('EngineListingRequest'))
arr = []
if response.success
response.res.elements.each('//EngineSummary') do |engine|
arr << EngineSummary.new(engine.attributes['id'].to_i,
engine.attributes['name'],
... | ruby | {
"resource": ""
} |
q18908 | Nexpose.Engine.save | train | def save(connection)
xml = '<EngineSaveRequest session-id="' + connection.session_id + '">'
xml << to_xml
xml << '</EngineSaveRequest>'
r = connection.execute(xml, '1.2')
if | ruby | {
"resource": ""
} |
q18909 | Nexpose.Connection.all_vulns | train | def all_vulns
uri = '/api/2.0/vulnerability_definitions'
resp = AJAX.get(self, uri, AJAX::CONTENT_TYPE::JSON, per_page: 2_147_483_647)
json = JSON.parse(resp, symbolize_names: true)
| ruby | {
"resource": ""
} |
q18910 | Nexpose.Connection.find_vulns_by_cve | train | def find_vulns_by_cve(cve)
uri = '/api/2.0/vulnerability_definitions'
resp = AJAX.get(self, uri, AJAX::CONTENT_TYPE::JSON, cve: cve)
json = JSON.parse(resp, symbolize_names: true)
| ruby | {
"resource": ""
} |
q18911 | Nexpose.Connection.find_vulns_by_ref | train | def find_vulns_by_ref(source, id)
uri = '/api/2.0/vulnerability_definitions'
resp = AJAX.get(self,
uri,
AJAX::CONTENT_TYPE::JSON,
source: source, id: id)
| ruby | {
"resource": ""
} |
q18912 | Nexpose.Connection.find_vulns_by_title | train | def find_vulns_by_title(title, all_words = true)
uri = '/api/2.0/vulnerability_definitions'
params = { title: title, all_words: all_words }
resp = AJAX.get(self, uri, AJAX::CONTENT_TYPE::JSON, params)
| ruby | {
"resource": ""
} |
q18913 | Nexpose.Connection.tags | train | def tags
tag_summary = []
tags = JSON.parse(AJAX.get(self, '/api/2.0/tags', AJAX::CONTENT_TYPE::JSON, { per_page: 2_147_483_647 }))
| ruby | {
"resource": ""
} |
q18914 | Nexpose.Connection.asset_tags | train | def asset_tags(asset_id)
tag_summary = []
asset_tag = JSON.parse(AJAX.get(self, "/api/2.0/assets/#{asset_id}/tags", AJAX::CONTENT_TYPE::JSON, { | ruby | {
"resource": ""
} |
q18915 | Nexpose.Connection.site_tags | train | def site_tags(site_id)
tag_summary = []
site_tag = JSON.parse(AJAX.get(self, "/api/2.0/sites/#{site_id}/tags", AJAX::CONTENT_TYPE::JSON, { per_page: 2_147_483_647 }))
| ruby | {
"resource": ""
} |
q18916 | Nexpose.Connection.asset_group_tags | train | def asset_group_tags(asset_group_id)
tag_summary = []
asset_group_tag = JSON.parse(AJAX.get(self, "/api/2.0/asset_groups/#{asset_group_id}/tags", AJAX::CONTENT_TYPE::JSON, { per_page: 2_147_483_647 }))
| ruby | {
"resource": ""
} |
q18917 | Nexpose.Connection.selected_criticality_tag | train | def selected_criticality_tag(asset_id)
selected_criticality = AJAX.get(self, "/data/asset/#{asset_id}/selected-criticality-tag")
| ruby | {
"resource": ""
} |
q18918 | Nexpose.Tag.color= | train | def color=(hex)
valid_colors = Type::Color.constants.map { |c| Type::Color.const_get(c) }
unless hex.nil? || valid_colors.include?(hex.to_s.downcase)
| ruby | {
"resource": ""
} |
q18919 | Nexpose.Tag.save | train | def save(connection)
params = to_json
if @id == -1
uri = AJAX.post(connection, '/api/2.0/tags', params, AJAX::CONTENT_TYPE::JSON)
@id = uri.split('/').last.to_i
else | ruby | {
"resource": ""
} |
q18920 | Nexpose.Tag.add_to_asset | train | def add_to_asset(connection, asset_id)
params = to_json_for_add
url = "/api/2.0/assets/#{asset_id}/tags"
uri | ruby | {
"resource": ""
} |
q18921 | Nexpose.Tag.add_to_site | train | def add_to_site(connection, site_id)
params = to_json_for_add
url = "/api/2.0/sites/#{site_id}/tags"
uri | ruby | {
"resource": ""
} |
q18922 | Nexpose.Tag.add_to_group | train | def add_to_group(connection, group_id)
params = to_json_for_add
url = "/api/2.0/asset_groups/#{group_id}/tags"
uri | ruby | {
"resource": ""
} |
q18923 | Nexpose.Connection.list_vuln_exceptions | train | def list_vuln_exceptions(status = nil)
unless is_valid_vuln_exception_status?(status)
raise "Unknown Status ~> '#{status}' :: For available options refer to Nexpose::VulnException::Status"
end
status = Nexpose::VulnException::Status.const_get(status_string_to_constant(status)) unless status.n... | ruby | {
"resource": ""
} |
q18924 | Nexpose.Connection.resubmit_vuln_exception | train | def resubmit_vuln_exception(id, comment, reason = nil)
options = { 'exception-id' => id }
options['reason'] = reason if reason
xml | ruby | {
"resource": ""
} |
q18925 | Nexpose.VulnException.save | train | def save(connection, comment = nil)
validate
xml = connection.make_xml('VulnerabilityExceptionCreateRequest')
xml.add_attributes({ 'vuln-id' => @vuln_id,
'scope' => @scope,
'reason' => @reason })
case @scope
when Scope::ALL_INSTANCES_O... | ruby | {
"resource": ""
} |
q18926 | Nexpose.VulnException.approve | train | def approve(connection, comment = nil)
xml = connection.make_xml('VulnerabilityExceptionApproveRequest',
{ 'exception-id' => @id })
if comment
cxml = REXML::Element.new('comment')
cxml.add_text(comment)
| ruby | {
"resource": ""
} |
q18927 | Nexpose.VulnException.update_expiration_date | train | def update_expiration_date(connection, new_date)
xml = connection.make_xml('VulnerabilityExceptionUpdateExpirationDateRequest',
| ruby | {
"resource": ""
} |
q18928 | Nexpose.VulnException.validate | train | def validate
raise ArgumentError.new('No vuln_id.') unless @vuln_id
raise ArgumentError.new('No scope.') unless @scope
raise ArgumentError.new('No reason.') unless @reason
case @scope
when Scope::ALL_INSTANCES
@asset_id = @port = @vuln_key = nil
when Scope::ALL_INSTANCES_ON_... | ruby | {
"resource": ""
} |
q18929 | Nexpose.Connection.list_backups | train | def list_backups
data = DataTable._get_dyn_table(self, '/data/admin/backups?tableID=BackupSynopsis') | ruby | {
"resource": ""
} |
q18930 | Nexpose.Connection.backup | train | def backup(platform_independent = false, description = nil)
parameters = { 'backup_desc' => description,
'cmd' => 'backup',
'platform_independent' => platform_independent,
'targetTask' => 'backupRestore' }
xml = AJAX.form_post(self, | ruby | {
"resource": ""
} |
q18931 | Nexpose.Connection.db_maintenance | train | def db_maintenance(clean_up = false, compress = false, reindex = false)
return unless compress || clean_up || reindex
parameters = { 'cmd' => 'startMaintenance', 'targetTask' => 'dbMaintenance' }
parameters['cleanup'] = 1 if clean_up
parameters['compress'] = 1 if compress
parameters['rein... | ruby | {
"resource": ""
} |
q18932 | Nexpose.Backup.restore | train | def restore(nsc, password = nil)
raise 'Supplied Password is incorrect for restoring this Backup.' if invalid_backup_password?(nsc, password)
parameters = { 'backupid' => @name,
| ruby | {
"resource": ""
} |
q18933 | Nexpose.HostOrIP.convert | train | def convert(asset)
ips = asset.split('-').map(&:strip)
IPAddr.new(ips[0])
IPAddr.new(ips[1]) if ips[1]
IPRange.new(ips[0], ips[1])
rescue ArgumentError => e
if e.message == | ruby | {
"resource": ""
} |
q18934 | Nexpose.Attributes.to_hash | train | def to_hash(arr)
arr.map(&:flatten).map { |p| { 'key' | ruby | {
"resource": ""
} |
q18935 | Nexpose.GlobalSettings.save | train | def save(nsc)
# load method can return XML missing this required attribute.
unless REXML::XPath.first(xml, '//*[@recalculation_duration]')
risk_model = REXML::XPath.first(xml, '//riskModel')
risk_model.add_attribute('recalculation_duration', 'do_not_recalculate')
end
replace_exc... | ruby | {
"resource": ""
} |
q18936 | Nexpose.GlobalSettings.add_exclusion | train | def add_exclusion(host_or_ip)
asset = host_or_ip
unless host_or_ip.respond_to?(:host) || host_or_ip.respond_to?(:from)
| ruby | {
"resource": ""
} |
q18937 | Nexpose.GlobalSettings.remove_exclusion | train | def remove_exclusion(host_or_ip)
asset = host_or_ip
unless host_or_ip.respond_to?(:host) || host_or_ip.respond_to?(:from)
# Attept to convert String to appropriate object.
| ruby | {
"resource": ""
} |
q18938 | Nexpose.GlobalSettings.replace_exclusions | train | def replace_exclusions(xml, exclusions)
xml.elements.delete('//ExcludedHosts')
elem = xml.root.add_element('ExcludedHosts')
exclusions.each | ruby | {
"resource": ""
} |
q18939 | Nexpose.GlobalSettings.parse_control_scanning_from_xml | train | def parse_control_scanning_from_xml(xml)
enabled = false
if elem = REXML::XPath.first(xml, '//enableControlsScan[@enabled]')
| ruby | {
"resource": ""
} |
q18940 | Nexpose.GlobalSettings.add_control_scanning_to_xml | train | def add_control_scanning_to_xml(xml, enabled)
if elem = REXML::XPath.first(xml, '//enableControlsScan')
elem.attributes['enabled'] = enabled | ruby | {
"resource": ""
} |
q18941 | Nexpose.GlobalSettings.parse_asset_linking_from_xml | train | def parse_asset_linking_from_xml(xml)
enabled = true
if elem = REXML::XPath.first(xml, '//AssetCorrelation[@enabled]')
| ruby | {
"resource": ""
} |
q18942 | Nexpose.GlobalSettings.add_asset_linking_to_xml | train | def add_asset_linking_to_xml(xml, enabled)
elem = REXML::XPath.first(xml, '//AssetCorrelation') | ruby | {
"resource": ""
} |
q18943 | Nexpose.CredentialHelper.set_db2_service | train | def set_db2_service(database = nil, username = nil, password = nil)
self.database = database
self.user_name = username
| ruby | {
"resource": ""
} |
q18944 | Nexpose.CredentialHelper.set_tds_service | train | def set_tds_service(database = nil, domain = nil, username = nil, password = nil)
self.database = database
self.domain = domain
self.use_windows_auth = domain.nil?
self.user_name = | ruby | {
"resource": ""
} |
q18945 | Nexpose.CredentialHelper.set_mysql_service | train | def set_mysql_service(database = nil, username = nil, password = nil)
self.database = database
self.user_name = username
| ruby | {
"resource": ""
} |
q18946 | Nexpose.CredentialHelper.set_oracle_service | train | def set_oracle_service(sid = nil, username = nil, password = nil)
self.database = sid
self.user_name = username
self.password | ruby | {
"resource": ""
} |
q18947 | Nexpose.CredentialHelper.set_postgresql_service | train | def set_postgresql_service(database = nil, username = nil, password = nil)
self.database = database
self.user_name = username
| ruby | {
"resource": ""
} |
q18948 | Nexpose.CredentialHelper.set_remote_execution_service | train | def set_remote_execution_service(username = nil, password = nil)
self.user_name = username
self.password = password
| ruby | {
"resource": ""
} |
q18949 | Nexpose.CredentialHelper.set_snmpv3_service | train | def set_snmpv3_service(authentication_type = Credential::AuthenticationType::NOAUTH, username = nil, password = nil, privacy_type = Credential::PrivacyType::NOPRIV, privacy_password = nil)
self.authentication_type = authentication_type
self.user_name = username
self.password | ruby | {
"resource": ""
} |
q18950 | Nexpose.CredentialHelper.set_sybase_service | train | def set_sybase_service(database = nil, domain = nil, username = nil, password = nil)
self.database = database
self.domain = domain
self.use_windows_auth = domain.nil?
self.user_name = | ruby | {
"resource": ""
} |
q18951 | Nexpose.CredentialHelper.set_telnet_service | train | def set_telnet_service(username = nil, password = nil)
self.user_name = | ruby | {
"resource": ""
} |
q18952 | Nexpose.CredentialHelper.set_http_service | train | def set_http_service(domain = nil, username = nil, password = nil)
self.domain = domain
self.user_name = username
| ruby | {
"resource": ""
} |
q18953 | Nexpose.Connection.list_users | train | def list_users
r = execute(make_xml('UserListingRequest'))
arr = []
if r.success
r.res.elements.each('UserListingResponse/UserSummary') do |summary|
| ruby | {
"resource": ""
} |
q18954 | Nexpose.Connection.list_discovery_connections | train | def list_discovery_connections
xml = make_xml('DiscoveryConnectionListingRequest')
response = execute(xml, '1.2')
connections | ruby | {
"resource": ""
} |
q18955 | Nexpose.Connection.delete_discovery_connection | train | def delete_discovery_connection(id)
xml = make_xml('DiscoveryConnectionDeleteRequest', { 'id' => id })
| ruby | {
"resource": ""
} |
q18956 | Nexpose.DiscoveryConnection.create | train | def create(nsc)
xml = nsc.make_xml('DiscoveryConnectionCreateRequest')
xml.add_element(as_xml)
response = nsc.execute(xml, '1.2')
if response.success
ret | ruby | {
"resource": ""
} |
q18957 | Nexpose.DiscoveryConnection.discover | train | def discover(nsc, criteria = nil)
parameters = { 'table-id' => 'assetdiscovery',
'sort' => 'assetDiscoveryName',
'searchCriteria' => criteria.nil? ? 'null' : criteria.to_json,
'configID' => @id }
| ruby | {
"resource": ""
} |
q18958 | Nexpose.DiscoveryConnection.connect | train | def connect(nsc)
xml = nsc.make_xml('DiscoveryConnectionConnectRequest', { 'id' => id })
| ruby | {
"resource": ""
} |
q18959 | Nexpose.Connection.list_asset_groups | train | def list_asset_groups
r = execute(make_xml('AssetGroupListingRequest'))
groups = []
if r.success
r.res.elements.each('AssetGroupListingResponse/AssetGroupSummary') do |group|
groups << AssetGroupSummary.new(group.attributes['id'].to_i,
group.... | ruby | {
"resource": ""
} |
q18960 | Nexpose.AssetGroup.as_xml | train | def as_xml
xml = REXML::Element.new('AssetGroup')
xml.attributes['id'] = @id
xml.attributes['name'] = @name
xml.attributes['description'] = @description
if @description && !@description.empty?
elem = REXML::Element.new('Description')
elem.add_text(@descript... | ruby | {
"resource": ""
} |
q18961 | Nexpose.AssetGroup.rescan_assets | train | def rescan_assets(connection)
scans = {}
sites_ids = @assets.map(&:site_id).uniq
sites_ids.each do |site_id|
to_scan = @assets.select { |d| d.site_id == site_id | ruby | {
"resource": ""
} |
q18962 | Fluent::Plugin.AwsElasticsearchServiceOutput.credentials | train | def credentials(opts)
calback = lambda do
credentials = nil
unless opts[:access_key_id].empty? or opts[:secret_access_key].empty?
credentials = Aws::Credentials.new opts[:access_key_id], opts[:secret_access_key]
else
if opts[:assume_role_arn].nil?
if opts[:e... | ruby | {
"resource": ""
} |
q18963 | Timezone.Zone.local_to_utc | train | def local_to_utc(time)
time = sanitize(time)
(time - | ruby | {
"resource": ""
} |
q18964 | Timezone.Zone.time_with_offset | train | def time_with_offset(time)
time = sanitize(time)
utc = utc_to_local(time)
offset = utc_offset(time)
Time.new(
utc.year,
utc.month,
utc.day,
| ruby | {
"resource": ""
} |
q18965 | Timezone.Zone.binary_search | train | def binary_search(time, from = 0, to = nil, &block)
to = private_rules.length - 1 if to.nil?
return from if from == to
mid = (from + to).div(2)
unless yield(time, | ruby | {
"resource": ""
} |
q18966 | BSON.OpenStruct.to_bson | train | def to_bson(buffer = ByteBuffer.new, validating_keys = Config.validating_keys?)
if Environment.ruby_1_9?
marshal_dump.dup
| ruby | {
"resource": ""
} |
q18967 | BSON.Hash.to_bson | train | def to_bson(buffer = ByteBuffer.new, validating_keys = Config.validating_keys?)
if buffer.respond_to?(:put_hash)
buffer.put_hash(self, validating_keys)
else
position = buffer.length
buffer.put_int32(0)
each do |field, value|
buffer.put_byte(value.bson_type)
... | ruby | {
"resource": ""
} |
q18968 | BSON.Timestamp.to_bson | train | def to_bson(buffer = ByteBuffer.new, validating_keys = Config.validating_keys?)
| ruby | {
"resource": ""
} |
q18969 | BSON.Array.to_bson | train | def to_bson(buffer = ByteBuffer.new, validating_keys = Config.validating_keys?)
if buffer.respond_to?(:put_array)
buffer.put_array(self, validating_keys)
else
position = buffer.length
buffer.put_int32(0)
each_with_index do |value, index|
buffer.put_byte(value.bson_t... | ruby | {
"resource": ""
} |
q18970 | BSON.Code.to_bson | train | def to_bson(buffer = ByteBuffer.new, validating_keys = Config.validating_keys?)
| ruby | {
"resource": ""
} |
q18971 | BSON.DateTime.to_bson | train | def to_bson(buffer = ByteBuffer.new, validating_keys = Config.validating_keys?)
| ruby | {
"resource": ""
} |
q18972 | BSON.CodeWithScope.to_bson | train | def to_bson(buffer = ByteBuffer.new, validating_keys = Config.validating_keys?)
position = buffer.length
buffer.put_int32(0)
buffer.put_string(javascript)
| ruby | {
"resource": ""
} |
q18973 | BSON.Integer.to_bson | train | def to_bson(buffer = ByteBuffer.new, validating_keys = Config.validating_keys?)
if bson_int32?
buffer.put_int32(self)
elsif bson_int64?
| ruby | {
"resource": ""
} |
q18974 | BSON.ObjectId.to_bson | train | def to_bson(buffer = ByteBuffer.new, validating_keys | ruby | {
"resource": ""
} |
q18975 | BSON.TrueClass.to_bson | train | def to_bson(buffer = ByteBuffer.new, validating_keys | ruby | {
"resource": ""
} |
q18976 | BSON.Binary.to_bson | train | def to_bson(buffer = ByteBuffer.new, validating_keys = Config.validating_keys?)
position = buffer.length
buffer.put_int32(0)
buffer.put_byte(SUBTYPES[type])
buffer.put_int32(data.bytesize) if type == :old
| ruby | {
"resource": ""
} |
q18977 | BSON.Registry.get | train | def get(byte, field = nil)
if type = MAPPINGS[byte] || (byte.is_a?(String) && type = MAPPINGS[byte.ord])
type
| ruby | {
"resource": ""
} |
q18978 | BSON.Date.to_bson | train | def to_bson(buffer = ByteBuffer.new, validating_keys = Config.validating_keys?) | ruby | {
"resource": ""
} |
q18979 | BSON.Regexp.to_bson | train | def to_bson(buffer = ByteBuffer.new, validating_keys = Config.validating_keys?)
| ruby | {
"resource": ""
} |
q18980 | BSON.Time.to_bson | train | def to_bson(buffer = ByteBuffer.new, validating_keys = Config.validating_keys?)
| ruby | {
"resource": ""
} |
q18981 | BSON.Document.fetch | train | def fetch(key, *args, &block)
key | ruby | {
"resource": ""
} |
q18982 | BSON.Document.merge! | train | def merge!(other)
other.each_pair do |key, value|
value = yield(convert_key(key), self[key], convert_value(value)) if block_given? | ruby | {
"resource": ""
} |
q18983 | BSON.Symbol.to_bson_key | train | def to_bson_key(validating_keys = Config.validating_keys?)
if validating_keys
raise | ruby | {
"resource": ""
} |
q18984 | RubyLint.Inspector.inspect_methods | train | def inspect_methods
return [] unless constant.respond_to?(:methods)
methods = get_methods.map do |name|
| ruby | {
"resource": ""
} |
q18985 | RubyLint.Inspector.inspect_modules | train | def inspect_modules
modules = []
if constant.respond_to?(:ancestors)
parent = inspect_superclass
# Take all the modules included *directly* into the constant.
modules = constant.ancestors.take_while do |ancestor|
parent && ancestor != parent
end
# | ruby | {
"resource": ""
} |
q18986 | RubyLint.Inspector.inspect_superclass | train | def inspect_superclass
parent = nil
if constant.respond_to?(:superclass) \
and constant.superclass \
and constant.superclass.name
| ruby | {
"resource": ""
} |
q18987 | RubyLint.Inspector.get_methods | train | def get_methods(getter = :methods)
parent = inspect_superclass || Object
diff = constant.__send__(getter, false) -
parent.__send__(getter, false)
methods = diff | | ruby | {
"resource": ""
} |
q18988 | RubyLint.Inspector.resolve_constant | train | def resolve_constant(constant)
current = Object
final = nil
constant.split('::').each do |segment|
if current.const_defined?(segment)
current = final = current.const_get(segment)
else
raise(
| ruby | {
"resource": ""
} |
q18989 | RubyLint.Iterator.execute_callback | train | def execute_callback(name, *args)
return unless respond_to?(name)
unless arity_cache.key?(name)
arity_cache[name] = method(name).arity
end | ruby | {
"resource": ""
} |
q18990 | RubyLint.ConstantPath.constant_segments | train | def constant_segments(node = self.node)
segments = []
if has_child_node?(node)
| ruby | {
"resource": ""
} |
q18991 | RubyLint.ConstantLoader.bootstrap | train | def bootstrap
types = VariablePredicates::RUBY_CLASSES.values
(BOOTSTRAP_CONSTS | types).each do |name|
load_constant(name)
end | ruby | {
"resource": ""
} |
q18992 | RubyLint.ConstantLoader.load_nested_constant | train | def load_nested_constant(constant)
if constant.start_with?("::")
constant = constant.sub(/^::/, "")
else
# ["A", "B", "C"] -> ["A::B::C", "A::B", "A"]
namespaces = module_nesting.size.downto(1).map do |n|
module_nesting.take(n).join("::")
end
| ruby | {
"resource": ""
} |
q18993 | RubyLint.ConstantLoader.load_constant | train | def load_constant(constant)
return if loaded?(constant)
registry.load(constant)
return | ruby | {
"resource": ""
} |
q18994 | RubyLint.Configuration.report_levels= | train | def report_levels=(given)
available = self.class.available_report_levels
levels = []
given.each do |level|
levels << available[level] if available[level]
| ruby | {
"resource": ""
} |
q18995 | RubyLint.Configuration.analysis_classes= | train | def analysis_classes=(names)
classes = []
available = self.class.available_analysis_classes
names.each do |name|
classes << available[name] if available[name]
| ruby | {
"resource": ""
} |
q18996 | RubyLint.RakeTask.run_task | train | def run_task
config = create_configuration
runner = RubyLint::Runner.new(config)
list = FileList.new
output | ruby | {
"resource": ""
} |
q18997 | RubyLint.FileScanner.build_constant_paths_cache | train | def build_constant_paths_cache(constant)
paths = match_globbed_files(constant_to_path(constant))
# Lets see if we can find anything when using dashes for the directory
# names instead of underscores.
if paths.empty?
paths = match_globbed_files(constant_to_dashed_path(constant))
en... | ruby | {
"resource": ""
} |
q18998 | RubyLint.Runner.parse_file | train | def parse_file(parser, file)
return parser.parse(File.read(file, | ruby | {
"resource": ""
} |
q18999 | RubyLint.Runner.run_analysis | train | def run_analysis(ast, vm, report)
classes = configuration.analysis_classes.select do |const|
const.analyze?(ast, vm)
end
classes.each do |const|
instance = const.new(
:vm | 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.