danconia 0.2.6 → 0.2.7

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
  SHA256:
3
- metadata.gz: ba0807109e90fd5f9f389815e67ccdfc8d58b4fdcb89dba2a80778ebe1c4b0e5
4
- data.tar.gz: e8b764b1a7063d2d113bddf5ea3315eed11db8f27681c030cb2fa36dbc10f04e
3
+ metadata.gz: baded88d58c693935472d8cc00e274384505ffd9859bca99c1accf4780f7cdf3
4
+ data.tar.gz: 50150e40b421805ff2f383250bb77f741932f66b4f324c9bb935388628521c77
5
5
  SHA512:
6
- metadata.gz: 1498f6ef4c4ebc334ada300bc4b203f84842d95d681c126698e31f21df1de8061a4930ed303b416581fc8a4c29fd3acd02a239c0cf0094da743c2b346cc4e0c0
7
- data.tar.gz: f45000331bb3e9657b77501fabdc692865e500afa8fcc09cf095f7788717a47e257e94afdf2058069f3910c3914f9b3a668f4a19adbbdd915f46ea1aca089243
6
+ metadata.gz: 5c936191102548a99cc30fddd737e95df0e9319adcfe6fbd12cd1d2a6b6b0228566c0f000da74125fbefa47ce63fe13e61417fce00ac69b3da531c71f7de9bb8
7
+ data.tar.gz: '09dffba5565f6c5207a396b943fd23bebe30eec94122ea4c86ade7ebeeebaa12294aa9378eb7cf2c7f7ab99ced0fcc424f81349f1d0c840b44e2cd2038be7733'
@@ -1,28 +1,27 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- danconia (0.2.6)
4
+ danconia (0.2.7)
5
5
  activerecord (>= 3.0.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activemodel (5.2.0)
11
- activesupport (= 5.2.0)
12
- activerecord (5.2.0)
13
- activemodel (= 5.2.0)
14
- activesupport (= 5.2.0)
15
- arel (>= 9.0)
16
- activesupport (5.2.0)
10
+ activemodel (6.0.0)
11
+ activesupport (= 6.0.0)
12
+ activerecord (6.0.0)
13
+ activemodel (= 6.0.0)
14
+ activesupport (= 6.0.0)
15
+ activesupport (6.0.0)
17
16
  concurrent-ruby (~> 1.0, >= 1.0.2)
18
17
  i18n (>= 0.7, < 2)
19
18
  minitest (~> 5.1)
20
19
  tzinfo (~> 1.1)
20
+ zeitwerk (~> 2.1, >= 2.1.8)
21
21
  addressable (2.5.2)
22
22
  public_suffix (>= 2.0.2, < 4.0)
23
- arel (9.0.0)
24
23
  coderay (1.1.2)
25
- concurrent-ruby (1.0.5)
24
+ concurrent-ruby (1.1.5)
26
25
  crack (0.4.3)
27
26
  safe_yaml (~> 1.0.0)
28
27
  diff-lcs (1.3)
@@ -43,7 +42,7 @@ GEM
43
42
  guard-compat (~> 1.1)
44
43
  rspec (>= 2.99.0, < 4.0)
45
44
  hashdiff (0.3.7)
46
- i18n (1.0.1)
45
+ i18n (1.7.0)
47
46
  concurrent-ruby (~> 1.0)
48
47
  listen (3.1.5)
49
48
  rb-fsevent (~> 0.9, >= 0.9.4)
@@ -51,7 +50,7 @@ GEM
51
50
  ruby_dep (~> 1.2)
52
51
  lumberjack (1.0.13)
53
52
  method_source (0.9.0)
54
- minitest (5.11.3)
53
+ minitest (5.13.0)
55
54
  nenv (0.3.0)
56
55
  notiffany (0.1.1)
57
56
  nenv (~> 0.1)
@@ -80,7 +79,7 @@ GEM
80
79
  ruby_dep (1.5.0)
81
80
  safe_yaml (1.0.4)
82
81
  shellany (0.0.1)
83
- sqlite3 (1.3.13)
82
+ sqlite3 (1.4.1)
84
83
  thor (0.20.0)
85
84
  thread_safe (0.3.6)
86
85
  tzinfo (1.2.5)
@@ -89,6 +88,7 @@ GEM
89
88
  addressable (>= 2.3.6)
90
89
  crack (>= 0.3.2)
91
90
  hashdiff
91
+ zeitwerk (2.1.10)
92
92
 
93
93
  PLATFORMS
94
94
  ruby
@@ -8,7 +8,9 @@ module Danconia
8
8
  end
9
9
 
10
10
  def rate from, to
11
- if from == 'USD' and direct_rate = @store.direct_rate(from, to)
11
+ if from == to
12
+ 1.0
13
+ elsif from == 'USD' and direct_rate = @store.direct_rate(from, to)
12
14
  direct_rate
13
15
  elsif to == 'USD' and inverse_rate = @store.direct_rate(to, from)
14
16
  (1.0 / inverse_rate).round 6
@@ -28,4 +30,4 @@ module Danconia
28
30
  end
29
31
  end
30
32
  end
31
- end
33
+ end
@@ -47,16 +47,10 @@ module Danconia
47
47
 
48
48
  def exchange_to other_currency
49
49
  other_currency = other_currency.presence && Currency.find(other_currency, exchange) || currency
50
- rate = exchange_rate_to(other_currency.code)
50
+ rate = exchange.rate currency.code, other_currency.code
51
51
  clone_with amount * rate, other_currency
52
52
  end
53
53
 
54
- def exchange_rate_to to
55
- from = currency.code
56
- return 1 if from == to
57
- exchange.rate from, to
58
- end
59
-
60
54
  %w(+ - * /).each do |op|
61
55
  class_eval <<-EOR, __FILE__, __LINE__ + 1
62
56
  def #{op} other
@@ -1,3 +1,3 @@
1
1
  module Danconia
2
- VERSION = '0.2.6'
2
+ VERSION = '0.2.7'
3
3
  end
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.6
4
+ version: 0.2.7
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-26 00:00:00.000000000 Z
11
+ date: 2019-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord