Class: Geometry::Rectangle

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

Overview

end class triangle

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(d, e) ⇒ Rectangle

Returns a new instance of Rectangle.



45
46
47
48
# File 'lib/geometrize.rb', line 45

def initialize(d,e)
  @d = d
  @e = e
end

Instance Attribute Details

#dObject

Returns the value of attribute d.



43
44
45
# File 'lib/geometrize.rb', line 43

def d
  @d
end

#eObject

Returns the value of attribute e.



43
44
45
# File 'lib/geometrize.rb', line 43

def e
  @e
end

Instance Method Details

#areaObject



54
55
56
# File 'lib/geometrize.rb', line 54

def area
  @d * @e
end

#perimeterObject



50
51
52
# File 'lib/geometrize.rb', line 50

def perimeter
  2 * (@d + @e)
end