Class: Qa::Authorities::Local::Registry

Inherits:
Object
  • Object
show all
Defined in:
lib/qa/authorities/local/registry.rb

Defined Under Namespace

Classes: RegistryEntry

Class Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ Registry

Returns a new instance of Registry.

Yields:

  • (_self)

Yield Parameters:



6
7
8
9
# File 'lib/qa/authorities/local/registry.rb', line 6

def initialize
  @hash = {}
  yield self if block_given?
end

Class Attribute Details

.loggerObject



15
16
17
# File 'lib/qa/authorities/local/registry.rb', line 15

def self.logger
  @logger ||= ::Rails.logger if defined? Rails && Rails.respond_to?(:logger)
end

Instance Method Details

#add(subauthority, class_name) ⇒ Object



23
24
25
26
# File 'lib/qa/authorities/local/registry.rb', line 23

def add(subauthority, class_name)
  Registry.logger.debug "Registering Local QA authority: #{subauthority} - #{class_name}"
  @hash[subauthority] = RegistryEntry.new(subauthority, class_name)
end

#instance_for(key) ⇒ Object



11
12
13
# File 'lib/qa/authorities/local/registry.rb', line 11

def instance_for(key)
  fetch(key).instance
end