text-table 1.2.3 → 1.2.4
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 +11 -0
- data/README.rdoc +3 -0
- data/lib/text-table/table.rb +4 -0
- data/lib/text-table/version.rb +1 -1
- data/spec/integration/alignment_spec.rb +2 -0
- data/spec/integration/performance_spec.rb +6 -6
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a197566529e0dc4b05dc3ee53918eb4eac2341a4
|
4
|
+
data.tar.gz: ee8786d2e4973ecdb34f0b76b02138c65fd4e2a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de10c431e934dcf03b2af5a50e977f85705ca46a29282bf71077f0e73bbf9ef9454e4c6aafc509a5a22caad2d3ab8a1e827433ae33d7d5a608e1a22476761bd5
|
7
|
+
data.tar.gz: c15f4390e3a4a782d3a36221ae5f175c3c8b1856dd99d4e8af6587c2bc55bec284355b4960205aada1459b13e363e41d577187fcf33b41c6c01a23d921cc054e
|
data/.travis.yml
ADDED
data/README.rdoc
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
= text-table
|
2
|
+
{<img src="https://badge.fury.io/rb/text-table.png" alt="Gem Version" />}[https://rubygems.org/gems/text-table]
|
3
|
+
{<img src="https://secure.travis-ci.org/aptinio/text-table.png" alt="Build Status" />}[http://travis-ci.org/aptinio/text-table]
|
4
|
+
{<img src="https://codeclimate.com/github/aptinio/text-table.png" alt="Code Climate" />}[https://codeclimate.com/github/aptinio/text-table]
|
2
5
|
|
3
6
|
A feature-rich, easy-to-use plain text table formatter.
|
4
7
|
|
data/lib/text-table/table.rb
CHANGED
@@ -201,6 +201,7 @@ module Text #:nodoc:
|
|
201
201
|
row[row.index(cell)] = hashify(cell, {:align => alignment_block}) if cell and not(cell.is_a?(Hash) && cell[:colspan].to_i > 0)
|
202
202
|
end
|
203
203
|
rows.each do |row|
|
204
|
+
next if row == :separator
|
204
205
|
set_alignment.call(row, column_number, alignment)
|
205
206
|
end
|
206
207
|
set_alignment.call(foot, column_number, alignment) if foot
|
@@ -211,5 +212,8 @@ module Text #:nodoc:
|
|
211
212
|
defaults.merge(cell.is_a?(Hash) ? cell : {:value => cell})
|
212
213
|
end
|
213
214
|
|
215
|
+
def inspect
|
216
|
+
"#<#{self.class}:0x#{self.__id__.to_s(16)}>"
|
217
|
+
end
|
214
218
|
end
|
215
219
|
end
|
data/lib/text-table/version.rb
CHANGED
@@ -149,6 +149,7 @@ describe Text::Table do
|
|
149
149
|
before do
|
150
150
|
table.rows[1][2] = {:value => 'c', :align => :center}
|
151
151
|
table.rows << [{:value => 'x', :colspan => 2}, 'c', 'd']
|
152
|
+
table.rows << :separator
|
152
153
|
table.rows << ['a', 'b', {:value => 'x', :colspan => 2}]
|
153
154
|
table.align_column 2, :right
|
154
155
|
table.align_column 3, :right
|
@@ -161,6 +162,7 @@ describe Text::Table do
|
|
161
162
|
| aa | bbb | cccc | d |
|
162
163
|
| aaa | bbbb | c | dd |
|
163
164
|
| x | c | d |
|
165
|
+
+------+------+------+------+
|
164
166
|
| a | b | x |
|
165
167
|
+------+------+------+------+
|
166
168
|
| aaaa | b | cc | ddd |
|
@@ -3,17 +3,17 @@ require 'benchmark'
|
|
3
3
|
|
4
4
|
describe Text::Table, 'performance' do
|
5
5
|
it 'is linear relative to row count' do
|
6
|
-
base = time_to_render_num_of_rows
|
7
|
-
time = time_to_render_num_of_rows
|
6
|
+
base = time_to_render_num_of_rows 1_000
|
7
|
+
time = time_to_render_num_of_rows 10_000
|
8
8
|
|
9
|
-
time.should_not > base *
|
9
|
+
time.should_not > base * 20
|
10
10
|
end
|
11
11
|
|
12
12
|
def time_to_render_num_of_rows(num)
|
13
13
|
GC.start
|
14
14
|
|
15
|
-
Benchmark.
|
16
|
-
Text::Table.new(rows
|
17
|
-
|
15
|
+
Benchmark.measure {
|
16
|
+
Text::Table.new(:rows => Array.new(num)).to_s
|
17
|
+
}.total
|
18
18
|
end
|
19
19
|
end
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: text-table
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Tinio
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '2'
|
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
26
|
version: '2'
|
27
27
|
description: Allows you to easily create and format plain text tables, useful when
|
@@ -34,8 +34,9 @@ extra_rdoc_files:
|
|
34
34
|
- LICENSE
|
35
35
|
- README.rdoc
|
36
36
|
files:
|
37
|
-
- .document
|
38
|
-
- .gitignore
|
37
|
+
- ".document"
|
38
|
+
- ".gitignore"
|
39
|
+
- ".travis.yml"
|
39
40
|
- CHANGELOG.rdoc
|
40
41
|
- Gemfile
|
41
42
|
- LICENSE
|
@@ -67,17 +68,17 @@ require_paths:
|
|
67
68
|
- lib
|
68
69
|
required_ruby_version: !ruby/object:Gem::Requirement
|
69
70
|
requirements:
|
70
|
-
- -
|
71
|
+
- - ">="
|
71
72
|
- !ruby/object:Gem::Version
|
72
73
|
version: '0'
|
73
74
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
75
|
requirements:
|
75
|
-
- -
|
76
|
+
- - ">="
|
76
77
|
- !ruby/object:Gem::Version
|
77
78
|
version: '0'
|
78
79
|
requirements: []
|
79
80
|
rubyforge_project:
|
80
|
-
rubygems_version: 2.
|
81
|
+
rubygems_version: 2.4.5
|
81
82
|
signing_key:
|
82
83
|
specification_version: 4
|
83
84
|
summary: A feature-rich, easy-to-use plain text table formatter.
|