Class: Geometry::Rectangle
- Inherits:
-
Object
- Object
- Geometry::Rectangle
- Defined in:
- lib/geometrize.rb
Overview
end class triangle
Instance Attribute Summary collapse
-
#d ⇒ Object
Returns the value of attribute d.
-
#e ⇒ Object
Returns the value of attribute e.
Instance Method Summary collapse
- #area ⇒ Object
-
#initialize(d, e) ⇒ Rectangle
constructor
A new instance of Rectangle.
- #perimeter ⇒ Object
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
#d ⇒ Object
Returns the value of attribute d.
43 44 45 |
# File 'lib/geometrize.rb', line 43 def d @d end |
#e ⇒ Object
Returns the value of attribute e.
43 44 45 |
# File 'lib/geometrize.rb', line 43 def e @e end |
Instance Method Details
#area ⇒ Object
54 55 56 |
# File 'lib/geometrize.rb', line 54 def area @d * @e end |
#perimeter ⇒ Object
50 51 52 |
# File 'lib/geometrize.rb', line 50 def perimeter 2 * (@d + @e) end |