relix 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY.md CHANGED
@@ -1,3 +1,9 @@
1
+ ### 1.2.1
2
+
3
+ * Handle out of memory errors better. (myronmarston)
4
+ * Property deindex immutable attributes. (myronmarston)
5
+ * Allow offsetting primary key lookup by a primary key. (ntalbott)
6
+
1
7
  ### 1.2.0
2
8
 
3
9
  * Improved keyer inheritance, including better legacy
@@ -106,7 +106,12 @@ module Relix
106
106
  current_values = @redis.hgetall(current_values_name)
107
107
 
108
108
  indexes.map do |name, index|
109
- old_value = current_values[name]
109
+ old_value = if index.attribute_immutable?
110
+ index.read_normalized(object)
111
+ else
112
+ current_values[name]
113
+ end
114
+
110
115
  ((watch = index.watch(old_value)) && @redis.watch(*watch))
111
116
  proc { index.deindex(@redis, pk, object, old_value) }
112
117
  end.tap { |ops| ops << proc { @redis.del current_values_name } }
@@ -143,7 +148,7 @@ module Relix
143
148
  end
144
149
 
145
150
  if results
146
- results.each do |result|
151
+ Array(results).each do |result|
147
152
  raise RedisIndexingError.new(result.message) if Exception === result
148
153
  end
149
154
  break
@@ -34,6 +34,12 @@ module Relix
34
34
  def eq(r, value, options)
35
35
  [value]
36
36
  end
37
+
38
+ def position(r, pk, value)
39
+ position = r.zrank(name, pk)
40
+ raise MissingIndexValueError, "Cannot find key #{pk} in index" unless position
41
+ position
42
+ end
37
43
  end
38
44
  register_index PrimaryKeyIndex
39
45
  end
@@ -1,3 +1,3 @@
1
1
  module Relix
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relix
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-13 00:00:00.000000000 Z
12
+ date: 2012-02-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hiredis
16
- requirement: &70287488679200 !ruby/object:Gem::Requirement
16
+ requirement: &70310579348720 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.4.1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70287488679200
24
+ version_requirements: *70310579348720
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: redis
27
- requirement: &70287488678700 !ruby/object:Gem::Requirement
27
+ requirement: &70310579348200 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: 2.2.2
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70287488678700
35
+ version_requirements: *70310579348200
36
36
  description: ! 'Relix is a layer that can be added on to any model to make all the
37
37
  normal types of querying you want to do: equality, less than/greater than, in set,
38
38
  range, limit, etc., quick and painless. Relix depends on Redis to be awesome at
@@ -72,7 +72,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
72
72
  version: '0'
73
73
  segments:
74
74
  - 0
75
- hash: -969086072538235743
75
+ hash: -2061026527532118384
76
76
  required_rubygems_version: !ruby/object:Gem::Requirement
77
77
  none: false
78
78
  requirements: