- Remove implicit conversion of values being compared. Only accept
Money
and subclasses ofMoney
for comparisons and raise TypeError otherwise. - When comparing fails due to
Money::Bank::UnknownRate
Money#<=>
will now returnnil
asComparable#==
will not rescue exceptions in the next release. - Fix
Currency
specs for#exponent
and#decimal_places
not making assertions. - Fix a couple of Ruby warnings found in specs.
- Use
Money#decimal_mark
when formatting withrounded_infinite_precision
rule set totrue
.
- Fixed VariableExchange#exchange_with for big numbers.
- Add Currency symbol translation support
Currency.all
raises a more helpful error message (Currency::MissingAttributeError
)if a currency has no priorityCurrency
implementsEnumerable
.Currency#<=>
sorts alphabetically byid
if thepriority
s are the same, and no longer raises an error if one of the priorities is missing.Money::Currency.unregister
can take an ISO code argument in addition to a hash.Money::Currency.unregister
returnstrue
if the given currency previously existed, andfalse
if it didn't.- Fix symbol for SZL currency
- Trying to create a Currency without an
iso_code
now raises a more helpful error message. - Add
Money.usd
,.cad
and.eur
as aliases for.us_dollar
,.ca_dollar
, and.euro
. - Add helper methods for British pounds:
Money.pound_sterling
andMoney.gbp
. - Add
Money.from_amount
to create money from a value in units instead of fractional units. - Changed CHF symbol from 'Fr' to 'CHF'
- Changed CLF exponent from 0 to 4
- Changed CLP subunit_to_unit from 1 to 100
- Minor fixes to prevent warnings on unused variables and the redefinition of
Money.default_currency
Money#==
changed to acknowledge that 0 in one currency is equal to 0 in any currency.- Changed KRW subunit_to_unit from 100 to 1
- Decouple exchange rates storage from bank objects and formalize storage public API. Default is
Money::RatesStore::Memory
. Currency.new
now a singleton by its id
- Fix format for BYR currency
- Add method to round a given amount of money to the nearest possible value in cash (aka Swedish rounding).
- Fixed the subunit_to_unit values of the CLP and KRW currencies
- Add option for
disambiguate
symbols for formatting - Fixed the subunit_to_unit values of the VND currency
- Fix formatting of NGN - show symbol before amount
- Switch default and alternate symbols for RUB currency
- Fix symbol for TRY currency
- Add
Money.default_formatting_rules
hash, meant to define default rules for everytimeMoney#format
is called. They can be overwritten if provided on method call - Add support for the new official symbol for Russian Ruble (RUB) — «₽»
- Ensure set is loaded
- Fixes formatting error when both
thousands_separator
anddecimal_mark
was added to Money#format as options. - Add Money#to_i which returns the whole part of the value. i.e. Money.new(100, "USD").to_i # => 1
- Fix output on Ukrainian Hryvnia symbol in HTML.
- Add documentation about i18n in README.
- Update iso code, symbol, subunit for the new Turkmenistani manat (GH-181)
- Performance Improvements (1.99x faster on MRI, 1.85x on Rubinius, 41.4x faster on JRuby)
- Money can now add and subtract Fixnum 0
- Money#new uses Money.default_currency if currency arg is nil (GH-410)
- Fixed formatting of NOK, putting the symbol after numbers
- Fixed issue where rounded_infinite_precision formatting fails for some localized currencies (GH-422)
- Remove lingering Monetize call
- Remove deprecated methods.
- Fix issue with block form of rounding_mode.
- Deprecated methods lists caller on print out for easier updating.
- Added support for Money::Currency#to_str and Money::Currency#to_sym
- Added ability to temporally change the rounding methond inside a given block
- Replaced parsing and core extensions with the monetize gem
- Fix BTC subunit
- New option :sign_positive to add a + sign to positive numbers
- Only allow to multiply a money by a number (int, float)
- Fix typo
- Wrap the currency symbol in a span if :html is specified in the rules
- Added Money::Currency.all method
- Allow combined comparison operator to handle zero values without rates
- Added Money::Currency.unregister method
- Works on Ruby 1.8.7
- Update deps
- Depreciate Money.parse
- Passing :symbol => false when formatting 'JPY' currency in :ja locale will work as expected
- Divide now obeys the specified rounding mode
- Add Money#round method. This is helpful when working in infinite_precision mode and would like to perform rounding at specific points in your work flow.
- In infinite precision mode, deserialized Money objects no longer return Float values from the
fractional
method. - Changed
thousands_separator
for Swedish Krona from dot to blank space. - Allow mathematical operations with first argument being not an instance of Money (eg. 2 * money instead of money * 2).
- Money#dollars and Money#amount methods return numbers of type BigDecimal.
- Change Money.from_bigdecimal (and in that way .to_money too) to keep precision when using
Money.infinite_precision = true
- Add :rounded_infinite_precision option to .format
- Changed the New Taiwan Dollar symbol position from after the amount to before the amount.
- Passing a Money instance to the Money constructor will obtain a new Money object with the same property values as the original
- Add deprecation warning to comparators
- Add Money.disallow_currency_conversion! option
- Allow to inherits from
Money
- Added :sign_before_symbol option to format negative numbers as -£1 rather than £-1
- Ensure BigDecimal.new always receives a string - compatibility fix for ruby-1.9.2-p320
- Update Maldivian Currency to MVR and fix ރ. to be ރ
- Add exponent to currency
- Add find_numeric to find currencies by ISO 4217 numeric code.
- Fixed regression where thousands separator was missing on certain currencies. (GH-245)
- Added :symbol_before_without_space option to add a space between currency symbol and amount.
- Fix currency assumption when parsing $ with a non-USD default currency.
- Changed the Bulgarian lev symbol position from before the amount to after the amount.
- Changed the symbol and html entity for INR. It is now "₹" instead of "₨".
- Added Money::Currency.analyze for determining potential currencies for a given string using powereful algorithms - will detect symbols, iso codes and names even if mixed with text.
- Changed UGX symbol from 'Sh' to 'USh'.
- Changed SYP symbol from "£ or ل.س" to "£S". The previous symbols remain as alternates.
- Changed RWF symbol from 'FR' to 'FRw'.
- Changed RSD symbol from "din. or дин." to 'РСД'. The previous symbols remain as alternates.
- Added MGA symbol 'Ar'
- Added KGS symbol 'som'
- Changed KES symbol from 'Sh' to 'KSh'
- Added ETB symbol 'Br'
- Changed EGP symbol from "£ or ج.م" to "ج.م"
- Changed DJF symbol from 'Fr' to 'Fdj'
- Changed CVE symbol from '$ or Esc' to '$'. 'Esc' remains as an alternate symbol.
- Added BTN symbol 'Nu.'
- Changed BAM symbol from 'KM or КМ' to 'КМ', the alternate (cyrillic script) remains as an alternate symbol.
- Added alternate symbols for all currencies. For example, USD can be written as both '$' and 'US$', SEK can be 'Kr' or ':-', etc.
- Renamed Money#cents to Money#fractional. Money#cents can still be used as a synonym and equivalent of Money#fractional.
- Added Money.new_with_amount and Money#amount. Money.new_with_dollars and Money#dollars remain as synonyms.
- Calling Bank::Base.instance doesn't make Bank::VariableExchange.instance return Bank::Base.instance anymore (semaperepelitsa)
- Update Turkmenistan manat from TMM to TMT currency (GH-181). [Thanks @Exoth]
- Moved ZWD Zimbabwean dollars to currency_bc.json, also added there ZWL, ZWN, and ZWR Zimbabwean dollars (GH-184).
- Switch to multi_json gem (GH-170)
- Fix "warning: ambiguous first argument..." (GH-166)
- Update dependencies to latest and greatest (GH-172)
- TravisBot is now watching Pull Request!!! (GH-171)
- Minor code cleaning
- Remove subunit from South Korean won (KRW)
- Fixed bug where bankers rounding wasn't being used everywhere.
- Minor bugfix - incorrect use of character range resulted in botched results for Money::Parsing#extract_cents (GH-162)
- Money::Currency::TABLE removed. Use Money::Currency.register to add additional currencies (GH-143)
- Fix rounding error in Numeric.to_money (GH-145)
- Allow on-the-fly calculation of decimal places if not known already (GH-146,GH-147,GH-148)
- Move Euro symbol ahead of amount (GH-151)
- Changed settings for Polish currency (GH-152)
- Fall back to symbol if there is no html_entity present (GH-153)
- Optionally Allow parsing of money values prefixed by symbols in key currencies (GH-155)
- Fix bug where rates exported to a file from VariableExchange leave the File object open (GH-154)
- Added Money#positive? and Money#negative? methods (GH-157)
- Fix format function output for custom currencies (GH-156)
- Fix parsing of strings with 3 decimal digits (GH-158)
- Updated development dependencies
- Said goodbye to RubyForge
-
Money.to_money now understands a currency option (GH-121)
-
Added Money#-@ method to change object polarity (GH-122)
-
Added Money#symbol_or_iso_code utility method (GH-128)
-
Money.parse now understands trailing - as negative inputs (GH-133)
-
Money::Currency.new now validates input to avoid memory leaks (GH-137)
-
Forced UTF-8 encoding on currency JSON (GH-117)
-
Fixed position of Philippine peso sign (GH-124)
-
Fixed position of Danish currency sign (GH-127)
- Add missing config dir.
The big change this release is moving the currency information into a JSON file. This should make it easier for users to add and test things. Thanks to Steve Morris for working on this during his Mendicant University course.
In addition to this big change there were well over a dozen other minor changes.
- a new exchange bank nordea has been added to the README. (k33l0r)
- a new exchange bank nbrb_currency has been added to the README. (slbug)
- update Rake tasks
- See our CI status in the README
- Add syntax highlighting to the README (phlipper)
- Remove minor unit from YEN (pwim)
- Format YEN (pwim)
- Update README for
_as_string
(mjankowski) - Update Lebanon currency (kaleemullah)
- Update Polish złoty (holek)
- Move currency information into JSON storage! (stevemorris)
- Add ISO4217 Numeric codes (alovak)
- EEK currency is no longer used, kept for BC (#issue/110)
- Lithuanian Litas symbol position fixed (laurynas)
- Fixed README typos (phlipper)
- Fixed README typos (pwim)
- Fix specs (alovak)
- Add encoding indicator to top of Gemspec
- add Money#to_d (thanks Andrew White)
- Add Money.use_i18n, this allows you to enable/disable i18n from being used, even if it's required in your app.
- i18n enhancements (thanks eloyesp link)
- README updates (thanks pconnor)
- Break into modules
- Added
:no_cents_if_whole
format option - Update HKD from Ho to Cent
- Performance improvements (thanks weppos)
- Added Symbol#to_currency
- Added Gemfile for development
- Updated HUF currency to use
symbol_first => false
- Updated "Turkish New Lira" to "Turkish Lira"
- Floating point comparison needs to Epsilon aware (thanks Tobias Luetke)
- reimplement fix for #issue/43, enable Marshal.(load/dump)
- Add a symbol position option for Money#format (thanks Romain, Gil and Julien)
- Updated CNY to use "Fen" and subunit_to_unit of 100
- Updates to work with gem-testers.org
- Fixed issue with #format(:no_cents => true) (thanks Romain & Julien)
- Enhancements to Money::Currency (thanks Matthew McEachen)
- Replace delimiter with thousands_separator
- Replace separator with decimal_mark
- Added symbol_first and html_entity
- Added allocation algorithm for fair(ish) splitting of money between parties without losing pennies (thanks Tobias Luetke)
- Always store cents as an Integer (thanks Abhay Kumar)
- Fixed TypeError in rate exchange (thanks Christian Billen)
- Cleanup #parse (thanks Tom Lianza)
- Added Currency#decimal_places.
- Fixed error with Money#to_s error with negative amounts that are only cents.
- Fixed an error in #to_s when cents is negative
- Fixed an error in #to_s which appended extra 0s incorrectly
- Removed erroneous require.
- Updated to RSpec2.
- Use i18n to lookup separator and delimiter signs.
- Removed all deprecated methods up to v3.5.0, including the following:
- Using Money#format with params instead of a Hash.
- Using a Hash with Money#new.
- Using Bank#exchange, use Bank#exchange_with instead.
- Updated Money#to_s to respect :separator and :subunit_to_unit.
- Fixed Money#format for :subunit_to_unit != 100. (#issue/37)
- Fixed String#to_money for :subunit_to_unit != 100. (#issue/36)
- Removed duplicate currencies. (#issue/38)
- Fixed issue related to JRuby returning 2 for Math.log10(1000).floor instead of correctly returning 3.
- Added support for creating objects with the main monetary unit instead of cents. (#issue/25)
- Deprecated
Money#format
with separate params instead of Hash. Deprecation target set to Money 3.5.0. (#issue/31) - Deprecated
Money#new(0, :currency => "EUR")
in favor ofMoney#new(0, "EUR")
. Deprecation target set to Money 3.5.0. (#issue/31) - Throw ArgumentError when trying to multiply two Money objects together. (#issue/29)
- Update Money#parse to use :subunit_to_unit (#issue/30)
- Downgraded required_rubygems_version to >= 1.3.6. (#issue/26)
- Use BigDecimal when floating point calculations are needed.
- Ruby 1.9.2 compatibility enhancements.
- Implemented
Money::Bank::Base
. (#issue/14) - Added
Money::Bank::Base#exchange_with
. - Deprecated
Money::Bank::Base#exchange
. Deprecation target set to Money 3.2.0. - Implented
Money::Bank::VariableExchange
- Deprecated
Money::VariableExchangeBank
. Deprecation target set to Money 3.2.0. - Deprecate
Money::SYMBOLS
,Money::SEPARATORS
andMoney::DELIMITERS
. Deprecation target set to Money 3.2.0. (#issue/16) - Implemented
#has
forMoney
andMoney::Currency
. - Refactored test suite to conform to RSpec conventions.
- Moved project from FooBarWidget to RubyMoney
- Added Simone Carletti to list of authors.
- Moved
@rounding_method
fromMoney::Bank::VariableExchange
toMoney::Bank::Base
. (#issue/18) - Added
#setup
toMoney::Bank::Base
. Called from#initialize
. (#issue/19) - Added google_currency to list of Currency Exchange Implementations.
- Added
#export_rates
toMoney::Bank::VariableExchange
. (#issue/21) - Added
#import_rates
toMoney::Bank::VariableExchange
. (#issue/21) - Removed dependency on Jeweler.
- Replaced usage of hanna with yardoc.
- Rewrote/reformatted all documentation.
- Fixed incorrect URLs in documentation. (#issue/17)
- Updated
:subunit_to_unit
for HKD from 10 to 100. (#issue/20) - Updated Ghanaian Cedi to use correct ISO Code, GHS. (#issue/22)
- Make
default
rake task callspec
. (#issue/23)
- Added google_currency to list of Currency Exchange Implementations.
- Added
#export_rates
toMoney::Bank::VariableExchange
. (#issue/21) - Added
#import_rates
toMoney::Bank::VariableExchange
. (#issue/21)
- Updated
:subunit_to_unit
for HKD from 10 to 100. (#issue/20)
- Moved
@rounding_method
fromMoney::Bank::VariableExchange
toMoney::Bank::Base
. (#issue/18) - Added
#setup
toMoney::Bank::Base
. Called from#initialize
. (#issue/19)
- Fixed incorrect URLs in documentation. (#issue/17)
- Implemented
Money::Bank::Base
. (#issue/14) - Added
Money::Bank::Base#exchange_with
. - Deprecated
Money::Bank::Base#exchange
. Deprecation target set to Money 3.2.0. - Implented
Money::Bank::VariableExchange
- Deprecated
Money::VariableExchangeBank
. Deprecation target set to Money 3.2.0. - Deprecate
Money::SYMBOLS
,Money::SEPARATORS
andMoney::DELIMITERS
. Deprecation target set to Money 3.2.0. (#issue/16) - Implemented
#has
forMoney
andMoney::Currency
. - Refactored test suite to conform to RSpec conventions.
- Moved project from FooBarWidget to RubyMoney
- Added Simone Carletti to list of authors.
- Fixed rounding error in
Numeric#to_money
. (#issue/15)
- Added
Money#abs
. - Added ability to pass a block to
VariableExchangeBank#new
or#exchange
, specifying a custom truncation method - Added optional
currency
argument toNumeric#to_money
. (#issue/11) - Added optional
currency
argument toString#to_money
. (#issue/11) - Use '¤' as the default currency symbol. (#issue/10)
- Updated
Currency#subunit_to_unit
documentation (it's an integer not a string). - Fixed issue when exchanging currencies with different
:subunit_to_unit
values. Numeric#to_money
now respects:subunit_to_unit
. (#issue/12)
- Use
:subunit_to_unit
in#to_s
,#to_f
and#format
. - Deprecated
Money#SEPARATORS
andMoney#DELIMITERS
.
- Updated
#exchange
to avoid floating point rounding errors. - Added
:separator
and:delimiter
toCurrency
- Updated the attributes of the Chilean Peso.
- Added
#currency_as_string
and#currency_as_string=
for easier integration with ActiveRecord/Rails
- Added
#div
,#divmod
,#modulo
,#%
and#remainder
toMoney
.
- Added
#eql?
toMoney
- Updated
Numeric#to_money
to work with all children ofNumeric
(i.e.BigDecimal
,Integer
,Fixnum
,Float
, etc)
- Version Bump due to compatibility changes with ActiveRecord. See conversation here for more information.
- Currency is now represented by a
Currency
Object instead of aString
.
- Can now divide two Money objects by one another using
#/
. - Can now convert a Money object to a float using
#to_f
. - Users can now specify Separators and Delimiters when using
#format
. - Support for Brazilian Real
Money.new(1_00, :BRL)
- Migrated to Jeweler