Class: LcpRuby::Workflow::StaticSource
- Inherits:
-
Object
- Object
- LcpRuby::Workflow::StaticSource
- Includes:
- Contract
- Defined in:
- lib/lcp_ruby/workflow/static_source.rb
Instance Method Summary collapse
-
#initialize(workflow_definitions) ⇒ StaticSource
constructor
A new instance of StaticSource.
- #workflow_by_name(name) ⇒ Object
- #workflows_for(model_name) ⇒ Object
Constructor Details
#initialize(workflow_definitions) ⇒ StaticSource
Returns a new instance of StaticSource.
6 7 8 9 |
# File 'lib/lcp_ruby/workflow/static_source.rb', line 6 def initialize(workflow_definitions) @definitions = workflow_definitions || {} @by_model = @definitions.values.group_by(&:model) end |
Instance Method Details
#workflow_by_name(name) ⇒ Object
15 16 17 |
# File 'lib/lcp_ruby/workflow/static_source.rb', line 15 def workflow_by_name(name) @definitions[name.to_s] end |
#workflows_for(model_name) ⇒ Object
11 12 13 |
# File 'lib/lcp_ruby/workflow/static_source.rb', line 11 def workflows_for(model_name) @by_model[model_name.to_s] || [] end |