Sha256: 2625507e56bd0bee34f9aac1c1d0ca9d61b10b656451f2206a96d35ef666a2c7

Contents?: true

Size: 870 Bytes

Versions: 1

Compression:

Stored size: 870 Bytes

Contents

# encoding: utf-8

module FiniteMachine
  # A class representing a callback transition event
  #
  # Used internally by {Observer}
  #
  # @api private
  class TransitionEvent
    # This event from state name
    #
    # @return [Object]
    #
    # @api public
    attr_accessor :from

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

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
finite_machine-0.9.2 lib/finite_machine/transition_event.rb