Module: EntityStore::Config
- Defined in:
- lib/entity_store/config.rb
Class Attribute Summary collapse
-
.feed_store ⇒ Object
Stores.
-
.logger ⇒ Object
Logger can be assigned.
-
.store ⇒ Object
Stores.
-
.type_loader ⇒ Object
Allows config to pass in a lambda or Proc to use as the type loader in place of the default.
Class Method Summary collapse
- .connect_timeout ⇒ Object
- .event_subscribers ⇒ Object
- .load_type(type_name) ⇒ Object
- .setup {|_self| ... } ⇒ Object
-
.snapshot_threshold ⇒ Object
Public - indicates the version increment that is used to decided whether a snapshot of an entity should be created when it’s saved.
- .snapshot_threshold=(value) ⇒ Object
Class Attribute Details
.feed_store ⇒ Object
Stores
5 6 7 |
# File 'lib/entity_store/config.rb', line 5 def feed_store @feed_store end |
.logger ⇒ Object
Logger can be assigned
14 15 16 |
# File 'lib/entity_store/config.rb', line 14 def logger @logger end |
.store ⇒ Object
Stores
5 6 7 |
# File 'lib/entity_store/config.rb', line 5 def store @store end |
.type_loader ⇒ Object
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_timeout ⇒ Object
47 48 49 |
# File 'lib/entity_store/config.rb', line 47 def connect_timeout (ENV['ENTITY_STORE_CONNECT_TIMEOUT'] || '2').to_i end |
.event_subscribers ⇒ Object
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
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_threshold ⇒ Object
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 |