tabularize 0.2.7 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b74dc849febd7f37efc2f8123dff4bdc6c484df88235e0d36f886ad879173703
4
+ data.tar.gz: 81e92767c11e10162510374afca7b09d6305b8cce1d6e67bd86b535138b4b4a1
5
+ SHA512:
6
+ metadata.gz: fd686051d7803dbae825bd1172fd1e8e67ba3bc19f0d162ce1b7cff550c981f58fb072aa24fe2595a62c409e72a0db272407385249cf8b0ac7ad56d0fff50fab
7
+ data.tar.gz: 58c62bb1919eade8506fad4e666edfdf7cb09e81b7870577edc3b0f790091f3db00b8779b2b04881603cf0a1e61b7c197e77155d7ec9a1a7e96f0cb1a5a49e77
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ 0.2.9
2
+ -----
3
+ - Bug fix: exception on empty column
4
+
5
+ 0.2.8
6
+ -----
7
+ - 1.8 compatibility
8
+
1
9
  0.2.7
2
10
  -----
3
11
  - Customizable border
data/Gemfile.lock CHANGED
@@ -1,21 +1,23 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tabularize (0.2.7)
5
- unicode-display_width (~> 0.1.1)
4
+ tabularize (0.3.0)
5
+ unicode-display_width (>= 2.0.0)
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
9
9
  specs:
10
- ansi (1.4.3)
11
- awesome_print (1.0.2)
12
- unicode-display_width (0.1.1)
10
+ minitest (5.14.4)
11
+ rake (13.0.6)
12
+ unicode-display_width (2.0.0)
13
13
 
14
14
  PLATFORMS
15
- java
16
- ruby
15
+ x86_64-darwin-20
17
16
 
18
17
  DEPENDENCIES
19
- ansi
20
- awesome_print
18
+ minitest
19
+ rake
21
20
  tabularize!
21
+
22
+ BUNDLED WITH
23
+ 2.2.25
data/README.md CHANGED
@@ -54,7 +54,7 @@ puts table
54
54
  * Alignment
55
55
  * `:align` Horizontal alignment. `:left`, `:center`, `:right`, or Array of the three options
56
56
  * `:valign` Vertical alignment. `:top`, `:middle`, `:bottom`, or Array of the three options
57
- * Ellipses: Cut off trailing cells if the total width exceeds the specified screen width
57
+ * Ellipsis: Cut off trailing cells if the total width exceeds the specified screen width
58
58
  * `:screen_width` The number of columns for the current terminal. Default: unlimited.
59
59
  * `:ellipsis` Ellipsis string when cells are cut off. Default: `>`
60
60
 
@@ -64,10 +64,9 @@ require 'ansi'
64
64
  table = Tabularize.new :pad => '.', :pad_left => 2, :pad_right => 0,
65
65
  :border_style => :unicode,
66
66
  :border_color => ANSI::Code.red,
67
- :hborder => '~', :vborder => 'I', :iborder => '#',
68
67
  :align => [:left, :center, :right],
69
68
  :valign => [:top, :bottom, :middle, :middle],
70
- :screen_width => 75, :ellipsis => 'X'
69
+ :screen_width => 75, :ellipsis => '~'
71
70
  table << %w[Name Dept Location Phone Description]
72
71
  table.separator!
73
72
  table << ['John Doe', 'Finance', 'Los Angeles CA 90089', '555-1555', 'Just a guy']
data/lib/tabularize.rb CHANGED
@@ -1,8 +1,12 @@
1
1
  # encoding: utf-8
2
+ # frozen_string_literal: true
2
3
 
3
- require "tabularize/version"
4
+ # rubocop:disable Style/HashSyntax
5
+
6
+ require 'tabularize/version'
4
7
  require 'stringio'
5
8
  require 'unicode/display_width'
9
+ require 'English'
6
10
 
7
11
  class Tabularize
8
12
  DEFAULT_OPTIONS = {
@@ -19,34 +23,34 @@ class Tabularize
19
23
  :ansi => true,
20
24
 
21
25
  :ellipsis => '>',
22
- :screen_width => nil,
23
- }
26
+ :screen_width => nil
27
+ }.freeze
24
28
 
25
29
  DEFAULT_OPTIONS_GENERATOR = {
26
30
  :pad_left => 1,
27
- :pad_right => 1,
28
- }
31
+ :pad_right => 1
32
+ }.freeze
29
33
 
30
34
  BORDER_STYLE = {
31
35
  :ascii => {
32
36
  :hborder => '-',
33
37
  :vborder => '|',
34
- :iborder => %w[+ + + + + + + + +],
38
+ :iborder => %w[+ + + + + + + + +]
35
39
  },
36
40
  :unicode => {
37
41
  :hborder => '─',
38
42
  :vborder => '│',
39
- :iborder => %w[┌ ┬ ┐ ├ ┼ ┤ └ ┴ ┘],
43
+ :iborder => %w[┌ ┬ ┐ ├ ┼ ┤ └ ┴ ┘]
40
44
  }
41
- }
45
+ }.freeze
42
46
 
43
47
  # @since 0.2.0
44
- def initialize options = {}
48
+ def initialize(options = {})
45
49
  @rows = []
46
50
  @seps = Hash.new { |h, k| h[k] = 0 }
47
- @options = DEFAULT_OPTIONS.
48
- merge(DEFAULT_OPTIONS_GENERATOR).
49
- merge(options)
51
+ @options = DEFAULT_OPTIONS
52
+ .merge(DEFAULT_OPTIONS_GENERATOR)
53
+ .merge(options)
50
54
  if @options[:border_style]
