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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2ad8e13934be05481be0f5f5830df44fb673655b72478fb72521949c231d165c
4
- data.tar.gz: bbf515b791d138967fa50435214ecdfe3f29e967f6b758f1731c82c2eb965aaa
3
+ metadata.gz: c0d5dc00e594f543c6dcf27352eec9467372cd7e69072eb4ca636c9e419e8b4f
4
+ data.tar.gz: 036db15d0219ff5b54740a01242bbe0ad50c124fee81ee69b29e188a45c48394
5
5
  SHA512:
6
- metadata.gz: 1cf5f8694e43c05f90aa6be8dbc07ebf9a8b07ae43ed1bf219ff0ab4e7a79cffd0c69220997b7733eb8b78900e987fe61a2c18acc1fb361daef3a4f96cfce610
7
- data.tar.gz: 5168ff74019cec1a6b39536fe6ffc1f7b94d9adb9dd7610692305990768db8c3b6fcd8c07dec8b276c2f57eb1bea5d6a9e5f7e5730a46ca74c020fac27474faf
6
+ metadata.gz: 471253b1395d2786e7f1af1c56183a9c4c7b49f88ee5e66c2669aec4d1c8e698bb673a3641fa99c3050a540136736b23bc2ae925c2bc0616711c5bdd8ba98f03
7
+ data.tar.gz: c59f6a75f1f1f18d57c295c3298df249c87d6f551dd845fb889f23fbad655961fb38ad622d5867869d85df0e851fee9b5197feda3492cf67db68f08ec0906ecb
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- danconia (0.2.4)
4
+ danconia (0.2.5)
5
5
  activerecord (>= 3.0.0)
6
6
 
7
7
  GEM
@@ -5,4 +5,4 @@ module Danconia
5
5
  new Danconia.config.available_currencies.find { |c| c[:code] == code } || {code: code, symbol: '$'}
6
6
  end
7
7
  end
8
- end
8
+ end
@@ -13,13 +13,12 @@ module Danconia
13
13
  @exchange = exchange
14
14
  end
15
15
 
16
- def format decimals: @decimals
17
- ActiveSupport::NumberHelper.number_to_currency amount, precision: decimals, unit: currency.symbol
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
- def to_s
21
- format
22
- end
21
+ alias to_s format
23
22
 
24
23
  def inspect
25
24
  "#{amount} #{currency.code}"
@@ -1,3 +1,3 @@
1
1
  module Danconia
2
- VERSION = '0.2.4'
2
+ VERSION = '0.2.5'
3
3
  end
@@ -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
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-16 00:00:00.000000000 Z
11
+ date: 2018-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord