module

Finfry::Money

Money is stored everywhere as a whole number of cents (Int64) so we never accumulate floating-point rounding error. This module is the only place that converts to and from the human-facing decimal string.

Class methods

format(cents : Int64) : String

Format cents as a "$1,234.56" string.

Source
parse(input : String) : Int64

Parse a user-supplied amount like "12.50", "$1,234.5", "12" or "-3.99" into cents. Raises Money::Error on anything it can't make sense of.

Source

Nested types