perpetuity-memory 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 477ff7a61d0901f4163007a2ee9e5a045ebde5ba
4
- data.tar.gz: 828e190b7a625cea3dca6e437cb9fda1eb31a323
3
+ metadata.gz: ca9f272273107e89f3ecac8937d20ccf945707e9
4
+ data.tar.gz: c74fd2ac60046eeaf97b8ffe523010da30616e86
5
5
  SHA512:
6
- metadata.gz: f0142345ad6aa81ba1974efeeaa838f203799a969432ec8b6c749f2010396987e00a54b3b662bd89ddb08a3826b34c7deabfb0ed7fc99a201361b0d13f544a1d
7
- data.tar.gz: 2df7c8961a04c70041710d9ace2c70d743648f7bdf8e0a2f399ca6c1ca9e5255a07b0186a6d601c57cb991f403f4c56cef1be2a61d4390ad678a8e8b19505527
6
+ metadata.gz: e31010b928e5ba96b9f4c6e4df201c78742fb5b66f0a6926588fb0a8149cd62aa663b1ba380c23abc356763c2b0bb27d575178babc8fabf5eec7589c415ac7cc
7
+ data.tar.gz: 16d030e599d7e18f149e6a818c64ed82fa356e2feb1ed0ff4b352a04f0c9d5d3a8ad781503728c5bdc2c290df666028e889fd4ad34f3d09c7a68b3add67135c0
@@ -8,7 +8,7 @@ module Perpetuity
8
8
  class Memory
9
9
  def initialize options = {}
10
10
  @cache = Hash.new
11
- @indexes = Hash.new { |hash, key| hash[key] = active_indexes(key) }
11
+ @indexes = Hash.new
12
12
  end
13
13
 
14
14
  def insert klass, attributes, _
@@ -99,15 +99,15 @@ module Perpetuity
99
99
 
100
100
 
101
101
  def index klass, attribute, options={}
102
- @indexes[klass] ||= Set.new
102
+ indexes(klass) << attribute
103
103
  end
104
104
 
105
105
  def indexes klass
106
- @indexes[klass]
106
+ @indexes[klass] ||= Set.new
107
107
  end
108
108
 
109
109
  def active_indexes klass
110
- Set.new
110
+ indexes(klass)
111
111
  end
112
112
 
113
113
  def activate_index! klass
@@ -1,5 +1,5 @@
1
1
  module Perpetuity
2
2
  module Memory
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
@@ -60,8 +60,9 @@ module Perpetuity
60
60
  end
61
61
 
62
62
  describe 'indexing' do
63
- it 'does nothing' do
64
- subject.index(klass, 'anything')
63
+ it 'keeps track of what attributes were indexed' do
64
+ subject.index(klass, Perpetuity::Attribute.new('name'))
65
+ subject.indexes(klass).map{|a| a.name}.should include('name')
65
66
  end
66
67
  end
67
68
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: perpetuity-memory
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamie Gaskins