table_print 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,10 +11,10 @@ it assumes the objects in your array all respond to the same methods.
11
11
  == Installation
12
12
 
13
13
  # Install as a standalone gem
14
- $ gem install table_print --pre
14
+ $ gem install table_print
15
15
 
16
16
  # Install within rails
17
- In your Gemfile: gem "table_print", "~> 1.0.0.rc3
17
+ In your Gemfile: gem "table_print", "~> 1.0.0"
18
18
  $ bundle install
19
19
 
20
20
  == Usage
@@ -115,7 +115,7 @@ can be used to filter a column. This could also be used for coloring output.
115
115
 
116
116
  === Config
117
117
 
118
- Use `tp.set` and `tp.clear` to set options on a class-by-class basis.
118
+ Use tp.set and tp.clear to set options on a class-by-class basis.
119
119
 
120
120
  tp.set User, :id, :email # now whenever you print users, the only columns shown will be id and email
121
121
 
@@ -130,7 +130,7 @@ Use `tp.set` and `tp.clear` to set options on a class-by-class basis.
130
130
  --
131
131
  17
132
132
 
133
- # you can still provide a specific set of columns:
133
+ # a specific set of columns will entirely override the baseline config:
134
134
  > tp User.first, :first_name
135
135
  FIRST_NAME
136
136
  ----------
@@ -138,7 +138,13 @@ Use `tp.set` and `tp.clear` to set options on a class-by-class basis.
138
138
 
139
139
  tp.clear User # back to square one - print all the columns we can find
140
140
 
141
- You can also set individual options:
141
+ To see the config for a given object, use tp.config_for.
142
+
143
+ > tp.set User, :id, :email
144
+ > tp.config_for User
145
+ [:id, :email]
146
+
147
+ You can also set global options:
142
148
 
143
149
  tp.set :max_width, 10 # columns won't exceed 10 characters
144
150
  tp.set :time_format, "%Y" # date columns will only show the year
@@ -49,7 +49,7 @@ module TablePrint
49
49
  end
50
50
  end
51
51
 
52
- def tp(data=[], *options)
52
+ def tp(data=Class, *options)
53
53
  start = Time.now
54
54
  printer = TablePrint::Printer.new(data, options)
55
55
  puts printer.table_print unless data.is_a? Class
@@ -21,5 +21,9 @@ module TablePrint
21
21
  def to_s
22
22
  @string_value
23
23
  end
24
+
25
+ def inspect
26
+ to_s
27
+ end
24
28
  end
25
29
  end
@@ -1,4 +1,4 @@
1
1
  module TablePrint
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
4
4
 
@@ -6,6 +6,12 @@ describe TablePrint::Returnable do
6
6
  r.to_s.should == "foobar"
7
7
  end
8
8
 
9
+ it "returns its initialized value from its inspect method" do
10
+ # 1.8.7 calls inspect on return values
11
+ r = TablePrint::Returnable.new("foobar")
12
+ r.inspect.should == "foobar"
13
+ end
14
+
9
15
  it "passes #set through to TablePrint::Config" do
10
16
  TablePrint::Config.should_receive(:set).with(Object, [:foo])
11
17
  r = TablePrint::Returnable.new
@@ -8,7 +8,7 @@ Gem::Specification.new do |gem|
8
8
  gem.email = ["archslide@gmail.com"]
9
9
  gem.email = "archslide@gmail.com"
10
10
 
11
- gem.description = "TablePrint formats an object or array of objects into columns for easy reading. To do this, it assumes the objects in your array all respond to the same methods (vs pretty_print or awesome_print, who can't create columns because your objects could be entirely different)."
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"
13
13
  gem.homepage = "http://tableprintgem.com"
14
14
  gem.version = TablePrint::VERSION
metadata CHANGED
@@ -1,95 +1,88 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: table_print
3
- version: !ruby/object:Gem::Version
4
- hash: 23
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
5
  prerelease:
6
- segments:
7
- - 1
8
- - 0
9
- - 0
10
- version: 1.0.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Chris Doyle
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-08-03 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-12-01 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: cat
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
18
+ requirements:
26
19
  - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 21
