Class: Celluloid::FSM::State

### Home Classes Methods

### In Files

- lib/celluloid/fsm.rb

### Parent

Object

### Methods

- ::new
- #call
- #valid_transition?

### Class/Module Index

Quicksearch

- Celluloid
- Celluloid::FSM
- Celluloid::FSM::ClassMethods
- Celluloid::FSM::State
- Celluloid::FSM::UnattachedError

No matching classes.

# Celluloid::FSM::State

FSM states as declared by Celluloid::FSM.state

### Attributes

name[R]
transitions[R]

### Public Class Methods

new(name, transitions = nil, &block) click to toggle source

    # File lib/celluloid/fsm.rb, line 169
    def initialize(name, transitions = nil, &block)
      @name, @block = name, block
      @transitions = nil
      @transitions = Array(transitions).map(&:to_sym) if transitions
    end

### Public Instance Methods

call(obj) click to toggle source

    # File lib/celluloid/fsm.rb, line 175
    def call(obj)
      obj.instance_eval(&@block) if @block
    end

valid_transition?(new_state) click to toggle source

    # File lib/celluloid/fsm.rb, line 179
    def valid_transition?(new_state)
      # All transitions are allowed unless expressly
      return true unless @transitions

      @transitions.include? new_state.to_sym
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.