module Inspec::ProfileContext::DomainSpecificLunacy

Public Class Methods

create_dsl(profile_context) click to toggle source
# File lib/inspec/profile_context.rb, line 216
def self.create_dsl(profile_context)
  Module.new do
    include DomainSpecificLunacy
    add_methods(profile_context)
  end
end
included(mod) click to toggle source
# File lib/inspec/profile_context.rb, line 223
def self.included(mod)
  mod.extend ClassMethods
end

Public Instance Methods

resource_class(profile_name, resource_name) click to toggle source
# File lib/inspec/profile_context.rb, line 227
def resource_class(profile_name, resource_name)
  inner_context = if profile_name == profile_context.profile_id
                    profile_context
                  else
                    profile_context.subcontext_by_name(profile_name)
                  end

  raise ProfileNotFound, "Cannot find profile named: #{profile_name}" if inner_context.nil?

  inner_context.resource_registry[resource_name]
end