Class: Replay::Repository::Configuration

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

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



4
5
6
# File 'lib/replay/repository/configuration.rb', line 4

def initialize
  @default_subscribers =[]
end

Instance Method Details

#add_default_subscriber(subscriber) ⇒ Object



8
9
10
11
# File 'lib/replay/repository/configuration.rb', line 8

def add_default_subscriber(subscriber)
  subscriber = Replay::Backends.resolve(subscriber) if subscriber.is_a?(String) || subscriber.is_a?(Symbol)
  @default_subscribers << subscriber
end

#storeObject



25
26
27
# File 'lib/replay/repository/configuration.rb', line 25

def store
  @store
end

#store=(store) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/replay/repository/configuration.rb', line 17

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



13
14
15
# File 'lib/replay/repository/configuration.rb', line 13

def subscribers
  @default_subscribers
end