Class: Replay::Repository::Configuration
- Inherits:
-
Object
- Object
- Replay::Repository::Configuration
- Defined in:
- lib/replay/repository/configuration.rb
Instance Attribute Summary collapse
-
#logger ⇒ Object
Returns the value of attribute logger.
Class Method Summary collapse
Instance Method Summary collapse
- #add_default_subscriber(subscriber) ⇒ Object
-
#initialize(logger = nil) ⇒ Configuration
constructor
A new instance of Configuration.
- #store ⇒ Object
- #store=(store) ⇒ Object
- #subscribers ⇒ Object
Constructor Details
#initialize(logger = nil) ⇒ Configuration
Returns a new instance of Configuration.
5 6 7 8 |
# File 'lib/replay/repository/configuration.rb', line 5 def initialize(logger = nil) @default_subscribers =[] @logger = logger end |
Instance Attribute Details
#logger ⇒ Object
Returns the value of attribute logger.
4 5 6 |
# File 'lib/replay/repository/configuration.rb', line 4 def logger @logger end |
Class Method Details
.default ⇒ Object
10 11 12 |
# File 'lib/replay/repository/configuration.rb', line 10 def self.default self.new(Replay.logger) end |
Instance Method Details
#add_default_subscriber(subscriber) ⇒ Object
14 15 16 17 |
# File 'lib/replay/repository/configuration.rb', line 14 def add_default_subscriber(subscriber) subscriber = Replay::Backends.resolve(subscriber) if subscriber.is_a?(String) || subscriber.is_a?(Symbol) @default_subscribers << subscriber end |
#store ⇒ Object
31 32 33 |
# File 'lib/replay/repository/configuration.rb', line 31 def store @store end |
#store=(store) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/replay/repository/configuration.rb', line 23 def store=(store) store = Replay::Backends.resolve(store) raise Replay::InvalidStorageError.new(store) unless store.respond_to?(:event_stream) raise Replay::InvalidSubscriberError.new(store) unless store.respond_to?(:published) @store = store add_default_subscriber(@store) end |
#subscribers ⇒ Object
19 20 21 |
# File 'lib/replay/repository/configuration.rb', line 19 def subscribers @default_subscribers end |