Module: EntityStore::Config

Defined in:
lib/entity_store/config.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.feed_storeObject

Stores



5
6
7
# File 'lib/entity_store/config.rb', line 5

def feed_store
  @feed_store
end

.loggerObject

Logger can be assigned



14
15
16
# File 'lib/entity_store/config.rb', line 14

def logger
  @logger
end

.storeObject

Stores



5
6
7
# File 'lib/entity_store/config.rb', line 5

def store
  @store
end

.type_loaderObject

Allows config to pass in a lambda or Proc to use as the type loader in place of the default. Original use case was migration of entity classes to new module namespace when extracting to a shared library



11
12
13
# File 'lib/entity_store/config.rb', line 11

def type_loader
  @type_loader
end

Class Method Details

.connect_timeoutObject



47
48
49
# File 'lib/entity_store/config.rb', line 47

def connect_timeout
  (ENV['ENTITY_STORE_CONNECT_TIMEOUT'] || '2').to_i
end

.event_subscribersObject



24
25
26
# File 'lib/entity_store/config.rb', line 24

def event_subscribers
  @_event_subscribers ||=[]
end

.load_type(type_name) ⇒ Object



39
40
41
42
43
44
45
# File 'lib/entity_store/config.rb', line 39

def load_type(type_name)
  if EntityStore::Config.type_loader
    EntityStore::Config.type_loader.call(type_name)
  else
    type_name.split('::').inject(Object) {|obj, name| obj.const_get(name) }
  end
end

.setup {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

Raises:

  • (StandardError)


16
17
18
19
20
21
22
# File 'lib/entity_store/config.rb', line 16

def setup
  yield self

  raise StandardError.new("store not assigned") unless store
  store.open 
  feed_store.open if feed_store
end

.snapshot_thresholdObject

Public - indicates the version increment that is used to decided whether a snapshot of an entity should be created when it’s saved



30
31
32
# File 'lib/entity_store/config.rb', line 30

def snapshot_threshold
  @_snapshot_threshold ||= 10
end

.snapshot_threshold=(value) ⇒ Object



34
35
36
# File 'lib/entity_store/config.rb', line 34

def snapshot_threshold=(value)
  @_snapshot_threshold = value
end