This gem allows you to convert arabic numbers to roman.
Install the gem and add to the application's Gemfile by executing:
$ bundle add romanumerals
If bundler is not being used to manage dependencies, install the gem by executing:
$ gem install romanumerals
Usage is very simple:
10.to_roman # => "X"
110.to_roman # => "CX"
99.to_roman # => "XCIX"
845.to_roman # => "DCCCXLV"
1193.to_roman # => "MCXCIII"
2024.to_roman # => "MMXXIV"
'MMXXIV'.to_numeral # => 2024
0.to_roman # => ""
11.9.to_roman # => "XI"
# If a string does not contain roman numerals then the String#to_i will be used
''.to_numeral # => 0
'0'.to_numeral # => 0
'XIIi'.to_numeral # => 0
'5 contributors'.to_numeral # => 5
Bug reports and pull requests are welcome on GitHub at https://github.com/febonazzic/romanumerals.
The gem is available as open source under the terms of the MIT License.