tabularize 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ 0.2.8
2
+ -----
3
+ - 1.8 compatibility
4
+
1
5
  0.2.7
2
6
  -----
3
7
  - Customizable border
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tabularize (0.2.7)
4
+ tabularize (0.2.8)
5
5
  unicode-display_width (~> 0.1.1)
6
6
 
7
7
  GEM
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'
@@ -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, u, a) > sw - el
122
+ if sw && Tabularize.cell_width(new_sep, true, true) > sw - el
123
123
  col_count = idx
124
124
  break
125
125
  else
@@ -1,3 +1,3 @@
1
1
  class Tabularize
2
- VERSION = "0.2.7"
2
+ VERSION = "0.2.8"
3
3
  end
@@ -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 <= w }
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 <= w }
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tabularize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: