Method: Inspec::ProfileContext::DomainSpecificLunacy::ClassMethods#add_registry_methods

Defined in:
lib/inspec/profile_context.rb

#add_registry_methods(profile_context) ⇒ Object



260
261
262
263
264
265
266
267
268
269
270
271
272
# File 'lib/inspec/profile_context.rb', line 260

def add_registry_methods(profile_context)
  be = profile_context.backend
  bec = be.class

  registry = profile_context.resource_registry
  registry.each do |id, r|
    define_method(id) { |*args| r.new(be, id.to_s, *args) }

    next if be.respond_to?(id)

    bec.define_method(id) { |*args| r.new(be, id.to_s, *args) }
  end
end