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
-
#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
#names ⇒ Object
21 22 23 24 25 |
# File 'lib/smith/workflow/graph/targets.rb', line 21 def names names = [transition.success_transition, transition.failure_transition] names.concat(router_names) names.compact.uniq end |
#router_names ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/smith/workflow/graph/targets.rb', line 27 def router_names return [] unless transition.router_config [ *transition.router_config.fetch(:routes).values, transition.router_config.fetch(:fallback) ] end |