console_table 0.2.4 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/README.md +1 -1
- data/console_table.gemspec +3 -3
- data/lib/console_table.rb +4 -4
- metadata +14 -15
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: '081cb85b432de9117e06bb17afc4a3c6f0afb71a7fcb257ac302a325e10c7b8e'
|
|
4
|
+
data.tar.gz: 393d21ad15fea24048ef1028009be13ebee75de31b169f84c7324e78b6195315
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fe3e9f9db0acf800f90388cf70a1408e5b6e2e4a8234894e26479ec651047c258e5cd1df6577a48a569260d7c193fbee83f38a763bccbaa92b392ecbe7fa1678
|
|
7
|
+
data.tar.gz: 0cffbb1101518a5147ba0e14e6a6d29304d7fe033f26b843329b2206cebacde91bbd1e763fc191398207d49e98cb26e939564c71fb34df44e5621f832e3dd8ee
|
data/README.md
CHANGED
|
@@ -398,7 +398,7 @@ Which will yield this, if you're into that sort of thing:
|
|
|
398
398
|
*======================================================*
|
|
399
399
|
```
|
|
400
400
|
|
|
401
|
-
A lot of times, supplying less information means that ConsoleTable will just guess at various defaults. For example, if you do not provide a key for the table config, ConsoleTable will simply number your keys with names like 'col1', 'col2', etc. If you do not provide a title, it will `capitalize` whatever key you are using for the column, or use something like "Column 1" if you do not supply one. If you do not supply a size, ConsoleTable will just assume you want "
|
|
401
|
+
A lot of times, supplying less information means that ConsoleTable will just guess at various defaults. For example, if you do not provide a key for the table config, ConsoleTable will simply number your keys with names like 'col1', 'col2', etc. If you do not provide a title, it will `capitalize` whatever key you are using for the column, or use something like "Column 1" if you do not supply one. If you do not supply a size, ConsoleTable will just assume you want "\*" as the size (remember, you can have many "*"s and the space is divided equally).
|
|
402
402
|
|
|
403
403
|
Additionally, you can give ONLY the titles for columns by simply suppling an array of strings as the console config. With this ability, it's possible to define and use ConsoleTable in a remarkably abbreviated manner, where most of the control of the formatting is unexercised.
|
|
404
404
|
|
data/console_table.gemspec
CHANGED
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
|
4
4
|
|
|
5
5
|
Gem::Specification.new do |spec|
|
|
6
6
|
spec.name = "console_table"
|
|
7
|
-
spec.version = "0.
|
|
7
|
+
spec.version = "0.3.1"
|
|
8
8
|
spec.authors = ["Rod Hilton"]
|
|
9
9
|
spec.email = ["consoletable@rodhilton.com"]
|
|
10
10
|
spec.summary = %q{Simplifies printing tables of information to commandline consoles}
|
|
@@ -17,10 +17,10 @@ Gem::Specification.new do |spec|
|
|
|
17
17
|
spec.require_paths = ["lib"]
|
|
18
18
|
|
|
19
19
|
spec.add_development_dependency 'simplecov', '~> 0.9'
|
|
20
|
-
spec.add_development_dependency "bundler", "~>
|
|
20
|
+
spec.add_development_dependency "bundler", "~> 2.3.7"
|
|
21
21
|
spec.add_development_dependency 'rake', '~> 0'
|
|
22
22
|
spec.add_development_dependency 'minitest', '~> 5.5'
|
|
23
23
|
spec.add_development_dependency 'colorize', '~> 0.7'
|
|
24
|
+
spec.add_development_dependency 'pry'
|
|
24
25
|
|
|
25
|
-
spec.add_runtime_dependency 'ruby-terminfo', '~> 0.1'
|
|
26
26
|
end
|
data/lib/console_table.rb
CHANGED
|
@@ -16,7 +16,7 @@ module ConsoleTable
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
class ConsoleTableClass
|
|
19
|
-
require '
|
|
19
|
+
require 'io/console'
|
|
20
20
|
|
|
21
21
|
# Add strings to the footer array to have them formatted when the table closes
|
|
22
22
|
attr_reader :footer
|
|
@@ -31,7 +31,7 @@ module ConsoleTable
|
|
|
31
31
|
def initialize(column_layout, options={})
|
|
32
32
|
@original_column_layout = []
|
|
33
33
|
|
|
34
|
-
if column_layout.is_a?
|
|
34
|
+
if column_layout.is_a? Integer
|
|
35
35
|
column_layout = (1..column_layout).collect{|i| "Column #{i}"}
|
|
36
36
|
end
|
|
37
37
|
|
|
@@ -39,7 +39,7 @@ module ConsoleTable
|
|
|
39
39
|
column_layout.each_with_index do |layout, i|
|
|
40
40
|
if layout.is_a? String
|
|
41
41
|
@original_column_layout << {:key => "col#{i+1}".to_sym, :title=>layout, :size=>"*"}
|
|
42
|
-
elsif layout.is_a?
|
|
42
|
+
elsif layout.is_a? Integer
|
|
43
43
|
@original_column_layout << {:key => "col#{i+1}".to_sym, :title=>"Column #{i+1}", :size=>layout}
|
|
44
44
|
elsif layout.is_a? Float
|
|
45
45
|
@original_column_layout << {:key => "col#{i+1}".to_sym, :title=>"Column #{i+1}", :size=>layout}
|
|
@@ -278,7 +278,7 @@ module ConsoleTable
|
|
|
278
278
|
|
|
279
279
|
total_width = @set_width
|
|
280
280
|
begin
|
|
281
|
-
total_width =
|
|
281
|
+
total_width = IO.console.winsize[1]
|
|
282
282
|
rescue => ex
|
|
283
283
|
total_width = ENV["COLUMNS"].to_i unless ENV["COLUMNS"].nil?
|
|
284
284
|
total_width = 79 if total_width.nil?
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: console_table
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rod Hilton
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2023-03-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: simplecov
|
|
@@ -30,14 +30,14 @@ dependencies:
|
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version:
|
|
33
|
+
version: 2.3.7
|
|
34
34
|
type: :development
|
|
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.3.7
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: rake
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -81,19 +81,19 @@ dependencies:
|
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
82
|
version: '0.7'
|
|
83
83
|
- !ruby/object:Gem::Dependency
|
|
84
|
-
name:
|
|
84
|
+
name: pry
|
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
|
86
86
|
requirements:
|
|
87
|
-
- - "
|
|
87
|
+
- - ">="
|
|
88
88
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: '0
|
|
90
|
-
type: :
|
|
89
|
+
version: '0'
|
|
90
|
+
type: :development
|
|
91
91
|
prerelease: false
|
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
93
|
requirements:
|
|
94
|
-
- - "
|
|
94
|
+
- - ">="
|
|
95
95
|
- !ruby/object:Gem::Version
|
|
96
|
-
version: '0
|
|
96
|
+
version: '0'
|
|
97
97
|
description: Allows developers to define tables with specifically-sized columns, which
|
|
98
98
|
can then have entries printed to them that are automatically formatted, truncated,
|
|
99
99
|
and padded to fit in the console window.
|
|
@@ -119,7 +119,7 @@ homepage: https://github.com/rodhilton/console_table
|
|
|
119
119
|
licenses:
|
|
120
120
|
- MIT
|
|
121
121
|
metadata: {}
|
|
122
|
-
post_install_message:
|
|
122
|
+
post_install_message:
|
|
123
123
|
rdoc_options: []
|
|
124
124
|
require_paths:
|
|
125
125
|
- lib
|
|
@@ -134,9 +134,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
134
134
|
- !ruby/object:Gem::Version
|
|
135
135
|
version: '0'
|
|
136
136
|
requirements: []
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
signing_key:
|
|
137
|
+
rubygems_version: 3.2.3
|
|
138
|
+
signing_key:
|
|
140
139
|
specification_version: 4
|
|
141
140
|
summary: Simplifies printing tables of information to commandline consoles
|
|
142
141
|
test_files:
|