cardname 0.11.0 → 0.11.1
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/lib/cardname/contextual.rb +7 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf803bf5912ae399a82c94a44bcc353a75f3d21894f292db0aacce5b40fde00c
|
4
|
+
data.tar.gz: d069f7f3d0a329d01fa67d7f20720e32d30ed3ca52d9e2ec360a9537d05152dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe7f9d7f7c0d16e9100da7689ec8a26d250a27d87c6445bdc1e62aa359c299760478f5c35a740cc50c7d190b43dd9788963cdf6190c9d098388e287decc26dc7
|
7
|
+
data.tar.gz: 91cabf13b19181f1b967830cad3fbcfd0c7faae4bbc5e6a4bde6d7a2bf7bd88ec4f31a65dac27902ffa8f771480c7d9a9728ac9b7d662bd83c0595b7fdd8d474
|
data/lib/cardname/contextual.rb
CHANGED
@@ -116,13 +116,15 @@ class Cardname
|
|
116
116
|
|
117
117
|
def absolutize_extremes new_parts, context
|
118
118
|
[0, -1].each do |i|
|
119
|
-
|
120
|
-
# following avoids recontextualizing with relative contexts.
|
121
|
-
# Eg, `+A+B+.absolute('+A')` should be +A+B, not +A+A+B.
|
122
|
-
next if new_parts.to_name.send "#{[ :start, :end ][i]}s_with_parts?", context
|
123
|
-
new_parts[i] = context
|
119
|
+
new_parts[i] = context if absolutize_extreme? new_parts, context, i
|
124
120
|
end
|
125
121
|
end
|
126
122
|
|
123
|
+
def absolutize_extreme? new_parts, context, index
|
124
|
+
return false if new_parts[index].present?
|
125
|
+
# following avoids recontextualizing with relative contexts.
|
126
|
+
# Eg, `+A+B+.absolute('+A')` should be +A+B, not +A+A+B.
|
127
|
+
!new_parts.to_name.send "#{[ :start, :end ][index]}s_with_parts?", context
|
128
|
+
end
|
127
129
|
end
|
128
130
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cardname
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ethan McCutchen
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2021-03-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|