fat_table 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.org +0 -1
- data/lib/fat_table/column.rb +6 -1
- data/lib/fat_table/footer.rb +15 -7
- data/lib/fat_table/table.rb +7 -2
- data/lib/fat_table/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f045f2196dd5d6ad7584b877d847945f99cc8079b86b8a810af8528d2c18074c
|
4
|
+
data.tar.gz: cb8f031c4f48d472af658f111221524882f5d2bb6574858b1e988e2384d7ba56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f906e8841e268263635dc4231573b07cb48cd48b1f33fd2a0d7812e65f1e9720ac8f8556129601b702a828c5c6a7a7a04c00344016c2ebe0004a892d1f524ab9
|
7
|
+
data.tar.gz: 694f65455ed63c1304f0bc626192c2770968278ec0599c0e9c5f57c5fcb091a351ed4e09d28fe6cbda12278f1f9ed669e128339e6e99b4fc2a1a21467d182892
|
data/README.org
CHANGED
data/lib/fat_table/column.rb
CHANGED
@@ -173,7 +173,12 @@ module FatTable
|
|
173
173
|
# Column. This makes Columns Enumerable, so all the Enumerable methods are
|
174
174
|
# available on a Column.
|
175
175
|
def each
|
176
|
-
|
176
|
+
if block_given?
|
177
|
+
items.each { |itm| yield itm }
|
178
|
+
self
|
179
|
+
else
|
180
|
+
to_enum(:each)
|
181
|
+
end
|
177
182
|
end
|
178
183
|
|
179
184
|
##########################################################################
|
data/lib/fat_table/footer.rb
CHANGED
@@ -67,7 +67,7 @@ module FatTable
|
|
67
67
|
|
68
68
|
# Return the value of the label, for the kth group if grouped.
|
69
69
|
def label(k = 0)
|
70
|
-
|
70
|
+
@values[@label_col][k]
|
71
71
|
end
|
72
72
|
|
73
73
|
# :category: Accessors
|
@@ -221,24 +221,32 @@ module FatTable
|
|
221
221
|
@values[@label_col] << calc_label(k)
|
222
222
|
end
|
223
223
|
else
|
224
|
-
@values[@label_col] = [calc_label
|
224
|
+
@values[@label_col] = [calc_label]
|
225
225
|
end
|
226
226
|
end
|
227
227
|
|
228
|
-
# Calculate the label for the kth group, using k =
|
228
|
+
# Calculate the label for the kth group, using k = nil for non-group
|
229
229
|
# footers. If the label is a proc, call it with the group number.
|
230
|
-
def calc_label(k)
|
230
|
+
def calc_label(k = nil)
|
231
231
|
case @label
|
232
232
|
when Proc
|
233
233
|
case @label.arity
|
234
234
|
when 0
|
235
235
|
@label.call
|
236
236
|
when 1
|
237
|
-
@label.call(k)
|
237
|
+
k ? @label.call(k) : @label.call(self)
|
238
238
|
when 2
|
239
|
-
|
239
|
+
if k
|
240
|
+
@label.call(k, self)
|
241
|
+
else
|
242
|
+
raise ArgumentError, "a non-group footer label proc may only have 1 argument for the containing footer f"
|
243
|
+
end
|
240
244
|
else
|
241
|
-
|
245
|
+
if k
|
246
|
+
raise ArgumentError, "group footer label proc may only have 0, 1, or 2 arguments for group number k and containing footer f"
|
247
|
+
else
|
248
|
+
raise ArgumentError, "a non-group footer label proc may only have 0 or 1 arguments for the containing footer f"
|
249
|
+
end
|
242
250
|
end
|
243
251
|
else
|
244
252
|
@label.to_s
|
data/lib/fat_table/table.rb
CHANGED
@@ -530,8 +530,13 @@ module FatTable
|
|
530
530
|
|
531
531
|
# Yield each row of the table as a Hash with the column symbols as keys.
|
532
532
|
def each
|
533
|
-
|
534
|
-
|
533
|
+
if block_given?
|
534
|
+
rows.each do |row|
|
535
|
+
yield row
|
536
|
+
end
|
537
|
+
self
|
538
|
+
else
|
539
|
+
to_enum(:each)
|
535
540
|
end
|
536
541
|
end
|
537
542
|
|
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.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel E. Doherty
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -332,7 +332,7 @@ licenses: []
|
|
332
332
|
metadata:
|
333
333
|
allowed_push_host: https://rubygems.org
|
334
334
|
yard.run: yri
|
335
|
-
post_install_message:
|
335
|
+
post_install_message:
|
336
336
|
rdoc_options: []
|
337
337
|
require_paths:
|
338
338
|
- lib
|
@@ -348,7 +348,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
348
348
|
version: '0'
|
349
349
|
requirements: []
|
350
350
|
rubygems_version: 3.3.3
|
351
|
-
signing_key:
|
351
|
+
signing_key:
|
352
352
|
specification_version: 4
|
353
353
|
summary: Provides tools for working with tables as a data type.
|
354
354
|
test_files: []
|