receipts 3.0.1 → 3.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b54a405f797e01a8f310f3ea6e69483bce31f98206f081a0b208d23a7e2e51be
4
- data.tar.gz: fee97dc98d48d413634b9dedeb47ad2fb1dfa738f17762914a711701000cde2a
3
+ metadata.gz: bc21a875e12a60a763da6248b1b771aca91f8fba3b6274bf2c40b9fc13418fa8
4
+ data.tar.gz: bf3b01f48954ad552db84f954ee8bf48b91f2e88cc44e68734775d0a8174ad13
5
5
  SHA512:
6
- metadata.gz: 4d7a5cb4a395a4259fe4e45d42e1230e91f954e995af1963bd2c6634a244d5fa560a5afbfefa3f7af5cf83a16247693999e0454b2f06e2d2a0b0f1eb73906fcd
7
- data.tar.gz: 7342bca2f4b131981fa8028b004ab4f4b7a65ba36ceddbbe5822b76273e85ddf16df5b28ef0c1fab85cf321f2c06c050566d97c4542243319d7b6d7bd25d7445
6
+ metadata.gz: bff6057bc91a915ddb9f347769529e8807835136aa5753da06d96f89522ac047cc39f9babfc46a425bd85318effcb4351a80cea8db96bf5b9bd8a169b8a6c23c
7
+ data.tar.gz: 4d2eb007c98393fd7d73b54891b9fabd751cb9e72f4a7add3c80cc7cec0adab0712a475640b924d77c6bd25c56a97bc61bccaeeda59b69314fbdc02684ca5c1d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ### Unreleased
2
2
 
3
+ ### 3.0.2
4
+
5
+ * Fix negative and out-of-range `column_widths` hash keys on tables #47 - @dhyabi2
6
+
3
7
  ### 3.0.1
4
8
 
5
9
  * Fix quadratic backtracking in the inline format tag regex on Ruby < 3.2 #46 - @p-w
@@ -202,6 +202,8 @@ module Receipts
202
202
  when Numeric then (0...count).map { |i| [i, @column_widths] }.to_h
203
203
  else {}
204
204
  end
205
+ # Negative indexes count from the last column, like column(-1). Widths for columns the table doesn't have are ignored.
206
+ fixed = fixed.map { |i, width| [(i < 0) ? i + count : i, width] }.select { |i, _| i >= 0 && i < count }.to_h
205
207
 
206
208
  widths = natural.dup
207
209
  fixed.each { |i, width| widths[i] = width }
@@ -1,3 +1,3 @@
1
1
  module Receipts
2
- VERSION = "3.0.1"
2
+ VERSION = "3.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: receipts
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Oliver