Closed charlierudolph closed 8 years ago
What would be the benefit of not delegating?
Allows you to use a standalone state machine. I would imagine it making testing simpler and would allow it to be used in more places. I'll close if you don't agree.
So all the machine needs to function is an object that has an attribute state
(changable using the state_attribute
macro).
So if you just wanted a "standalone state machine" then just hand it something that it wants:
machine = MyMachine.new(OpenStruct.new(state: :idle))
Then you can use the machine all you want.
Or am I missing something else about this issue?
Closing as the guard / actions / concluders all get passed the delegated object so this wouldn't make sense.
I think it would be nice if you could use this without being a delegate.
The decorator works as a delegator adding the machines methods (through method missing). And the initializer simply returns the machine.