table_display 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ba8622f69a321f9bf5642f544c08f8cec21c8173
4
+ data.tar.gz: 87a83652fd7ca20ed437b44bb2ce88c9235d5a94
5
+ SHA512:
6
+ metadata.gz: bc1f6b943a1be7442744c1cdec0b484b10c45847391ab9e331c132bd9a242eac13f118f5bfd0b2d062e22482ed7862d68b25a70c637399a4fb610832aa7751af
7
+ data.tar.gz: 22de4f2301b19d812d54de2484df9f2856cc525a0c42f3943990904a93cc9ebeb1cb95f63caddc0622514b6a09a761ed80d06f7d37528aab30a0563edebe345c
data/README CHANGED
@@ -4,13 +4,13 @@ Table Display
4
4
  Adds support for displaying your ActiveRecord tables, named scopes, collections, or
5
5
  plain arrays in a table view when working in rails console, shell, or email template.
6
6
 
7
- Enumerable#to_table returns the printable strings; Object#pt calls #to_table on its
7
+ Enumerable#to_table_display returns the printable strings; Object#pt calls #to_table_display on its
8
8
  first argument and puts out the result.
9
9
 
10
10
  Columns you haven't loaded (eg. from using :select) are omitted, and derived/calculated
11
11
  columns (eg. again, from using :select) are added.
12
12
 
13
- Both #to_table and Object#pt methods take :only, :except, and :methods which work like
13
+ Both #to_table_display and Object#pt methods take :only, :except, and :methods which work like
14
14
  the #to_xml method to change what attributes/methods are output.
15
15
 
16
16
  The normal output uses #inspect on the data values to make them printable, so you can
@@ -21,8 +21,8 @@ you can pass the option :inspect => false to disable inspection.
21
21
  Example
22
22
  =======
23
23
 
24
- # You can call the to_table method:
25
- >> puts Project.find(31).tasks.to_table
24
+ # You can call the to_table_display method:
25
+ >> puts Project.find(31).tasks.to_table_display
26
26
  +----+------------+------------------------+------------------+--------------------------------+--------------------------------+--------------------------------+
27
27
  | id | project_id | description | due_on | completed_at | created_at | updated_at |
28
28
  +----+------------+------------------------+------------------+--------------------------------+--------------------------------+--------------------------------+
@@ -42,7 +42,7 @@ Example
42
42
 
43
43
  # Like to_xml, you can pass a :methods option to add the output methods on your models, and you can pass :only or :except
44
44
  # to (respectively) show only certain columns or show all except certain columns:
45
- >> puts Customer.find(31).purchases.to_table(:only => [:id, :description], :methods => [:met_due_date?])
45
+ >> puts Customer.find(31).purchases.to_table_display(:only => [:id, :description], :methods => [:met_due_date?])
46
46
  +----+------------------------+---------------+
47
47
  | id | description | met_due_date? |
48
48
  +----+------------------------+---------------+
@@ -60,7 +60,7 @@ Example
60
60
  +----+------------------------+---------------+
61
61
 
62
62
  # There's a convenient equivalent syntax for displaying an ordered list of columns, like :only and :methods:
63
- >> puts Customer.find(31).purchases.to_table :id, :description, :met_due_date?
63
+ >> puts Customer.find(31).purchases.to_table_display :id, :description, :met_due_date?
64
64
  # which provides:
65
65
  >> pt Customer.find(31).purchases, :id, :description, :met_due_date?
66
66
  # resulting in the same output as above.
@@ -1,5 +1,5 @@
1
1
  module TableDisplay
2
- def to_table(*args)
2
+ def to_table_display(*args)
3
3
  options = args.last.is_a?(Hash) ? args.pop : {}
4
4
  extra_methods = args.length > 0 ? args.collect(&:to_s) : []
5
5
  extra_methods += Array(options.delete(:methods)) if options[:methods]
@@ -8,7 +8,7 @@ module TableDisplay
8
8
  except_attributes = Array(options.delete(:except)) if options[:except]
9
9
  except_attributes = (except_attributes + except_attributes.collect(&:to_s)).uniq if except_attributes.present? # we have to keep string and symbol arguments separate for hashes, which may not have 'indifferent access'
10
10
  display_inspect = options.nil? || !options.has_key?(:inspect) || options.delete(:inspect)
11
- raise "unknown options passed to to_table: #{options.keys.to_sentence}" unless options.blank?
11
+ raise "unknown options passed to to_table_display: #{options.keys.to_sentence}" unless options.blank?
12
12
 
13
13
  column_lengths = ActiveSupport::OrderedHash.new
14
14
 
@@ -100,7 +100,7 @@ end
100
100
 
101
101
  module Kernel
102
102
  def pt(target, *options)
103
- puts target.to_table(*options)
103
+ puts target.respond_to?(:to_table_display) ? target.to_table_display(*options) : target
104
104
  end
105
105
  end
106
106
 
@@ -1,3 +1,3 @@
1
1
  module TableDisplay
2
- VERSION = '1.0.0'
2
+ VERSION = '2.0.0'
3
3
  end
@@ -9,13 +9,13 @@ spec = Gem::Specification.new do |gem|
9
9
  Adds support for displaying your ActiveRecord tables, named scopes, collections, or
10
10
  plain arrays in a table view when working in rails console, shell, or email template.
11
11
 
12
- Enumerable#to_table returns the printable strings; Object#pt calls #to_table on its
12
+ Enumerable#to_table_display returns the printable strings; Object#pt calls #to_table_display on its
13
13
  first argument and puts out the result.
14
14
 
15
15
  Columns you haven't loaded (eg. from using :select) are omitted, and derived/calculated
16
16
  columns (eg. again, from using :select) are added.
17
17
 
18
- Both #to_table and Object#pt methods take :only, :except, and :methods which work like
18
+ Both #to_table_display and Object#pt methods take :only, :except, and :methods which work like
19
19
  the #to_xml method to change what attributes/methods are output.
20
20
 
21
21
  The normal output uses #inspect on the data values to make them printable, so you can
@@ -35,4 +35,5 @@ EOF
35
35
  gem.add_development_dependency "rake"
36
36
  gem.add_development_dependency "sqlite3"
37
37
  gem.add_development_dependency "activerecord"
38
+ gem.add_development_dependency "test-unit"
38
39
  end
@@ -39,40 +39,40 @@ class TableDisplayTest < ActiveSupport::TestCase
39
39
  @project = projects(:this_project)
40
40
  end
41
41
 
42
- test "#to_table is available on arrays" do
42
+ test "#to_table_display is available on arrays" do
43
43
  assert_nothing_raised do
44
- [].to_table
44
+ [].to_table_display
45
45
  end
46
46
  end
47
47
 
48
- test "#to_table is available on ActiveRecord find results" do # which should be arrays, in fact
48
+ test "#to_table_display is available on ActiveRecord find results" do # which should be arrays, in fact
49
49
  assert_nothing_raised do
50
- Task.find(:all).to_table
50
+ Task.find(:all).to_table_display
51
51
  end
52
52
  end
53
53
 
54
- test "#to_table is available on ActiveRecord named_scopes" do
54
+ test "#to_table_display is available on ActiveRecord named_scopes" do
55
55
  assert_nothing_raised do
56
- Task.completed.to_table
56
+ Task.completed.to_table_display
57
57
  end
58
58
  end
59
59
 
60
- test "#to_table is available on ActiveRecord association collections" do
60
+ test "#to_table_display is available on ActiveRecord association collections" do
61
61
  assert_nothing_raised do
62
- @project.tasks.to_table
62
+ @project.tasks.to_table_display
63
63
  end
64
64
  end
65
65
 
66
- test "#to_table is available on named scopes in ActiveRecord association collections" do
66
+ test "#to_table_display is available on named scopes in ActiveRecord association collections" do
67
67
  assert_nothing_raised do
68
- @project.tasks.completed.to_table
68
+ @project.tasks.completed.to_table_display
69
69
  end
70
70
  end
71
71
 
72
72
  # we run some simple regression tests to check that everything works as expected
73
73
 
74
- test "#to_table by default includes all the database columns in database order" do
75
- assert_equal <<END.strip, @project.tasks.to_table.join("\n")
74
+ test "#to_table_display by default includes all the database columns in database order" do
75
+ assert_equal <<END.strip, @project.tasks.to_table_display.join("\n")
76
76
  +----+------------+------------------------+------------------+---------------------------+---------------------------+---------------------------+
77
77
  | id | project_id | description | due_on | completed_at | created_at | updated_at |
78
78
  +----+------------+------------------------+------------------+---------------------------+---------------------------+---------------------------+
