class Aqueductron::JointPiece

Public Class Methods

new(paths) click to toggle source
# File lib/aqueductron/joint_piece.rb, line 7
def initialize(paths)
  @paths = paths
end

Public Instance Methods

draw() click to toggle source
# File lib/aqueductron/joint_piece.rb, line 29
def draw
  prefix = Drawing.joint_prefix
  ducts = Drawing.draw_multiple_paths(@paths)
  Drawing.horizontal_concat(prefix, ducts)
end
eof() click to toggle source
# File lib/aqueductron/joint_piece.rb, line 22
def eof
  go = ->(v) { v.result? ? v : v.eof }
  new_map = @paths.map_values(&go)
  construct_compound_result(new_map)
end
receive(msg) click to toggle source
# File lib/aqueductron/joint_piece.rb, line 12
def receive(msg)
  go = ->(v) { v.result? ? v : v.receive(msg) }
  new_map = @paths.map_values(&go)
  if (new_map.values.all? &:result? )
    construct_compound_result(new_map)
  else
    JointPiece.new(new_map)
  end
end

Private Instance Methods

construct_compound_result(paths) click to toggle source
# File lib/aqueductron/joint_piece.rb, line 35
def construct_compound_result(paths)
  CompoundResult.new(paths)
end