text-table 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +4 -0
- data/README.rdoc +13 -13
- data/Rakefile +2 -1
- data/VERSION +1 -1
- data/lib/text-table/table.rb +5 -5
- data/text-table.gemspec +9 -6
- metadata +30 -9
data/CHANGELOG.rdoc
CHANGED
data/README.rdoc
CHANGED
@@ -11,22 +11,9 @@ or when you want to quickly print formatted tables to a dot-matrix printer.
|
|
11
11
|
|
12
12
|
Text::Table is compatible with Ruby 1.8.6, 1.8.7 and 1.9.1 and includes a comprehensive test suite.
|
13
13
|
|
14
|
-
This project was heavily inspired by visionmedia's terminal-table, and to a lesser-extent, by prawn, ruport and hirb.
|
15
|
-
I initially wanted to add more features to terminal-table (footer, separators between rows, etc)
|
16
|
-
and to fix a then alignment issue with spanned columns.
|
17
|
-
Instead of forking terminal-table, I've decided to start a new project primarily as an exercise,
|
18
|
-
and to be able to model-out the classes differently.
|
19
|
-
|
20
14
|
|
21
15
|
== Install
|
22
16
|
|
23
|
-
If you haven't yet,
|
24
|
-
|
25
|
-
gem install gemcutter
|
26
|
-
gem tumble
|
27
|
-
|
28
|
-
Then,
|
29
|
-
|
30
17
|
gem install text-table
|
31
18
|
|
32
19
|
|
@@ -191,6 +178,19 @@ Cell padding and table boundaries can be modified.
|
|
191
178
|
# O=======O=======O
|
192
179
|
|
193
180
|
|
181
|
+
== Special Thanks
|
182
|
+
|
183
|
+
This project was inspired by visionmedia's terminal-table, and to a lesser-extent, by prawn, ruport and hirb.
|
184
|
+
I've decided to start a new project, primarily as an exercise, and to be able to model-out the classes differently.
|
185
|
+
Thanks to the authors and contributors of these projects.
|
186
|
+
|
187
|
+
|
188
|
+
== Contributors
|
189
|
+
|
190
|
+
* Claudio Bustos (clbustos[link:http://github.com/clbustos])
|
191
|
+
* Fix Ruby 1.9 warnings on shadowed outer local variables
|
192
|
+
|
193
|
+
|
194
194
|
== Copyright
|
195
195
|
|
196
196
|
Copyright (c) 2009 Aaron Tinio. See LICENSE for details.
|
data/Rakefile
CHANGED
@@ -10,7 +10,8 @@ begin
|
|
10
10
|
gem.email = "aptinio@yahoo.com"
|
11
11
|
gem.homepage = "http://github.com/aptinio/text-table"
|
12
12
|
gem.authors = ["Aaron Tinio"]
|
13
|
-
gem.add_development_dependency
|
13
|
+
gem.add_development_dependency 'rspec'
|
14
|
+
gem.add_development_dependency 'jeweler'
|
14
15
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
16
|
end
|
16
17
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.
|
1
|
+
1.2.2
|
data/lib/text-table/table.rb
CHANGED
@@ -193,11 +193,11 @@ module Text #:nodoc:
|
|
193
193
|
# Note that headers, spanned cells and cells with explicit alignments are not affected by <tt>align_column</tt>.
|
194
194
|
#
|
195
195
|
def align_column(column_number, alignment)
|
196
|
-
set_alignment = Proc.new do |row,
|
197
|
-
cell = row.find do |
|
198
|
-
row[0...row.index(
|
196
|
+
set_alignment = Proc.new do |row, column_number_block, alignment_block|
|
197
|
+
cell = row.find do |cell_row|
|
198
|
+
row[0...row.index(cell_row)].map {|c| c.is_a?(Hash) ? c[:colspan] || 1 : 1}.inject(0, &:+) == column_number_block - 1
|
199
199
|
end
|
200
|
-
row[row.index(cell)] = hashify(cell, {:align =>
|
200
|
+
row[row.index(cell)] = hashify(cell, {:align => alignment_block}) if cell and not(cell.is_a?(Hash) && cell[:colspan].to_i > 0)
|
201
201
|
end
|
202
202
|
rows.each do |row|
|
203
203
|
set_alignment.call(row, column_number, alignment)
|
@@ -211,4 +211,4 @@ module Text #:nodoc:
|
|
211
211
|
end
|
212
212
|
|
213
213
|
end
|
214
|
-
end
|
214
|
+
end
|
data/text-table.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{text-table}
|
8
|
-
s.version = "1.2.
|
8
|
+
s.version = "1.2.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Aaron Tinio"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-03-29}
|
13
13
|
s.description = %q{Allows you to easily create and format plain text tables, useful when working with the terminal or when you want to quickly print formatted tables to a dot-matrix printer.}
|
14
14
|
s.email = %q{aptinio@yahoo.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -40,7 +40,7 @@ Gem::Specification.new do |s|
|
|
40
40
|
s.homepage = %q{http://github.com/aptinio/text-table}
|
41
41
|
s.rdoc_options = ["--charset=UTF-8"]
|
42
42
|
s.require_paths = ["lib"]
|
43
|
-
s.rubygems_version = %q{1.3.
|
43
|
+
s.rubygems_version = %q{1.3.6}
|
44
44
|
s.summary = %q{A feature-rich, easy-to-use plain text table formatter.}
|
45
45
|
s.test_files = [
|
46
46
|
"spec/spec_helper.rb",
|
@@ -54,12 +54,15 @@ Gem::Specification.new do |s|
|
|
54
54
|
s.specification_version = 3
|
55
55
|
|
56
56
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
57
|
-
s.add_development_dependency(%q<rspec>, [">=
|
57
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
58
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
58
59
|
else
|
59
|
-
s.add_dependency(%q<rspec>, [">=
|
60
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
61
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
60
62
|
end
|
61
63
|
else
|
62
|
-
s.add_dependency(%q<rspec>, [">=
|
64
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
65
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
63
66
|
end
|
64
67
|
end
|
65
68
|
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: text-table
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 2
|
8
|
+
- 2
|
9
|
+
version: 1.2.2
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Aaron Tinio
|
@@ -9,19 +14,33 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date: 2010-
|
17
|
+
date: 2010-03-29 00:00:00 +08:00
|
13
18
|
default_executable:
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: rspec
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
version: "0"
|
17
30
|
type: :development
|
18
|
-
|
19
|
-
|
31
|
+
version_requirements: *id001
|
32
|
+
- !ruby/object:Gem::Dependency
|
33
|
+
name: jeweler
|
34
|
+
prerelease: false
|
35
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
20
36
|
requirements:
|
21
37
|
- - ">="
|
22
38
|
- !ruby/object:Gem::Version
|
23
|
-
|
24
|
-
|
39
|
+
segments:
|
40
|
+
- 0
|
41
|
+
version: "0"
|
42
|
+
type: :development
|
43
|
+
version_requirements: *id002
|
25
44
|
description: Allows you to easily create and format plain text tables, useful when working with the terminal or when you want to quickly print formatted tables to a dot-matrix printer.
|
26
45
|
email: aptinio@yahoo.com
|
27
46
|
executables: []
|
@@ -64,18 +83,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
64
83
|
requirements:
|
65
84
|
- - ">="
|
66
85
|
- !ruby/object:Gem::Version
|
86
|
+
segments:
|
87
|
+
- 0
|
67
88
|
version: "0"
|
68
|
-
version:
|
69
89
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
90
|
requirements:
|
71
91
|
- - ">="
|
72
92
|
- !ruby/object:Gem::Version
|
93
|
+
segments:
|
94
|
+
- 0
|
73
95
|
version: "0"
|
74
|
-
version:
|
75
96
|
requirements: []
|
76
97
|
|
77
98
|
rubyforge_project:
|
78
|
-
rubygems_version: 1.3.
|
99
|
+
rubygems_version: 1.3.6
|
79
100
|
signing_key:
|
80
101
|
specification_version: 3
|
81
102
|
summary: A feature-rich, easy-to-use plain text table formatter.
|