money 6.8.1 → 6.8.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 15096aaaa1d4cd7f33b54b6763c3ee1fa35dbe30
4
- data.tar.gz: e8907ecf8a282428ae9f9da1f183acc2d615e508
3
+ metadata.gz: de64036375389ebf07d17aceb12d6c87cf9875c1
4
+ data.tar.gz: c06912a82016bbac71975470d8186045e4300440
5
5
  SHA512:
6
- metadata.gz: 1ffc7e4ebb66b8fe190add39f17fa26536d7e5de5e2130fa7d56c01a624ec7886671fe6ad389dd1d661721e168fa738ade3a44671e8616b9dfb83131fb121a99
7
- data.tar.gz: 76fbc5414418ccd7bce8e41c7baf481daf29574a641957274c20c830e338030795011a61f33d7c50daa9c3587f36eca1fdf1c51283535e719dd25ee3958a89a1
6
+ metadata.gz: 10dc51d8d65dabc317cc8b6f9f48acc4ec5fa404d27d08e04f280e7186e7d65e81e90cf27b586487e46637dd960c90b1972aa96fbe560400799c4a634539e94d
7
+ data.tar.gz: 11cc4587eec537e3faf392cdd61def5c93c0ccc2217c7f06d5f71d81ebcd3f037c1e8c46328d554d0b7e916afd9cbc981120cc6d264a291819f196fb1a96b367
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 6.8.2
4
+ - Removed subunits for HUF
5
+ - Fixed `#from_amount` accepting `nil` as currency_code
6
+ - Relaxed i18n version (< 0.9)
7
+ - Set symbol for UZS
8
+ - Added disambiguate_symbol for XFU
9
+ - Fixed Peruvian Sol name
10
+ - Fixed symbol_first for VND (now `false`)
11
+
3
12
  ## 6.8.1
4
13
  - Fixed issue with calling `format` on a frozen `Money` object
5
14
 
