Class: AasmHistory::HistoryCreator
- Inherits:
-
Object
- Object
- AasmHistory::HistoryCreator
- Defined in:
- lib/aasm_history/history_creator.rb
Instance Method Summary collapse
- #attributes ⇒ Object
- #create ⇒ Object
-
#initialize(object, state, previous_state) ⇒ HistoryCreator
constructor
A new instance of HistoryCreator.
- #klass ⇒ Object
Constructor Details
#initialize(object, state, previous_state) ⇒ HistoryCreator
Returns a new instance of HistoryCreator.
3 4 5 6 7 |
# File 'lib/aasm_history/history_creator.rb', line 3 def initialize object, state, previous_state @object = object @state = state @previous_state = previous_state end |
Instance Method Details
#attributes ⇒ Object
17 18 19 |
# File 'lib/aasm_history/history_creator.rb', line 17 def attributes {state: @state, previous_state: @previous_state, stateable: @object} end |
#create ⇒ Object
9 10 11 |
# File 'lib/aasm_history/history_creator.rb', line 9 def create klass.create! attributes end |
#klass ⇒ Object
13 14 15 |
# File 'lib/aasm_history/history_creator.rb', line 13 def klass @klass ||= AASM::StateMachine[@object.class].config.history_class.constantize end |