class EnumStateMachine::Integrations::ActiveModel::ObserverUpdate
Represents the encapsulation of all of the details to be included in an update to state machine observers. This allows multiple arguments to get passed to an observer method (instead of just a single object
) while still respecting the way in which ActiveModel
checks for the object's list of observers.
Attributes
The method to invoke on the observer
The object being transitioned
The transition being run
Public Instance Methods
The arguments to pass into the method
# File lib/enum_state_machine/integrations/active_model/observer_update.rb 24 def args 25 [object, transition] 26 end
The class of the object being transitioned. Normally the object getting passed into observer methods is the actual instance of the ActiveModel
class. ActiveModel
uses that instance's class to check for enabled / disabled observers.
Since state_machine is passing an ObserverUpdate
instance into observer methods, class
needs to be overridden so that ActiveModel
can still get access to the enabled / disabled observers.
# File lib/enum_state_machine/integrations/active_model/observer_update.rb 36 def class 37 object.class 38 end