Module: Trailblazer::Activity::DSL::Linear::Search
- Defined in:
- lib/trailblazer/activity/dsl/linear.rb
Overview
Sequence
Class Method Summary collapse
-
.ById(output, id) ⇒ Object
Find the seq_row with id and connect the current node to it.
-
.Forward(output, target_color) ⇒ Object
From this task onwards, find the next task that’s “magnetic to” target_color.
- .Noop(output) ⇒ Object
Class Method Details
.ById(output, id) ⇒ Object
Find the seq_row with id and connect the current node to it.
64 65 66 67 68 69 70 71 |
# File 'lib/trailblazer/activity/dsl/linear.rb', line 64 def ById(output, id) ->(sequence, me) do index = Insert.find_index(sequence, id) or return output, sequence[0] # FIXME # or raise "Couldn't find {#{id}}" target_seq_row = sequence[index] return output, target_seq_row end end |
.Forward(output, target_color) ⇒ Object
From this task onwards, find the next task that’s “magnetic to” target_color. Note that we only go forward, no back-references are done here.
49 50 51 52 53 54 55 |
# File 'lib/trailblazer/activity/dsl/linear.rb', line 49 def Forward(output, target_color) ->(sequence, me) do target_seq_row = sequence[sequence.index(me)+1..-1].find { |seq_row| seq_row[0] == target_color } return output, target_seq_row end end |
.Noop(output) ⇒ Object
57 58 59 60 61 |
# File 'lib/trailblazer/activity/dsl/linear.rb', line 57 def Noop(output) ->(sequence, me) do return output, [nil,nil,nil,{}] # FIXME end end |