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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: edb6043945662b09cf500a65acec2fa51eac9c9397e7c58a890379bc174424cd
4
- data.tar.gz: f7866a1ac405b431752ccba6a81678c9533b245384290c913bb015267ff8f7cd
3
+ metadata.gz: fdbbbcb7f1eb925be546ddb8b798f2c2aa949e737aa221018cfffeb25352458a
4
+ data.tar.gz: 6960e851a8086dc345d4f4db2d3867893b4a0772c748336b2341dd22f9c862be
5
5
  SHA512:
6
- metadata.gz: e67b0006b767a5dbe884bad9296636a01e1d5bdc57c6ffd2689f9315a9465e899e79e74508e2ae7c83c37869bfb3a523931accd2e5d6db346e104794a6c844ec
7
- data.tar.gz: 663b95287868f59f2c29f75564cb660b5c1b2462984f351d6abd6ff057228fd1f8af5a3c7a99d68ed99740b90a493fe18bd9e4a7228f45dc312c929aeb7308a3
6
+ metadata.gz: b4488086be31ac7f659110c3f55c1a6ecce1ccfa59406ba165490622b86167bc61a666a3c42d4ae8c12a5ad4975141ea418242bcd971a4930fbc75a991797cc4
7
+ data.tar.gz: 1de32be32999408268de863e94c79fed536e6844a658f135288c4469c8081d3bce7461c90ef809d67f9a2cf5a1fd6c36f323da4c64a40d20d2fff336bf65d2eb
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ### v1.5.1
4
+
5
+ * Dependency version upgrades
6
+ * Minor documentation fixes
7
+
3
8
  ### v1.5.0
4
9
 
5
10
  * Support use of ANSI escape sequences to add colours and
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 stying[(#colours-and-styling)
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
- such as underlining, you need to use ANSI escape sequences, either directly, or by means of a library
410
- such as [Rainbow](http://github.com/sickill/rainbow) that uses them under the hood. When added
411
- to a string, ANSI escape codes increase a string's length without increasing the width
412
- it visually occupies in the terminal. So that Tabulo can perform the width calculations required to
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: -> (n, s) { n.even? ? "\033[32m#{s}\033[0m" : "\033[31m#{s}\033[0m" }
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: -> (n, s) { n.even? ? Rainbow(s).red : Rainbow(s).green }
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 element of the underlying enumerable for a given table
443
- row; and the second the represents formatted string value of that cell, i.e. the
444
- cell content after any processing by the [formatter](#formatting-cell-values) (if any).
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 stying doesn't bleed into neighbouring cells).
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.0/Tabulo/Table#transpose-instance_method).
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.0
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.0-blue.svg
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.0
1
+ 1.5.1
@@ -1,3 +1,3 @@
1
1
  module Tabulo
2
- VERSION = "1.5.0"
2
+ VERSION = "1.5.1"
3
3
  end
@@ -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.6.5"
32
- spec.add_runtime_dependency "unicode-display_width", "1.5.0"
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.0
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-02 00:00:00.000000000 Z
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.6.5
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.6.5
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.5.0
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.5.0
40
+ version: 1.6.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement