Class: Aqueductron::Duct

Inherits:
Object
  • Object
show all
Includes:
Buildering
Defined in:
lib/aqueductron/duct.rb

Instance Method Summary collapse

Methods included from Buildering

#answer, #count, #custom, #expand, expand_function, filter_function, #keeping, #last, map_function, #partition, #split, #take, take_function, #through

Constructor Details

#initialize(things_so_far = []) ⇒ Duct

Returns a new instance of Duct.



6
7
8
# File 'lib/aqueductron/duct.rb', line 6

def initialize(things_so_far = [])
  @do_these_things = things_so_far
end

Instance Method Details

#answer_int(piece) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/aqueductron/duct.rb', line 14

def answer_int(piece)
  if (@do_these_things.empty?)
    piece
  else
    answer_int(Piece.new(piece, @do_these_things.pop))
  end
end

#attach(piece) ⇒ Object



10
11
12
# File 'lib/aqueductron/duct.rb', line 10

def attach(piece)
  Duct.new(@do_these_things + [piece])
end