conanite/sepa — pull request #8 by TheConstructor (2014-01-26 13:55:06+00:00)
Title: Support for more "float-likes", Bignum, Non-String values.

- Replaced check for Fixnum by check for Integer to handle Bignum in the same way as Fixnum
- Replaced separate checks for Float and BigDecimal by a more generic check for Numeric and to_f
to include support for Rational and maybe more exotic floating point numbers while not building
any dependency on BigDecimal
- Added call to to_s for other values which is a no-op for String
- Added specs to check correct handling of Float, BigDecimal and Rational amounts

While strictly speaking most changes are of pure optional nature I like to emphasis that moving the "require bigdecimal" into the spec makes the lib less dependent on the presence of BigDecimal at runtime while maintaining support for handling BigDecimal. These changes emphasis on the inheritance of objects thus enabling a more objcet-oriented and problem aware usage by others.

The to_s-call may or may not help as this means that all values are accepted (previously only values implementing gsub) which can mean that you can reuse application-space objects as values (provided they implement to_s in a meaningful way) or mean that you don't get exceptions when you provide strange or nil values. For String-values this does not impose any change.