-
-
Save hassox/08453296ebd63a3bd8dd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Defines an initialization hook into the owner class for setting the | |
# initial state of the machine *before* any attributes are set on the | |
# object | |
def define_state_initializer | |
@instance_helper_module.class_eval <<-end_eval, __FILE__, __LINE__ | |
def initialize(attributes = {}, *args) | |
ignore = attributes ? attributes.keys : [] | |
initialize_state_machines(:dynamic => false, :ignore => ignore) | |
super | |
initialize_state_machines(:dynamic => true, :ignore => ignore) | |
end | |
end_eval | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment