lexorank 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lexorank/rankable.rb +4 -4
- data/lib/lexorank/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4643e7db16d6b8ed5dcb807f80d2350663f168b8b66e0e81791d1c746fd1a17a
|
4
|
+
data.tar.gz: 2fdf4f043ef14b8fab235422f409b151fc1117000ea304c2612ccb0e71a079ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27fb2b029e5eab9088a1236b0b0cb18688e0a8efdee64cfedee869dd1b72a7257056757d59989dd6a0ffc8164af77282108258d066fd8462a1dfc0f074128b61
|
7
|
+
data.tar.gz: 9dda1742be04a290c3b68defcbb6f88302665ee01ff0f5cbb4086a62a004ee95e7ebe381f1280414dee6d84a8810a177e712ae4f86eee4c8e243a40a5c20d216
|
data/lib/lexorank/rankable.rb
CHANGED
@@ -60,10 +60,7 @@ module Lexorank::Rankable
|
|
60
60
|
if position == 0
|
61
61
|
[nil, collection.first]
|
62
62
|
else
|
63
|
-
|
64
|
-
# if the item has no rank we use position - 1
|
65
|
-
position -= 1 if !self.send(self.class.ranking_column) || collection.map(&:id).index(self.id) > position
|
66
|
-
collection.offset(position).limit(2)
|
63
|
+
collection.where.not(id: self.id).offset(position - 1).limit(2)
|
67
64
|
end
|
68
65
|
|
69
66
|
rank =
|
@@ -85,6 +82,9 @@ module Lexorank::Rankable
|
|
85
82
|
move_to!(0)
|
86
83
|
end
|
87
84
|
|
85
|
+
def no_rank?
|
86
|
+
!self.send(self.class.ranking_column)
|
87
|
+
end
|
88
88
|
end
|
89
89
|
|
90
90
|
end
|
data/lib/lexorank/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lexorank
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Böhme
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -166,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
166
|
- !ruby/object:Gem::Version
|
167
167
|
version: '0'
|
168
168
|
requirements: []
|
169
|
-
rubygems_version: 3.2.
|
169
|
+
rubygems_version: 3.2.15
|
170
170
|
signing_key:
|
171
171
|
specification_version: 4
|
172
172
|
summary: Store order of your models by using lexicographic sorting.
|