Class: Hexflex::Side

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Side

make a new side of a hexaflexagon

Parameters:

  • opts (Hash) (defaults to: {})

    options hash with properties for new side

Options Hash (opts):

  • :face (Mixed)

    the fill of the triangle, can be a symbol, string, or hex number representing a color



11
12
13
14
15
16
# File 'lib/hexflex/side.rb', line 11

def initialize(opts = {})
  self.fill = opts[:fill]
  self.triangles = Array.new(6) do |index|
    Triangle.new(fill: fill, index: index)
  end
end

Instance Attribute Details

#fillObject

Returns the value of attribute fill.



5
6
7
# File 'lib/hexflex/side.rb', line 5

def fill
  @fill
end

#trianglesObject

Returns the value of attribute triangles.



5
6
7
# File 'lib/hexflex/side.rb', line 5

def triangles
  @triangles
end