CousinRoman
CousinRoman is a String extension which allows you to convert
Roman numerals (following modern subtractive notation)
to Arabic numbers (i.e. Integers).
Installation
Add this line to your application's Gemfile:
gem 'cousin_roman'
And then execute:
$ bundle
Or install it yourself as:
$ gem install cousin_roman
Usage
Just use String#to_arabic or String#to_arabic! method.
For example:
'MMXIII'.to_arabic # => 2013
'MMYUOX'.to_arabic # => nil
'MMYOUX'.to_arabic! # => TypeError: not a valid roman number
Testing
Just run
$ rake
under gem folder.
Contributing
- Fork it
- 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 new Pull Request