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.
-
#reject_load_on_empty_stream ⇒ Object
writeonly
Sets the attribute reject_load_on_empty_stream.
Class Method Summary collapse
Instance Method Summary collapse
- #add_default_subscriber(subscriber) ⇒ Object
-
#initialize(logger = nil) ⇒ Configuration
constructor
A new instance of Configuration.
- #reject_load_on_empty_stream? ⇒ Boolean
- #store ⇒ Object
- #store=(store) ⇒ Object
- #subscribers ⇒ Object
Constructor Details
#initialize(logger = nil) ⇒ Configuration
Returns a new instance of Configuration.
6 7 8 9 |
# File 'lib/replay/repository/configuration.rb', line 6 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 |
#reject_load_on_empty_stream=(value) ⇒ Object (writeonly)
Sets the attribute reject_load_on_empty_stream
5 6 7 |
# File 'lib/replay/repository/configuration.rb', line 5 def reject_load_on_empty_stream=(value) @reject_load_on_empty_stream = value end |
Class Method Details
.default ⇒ Object
11 12 13 |
# File 'lib/replay/repository/configuration.rb', line 11 def self.default self.new(Replay.logger) end |
Instance Method Details
#add_default_subscriber(subscriber) ⇒ Object
15 16 17 18 |
# File 'lib/replay/repository/configuration.rb', line 15 def add_default_subscriber(subscriber) subscriber = Replay::Backends.resolve(subscriber) if subscriber.is_a?(String) || subscriber.is_a?(Symbol) @default_subscribers << subscriber end |
#reject_load_on_empty_stream? ⇒ Boolean
32 33 34 35 |
# File 'lib/replay/repository/configuration.rb', line 32 def reject_load_on_empty_stream? @reject_load_on_empty_stream ||= true @reject_load_on_empty_stream end |
#store ⇒ Object
37 38 39 |
# File 'lib/replay/repository/configuration.rb', line 37 def store @store end |
#store=(store) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/replay/repository/configuration.rb', line 24 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
20 21 22 |
# File 'lib/replay/repository/configuration.rb', line 20 def subscribers @default_subscribers end |