Class: Replay::Repository::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/replay/repository/configuration.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#loggerObject

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

Parameters:

  • value

    the value to set the attribute reject_load_on_empty_stream to.



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

.defaultObject



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

Returns:

  • (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

#storeObject



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

#subscribersObject



20
21
22
# File 'lib/replay/repository/configuration.rb', line 20

def subscribers
  @default_subscribers
end