Class: Pentagon

Inherits:
Polygon show all
Includes:
Math
Defined in:
lib/shapedoc.rb

Overview

Regular Pentagon

Instance Attribute Summary collapse

Attributes inherited from Polygon

#sides

Instance Method Summary collapse

Methods inherited from Polygon

#perimeter

Constructor Details

#initialize(side) ⇒ Pentagon

Returns a new instance of Pentagon.



96
# File 'lib/shapedoc.rb', line 96

def initialize(side); @side = side; end

Instance Attribute Details

#sideObject (readonly)

Returns the value of attribute side.



95
96
97
# File 'lib/shapedoc.rb', line 95

def side
  @side
end

Instance Method Details

#_sidesObject



97
# File 'lib/shapedoc.rb', line 97

def _sides; 5; end

#areaObject



99
# File 'lib/shapedoc.rb', line 99

def area; (5* @side ** 2 * tan(54))/4; end

#diagramObject

Displays a pentagon



98
# File 'lib/shapedoc.rb', line 98

def diagram; "\u2b20"; end