Class: Smith::Workflow::Graph::Targets
- Inherits:
-
Object
- Object
- Smith::Workflow::Graph::Targets
- Defined in:
- lib/smith/workflow/graph/targets.rb
Instance Attribute Summary collapse
-
#transition ⇒ Object
readonly
Returns the value of attribute transition.
Class Method Summary collapse
Instance Method Summary collapse
- #deterministic_route_names ⇒ Object
-
#initialize(transition) ⇒ Targets
constructor
A new instance of Targets.
- #names ⇒ Object
- #router_names ⇒ Object
Constructor Details
#initialize(transition) ⇒ Targets
Returns a new instance of Targets.
17 18 19 |
# File 'lib/smith/workflow/graph/targets.rb', line 17 def initialize(transition) @transition = transition end |
Instance Attribute Details
#transition ⇒ Object (readonly)
Returns the value of attribute transition.
7 8 9 |
# File 'lib/smith/workflow/graph/targets.rb', line 7 def transition @transition end |
Class Method Details
.for(transition) ⇒ Object
9 10 11 |
# File 'lib/smith/workflow/graph/targets.rb', line 9 def self.for(transition) new(transition).names end |
.router_for(transition) ⇒ Object
13 14 15 |
# File 'lib/smith/workflow/graph/targets.rb', line 13 def self.router_for(transition) new(transition).router_names end |
Instance Method Details
#deterministic_route_names ⇒ Object
37 38 39 |
# File 'lib/smith/workflow/graph/targets.rb', line 37 def deterministic_route_names transition.deterministic_routes || [] end |
#names ⇒ Object
21 22 23 24 25 26 |
# File 'lib/smith/workflow/graph/targets.rb', line 21 def names names = [transition.success_transition, transition.failure_transition] names.concat(router_names) names.concat(deterministic_route_names) names.compact.uniq end |
#router_names ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/smith/workflow/graph/targets.rb', line 28 def router_names return [] unless transition.router_config [ *transition.router_config.fetch(:routes).values, transition.router_config.fetch(:fallback) ] end |