monetize 1.5.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/CHANGELOG.md +4 -1
- data/Gemfile +1 -1
- data/lib/monetize/version.rb +1 -1
- data/lib/monetize.rb +2 -1
- data/monetize.gemspec +1 -1
- data/spec/monetize_spec.rb +6 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 752c49ba346a3c44c84575d7c9342729666430e8
|
4
|
+
data.tar.gz: 177308181d7d1a004ace9e3d7d1b3f341a074ac0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b3736c481b79a3c1faa4e3187181a862a4861567166b30b8196b9966d7828d7f3d8a279c03c69453dda14f3f4124723df03389f396b16842e5d3ebe9ee096e5
|
7
|
+
data.tar.gz: f11c8c2062a848b0d5fac52f05c8d9c86c8707f0fbb04772c83f324e906c903f347bce9072f55000c463e3757a7367fdf68d704655b3417e77329d11b28b548a
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.6.0
|
4
|
+
- Ruby 2.4.0 support
|
5
|
+
- Money version updated to 6.8
|
6
|
+
|
3
7
|
## 1.5.0
|
4
8
|
- Add extra currencies:
|
5
9
|
- Azerbaijani manat
|
@@ -23,7 +27,6 @@
|
|
23
27
|
- Suppress errors when using parse. Use `parse!` instead
|
24
28
|
- Strip currency symbol prefix when parsing input
|
25
29
|
|
26
|
-
|
27
30
|
## 1.4.0
|
28
31
|
- Required Forwardable on Collection to resolve NameError [\#44](https://github.com/RubyMoney/monetize/issues/44)
|
29
32
|
- Add capability to parse currency amounts given with suffixes (K, M, B, and T)
|
data/Gemfile
CHANGED
data/lib/monetize/version.rb
CHANGED
data/lib/monetize.rb
CHANGED
@@ -92,6 +92,7 @@ module Monetize
|
|
92
92
|
value *= currency.subunit_to_unit
|
93
93
|
Money.new(value, currency)
|
94
94
|
end
|
95
|
+
singleton_class.send(:alias_method, :from_integer, :from_fixnum)
|
95
96
|
|
96
97
|
def self.from_float(value, currency = Money.default_currency)
|
97
98
|
value = BigDecimal.new(value.to_s)
|
@@ -107,7 +108,7 @@ module Monetize
|
|
107
108
|
|
108
109
|
def self.from_numeric(value, currency = Money.default_currency)
|
109
110
|
case value
|
110
|
-
when
|
111
|
+
when Integer
|
111
112
|
from_fixnum(value, currency)
|
112
113
|
when Numeric
|
113
114
|
value = BigDecimal.new(value.to_s)
|
data/monetize.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
20
|
spec.require_paths = ['lib']
|
21
21
|
|
22
|
-
spec.add_dependency 'money', '~> 6.
|
22
|
+
spec.add_dependency 'money', '~> 6.8'
|
23
23
|
|
24
24
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
25
25
|
spec.add_development_dependency 'rake'
|
data/spec/monetize_spec.rb
CHANGED
@@ -232,11 +232,11 @@ describe Monetize do
|
|
232
232
|
end
|
233
233
|
|
234
234
|
context 'parsing an instance of Numeric class' do
|
235
|
-
let(:
|
235
|
+
let(:integer) { 10 }
|
236
236
|
let(:float) { 10.0 }
|
237
237
|
let(:big_decimal) { BigDecimal.new('10') }
|
238
238
|
|
239
|
-
[:
|
239
|
+
[:integer, :float, :big_decimal].each do |type|
|
240
240
|
it "returns a new Money object based on the #{type} input" do
|
241
241
|
money = Monetize.parse(send(type), 'USD')
|
242
242
|
|
@@ -386,6 +386,10 @@ describe Monetize do
|
|
386
386
|
m = Monetize.from_fixnum(1, 'EUR')
|
387
387
|
expect(m.currency).to eq Money::Currency.wrap('EUR')
|
388
388
|
end
|
389
|
+
|
390
|
+
it 'is aliased as from_integer' do
|
391
|
+
expect(Monetize.from_integer(1)).to eq(Monetize.from_fixnum(1))
|
392
|
+
end
|
389
393
|
end
|
390
394
|
|
391
395
|
describe '.from_float' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: monetize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shane Emmons
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: money
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '6.
|
19
|
+
version: '6.8'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '6.
|
26
|
+
version: '6.8'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|