Class Statemachine::StatemachineBuilder
In: lib/statemachine/builder.rb
Parent: Builder

Created by Statemachine.build as the root context for building the statemachine.

Methods

context   new  

Included Modules

SuperstateBuilding

Public Class methods

[Source]

     # File lib/statemachine/builder.rb, line 239
239:     def initialize(statemachine = Statemachine.new)
240:       super statemachine
241:       @subject = @statemachine.root
242:     end

Public Instance methods

Used the set the context of the statemahine within the builder.

  sm = Statemachine.build do
    ...
    context MyContext.new
  end

Statemachine.context may also be used.

[Source]

     # File lib/statemachine/builder.rb, line 252
252:     def context(a_context)
253:       @statemachine.context = a_context
254:       a_context.statemachine = @statemachine if a_context.respond_to?(:statemachine=)
255:     end

[Validate]