lib/statemachine/state.rb in MINT-statemachine-1.2.2 vs lib/statemachine/state.rb in MINT-statemachine-1.2.3

- old
+ new

@@ -1,11 +1,11 @@ module Statemachine class State #:nodoc: - attr_reader :id, :statemachine - attr_accessor :entry_action, :exit_action, :superstate + attr_reader :statemachine + attr_accessor :id, :entry_action, :exit_action, :superstate attr_writer :default_transition def initialize(id, superstate, state_machine) @id = id @superstate = superstate @@ -19,13 +19,13 @@ def transitions return @superstate ? @transitions.merge(@superstate.transitions) : @transitions end - def non_default_transition_for(event) + def non_default_transition_for(event,check_superstates = true) transition = @transitions[event] - if @superstate + if check_superstates and @superstate transition = @superstate.non_default_transition_for(event) if @superstate and @superstate.is_parallel == false and not transition end return transition end @@ -33,12 +33,12 @@ return @default_transition if @default_transition return @superstate.default_transition if @superstate return nil end - def transition_for(event) - transition = non_default_transition_for(event) + def transition_for(event,check_superstate=true) + transition = non_default_transition_for(event,check_superstate) transition = default_transition if not transition return transition end def exit(args) @@ -56,15 +56,14 @@ @statemachine.invoke_action(@entry_action, args, "entry action for #{self}", messenger, message_queue) if @entry_action end def activate @statemachine.state = self - if (@statemachine.is_parallel) - @statemachine.activation.call(self.id,@statemachine.is_parallel.abstract_states,@statemachine.is_parallel.statemachine.states_id) if @statemachine.activation - else - - @statemachine.activation.call(self.id,@statemachine.abstract_states,@statemachine.states_id) if @statemachine.activation - end + # if (@statemachine.is_parallel) + # @statemachine.activation.call(self.id,@statemachine.is_parallel.abstract_states,@statemachine.is_parallel.statemachine.states_id) if @statemachine.activation + #else + @statemachine.activation.call(self.id,@statemachine.abstract_states,@statemachine.states_id) if @statemachine.activation + # end end def concrete? return true end