tabulo 1.5.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +15 -17
- data/VERSION +1 -1
- data/lib/tabulo/version.rb +1 -1
- data/tabulo.gemspec +2 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fdbbbcb7f1eb925be546ddb8b798f2c2aa949e737aa221018cfffeb25352458a
|
4
|
+
data.tar.gz: 6960e851a8086dc345d4f4db2d3867893b4a0772c748336b2341dd22f9c862be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4488086be31ac7f659110c3f55c1a6ecce1ccfa59406ba165490622b86167bc61a666a3c42d4ae8c12a5ad4975141ea418242bcd971a4930fbc75a991797cc4
|
7
|
+
data.tar.gz: 1de32be32999408268de863e94c79fed536e6844a658f135288c4469c8081d3bce7461c90ef809d67f9a2cf5a1fd6c36f323da4c64a40d20d2fff336bf65d2eb
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -87,7 +87,7 @@ Tabulo has also been ported to Crystal (with some modifications): see [Tablo](ht
|
|
87
87
|
* [Automating column widths](#automating-column-widths)
|
88
88
|
* [Overflow handling](#overflow-handling)
|
89
89
|
* [Formatting cell values](#formatting-cell-values)
|
90
|
-
* [Colours and
|
90
|
+
* [Colours and styling](#colours-and-styling)
|
91
91
|
* [Repeating headers](#repeating-headers)
|
92
92
|
* [Using a Table Enumerator](#using-a-table-enumerator)
|
93
93
|
* [Accessing cell values](#accessing-cell-values)
|
@@ -405,13 +405,11 @@ the underlying value of that cell, not its formatted value.
|
|
405
405
|
<a name="colours-and-styling"></a>
|
406
406
|
### Colours and styling
|
407
407
|
|
408
|
-
In most terminals, if you want print text that is coloured, or has other styles
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
render the table correctly, the `styler` option should be passed to `add_column` to apply colours
|
414
|
-
or other styling that require escape sequences.
|
408
|
+
In most terminals, if you want to print text that is coloured, or has certain other styles such as
|
409
|
+
underlining, you need to use ANSI escape sequences, either directly, or by means of a library such
|
410
|
+
as [Rainbow](http://github.com/sickill/rainbow) that uses them internally. Tabulo needs to properly
|
411
|
+
account for escape sequences when performing the width calculations required to render tables.
|
412
|
+
The `styler` option on the `add_column` method is intended to facilitate this.
|
415
413
|
|
416
414
|
For example, suppose you have a table to which you want to add a column that
|
417
415
|
displays `true` in green if a given number is even, or else displays `false` in red.
|
@@ -420,7 +418,7 @@ You can achieve this as follows using raw ANSI escape codes:
|
|
420
418
|
```ruby
|
421
419
|
table.add_column(
|
422
420
|
:even?,
|
423
|
-
styler: -> (
|
421
|
+
styler: -> (cell_value, s) { cell_value ? "\033[32m#{s}\033[0m" : "\033[31m#{s}\033[0m" }
|
424
422
|
)
|
425
423
|
```
|
426
424
|
|
@@ -434,17 +432,17 @@ require "rainbow"
|
|
434
432
|
|
435
433
|
table.add_column(
|
436
434
|
:even?,
|
437
|
-
styler: -> (
|
435
|
+
styler: -> (cell_value, s) { cell_value ? Rainbow(s).green : Rainbow(s).red }
|
438
436
|
)
|
439
437
|
```
|
440
438
|
|
441
439
|
The `styler` option should be passed a callable that takes two parameters: the
|
442
|
-
first represents the
|
443
|
-
|
444
|
-
cell content after any processing by the [formatter](#formatting-cell-values)
|
440
|
+
first represents the content of the cell (in this case a boolean indicating whether the
|
441
|
+
number is even); and the second represents the formatted string value of that cell, i.e. the
|
442
|
+
cell content after any processing by the [formatter](#formatting-cell-values).
|
445
443
|
If the content of a cell is wrapped over multiple lines, then the `styler` will be called
|
446
444
|
once per line, so that each line of the cell will have the escape sequence applied to it
|
447
|
-
separately (ensuring the
|
445
|
+
separately (ensuring the styling doesn't bleed into neighbouring cells).
|
448
446
|
|
449
447
|
If you want to apply colours or other styling to the content of a column header, as opposed
|
450
448
|
to cells in the table body, use the `header_styler` option, e.g.:
|
@@ -623,7 +621,7 @@ a new table in which the rows and columns are swapped:
|
|
623
621
|
By default, a header row is added to the new table, showing the string value of the element
|
624
622
|
represented in that column. This can be configured, however, along with other aspects of
|
625
623
|
`transpose`'s behaviour. For details, see the
|
626
|
-
[documentation](https://www.rubydoc.info/gems/tabulo/1.5.
|
624
|
+
[documentation](https://www.rubydoc.info/gems/tabulo/1.5.1/Tabulo/Table#transpose-instance_method).
|
627
625
|
|
628
626
|
<a name="additional-configuration-options"></a>
|
629
627
|
### Additional configuration options
|
@@ -764,14 +762,14 @@ The gem is available as open source under the terms of the [MIT
|
|
764
762
|
License](http://opensource.org/licenses/MIT).
|
765
763
|
|
766
764
|
[Gem Version]: https://rubygems.org/gems/tabulo
|
767
|
-
[Documentation]: http://www.rubydoc.info/gems/tabulo/1.5.
|
765
|
+
[Documentation]: http://www.rubydoc.info/gems/tabulo/1.5.1
|
768
766
|
[Build Status]: https://travis-ci.org/matt-harvey/tabulo
|
769
767
|
[Coverage Status]: https://coveralls.io/r/matt-harvey/tabulo
|
770
768
|
[Code Climate]: https://codeclimate.com/github/matt-harvey/tabulo
|
771
769
|
[Awesome Ruby]: https://github.com/markets/awesome-ruby#cli-utilities
|
772
770
|
|
773
771
|
[GV img]: https://img.shields.io/gem/v/tabulo.svg
|
774
|
-
[DC img]: https://img.shields.io/badge/documentation-v1.5.
|
772
|
+
[DC img]: https://img.shields.io/badge/documentation-v1.5.1-blue.svg
|
775
773
|
[BS img]: https://img.shields.io/travis/matt-harvey/tabulo.svg
|
776
774
|
[CS img]: https://img.shields.io/coveralls/matt-harvey/tabulo.svg
|
777
775
|
[CC img]: https://codeclimate.com/github/matt-harvey/tabulo/badges/gpa.svg
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.5.
|
1
|
+
1.5.1
|
data/lib/tabulo/version.rb
CHANGED
data/tabulo.gemspec
CHANGED
@@ -28,8 +28,8 @@ Gem::Specification.new do |spec|
|
|
28
28
|
"changelog_uri" => "https://raw.githubusercontent.com/matt-harvey/tabulo/master/CHANGELOG.md"
|
29
29
|
}
|
30
30
|
|
31
|
-
spec.add_runtime_dependency "tty-screen", "0.
|
32
|
-
spec.add_runtime_dependency "unicode-display_width", "1.
|
31
|
+
spec.add_runtime_dependency "tty-screen", "0.7.0"
|
32
|
+
spec.add_runtime_dependency "unicode-display_width", "1.6.0"
|
33
33
|
|
34
34
|
spec.add_development_dependency "bundler"
|
35
35
|
spec.add_development_dependency "rake", "~> 11.0"
|
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: 1.5.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Harvey
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tty-screen
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.7.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.7.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: unicode-display_width
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.6.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
40
|
+
version: 1.6.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|