gauge-ruby 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/table.rb +12 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a827a1d745e1a0a7156b9f3ad37b08be91cce127
|
4
|
+
data.tar.gz: c5103ef16af489c0426ce789bd7a91836cd45fe0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 548a966e03e16389ee57f8708136da420d2fcaa2d39db5d13d89666fc45d186d79fd2690d02e9e1528a43c8e3bec2d423e8790a5ce1f641c524692d7815de21c
|
7
|
+
data.tar.gz: 5f22447adbcf0c92f98202c866c873d05e1676465058794d9a837db78baa317db2229368172bc5fbab112d0441c1bcca02c5222e0b52c822122ba0f6381a0643
|
data/lib/table.rb
CHANGED
@@ -55,6 +55,18 @@ module Gauge
|
|
55
55
|
column_values_as_array(index)
|
56
56
|
end
|
57
57
|
|
58
|
+
# Converts the table to the markdown equivalent string
|
59
|
+
def to_s
|
60
|
+
col_str = Array.new(@rows.length+2, '')
|
61
|
+
@columns.each{|c|
|
62
|
+
col_vals = column_values_as_array(c).unshift c
|
63
|
+
col_width = col_vals.map(&:length).max
|
64
|
+
col_vals.insert(1, '-' * col_width)
|
65
|
+
col_str = col_str.zip(col_vals.map{|x| '|' + x.ljust(col_width)}).map { |x| x[0] + x[1]}
|
66
|
+
}
|
67
|
+
col_str.join('|\n') + '|'
|
68
|
+
end
|
69
|
+
|
58
70
|
private
|
59
71
|
|
60
72
|
def column_values_as_array(col_name)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gauge-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gauge Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-protocol-buffers
|