positioning 0.1.1 → 0.1.2
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 +4 -4
- data/CHANGELOG.md +6 -2
- data/Gemfile.lock +7 -7
- data/lib/positioning/mechanisms.rb +0 -8
- data/lib/positioning/version.rb +1 -1
- data/lib/positioning.rb +5 -0
- data/positioning.gemspec +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: 42c7d9b5b08bb03060627230a1b44fe9d243b57779541de8def15a0f49f57011
|
4
|
+
data.tar.gz: 66a36e6cc2f019a34c4e1c0d92700be81062556c01da38de8fed632f12bde607
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50b3a860281e94d7657b82265e639f038d0004bbfde9d3cf19ca38aeab77814a92d31f5660e6f802c4c72c8931e42c960313413660dd48b0cbc81ca3c899ca30
|
7
|
+
data.tar.gz: 71718c58f8ada39e8b089cc2a2de1da96b685099461b5b397fd40c766549e60279e7b5e6c7d3a61081d5e435b18d3d24e260d985bbda5f2916669f3bdd8f1321
|
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,13 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
-
## [0.1.
|
3
|
+
## [0.1.2] - 2024-02-29
|
4
|
+
|
5
|
+
- Fix a bug related to the scope changing with an explicitly set position value that is the same as the original position.
|
6
|
+
|
7
|
+
## [0.1.1] - 2024-02-25
|
4
8
|
|
5
9
|
- Fix issues with STI based models
|
6
10
|
|
7
|
-
## [0.1.0] - 2024-02-
|
11
|
+
## [0.1.0] - 2024-02-24
|
8
12
|
|
9
13
|
- Initial release
|
data/Gemfile.lock
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
positioning (0.1.
|
4
|
+
positioning (0.1.2)
|
5
5
|
activerecord (>= 6.1)
|
6
6
|
activesupport (>= 6.1)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activemodel (7.1.3)
|
12
|
-
activesupport (= 7.1.3)
|
13
|
-
activerecord (7.1.3)
|
14
|
-
activemodel (= 7.1.3)
|
15
|
-
activesupport (= 7.1.3)
|
11
|
+
activemodel (7.1.3.2)
|
12
|
+
activesupport (= 7.1.3.2)
|
13
|
+
activerecord (7.1.3.2)
|
14
|
+
activemodel (= 7.1.3.2)
|
15
|
+
activesupport (= 7.1.3.2)
|
16
16
|
timeout (>= 0.4.0)
|
17
|
-
activesupport (7.1.3)
|
17
|
+
activesupport (7.1.3.2)
|
18
18
|
base64
|
19
19
|
bigdecimal
|
20
20
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
@@ -39,10 +39,6 @@ module Positioning
|
|
39
39
|
|
40
40
|
contract(positioning_scope_was, position_was..)
|
41
41
|
expand(positioning_scope, position..)
|
42
|
-
|
43
|
-
# If the position integer was set to the same as its prior value but the scope has changed then
|
44
|
-
# we need to tell Rails that it has changed so that it gets updated from the temporary 0 value.
|
45
|
-
position_will_change!
|
46
42
|
elsif position_was > position
|
47
43
|
expand(positioning_scope, position..position_was)
|
48
44
|
else
|
@@ -81,10 +77,6 @@ module Positioning
|
|
81
77
|
@positioned.send :"#{@column}_changed?"
|
82
78
|
end
|
83
79
|
|
84
|
-
def position_will_change!
|
85
|
-
@positioned.send :"#{@column}_will_change!"
|
86
|
-
end
|
87
|
-
|
88
80
|
def expand(scope, range)
|
89
81
|
scope.where("#{@column}": range).update_all "#{@column} = #{@column} * -1"
|
90
82
|
scope.where("#{@column}": ..-1).update_all "#{@column} = #{@column} * -1 + 1"
|
data/lib/positioning/version.rb
CHANGED
data/lib/positioning.rb
CHANGED
@@ -34,6 +34,11 @@ module Positioning
|
|
34
34
|
define_method(:"prior_#{column}") { Mechanisms.new(self, column).prior }
|
35
35
|
define_method(:"subsequent_#{column}") { Mechanisms.new(self, column).subsequent }
|
36
36
|
|
37
|
+
redefine_method(:"#{column}=") do |position|
|
38
|
+
send :"#{column}_will_change!"
|
39
|
+
super(position)
|
40
|
+
end
|
41
|
+
|
37
42
|
before_create { Mechanisms.new(self, column).create_position }
|
38
43
|
before_update { Mechanisms.new(self, column).update_position }
|
39
44
|
after_destroy { Mechanisms.new(self, column).destroy_position }
|
data/positioning.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
|
|
13
13
|
|
14
14
|
spec.metadata["homepage_uri"] = spec.homepage
|
15
15
|
spec.metadata["source_code_uri"] = "https://github.com/brendon/positioning"
|
16
|
-
spec.metadata["changelog_uri"] = "https://github.com/brendon/positioning/CHANGELOG.md"
|
16
|
+
spec.metadata["changelog_uri"] = "https://github.com/brendon/positioning/blob/main/CHANGELOG.md"
|
17
17
|
|
18
18
|
# Specify which files should be added to the gem when it is released.
|
19
19
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: positioning
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brendon Muir
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-02-
|
11
|
+
date: 2024-02-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -133,7 +133,7 @@ licenses:
|
|
133
133
|
metadata:
|
134
134
|
homepage_uri: https://github.com/brendon/positioning
|
135
135
|
source_code_uri: https://github.com/brendon/positioning
|
136
|
-
changelog_uri: https://github.com/brendon/positioning/CHANGELOG.md
|
136
|
+
changelog_uri: https://github.com/brendon/positioning/blob/main/CHANGELOG.md
|
137
137
|
post_install_message:
|
138
138
|
rdoc_options: []
|
139
139
|
require_paths:
|