Class: Circle

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

Instance Method Summary collapse

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_lengthObject



158
159
160
# File 'lib/classes.rb', line 158

def radius_by_length
  @circle_length / (2 * 3.14)
end

#squareObject



162
163
164
# File 'lib/classes.rb', line 162

def square
  ((radius_by_length**2) * 3.14).round(4)
end