Class: Hexflex::Hexaflexagon

Inherits:
Object
  • Object
show all
Defined in:
lib/hexflex/hexaflexagon.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(side_fills) ⇒ Hexaflexagon

Returns a new instance of Hexaflexagon.



8
9
10
11
12
13
# File 'lib/hexflex/hexaflexagon.rb', line 8

def initialize(side_fills)
  @raw_fills = side_fills
  @sides = Array.new(3) do |index|
    Side.new(fill: side_fills[index])
  end
end

Instance Attribute Details

#sidesObject

Returns the value of attribute sides.



6
7
8
# File 'lib/hexflex/hexaflexagon.rb', line 6

def sides
  @sides
end

Instance Method Details

#trianglesObject



15
16
17
# File 'lib/hexflex/hexaflexagon.rb', line 15

def triangles
  self.sides.map(&:triangles).flatten
end