money 6.7.0 → 6.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +2 -1
  3. data/.travis.yml +22 -5
  4. data/AUTHORS +5 -0
  5. data/CHANGELOG.md +109 -3
  6. data/Gemfile +13 -4
  7. data/LICENSE +2 -0
  8. data/README.md +69 -49
  9. data/config/currency_backwards_compatible.json +30 -0
  10. data/config/currency_iso.json +139 -62
  11. data/config/currency_non_iso.json +66 -2
  12. data/lib/money.rb +0 -13
  13. data/lib/money/bank/variable_exchange.rb +9 -22
  14. data/lib/money/currency.rb +35 -38
  15. data/lib/money/currency/heuristics.rb +1 -144
  16. data/lib/money/currency/loader.rb +1 -1
  17. data/lib/money/locale_backend/base.rb +7 -0
  18. data/lib/money/locale_backend/errors.rb +6 -0
  19. data/lib/money/locale_backend/i18n.rb +24 -0
  20. data/lib/money/locale_backend/legacy.rb +28 -0
  21. data/lib/money/money.rb +120 -151
  22. data/lib/money/money/allocation.rb +37 -0
  23. data/lib/money/money/arithmetic.rb +57 -52
  24. data/lib/money/money/constructors.rb +1 -2
  25. data/lib/money/money/formatter.rb +397 -0
  26. data/lib/money/money/formatting_rules.rb +120 -0
  27. data/lib/money/money/locale_backend.rb +20 -0
  28. data/lib/money/rates_store/memory.rb +1 -2
  29. data/lib/money/version.rb +1 -1
  30. data/money.gemspec +10 -16
  31. data/spec/bank/variable_exchange_spec.rb +7 -3
  32. data/spec/currency/heuristics_spec.rb +2 -153
  33. data/spec/currency_spec.rb +45 -4
  34. data/spec/locale_backend/i18n_spec.rb +62 -0
  35. data/spec/locale_backend/legacy_spec.rb +74 -0
  36. data/spec/money/allocation_spec.rb +130 -0
  37. data/spec/money/arithmetic_spec.rb +217 -104
  38. data/spec/money/constructors_spec.rb +0 -12
  39. data/spec/money/formatting_spec.rb +320 -179
  40. data/spec/money/locale_backend_spec.rb +14 -0
  41. data/spec/money_spec.rb +159 -26
  42. data/spec/rates_store/memory_spec.rb +13 -2
  43. data/spec/spec_helper.rb +2 -0
  44. data/spec/support/shared_examples/money_examples.rb +14 -0
  45. metadata +32 -41
  46. data/lib/money/money/formatting.rb +0 -417
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9cffd9f173701f8599fae9244a9de6b4aef0a95f
4
- data.tar.gz: 30080c0c9743507a615598ab80c8235d7313f769
3
+ metadata.gz: 7929d62cf482b5ad0876b0ff4950440cec3051ff
4
+ data.tar.gz: 8b40765349b517c8182f20de9378ad14b76eb863
5
5
  SHA512:
6
- metadata.gz: 60307b13ad66a684ff833d58441093b58eb7730ccb108b6804a68f935a91dcc0921153e7c2ce0c8543af0851239b4c7289dcc23f71c60361e875d0e71f5f26fb
7
- data.tar.gz: b435062afea1d2a798502354347b757dc5c4f84a835449d39d411c9ea6400e52fa99eeeded5322a92e00b0956d41d9d3003134b25f49c72b18b4fa1f195acf01
6
+ metadata.gz: 1bc3a9c7fc84b6c4cd7e78d2dbe7bd666ab25f0715523953751984405f0ae858396e20e7bf0d8199b50c1d94d5947a1d3b0308094f3f2b347f07c93b655b28f1
7
+ data.tar.gz: 1a1dae32b195ccb6a93125fd2526e1c60e24c794cdd26fc08eb6254a1e6f8f4c0aef270ac215d1606b5163f7a1690443230161a75a5e522f72aa824b1f6f2efd
data/.rspec CHANGED
@@ -1 +1,2 @@
1
- --require spec_helper
1
+ --require spec_helper
2
+ --color
@@ -1,12 +1,29 @@
1
+ ---
1
2
  language: ruby
