texttable 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/texttable.rb +11 -6
- data/texttable.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: daf8fb1088ce9570617aea39c1cbbfa3b4b5819af7013e26c2e4680d1ec2ceb1
|
4
|
+
data.tar.gz: 343e38b5ff4ed2cb20076af22bcfaedb00fd70702dcc8654b4169736b87a4768
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfbd834c7999c0c666c39043f2529b31fa4077292aec331541744cb6fc22a841380914435b75c3462647896969d4b8eb6846e72ebdf6cb3878c761f0ac8005a1
|
7
|
+
data.tar.gz: 8b401aab5b7df8d12aa883a7c0932cf5e4713889d5a3f63aa59416cfb3e3c15eb9029257819e9e46aa62e7f23a547239cd2e21e52a35ab91990240c950bdd279
|
data/lib/texttable.rb
CHANGED
@@ -128,15 +128,20 @@ class TextTable
|
|
128
128
|
def show!(list=nil)
|
129
129
|
meth = list.is_a?(Array) ? list.method(:push) : method(:puts)
|
130
130
|
join = " | "
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
131
|
+
size = @cols.size
|
132
|
+
full = [@cols.keys] + rows
|
133
|
+
full.each_with_index do |vals, i| # only when asymmetric
|
134
|
+
miss = size - vals.size
|
135
|
+
full[i] += [nil] * miss if miss > 0
|
136
|
+
full[i] = vals[0...size] if miss < 0
|
137
|
+
end
|
138
|
+
lens = full.map {|r| r.map {|c| c.to_s.size}}.transpose.map(&:max)
|
139
|
+
pict = lens.map {|len| "%-#{len}.#{len}s" }.join(join)
|
135
140
|
pict = [join, pict, join].join.strip
|
136
|
-
line = (pict % ([""] *
|
141
|
+
line = (pict % ([""] * size)).tr("| ", "+-")
|
137
142
|
seen = -1
|
138
143
|
meth["", line]
|
139
|
-
|
144
|
+
full.each do |vals|
|
140
145
|
meth[pict % vals]
|
141
146
|
meth[line] if (seen += 1) == 0
|
142
147
|
end
|
data/texttable.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: texttable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Shreeve
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: This gem will auto-size based on column widths.
|
14
14
|
email: steve.shreeve@gmail.com
|