Class: Yasm::Context::StateConfiguration

Inherits:
Object
  • Object
show all
Defined in:
lib/yasm/context/state_configuration.rb,
lib/yasm/context/state_configuration/action_hook.rb

Defined Under Namespace

Classes: ActionHook

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(start_state = nil) ⇒ StateConfiguration

Returns a new instance of StateConfiguration.



6
7
8
9
10
# File 'lib/yasm/context/state_configuration.rb', line 6

def initialize(start_state = nil)
  @start_state = start_state
  @after_actions = []
  @before_actions = []
end

Instance Attribute Details

#after_actionsObject (readonly)

Returns the value of attribute after_actions.



4
5
6
# File 'lib/yasm/context/state_configuration.rb', line 4

def after_actions
  @after_actions
end

#before_actionsObject (readonly)

Returns the value of attribute before_actions.



4
5
6
# File 'lib/yasm/context/state_configuration.rb', line 4

def before_actions
  @before_actions
end

#start_stateObject (readonly)

Returns the value of attribute start_state.



4
5
6
# File 'lib/yasm/context/state_configuration.rb', line 4

def start_state
  @start_state
end

Instance Method Details

#after_action(method, options = {}) ⇒ Object



16
17
18
# File 'lib/yasm/context/state_configuration.rb', line 16

def after_action(method, options={})
  @after_actions << ActionHook.new(method, options)
end

#before_action(method, options = {}) ⇒ Object



20
21
22
# File 'lib/yasm/context/state_configuration.rb', line 20

def before_action(method, options={})
  @before_actions << ActionHook.new(method, options)
end

#start(state) ⇒ Object



12
13
14
# File 'lib/yasm/context/state_configuration.rb', line 12

def start(state)
  @start_state = state
end