table_print 1.5.4 → 1.5.5
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 +2 -4
- data/LICENSE.txt +1 -1
- data/README.rdoc +2 -0
- data/features/configuring_output.feature +43 -0
- data/lib/table_print/column.rb +5 -2
- data/lib/table_print/version.rb +1 -1
- data/table_print.gemspec +2 -2
- 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: 75f0b161cc29a2e227d625e00c76364946cc5e11
|
4
|
+
data.tar.gz: 179532ca5df6f983c329cab1f477dc847f35e7ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 808d2426a172902d3d9bbf7c9b084107f43607927e6e5f9fcd4bca9303158a0a35c921718c7e536b6bdef4b324c32ee510879b448f86b3efd485ad390709daf6
|
7
|
+
data.tar.gz: dd0dba14399110e1c2e6f08c5735f812dea8ac22992685dc8ea2e48ee69e0ab98561d32acf5e96efba4a8a56fd30966abc8ff4111e1b52a18463acaf175c3330
|
data/.travis.yml
CHANGED
data/LICENSE.txt
CHANGED
data/README.rdoc
CHANGED
@@ -10,6 +10,8 @@ see exactly the data you care about.
|
|
10
10
|
This {three minute screencast}[http://tableprintgem.com] will give you a quick overview of table_print's most
|
11
11
|
powerful features and how to use them.
|
12
12
|
|
13
|
+
http://arches.io/tp_example.gif
|
14
|
+
|
13
15
|
== Installation
|
14
16
|
|
15
17
|
# Install as a standalone gem
|
@@ -13,6 +13,49 @@ Feature: Configuring output
|
|
13
13
|
------|-----------------------------------------
|
14
14
|
post! | Ryan Ryan Ryan Ryan Ryan Ryan Ryan Ry...
|
15
15
|
"""
|
16
|
+
|
17
|
+
Scenario: Setting a minimum width for an individual column
|
18
|
+
Given a class named Blog
|
19
|
+
|
20
|
+
Given Blog has attributes title, author
|
21
|
+
|
22
|
+
When I instantiate a Blog with {:title => "post!", :author => 'Ryan Ryan'}
|
23
|
+
And table_print Blog, {:include => {:author => {:min_width => 40}}}
|
24
|
+
Then the output should contain
|
25
|
+
"""
|
26
|
+
TITLE | AUTHOR
|
27
|
+
------|-----------------------------------------
|
28
|
+
post! | Ryan Ryan
|
29
|
+
"""
|
30
|
+
|
31
|
+
Scenario: Setting a fixed width for an individual column, when data width is greater than fixed width
|
32
|
+
Given a class named Blog
|
33
|
+
|
34
|
+
Given Blog has attributes title, author
|
35
|
+
|
36
|
+
When I instantiate a Blog with {:title => "post!", :author => 'Ryan Ryan Ryan Ryan Ryan Ryan Ryan'}
|
37
|
+
And table_print Blog, {:include => {:author => {:fixed_width => 15}}}
|
38
|
+
Then the output should contain
|
39
|
+
"""
|
40
|
+
TITLE | AUTHOR
|
41
|
+
------|----------------
|
42
|
+
post! | Ryan Ryan Ry...
|
43
|
+
"""
|
44
|
+
|
45
|
+
Scenario: Setting a fixed width for an individual column, when data width is less than fixed width
|
46
|
+
Given a class named Blog
|
47
|
+
|
48
|
+
Given Blog has attributes title, author
|
49
|
+
|
50
|
+
When I instantiate a Blog with {:title => "post!", :author => 'Ryan Ryan'}
|
51
|
+
And table_print Blog, {:include => {:author => {:fixed_width => 15}}}
|
52
|
+
Then the output should contain
|
53
|
+
"""
|
54
|
+
TITLE | AUTHOR
|
55
|
+
------|----------------
|
56
|
+
post! | Ryan Ryan
|
57
|
+
"""
|
58
|
+
|
16
59
|
Scenario: Specifying configuration on a per-object basis
|
17
60
|
Given a class named Blog
|
18
61
|
|
data/lib/table_print/column.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module TablePrint
|
2
2
|
class Column
|
3
3
|
attr_reader :formatters
|
4
|
-
attr_accessor :name, :data, :time_format, :default_width
|
4
|
+
attr_accessor :name, :data, :time_format, :default_width, :min_width, :fixed_width
|
5
5
|
|
6
6
|
def initialize(attr_hash={})
|
7
7
|
@formatters = []
|
@@ -48,7 +48,10 @@ module TablePrint
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def width
|
51
|
-
|
51
|
+
return fixed_width if fixed_width
|
52
|
+
|
53
|
+
width = [(default_width || max_width), data_width].min
|
54
|
+
[(min_width || 0), width].max
|
52
55
|
end
|
53
56
|
|
54
57
|
private
|
data/lib/table_print/version.rb
CHANGED
data/table_print.gemspec
CHANGED
@@ -5,8 +5,8 @@ Gem::Specification.new do |gem|
|
|
5
5
|
gem.name = "table_print"
|
6
6
|
|
7
7
|
gem.authors = ["Chris Doyle"]
|
8
|
-
gem.email = ["
|
9
|
-
gem.email = "
|
8
|
+
gem.email = ["chris@arches.io"]
|
9
|
+
gem.email = "chris@arches.io"
|
10
10
|
|
11
11
|
gem.description = "TablePrint turns objects into nicely formatted columns for easy reading. Works great in rails console, works on pure ruby objects, autodetects columns, lets you traverse ActiveRecord associations. Simple, powerful."
|
12
12
|
gem.summary = "Turn objects into nicely formatted columns for easy reading"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: table_print
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Doyle
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cat
|
@@ -69,7 +69,7 @@ dependencies:
|
|
69
69
|
description: TablePrint turns objects into nicely formatted columns for easy reading.
|
70
70
|
Works great in rails console, works on pure ruby objects, autodetects columns, lets
|
71
71
|
you traverse ActiveRecord associations. Simple, powerful.
|
72
|
-
email:
|
72
|
+
email: chris@arches.io
|
73
73
|
executables: []
|
74
74
|
extensions: []
|
75
75
|
extra_rdoc_files: []
|
@@ -134,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
134
|
version: '0'
|
135
135
|
requirements: []
|
136
136
|
rubyforge_project:
|
137
|
-
rubygems_version: 2.
|
137
|
+
rubygems_version: 2.4.8
|
138
138
|
signing_key:
|
139
139
|
specification_version: 4
|
140
140
|
summary: Turn objects into nicely formatted columns for easy reading
|