fat_table 0.3.4 → 0.4.0

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: b1acf502c906ac50471a86a10889b2897831c26a4a49102aa3ee18e784658122
4
- data.tar.gz: a239367ae5b4a70a888fe1e8427f1989f0cf8369402f2e3e252b9b2d11058841
3
+ metadata.gz: dea0adf5d428fa875a7dda51538a79e514b9095b167d392ef06eae849e563a9f
4
+ data.tar.gz: d5ac2784c1f569fc1677f596278af3c6a00b1b5736ea1a080667f8a0f0acdd16
5
5
  SHA512:
6
- metadata.gz: 1edd15c8c3bf469a2b2278fd96246af6154ec8d7b1190f9f8398f23db1fc6bd816ecc92467296f8d811ac21045f797fbfb62c54fb2f6e95b83b33272a5bac1a4
7
- data.tar.gz: 8c938a602ea1a7a4f58a85265d84d80c9c7eea9dcba250a36861456f8244ab14f0f108f70d57737c43316b528d2ca373ff7ab3d0ee87eb8ae9c77637207163cd
6
+ metadata.gz: 7ea35509645ae4c11c8f7fd61157fe5057cf5d11237d888b9e5cfcbab437ff5fd90a3d3cffa9bd6d53038406138b12a890c65a72a59ac0b9542c1a90a979158c
7
+ data.tar.gz: 04eaf2e05b452efc8f25c14ab51b069d09dd9c548983481731562883d8866beac555a4a48a85b3352d408736c1b22d90881c0a23fab273fd78b459f31f704988
data/.rubocop.yml CHANGED
@@ -1,10 +1,7 @@
1
- inherit_gem:
2
- rubocop-shopify: rubocop.yml
3
- require: rubocop-rspec
4
- require: rubocop-performance
1
+ inherit_from:
2
+ - ~/.rubocop.yml
5
3
 
6
4
  AllCops:
7
- TargetRubyVersion: 2.7
8
5
  Exclude:
9
6
  - 'test/tmp/**/*'
10
7
  - 'vendor/bundle/**/*'
@@ -12,6 +9,7 @@ AllCops:
12
9
  Style/MethodCallWithArgsParentheses:
13
10
  Exclude:
14
11
  - '**/Gemfile'
12
+ - '*_spec.rb'
15
13
 
16
14
  Style/ClassAndModuleChildren:
17
15
  Exclude:
@@ -1304,12 +1304,20 @@ module FatTable
1304
1304
  # is set true, mark this row as a boundary. All tables should be built
1305
1305
  # ultimately using this method as a primitive.
1306
1306
  def add_row(row, mark: false)
1307
- row.each_pair do |k, v|
1308
- key = k.as_sym
1309
- columns << Column.new(header: k) unless column?(k)
1310
- column(key) << v
1307
+ row.transform_keys!(&:as_sym)
1308
+ # Make sure there is a column for each known header and each new key
1309
+ # present in row.
1310
+ new_heads = row.keys - headers
1311
+ new_heads.each do |h|
1312
+ # This column is new, so it needs nil items for all prior rows lest
1313
+ # the value be added to a prior row.
1314
+ items = Array.new(size, nil)
1315
+ columns << Column.new(header: h, items: items)
1316
+ end
1317
+ headers.each do |h|
1318
+ # NB: This adds a nil if h is not in row.
1319
+ column(h) << row[h]
1311
1320
  end
1312
- add_boundary if mark
1313
1321
  self
1314
1322
  end
1315
1323
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  module FatTable
4
4
  # The current version of FatTable
5
- VERSION = '0.3.4'
5
+ VERSION = '0.4.0'
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fat_table
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel E. Doherty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-01 00:00:00.000000000 Z
11
+ date: 2022-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler