tabulo 2.4.0 → 2.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -4
- data/CHANGELOG.md +28 -0
- data/README.md +332 -122
- data/VERSION +1 -1
- data/assets/social_media_preview/table.png +0 -0
- data/lib/tabulo/border.rb +66 -102
- data/lib/tabulo/cell.rb +28 -17
- data/lib/tabulo/cell_data.rb +2 -1
- data/lib/tabulo/column.rb +28 -5
- data/lib/tabulo/table.rb +204 -86
- data/lib/tabulo/util.rb +22 -0
- data/lib/tabulo/version.rb +1 -1
- data/tabulo.gemspec +2 -2
- metadata +8 -8
data/lib/tabulo/util.rb
CHANGED
@@ -3,11 +3,23 @@ module Tabulo
|
|
3
3
|
# @!visibility private
|
4
4
|
module Util
|
5
5
|
|
6
|
+
NEWLINE = /\r\n|\n|\r/
|
7
|
+
|
8
|
+
# @!visibility private
|
9
|
+
def self.condense_lines(lines)
|
10
|
+
join_lines(lines.reject(&:empty?))
|
11
|
+
end
|
12
|
+
|
6
13
|
# @!visibility private
|
7
14
|
def self.divides?(smaller, larger)
|
8
15
|
larger % smaller == 0
|
9
16
|
end
|
10
17
|
|
18
|
+
# @!visibility private
|
19
|
+
def self.join_lines(lines)
|
20
|
+
lines.join($/)
|
21
|
+
end
|
22
|
+
|
11
23
|
# @!visibility private
|
12
24
|
def self.max(x, y)
|
13
25
|
x > y ? x : y
|
@@ -20,6 +32,16 @@ module Tabulo
|
|
20
32
|
new_hash
|
21
33
|
end
|
22
34
|
|
35
|
+
# @!visibility private
|
36
|
+
# @return [Integer] the length of the longest segment of str when split by newlines
|
37
|
+
def self.wrapped_width(str)
|
38
|
+
return 0 if str.empty?
|
39
|
+
segments = str.split(NEWLINE)
|
40
|
+
segments.inject(1) do |longest_length_so_far, segment|
|
41
|
+
Util.max(longest_length_so_far, Unicode::DisplayWidth.of(segment))
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
23
45
|
end
|
24
46
|
end
|
25
47
|
|
data/lib/tabulo/version.rb
CHANGED
data/tabulo.gemspec
CHANGED
@@ -28,12 +28,12 @@ Gem::Specification.new do |spec|
|
|
28
28
|
"changelog_uri" => "https://raw.githubusercontent.com/matt-harvey/tabulo/master/CHANGELOG.md"
|
29
29
|
}
|
30
30
|
|
31
|
-
spec.add_runtime_dependency "tty-screen", "0.
|
31
|
+
spec.add_runtime_dependency "tty-screen", "0.8.1"
|
32
32
|
spec.add_runtime_dependency "unicode-display_width", "1.7.0"
|
33
33
|
|
34
34
|
spec.add_development_dependency "bundler"
|
35
35
|
spec.add_development_dependency "rake", "~> 12.3.3"
|
36
|
-
spec.add_development_dependency "rspec", "~> 3.
|
36
|
+
spec.add_development_dependency "rspec", "~> 3.9"
|
37
37
|
spec.add_development_dependency "simplecov"
|
38
38
|
spec.add_development_dependency "coveralls"
|
39
39
|
spec.add_development_dependency "yard"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tabulo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Harvey
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tty-screen
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.8.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.8.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: unicode-display_width
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '3.
|
75
|
+
version: '3.9'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '3.
|
82
|
+
version: '3.9'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: simplecov
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -184,6 +184,7 @@ files:
|
|
184
184
|
- Rakefile
|
185
185
|
- VERSION
|
186
186
|
- _config.yml
|
187
|
+
- assets/social_media_preview/table.png
|
187
188
|
- bin/console
|
188
189
|
- bin/setup
|
189
190
|
- lib/tabulo.rb
|
@@ -219,8 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
219
220
|
- !ruby/object:Gem::Version
|
220
221
|
version: '0'
|
221
222
|
requirements: []
|
222
|
-
|
223
|
-
rubygems_version: 2.7.6
|
223
|
+
rubygems_version: 3.1.2
|
224
224
|
signing_key:
|
225
225
|
specification_version: 4
|
226
226
|
summary: Terminal table generator
|