tabulo 2.4.1 → 2.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -4
- data/CHANGELOG.md +26 -0
- data/README.md +330 -120
- data/VERSION +1 -1
- data/assets/social_media_preview/table.png +0 -0
- data/lib/tabulo/border.rb +65 -101
- data/lib/tabulo/cell.rb +28 -17
- 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 +3 -3
- metadata +12 -11
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.
|
32
|
-
spec.add_runtime_dependency "unicode-display_width", "
|
31
|
+
spec.add_runtime_dependency "tty-screen", "0.8.1"
|
32
|
+
spec.add_runtime_dependency "unicode-display_width", "2.0.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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Harvey
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-30 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:
|
33
|
+
version: 2.0.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:
|
40
|
+
version: 2.0.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,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
|
@@ -204,7 +205,7 @@ licenses:
|
|
204
205
|
metadata:
|
205
206
|
source_code_uri: https://github.com/matt-harvey/tabulo
|
206
207
|
changelog_uri: https://raw.githubusercontent.com/matt-harvey/tabulo/master/CHANGELOG.md
|
207
|
-
post_install_message:
|
208
|
+
post_install_message:
|
208
209
|
rdoc_options: []
|
209
210
|
require_paths:
|
210
211
|
- lib
|
@@ -220,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
220
221
|
version: '0'
|
221
222
|
requirements: []
|
222
223
|
rubygems_version: 3.1.2
|
223
|
-
signing_key:
|
224
|
+
signing_key:
|
224
225
|
specification_version: 4
|
225
226
|
summary: Terminal table generator
|
226
227
|
test_files: []
|