Class: Qa::Authorities::Local::Registry
- Inherits:
-
Object
- Object
- Qa::Authorities::Local::Registry
- Defined in:
- lib/qa/authorities/local/registry.rb
Defined Under Namespace
Classes: RegistryEntry
Class Attribute Summary collapse
Instance Method Summary collapse
- #add(subauthority, class_name) ⇒ Object
-
#initialize {|_self| ... } ⇒ Registry
constructor
A new instance of Registry.
- #instance_for(key) ⇒ Object
Constructor Details
#initialize {|_self| ... } ⇒ Registry
Returns a new instance of Registry.
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
.logger ⇒ Object
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(, class_name) Registry.logger.debug "Registering Local QA authority: #{} - #{class_name}" @hash[] = RegistryEntry.new(, 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 |