dw_money 0.1.2 → 0.1.3

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
  SHA1:
3
- metadata.gz: 9ac9e0927e29f104c85b0d5ca995b169b7c62b2d
4
- data.tar.gz: f47a4639cc45001e74522897eaf15e4220108eb8
3
+ metadata.gz: ebe7747dee9aafde412a4374a6b0fba54ee63599
4
+ data.tar.gz: c38ad2a40c4909635e00344c5a0bd90ca69c0b99
5
5
  SHA512:
6
- metadata.gz: 2959f39fe10ad20899bf355c01798a8f4717674b28b4241e9f1aa4f0eb9140812646c4776fa089346465f71ce0ef83935cfa48ed14904c867fcd3b69d6cc30a9
7
- data.tar.gz: 3ceb28a31bfe9999d316c8b1d5605691ead4e63748c72cbfe2b6011998ee31609efa874f93b9888cb839c981ab9b459b47866edc51c2e8a7b6b9967193a88e84
6
+ metadata.gz: 0f441a9ea3a8fa8b0ed73bfb0bbba918097663b998c50598e5f733e967c12031aa69b4e67d10a24299b0646fb06977bb483ec95d0f929222d2dce1332ae64529
7
+ data.tar.gz: b401bf694cf52e6087b950d31af0cc7e30e651ccc01ac78a314a6b0b96ec2c0b619a4743394c5c04cf199239588d94760c558e830ec61120f3b6179186adede1
@@ -15,6 +15,10 @@ module DwMoney
15
15
  @conversion_rates[base_currency] = rates
16
16
  end
17
17
 
18
+ def self.conversion_rates_configuration
19
+ @conversion_rates
20
+ end
21
+
18
22
  def initialize(amount, currency)
19
23
  @amount = amount
20
24
  @currency = currency
@@ -33,8 +37,8 @@ module DwMoney
33
37
  Money.new(new_amount, new_currency)
34
38
  end
35
39
 
36
- def self.conversion_rates_configuration
37
- @conversion_rates
40
+ def <=>(other)
41
+ amount.round(2) <=> other.convert_to(currency).amount.round(2)
38
42
  end
39
43
 
40
44
  private
@@ -1,10 +1,6 @@
1
1
  module DwMoney
2
2
  class Money
3
3
  module Arithmetic
4
- def <=>(other)
5
- amount.round(2) <=> other.convert_to(currency).amount.round(2)
6
- end
7
-
8
4
  [:+, :-, :*, :/].each do |math_operator|
9
5
  define_method(math_operator) do |other|
10
6
  raise TypeError unless other.is_a?(Money) || other.is_a?(Numeric)
@@ -1,3 +1,3 @@
1
1
  module DwMoney
2
- VERSION = '0.1.2'.freeze
2
+ VERSION = '0.1.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dw_money
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pedro Vitti