51
55
  @options = BORDER_STYLE[@options[:border_style]].merge(@options)
52
56
 
@@ -55,7 +59,7 @@ class Tabularize
55
59
  @options[:iborder] = [@options[:iborder]] * 9
56
60
  end
57
61
  end
58
- @cache = {}
62
+ @cache = {}
59
63
  end
60
64
 
61
65
  # @since 0.2.0
@@ -63,10 +67,10 @@ class Tabularize
63
67
  @seps[@rows.length] += 1
64
68
  nil
65
69
  end
66
-
70
+
67
71
  # @param [Array] row
68
72
  # @since 0.2.0
69
- def << row
73
+ def <<(row)
70
74
  @rows << row
71
75
  nil
72
76
  end
@@ -78,7 +82,9 @@ class Tabularize
78
82
 
79
83
  # Invalidate cache if needed
80
84
  num_cached_rows = @cache[:num_rows] || 0
81
- analysis = Tabularize.analyze(@rows[num_cached_rows..-1], @options.merge(@cache[:analysis] || {}))
85
+ analysis = Tabularize.analyze(
86
+ @rows[num_cached_rows..-1], @options.merge(@cache[:analysis] || {})
87
+ )
82
88
 
83
89
  unless @cache.empty?
84
90
  cmw = @cache[:analysis][:max_widths]
@@ -97,7 +103,7 @@ class Tabularize
97
103
  end
98
104
  end
99
105
  end
100
-
106
+
101
107
  rows = Tabularize.it(@rows[num_cached_rows..-1], @options.merge(analysis))
102
108
 
103
109
  h = @options[:hborder]
@@ -114,12 +120,14 @@ class Tabularize
114
120
 
115
121
  separators = @cache[:separators]
116
122
  col_count = @cache[:col_count]
117
- separators ||=
118
- Array.new(3) {''}.zip(i9.each_slice(3).to_a).map { |separator, i3|
123
+ separators ||=
124
+ Array.new(3) { '' }.zip(i9.each_slice(3).to_a).map do |separator, i3|
119
125
  rows[0].each_with_index do |ch, idx|
120
- new_sep = separator + i3[idx == 0 ? 0 : 1] + h * Tabularize.cell_width(ch, u, a)
126
+ new_sep = separator +
127
+ i3[idx.zero? ? 0 : 1] +
128
+ h * Tabularize.cell_width(ch, u, a)
121
129
 
122
- if sw && Tabularize.cell_width(new_sep, u, a) > sw - el
130
+ if sw && Tabularize.cell_width(new_sep, true, true) > sw - el
123
131
  col_count = idx
124
132
  break
125
133
  else
@@ -132,12 +140,12 @@ class Tabularize
132
140
  else
133
141
  separator
134
142
  end
135
- }
143
+ end
136
144
 
137
- output = @cache[:string_io] || StringIO.new.tap { |io|
145
+ output = @cache[:string_io] || StringIO.new.tap do |io|
138
146
  io.set_encoding 'UTF-8' if io.respond_to? :set_encoding
139
147
  io.puts separators.first
140
- }
148
+ end
141
149
  if col_count
142
150
  rows = rows.map { |line| line[0, col_count] }
143
151
  vl = e
@@ -169,24 +177,26 @@ class Tabularize
169
177
  :last_seps => @seps[rows.length]
170
178
  }
171
179
  output.string + separators.last
172
- rescue Exception
180
+ rescue StandardError
173
181
  @cache = {}
174
182
  raise
175
183
  end
176
184
 
177
185
  # Returns the display width of a String
178
186
  # @param [String] str Input String
179
- # @param [Boolean] unicode Set to true when the given String can include CJK wide characters
180
- # @param [Boolean] ansi Set to true When the given String can include ANSI codes
181
- # @return [Fixnum] Display width of the given String
187
+ # @param [Boolean] unicode Set to true when the given String can include CJK
188
+ # wide characters
189
+ # @param [Boolean] ansi Set to true When the given String can include ANSI
190
+ # codes
191
+ # @return [Integer] Display width of the given String
182
192
  # @since 0.2.0
