Class: Hooksmith::Config::EventStore
- Inherits:
-
Object
- Object
- Hooksmith::Config::EventStore
- Defined in:
- lib/hooksmith/config/event_store.rb
Overview
EventStore holds settings for optional event persistence.
Instance Attribute Summary collapse
-
#enabled ⇒ Object
Whether persistence is enabled.
-
#mapper ⇒ Object
Proc to map provider/event/payload to attributes persisted.
-
#model_class_name ⇒ Object
Class name of the model used to persist events.
-
#record_timing ⇒ Object
When to record: :before, :after, or :both.
Instance Method Summary collapse
-
#initialize ⇒ EventStore
constructor
A new instance of EventStore.
- #model_class ⇒ Object
Constructor Details
#initialize ⇒ EventStore
Returns a new instance of EventStore.
16 17 18 19 20 21 22 |
# File 'lib/hooksmith/config/event_store.rb', line 16 def initialize @enabled = false # No default model in the gem; applications should provide their own model @model_class_name = nil @record_timing = :before @mapper = default_mapper end |
Instance Attribute Details
#enabled ⇒ Object
Whether persistence is enabled.
8 9 10 |
# File 'lib/hooksmith/config/event_store.rb', line 8 def enabled @enabled end |
#mapper ⇒ Object
Proc to map provider/event/payload to attributes persisted
12 13 14 |
# File 'lib/hooksmith/config/event_store.rb', line 12 def mapper @mapper end |
#model_class_name ⇒ Object
Class name of the model used to persist events. Must respond to .create!(attrs)
10 11 12 |
# File 'lib/hooksmith/config/event_store.rb', line 10 def model_class_name @model_class_name end |
#record_timing ⇒ Object
When to record: :before, :after, or :both
14 15 16 |
# File 'lib/hooksmith/config/event_store.rb', line 14 def record_timing @record_timing end |
Instance Method Details
#model_class ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/hooksmith/config/event_store.rb', line 24 def model_class return nil if model_class_name.nil? Object.const_get(model_class_name) rescue NameError nil end |