Sha256: 5756dec2bdba4a8b7531b26b3fd29940d3dfb6855b6527728e65cdab31a60fb4

Contents?: true

Size: 911 Bytes

Versions: 4

Compression:

Stored size: 911 Bytes

Contents

module Statemachine

  class Superstate < State #:nodoc:
  
    attr_accessor :startstate_id
    attr_reader :history_id
  
    def initialize(id, superstate, statemachine)
      super(id, superstate, statemachine)
      @startstate = nil
      @history_id = nil
      @default_history_id = nil
    end
    
    def concrete?
      return false
    end

    def startstate
      return @statemachine.get_state(@startstate_id)
    end

    def resolve_startstate
      return startstate.resolve_startstate
    end

    def substate_exiting(substate)
      @history_id = substate.id
    end
  
    def add_substates(*substate_ids)
      do_substate_adding(substate_ids)
    end
    
    def default_history=(state_id)
      @history_id = @default_history_id = state_id
    end
    
    def reset
      @history_id = @default_history_id
    end

    def to_s
      return "'#{id}' superstate"
    end
  
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
statemachine-2.3.0 lib/statemachine/superstate.rb
statemachine-2.2.0 lib/statemachine/superstate.rb
statemachine-2.1.0 lib/statemachine/superstate.rb
statemachine-2.0.1 lib/statemachine/superstate.rb