dominikh / filesize

filesize is a small ruby class for handling filesizes with both the SI and binary prefixes, allowing conversion from any size to any other size.
MIT License
81 stars 16 forks source link

Support selection of precision #21

Closed lauer closed 6 years ago

lauer commented 6 years ago

It should be possible to chose the precision of the output.

Currently it will always print with 2 decimals. It would be a parameter to the pretty method, mostly before the to_s is already hardcoded with a unit = 'B'.

It could also be a format_as method.