183
- def self.cell_width str, unicode, ansi
193
+ def self.cell_width(str, unicode, ansi)
184
194
  str = str.gsub(/\e\[\d*(?:;\d+)*m/, '') if ansi
185
- str.send(unicode ? :display_width : :length)
195
+ unicode ? Unicode::DisplayWidth.of(str) : str.length
186
196
  end
187
197
 
188
198
  # Determines maximum widths of cells and maximum heights of rows
189
- def self.analyze data, options = {}
199
+ def self.analyze(data, options = {})
190
200
  unicode = options[:unicode]
191
201
  ansi = options[:ansi]
192
202
  max_widths = (options[:max_widths] || []).dup
@@ -198,11 +208,13 @@ class Tabularize
198
208
 
199
209
  row.each_with_index do |cell, idx|
200
210
  nlines = 0
201
- cell.lines do |c|
202
- max_widths[idx] = [ Tabularize.cell_width(c.chomp, unicode, ansi), max_widths[idx] || 0 ].max
211
+ (cell.empty? ? [''] : cell.lines).each do |c|
212
+ max_widths[idx] =
213
+ [Tabularize.cell_width(c.chomp, unicode, ansi),
214
+ max_widths[idx] || 0].max
203
215
  nlines += 1
204
216
  end
205
- max_heights[ridx] = [ nlines, max_heights[ridx] || 1 ].max
217
+ max_heights[ridx] = [nlines, max_heights[ridx] || 1].max
206
218
  end
207
219
  end
208
220
 
@@ -216,18 +228,18 @@ class Tabularize
216
228
  {
217
229
  :rows => rows,
218
230
  :max_widths => max_widths,
219
- :max_heights => max_heights,
231
+ :max_heights => max_heights
220
232
  }
221
233
  end
222
234
 
223
235
  # Formats two-dimensional tabular data.
224
- # One-dimensional data (e.g. Array of Strings) is treated as tabular data
236
+ # One-dimensional data (e.g. Array of Strings) is treated as tabular data
225
237
  # of which each row has only one column.
226
238
  # @param [Enumerable] table_data
227
239
  # @param [Hash] options Formatting options.
228
240
  # @return [Array] Two-dimensional Array of formatted cells.
229
- def self.it table_data, options = {}
230
- raise ArgumentError.new("Not enumerable") unless
241
+ def self.it(table_data, options = {})
242
+ raise ArgumentError, 'Not enumerable' unless
231
243
  table_data.respond_to?(:each)
232
244
 
233
245
  options = DEFAULT_OPTIONS.merge(options)
@@ -240,36 +252,34 @@ class Tabularize
240
252
  ansi = options[:ansi]
241
253
  screenw = options[:screen_width]
242
254
 
243
- unless pad.length == 1
244
- raise ArgumentError.new("Invalid padding")
245
- end
246
- unless padl.is_a?(Fixnum) && padl >= 0
247
- raise ArgumentError.new(":pad_left must be a non-negative integer")
255
+ raise ArgumentError, 'Invalid padding' unless pad.length == 1
256
+ unless padl.is_a?(Integer) && padl >= 0
257
+ raise ArgumentError, ':pad_left must be a non-negative integer'
248
258
  end
249
- unless padr.is_a?(Fixnum) && padr >= 0
250
- raise ArgumentError.new(":pad_right must be a non-negative integer")
259
+ unless padr.is_a?(Integer) && padr >= 0
260
+ raise ArgumentError, ':pad_right must be a non-negative integer'
251
261
  end
252
- unless align.all? { |a| [:left, :right, :center].include?(a) }
253
- raise ArgumentError.new("Invalid alignment")
262
+ unless align.all? { |a| %i[left right center].include?(a) }
263
+ raise ArgumentError, 'Invalid alignment'
254
264
  end
255
- unless valign.all? { |a| [:top, :bottom, :middle].include?(a) }
256
- raise ArgumentError.new("Invalid vertical alignment")
265
+ unless valign.all? { |a| %i[top bottom middle].include?(a) }
266
+ raise ArgumentError, 'Invalid vertical alignment'
257
267
  end
258
- unless screenw.nil? || (screenw.is_a?(Fixnum) && screenw > 0)
259
- raise ArgumentError.new(":screen_width must be a positive integer")
268
+ unless screenw.nil? || (screenw.is_a?(Integer) && screenw > 0)
269
+ raise ArgumentError, ':screen_width must be a positive integer'
260
270
  end
261
271
 
262
272
  # Analyze data
263
273
  ret = options[:analysis] || Tabularize.analyze(table_data, options)
264
274
  rows, max_widths, max_heights =
265
- [:rows, :max_widths, :max_heights].map { |k| ret[k] }
275
+ %i[rows max_widths max_heights].map { |k| ret[k] }
266
276
 
267
277
  ridx = -1
268
- rows.map { |row|
278
+ rows.map do |row|
269
279
  ridx += 1
270
280
  idx = -1
271
281
  max_height = max_heights[ridx]
272
- row.map { |cell|
282
+ row.map do |cell|
273
283
  idx += 1
274
284
  lines = cell.to_s.lines.to_a
275
285
  offset =
@@ -282,10 +292,10 @@ class Tabularize
282
292
  (max_height - lines.length) / 2
283
293
  end
284
294
 
285
- (0...max_height).map { |ln|
295
+ (0...max_height).map do |ln|
286
296
  ln -= offset
287
- str = (ln >= 0 && lines[ln]) ? lines[ln].chomp : (pad * max_widths[idx])
288
- alen =
297
+ str = ln >= 0 && lines[ln] ? lines[ln].chomp : (pad * max_widths[idx])
298
+ alen =
289
299
  if ansi
290
300
  Tabularize.cell_width(str, false, false) -
291
301
  Tabularize.cell_width(str, false, true)
@@ -295,8 +305,8 @@ class Tabularize
295
305
  slen = str.length - alen
296
306
 
297
307
  w = max_widths[idx]
298
- w += str.length - str.display_width if unicode
299
- pad * padl +
308
+ w += str.length - Unicode::DisplayWidth.of(str) if unicode
309
+ pad * padl +
300
310
  case align[idx] || align.last
301
311
  when :left
302
312
  str.ljust(w + alen, pad)
@@ -305,9 +315,9 @@ class Tabularize
305
315
  when :center
306
316
  str.rjust((w - slen) / 2 + slen + alen, pad).ljust(w + alen, pad)
307
317
  end +
308
- pad * padr
309
- }.join($/)
310
- }
311
- }
318
+ pad * padr
319
+ end.join($RS)
320
+ end
321
+ end
312
322
  end
313
323
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Tabularize
2
- VERSION = "0.2.7"
4
+ VERSION = '0.3.0'
3
5
  end
data/tabularize.gemspec CHANGED
@@ -1,25 +1,25 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "tabularize/version"
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.push File.expand_path('../lib', __FILE__)
4
+ require 'tabularize/version'
4
5
 
5
6
  Gem::Specification.new do |s|
6
- s.name = "tabularize"
7
+ s.name = 'tabularize'
7
8
  s.version = Tabularize::VERSION
8
- s.authors = ["Junegunn Choi"]
9
- s.email = ["junegunn.c@gmail.com"]
10
- s.homepage = ""
11
- s.summary = %q{Formatting tabular data}
12
- s.description = %q{Formatting tabular data with paddings and alignments}
9
+ s.authors = ['Junegunn Choi']
10
+ s.email = ['junegunn.c@gmail.com']
11
+ s.homepage = 'https://github.com/junegunn/tabularize'
12
+ s.summary = 'Formatting tabular data'
13
+ s.description = 'Formatting tabular data with paddings and alignments'
13
14
 
14
- s.rubyforge_project = "tabularize"
15
+ s.rubyforge_project = 'tabularize'
15
16
 
16
17
  s.files = `git ls-files`.split("\n")
17
18
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
- s.require_paths = ["lib"]
19
+ s.require_paths = ['lib']
20
20
 
21
21
  # specify any dependencies here; for example:
22
- s.add_development_dependency 'awesome_print'
23
- s.add_development_dependency 'ansi'
24
- s.add_runtime_dependency 'unicode-display_width', '~> 0.1.1'
22
+ s.add_development_dependency 'minitest'
23
+ s.add_development_dependency 'rake'
24
+ s.add_runtime_dependency 'unicode-display_width', '>= 2.0.0'
25
25
  end
@@ -1,102 +1,96 @@
1
1
  # encoding: utf-8
2
+ # frozen_string_literal: true
3
+
2
4
  require 'rubygems'
3
- require 'bundler'
4
- Bundler.setup(:default, :development)
5
- require 'test/unit'
6
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
5
+ require 'bundler/setup'
6
+ require 'minitest/autorun'
7
7
  require 'tabularize'
8
- require 'awesome_print'
9
8
  require 'csv'
10
- require 'ansi'
9
+ require 'English'
11
10
 
12
- class TestTabularize < Test::Unit::TestCase
13
- DATA0 = %w[a aa aaa aaaa aaaaa]
14
- DATA1 =
11
+ class TestTabularize < Minitest::Test
12
+ DATA0 = %w[a aa aaa aaaa aaaaa].freeze
13
+ DATA1 =
15
14
  [
16
15
  %w[a aa aaa aaaa],
17
16
  %w[bbbb bbb bb b]
18
- ]
19
- DATA2 =
17
+ ].freeze
18
+ DATA2 =
20
19
  [
21
20
  %w[a aa aaa aaaa],
22
21
  %w[cccccccccccccccccccc],
23
22
  %w[ddd dddd d],
24
23
  %w[bbbb bbb bb b]
25
- ]
24
+ ].freeze
26
25
  RESULT = {
27
26
  DATA0 => {
28
- :left => [
29
- "a ",
30
- "aa ",
31
- "aaa ",
32
- "aaaa ",
33
- "aaaaa",
34
- ],
35
- :right => [
36
- " a",
37
- " aa",
38
- " aaa",
39
- " aaaa",
40
- "aaaaa",
27
+ left: [
28
+ 'a ',
29
+ 'aa ',
30
+ 'aaa ',
31
+ 'aaaa ',
32
+ 'aaaaa'
41
33
  ],
42
- :center => [
43
- " a ",
44
- " aa ",
45
- " aaa ",
46
- "aaaa ",
47
- "aaaaa",
34
+ right: [
35
+ ' a',
36
+ ' aa',
37
+ ' aaa',
38
+ ' aaaa',
39
+ 'aaaaa'
48
40
  ],
41
+ center: [
42
+ ' a ',
43
+ ' aa ',
44
+ ' aaa ',
45
+ 'aaaa ',
46
+ 'aaaaa'
47
+ ]
49
48
  },
50
49
  DATA1 => {
51
- :left =>
52
- [
53
- "a |aa |aaa|aaaa",
54
- "bbbb|bbb|bb |b "
55
- ],
56
- :right =>
57
- [
58
- " a| aa|aaa|aaaa",
59
- "bbbb|bbb| bb| b"
60
- ],
61
- :center =>
62
- [
63
- " a |aa |aaa|aaaa",
64
- "bbbb|bbb|bb | b "
65
- ]
50
+ left: [
51
+ 'a |aa |aaa|aaaa',
52
+ 'bbbb|bbb|bb |b '
53
+ ],
54
+ right: [
55
+ ' a| aa|aaa|aaaa',
56
+ 'bbbb|bbb| bb| b'
57
+ ],
58
+ center: [
59
+ ' a |aa |aaa|aaaa',
60
+ 'bbbb|bbb|bb | b '
61
+ ]
66
62
  },
67
63
  DATA2 => {
68
- :left =>
69
- [
70
- "a |aa |aaa|aaaa",
71
- "cccccccccccccccccccc| | | ",
72
- "ddd |dddd|d | ",
73
- "bbbb |bbb |bb |b "
74
- ],
75
- :right =>
76
- [
77
- " a| aa|aaa|aaaa",
78
- "cccccccccccccccccccc| | | ",
79
- " ddd|dddd| d| ",
80
- " bbbb| bbb| bb| b"
81
- ],
82
- :center =>
83
- [
84
- " a | aa |aaa|aaaa",
85
- "cccccccccccccccccccc| | | ",
86
- " ddd |dddd| d | ",
87
- " bbbb |bbb |bb | b "
88
- ]
64
+ left: [
65
+ 'a |aa |aaa|aaaa',
66
+ 'cccccccccccccccccccc| | | ',
67
+ 'ddd |dddd|d | ',
68
+ 'bbbb |bbb |bb |b '
69
+ ],
70
+ right: [
71
+ ' a| aa|aaa|aaaa',
72
+ 'cccccccccccccccccccc| | | ',
73
+ ' ddd|dddd| d| ',
74
+ ' bbbb| bbb| bb| b'
75
+ ],
76
+ center: [
77
+ ' a | aa |aaa|aaaa',
78
+ 'cccccccccccccccccccc| | | ',
79
+ ' ddd |dddd| d | ',
80
+ ' bbbb |bbb |bb | b '
81
+ ]
89
82
  }
90
- }
83
+ }.freeze
91
84
 
92
85
  def test_tabularize
93
- data_lines = DATA0.join($/).lines
94
- RESULT[data_lines] = RESULT[DATA0]
86
+ data_lines = DATA0.join($RS).lines
87
+ output = RESULT.dup
88
+ output[data_lines] = output[DATA0]
95
89
  [DATA0, data_lines, DATA1, DATA2].each do |data|
96
- [ '.', '_' ].each do |pad|
97
- [:left, :right, :center].each do |align|
98
- result = Tabularize.it(data, :pad => pad, :align => align)
99
- assert_equal RESULT[data][align], result.map { |row| row.join('|').gsub(pad, ' ') }
90
+ ['.', '_'].each do |pad|
91
+ %i[left right center].each do |align|
92
+ result = Tabularize.it(data, pad: pad, align: align)
93
+ assert_equal output[data][align], result.map { |row| row.join('|').gsub(pad, ' ') }
100
94
  end
101
95
  end
102
96
  end
@@ -109,7 +103,7 @@ class TestTabularize < Test::Unit::TestCase
109
103
  data << %w[aaa bb cc]
110
104
  data << %w[aaa bb cc] + ["dddd\neee"]
111
105
  data << %w[f]
112
- ret = Tabularize.analyze(data, :unicode => true, :ansi => true)
106
+ ret = Tabularize.analyze(data, unicode: true, ansi: true)
113
107
  assert_equal [%w[a bb ccc].push(''), %w[aa bb cc].push(''), %w[aaa bb cc].push(''),
114
108
  %w[aaa bb cc] + ["dddd\neee"], %w[f] + [''] * 3], ret[:rows]
115
109
  assert_equal [1, 1, 1, 2, 1], ret[:max_heights]
@@ -118,7 +112,7 @@ class TestTabularize < Test::Unit::TestCase
118
112
 
119
113
  # TODO: Need assertion
120
114
  def test_tabularize_csv
121
- return if RUBY_VERSION =~ /^1\.8\./
115
+ return if RUBY_VERSION.match?(/^1\.8\./)
122
116
 
123
117
  sio = StringIO.new
124
118
 
@@ -128,37 +122,37 @@ class TestTabularize < Test::Unit::TestCase
128
122
  'fixture/test_unicode_ansi.csv' => [true, true]
129
123
  }.each do |file, unicode_ansi|
130
124
  unicode, ansi = unicode_ansi
131
- opts = { :unicode => unicode, :ansi => ansi }
132
- data = CSV.read(File.join(File.dirname(__FILE__), file), :col_sep => '|')
125
+ opts = { unicode: unicode, ansi: ansi }
126
+ data = CSV.read(File.join(File.dirname(__FILE__), file), col_sep: '|')
133
127
  output = Tabularize.it(data, opts).map { |row| row.join '|' }
134
128
 
135
129
  sio.puts output
136
- sio.puts Tabularize.it(data, opts.merge(:align => :right)).map { |row| row.join '|' }
137
- sio.puts Tabularize.it(data, opts.merge(:align => :center)).map { |row| row.join '|' }
138
- sio.puts Tabularize.it(data, opts.merge(:pad => '_')).map { |row| row.join '|' }
130
+ sio.puts Tabularize.it(data, opts.merge(align: :right)).map { |row| row.join '|' }
131
+ sio.puts Tabularize.it(data, opts.merge(align: :center)).map { |row| row.join '|' }
132
+ sio.puts Tabularize.it(data, opts.merge(pad: '_')).map { |row| row.join '|' }
139
133
  end
140
134
 
141
135
  assert_equal File.read(File.join(File.dirname(__FILE__), 'fixture/tabularize_csv.txt')), sio.string
142
136
  end
143
137
 
144
138
  def test_invalid_arguments
145
- assert_raise(ArgumentError) { Tabularize.it(5) }
146
- assert_raise(ArgumentError) { Tabularize.it("hello") } unless RUBY_VERSION =~ /^1\.8\./
147
- assert_raise(ArgumentError) { Tabularize.it([1, 2, 3], :align => :noidea) }
148
- assert_raise(ArgumentError) { Tabularize.it([1, 2, 3], :valign => :noidea) }
149
- assert_raise(ArgumentError) { Tabularize.it([1, 2, 3], :align => [:center, :top]) }
150
- assert_raise(ArgumentError) { Tabularize.it([1, 2, 3], :valign => [:left, :right]) }
151
- assert_raise(ArgumentError) { Tabularize.it([1, 2, 3], :pad => 'long') }
152
- assert_raise(ArgumentError) { Tabularize.it([1, 2, 3], :pad => ' ', :pad_left => -1) }
153
- assert_raise(ArgumentError) { Tabularize.it([1, 2, 3], :pad => ' ', :pad_left => '') }
154
- assert_raise(ArgumentError) { Tabularize.it([1, 2, 3], :pad => ' ', :pad_right => -1) }
155
- assert_raise(ArgumentError) { Tabularize.it([1, 2, 3], :pad => ' ', :pad_right => '') }
156
- assert_raise(ArgumentError) { Tabularize.it([1, 2, 3], :screen_width => -2) }
139
+ assert_raises(ArgumentError) { Tabularize.it(5) }
140
+ assert_raises(ArgumentError) { Tabularize.it('hello') } unless RUBY_VERSION.match?(/^1\.8\./)
141
+ assert_raises(ArgumentError) { Tabularize.it([1, 2, 3], align: :noidea) }
142
+ assert_raises(ArgumentError) { Tabularize.it([1, 2, 3], valign: :noidea) }
143
+ assert_raises(ArgumentError) { Tabularize.it([1, 2, 3], align: %i[center top]) }
144
+ assert_raises(ArgumentError) { Tabularize.it([1, 2, 3], valign: %i[left right]) }
145
+ assert_raises(ArgumentError) { Tabularize.it([1, 2, 3], pad: 'long') }
146
+ assert_raises(ArgumentError) { Tabularize.it([1, 2, 3], pad: ' ', pad_left: -1) }
147
+ assert_raises(ArgumentError) { Tabularize.it([1, 2, 3], pad: ' ', pad_left: '') }
148
+ assert_raises(ArgumentError) { Tabularize.it([1, 2, 3], pad: ' ', pad_right: -1) }
149
+ assert_raises(ArgumentError) { Tabularize.it([1, 2, 3], pad: ' ', pad_right: '') }
150
+ assert_raises(ArgumentError) { Tabularize.it([1, 2, 3], screen_width: -2) }
157
151
  end
158
152
 
159
153
  def test_table
160
- table = Tabularize.new :align => :center, :pad => ',',
161
- :pad_left => 3, :pad_right => 5, :hborder => '=', :vborder => 'I', :iborder => '#'
154
+ table = Tabularize.new align: :center, pad: ',',
155
+ pad_left: 3, pad_right: 5, hborder: '=', vborder: 'I', iborder: '#'
162
156
  table << DATA2[0]
163
157
  table.separator!
164
158
  table << DATA2[0]
@@ -169,43 +163,47 @@ class TestTabularize < Test::Unit::TestCase
169
163
  table << DATA2[2]
170
164
  table << DATA2[3]
171
165
 
172
- assert_equal(
173
- '#============================#============#===========#============#
174
- I,,,,,,,,,,,,a,,,,,,,,,,,,,,,I,,,,aa,,,,,,I,,,aaa,,,,,I,,,aaaa,,,,,I
175
- #============================#============#===========#============#
176
- I,,,,,,,,,,,,a,,,,,,,,,,,,,,,I,,,,aa,,,,,,I,,,aaa,,,,,I,,,aaaa,,,,,I
177
- #============================#============#===========#============#
178
- #============================#============#===========#============#
179
- I,,,cccccccccccccccccccc,,,,,I,,,,,,,,,,,,I,,,,,,,,,,,I,,,,,,,,,,,,I
180
- #============================#============#===========#============#
181
- I,,,,,,,,,,,ddd,,,,,,,,,,,,,,I,,,dddd,,,,,I,,,,d,,,,,,I,,,,,,,,,,,,I
182
- I,,,,,,,,,,,bbbb,,,,,,,,,,,,,I,,,bbb,,,,,,I,,,bb,,,,,,I,,,,b,,,,,,,I
183
- #============================#============#===========#============#', table.to_s)
166
+ expected = <<~EOF
167
+ #============================#============#===========#============#
168
+ I,,,,,,,,,,,,a,,,,,,,,,,,,,,,I,,,,aa,,,,,,I,,,aaa,,,,,I,,,aaaa,,,,,I
169
+ #============================#============#===========#============#
170
+ I,,,,,,,,,,,,a,,,,,,,,,,,,,,,I,,,,aa,,,,,,I,,,aaa,,,,,I,,,aaaa,,,,,I
171
+ #============================#============#===========#============#
172
+ #============================#============#===========#============#
173
+ I,,,cccccccccccccccccccc,,,,,I,,,,,,,,,,,,I,,,,,,,,,,,I,,,,,,,,,,,,I
174
+ #============================#============#===========#============#
175
+ I,,,,,,,,,,,ddd,,,,,,,,,,,,,,I,,,dddd,,,,,I,,,,d,,,,,,I,,,,,,,,,,,,I
176
+ I,,,,,,,,,,,bbbb,,,,,,,,,,,,,I,,,bbb,,,,,,I,,,bb,,,,,,I,,,,b,,,,,,,I
177
+ #============================#============#===========#============#
178
+ EOF
179
+ assert_equal expected.chomp, table.to_s
184
180
  end
185
181
 
186
182
  def test_table_complex
187
- separator = '#~~~~~~~~~~~~~#~~~~~~~~~~~~~#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~#'
188
- output = "
189
- #~~~~~~~~~~~~~#~~~~~~~~~~~~~#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~#
190
- I..Name.......I.....Dept....I.....................LocationI.....PhoneI
191
- #~~~~~~~~~~~~~#~~~~~~~~~~~~~#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~#
192
- I..John Doe...I....Finance..I.........Los Angeles CA 90089I..555-1555I
193
- I..Average JoeI..EngineeringI...Somewhere over the rainbowI.......N/AI
194
- I..1..........I.............I.............................I..........I
195
- #~~~~~~~~~~~~~#~~~~~~~~~~~~~#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~#
196
- #~~~~~~~~~~~~~#~~~~~~~~~~~~~#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~#
197
- I..홍길동.....I.............I..서울역 3번 출구 김씨 옆자리I..........I
198
- I.............I.............I.............................I.......N/AI
199
- I.............I...탁상 3부..I.....................맞습니다I..........I
200
- #~~~~~~~~~~~~~#~~~~~~~~~~~~~#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~#
201
- #~~~~~~~~~~~~~#~~~~~~~~~~~~~#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~#
202
- #~~~~~~~~~~~~~#~~~~~~~~~~~~~#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~#
203
- ".strip
183
+ separator =
184
+ '#~~~~~~~~~~~~~#~~~~~~~~~~~~~#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~#'
185
+ output = <<~EOF
186
+ #~~~~~~~~~~~~~#~~~~~~~~~~~~~#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~#
187
+ I..Name.......I.....Dept....I.....................LocationI.....PhoneI
188
+ #~~~~~~~~~~~~~#~~~~~~~~~~~~~#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~#
189
+ I..John Doe...I....Finance..I.........Los Angeles CA 90089I..555-1555I
190
+ I..Average JoeI..EngineeringI...Somewhere over the rainbowI.......N/AI
191
+ I..1..........I.............I.............................I..........I
192
+ #~~~~~~~~~~~~~#~~~~~~~~~~~~~#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~#
193
+ #~~~~~~~~~~~~~#~~~~~~~~~~~~~#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~#
194
+ I..홍길동.....I.............I..서울역 3번 출구 김씨 옆자리I..........I
195
+ I.............I.............I.............................I.......N/AI
196
+ I.............I...탁상 3부..I.....................맞습니다I..........I
197
+ #~~~~~~~~~~~~~#~~~~~~~~~~~~~#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~#
198
+ #~~~~~~~~~~~~~#~~~~~~~~~~~~~#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~#
199
+ #~~~~~~~~~~~~~#~~~~~~~~~~~~~#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~#
200
+ EOF
201
+ output = output.strip
204
202
 
205
- table = Tabularize.new :pad => '.', :pad_left => 2, :pad_right => 0,
206
- :hborder => '~', :vborder => 'I', :iborder => '#',
207
- :align => [:left, :center, :right],
208
- :valign => [:top, :bottom, :middle, :middle]
203
+ table = Tabularize.new pad: '.', pad_left: 2, pad_right: 0,
204
+ hborder: '~', vborder: 'I', iborder: '#',
205
+ align: %i[left center right],
206
+ valign: %i[top bottom middle middle]
209
207
  table << %w[Name Dept Location Phone]
210
208
  table.separator!
211
209
  table << ['John Doe', 'Finance', 'Los Angeles CA 90089', '555-1555']
@@ -222,27 +220,29 @@ I.............I...탁상 3부..I.....................맞습니다I..........I
222
220
  end
223
221
  table.separator!
224
222
  table.separator!
225
- assert_equal [output, separator, separator].join($/), table.to_s.strip
226
- assert_equal [output, separator, separator].join($/), table.to_s.strip
227
- table << "This should change everything doh!"
228
- output = "
229
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~~~~#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~#
230
- I..Name..............................I.....Dept....I.....................LocationI.....PhoneI
231
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~~~~#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~#
232
- I..John Doe..........................I....Finance..I.........Los Angeles CA 90089I..555-1555I
233
- I..Average Joe.......................I..EngineeringI...Somewhere over the rainbowI.......N/AI
234
- I..1.................................I.............I.............................I..........I
235
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~~~~#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~#
236
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~~~~#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~#
237
- I..홍길동............................I.............I..서울역 3번 출구 김씨 옆자리I..........I
238
- I....................................I.............I.............................I.......N/AI
239
- I....................................I...탁상 3부..I.....................맞습니다I..........I
240
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~~~~#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~#
241
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~~~~#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~#
242
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~~~~#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~#
243
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~~~~#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~#
244
- I..This should change everything doh!I.............I.............................I..........I
245
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~~~~#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~#".strip
223
+ assert_equal [output, separator, separator].join($RS), table.to_s.strip
224
+ assert_equal [output, separator, separator].join($RS), table.to_s.strip
225
+ table << 'This should change everything doh!'
226
+ output = <<~EOF
227
+ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~~~~#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~#
228
+ I..Name..............................I.....Dept....I.....................LocationI.....PhoneI
229
+ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~~~~#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~#
230
+ I..John Doe..........................I....Finance..I.........Los Angeles CA 90089I..555-1555I
231
+ I..Average Joe.......................I..EngineeringI...Somewhere over the rainbowI.......N/AI
232
+ I..1.................................I.............I.............................I..........I
233
+ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~~~~#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~#
234
+ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~~~~#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~#
235
+ I..홍길동............................I.............I..서울역 3번 출구 김씨 옆자리I..........I
236
+ I....................................I.............I.............................I.......N/AI
237
+ I....................................I...탁상 3부..I.....................맞습니다I..........I
238
+ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~~~~#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~#
239
+ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~~~~#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~#
240
+ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~~~~#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~#
241
+ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~~~~#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~#
242
+ I..This should change everything doh!I.............I.............................I..........I
243
+ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~~~~#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~~~~~~~~~#
244
+ EOF
245
+ output = output.strip
246
246
  assert_equal output, table.to_s.strip
247
247
  assert_equal output, table.to_s.strip
248
248
 
@@ -250,32 +250,31 @@ I..This should change everything doh!I.............I............................
250
250
  line = 'I..a.................................I.......b.....I............................cI.........dI'
251
251
  10.times do |i|
252
252
  table << %w[a b c d]
253
- expected = (output.lines.to_a[0..-2].map(&:chomp) + [line] * (i+1) + [separator]).join($/)
253
+ expected = (output.lines.to_a[0..-2].map(&:chomp) + [line] * (i + 1) + [separator]).join($RS)
254
254
  assert_equal expected, table.to_s
255
255
  end
256
256
  end
257
257
 
258
258
  def test_screen_width
259
259
  [1, 3, 9, 50, 80].each do |w|
260
- t = Tabularize.new :screen_width => w
260
+ t = Tabularize.new screen_width: w
261
261
  10.times do
262
262
  t << ['12345'] * 20
263
263
  end
264
- assert t.to_s.lines.all? { |line| line.chomp.length <= w }
264
+ assert(t.to_s.lines.all? { |line| (w - 9..w).cover? line.chomp.length })
265
265
  t << %w[12345]
266
266
  puts t.to_s
267
- assert t.to_s.lines.all? { |line| line.chomp.length <= w }
268
- assert t.to_s.lines.all? { |line| line.chomp.reverse[0, 1] == '>' }
267
+ assert(t.to_s.lines.all? { |line| (w - 9..w).cover? line.chomp.length })
268
+ assert(t.to_s.lines.all? { |line| line.chomp.reverse[0, 1] == '>' })
269
269
  end
270
270
  end
271
271
 
272
272
  def test_readme
273
- table = Tabularize.new
274
- table = Tabularize.new :pad => '.', :pad_left => 2, :pad_right => 0,
275
- :border_style => :unicode,
276
- :align => [:left, :center, :right],
277
- :valign => [:top, :bottom, :middle, :middle],
278
- :screen_width => 75, :ellipsis => '~'
273
+ table = Tabularize.new pad: '.', pad_left: 2, pad_right: 0,
274
+ border_style: :unicode,
275
+ align: %i[left center right],
276
+ valign: %i[top bottom middle middle],
277
+ screen_width: 75, ellipsis: '~'
279
278
  table << %w[Name Dept Location Phone Description]
280
279
  table.separator!
281
280
  table << ['John Doe', 'Finance', 'Los Angeles CA 90089', '555-1555', 'Just a guy']
@@ -293,4 +292,29 @@ I..This should change everything doh!I.............I............................
293
292
  └─────────────┴─────────────┴─────────────────────────────┴──────────~
294
293
  ".strip, table.to_s
295
294
  end
295
+
296
+ def test_unicode_border_with_screen_width
297
+ table = Tabularize.new(
298
+ border_style: :unicode, unicode: false, screen_width: 200
299
+ )
300
+ table << %w[abcde] * 100
301
+ assert Unicode::DisplayWidth.of(table.to_s.lines.first) > 190
302
+ end
303
+
304
+ def test_it_nil_column
305
+ assert_equal [['1 ', '', '2 '], ['11', '', '22']],
306
+ Tabularize.it([[1, nil, 2], [11, nil, 22]])
307
+ end
308
+
309
+ def test_analyze_nil_column
310
+ assert_equal [2, 0, 2],
311
+ Tabularize.analyze([[1, nil, 2], [11, nil, 22]])[:max_widths]
312
+ end
313
+
314
+ def test_tabualarize_nil_column
315
+ table = Tabularize.new
316
+ table << [1, nil, 2]
317
+ table << [11, nil, 22]
318
+ table.to_s
319
+ end
296
320
  end
metadata CHANGED
@@ -1,64 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tabularize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
5
- prerelease:
4
+ version: 0.3.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Junegunn Choi
9
- autorequire:
8
+ autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-08-01 00:00:00.000000000 Z
11
+ date: 2021-08-17 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- name: awesome_print
14
+ name: minitest
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
- name: ansi
28
+ name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: unicode-display_width
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ~>
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
- version: 0.1.1
47
+ version: 2.0.0
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ~>
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
- version: 0.1.1
54
+ version: 2.0.0
62
55
  description: Formatting tabular data with paddings and alignments
63
56
  email:
64
57
  - junegunn.c@gmail.com
@@ -66,7 +59,7 @@ executables: []
66
59
  extensions: []
67
60
  extra_rdoc_files: []
68
61
  files:
69
- - .gitignore
62
+ - ".gitignore"
70
63
  - CHANGELOG.md
71
64
  - Gemfile
72
65
  - Gemfile.lock
@@ -82,29 +75,27 @@ files:
82
75
  - test/fixture/test_unicode_ansi.csv
83
76
  - test/readme.rb
84
77
  - test/test_tabularize.rb
85
- homepage: ''
78
+ homepage: https://github.com/junegunn/tabularize
86
79
  licenses: []
87
- post_install_message:
80
+ metadata: {}
81
+ post_install_message:
88
82
  rdoc_options: []
89
83
  require_paths:
90
84
  - lib
91
85
  required_ruby_version: !ruby/object:Gem::Requirement
92
- none: false
93
86
  requirements:
94
- - - ! '>='
87
+ - - ">="
95
88
  - !ruby/object:Gem::Version
96
89
  version: '0'
97
90
  required_rubygems_version: !ruby/object:Gem::Requirement
98
- none: false
99
91
  requirements:
100
- - - ! '>='
92
+ - - ">="
101
93
  - !ruby/object:Gem::Version
102
94
  version: '0'
103
95
  requirements: []
104
- rubyforge_project: tabularize
105
- rubygems_version: 1.8.24
106
- signing_key:
107
- specification_version: 3
96
+ rubygems_version: 3.2.15
97
+ signing_key:
98
+ specification_version: 4
108
99
  summary: Formatting tabular data
109
100
  test_files:
110
101
  - test/fixture/tabularize_csv.txt