Class: Yasm::Context::StateContainer

Inherits:
Object
  • Object
show all
Defined in:
lib/yasm/context/state_container.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ StateContainer

Returns a new instance of StateContainer.



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

def initialize(options)
  @context = options[:context]
  @state   = options[:state]
end

Instance Attribute Details

#contextObject

Returns the value of attribute context.



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

def context
  @context
end

#stateObject

:nodoc:



5
6
7
# File 'lib/yasm/context/state_container.rb', line 5

def state
  @state
end

Instance Method Details

#do!(*actions) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/yasm/context/state_container.rb', line 22

def do!(*actions)
  actions = [self.state.class.maximum_duration_action] + actions if self.state.passed_maximum_time_limit?

  Yasm::Manager.execute(
    :context => context, 
    :state_container => self,
    :actions => actions
  )
end

#valueObject



12
# File 'lib/yasm/context/state_container.rb', line 12

def value; @state; end