tabulo 2.7.1 → 2.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/tests.yml +3 -3
- data/CHANGELOG.md +5 -0
- data/README.md +20 -10
- data/VERSION +1 -1
- data/lib/tabulo/table.rb +1 -1
- data/lib/tabulo/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2419c20288ae285e4fcbfefd5627f6dac370ab3940969093216283407df6ee4
|
4
|
+
data.tar.gz: '08ee67482f630a3f185319fcc7fec4844b3a64d70042f3afc9abb993e4a65260'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97f9cc96273afdc2fb30f341cc7dede4440cc2198209035bdbb65bf4872628a0db6a42f29287a7f9a2aa08c0fd2495bd7cdf189529ef1ce93f62797a5cfdb8dd
|
7
|
+
data.tar.gz: 96e4fd149487e51a49bb3935ec4341c0a327f101d028019b8bf73279b3e239cf3d8deb0fd5efda92c8d10d79c5bf1973b16344e45e753695b6920c6c4111f852
|
data/.github/workflows/tests.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -6,8 +6,7 @@
|
|
6
6
|
[![Coverage Status][CS img]][Coverage Status]
|
7
7
|
[![Awesome][AR img]][Awesome Ruby]
|
8
8
|
|
9
|
-
Tabulo is a Ruby library for generating plain text tables
|
10
|
-
or “ASCII tables”). It is both highly configurable and very easy to use.
|
9
|
+
Tabulo is a Ruby library for generating plain text tables. It is both highly configurable and very easy to use.
|
11
10
|
|
12
11
|
<a name="overview"></a>
|
13
12
|
## Overview
|
@@ -103,7 +102,7 @@ Tabulo has also been ported to Crystal (with some modifications): see [Tablo](ht
|
|
103
102
|
* [Setting default styles](#default-styles)
|
104
103
|
* [Styling borders](#styling-borders)
|
105
104
|
* [Repeating headers](#repeating-headers)
|
106
|
-
* [Using a Table Enumerator](#
|
105
|
+
* [Using a Table Enumerator](#enumerator)
|
107
106
|
* [Accessing cell values](#accessing-cell-values)
|
108
107
|
* [Accessing the underlying enumerable](#accessing-sources)
|
109
108
|
* [Transposing rows and columns](#transposition)
|
@@ -793,7 +792,7 @@ the table.
|
|
793
792
|
The `formatter` callback also has an alternative, 2-parameter version. If `formatter` is passed
|
794
793
|
a 2-parameter callable, the second parameter will be given a `CellData` instance,
|
795
794
|
containing additional information about the cell that may be useful in determining how to format
|
796
|
-
it—see the [documentation](https://www.rubydoc.info/gems/tabulo/2.7.
|
795
|
+
it—see the [documentation](https://www.rubydoc.info/gems/tabulo/2.7.2/Tabulo/CellData.html)
|
797
796
|
for details.
|
798
797
|
|
799
798
|
<a name="colours-and-styling"></a>
|
@@ -839,7 +838,7 @@ number is even). The second parameter represents the formatted string value of t
|
|
839
838
|
content after any processing by the [formatter](#formatting-cell-values). The third and fourth
|
840
839
|
parameters are optional, and contain further information about the cell and its contents that may be useful in
|
841
840
|
determining how to style it. See the
|
842
|
-
[documentation](https://www.rubydoc.info/gems/tabulo/2.7.
|
841
|
+
[documentation](https://www.rubydoc.info/gems/tabulo/2.7.2/Tabulo/Table#add_column-instance_method) for details.
|
843
842
|
|
844
843
|
If the content of a cell is wrapped over multiple lines, then the `styler` will be called once
|
845
844
|
per line, so that each line of the cell will have the escape sequence applied to it separately
|
@@ -859,7 +858,7 @@ table.add_column(:even?, header_styler: -> (s) { "\033[32m#{s}\033[0m" })
|
|
859
858
|
```
|
860
859
|
|
861
860
|
The `header_styler` option accepts a 1-, 2- or 3-parameter callable. See the
|
862
|
-
[documentation](https://www.rubydoc.info/gems/tabulo/2.7.
|
861
|
+
[documentation](https://www.rubydoc.info/gems/tabulo/2.7.2/Tabulo/Table#add_column-instance_method)
|
863
862
|
for details.
|
864
863
|
|
865
864
|
<a name="styling-title"></a>
|
@@ -873,7 +872,7 @@ table = Tabulo::Table.new(1..5, :itself, :even?, :odd?, title: "Numbers", title_
|
|
873
872
|
```
|
874
873
|
|
875
874
|
The `title_styler` option accepts a 1- or 2-parameter callable. See the
|
876
|
-
[documentation](https://www.rubydoc.info/gems/tabulo/2.7.
|
875
|
+
[documentation](https://www.rubydoc.info/gems/tabulo/2.7.2/Tabulo/Table#initialize-instance_method)
|
877
876
|
for details.
|
878
877
|
|
879
878
|
<a name="styling-borders"></a>
|
@@ -939,6 +938,12 @@ table = Tabulo::Table.new(1..10, :itself, :even?, header_frequency: 5)
|
|
939
938
|
|
940
939
|
Note that if the table has a [title](#title), it will not be repeated; only column headers are repeated.
|
941
940
|
|
941
|
+
One can achieve even finer-grained control over printing of headers within the table body by stepping
|
942
|
+
through the table a row at a time (using `.each` or other methods of `Enumerable`) and calling the
|
943
|
+
the [`formatted_header`](https://www.rubydoc.info/gems/tabulo/Tabulo/Table#formatted_header-instance_method)
|
944
|
+
method in combination with [`horizontal_rule`](https://www.rubydoc.info/gems/tabulo/Tabulo%2FTable:horizontal_rule)
|
945
|
+
to produce headers at arbitrary points in the output.
|
946
|
+
|
942
947
|
<a name="enumerator"></a>
|
943
948
|
### Using a Table Enumerator [↑](#contents)
|
944
949
|
|
@@ -1068,7 +1073,7 @@ a new table in which the rows and columns are swapped:
|
|
1068
1073
|
By default, a header row is added to the new table, showing the string value of the element
|
1069
1074
|
represented in that column. This can be configured, however, along with other aspects of
|
1070
1075
|
`transpose`’s behaviour. For details, see the
|
1071
|
-
[documentation](https://www.rubydoc.info/gems/tabulo/2.7.
|
1076
|
+
[documentation](https://www.rubydoc.info/gems/tabulo/2.7.2/Tabulo/Table#transpose-instance_method).
|
1072
1077
|
|
1073
1078
|
<a name="borders"></a>
|
1074
1079
|
### Configuring borders [↑](#contents)
|
@@ -1286,6 +1291,11 @@ If you want a line before every row, pass `1` to `row_divider_frequency`. For ex
|
|
1286
1291
|
+--------------+--------------+--------------+
|
1287
1292
|
```
|
1288
1293
|
|
1294
|
+
In addition to these options, it is also possible to print horizontal dividers at any chosen
|
1295
|
+
point in the table output, by stepping through the table one row at a time
|
1296
|
+
and calling the [`horizontal_rule`](https://www.rubydoc.info/gems/tabulo/Tabulo%2FTable:horizontal_rule)
|
1297
|
+
method as required.
|
1298
|
+
|
1289
1299
|
<a name="freezing-a-table"></a>
|
1290
1300
|
### Using a table as a snapshot rather than as a dynamic view [↑](#contents)
|
1291
1301
|
|
@@ -1459,13 +1469,13 @@ The gem is available as open source under the terms of the [MIT
|
|
1459
1469
|
License](http://opensource.org/licenses/MIT).
|
1460
1470
|
|
1461
1471
|
[Gem Version]: https://rubygems.org/gems/tabulo
|
1462
|
-
[Documentation]: http://www.rubydoc.info/gems/tabulo
|
1472
|
+
[Documentation]: http://www.rubydoc.info/gems/tabulo
|
1463
1473
|
[Build Status]: https://github.com/matt-harvey/tabulo/actions/workflows/tests.yml
|
1464
1474
|
[Coverage Status]: https://coveralls.io/github/matt-harvey/tabulo
|
1465
1475
|
[Awesome Ruby]: https://github.com/markets/awesome-ruby#cli-utilities
|
1466
1476
|
|
1467
1477
|
[GV img]: https://img.shields.io/gem/v/tabulo.svg
|
1468
|
-
[DC img]: https://img.shields.io/badge/documentation-v2.7.
|
1478
|
+
[DC img]: https://img.shields.io/badge/documentation-v2.7.2-blue.svg
|
1469
1479
|
[BS img]: https://github.com/matt-harvey/tabulo/actions/workflows/tests.yml/badge.svg
|
1470
1480
|
[CS img]: https://img.shields.io/coveralls/matt-harvey/tabulo.svg
|
1471
1481
|
[AR img]: https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.7.
|
1
|
+
2.7.2
|
data/lib/tabulo/table.rb
CHANGED
@@ -420,7 +420,7 @@ module Tabulo
|
|
420
420
|
end
|
421
421
|
|
422
422
|
# @return [String] a graphical representation of the Table column headers formatted with fixed
|
423
|
-
# width plain text.
|
423
|
+
# width plain text, excluding any horizontal borders above or below.
|
424
424
|
def formatted_header
|
425
425
|
cells = get_columns.map(&:header_cell)
|
426
426
|
format_row(cells, @wrap_header_cells_to)
|
data/lib/tabulo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tabulo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.7.
|
4
|
+
version: 2.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Harvey
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tty-screen
|
@@ -221,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: '0'
|
223
223
|
requirements: []
|
224
|
-
rubygems_version: 3.2.
|
224
|
+
rubygems_version: 3.2.3
|
225
225
|
signing_key:
|
226
226
|
specification_version: 4
|
227
227
|
summary: Terminal table generator
|