mongoid_money_field 7.3.0 → 7.3.1

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: 8ae43f2d2161532a660a5d3e9cfb2b4622ee845c6d2fd48b67d0483104228d3e
4
- data.tar.gz: 96472c8e8ca9b1834cfa3d954261bc6c2d36fd508559c9924932d2a65e44f71a
3
+ metadata.gz: b5d42e0e5b76a46f273daf85b160ff381397b65464f10dcc5755ffc32dcda6cd
4
+ data.tar.gz: 58093c0fd31e48717a0bc26e075d94f35bb27fb6b1d94d1dffc6263234244322
5
5
  SHA512:
6
- metadata.gz: 6af1c9e78278977317d8a4cc49e633f8149cedc94fc2680d4aad6ba985e1d8e19cd57c203005d45afcc7b1930d9c83ddd3ce8f3ae60ce0527fa5bccc2e756bc0
7
- data.tar.gz: 5c9a1573f1abd2e0f4c534975cf390882d2ea949117e53cc50ba3837b9706e1b80c6878e7c7ab390b7c14c1fbcfcaba2466a57dcc2b923fdf1a418943815a234
6
+ metadata.gz: c813bb22e338eb7d9ab013ee1580cebd783be96840f55c0214b3a34b19f37420b6cd8a6dd710005c7c4389cb0b22efb28cf4596644c3d6678c0e56203c934df9
7
+ data.tar.gz: 871c56d08a3863894300171d5b56702a0e6d226a8e49fa984797fb129e4c8dc01b88b4817e1bba8b959f01d77c0c974617c54ad918be85a660663d1060c30ded
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mongoid_money_field (7.3.0)
4
+ mongoid_money_field (7.3.1)
5
5
  monetize
6
6
  money (~> 6.19)
7
7
  mongoid (~> 7.0)
@@ -16,7 +16,7 @@ class Money
16
16
  # this custom class from it.
17
17
  def demongoize(object)
18
18
  if object.is_a?(Hash)
19
- object = object.symbolize_keys
19
+ object = object.symbolize_keys unless object.is_a?(BSON::Document)
20
20
  object.has_key?(:cents) ? ::Money.new(object[:cents], object[:currency_iso]) : nil
21
21
  else
22
22
  nil
@@ -27,11 +27,9 @@ class Money
27
27
  # stored in the database.
28
28
  def mongoize(object)
29
29
  case
30
- when object.is_a?(BSON::Document) then
31
- ::Money.new(object[:cents], object[:currency_iso]).mongoize
32
30
  when object.is_a?(Money) then object.mongoize
33
31
  when object.is_a?(Hash) then
34
- object.symbolize_keys! if object.respond_to?(:symbolize_keys!)
32
+ object.symbolize_keys! if object.respond_to?(:symbolize_keys!) && !object.is_a?(BSON::Document)
35
33
  ::Money.new(object[:cents], object[:currency_iso]).mongoize
36
34
  when object.respond_to?(:to_money) then
37
35
  object.to_money.mongoize
@@ -48,11 +48,9 @@ class MoneyType
48
48
  end
49
49
 
50
50
  ret = case
51
- when object.is_a?(BSON::Document) then
52
- ::Money.new(object[:cents], object[:currency_iso]).mongoize
53
51
  when object.is_a?(Money) then object.mongoize
54
52
  when object.is_a?(Hash) then
55
- object.symbolize_keys! if object.respond_to?(:symbolize_keys!)
53
+ object.symbolize_keys! if object.respond_to?(:symbolize_keys!) && !object.is_a?(BSON::Document)
56
54
  ::Money.new(object[:cents], object[:currency_iso]).mongoize
57
55
  when object.blank? then
58
56
  if !@options[:default].nil?
@@ -1,3 +1,3 @@
1
1
  module MongoidMoneyField
2
- VERSION = "7.3.0"
2
+ VERSION = "7.3.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid_money_field
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.3.0
4
+ version: 7.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gleb Tv