Class: Hexflex::Hexaflexagon
- Inherits:
-
Object
- Object
- Hexflex::Hexaflexagon
- Defined in:
- lib/hexflex/hexaflexagon.rb
Instance Attribute Summary collapse
-
#sides ⇒ Object
Returns the value of attribute sides.
Instance Method Summary collapse
-
#initialize(side_fills) ⇒ Hexaflexagon
constructor
A new instance of Hexaflexagon.
- #triangles ⇒ Object
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
#sides ⇒ Object
Returns the value of attribute sides.
6 7 8 |
# File 'lib/hexflex/hexaflexagon.rb', line 6 def sides @sides end |
Instance Method Details
#triangles ⇒ Object
15 16 17 |
# File 'lib/hexflex/hexaflexagon.rb', line 15 def triangles self.sides.map(&:triangles).flatten end |