tabulo 2.5.0 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -3
- data/CHANGELOG.md +8 -0
- data/README.md +140 -88
- data/VERSION +1 -1
- data/assets/social_media_preview/table.png +0 -0
- data/lib/tabulo/border.rb +56 -101
- data/lib/tabulo/cell.rb +27 -16
- data/lib/tabulo/column.rb +28 -5
- data/lib/tabulo/table.rb +98 -79
- data/lib/tabulo/util.rb +20 -0
- data/lib/tabulo/version.rb +1 -1
- metadata +3 -2
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
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.0
|
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-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tty-screen
|
@@ -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
|