Class: Circle
- Inherits:
-
Object
- Object
- Circle
- Defined in:
- lib/classes.rb
Instance Method Summary collapse
-
#initialize(circle_length) ⇒ Circle
constructor
A new instance of Circle.
- #radius_by_length ⇒ Object
- #square ⇒ Object
Constructor Details
#initialize(circle_length) ⇒ Circle
Returns a new instance of Circle.
154 155 156 |
# File 'lib/classes.rb', line 154 def initialize(circle_length) @circle_length = circle_length end |
Instance Method Details
#radius_by_length ⇒ Object
158 159 160 |
# File 'lib/classes.rb', line 158 def radius_by_length @circle_length / (2 * 3.14) end |
#square ⇒ Object
162 163 164 |
# File 'lib/classes.rb', line 162 def square ((radius_by_length**2) * 3.14).round(4) end |