tabulo 2.3.3 → 2.6.1
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 +32 -0
- data/README.md +330 -96
- data/Rakefile +6 -1
- data/VERSION +1 -1
- data/assets/social_media_preview/table.png +0 -0
- data/lib/tabulo.rb +1 -0
- data/lib/tabulo/border.rb +66 -102
- data/lib/tabulo/cell.rb +56 -19
- data/lib/tabulo/cell_data.rb +14 -0
- data/lib/tabulo/column.rb +52 -6
- data/lib/tabulo/row.rb +8 -5
- data/lib/tabulo/table.rb +268 -110
- data/lib/tabulo/util.rb +20 -0
- data/lib/tabulo/version.rb +1 -1
- data/tabulo.gemspec +3 -3
- metadata +11 -10
data/lib/tabulo/util.rb
CHANGED
@@ -3,11 +3,21 @@ module Tabulo
|
|
3
3
|
# @!visibility private
|
4
4
|
module Util
|
5
5
|
|
6
|
+
# @!visibility private
|
7
|
+
def self.condense_lines(lines)
|
8
|
+
join_lines(lines.reject(&:empty?))
|
9
|
+
end
|
10
|
+
|
6
11
|
# @!visibility private
|
7
12
|
def self.divides?(smaller, larger)
|
8
13
|
larger % smaller == 0
|
9
14
|
end
|
10
15
|
|
16
|
+
# @!visibility private
|
17
|
+
def self.join_lines(lines)
|
18
|
+
lines.join($/)
|
19
|
+
end
|
20
|
+
|
11
21
|
# @!visibility private
|
12
22
|
def self.max(x, y)
|
13
23
|
x > y ? x : y
|
@@ -20,6 +30,16 @@ module Tabulo
|
|
20
30
|
new_hash
|
21
31
|
end
|
22
32
|
|
33
|
+
# @!visibility private
|
34
|
+
# @return [Integer] the length of the longest segment of str when split by newlines
|
35
|
+
def self.wrapped_width(str)
|
36
|
+
return 0 if str.empty?
|
37
|
+
segments = str.split($/)
|
38
|
+
segments.inject(1) do |longest_length_so_far, segment|
|
39
|
+
Util.max(longest_length_so_far, Unicode::DisplayWidth.of(segment))
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
23
43
|
end
|
24
44
|
end
|
25
45
|
|
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.
|
32
|
-
spec.add_runtime_dependency "unicode-display_width", "1.
|
31
|
+
spec.add_runtime_dependency "tty-screen", "0.8.1"
|
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.1
|
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-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tty-screen
|
@@ -16,28 +16,28 @@ 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
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.7.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
40
|
+
version: 1.7.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
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,11 +184,13 @@ 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
|
190
191
|
- lib/tabulo/border.rb
|
191
192
|
- lib/tabulo/cell.rb
|
193
|
+
- lib/tabulo/cell_data.rb
|
192
194
|
- lib/tabulo/column.rb
|
193
195
|
- lib/tabulo/deprecation.rb
|
194
196
|
- lib/tabulo/exceptions.rb
|
@@ -218,8 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
218
220
|
- !ruby/object:Gem::Version
|
219
221
|
version: '0'
|
220
222
|
requirements: []
|
221
|
-
|
222
|
-
rubygems_version: 2.7.6
|
223
|
+
rubygems_version: 3.1.2
|
223
224
|
signing_key:
|
224
225
|
specification_version: 4
|
225
226
|
summary: Terminal table generator
|