tabularize 0.2.7 → 0.2.8
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.
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +0 -1
- data/lib/tabularize.rb +1 -1
- data/lib/tabularize/version.rb +1 -1
- data/test/test_tabularize.rb +8 -3
- metadata +1 -1
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -64,7 +64,6 @@ 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
69
|
:screen_width => 75, :ellipsis => 'X'
|
data/lib/tabularize.rb
CHANGED
@@ -119,7 +119,7 @@ class Tabularize
|
|
119
119
|
rows[0].each_with_index do |ch, idx|
|
120
120
|
new_sep = separator + i3[idx == 0 ? 0 : 1] + h * Tabularize.cell_width(ch, u, a)
|
121
121
|
|
122
|
-
if sw && Tabularize.cell_width(new_sep,
|
122
|
+
if sw && Tabularize.cell_width(new_sep, true, true) > sw - el
|
123
123
|
col_count = idx
|
124
124
|
break
|
125
125
|
else
|
data/lib/tabularize/version.rb
CHANGED
data/test/test_tabularize.rb
CHANGED
@@ -261,16 +261,15 @@ I..This should change everything doh!I.............I............................
|
|
261
261
|
10.times do
|
262
262
|
t << ['12345'] * 20
|
263
263
|
end
|
264
|
-
assert t.to_s.lines.all? { |line| line.chomp.length
|
264
|
+
assert t.to_s.lines.all? { |line| (w-9..w).include? 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
|
267
|
+
assert t.to_s.lines.all? { |line| (w-9..w).include? line.chomp.length }
|
268
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
273
|
table = Tabularize.new :pad => '.', :pad_left => 2, :pad_right => 0,
|
275
274
|
:border_style => :unicode,
|
276
275
|
:align => [:left, :center, :right],
|
@@ -293,4 +292,10 @@ 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 :border_style => :unicode, :unicode => false, :screen_width => 200
|
298
|
+
table << %w[abcde] * 100
|
299
|
+
assert table.to_s.lines.first.display_width > 190
|
300
|
+
end
|
296
301
|
end
|