cardname 0.11.0 → 0.11.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cardname/contextual.rb +7 -5
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2aaef149c22c0d7904227d548b3b7b3aafe37385f345f76334bbf42b97ef062d
4
- data.tar.gz: c6456801e22e9481be99555e791469ebcdaa4d2cdd7070aea54e38bf2559e97d
3
+ metadata.gz: bf803bf5912ae399a82c94a44bcc353a75f3d21894f292db0aacce5b40fde00c
4
+ data.tar.gz: d069f7f3d0a329d01fa67d7f20720e32d30ed3ca52d9e2ec360a9537d05152dc
5
5
  SHA512:
6
- metadata.gz: eed77c0d0f1437ffa49bf414b5a8ac51dc3af4833e0a3b71d90eca8daa15901373c41fae2309dcc27502ee495ce8aa12b52d39a22c11b448c6b51a58f6720c47
7
- data.tar.gz: 3179e5d7defa1a0391297e975cc2ee942ef403d72d453b89b80b09c84a77e10c5000ba60bbf0a5114bbc91cc3a50e09ee67efd059897e10776662a7d6917ac0a
6
+ metadata.gz: fe7f9d7f7c0d16e9100da7689ec8a26d250a27d87c6445bdc1e62aa359c299760478f5c35a740cc50c7d190b43dd9788963cdf6190c9d098388e287decc26dc7
7
+ data.tar.gz: 91cabf13b19181f1b967830cad3fbcfd0c7faae4bbc5e6a4bde6d7a2bf7bd88ec4f31a65dac27902ffa8f771480c7d9a9728ac9b7d662bd83c0595b7fdd8d474
@@ -116,13 +116,15 @@ class Cardname
116
116
 
117
117
  def absolutize_extremes new_parts, context
118
118
  [0, -1].each do |i|
119
- next if new_parts[i].present?
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.0
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: 2020-12-24 00:00:00.000000000 Z
13
+ date: 2021-03-02 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport