tabulo 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.ackrc +10 -0
- data/.gitignore +12 -0
- data/.rdoc_options +22 -0
- data/.rspec +2 -0
- data/.travis.yml +10 -0
- data/.yardopts +2 -0
- data/CHANGELOG.md +249 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +1353 -0
- data/Rakefile +17 -0
- data/VERSION +1 -0
- data/_config.yml +1 -0
- data/assets/social_media_preview/table.png +0 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/tabulo.rb +10 -0
- data/lib/tabulo/border.rb +164 -0
- data/lib/tabulo/cell.rb +155 -0
- data/lib/tabulo/cell_data.rb +14 -0
- data/lib/tabulo/column.rb +114 -0
- data/lib/tabulo/deprecation.rb +33 -0
- data/lib/tabulo/exceptions.rb +12 -0
- data/lib/tabulo/row.rb +51 -0
- data/lib/tabulo/table.rb +763 -0
- data/lib/tabulo/util.rb +45 -0
- data/lib/tabulo/version.rb +3 -0
- data/tabulo.gemspec +43 -0
- metadata +227 -0
data/lib/tabulo/util.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
module Tabulo
|
2
|
+
|
3
|
+
# @!visibility private
|
4
|
+
module Util
|
5
|
+
|
6
|
+
# @!visibility private
|
7
|
+
def self.condense_lines(lines)
|
8
|
+
join_lines(lines.reject(&:empty?))
|
9
|
+
end
|
10
|
+
|
11
|
+
# @!visibility private
|
12
|
+
def self.divides?(smaller, larger)
|
13
|
+
larger % smaller == 0
|
14
|
+
end
|
15
|
+
|
16
|
+
# @!visibility private
|
17
|
+
def self.join_lines(lines)
|
18
|
+
lines.join($/)
|
19
|
+
end
|
20
|
+
|
21
|
+
# @!visibility private
|
22
|
+
def self.max(x, y)
|
23
|
+
x > y ? x : y
|
24
|
+
end
|
25
|
+
|
26
|
+
# @!visibility private
|
27
|
+
def self.slice_hash(hash, *keys)
|
28
|
+
new_hash = {}
|
29
|
+
keys.each { |k| new_hash[k] = hash[k] if hash.include?(k) }
|
30
|
+
new_hash
|
31
|
+
end
|
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
|
+
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
data/tabulo.gemspec
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'tabulo/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "tabulo"
|
8
|
+
spec.version = Tabulo::VERSION
|
9
|
+
spec.authors = ["Matthew Harvey"]
|
10
|
+
spec.email = ["software@matthewharvey.net"]
|
11
|
+
|
12
|
+
spec.summary = "Terminal table generator"
|
13
|
+
spec.description = "Plain text table generator with a column-based API"
|
14
|
+
spec.homepage = "https://github.com/matt-harvey/tabulo"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.required_ruby_version = ">= 2.1.10"
|
25
|
+
|
26
|
+
spec.metadata = {
|
27
|
+
"source_code_uri" => "https://github.com/matt-harvey/tabulo",
|
28
|
+
"changelog_uri" => "https://raw.githubusercontent.com/matt-harvey/tabulo/master/CHANGELOG.md"
|
29
|
+
}
|
30
|
+
|
31
|
+
spec.add_runtime_dependency "tty-screen", "0.7.1"
|
32
|
+
spec.add_runtime_dependency "unicode-display_width", "1.7.0"
|
33
|
+
|
34
|
+
spec.add_development_dependency "bundler"
|
35
|
+
spec.add_development_dependency "rake", "~> 12.3.3"
|
36
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
37
|
+
spec.add_development_dependency "simplecov"
|
38
|
+
spec.add_development_dependency "coveralls"
|
39
|
+
spec.add_development_dependency "yard"
|
40
|
+
spec.add_development_dependency "redcarpet"
|
41
|
+
spec.add_development_dependency "github-markup"
|
42
|
+
spec.add_development_dependency "rake-version", "~> 1.0"
|
43
|
+
end
|
metadata
ADDED
@@ -0,0 +1,227 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tabulo
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.6.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Matthew Harvey
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-05-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: tty-screen
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.7.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.7.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: unicode-display_width
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.7.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.7.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 12.3.3
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 12.3.3
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: simplecov
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: coveralls
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: yard
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: redcarpet
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: github-markup
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: rake-version
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '1.0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '1.0'
|
167
|
+
description: Plain text table generator with a column-based API
|
168
|
+
email:
|
169
|
+
- software@matthewharvey.net
|
170
|
+
executables: []
|
171
|
+
extensions: []
|
172
|
+
extra_rdoc_files: []
|
173
|
+
files:
|
174
|
+
- ".ackrc"
|
175
|
+
- ".gitignore"
|
176
|
+
- ".rdoc_options"
|
177
|
+
- ".rspec"
|
178
|
+
- ".travis.yml"
|
179
|
+
- ".yardopts"
|
180
|
+
- CHANGELOG.md
|
181
|
+
- Gemfile
|
182
|
+
- LICENSE.txt
|
183
|
+
- README.md
|
184
|
+
- Rakefile
|
185
|
+
- VERSION
|
186
|
+
- _config.yml
|
187
|
+
- assets/social_media_preview/table.png
|
188
|
+
- bin/console
|
189
|
+
- bin/setup
|
190
|
+
- lib/tabulo.rb
|
191
|
+
- lib/tabulo/border.rb
|
192
|
+
- lib/tabulo/cell.rb
|
193
|
+
- lib/tabulo/cell_data.rb
|
194
|
+
- lib/tabulo/column.rb
|
195
|
+
- lib/tabulo/deprecation.rb
|
196
|
+
- lib/tabulo/exceptions.rb
|
197
|
+
- lib/tabulo/row.rb
|
198
|
+
- lib/tabulo/table.rb
|
199
|
+
- lib/tabulo/util.rb
|
200
|
+
- lib/tabulo/version.rb
|
201
|
+
- tabulo.gemspec
|
202
|
+
homepage: https://github.com/matt-harvey/tabulo
|
203
|
+
licenses:
|
204
|
+
- MIT
|
205
|
+
metadata:
|
206
|
+
source_code_uri: https://github.com/matt-harvey/tabulo
|
207
|
+
changelog_uri: https://raw.githubusercontent.com/matt-harvey/tabulo/master/CHANGELOG.md
|
208
|
+
post_install_message:
|
209
|
+
rdoc_options: []
|
210
|
+
require_paths:
|
211
|
+
- lib
|
212
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
213
|
+
requirements:
|
214
|
+
- - ">="
|
215
|
+
- !ruby/object:Gem::Version
|
216
|
+
version: 2.1.10
|
217
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
218
|
+
requirements:
|
219
|
+
- - ">="
|
220
|
+
- !ruby/object:Gem::Version
|
221
|
+
version: '0'
|
222
|
+
requirements: []
|
223
|
+
rubygems_version: 3.1.2
|
224
|
+
signing_key:
|
225
|
+
specification_version: 4
|
226
|
+
summary: Terminal table generator
|
227
|
+
test_files: []
|