Class: RailsWorkflow::DependencyResolver
- Inherits:
-
Object
- Object
- RailsWorkflow::DependencyResolver
- Defined in:
- lib/rails_workflow/dependency_resolver.rb
Overview
DependencyResolver
New operation can be added to process if all it’s dependencies are satisfied. For example current operation can depend on some existing process operation which should be completed - then current operation can be build
Instance Attribute Summary collapse
-
#process ⇒ Object
Returns the value of attribute process.
Instance Method Summary collapse
- #build_new_operations(operation) ⇒ Object
-
#initialize(process) ⇒ DependencyResolver
constructor
A new instance of DependencyResolver.
Constructor Details
#initialize(process) ⇒ DependencyResolver
Returns a new instance of DependencyResolver.
15 16 17 |
# File 'lib/rails_workflow/dependency_resolver.rb', line 15 def initialize(process) @process = process end |
Instance Attribute Details
#process ⇒ Object
Returns the value of attribute process.
11 12 13 |
# File 'lib/rails_workflow/dependency_resolver.rb', line 11 def process @process end |
Instance Method Details
#build_new_operations(operation) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/rails_workflow/dependency_resolver.rb', line 19 def build_new_operations(operation) [].tap do |new_operations| matched_templates(operation).each do |operation_template| completed_dependencies = [operation] new_operations << operation_builder.new( process, operation_template, completed_dependencies ).create_operation end end.compact rescue => exception handle_exception(exception, operation) end |