module Progressive::Subject::ClassMethods
Public Instance Methods
specification()
click to toggle source
# File lib/progressive/subject.rb, line 27 def specification Progressive.specifications[name] end
specification=(specification)
click to toggle source
# File lib/progressive/subject.rb, line 23 def specification=(specification) Progressive.specifications[name] = specification end
states(options = {}, &block)
click to toggle source
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
# File lib/progressive/subject.rb, line 18 def states(options = {}, &block) self.specification = Specification.new(options, &block) define_model_callbacks(*specification.event_names, only: [:before, :after]) end