data/README.md CHANGED
@@ -1,12 +1,12 @@
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)
7
+ [![Inline docs](https://inch-ci.org/github/RubyMoney/money.svg)](https://inch-ci.org/github/RubyMoney/money)
8
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)
9
+ [![License](https://img.shields.io/github/license/RubyMoney/money.svg)](https://opensource.org/licenses/MIT)
10
10
 
11
11
  :warning: Please read the [migration notes](#migration-notes) before upgrading to a new major version.
12
12
 
@@ -34,7 +34,7 @@ A Ruby Library for dealing with money and currency conversion.
34
34
 
35
35
  ### Resources
36
36
 
37
- - [Website](http://rubymoney.github.io/money/)
37
+ - [Website](https://rubymoney.github.io/money/)
38
38
  - [API Documentation](http://www.rubydoc.info/gems/money/frames)
39
39
  - [Git Repository](https://github.com/RubyMoney/money)
40
40
 
@@ -157,7 +157,7 @@ The priority attribute is an arbitrary numerical value you can assign to the
157
157
 
158
158
  For instance, let's assume your Rails application needs to render a currency
159
159
  selector like the one available
160
- [here](http://finance.yahoo.com/currency-converter/). You can create a couple of
160
+ [here](https://finance.yahoo.com/currency-converter/). You can create a couple of
161
161
  custom methods to return the list of major currencies and all currencies as
162
162
  follows:
163
163
 
@@ -202,8 +202,8 @@ If you use Rails, then `environment.rb` is a very good place to put this.
202
202
 
203
203
  The exponent of a money value is the number of digits after the decimal
204
204
  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 an `Integer`) by
205
+ [ISO 4217](https://www.currency-iso.org/en/shared/amendments/iso-4217-amendment.html) for more
206
+ information. You can find the exponent (as an `Integer`) by
207
207
 
208
208
  ``` ruby
209
209
  Money::Currency.new("USD").exponent # => 2
@@ -932,7 +932,7 @@
932
932
  "symbol": "Ft",
933
933
  "alternate_symbols": [],
934
934
  "subunit": "Fillér",
935
- "subunit_to_unit": 100,
935
+ "subunit_to_unit": 1,
936
936
  "symbol_first": false,
937
937
  "html_entity": "",
938
938
  "decimal_mark": ",",
@@ -1675,7 +1675,7 @@
1675
1675
  "pen": {
1676
1676
  "priority": 100,
1677
1677
  "iso_code": "PEN",
1678
- "name": "Peruvian Nuevo Sol",
1678
+ "name": "Peruvian Sol",
1679
1679
  "symbol": "S/.",
1680
1680
  "alternate_symbols": [],
1681
1681
  "subunit": "Céntimo",
@@ -2289,7 +2289,7 @@
2289
2289
  "priority": 100,
2290
2290
  "iso_code": "UZS",
2291
2291
  "name": "Uzbekistan Som",
2292
- "symbol": null,
2292
+ "symbol": "",
2293
2293
  "alternate_symbols": ["so‘m", "сўм", "сум", "s", "с"],
2294
2294
  "subunit": "Tiyin",
2295
2295
  "subunit_to_unit": 100,
@@ -2323,7 +2323,7 @@
2323
2323
  "alternate_symbols": [],
2324
2324
  "subunit": "Hào",
2325
2325
  "subunit_to_unit": 1,
2326
- "symbol_first": true,
2326
+ "symbol_first": false,
2327
2327
  "html_entity": "&#x20AB;",
2328
2328
  "decimal_mark": ",",
2329
2329
  "thousands_separator": ".",
@@ -67,7 +67,7 @@
67
67
  "iso_code": "XFU",
68
68
  "name": "UIC Franc",
69
69
  "symbol": "",
70
- "disambiguate_symbol": "",
70
+ "disambiguate_symbol": "XFU",
71
71
  "alternate_symbols": [],
72
72
  "subunit": "",
73
73
  "subunit_to_unit": 100,
@@ -8,7 +8,7 @@ class Money
8
8
 
9
9
  # Represents a specific currency unit.
10
10
  #
11
- # @see http://en.wikipedia.org/wiki/Currency
11
+ # @see https://en.wikipedia.org/wiki/Currency
12
12
  # @see http://iso4217.net/
13
13
  class Currency
14
14
  include Comparable
@@ -112,12 +112,12 @@ class Money
112
112
  #
113
113
  # == monetary unit
114
114
  # The standard unit of value of a currency, as the dollar in the United States or the peso in Mexico.
115
- # http://www.answers.com/topic/monetary-unit
115
+ # https://www.answers.com/topic/monetary-unit
116
116
  # == fractional monetary unit, subunit
117
117
  # A monetary unit that is valued at a fraction (usually one hundredth) of the basic monetary unit
118
- # http://www.answers.com/topic/fractional-monetary-unit-subunit
118
+ # https://www.answers.com/topic/fractional-monetary-unit-subunit
119
119
  #
120
- # See http://en.wikipedia.org/wiki/List_of_circulating_currencies and
120
+ # See https://en.wikipedia.org/wiki/List_of_circulating_currencies and
121
121
  # http://search.cpan.org/~tnguyen/Locale-Currency-Format-1.28/Format.pm
122
122
  def table
123
123
  @table ||= load_currencies
@@ -229,7 +229,7 @@ class Money
229
229
  # @see #initialize
230
230
  def self.from_amount(amount, currency = default_currency, bank = default_bank)
231
231
  Numeric === amount or raise ArgumentError, "'amount' must be numeric"
232
- currency = Currency.wrap(currency)
232
+ currency = Currency.wrap(currency) || Money.default_currency
233
233
  value = amount.to_d * currency.subunit_to_unit
234
234
  value = value.round(0, rounding_mode) unless infinite_precision
235
235
  new(value, currency, bank)
@@ -1,3 +1,3 @@
1
1
  class Money
2
- VERSION = "6.8.1"
2
+ VERSION = "6.8.2"
3
3
  end
@@ -9,12 +9,12 @@ Gem::Specification.new do |s|
9
9
  s.platform = Gem::Platform::RUBY
10
10
  s.authors = ["Shane Emmons"]
11
11
  s.email = ["shane@emmons.io"]
12
- s.homepage = "http://rubymoney.github.io/money"
12
+ s.homepage = "https://rubymoney.github.io/money"
13
13
  s.summary = "A Ruby Library for dealing with money and currency conversion."
14
14
  s.description = "A Ruby Library for dealing with money and currency conversion."
15
15
  s.license = "MIT"
16
16
 
17
- s.add_dependency 'i18n', ['>= 0.6.4', '<= 0.7.0']
17
+ s.add_dependency 'i18n', ['>= 0.6.4', '< 0.9']
18
18
  s.add_dependency 'sixarm_ruby_unaccent', ['>= 1.1.1', '< 2']
19
19
 
20
20
  s.add_development_dependency "bundler", "~> 1.3"
@@ -324,6 +324,9 @@ describe Money, "formatting" do
324
324
  # Brazilian Real
325
325
  expect(one["BRL"]).to eq "R$1,00"
326
326
 
327
+ # Vietnamese Dong
328
+ expect(one["VND"]).to eq "100 ₫"
329
+
327
330
  # Other
328
331
  expect(one["SEK"]).to eq "1,00 kr"
329
332
  expect(one["GHC"]).to eq "₵1.00"
@@ -169,6 +169,16 @@ describe Money do
169
169
  Money.from_amount(1.999).to_d
170
170
  end).to eq 1.99
171
171
  end
172
+
173
+ context 'given a currency is provided' do
174
+ context 'and the currency is nil' do
175
+ let(:currency) { nil }
176
+
177
+ it "should have the default currency" do
178
+ expect(Money.from_amount(1, currency).currency).to eq Money.default_currency
179
+ end
180
+ end
181
+ end
172
182
  end
173
183
 
174
184
  %w[cents pence].each do |units|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: money
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.8.1
4
+ version: 6.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane Emmons
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-08 00:00:00.000000000 Z
11
+ date: 2017-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -17,9 +17,9 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.6.4
20
- - - "<="
20
+ - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: 0.7.0
22
+ version: '0.9'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -27,9 +27,9 @@ dependencies:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
29
  version: 0.6.4
30
- - - "<="
30
+ - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: 0.7.0
32
+ version: '0.9'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: sixarm_ruby_unaccent
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -167,7 +167,7 @@ files:
167
167
  - spec/money_spec.rb
168
168
  - spec/rates_store/memory_spec.rb
169
169
  - spec/spec_helper.rb
170
- homepage: http://rubymoney.github.io/money
170
+ homepage: https://rubymoney.github.io/money
171
171
  licenses:
172
172
  - MIT
173
173
  metadata: {}
@@ -187,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
187
187
  version: '0'
188
188
  requirements: []
189
189
  rubyforge_project:
190
- rubygems_version: 2.5.1
190
+ rubygems_version: 2.6.8
191
191
  signing_key:
192
192
  specification_version: 4
193
193
  summary: A Ruby Library for dealing with money and currency conversion.