Class: Aqueductron::JointPiece
- Inherits:
-
Object
- Object
- Aqueductron::JointPiece
- Includes:
- PieceCommon
- Defined in:
- lib/aqueductron/joint_piece.rb
Instance Method Summary collapse
- #eof ⇒ Object
-
#initialize(paths) ⇒ JointPiece
constructor
A new instance of JointPiece.
- #receive(msg) ⇒ Object
Methods included from PieceCommon
Constructor Details
#initialize(paths) ⇒ JointPiece
Returns a new instance of JointPiece.
6 7 8 |
# File 'lib/aqueductron/joint_piece.rb', line 6 def initialize(paths) @paths = paths end |
Instance Method Details
#eof ⇒ Object
21 22 23 24 25 |
# File 'lib/aqueductron/joint_piece.rb', line 21 def eof go = ->(v) { v.result? ? v : v.eof } new_map = @paths.map_values(&go) construct_compound_result(new_map) end |
#receive(msg) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/aqueductron/joint_piece.rb', line 11 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 |