Class: Qa::Authorities::Local::Registry
- Inherits:
-
Object
- Object
- Qa::Authorities::Local::Registry
- Defined in:
- lib/qa/authorities/local.rb
Defined Under Namespace
Classes: RegistryEntry
Class Method 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.
38 39 40 41 |
# File 'lib/qa/authorities/local.rb', line 38 def initialize @hash = {} yield self if block_given? end |
Class Method Details
.logger ⇒ Object
55 56 57 58 59 |
# File 'lib/qa/authorities/local.rb', line 55 def self.logger @logger ||= begin ::Rails.logger if defined? Rails and Rails.respond_to? :logger end end |
.logger=(logger) ⇒ Object
61 62 63 |
# File 'lib/qa/authorities/local.rb', line 61 def self.logger= logger @logger = logger end |
Instance Method Details
#add(subauthority, class_name) ⇒ Object
65 66 67 68 |
# File 'lib/qa/authorities/local.rb', line 65 def add(, class_name) Registry.logger.debug "Registering Local QA authority: #{} - #{class_name}" @hash[] = RegistryEntry.new(, class_name) end |
#fetch(key) ⇒ Object
51 52 53 |
# File 'lib/qa/authorities/local.rb', line 51 def fetch(key) @hash.fetch(key) end |
#instance_for(key) ⇒ Object
47 48 49 |
# File 'lib/qa/authorities/local.rb', line 47 def instance_for(key) fetch(key).instance end |
#keys ⇒ Object
43 44 45 |
# File 'lib/qa/authorities/local.rb', line 43 def keys @hash.keys end |