command_line_reporter 3.3.3 → 3.3.4
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.
- checksums.yaml +4 -4
- data/lib/command_line_reporter/row.rb +1 -3
- data/lib/command_line_reporter/table.rb +2 -5
- data/lib/command_line_reporter/version.rb +1 -1
- data/spec/table_spec.rb +0 -9
- 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: d6a50a82965011fe248f827a38ebd74334b3010f
|
4
|
+
data.tar.gz: 01835a6b108b5064c59ab06f92f9177443f38a37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f6a66faac50b478a1c795d8f499ae19c577e5776e2129c71f3a84ab6b1b01786ed68083311dd672b46ea57fefd90bc3d4bce07578526dc96a0435082dea1b98
|
7
|
+
data.tar.gz: 352c1e3725cf969e02c54d3767366116f252cbcaca582bef677e484435c87c0a4d0ff2368a0b5648f36774a67e1bd5989a5398fd5ff886278df8e8152252563f
|
@@ -2,7 +2,7 @@ module CommandLineReporter
|
|
2
2
|
class Row
|
3
3
|
include OptionsValidator
|
4
4
|
|
5
|
-
VALID_OPTIONS = [:header, :color, :
|
5
|
+
VALID_OPTIONS = [:header, :color, :bold, :encoding]
|
6
6
|
attr_accessor :columns, :border, *VALID_OPTIONS
|
7
7
|
|
8
8
|
def initialize(options = {})
|
@@ -12,7 +12,6 @@ module CommandLineReporter
|
|
12
12
|
self.border = false
|
13
13
|
self.header = options[:header] || false
|
14
14
|
self.color = options[:color]
|
15
|
-
self.border_color = options[:border_color]
|
16
15
|
self.bold = options[:bold] || false
|
17
16
|
self.encoding = options[:encoding] || :unicode
|
18
17
|
end
|
@@ -32,7 +31,6 @@ module CommandLineReporter
|
|
32
31
|
def output
|
33
32
|
screen_count.times do |sr|
|
34
33
|
border_char = use_utf8? ? "\u2503" : '|'
|
35
|
-
border_char = border_char.send(self.border_color) if self.border_color
|
36
34
|
|
37
35
|
line = (self.border) ? "#{border_char} " : ''
|
38
36
|
|
@@ -2,14 +2,13 @@ module CommandLineReporter
|
|
2
2
|
class Table
|
3
3
|
include OptionsValidator
|
4
4
|
|
5
|
-
VALID_OPTIONS = [:border, :
|
5
|
+
VALID_OPTIONS = [:border, :width, :encoding]
|
6
6
|
attr_accessor :rows, *VALID_OPTIONS
|
7
7
|
|
8
8
|
def initialize(options = {})
|
9
9
|
self.validate_options(options, *VALID_OPTIONS)
|
10
10
|
|
11
11
|
self.border = options[:border] || false
|
12
|
-
self.border_color = options[:border_color] || false
|
13
12
|
self.width = options[:width] || false
|
14
13
|
self.encoding = options[:encoding] || CommandLineReporter::DEFAULTS[:encoding]
|
15
14
|
|
@@ -21,7 +20,6 @@ module CommandLineReporter
|
|
21
20
|
def add(row)
|
22
21
|
# Inheritance from the table
|
23
22
|
row.border = self.border
|
24
|
-
row.border_color = self.border_color
|
25
23
|
|
26
24
|
# Inherit properties from the appropriate row
|
27
25
|
inherit_column_attrs(row) if self.rows[0]
|
@@ -62,8 +60,7 @@ module CommandLineReporter
|
|
62
60
|
def separator(type = 'middle')
|
63
61
|
left, center, right, bar = use_utf8? ? utf8_separator(type) : ascii_separator
|
64
62
|
|
65
|
-
|
66
|
-
separator_str.send(self.border_color) if self.border_color
|
63
|
+
left + self.rows[0].columns.map {|c| bar * (c.width + 2)}.join(center) + right
|
67
64
|
end
|
68
65
|
|
69
66
|
def use_utf8?
|
data/spec/table_spec.rb
CHANGED
@@ -16,14 +16,6 @@ describe CommandLineReporter::Table do
|
|
16
16
|
expect(CommandLineReporter::Table.new(:border => true).border).to eq(true)
|
17
17
|
end
|
18
18
|
|
19
|
-
it 'defaults the border_color' do
|
20
|
-
expect(CommandLineReporter::Table.new.border_color).to be false
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'accepts the border_color' do
|
24
|
-
expect(CommandLineReporter::Table.new(:border_color => true).border_color).to eq(true)
|
25
|
-
end
|
26
|
-
|
27
19
|
it 'output encoding should be ascii' do
|
28
20
|
expect(CommandLineReporter::Table.new(:encoding => :ascii).encoding).to eq(:ascii)
|
29
21
|
end
|
@@ -120,7 +112,6 @@ describe CommandLineReporter::Table do
|
|
120
112
|
end
|
121
113
|
end
|
122
114
|
|
123
|
-
|
124
115
|
describe '#auto_adjust_widths' do
|
125
116
|
it 'sets the widths of each column in each row to the maximum required width for that column' do
|
126
117
|
table = CommandLineReporter::Table.new.tap do |t|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: command_line_reporter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.
|
4
|
+
version: 3.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wes
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-01-
|
12
|
+
date: 2015-01-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|