2
3
  sudo: false
3
4
  rvm:
4
5
  - 1.9.3
5
- - 2.0.0
6
- - 2.1.8
7
- - 2.2.4
8
- - 2.3.0
9
- - rbx-2
6
+ - 2.0
7
+ - 2.1.10
8
+ - 2.2.10
9
+ - 2.3.7
10
+ - 2.4.4
11
+ - 2.5.1
12
+ - 2.6.0
13
+ - rbx-3
14
+ - jruby-9.0.5.0
15
+ - jruby-9.1.17.0
16
+ - jruby-9.2.0.0
17
+ - ruby-head
18
+ - jruby-head
19
+ matrix:
20
+ allow_failures:
21
+ - rvm: ruby-head
22
+ - rvm: jruby-head
23
+ - rvm: rbx-3
24
+ fast_finish: true
25
+ before_install:
26
+ - gem update bundler
10
27
  script: bundle exec rspec spec
11
28
  notifications:
12
29
  email:
data/AUTHORS CHANGED
@@ -36,12 +36,14 @@ Filipe Goncalves
36
36
  Francisco Trindade
37
37
  François Beausoleil
38
38
  François Klingler
39
+ Fred Liang
39
40
  Gabriel Gilder
40
41
  Gee-Hsien Chuang
41
42
  George Millo
42
43
  Hakan Ensari
43
44
  Hongli Lai
44
45
  Ilia Lobsanov
46
+ Ivan Shamatov
45
47
  Ingo Wichmann
46
48
  Jacob Atzen
47
49
  James Cotterill
@@ -63,6 +65,7 @@ Julien Boyer
63
65
  Kaleem Ullah
64
66
  Kenichi Kamiya
65
67
  Kenn Ejima
68
+ Kenneth Salomon
66
69
  kirillian
67
70
  Laurynas Butkus
68
71
  Marcel Scherf
@@ -111,6 +114,7 @@ Thomas Weymuth
111
114
  Ticean Bennett
112
115
  Tien Nguyen
113
116
  Tim Hart
117
+ Tim Krins
114
118
  Tobias Luetke
115
119
  Tobias Schmidt
116
120
  Tom Lianza
@@ -124,3 +128,4 @@ Yuri Sidorov
124
128
  Yuusuke Takizawa
125
129
  Zubin Henner
126
130
  Бродяной Александр
131
+ Nicolay Hvidsten
@@ -1,5 +1,111 @@
1
1
  # Changelog
2
2
 
