store-memory 0.0.2 → 0.0.3

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: b18a12e1a63f9d04de12848a92abee4dc8f5ae83
4
- data.tar.gz: 69cd620454bc33d4dda3ee4a56b386c91baa46b8
3
+ metadata.gz: 25cf8a3bda43b3c159ab59944e48fe1c8fa22af1
4
+ data.tar.gz: 01f0183cc781f046f61a9d598c2b05d02de79a3f
5
5
  SHA512:
6
- metadata.gz: 69780101fe15e18f21f63e02ba93191f15adfa850f4c61d0a7423b00ae0cc808602b65e23183bcef4054d1e622ee4afc030c7695c588fa0531945461d575efd7
7
- data.tar.gz: d0c822279ccfacae3d9eb3debcd1ec48e93360521534f05b38cb5512c5a7607749d48f01fd26ffbb0fdcc7392a104fb5ad03ebd050e6f73e935ddbbd971e5ba8
6
+ metadata.gz: 1fc9d1652882e369a764c0b9da000a3ca901f5a14f89594ab55f53a43bf2ed56d583c1e7ebf7812a2f199556654296f84c3e76664acb69c250742bfd3e4e49ae
7
+ data.tar.gz: 29f72db4987a71376024eda953768da8bda9825a72311221b6376d4636bb77a72199cc54d0a811f23fc5a61dd723d1be6d7272b7823f2bc46ac502ea3ccc97b7
@@ -1,5 +1,5 @@
1
1
  class Store
2
2
  class Memory
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
data/lib/store/memory.rb CHANGED
@@ -23,31 +23,39 @@ class Store
23
23
  end
24
24
 
25
25
  def delete(id)
26
- @items.delete(id)
26
+ items.delete(id)
27
27
  id
28
28
  end
29
29
 
30
30
  def single_find(id)
31
- dup(@items[id])
31
+ dup(items[id])
32
32
  end
33
33
 
34
34
  def bulk_find(ids)
35
- @items.values_at(*ids).map do |data|
36
- dup data
37
- end
35
+ collection(items.values_at(*ids))
38
36
  end
39
-
37
+
38
+ def all
39
+ collection(items.values)
40
+ end
41
+
40
42
  def count
41
43
  all.size
42
44
  end
43
-
44
- def all
45
- @items.values.map do |data|
46
- dup data
45
+
46
+ private
47
+
48
+ def collection(items)
49
+ @result = {}
50
+ items.map do |data|
51
+ @result.merge!(data['uid'] => dup(data))
47
52
  end
53
+ @result
54
+ end
55
+
56
+ def items
57
+ @items
48
58
  end
49
-
50
- private
51
59
 
52
60
  def next_id
53
61
  @id += 1
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: store-memory
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Owiesniak