class Rectangle::Rectangle

Represents some rectangular area

Attributes

height[R]
width[R]

Public Class Methods

new(width, height) click to toggle source
# File lib/rectangle.rb, line 8
def initialize width, height
  @width = width
  @height = height
end

Public Instance Methods

==(other) click to toggle source
# File lib/rectangle.rb, line 13
def == other
  other.width == width && other.height == height
end
area() click to toggle source
# File lib/rectangle.rb, line 17
def area
  width * height
end
perimeter() click to toggle source
# File lib/rectangle.rb, line 21
def perimeter
  2 * (width + height)
end