Class: Statesman::Adapters::Sequel
- Inherits:
-
Object
- Object
- Statesman::Adapters::Sequel
- Defined in:
- lib/statesman/adapters/sequel.rb
Instance Attribute Summary collapse
-
#observer ⇒ Object
readonly
Returns the value of attribute observer.
-
#parent_model ⇒ Object
readonly
Returns the value of attribute parent_model.
-
#transition_class ⇒ Object
readonly
Returns the value of attribute transition_class.
Instance Method Summary collapse
- #create(from, to, metadata = {}) ⇒ Object
- #history ⇒ Object
-
#initialize(transition_class, parent_model, observer, options = {}) ⇒ Sequel
constructor
A new instance of Sequel.
- #last(force_reload: false) ⇒ Object
Constructor Details
#initialize(transition_class, parent_model, observer, options = {}) ⇒ Sequel
6 7 8 9 10 |
# File 'lib/statesman/adapters/sequel.rb', line 6 def initialize(transition_class, parent_model, observer, ={}) @transition_class = transition_class @parent_model = parent_model @observer = observer end |
Instance Attribute Details
#observer ⇒ Object (readonly)
Returns the value of attribute observer.
4 5 6 |
# File 'lib/statesman/adapters/sequel.rb', line 4 def observer @observer end |
#parent_model ⇒ Object (readonly)
Returns the value of attribute parent_model.
4 5 6 |
# File 'lib/statesman/adapters/sequel.rb', line 4 def parent_model @parent_model end |
#transition_class ⇒ Object (readonly)
Returns the value of attribute transition_class.
4 5 6 |
# File 'lib/statesman/adapters/sequel.rb', line 4 def transition_class @transition_class end |
Instance Method Details
#create(from, to, metadata = {}) ⇒ Object
12 13 14 15 16 |
# File 'lib/statesman/adapters/sequel.rb', line 12 def create(from, to, = {}) create_transition(from.to_s, to.to_s, ) ensure @last_transition = nil end |
#history ⇒ Object
18 19 20 |
# File 'lib/statesman/adapters/sequel.rb', line 18 def history history_dataset.all end |
#last(force_reload: false) ⇒ Object
22 23 24 25 |
# File 'lib/statesman/adapters/sequel.rb', line 22 def last(force_reload: false) @last_transition = nil if force_reload @last_transition ||= history_dataset.last end |