module StateManager::Resource::InstanceMethods

Public Class Methods

new(*args) click to toggle source
Calls superclass method
# File lib/state_manager/resource.rb, line 68
def initialize(*args)
  super
  self.state_managers ||= {}
end

Public Instance Methods

validate_states!() click to toggle source

Ensures that all properties with state managers are in valid states

# 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