3
+ ## 6.13.0
4
+ - Add :format option to the Formatter
5
+ - Add ruby 2.6.0 support
6
+ - Performance improvement (lazy stringify currency keys)
7
+ - Add `Money.locale_backend` for translation lookups
8
+ - Deprecate `use_i18n` flag in favour of `locale_backend = :i18n`
9
+ - Deprecate old formatting rules in favour of `:format`
10
+ - LVL and LTL are no longer used
11
+ - Add `Currency#iso?` for checking if currency is iso or not
12
+ - Relax versions-lock of `i18n` and `rspec` dependencies
13
+ - Add Bitcoin Cash
14
+ - Fix incorrect behaviour of `Currency#find_by_currency_iso` when given empty input
15
+
16
+ ## 6.12.0
17
+ - Remove caching of `.empty`/`.zero`
18
+ - Preserve assigned bank when rounding
19
+ - Always round the fractional part when calling `#round`
20
+ - Wrap all amount parts when `:html_wrap` option is used
21
+ - Deprecate `#currency_as_string` and `#currency_as_string=` (in favour of `#with_currency`)
22
+ - Add `#with_currency` for swapping the currency
23
+ - Rewrite allocate/split (fixing some penny loosing issues)
24
+
25
+ ## 6.11.3
26
+ - Fix regression: if enabled use i18n locales in Money#to_s
27
+
28
+ ## 6.11.2
29
+ - Fix regression: ignore formatting defaults for Money#to_s
30
+
31
+ ## 6.11.1
32
+ - Fix issue with adding non-USD money to zero (used when calling `.sum` on an array)
33
+
34
+ ## 6.11.0
35
+ - Support i18n 1.0
36
+ - Update yard dependency to 0.9.11
37
+ - Support for ruby 2.5.0
38
+ - Add inheritance for currency definitions
39
+ - Added new symbol for bitcoin denomination
40
+ - Specify custom rounding precision when using `infinite_precision`
41
+ - Allow splits with sums greater than 1
42
+ - Prevent arithmetic methods from loosing reference to the bank
43
+ - Fix coerced zero numeric subtraction
44
+ - Fix south asian formatting to support whole numbers
45
+ - Refactor formatting logic
46
+
47
+ ## 6.10.1
48
+ - Fix an issue with Money.empty memoization
49
+
50
+ ## 6.10.0
51
+ - Added support for i18n version 0.9
52
+ - Disabled rounding when verifying allocation splits
53
+ - Added Chinese Yuan Offshore (CNH)
54
+ - Fixed html_entity for ARS
55
+ - Fixed KZT symbol
56
+ - Allowed comparing cross currency when both are zero
57
+ - Fixed memory rate store
58
+ - Corrected HUF subunit and thousands separator config
59
+
60
+ ## 6.9.0
61
+ - Extracted heuristics into money-heuristics gem
62
+
63
+ ## 6.8.4
64
+ - Resolving NIO ambiguity with CAD
65
+ - Display the BBD $ symbol before digits
66
+ - Symbol first for NIO and PAB currencies
67
+
68
+ ## 6.8.3
69
+ - Added support for the British Penny (GBX)
70
+ - Fixed LKR currency html_entity symbol
71
+
72
+ ## 6.8.2
73
+ - Removed subunits for HUF
74
+ - Fixed `#from_amount` accepting `nil` as currency_code
75
+ - Relaxed i18n version (< 0.9)
76
+ - Set symbol for UZS
77
+ - Added disambiguate_symbol for XFU
78
+ - Fixed Peruvian Sol name
79
+ - Fixed symbol_first for VND (now `false`)
80
+
81
+ ## 6.8.1
82
+ - Fixed issue with calling `format` on a frozen `Money` object
83
+
84
+ ## 6.8.0
85
+ - Ruby 2.4.0 support
86
+ - Fixed UZS syntax
87
+ - Fixed HUF smallest denomination
88
+ - Fixed ruby 1.9 issues
89
+ - Fixed html entity for COP
90
+ - Updated all currency decimals to ISO-4217
91
+ - Fixed money allocation for negative amounts
92
+ - Fixed symbol_first for RON
93
+ - Fixed disambiguate option when symbol is set to true
94
+ - Fixed thousands separator for CZK
95
+ - Improved formatter performance by precaching I18n calls
96
+
97
+ ## 6.7.1
98
+ - Changed DKK symbol from 'kr' to 'kr.'
99
+ - Improved Money::Formatting#format docs
100
+ - Updated VEF symbol from 'Bs F' to 'Bs'
101
+ - `Currency#exponent` now returns Fixnum
102
+ - Fixed coercion issues
103
+ - Fixed edge case with explicit override of thousands separator and decimal mark
104
+ - `Money#==` will now raise error for non-zero numeric values
105
+ - Fixed divmod
106
+ - Added disambiguation symbol to USD Dollar
107
+ - Use disambiguation symbol when both disambiguate and symbol are true in `format` method
108
+
3
109
  ## 6.7.0
