volt-mongo 0.1.4 → 0.2.0

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
  SHA1:
3
- metadata.gz: 96dcd1e4f9f6fa85d764bda674f158db0cc78d78
4
- data.tar.gz: ffc67a58b285094b57b3d0354e8a5dabfef3679d
3
+ metadata.gz: 0d5451b5e19ea1fc769bbc11ec88b87c39d67999
4
+ data.tar.gz: 3a3f9b654c9917f35bea51a5e5f514957dda9e51
5
5
  SHA512:
6
- metadata.gz: 6d83fef88ac38f28c929a50df51276959f0d10b2becec690f1aa72339f9a6e718b226b8bf70f12b53b55d22a295da550267dae54b04aeb0c7909cfdc960239ac
7
- data.tar.gz: 030ed7d5a6c4cbd52112b185ec6ae76e511a048b842bae8dae64ec242a454ee076b3d47a7dc76c9dd11164397a59ceb727a594b7e79a15e830b48ba2d131645c
6
+ metadata.gz: cf08cb5f082845f02a19bec54e7485903aa4a19db7863debf69f6e88c24792528b1f0b22ba42d422141b4f04cc0d97c08ad609431d09d14aa5a6a199a81ce443
7
+ data.tar.gz: 8fe791f9c5fc615fd9046d608497a8a6c7c69f3425b84167b25d9ce3bbdbbfb0757dd06e5bbb0eb5d890e7fc611d3a900bc73a7c705c75489ae5229688466a67
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.2.0
@@ -1,4 +1,5 @@
1
1
  require 'mongo'
2
+ require 'volt/utils/data_transformer'
2
3
 
3
4
  # We need to be able to deeply stringify keys for mongo
4
5
  class Hash
@@ -50,6 +51,13 @@ module Volt
50
51
 
51
52
  def update(collection, values)
52
53
  values = values.nested_stringify_keys
54
+ values = Volt::DataTransformer.transform(values) do |value|
55
+ if defined?(VoltTime) && value.is_a?(VoltTime)
56
+ value.to_time
57
+ else
58
+ value
59
+ end
60
+ end
53
61
 
54
62
  to_mongo_id!(values)
55
63
  # TODO: Seems mongo is dumb and doesn't let you upsert with custom id's
@@ -112,7 +120,15 @@ module Volt
112
120
  end#.tap {|v| puts "QUERY: " + v.inspect }
113
121
  end
114
122
 
115
- result
123
+ values = Volt::DataTransformer.transform(result) do |value|
124
+ if defined?(VoltTime) && value.is_a?(Time)
125
+ value = VoltTime.from_time(value)
126
+ else
127
+ value
128
+ end
129
+ end
130
+
131
+ values
116
132
  end
117
133
 
118
134
  def delete(collection, query)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: volt-mongo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Stout
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-19 00:00:00.000000000 Z
11
+ date: 2015-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongo