class States::Dsl::StateMachine

Attributes

states[R]

Public Class Methods

new(options) click to toggle source
Calls superclass method States::Dsl::ExecutionContext::new
# File lib/states/dsl/state_machine.rb, line 6
def initialize(options)
  super(nil, options)
end

Public Instance Methods

comment(comment) click to toggle source
# File lib/states/dsl/state_machine.rb, line 16
def comment(comment)
  @comment = comment
end
serializable_hash() click to toggle source
# File lib/states/dsl/state_machine.rb, line 20
def serializable_hash
  h = super
  h["Comment"] = @comment if @comment
  h
end
to_json() click to toggle source
# File lib/states/dsl/state_machine.rb, line 26
def to_json
  JSON.pretty_generate(serializable_hash)
end
trait(name, options={}, &block) click to toggle source
# File lib/states/dsl/state_machine.rb, line 10
def trait(name, options={}, &block)
  trait = Trait.new(options, context)
  trait.instance_eval(&block)
  @context.register_trait(name, trait)
end