Class: Aqueductron::EndPiece

Inherits:
Object
  • Object
show all
Includes:
PieceCommon
Defined in:
lib/aqueductron/end_piece.rb

Instance Method Summary collapse

Methods included from PieceCommon

#flow, #result?

Constructor Details

#initialize(monoid, so_far = :no_value) ⇒ EndPiece

Returns a new instance of EndPiece.



7
8
9
10
# File 'lib/aqueductron/end_piece.rb', line 7

def initialize(monoid, so_far = :no_value)
  @monoid = monoid
  @so_far = (so_far == :no_value) ? monoid.zero : so_far
end

Instance Method Details

#eofObject



12
13
14
# File 'lib/aqueductron/end_piece.rb', line 12

def eof
  SimpleResult.new(@so_far)
end

#receive(msg) ⇒ Object



16
17
18
# File 'lib/aqueductron/end_piece.rb', line 16

def receive msg
  EndPiece.new(@monoid, @monoid.append(@so_far, msg))
end