ohm-sorted 0.3.4 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ODM0YjY5ZGI2ZjdiNjk4Mjc0OGZkNTEwNjZlOTQ3NzcwYTRkNWI3NQ==
5
- data.tar.gz: !binary |-
6
- MDNmZTcwMWNmNjBkNmExODdkMDc0MWFlM2M1NjAyZGZmZWI5YWRlMg==
2
+ SHA1:
3
+ metadata.gz: 355f7018df42de77b3733ed309257ac21a50e9df
4
+ data.tar.gz: 512e39ffdcea42c36d3ed2ecdaa3b3f9fa7ba7fd
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- NDRiYzFhMzQ0N2YzODI5N2JkMDczOWNlN2QxNGQxNDRiMDgwYWRhYTY5YTFj
10
- OWI3NmU2MzljYzFlNzZkYWVhYmZlOTYzN2I1ODQ2Y2I3NTE2YWViZmEzMmIy
11
- YWRhYzliYzZmMTVmZjQyYmVmMGM2OWE5ZWU0NGVkMmIwODNmZDc=
12
- data.tar.gz: !binary |-
13
- YzA4ZWNmOTM3OGU1OGUxOTY4NTcxYjZlNmU2ODI5NGZiMmJlOTRmZDI1ZDBj
14
- YzM3MjViZWIyZDA4ZDc3MTQ3MDVjOTcwNTZkMjNhYTUzODIwYzkwYWJlNTcy
15
- MjJhYTFlMWUzMjBiOGU3OTgxMjY1ODdkN2E1ZTQzMzEyNmRlZjM=
6
+ metadata.gz: 71219e4bbd9f003f58bbfb8631a25e9e799155cf442d316ce6fdb648bf1ed6afd0970fd2c78037b5a50fe1ae553cc6bcd17d99b4a24a1ca0807af16aa27b4c03
7
+ data.tar.gz: a2ab1aa904a6195d84a0e1ca624952036aff42dd03293c9eef51a2a8618afbf74e4988fa3ed42de9b69905f5c7ec43e88e601c7c827c4b305cf532220900cdf5
data/.travis.yml CHANGED
@@ -1,3 +1,4 @@
1
1
  language: ruby
2
+ services: redis-server
2
3
  before_script: "rake appraisal:install"
3
4
  script: "rake appraisal"
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ### 0.4.0
2
+
3
+ - Do not index nil values. You can do a manual `to_f` in case you need to
4
+ preserve the old behaviour
5
+
1
6
  ### 0.3.4
2
7
 
3
8
  - Fix `SortedSet#size` when using slicing
data/lib/ohm/sorted.rb CHANGED
@@ -219,7 +219,10 @@ module Ohm
219
219
 
220
220
  def add_sorted_indices
221
221
  update_sorted_indices do |key, attribute, options|
222
- score = send(attribute).to_f
222
+ attr = send(attribute)
223
+ next if attr.nil?
224
+
225
+ score = attr.to_f
223
226
  db.zadd(key, score, id)
224
227
  end
225
228
  end
data/ohm-sorted.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'ohm-sorted'
3
- s.version = '0.3.4'
3
+ s.version = '0.4.0'
4
4
  s.summary = "Sorted indices for Ohm."
5
5
  s.description = "An plugin for Ohm that lets you create sorted indices."
6
6
  s.author = "Federico Bond"
data/test/sorted_test.rb CHANGED
@@ -105,10 +105,10 @@ class SortedTest < Test::Unit::TestCase
105
105
  assert_equal [], sorted_set.to_a
106
106
  end
107
107
 
108
- def test_indexes_nil
108
+ def test_does_not_index_nil
109
109
  post = Post.create(status: "draft")
110
110
  sorted_set = Post.sorted_find(:order, status: "draft")
111
- assert_equal [post], sorted_set.to_a
111
+ assert_equal [], sorted_set.to_a
112
112
  end
113
113
 
114
114
  def test_sorted_find_invalid
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ohm-sorted
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Federico Bond
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-26 00:00:00.000000000 Z
11
+ date: 2014-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appraisal
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: ohm
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: ohm-contrib
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ! '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  description: An plugin for Ohm that lets you create sorted indices.
@@ -58,8 +58,8 @@ executables: []
58
58
  extensions: []
59
59
  extra_rdoc_files: []
60
60
  files:
61
- - .gitignore
62
- - .travis.yml
61
+ - ".gitignore"
62
+ - ".travis.yml"
63
63
  - Appraisals
64
64
  - CHANGELOG.md
65
65
  - Gemfile
@@ -80,17 +80,17 @@ require_paths:
80
80
  - lib
81
81
  required_ruby_version: !ruby/object:Gem::Requirement
82
82
  requirements:
83
- - - ! '>='
83
+ - - ">="
84
84
  - !ruby/object:Gem::Version
85
85
  version: '0'
86
86
  required_rubygems_version: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - ! '>='
88
+ - - ">="
89
89
  - !ruby/object:Gem::Version
90
90
  version: '0'
91
91
  requirements: []
92
92
  rubyforge_project:
93
- rubygems_version: 2.2.1
93
+ rubygems_version: 2.2.2
94
94
  signing_key:
95
95
  specification_version: 4
96
96
  summary: Sorted indices for Ohm.