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 +4 -4
- data/CHANGELOG.md +9 -0
- data/README.md +7 -7
- data/config/currency_iso.json +4 -4
- data/config/currency_non_iso.json +1 -1
- data/lib/money/currency.rb +4 -4
- data/lib/money/money.rb +1 -1
- data/lib/money/version.rb +1 -1
- data/money.gemspec +2 -2
- data/spec/money/formatting_spec.rb +3 -0
- data/spec/money_spec.rb +10 -0
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de64036375389ebf07d17aceb12d6c87cf9875c1
|
4
|
+
data.tar.gz: c06912a82016bbac71975470d8186045e4300440
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10dc51d8d65dabc317cc8b6f9f48acc4ec5fa404d27d08e04f280e7186e7d65e81e90cf27b586487e46637dd960c90b1972aa96fbe560400799c4a634539e94d
|
7
|
+
data.tar.gz: 11cc4587eec537e3faf392cdd61def5c93c0ccc2217c7f06d5f71d81ebcd3f037c1e8c46328d554d0b7e916afd9cbc981120cc6d264a291819f196fb1a96b367
|
data/CHANGELOG.md
CHANGED
@@ -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)](
|
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](
|
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)](
|
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](
|
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](
|
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](
|
206
|
-
information.
|
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
|
data/config/currency_iso.json
CHANGED
@@ -932,7 +932,7 @@
|
|
932
932
|
"symbol": "Ft",
|
933
933
|
"alternate_symbols": [],
|
934
934
|
"subunit": "Fillér",
|
935
|
-
"subunit_to_unit":
|
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
|
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":
|
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":
|
2326
|
+
"symbol_first": false,
|
2327
2327
|
"html_entity": "₫",
|
2328
2328
|
"decimal_mark": ",",
|
2329
2329
|
"thousands_separator": ".",
|
data/lib/money/currency.rb
CHANGED
@@ -8,7 +8,7 @@ class Money
|
|
8
8
|
|
9
9
|
# Represents a specific currency unit.
|
10
10
|
#
|
11
|
-
# @see
|
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
|
-
#
|
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
|
-
#
|
118
|
+
# https://www.answers.com/topic/fractional-monetary-unit-subunit
|
119
119
|
#
|
120
|
-
# See
|
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
|
data/lib/money/money.rb
CHANGED
@@ -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)
|
data/lib/money/version.rb
CHANGED
data/money.gemspec
CHANGED
@@ -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 = "
|
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', '
|
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"
|
data/spec/money_spec.rb
CHANGED
@@ -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.
|
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-
|
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.
|
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.
|
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:
|
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.
|
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.
|