Class: Pentagon
Overview
Regular Pentagon
Instance Attribute Summary collapse
-
#side ⇒ Object
readonly
Returns the value of attribute side.
Attributes inherited from Polygon
Instance Method Summary collapse
- #_sides ⇒ Object
- #area ⇒ Object
-
#diagram ⇒ Object
Displays a pentagon.
-
#initialize(side) ⇒ Pentagon
constructor
A new instance of Pentagon.
Methods inherited from Polygon
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
#side ⇒ Object (readonly)
Returns the value of attribute side.
95 96 97 |
# File 'lib/shapedoc.rb', line 95 def side @side end |
Instance Method Details
#_sides ⇒ Object
97 |
# File 'lib/shapedoc.rb', line 97 def _sides; 5; end |
#area ⇒ Object
99 |
# File 'lib/shapedoc.rb', line 99 def area; (5* @side ** 2 * tan(54))/4; end |
#diagram ⇒ Object
Displays a pentagon
98 |
# File 'lib/shapedoc.rb', line 98 def diagram; "\u2b20"; end |