Hexa
Hexa is a gem which provides some objects to work on my math works. There are shapes and objects like circles, squares or cylinders. Each object has its own set of methods like perimeter
, volume
or area
.
There are also extended core objects such as Fixnum
. They have new methods to simplify operations such as !
, prime?
or sqrt
.
For the moment, the project isn't very complete. You can contribute if you want!
Installation
If you want to install hexa and start use it:
$ gem install hexa
Now you can use hexa into IRB or a Ruby file:
require "hexa"
Usage
Hexa comes with a set of objects. Objects (Ruby objects) are divided into shapes and objects. Main objects (Ruby) are Circle, Square, Cylinder and Cube. Each constructor accept a Hash of options. Here an example of a IRB session:
>> c = Circle.new :radius => 10
=> #<Circle:0x00000001a00360 @radius=10, @diameter=20>
>> c.diameter
=> 20
>> c.area
=> 314.1592653589793
Other objects (such as Cylinder) allows you to pass other object to set attributes.
>> circle = Circle.new :diameter => 10
=> #<Circle:0x00000001a03b28 @radius=5, @diameter=10>
>> cylinder = Cylinder.new :radius => circle, :height => 40
=> #<Cylinder:0x00000001a0b210 @radius=5, @diameter=10, @height=40>
Contributing
If you want to contribute, just fork the project then write and commit your patch. Finally, you can open a pull-request.
License
Hexa is released under the MIT license. See the LICENSE
file for more information.