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
- #fetch(key) ⇒ Object
-
#initialize {|_self| ... } ⇒ Registry
constructor
A new instance of Registry.
- #instance_for(key) ⇒ Object
- #keys ⇒ Object
Constructor Details
#initialize {|_self| ... } ⇒ Registry
Returns a new instance of Registry.
4 5 6 7 |
# File 'lib/qa/authorities/local/registry.rb', line 4 def initialize @hash = {} yield self if block_given? end |
Class Attribute Details
.logger ⇒ Object
21 22 23 24 25 |
# File 'lib/qa/authorities/local/registry.rb', line 21 def self.logger @logger ||= begin ::Rails.logger if defined? Rails && Rails.respond_to?(:logger) end end |
Instance Method Details
#add(subauthority, class_name) ⇒ Object
31 32 33 34 |
# File 'lib/qa/authorities/local/registry.rb', line 31 def add(, class_name) Registry.logger.debug "Registering Local QA authority: #{} - #{class_name}" @hash[] = RegistryEntry.new(, class_name) end |
#fetch(key) ⇒ Object
17 18 19 |
# File 'lib/qa/authorities/local/registry.rb', line 17 def fetch(key) @hash.fetch(key) end |
#instance_for(key) ⇒ Object
13 14 15 |
# File 'lib/qa/authorities/local/registry.rb', line 13 def instance_for(key) fetch(key).instance end |
#keys ⇒ Object
9 10 11 |
# File 'lib/qa/authorities/local/registry.rb', line 9 def keys @hash.keys end |