class Geometry::Rectangle

Attributes

length[RW]
width[RW]

Public Class Methods

new(length, width) click to toggle source
# File lib/gemometry.rb, line 43
def initialize(length, width)
  @length = length.to_f
  @width = width.to_f
end

Public Instance Methods

area() click to toggle source
# File lib/gemometry.rb, line 52
def area
  @length * @width
end
perimeter() click to toggle source
# File lib/gemometry.rb, line 48
def perimeter
  2 * (@length + @width)
end