store-active_record 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/store/active_record/version.rb +1 -1
- data/lib/store/active_record.rb +12 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3279773707e3e0b96040ffb066b309896a78e4da
|
4
|
+
data.tar.gz: 5f227bababaa2f002ba63a196627a6bf6e55e397
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac711ed8cff10390e3811a8b859c78e82f6a71df1c6e7855ebc59c8dc2a1e8438664fd00fd3cbd37601235eac5be2572acfe926f7874108d80b499f0bd069208
|
7
|
+
data.tar.gz: 5238c2e0c72702c4561d226943ae6ae0681888f4f451c236b49f7133fb9ad733c071fae97c24724e82520771bb9e1d1e886c5b0f7e12ec16b0c94b2b0e0dd759
|
data/lib/store/active_record.rb
CHANGED
@@ -39,21 +39,28 @@ class Store
|
|
39
39
|
ordered_entities = ids.map do |id|
|
40
40
|
entities.detect {|entity| entity.id == id.to_i }
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
|
+
collection(ordered_entities)
|
44
|
+
end
|
45
|
+
|
46
|
+
def all
|
47
|
+
collection(items)
|
43
48
|
end
|
44
49
|
|
45
50
|
def count
|
46
51
|
cls.count
|
47
52
|
end
|
48
53
|
|
49
|
-
|
54
|
+
private
|
55
|
+
|
56
|
+
def collection(items)
|
57
|
+
@result = {}
|
50
58
|
items.map do |item|
|
51
|
-
item.to_hash
|
59
|
+
@result.merge!(item.uid => item.to_hash)
|
52
60
|
end
|
61
|
+
@result
|
53
62
|
end
|
54
63
|
|
55
|
-
private
|
56
|
-
|
57
64
|
def items
|
58
65
|
cls.all
|
59
66
|
end
|