RubyMoney / monetize

A library for converting various objects into `Money` objects.
MIT License
430 stars 107 forks source link

Respect Money.rounding_mode #123

Closed antstorm closed 5 years ago

antstorm commented 5 years ago

For a while Monetize had its own custom logic for rounding parsed amounts. The of course completely ignores the Money.rounding_mode always assuming one rounding mode — ROUND_HALF_UP.

This PR clean some of that logic up and returns amount in units letting Money to convert it to subunits.

A potential breaking change here is that a correct, but different rounding mode will be used. Will add a post-install message to double check Money.rounding_mode is set to the desired value.

coveralls commented 5 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling d90a79da4b9b636c5442778b916564b96d7e59bf on antstorm:simplify-parser into 16778698a6288b0706cc878246d02ea693cc2247 on RubyMoney:master.

coveralls commented 5 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling d90a79da4b9b636c5442778b916564b96d7e59bf on antstorm:simplify-parser into 16778698a6288b0706cc878246d02ea693cc2247 on RubyMoney:master.

coveralls commented 5 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling d90a79da4b9b636c5442778b916564b96d7e59bf on antstorm:simplify-parser into 16778698a6288b0706cc878246d02ea693cc2247 on RubyMoney:master.

coveralls commented 5 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling d90a79da4b9b636c5442778b916564b96d7e59bf on antstorm:simplify-parser into 16778698a6288b0706cc878246d02ea693cc2247 on RubyMoney:master.

coveralls commented 5 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling e5700edbd353c3f9668db377b1c75d16de4216db on antstorm:simplify-parser into 16778698a6288b0706cc878246d02ea693cc2247 on RubyMoney:master.