4
110
  - Changed `Money#<=>` to return `nil` if the comparison is inappropriate. (#584)
5
111
  - Remove implicit conversion of values being compared. Only accept `Money` and
@@ -99,7 +205,7 @@
99
205
  - Works on Ruby 1.8.7
100
206
  - Update deps
101
207
  - Depreciate Money.parse
102
- - Passing :symbol => false when formatting 'JPY' currency in :ja locale
208
+ - Passing symbol: false when formatting 'JPY' currency in :ja locale
103
209
  will work as expected
104
210
  - Divide now obeys the specified rounding mode
105
211
  - 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.
@@ -282,7 +388,7 @@ Features
282
388
 
283
389
  Bugfixes
284
390
  --------
285
- - Fixed issue with #format(:no_cents => true) (thanks Romain & Julien)
391
+ - Fixed issue with #format(no_cents: true) (thanks Romain & Julien)
286
392
 
287
393
  Money 3.5.5
288
394
  ===========
@@ -369,7 +475,7 @@ Features
369
475
  - Deprecated `Money#format` with separate params instead of Hash. Deprecation
370
476
  target set to Money 3.5.0.
371
477
  ([#issue/31](http://github.com/RubyMoney/money/issues/31))
372
- - Deprecated `Money#new(0, :currency => "EUR")` in favor of
478
+ - Deprecated `Money#new(0, currency: "EUR")` in favor of
373
479
  `Money#new(0, "EUR")`. Deprecation target set to Money 3.5.0.
374
480
  ([#issue/31](http://github.com/RubyMoney/money/issues/31))
375
481
  - Throw ArgumentError when trying to multiply two Money objects together.
data/Gemfile CHANGED
@@ -1,7 +1,16 @@
1
- source "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
- gem "coveralls", :require => false
4
- gem "json", :platform => :jruby
5
- gem "pry", :require => false
3
+ gem 'coveralls', '>= 0.8.17', require: false
4
+ gem 'pry', require: false
5
+
6
+ # JSON gem no longer supports ruby < 2.0.0
7
+ if defined?(JRUBY_VERSION)
8
+ gem 'json'
9
+ elsif RUBY_VERSION =~ /^1/
10
+ # Legacy gem locks for ruby 1.9.x
11
+ gem 'json', '~> 1.8.3'
12
+ gem 'tins', '~> 1.6.0'
13
+ gem 'term-ansicolor', '< 1.4'
14
+ end
6
15
 
7
16
  gemspec
data/LICENSE CHANGED
@@ -1,3 +1,5 @@
1
+ The MIT License (MIT)
2
+
1
3
  Copyright (c) 2005 Tobias Lutke
2
4
  Copyright (c) 2008 Phusion
3
5
 
data/README.md CHANGED
@@ -1,12 +1,11 @@
1
1
  # RubyMoney - Money
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/money.svg)](http://badge.fury.io/rb/money)
3
+ [![Gem Version](https://badge.fury.io/rb/money.svg)](https://rubygems.org/gems/money)
4
4
  [![Build Status](https://travis-ci.org/RubyMoney/money.svg?branch=master)](https://travis-ci.org/RubyMoney/money)
5
5
  [![Code Climate](https://codeclimate.com/github/RubyMoney/money.svg)](https://codeclimate.com/github/RubyMoney/money)
6
6
  [![Coverage Status](https://coveralls.io/repos/RubyMoney/money/badge.svg?branch=master)](https://coveralls.io/r/RubyMoney/money?branch=master)
7
- [![Inline docs](http://inch-ci.org/github/RubyMoney/money.svg)](http://inch-ci.org/github/RubyMoney/money)
8
- [![Dependency Status](https://gemnasium.com/RubyMoney/money.svg)](https://gemnasium.com/RubyMoney/money)
9
- [![License](https://img.shields.io/github/license/RubyMoney/money.svg)](http://opensource.org/licenses/MIT)
7
+ [![Inline docs](https://inch-ci.org/github/RubyMoney/money.svg)](https://inch-ci.org/github/RubyMoney/money)
8
+ [![License](https://img.shields.io/github/license/RubyMoney/money.svg)](https://opensource.org/licenses/MIT)
10
9
 
11
10
  :warning: Please read the [migration notes](#migration-notes) before upgrading to a new major version.
12
11
 
@@ -28,13 +27,13 @@ A Ruby Library for dealing with money and currency conversion.
28
27
  a monetary unit.
29
28
  - Represents monetary values as integers, in cents. This avoids floating point
30
29
  rounding errors.
31
- - Represents currency as `Money::Currency` instances providing an high level of
30
+ - Represents currency as `Money::Currency` instances providing a high level of
32
31
  flexibility.
33
32
  - Provides APIs for exchanging money from one currency to another.
34
33
 
35
34
  ### Resources
36
35
 
37
- - [Website](http://rubymoney.github.io/money/)
36
+ - [Website](https://rubymoney.github.io/money/)
38
37
  - [API Documentation](http://www.rubydoc.info/gems/money/frames)
39
38
  - [Git Repository](https://github.com/RubyMoney/money)
40
39
 
@@ -88,6 +87,9 @@ Money.from_amount(5, "TND") == Money.new(5000, "TND") # 5 TND
88
87
  some_code_to_setup_exchange_rates
89
88
  Money.new(1000, "USD").exchange_to("EUR") == Money.new(some_value, "EUR")
90
89
 
90
+ # Swap currency
91
+ Money.new(1000, "USD").with_currency("EUR") == Money.new(1000, "EUR")
92
+
91
93
  # Formatting (see Formatting section for more options)
92
94
  Money.new(100, "USD").format #=> "$1.00"
93
95
  Money.new(100, "GBP").format #=> "£1.00"
@@ -119,15 +121,15 @@ below.
119
121
 
120
122
  ``` ruby
121
123
  curr = {
122
- :priority => 1,
123
- :iso_code => "USD",
124
- :iso_numeric => "840",
125
- :name => "United States Dollar",
126
- :symbol => "$",
127
- :subunit => "Cent",
128
- :subunit_to_unit => 100,
129
- :separator => ".",
130
- :delimiter => ","
124
+ priority: 1,
125
+ iso_code: "USD",
126
+ iso_numeric: "840",
127
+ name: "United States Dollar",
128
+ symbol: "$",
129
+ subunit: "Cent",
130
+ subunit_to_unit: 100,
131
+ decimal_mark: ".",
132
+ thousands_separator: ","
131
133
  }
132
134
 
133
135
  Money::Currency.register(curr)
@@ -142,8 +144,8 @@ The pre-defined set of attributes includes:
142
144
  - `:symbol` the currency symbol (UTF-8 encoded)
143
145
  - `:subunit` the name of the fractional monetary unit
144
146
  - `:subunit_to_unit` the proportion between the unit and the subunit
145
- - `:separator` character between the whole and fraction amounts
146
- - `:delimiter` character between each thousands place
147
+ - `:decimal_mark` character between the whole and fraction amounts
148
+ - `:thousands_separator` character between each thousands place
147
149
 
148
150
  All attributes except `:iso_code` are optional. Some attributes, such as
149
151
  `:symbol`, are used by the Money class to print out a representation of the
@@ -157,7 +159,7 @@ The priority attribute is an arbitrary numerical value you can assign to the
157
159
 
158
160
  For instance, let's assume your Rails application needs to render a currency
159
161
  selector like the one available
160
- [here](http://finance.yahoo.com/currency-converter/). You can create a couple of
162
+ [here](https://finance.yahoo.com/currency-converter/). You can create a couple of
161
163
  custom methods to return the list of major currencies and all currencies as
162
164
  follows:
163
165
 
@@ -196,19 +198,19 @@ using:
196
198
  Money.default_currency = Money::Currency.new("CAD")
197
199
  ```
198
200
 
199
- If you use Rails, then `environment.rb` is a very good place to put this.
201
+ If you use [Rails](https://github.com/RubyMoney/money/tree/master#ruby-on-rails), then `config/initializers/money.rb` is a very good place to put this.
200
202
 
201
203
  ### Currency Exponent
202
204
 
203
205
  The exponent of a money value is the number of digits after the decimal
204
206
  separator (which separates the major unit from the minor unit). See e.g.
205
- [ISO 4217](http://www.currency-iso.org/en/shared/amendments/iso-4217-amendment.html) for more
206
- information. You can find the exponent (as a `Float`) by
207
+ [ISO 4217](https://www.currency-iso.org/en/shared/amendments/iso-4217-amendment.html) for more
208
+ information. You can find the exponent (as an `Integer`) by
207
209
 
208
210
  ``` ruby
209
- Money::Currency.new("USD").exponent # => 2.0
210
- Money::Currency.new("JPY").exponent # => 0.0
211
- Money::Currency.new("MGA").exponent # => 0.6989700043360189
211
+ Money::Currency.new("USD").exponent # => 2
212
+ Money::Currency.new("JPY").exponent # => 0
213
+ Money::Currency.new("MGA").exponent # => 1
212
214
  ```
213
215
 
214
216
  ### Currency Lookup
@@ -312,16 +314,17 @@ def marshal_dump; end
312
314
  The following example implements an `ActiveRecord` store to save exchange rates to a database.
313
315
 
314
316
  ```ruby
315
- # DB columns :from[String], :to[String], :rate[Float]
317
+ # rails g model exchange_rate from:string to:string rate:float
316
318
 
319
+ # for Rails 5 replace ActiveRecord::Base with ApplicationRecord
317
320
  class ExchangeRate < ActiveRecord::Base
318
321
  def self.get_rate(from_iso_code, to_iso_code)
319
- rate = find_by_from_and_to(from_iso_code, to_iso_code)
322
+ rate = find_by(from: from_iso_code, to: to_iso_code)
320
323
  rate.present? ? rate.rate : nil
321
324
  end
322
325
 
323
326
  def self.add_rate(from_iso_code, to_iso_code, rate)
324
- exrate = find_or_initialize_by_from_and_to(from_iso_code, to_iso_code)
327
+ exrate = find_or_initialize_by(from: from_iso_code, to: to_iso_code)
325
328
  exrate.rate = rate
326
329
  exrate.save!
327
330
  end
@@ -369,13 +372,25 @@ implementations.
369
372
 
370
373
  - [eu_central_bank](https://github.com/RubyMoney/eu_central_bank)
371
374
  - [google_currency](https://github.com/RubyMoney/google_currency)
372
- - [money-json-rates](https://github.com/askuratovsky/money-json-rates)
375
+ - [currencylayer](https://github.com/askuratovsky/currencylayer)
373
376
  - [nordea](https://github.com/matiaskorhonen/nordea)
374
377
  - [nbrb_currency](https://github.com/slbug/nbrb_currency)
375
378
  - [money-currencylayer-bank](https://github.com/phlegx/money-currencylayer-bank)
376
379
  - [money-open-exchange-rates](https://github.com/spk/money-open-exchange-rates)
377
380
  - [money-historical-bank](https://github.com/atwam/money-historical-bank)
378
381
  - [russian_central_bank](https://github.com/rmustafin/russian_central_bank)
382
+ - [money-uphold-bank](https://github.com/subvisual/money-uphold-bank)
383
+
384
+ ## Formatting
385
+
386
+ There are several formatting rules for when `Money#format` is called. For more information, check out the [formatting module source](https://github.com/RubyMoney/money/blob/master/lib/money/money/formatter.rb), or read the latest release's [rdoc version](http://www.rubydoc.info/gems/money/Money/Formatter).
387
+
388
+ If you wish to format money according to the EU's [Rules for expressing monetary units](http://publications.europa.eu/code/en/en-370303.htm#position) in either English, Irish, Latvian or Maltese:
389
+
390
+ ```ruby
391
+ m = Money.new('123', :gbp) # => #<Money fractional:123 currency:GBP>
392
+ m.format(symbol: m.currency.to_s + ' ') # => "GBP 1.23"
393
+ ```
379
394
 
380
395
  ## Ruby on Rails
381
396
 
@@ -383,39 +398,50 @@ To integrate money in a Rails application use [money-rails](https://github.com/R
383
398
 
384
399
  For deprecated methods of integrating with Rails, check [the wiki](https://github.com/RubyMoney/money/wiki).
385
400
 
386
- ## I18n
401
+ ## Localization
387
402
 
388
- If you want thousands seperator and decimal mark to be same across all
389
- currencies this can be defined in your `I18n` translation files.
403
+ In order to localize formatting you can use `I18n` gem:
404
+
405
+ ```ruby
406
+ Money.locale_backend = :i18n
407
+ ```
390
408
 
391
- In an rails application this may look like:
409
+ With this enabled a thousands seperator and a decimal mark will get looked up in your `I18n` translation files. In a Rails application this may look like:
392
410
 
393
411
  ```yml
394
412
  # config/locale/en.yml
395
413
  en:
396
- number:
397
- format:
398
- delimiter: ","
399
- separator: "."
400
- # or
401
414
  number:
402
415
  currency:
403
416
  format:
404
417
  delimiter: ","
405
418
  separator: "."
419
+ # falling back to
420
+ number:
421
+ format:
422
+ delimiter: ","
423
+ separator: "."
406
424
  ```
407
425
 
408
426
  For this example `Money.new(123456789, "SEK").format` will return `1,234,567.89
409
- kr` which otherwise will return `1 234 567,89 kr`.
427
+ kr` which otherwise would have returned `1 234 567,89 kr`.
428
+
429
+ This will work seamlessly with [rails-i18n](https://github.com/svenfuchs/rails-i18n) gem that already has a lot of locales defined.
430
+
431
+ If you wish to disable this feature and use defaults instead:
410
432
 
411
- If you wish to disable this feature:
412
433
  ``` ruby
413
- Money.use_i18n = false
434
+ Money.locale_backend = nil
414
435
  ```
415
436
 
437
+ ## Collection
438
+
439
+ In case you're working with collections of `Money` instances, have a look at [money-collection](https://github.com/RubyMoney/money-collection)
440
+ for improved performance and accuracy.
441
+
416
442
  ### Troubleshooting
417
443
 
418
- If you get a runtime error such as:
444
+ If you don't have some locale and don't want to get a runtime error such as:
419
445
 
420
446
  I18n::InvalidLocale: :en is not a valid locale
421
447
 
@@ -424,15 +450,9 @@ Set the following:
424
450
  I18n.enforce_available_locales = false
425
451
  ```
426
452
 
427
- ## Formatting
428
-
429
- There are several formatting rules for when `Money#format` is called. For more information, check out the [formatting module source](https://github.com/RubyMoney/money/blob/master/lib/money/money/formatting.rb), or read the latest release's [rdoc version](http://www.rubydoc.info/gems/money/Money/Formatting).
453
+ ## Heuristics
430
454
 
431
- If you wish to format money according to the EU's [Rules for expressing monetary units](http://publications.europa.eu/code/en/en-370303.htm#position) in either English, Irish, Latvian or Maltese:
432
- ```ruby
433
- m = Money.new('123', :gbp) # => #<Money fractional:123 currency:GBP>
434
- m.format( symbol: m.currency.to_s + ' ') # => "GBP 1.23"
435
- ```
455
+ Prior to v6.9.0 heuristic analysis of string input was part of this gem. Since then it was extracted in to [money-heuristics gem](https://github.com/RubyMoney/money-heuristics).
436
456
 
437
457
  ## Migration Notes
438
458