Abaco
Abaco is a Ruby library for converting numbers into Italian words.
It was specifically developed for the generation of postal payment slips via our Bollettino gem. Initially, Abaco was part of the gem, then we decided to extract the functionality.
Installation
Add this line to your application's Gemfile:
gem 'abaco'
And then execute:
$ bundle
Or install it yourself as:
$ gem install abaco
Usage
Abaco extends the Numeric
class, so you can use with Fixnum
and Float
:
15.to_italian # <= "quindici/00"
15.5.to_italian # <= "quindici/50"
You can also call the converter directly:
Abaco::Converter.convert(15) # <= "quindici/00"
Abaco::Converter.convert(15.5) # <= "quindici/50"
Limitations
Presently, the biggest number Abaco can translate is 999.999.999.999. Since this library is mainly meant to be used for billing purposes, we didn't find it necessary to go beyond that limit.
If you're billing someone for one trillion, contact us right away: we'll be glad to help you! :)
Contributing
- Fork it (https://github.com/interconn-isp/abaco/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
Related projects
The Bollettino gem can be used with Abaco to generate Italian postal payment slips.
Credits
Abaco is developed and maintained by Alessandro Desantis.
The original implementation was written by Giovanni Intini in an article entitled “Dai numeri alle lettere”.
License
Abaco is released under the MIT license.