29
- segments:
30
- - 0
31
- - 2
32
- - 1
20
+ - !ruby/object:Gem::Version
33
21
  version: 0.2.1
34
22
  type: :development
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: cucumber
38
23
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 0.2.1
30
+ - !ruby/object:Gem::Dependency
31
+ name: cucumber
32
+ requirement: !ruby/object:Gem::Requirement
40
33
  none: false
41
- requirements:
34
+ requirements:
42
35
  - - ~>
43
- - !ruby/object:Gem::Version
44
- hash: 29
45
- segments:
46
- - 1
47
- - 2
48
- - 1
36
+ - !ruby/object:Gem::Version
49
37
  version: 1.2.1
50
38
  type: :development
51
- version_requirements: *id002
52
- - !ruby/object:Gem::Dependency
53
- name: rspec
54
39
  prerelease: false
55
- requirement: &id003 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 1.2.1
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ requirement: !ruby/object:Gem::Requirement
56
49
  none: false
57
- requirements:
50
+ requirements:
58
51
  - - ~>
59
- - !ruby/object:Gem::Version
60
- hash: 35
61
- segments:
62
- - 2
63
- - 11
64
- - 0
52
+ - !ruby/object:Gem::Version
65
53
  version: 2.11.0
66
54
  type: :development
67
- version_requirements: *id003
68
- - !ruby/object:Gem::Dependency
69
- name: rake
70
55
  prerelease: false
71
- requirement: &id004 !ruby/object:Gem::Requirement
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 2.11.0
62
+ - !ruby/object:Gem::Dependency
63
+ name: rake
64
+ requirement: !ruby/object:Gem::Requirement
72
65
  none: false
73
- requirements:
66
+ requirements:
74
67
  - - ~>
75
- - !ruby/object:Gem::Version
76
- hash: 63
77
- segments:
78
- - 0
79
- - 9
80
- - 2
68
+ - !ruby/object:Gem::Version
81
69
  version: 0.9.2
82
70
  type: :development
83
- version_requirements: *id004
84
- description: TablePrint formats an object or array of objects into columns for easy reading. To do this, it assumes the objects in your array all respond to the same methods (vs pretty_print or awesome_print, who can't create columns because your objects could be entirely different).
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 0.9.2
78
+ description: TablePrint turns objects into nicely formatted columns for easy reading.
79
+ Works great in rails console, works on pure ruby objects, autodetects columns, lets
80
+ you traverse ActiveRecord associations. Simple, powerful.
85
81
  email: archslide@gmail.com
86
82
  executables: []
87
-
88
83
  extensions: []
89
-
90
84
  extra_rdoc_files: []
91
-
92
- files:
85
+ files:
93
86
  - .document
94
87
  - .gitignore
95
88
  - .rspec
@@ -131,38 +124,29 @@ files:
131
124
  - table_print.gemspec
132
125
  homepage: http://tableprintgem.com
133
126
  licenses: []
134
-
135
127
  post_install_message:
136
128
  rdoc_options: []
137
-
138
- require_paths:
129
+ require_paths:
139
130
  - lib
140
- required_ruby_version: !ruby/object:Gem::Requirement
131
+ required_ruby_version: !ruby/object:Gem::Requirement
141
132
  none: false
142
- requirements:
143
- - - ">="
144
- - !ruby/object:Gem::Version
145
- hash: 3
146
- segments:
147
- - 0
148
- version: "0"
149
- required_rubygems_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ! '>='
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ required_rubygems_version: !ruby/object:Gem::Requirement
150
138
  none: false
151
- requirements:
152
- - - ">="
153
- - !ruby/object:Gem::Version
154
- hash: 3
155
- segments:
156
- - 0
157
- version: "0"
139
+ requirements:
140
+ - - ! '>='
141
+ - !ruby/object:Gem::Version
142
+ version: '0'
158
143
  requirements: []
159
-
160
144
  rubyforge_project:
161
145
  rubygems_version: 1.8.19
162
146
  signing_key:
163
147
  specification_version: 3
164
148
  summary: Turn objects into nicely formatted columns for easy reading
165
- test_files:
149
+ test_files:
166
150
  - features/adding_columns.feature
167
151
  - features/configuring_output.feature
168
152
  - features/excluding_columns.feature