Module: Inspec::ProfileContext::DomainSpecificLunacy

Defined in:
lib/inspec/profile_context.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.create_dsl(profile_context) ⇒ Object



213
214
215
216
217
218
# File 'lib/inspec/profile_context.rb', line 213

def self.create_dsl(profile_context)
  Module.new do
    include DomainSpecificLunacy
    add_methods(profile_context)
  end
end

.included(mod) ⇒ Object



220
221
222
# File 'lib/inspec/profile_context.rb', line 220

def self.included(mod)
  mod.extend ClassMethods
end

Instance Method Details

#resource_class(profile_name, resource_name) ⇒ Object

Raises:



224
225
226
227
228
229
230
231
232
233
234
# File 'lib/inspec/profile_context.rb', line 224

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