@@ -82,8 +82,8 @@ class TableDisplayTest < ActiveSupport::TestCase
82
82
  END
83
83
  end
84
84
 
85
- test "#to_table by default includes all the database columns in database order even when not called on a typeless array" do
86
- assert_equal <<END.strip, @project.tasks.find(:all).to_table.join("\n")
85
+ test "#to_table_display by default includes all the database columns in database order even when not called on a typeless array" do
86
+ assert_equal <<END.strip, @project.tasks.find(:all).to_table_display.join("\n")
87
87
  +----+------------+------------------------+------------------+---------------------------+---------------------------+---------------------------+
88
88
  | id | project_id | description | due_on | completed_at | created_at | updated_at |
89
89
  +----+------------+------------------------+------------------+---------------------------+---------------------------+---------------------------+
@@ -93,8 +93,8 @@ END
93
93
  END
94
94
  end
95
95
 
96
- test "#to_table leaves out any attributes not loaded" do
97
- assert_equal <<END.strip, @project.tasks.find(:all, :select => "id, project_id, completed_at").to_table.join("\n")
96
+ test "#to_table_display leaves out any attributes not loaded" do
97
+ assert_equal <<END.strip, @project.tasks.find(:all, :select => "id, project_id, completed_at").to_table_display.join("\n")
98
98
  +----+------------+---------------------------+
99
99
  | id | project_id | completed_at |
100
100
  +----+------------+---------------------------+
@@ -104,8 +104,8 @@ END
104
104
  END
105
105
  end
106
106
 
107
- test "#to_table also shows any attributes that are not columns on the underlying table" do
108
- assert_equal <<END.strip, @project.tasks.find(:all, :joins => :project, :select => "tasks.id, project_id, projects.description AS BigProjectDescription").to_table.join("\n")
107
+ test "#to_table_display also shows any attributes that are not columns on the underlying table" do
108
+ assert_equal <<END.strip, @project.tasks.find(:all, :joins => :project, :select => "tasks.id, project_id, projects.description AS BigProjectDescription").to_table_display.join("\n")
109
109
  +----+------------+-----------------------------------------------------------------------------------------------------+
110
110
  | id | project_id | BigProjectDescription |
111
111
  +----+------------+-----------------------------------------------------------------------------------------------------+
@@ -115,8 +115,8 @@ END
115
115
  END
116
116
  end
117
117
 
118
- test "#to_table excludes any columns named in :except" do
119
- assert_equal <<END.strip, @project.tasks.to_table(:except => ['created_at', :completed_at]).join("\n")
118
+ test "#to_table_display excludes any columns named in :except" do
119
+ assert_equal <<END.strip, @project.tasks.to_table_display(:except => ['created_at', :completed_at]).join("\n")
120
120
  +----+------------+------------------------+------------------+---------------------------+
121
121
  | id | project_id | description | due_on | updated_at |
122
122
  +----+------------+------------------------+------------------+---------------------------+
@@ -126,8 +126,8 @@ END
126
126
  END
127
127
  end
128
128
 
129
- test "#to_table excludes all columns except those named in :only" do
130
- assert_equal <<END.strip, @project.tasks.to_table(:only => ['id', :due_on]).join("\n")
129
+ test "#to_table_display excludes all columns except those named in :only" do
130
+ assert_equal <<END.strip, @project.tasks.to_table_display(:only => ['id', :due_on]).join("\n")
131
131
  +----+------------------+
132
132
  | id | due_on |
133
133
  +----+------------------+
@@ -137,8 +137,8 @@ END
137
137
  END
138
138
  end
139
139
 
140
- test "#to_table keeps the columns in the order given in :only" do
141
- assert_equal <<END.strip, @project.tasks.to_table(:only => [:due_on, 'id']).join("\n")
140
+ test "#to_table_display keeps the columns in the order given in :only" do
141
+ assert_equal <<END.strip, @project.tasks.to_table_display(:only => [:due_on, 'id']).join("\n")
142
142
  +------------------+----+
143
143
  | due_on | id |
144
144
  +------------------+----+
@@ -146,7 +146,7 @@ END
146
146
  | Sun, 05 Apr 2009 | 2 |
147
147
  +------------------+----+
148
148
  END
149
- assert_equal <<END.strip, @project.tasks.to_table(:only => [:due_on, :id]).join("\n")
149
+ assert_equal <<END.strip, @project.tasks.to_table_display(:only => [:due_on, :id]).join("\n")
150
150
  +------------------+----+
151
151
  | due_on | id |
152
152
  +------------------+----+
@@ -156,8 +156,8 @@ END
156
156
  END
157
157
  end
158
158
 
159
- test "#to_table accepts an unnamed list of arguments for column names" do
160
- assert_equal <<END.strip, @project.tasks.to_table('id', :due_on, :completed?).join("\n")
159
+ test "#to_table_display accepts an unnamed list of arguments for column names" do
160
+ assert_equal <<END.strip, @project.tasks.to_table_display('id', :due_on, :completed?).join("\n")
161
161
  +----+------------------+------------+
162
162
  | id | due_on | completed? |
163
163
  +----+------------------+------------+
@@ -167,8 +167,8 @@ END
167
167
  END
168
168
  end
169
169
 
170
- test "#to_table allows auxiliary named arguments with the array format" do
171
- assert_equal <<END.strip, @project.tasks.to_table('id', :due_on, :completed?, :inspect => false).join("\n")
170
+ test "#to_table_display allows auxiliary named arguments with the array format" do
171
+ assert_equal <<END.strip, @project.tasks.to_table_display('id', :due_on, :completed?, :inspect => false).join("\n")
172
172
  +----+------------+------------+
173
173
  | id | due_on | completed? |
174
174
  +----+------------+------------+
@@ -178,8 +178,8 @@ END
178
178
  END
179
179
  end
180
180
 
181
- test "#to_table also shows any :methods given as columns" do
182
- assert_equal <<END.strip, @project.tasks.to_table(:methods => [:completed?, 'project_name']).join("\n")
181
+ test "#to_table_display also shows any :methods given as columns" do
182
+ assert_equal <<END.strip, @project.tasks.to_table_display(:methods => [:completed?, 'project_name']).join("\n")
183
183
  +----+------------+------------------------+------------------+---------------------------+---------------------------+---------------------------+------------+------------------------+
184
184
  | id | project_id | description | due_on | completed_at | created_at | updated_at | completed? | project_name |
185
185
  +----+------------+------------------------+------------------+---------------------------+---------------------------+---------------------------+------------+------------------------+
@@ -189,8 +189,8 @@ END
189
189
  END
190
190
  end
191
191
 
192
- test "#to_table shows the #to_s format rather than the #inspect format when :inspect => false is set" do
193
- assert_equal <<END.strip, @project.tasks.to_table(:inspect => false).join("\n")
192
+ test "#to_table_display shows the #to_s format rather than the #inspect format when :inspect => false is set" do
193
+ assert_equal <<END.strip, @project.tasks.to_table_display(:inspect => false).join("\n")
194
194
  +----+------------+----------------------+------------+---------------------------+---------------------------+---------------------------+
195
195
  | id | project_id | description | due_on | completed_at | created_at | updated_at |
196
196
  +----+------------+----------------------+------------+---------------------------+---------------------------+---------------------------+
@@ -201,9 +201,9 @@ END
201
201
  # note the strings no longer have quotes, the nil is not shown, and the date format happens to be different
202
202
  end
203
203
 
204
- test "#to_table correctly pads out to match the length in characters of long values with utf-8 sequences" do
204
+ test "#to_table_display correctly pads out to match the length in characters of long values with utf-8 sequences" do
205
205
  tasks(:write_a_handy_plugin).update_attribute(:description, "Write a handy plugin \342\200\223 with UTF-8 handling")
206
- assert_equal <<END.strip, @project.tasks.to_table(:only => [:id, :description], :inspect => false).join("\n")
206
+ assert_equal <<END.strip, @project.tasks.to_table_display(:only => [:id, :description], :inspect => false).join("\n")
207
207
  +----+--------------------------------------------+
208
208
  | id | description |
209
209
  +----+--------------------------------------------+
@@ -213,9 +213,9 @@ END
213
213
  END
214
214
  end
215
215
 
216
- test "#to_table correctly pads out short values with utf-8 sequences" do
216
+ test "#to_table_display correctly pads out short values with utf-8 sequences" do
217
217
  tasks(:blog_the_plugin).update_attribute(:description, "Blog \342\200\223 plugin")
218
- assert_equal <<END.strip, @project.tasks.to_table(:only => [:id, :description], :inspect => false).join("\n")
218
+ assert_equal <<END.strip, @project.tasks.to_table_display(:only => [:id, :description], :inspect => false).join("\n")
219
219
  +----+----------------------+
220
220
  | id | description |
221
221
  +----+----------------------+
@@ -225,18 +225,18 @@ END
225
225
  END
226
226
  end
227
227
 
228
- test "#to_table on an empty array returns an empty result" do
229
- assert_equal [], [].to_table
228
+ test "#to_table_display on an empty array returns an empty result" do
229
+ assert_equal [], [].to_table_display
230
230
  end
231
231
 
232
- test "#to_table can extract data out of raw hashes" do
232
+ test "#to_table_display can extract data out of raw hashes" do
233
233
  @records = [{:foo => 1234, :bar => "test"},
234
234
  {:bar => "text", :baz => 5678}]
235
- results = @records.to_table.join("\n")
235
+ results = @records.to_table_display.join("\n")
236
236
  assert results.include?('| foo |')
237
237
  assert results.include?('| bar |')
238
238
  assert results.include?('| baz |')
239
- assert_equal <<END.strip, @records.to_table(:only => [:foo, :bar, :baz]).join("\n")
239
+ assert_equal <<END.strip, @records.to_table_display(:only => [:foo, :bar, :baz]).join("\n")
240
240
  +------+--------+------+
241
241
  | foo | bar | baz |
242
242
  +------+--------+------+
@@ -244,7 +244,7 @@ END
244
244
  | nil | "text" | 5678 |
245
245
  +------+--------+------+
246
246
  END
247
- assert_equal <<END.strip, @records.to_table(:only => [:bar, :baz]).join("\n")
247
+ assert_equal <<END.strip, @records.to_table_display(:only => [:bar, :baz]).join("\n")
248
248
  +--------+------+
249
249
  | bar | baz |
250
250
  +--------+------+
@@ -252,7 +252,7 @@ END
252
252
  | "text" | 5678 |
253
253
  +--------+------+
254
254
  END
255
- assert_equal <<END.strip, @records.to_table(:except => [:bar]).join("\n")
255
+ assert_equal <<END.strip, @records.to_table_display(:except => [:bar]).join("\n")
256
256
  +------+------+
257
257
  | foo | baz |
258
258
  +------+------+
@@ -262,14 +262,14 @@ END
262
262
  END
263
263
  end
264
264
 
265
- test "#to_table can extract data out of OpenStruct records" do
265
+ test "#to_table_display can extract data out of OpenStruct records" do
266
266
  @records = [OpenStruct.new(:foo => 1234, :bar => "test"),
267
267
  OpenStruct.new(:bar => "text", :baz => 5678)]
268
- results = @records.to_table.join("\n")
268
+ results = @records.to_table_display.join("\n")
269
269
  assert results.include?('| foo |')
270
270
  assert results.include?('| bar |')
271
271
  assert results.include?('| baz |')
272
- assert_equal <<END.strip, @records.to_table(:only => [:foo, :bar, :baz]).join("\n")
272
+ assert_equal <<END.strip, @records.to_table_display(:only => [:foo, :bar, :baz]).join("\n")
273
273
  +------+--------+------+
274
274
  | foo | bar | baz |
275
275
  +------+--------+------+
@@ -277,7 +277,7 @@ END
277
277
  | nil | "text" | 5678 |
278
278
  +------+--------+------+
279
279
  END
280
- assert_equal <<END.strip, @records.to_table(:only => [:bar, :baz]).join("\n")
280
+ assert_equal <<END.strip, @records.to_table_display(:only => [:bar, :baz]).join("\n")
281
281
  +--------+------+
282
282
  | bar | baz |
283
283
  +--------+------+
@@ -285,7 +285,7 @@ END
285
285
  | "text" | 5678 |
286
286
  +--------+------+
287
287
  END
288
- assert_equal <<END.strip, @records.to_table(:except => [:bar]).join("\n")
288
+ assert_equal <<END.strip, @records.to_table_display(:except => [:bar]).join("\n")
289
289
  +------+------+
290
290
  | foo | baz |
291
291
  +------+------+
metadata CHANGED
@@ -1,90 +1,93 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: table_display
3
- version: !ruby/object:Gem::Version
4
- hash: 23
5
- prerelease:
6
- segments:
7
- - 1
8
- - 0
9
- - 0
10
- version: 1.0.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Will Bryant
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2013-04-21 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
11
+ date: 2016-09-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
21
14
  name: rake
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
26
17
  - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 3
29
- segments:
30
- - 0
31
- version: "0"
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
32
20
  type: :development
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: sqlite3
36
21
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
38
- none: false
39
- requirements:
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
40
24
  - - ">="
41
- - !ruby/object:Gem::Version
42
- hash: 3
43
- segments:
44
- - 0
45
- version: "0"
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: sqlite3
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
46
34
  type: :development
47
- version_requirements: *id002
48
- - !ruby/object:Gem::Dependency
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
49
42
  name: activerecord
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
50
49
  prerelease: false
51
- requirement: &id003 !ruby/object:Gem::Requirement
52
- none: false
53
- requirements:
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
54
52
  - - ">="
55
- - !ruby/object:Gem::Version
56
- hash: 3
57
- segments:
58
- - 0
59
- version: "0"
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: test-unit
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
60
62
  type: :development
61
- version_requirements: *id003
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
62
69
  description: |
63
70
  Adds support for displaying your ActiveRecord tables, named scopes, collections, or
64
71
  plain arrays in a table view when working in rails console, shell, or email template.
65
-
66
- Enumerable#to_table returns the printable strings; Object#pt calls #to_table on its
72
+
73
+ Enumerable#to_table_display returns the printable strings; Object#pt calls #to_table_display on its
67
74
  first argument and puts out the result.
68
-
75
+
69
76
  Columns you haven't loaded (eg. from using :select) are omitted, and derived/calculated
70
77
  columns (eg. again, from using :select) are added.
71
-
72
- Both #to_table and Object#pt methods take :only, :except, and :methods which work like
78
+
79
+ Both #to_table_display and Object#pt methods take :only, :except, and :methods which work like
73
80
  the #to_xml method to change what attributes/methods are output.
74
-
81
+
75
82
  The normal output uses #inspect on the data values to make them printable, so you can
76
83
  see what type the values had. When that's inconvenient or you'd prefer direct display,
77
84
  you can pass the option :inspect => false to disable inspection.
78
-
79
85
  email: will.bryant@gmail.com
80
86
  executables: []
81
-
82
87
  extensions: []
83
-
84
88
  extra_rdoc_files: []
85
-
86
- files:
87
- - .gitignore
89
+ files:
90
+ - ".gitignore"
88
91
  - Gemfile
89
92
  - MIT-LICENSE
90
93
  - README
@@ -101,38 +104,30 @@ files:
101
104
  - test/test_helper.rb
102
105
  homepage: http://github.com/willbryant/table_display
103
106
  licenses: []
104
-
107
+ metadata: {}
105
108
  post_install_message:
106
109
  rdoc_options: []
107
-
108
- require_paths:
110
+ require_paths:
109
111
  - lib
110
- required_ruby_version: !ruby/object:Gem::Requirement
111
- none: false
112
- requirements:
112
+ required_ruby_version: !ruby/object:Gem::Requirement
113
+ requirements:
113
114
  - - ">="
114
- - !ruby/object:Gem::Version
115
- hash: 3
116
- segments:
117
- - 0
118
- version: "0"
119
- required_rubygems_version: !ruby/object:Gem::Requirement
120
- none: false
121
- requirements:
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ required_rubygems_version: !ruby/object:Gem::Requirement
118
+ requirements:
122
119
  - - ">="
123
- - !ruby/object:Gem::Version
124
- hash: 3
125
- segments:
126
- - 0
127
- version: "0"
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
128
122
  requirements: []
129
-
130
123
  rubyforge_project:
131
- rubygems_version: 1.8.15
124
+ rubygems_version: 2.5.1
132
125
  signing_key:
133
- specification_version: 3
134
- summary: Adds support for displaying your ActiveRecord tables, named scopes, collections, or plain arrays in a table view when working in script/console, shell, or email template.
135
- test_files:
126
+ specification_version: 4
127
+ summary: Adds support for displaying your ActiveRecord tables, named scopes, collections,
128
+ or plain arrays in a table view when working in script/console, shell, or email
129
+ template.
130
+ test_files:
136
131
  - test/database.yml
137
132
  - test/fixtures/projects.yml
138
133
  - test/fixtures/tasks.yml