nested machines

3 views
Skip to first unread message

umuro

unread,
Sep 26, 2009, 1:51:41 PM9/26/09
to state-fu
I am new to using this library. I see the nested? and child? messages.
A brief example on nested states would be nice.

David Lee

unread,
Sep 27, 2009, 6:51:15 AM9/27/09
to stat...@googlegroups.com
Hi umuro,

It sounds like you're talking about the methods inside the Lathe class. The nesting it is referring to is that a new Lathe object is created for each level of nesting in the machine definition block; this isn't something you'd ordinarily need to worry about (and in fact, more of those methods should probably be private or protected).

A lathe / block is #nested? if it is not the outermost block for a state machine - e.g., it's a #state or #event block. Many of Lathe's methods are valid only in certain kinds of blocks (for example, you can only use #on_entry inside a state block). The private method #valid_in_context is used to describe these restrictions: if you look at #on_entry you'll see it's "valid_in_context State" - but rather than digging through the source / RDoc for the Lathe class, I suggest you take a look at the examples in state_fu_spec.rb, which has a number of examples which should (hopefully) show you how to use the library.

Hope this helps.

best regards,
David


On Sun, Sep 27, 2009 at 3:51 AM, umuro <umur....@gmail.com> wrote:

I am new to using this library. I see the nested? and child? messages.
A brief example on nested states would be nice.




--
cheers,
David Lee
Reply all
Reply to author
Forward
0 new messages