fat_table 0.9.1 → 0.9.3
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/README.org +13 -10
- data/lib/fat_table/formatters/formatter.rb +0 -6
- data/lib/fat_table/table.rb +1 -1
- data/lib/fat_table/version.rb +1 -1
- 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: c938654651af21d509d2a71fe8a7a9c36747f33e04d1be8eab4c020c1400a26e
|
4
|
+
data.tar.gz: 6d9191d19b79a70a963eb16eaabfaefb2643cd0df7b9dec7a77c5d36f2c836b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38371b27911a835c34e7536bc6226b08a20225d399b4feaa6e6bb6e1dbb6031292d10ea6673c4dabb77c2576294188ce6ab6d76186f6d0a8c803a175e2db3907
|
7
|
+
data.tar.gz: 69a13614617e0423cb7739ec47939841bb96eb5c460d0711528e2163969b70339a14a129a96ed5d68f8908a86479c4ee596799197423cf2cbf3d56f7afe5ba90
|
data/README.org
CHANGED
@@ -2614,19 +2614,22 @@ parameter. See below at [[*Table Locations][Table Locations]] for an explanatio
|
|
2614
2614
|
locations available.
|
2615
2615
|
|
2616
2616
|
Other than that first parameter, the two methods take the same types of
|
2617
|
-
parameters. The remaining parameters are hash-like parameters that use either
|
2618
|
-
column name or a type as the key and a string with the formatting directives
|
2619
|
-
apply as the value.
|
2620
|
-
|
2621
|
-
|
2622
|
-
|
2623
|
-
|
2624
|
-
|
2625
|
-
|
2617
|
+
parameters. The remaining parameters are hash-like parameters that use either
|
2618
|
+
a column name or a type as the key and a string with the formatting directives
|
2619
|
+
to apply as the value. If a key represents neither a column name nor a valid
|
2620
|
+
type, it is silently ignored. The following example says to set the
|
2621
|
+
formatting for all locations in the table and to format all numeric fields as
|
2622
|
+
strings that are rounded to whole numbers (the '0.0' part), that are
|
2623
|
+
right-aligned (the 'R' part), and have grouping commas inserted (the ','
|
2624
|
+
part). But the ~:id~ column is numeric, and the second parameter overrides the
|
2625
|
+
formatting for numerics in general and calls for the ~:id~ column to be padded
|
2626
|
+
to three digits with zeros on the left (the '3.0' part) and to be centered
|
2627
|
+
(the 'C' part).
|
2626
2628
|
|
2627
2629
|
#+BEGIN_SRC ruby :wrap EXAMPLE
|
2628
2630
|
tab_a.to_text do |f|
|
2629
|
-
|
2631
|
+
# Note: blat: is silently ignored
|
2632
|
+
f.format(numeric: '0.0,R', id: '3.0C', blat: 'B')
|
2630
2633
|
f.format_for(:body, string: 'R')
|
2631
2634
|
f.format_for(:header, string: 'C')
|
2632
2635
|
end
|
@@ -648,12 +648,6 @@ module FatTable
|
|
648
648
|
k
|
649
649
|
end
|
650
650
|
end
|
651
|
-
valid_keys = table.headers + %i[string numeric datetime boolean nil]
|
652
|
-
invalid_keys = (fmts.keys - valid_keys).uniq
|
653
|
-
unless invalid_keys.empty?
|
654
|
-
msg = "invalid #{location} column or type: #{invalid_keys.join(', ')}"
|
655
|
-
raise UserError, msg
|
656
|
-
end
|
657
651
|
|
658
652
|
@format_at[location] ||= {}
|
659
653
|
table.headers.each do |h|
|
data/lib/fat_table/table.rb
CHANGED
@@ -137,7 +137,7 @@ module FatTable
|
|
137
137
|
def empty_dup(result_cols = nil)
|
138
138
|
result_cols ||= heads
|
139
139
|
result_types = types.select { |k,_v| result_cols.include?(k) }
|
140
|
-
result =
|
140
|
+
result = self.class.new(result_cols, **result_types)
|
141
141
|
tolerant_cols.each do |h|
|
142
142
|
result.tolerant_cols << h
|
143
143
|
result.column(h).tolerant = true
|
data/lib/fat_table/version.rb
CHANGED
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.9.
|
4
|
+
version: 0.9.3
|
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: 2023-05-
|
11
|
+
date: 2023-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|