Class: Geometry::Rectangle
- Inherits:
-
Object
- Object
- Geometry::Rectangle
- Defined in:
- lib/geometry-mc.rb
Instance Attribute Summary collapse
-
#l ⇒ Object
Returns the value of attribute l.
-
#w ⇒ Object
Returns the value of attribute w.
Instance Method Summary collapse
- #area ⇒ Object
-
#initialize(l, w) ⇒ Rectangle
constructor
A new instance of Rectangle.
- #perimeter ⇒ Object
Constructor Details
#initialize(l, w) ⇒ Rectangle
Returns a new instance of Rectangle.
55 56 57 58 |
# File 'lib/geometry-mc.rb', line 55 def initialize(l, w) @l = l @w = w end |
Instance Attribute Details
#l ⇒ Object
Returns the value of attribute l.
53 54 55 |
# File 'lib/geometry-mc.rb', line 53 def l @l end |
#w ⇒ Object
Returns the value of attribute w.
53 54 55 |
# File 'lib/geometry-mc.rb', line 53 def w @w end |
Instance Method Details
#area ⇒ Object
64 65 66 |
# File 'lib/geometry-mc.rb', line 64 def area @l * @w end |
#perimeter ⇒ Object
60 61 62 |
# File 'lib/geometry-mc.rb', line 60 def perimeter 2 * (@l + @w) end |