danconia 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/danconia/currency.rb +1 -1
- data/lib/danconia/money.rb +4 -5
- data/lib/danconia/version.rb +1 -1
- data/spec/danconia/money_spec.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0d5dc00e594f543c6dcf27352eec9467372cd7e69072eb4ca636c9e419e8b4f
|
4
|
+
data.tar.gz: 036db15d0219ff5b54740a01242bbe0ad50c124fee81ee69b29e188a45c48394
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 471253b1395d2786e7f1af1c56183a9c4c7b49f88ee5e66c2669aec4d1c8e698bb673a3641fa99c3050a540136736b23bc2ae925c2bc0616711c5bdd8ba98f03
|
7
|
+
data.tar.gz: c59f6a75f1f1f18d57c295c3298df249c87d6f551dd845fb889f23fbad655961fb38ad622d5867869d85df0e851fee9b5197feda3492cf67db68f08ec0906ecb
|
data/Gemfile.lock
CHANGED
data/lib/danconia/currency.rb
CHANGED
data/lib/danconia/money.rb
CHANGED
@@ -13,13 +13,12 @@ module Danconia
|
|
13
13
|
@exchange = exchange
|
14
14
|
end
|
15
15
|
|
16
|
-
def format decimals: @decimals
|
17
|
-
|
16
|
+
def format decimals: @decimals, **other_options
|
17
|
+
opts = other_options.reverse_merge precision: decimals, unit: currency.symbol
|
18
|
+
ActiveSupport::NumberHelper.number_to_currency amount, opts
|
18
19
|
end
|
19
20
|
|
20
|
-
|
21
|
-
format
|
22
|
-
end
|
21
|
+
alias to_s format
|
23
22
|
|
24
23
|
def inspect
|
25
24
|
"#{amount} #{currency.code}"
|
data/lib/danconia/version.rb
CHANGED
data/spec/danconia/money_spec.rb
CHANGED
@@ -89,6 +89,10 @@ module Danconia
|
|
89
89
|
it 'allow to override the number of decimals' do
|
90
90
|
expect(Money(3.561, decimals: 3).format(decimals: 1)).to eq '$3.6'
|
91
91
|
end
|
92
|
+
|
93
|
+
it 'pass the options to the activesupport helper' do
|
94
|
+
expect(Money(2).format(format: '%n %u')).to eq '2.00 $'
|
95
|
+
end
|
92
96
|
end
|
93
97
|
|
94
98
|
context 'to_s' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danconia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emmanuel Nicolau
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|