Module: StateManager::Resource::InstanceMethods
- Defined in:
- lib/state_manager/resource.rb
Instance Method Summary collapse
- #initialize(*args) ⇒ Object
-
#validate_states! ⇒ Object
Ensures that all properties with state managers are in valid states.
Instance Method Details
#initialize(*args) ⇒ Object
68 69 70 71 |
# File 'lib/state_manager/resource.rb', line 68 def initialize(*args) super self.state_managers ||= {} end |
#validate_states! ⇒ Object
Ensures that all properties with state managers are in valid states
74 75 76 77 78 79 80 81 82 |
# File 'lib/state_manager/resource.rb', line 74 def validate_states! self.class.state_managers.each do |name, klass| # Simply ensuring that all of the state managers have been # instantiated will make the corresponding states valid unless state_managers[name] state_managers[name] = klass.new(self) end end end |