Module: Workflow
- Defined in:
- lib/workflow.rb,
lib/workflow/draw.rb,
lib/workflow/event.rb,
lib/workflow/state.rb,
lib/workflow/errors.rb,
lib/workflow/version.rb,
lib/workflow/specification.rb,
lib/workflow/event_collection.rb
Overview
See also README for documentation
Defined Under Namespace
Modules: ClassMethods, Draw, InstanceMethods Classes: Error, Event, EventCollection, NoTransitionAllowed, Specification, State, TransitionHalted, WorkflowDefinitionError, WorkflowError
Constant Summary collapse
- VERSION =
"3.1.1"
Class Method Summary collapse
Class Method Details
.included(klass) ⇒ Object
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
# File 'lib/workflow.rb', line 250 def self.included(klass) klass.send :include, InstanceMethods # backup the parent workflow spec, making accessible through #inherited_workflow_spec if klass.superclass.respond_to?(:workflow_spec, true) klass.module_eval do # see http://stackoverflow.com/a/2495650/111995 for implementation explanation pro = Proc.new { klass.superclass.workflow_spec } singleton_class = class << self; self; end singleton_class.send(:define_method, :inherited_workflow_spec) do pro.call end end end klass.extend ClassMethods # Look for a hook; otherwise detect based on ancestor class. if klass.respond_to?(:workflow_adapter) klass.send :include, klass.workflow_adapter end end |