Sha256: 25b99c94714a8b8fa163562a4015a79994e98b328f02babaa200f612856ffb69
Contents?: true
Size: 1.1 KB
Versions: 3
Compression:
Stored size: 1.1 KB
Contents
module Flows class SharedContextPipeline # @api private class TrackList attr_reader :current_track def initialize @tracks = { main: Track.new(:main) } @current_track = :main end def initialize_dup(_other) @tracks = @tracks.transform_values(&:dup) end def switch_track(track_name) @tracks[track_name] ||= Track.new(track_name) @current_track = track_name end def add_step(step) @tracks[@current_track].add_step(step) end def first_step_name @tracks[:main].first_step_name end def main_track_empty? @tracks[:main].empty? end def to_node_map(method_source) @tracks.reduce({}) do |node_map, (_, track)| node_map.merge!( track.to_node_map(method_source) ) end end 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 end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
flows-0.6.0 | lib/flows/shared_context_pipeline/track_list.rb |
flows-0.5.1 | lib/flows/shared_context_pipeline/track_list.rb |
flows-0.5.0 | lib/flows/shared_context_pipeline/track_list.rb |