Class: PolymorphicShape::Circle
- Defined in:
- lib/shape/polymorphic_shape/circle.rb
Constant Summary collapse
- PI =
3.14
Instance Attribute Summary collapse
-
#radius ⇒ Object
Returns the value of attribute radius.
Instance Method Summary collapse
- #area ⇒ Object
-
#initialize(radius) ⇒ Circle
constructor
A new instance of Circle.
Constructor Details
#initialize(radius) ⇒ Circle
Returns a new instance of Circle.
5 6 7 |
# File 'lib/shape/polymorphic_shape/circle.rb', line 5 def initialize(radius) @radius = radius end |
Instance Attribute Details
#radius ⇒ Object
Returns the value of attribute radius.
4 5 6 |
# File 'lib/shape/polymorphic_shape/circle.rb', line 4 def radius @radius end |
Instance Method Details
#area ⇒ Object
9 10 11 |
# File 'lib/shape/polymorphic_shape/circle.rb', line 9 def area (@radius * @radius) * PI end |