uorm 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,17 +13,13 @@ module Uorm
13
13
  end
14
14
 
15
15
  def all options = {}
16
- keys = collection.keys
17
- return [] if keys.empty?
18
-
19
- collection.mget(keys).map do |val|
20
- MultiJson.load val if val
21
- end
16
+ ids = collection.keys
17
+ return [] if ids.empty?
18
+ ids.map { |id| find id }
22
19
  end
23
20
 
24
21
  def find id
25
- data = collection.get id
26
- MultiJson.load data if data
22
+ collection.mapped_hmget id, *model.fields.map(&:name)
27
23
  end
28
24
 
29
25
  def create object
@@ -42,7 +38,7 @@ module Uorm
42
38
  private
43
39
 
44
40
  def write object
45
- collection.set object.id, MultiJson.dump(object)
41
+ collection.mapped_hmset object.id, object.attributes
46
42
  end
47
43
  end
48
44
  end
data/lib/uorm/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Uorm
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uorm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: