Project

ziffern

0.0
No release in over 3 years
Low commit activity in last 3 years
Converts numbers to text, in German.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.6
~> 10.0
~> 3.0
 Project Readme

Ziffern

Number to text, in German!

Handles positive and negative numbers up to 126 digits, with unlimited decimals.

Just create an instance of the class and use the #to_german method to convert numbers, it accepts floats, integers and strings, and will raise subclasses of ArgumentError if it is not able to handle what you pass in.

require 'ziffern'
converter = Ziffern.new

converter.to_german 1           # => "eins"
converter.to_german -5          # => "minus fünf"
converter.to_german 12345       # => "zwölftausenddreihundertfünfundvierzig"
converter.to_german 99.99       # => "neunundneunzig Komma neun neun"
converter.to_german 0.00        # => "null Komma null"
converter.to_german '0.00'      # => "null Komma null null"
converter.to_german 10**125     # => "einhundert Vigintilliarden"
converter.to_german 'invalid'   # ~> Ziffern::InvalidNumberError
converter.to_german 10**126     # ~> Ziffern::TooLargeNumberError

Testing

# ...is the default task
rake