Class: DurableFlow::Live::Change
- Inherits:
-
Struct
- Object
- Struct
- DurableFlow::Live::Change
- Defined in:
- lib/durable_flow/live.rb
Instance Attribute Summary collapse
-
#occurred_at ⇒ Object
Returns the value of attribute occurred_at.
-
#record ⇒ Object
Returns the value of attribute record.
-
#record_class ⇒ Object
Returns the value of attribute record_class.
-
#record_id ⇒ Object
Returns the value of attribute record_id.
-
#run_id ⇒ Object
Returns the value of attribute run_id.
-
#snapshot ⇒ Object
Returns the value of attribute snapshot.
-
#type ⇒ Object
Returns the value of attribute type.
-
#workflow_class ⇒ Object
Returns the value of attribute workflow_class.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#occurred_at ⇒ Object
Returns the value of attribute occurred_at
5 6 7 |
# File 'lib/durable_flow/live.rb', line 5 def occurred_at @occurred_at end |
#record ⇒ Object
Returns the value of attribute record
5 6 7 |
# File 'lib/durable_flow/live.rb', line 5 def record @record end |
#record_class ⇒ Object
Returns the value of attribute record_class
5 6 7 |
# File 'lib/durable_flow/live.rb', line 5 def record_class @record_class end |
#record_id ⇒ Object
Returns the value of attribute record_id
5 6 7 |
# File 'lib/durable_flow/live.rb', line 5 def record_id @record_id end |
#run_id ⇒ Object
Returns the value of attribute run_id
5 6 7 |
# File 'lib/durable_flow/live.rb', line 5 def run_id @run_id end |
#snapshot ⇒ Object
Returns the value of attribute snapshot
5 6 7 |
# File 'lib/durable_flow/live.rb', line 5 def snapshot @snapshot end |
#type ⇒ Object
Returns the value of attribute type
5 6 7 |
# File 'lib/durable_flow/live.rb', line 5 def type @type end |
#workflow_class ⇒ Object
Returns the value of attribute workflow_class
5 6 7 |
# File 'lib/durable_flow/live.rb', line 5 def workflow_class @workflow_class end |
Class Method Details
.from_record(record, action:) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/durable_flow/live.rb', line 16 def self.from_record(record, action:) workflow_run = workflow_run_for(record) new( type: "#{record.model_name.element}.#{action}", run_id: workflow_run&.run_id, workflow_class: workflow_run&.workflow_class, record_class: record.class.name, record_id: record.id, record: record, snapshot: record.live_snapshot, occurred_at: Time.current, ) end |
Instance Method Details
#payload ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/durable_flow/live.rb', line 31 def payload snapshot.merge( type: type, run_id: run_id, workflow_class: workflow_class, record_class: record_class, record_id: record_id, occurred_at: occurred_at, ).compact end |