positioning 0.1.3 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/positioning/mechanisms.rb +6 -5
- data/lib/positioning/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a18c3175781c6d4509ea42db1583e68bb2e7258e9c0b99201b1b551fc50ccd7
|
4
|
+
data.tar.gz: 8ceb46c8c93882d2e82e88f4d9c5bcafb3371830dd6d5169cf23dd76d8ba6cd0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19ced8dddfaefd60c644f19ac576513185e5f3dfa52e8aaabab59f390042f1937bfd3f24874bd228012b337f9f843963b6261b25133d5d1d54f2d606d5c08b7a
|
7
|
+
data.tar.gz: ac66e6a3eeb7ab20d54511640c9c1e1e20090b9cd0d01cf583031944d42e7f517dc603afc9b59b49c35617a437f5ebbdbf406e0b1cc71beff3413fd8cf73d76b
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.1.5] - 2024-03-04
|
4
|
+
|
5
|
+
- Allow empty strings to represent nil for the purposes of solidifying a position
|
6
|
+
|
7
|
+
## [0.1.4] - 2024-03-04
|
8
|
+
|
9
|
+
- Fix bug relating to relative position hash coming from Rails being a Hash With Indifferent Access
|
10
|
+
|
3
11
|
## [0.1.3] - 2024-03-04
|
4
12
|
|
5
13
|
- Internal refactoring of Mechanisms for clarity
|
@@ -98,14 +98,14 @@ module Positioning
|
|
98
98
|
def solidify_position
|
99
99
|
position_before_type_cast = @positioned.read_attribute_before_type_cast @column
|
100
100
|
position_before_type_cast.to_sym if position_before_type_cast.is_a? String
|
101
|
-
position_before_type_cast.symbolize_keys
|
101
|
+
position_before_type_cast = position_before_type_cast.symbolize_keys if position_before_type_cast.is_a? Hash
|
102
102
|
|
103
103
|
case position_before_type_cast
|
104
104
|
when Integer
|
105
105
|
self.position = position_before_type_cast.clamp(1..last_position)
|
106
|
-
when :first, {after: nil}
|
106
|
+
when :first, {after: nil}, {after: ""}
|
107
107
|
self.position = 1
|
108
|
-
when nil, :last, {before: nil}
|
108
|
+
when nil, "", :last, {before: nil}, {before: ""}
|
109
109
|
self.position = last_position
|
110
110
|
when Hash
|
111
111
|
relative_position, relative_record_or_primary_key = *position_before_type_cast.first
|
@@ -135,8 +135,9 @@ module Positioning
|
|
135
135
|
|
136
136
|
unless position.is_a? Integer
|
137
137
|
raise Error.new,
|
138
|
-
|
139
|
-
|
138
|
+
%(`#{@column}` must be an Integer, :first, :last, ) +
|
139
|
+
%{before: (#{base_class.name}, #{primary_key_column}, nil, or ""), } +
|
140
|
+
%{after: (#{base_class.name}, #{primary_key_column}, nil or ""), nil or ""}
|
140
141
|
end
|
141
142
|
end
|
142
143
|
|
data/lib/positioning/version.rb
CHANGED