Class: Mocha::StateMachine::State

Inherits:
Object
  • Object
show all
Defined in:
lib/mocha/state_machine.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(state_machine, state) ⇒ State

Returns a new instance of State.



9
10
11
# File 'lib/mocha/state_machine.rb', line 9

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

Instance Method Details

#activateObject



13
14
15
# File 'lib/mocha/state_machine.rb', line 13

def activate
  @state_machine.current_state = @state
end

#active?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/mocha/state_machine.rb', line 17

def active?
  @state_machine.current_state == @state
end

#mocha_inspectObject



21
22
23
# File 'lib/mocha/state_machine.rb', line 21

def mocha_inspect
  "#{@state_machine.name} is #{@state.mocha_inspect}"
end