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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d6b4efdcbfa9194f5ec8161940ce18fb5830ce4d
4
- data.tar.gz: edc7d1311c79d32f7de93d3eae58bd103c463702
3
+ metadata.gz: 3279773707e3e0b96040ffb066b309896a78e4da
4
+ data.tar.gz: 5f227bababaa2f002ba63a196627a6bf6e55e397
5
5
  SHA512:
6
- metadata.gz: 154642183b91bff7974e80e1a298c3e00f968c6f4f584b5b6f7a1f7ea29ce10a60c56ef2ad3806be8aa207f876e638fb6a750f94a4860ff7b1b4389e7bb7b829
7
- data.tar.gz: be899db40b4371c901e3a7c2722ea5ccb5041c8de867eab5a7ced5c59324e6a80053d9ea61818531816497d244690aafa7375473116f9229c2c7b9b9d9ae2e57
6
+ metadata.gz: ac711ed8cff10390e3811a8b859c78e82f6a71df1c6e7855ebc59c8dc2a1e8438664fd00fd3cbd37601235eac5be2572acfe926f7874108d80b499f0bd069208
7
+ data.tar.gz: 5238c2e0c72702c4561d226943ae6ae0681888f4f451c236b49f7133fb9ad733c071fae97c24724e82520771bb9e1d1e886c5b0f7e12ec16b0c94b2b0e0dd759
@@ -1,5 +1,5 @@
1
1
  class Store
2
2
  class ActiveRecord
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.6"
4
4
  end
5
5
  end
@@ -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
- ordered_entities.map(&:to_hash)
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
- def all
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: store-active_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Owiesniak