Module: Progressive::Subject::ClassMethods

Defined in:
lib/progressive/subject.rb

Instance Method Summary collapse

Instance Method Details

#states(options = {}, &block) ⇒ Object

Public: Define the different states and events the subject can go through.

options - The Hash options used to build the specification (default: {}):

:default - The default state the subject is instantiated at (optional).

block - A required block that is used to define states and events for

the subject.

Returns Progression::Specification



24
25
26
27
# File 'lib/progressive/subject.rb', line 24

def states(options = {}, &block)
  self.specification = Specification.new(options, &block)
  define_model_callbacks(*specification.event_names, only: [:before, :after])
end