Rectangle
Implementation of rectangle: represents some rectangular area.
Installation
Add this line to your application's Gemfile:
gem 'rectangle'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rectangle
Usage
Creating new rectangle
require 'rectangle'
rectangle = Rectangle::Rectangle.new width, height
Creating new square
square = Rectangle::Square.new width
square == Rectangle::Rectangle.new(width, width) #=> true
Calculating area
rectangle.area
Calculating perimeter
rectangle.perimeter
Contributing
- Fork it ( https://github.com/d-ark/rectangle/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request