Class: EndState::Action

Inherits:
Object
  • Object
show all
Defined in:
lib/end_state/action.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, state) ⇒ Action

Returns a new instance of Action.



5
6
7
8
# File 'lib/end_state/action.rb', line 5

def initialize(object, state)
  @object = object
  @state = state
end

Instance Attribute Details

#objectObject (readonly)

Returns the value of attribute object.



3
4
5
# File 'lib/end_state/action.rb', line 3

def object
  @object
end

#stateObject (readonly)

Returns the value of attribute state.



3
4
5
# File 'lib/end_state/action.rb', line 3

def state
  @state
end

Instance Method Details

#callObject



10
11
12
13
# File 'lib/end_state/action.rb', line 10

def call
  object.state = object.class.store_states_as_strings ? state.to_s : state.to_sym
  true
end

#rollbackObject



15
16
17
# File 'lib/end_state/action.rb', line 15

def rollback
  call
end