Class: Flows::SharedContextPipeline::TrackList Private
- Inherits:
-
Object
- Object
- Flows::SharedContextPipeline::TrackList
- Defined in:
- lib/flows/shared_context_pipeline/track_list.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #current_track ⇒ Object readonly private
Instance Method Summary collapse
- #add_step(step) ⇒ Object private
- #first_step_name ⇒ Object private
-
#initialize ⇒ TrackList
constructor
private
A new instance of TrackList.
- #initialize_dup(_other) ⇒ Object private
- #main_track_empty? ⇒ Boolean private
- #switch_track(track_name) ⇒ Object private
- #to_flow(method_source) ⇒ Object private
- #to_node_map(method_source) ⇒ Object private
Constructor Details
#initialize ⇒ TrackList
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of TrackList.
7 8 9 10 |
# File 'lib/flows/shared_context_pipeline/track_list.rb', line 7 def initialize @tracks = { main: Track.new(:main) } @current_track = :main end |
Instance Attribute Details
#current_track ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
5 6 7 |
# File 'lib/flows/shared_context_pipeline/track_list.rb', line 5 def current_track @current_track end |
Instance Method Details
#add_step(step) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
21 22 23 |
# File 'lib/flows/shared_context_pipeline/track_list.rb', line 21 def add_step(step) @tracks[@current_track].add_step(step) end |
#first_step_name ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
25 26 27 |
# File 'lib/flows/shared_context_pipeline/track_list.rb', line 25 def first_step_name @tracks[:main].first_step_name end |
#initialize_dup(_other) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
12 13 14 |
# File 'lib/flows/shared_context_pipeline/track_list.rb', line 12 def initialize_dup(_other) @tracks = @tracks.transform_values(&:dup) end |
#main_track_empty? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
29 30 31 |
# File 'lib/flows/shared_context_pipeline/track_list.rb', line 29 def main_track_empty? @tracks[:main].empty? end |
#switch_track(track_name) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
16 17 18 19 |
# File 'lib/flows/shared_context_pipeline/track_list.rb', line 16 def switch_track(track_name) @tracks[track_name] ||= Track.new(track_name) @current_track = track_name end |
#to_flow(method_source) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
41 42 43 44 45 46 47 48 |
# File 'lib/flows/shared_context_pipeline/track_list.rb', line 41 def to_flow(method_source) raise NoStepsError, method_source if main_track_empty? Flows::Flow.new( start_node: first_step_name, node_map: to_node_map(method_source) ) end |
#to_node_map(method_source) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
33 34 35 36 37 38 39 |
# File 'lib/flows/shared_context_pipeline/track_list.rb', line 33 def to_node_map(method_source) @tracks.reduce({}) do |node_map, (_, track)| node_map.merge!( track.to_node_map(method_source) ) end end |