Sha256: c526f77bef914a5e61baef9a1f142607a9312949b1b587e75f836d28b9653e5f

Contents?: true

Size: 853 Bytes

Versions: 3

Compression:

Stored size: 853 Bytes

Contents

# encoding: utf-8

module FiniteMachine
  # A class representing a callback transition event
  #
  # Used internally by {Observer}
  #
  # @api private
  class TransitionEvent
    include Threadable

    # This event from state name
    #
    # @return [Object]
    #
    # @api public
    attr_threadsafe :from

    # This event to state name
    #
    # @return [Object]
    #
    # @api public
    attr_threadsafe :to

    # This event name
    #
    # @api public
    attr_threadsafe :name

    # Build a transition event
    #
    # @param [FiniteMachine::Transition] transition
    #
    # @return [self]
    #
    # @api private
    def initialize(transition, *data)
      @name = transition.name
      @from = transition.latest_from_state
      @to   = transition.to_state(*data)
      freeze
    end
  end # TransitionEvent
end # FiniteMachine

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
finite_machine-0.10.2 lib/finite_machine/transition_event.rb
finite_machine-0.10.1 lib/finite_machine/transition_event.rb
finite_machine-0.10.0 lib/finite_machine/transition_event.rb