tabulo 1.0.0 → 1.0.1
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/.travis.yml +1 -1
- data/CHANGELOG.md +5 -0
- data/README.md +4 -7
- data/VERSION +1 -1
- data/lib/tabulo/row.rb +1 -2
- data/lib/tabulo/table.rb +11 -11
- data/lib/tabulo/version.rb +1 -1
- data/tabulo.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb96e6f0dd6059d898a0bce0d60b8d97cc3c08fc
|
4
|
+
data.tar.gz: 84e67bf09c8e7058789bacecaabace6c1b0fa4af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2eff9dc5e7a946ea6b0ed95e5ddff7f987c39c8308ed3199447c8c0f1ad21f1f1d4ff4af7ffe0df35cf6167d2729f4c5f4ba04b62d28e37516ea71e6bee8fc3a
|
7
|
+
data.tar.gz: 1ca3aeeba0dd8333ca398b1245dea596e93d0b4cd11cb4f013a56d2f7dbb9d9aaba330829e16ad1b1c77419c6b1862a7da71be0082f758ff27fc4b41e1804b2f
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -4,7 +4,6 @@
|
|
4
4
|
[![Dependency Status][DS img]][Dependency Status]
|
5
5
|
[![Coverage Status][CS img]][Coverage Status]
|
6
6
|
[![Build Status][BS img]][Build Status]
|
7
|
-
[![Code Climate][CC img]][Code Climate]
|
8
7
|
[![Documentation][DC img]][Documentation]
|
9
8
|
|
10
9
|
## Overview
|
@@ -259,7 +258,7 @@ table = Tabulo::Table.new(
|
|
259
258
|
|
260
259
|
Wrapping behaviour is configured for the table as a whole using the `wrap_header_cells_to` option
|
261
260
|
for header cells and `wrap_body_cells_to` for body cells, both of which default to `nil`, meaning
|
262
|
-
that cells are wrapped to as many rows as required. Passing
|
261
|
+
that cells are wrapped to as many rows as required. Passing an `Integer` limits wrapping to the given
|
263
262
|
number of rows, with content truncated from that point on. The `~` character is appended to the
|
264
263
|
outputted cell content to show that truncation has occurred:
|
265
264
|
|
@@ -318,7 +317,7 @@ the underlying value of that cell, not its formatted value.
|
|
318
317
|
### Repeating headers
|
319
318
|
|
320
319
|
By default, headers are only shown once, at the top of the table (`header_frequency: :start`). If
|
321
|
-
`header_frequency` is passed `nil`, headers are not shown at all; or, if passed
|
320
|
+
`header_frequency` is passed `nil`, headers are not shown at all; or, if passed an `Integer` N,
|
322
321
|
headers are shown at the top and then repeated every N rows. This can be handy when you're looking
|
323
322
|
at table that's taller than your terminal.
|
324
323
|
|
@@ -396,12 +395,10 @@ License](http://opensource.org/licenses/MIT).
|
|
396
395
|
[Build Status]: https://travis-ci.org/matt-harvey/tabulo
|
397
396
|
[Dependency Status]: https://gemnasium.com/matt-harvey/tabulo
|
398
397
|
[Coverage Status]: https://coveralls.io/r/matt-harvey/tabulo
|
399
|
-
[
|
400
|
-
[Documentation]: http://www.rubydoc.info/gems/tabulo/1.0.0
|
398
|
+
[Documentation]: http://www.rubydoc.info/gems/tabulo/1.0.1
|
401
399
|
|
402
400
|
[GV img]: https://img.shields.io/gem/v/tabulo.svg?style=plastic
|
403
401
|
[BS img]: https://img.shields.io/travis/matt-harvey/tabulo.svg?style=plastic
|
404
402
|
[DS img]: https://img.shields.io/gemnasium/matt-harvey/tabulo.svg?style=plastic
|
405
403
|
[CS img]: https://img.shields.io/coveralls/matt-harvey/tabulo.svg?style=plastic
|
406
|
-
[
|
407
|
-
[DC img]: https://img.shields.io/badge/docs-v1.0.0-blue.svg?style=plastic
|
404
|
+
[DC img]: https://img.shields.io/badge/docs-v1.0.1-blue.svg?style=plastic
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.1
|
data/lib/tabulo/row.rb
CHANGED
@@ -18,8 +18,7 @@ module Tabulo
|
|
18
18
|
# table = Tabulo::Table.new([1, 10], columns: %i(itself even?))
|
19
19
|
# row = table.first
|
20
20
|
# row.each do |cell|
|
21
|
-
# cell # => 1,
|
22
|
-
# cell.class # => Fixnum, => FalseClass
|
21
|
+
# puts cell # => 1, => false
|
23
22
|
# end
|
24
23
|
def each
|
25
24
|
@table.column_registry.each do |_, column|
|
data/lib/tabulo/table.rb
CHANGED
@@ -32,19 +32,19 @@ module Tabulo
|
|
32
32
|
# be unique. Each element of the Array will be used to create a column whose content is
|
33
33
|
# created by calling the corresponding method on each element of sources. Note
|
34
34
|
# the {#add_column} method is a much more flexible way to set up columns on the table.
|
35
|
-
# @param [
|
35
|
+
# @param [Integer, nil] column_width The default column width for columns in this
|
36
36
|
# table, not excluding padding. If nil, then DEFAULT_COLUMN_WIDTH will be used.
|
37
|
-
# @param [:start, nil,
|
37
|
+
# @param [:start, nil, Integer] header_frequency Controls the display of column headers.
|
38
38
|
# If passed <tt>:start</tt>, headers will be shown at the top of the table only. If passed <tt>nil</tt>,
|
39
|
-
# headers will not be shown. If passed
|
39
|
+
# headers will not be shown. If passed an Integer N (> 0), headers will be shown at the top of the table,
|
40
40
|
# then repeated every N rows.
|
41
|
-
# @param [nil,
|
41
|
+
# @param [nil, Integer] wrap_header_cells_to Controls wrapping behaviour for header
|
42
42
|
# cells if the content thereof is longer than the column's fixed width. If passed <tt>nil</tt> (default),
|
43
|
-
# content will be wrapped for as many rows as required to accommodate it. If passed
|
43
|
+
# content will be wrapped for as many rows as required to accommodate it. If passed an Integer N (> 0),
|
44
44
|
# content will be wrapped up to N rows and then truncated thereafter.
|
45
|
-
# @param [nil,
|
45
|
+
# @param [nil, Integer] wrap_body_cells_to Controls wrapping behaviour for table cells (excluding
|
46
46
|
# headers), if their content is longer than the column's fixed width. If passed <tt>nil</tt>, content will
|
47
|
-
# be wrapped for as many rows as required to accommodate it. If passed
|
47
|
+
# be wrapped for as many rows as required to accommodate it. If passed an Integer N (> 0), content will be
|
48
48
|
# wrapped up to N rows and then truncated thereafter.
|
49
49
|
# @return [Table] a new Table
|
50
50
|
# @raise [InvalidColumnLabelError] if non-unique Symbols are provided to columns.
|
@@ -80,7 +80,7 @@ module Tabulo
|
|
80
80
|
# by the type of the cell value, with numbers aligned right, booleans center-aligned, and
|
81
81
|
# other values left-aligned. Note header text alignment is configured separately using the
|
82
82
|
# :align_header param.
|
83
|
-
# @param [
|
83
|
+
# @param [Integer] width (nil) Specifies the width of the column, excluding padding. If
|
84
84
|
# nil, then the column will take the width provided by the `column_width` param
|
85
85
|
# with which the Table was initialized.
|
86
86
|
# @param [#to_proc] formatter (:to_s.to_proc) A lambda or other callable object that
|
@@ -141,7 +141,7 @@ module Tabulo
|
|
141
141
|
case @header_frequency
|
142
142
|
when :start
|
143
143
|
index == 0
|
144
|
-
when
|
144
|
+
when Integer
|
145
145
|
index % @header_frequency == 0
|
146
146
|
else
|
147
147
|
@header_frequency
|
@@ -265,7 +265,7 @@ module Tabulo
|
|
265
265
|
# Each String includes the spaces, if any, on either side required for the
|
266
266
|
# "internal padding" of the cell to carry out the cell content alignment -- but
|
267
267
|
# does not include the single character of padding around each column.
|
268
|
-
# @param [
|
268
|
+
# @param [Integer] wrap_cells_to the number of "lines" of wrapped content to allow
|
269
269
|
# before truncating.
|
270
270
|
# @return [String] the entire formatted row including all padding and borders.
|
271
271
|
def format_row(cells, wrap_cells_to)
|
@@ -312,7 +312,7 @@ module Tabulo
|
|
312
312
|
end
|
313
313
|
|
314
314
|
# @!visibility private
|
315
|
-
# @return [
|
315
|
+
# @return [Integer] the length of the longest segment of str when split by newlines
|
316
316
|
def wrapped_width(str)
|
317
317
|
segments = str.split($/)
|
318
318
|
segments.inject(1) do |length, segment|
|
data/lib/tabulo/version.rb
CHANGED
data/tabulo.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
|
24
24
|
spec.required_ruby_version = ">= 2.1.10"
|
25
25
|
|
26
|
-
spec.add_development_dependency "bundler", "~> 1.
|
26
|
+
spec.add_development_dependency "bundler", "~> 1.16.0"
|
27
27
|
spec.add_development_dependency "rake", "~> 11.0"
|
28
28
|
spec.add_development_dependency "rspec", "~> 3.0"
|
29
29
|
spec.add_development_dependency "simplecov"
|
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.0.
|
4
|
+
version: 1.0.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: 2017-
|
11
|
+
date: 2017-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.16.0
|
20
20
|
type: :development
|
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: 1.
|
26
|
+
version: 1.16.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|