-
Added Rational#to_percentage
-
Added Rational#percent_of
-
Added Rational#as_percentage_of
- Added bigdecimal gem dependency (thanks @orien)
-
Added Percentage#-@
-
Added Percentage#positive?
-
Added Percentage#negative?
-
Added Percentage#to_d
-
Percentage instances are now frozen on initialization
-
Changed
Percentage.change
to returnnil
when first argument is zero
-
Added CHANGES.md to gem files
-
Fixed outdated changelog_uri
- Added optional YAML integration
This makes it possible to dump/load percentage objects to/from YAML as scalar values. For example:
require 'percentage/yaml'
puts YAML.dump([Percentage(BigDecimal('17.5'))])
This functionality is not enabled by default, due to the use of Module#prepend.
- Added ndigits argument to Percentage#truncate
- Removed memoization so that Percentage objects can be frozen (thanks @iamvery)
-
Added BigDecimal#to_percentage and Integer#to_percentage
-
Added BigDecimal#percent_of (thanks @mikeymicrophone)
- First version!