rtables 1.0.0 → 1.0.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 +4 -4
- data/README.md +3 -0
- data/docs/tables/MonoTable.md +16 -16
- data/docs/tables/PlainTable.md +36 -0
- data/docs/tables/SimpleTable.md +33 -0
- data/docs/tables/UnicodeMonoTable.md +43 -0
- data/docs/tables_in_2_minutes.md +1 -34
- data/lib/rtables/tablebuilder.rb +1 -1
- data/lib/rtables/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6ca63c3fa094725afe6a512242c42625b804c69
|
4
|
+
data.tar.gz: a4007c9aa87978745c6bcb2c1cfc4a8d27cc6be7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8ab35eeb7fd374545eb59e5ed27b50023dc8c25d1f5a7ddda5e41b1e7f36344a70dac8c2dd5f5cbf337fcfb177b20b5529d1f242f16774eef7aebdf780cc765
|
7
|
+
data.tar.gz: de32615674f18a08e305e811a32a4fb353dfe27e1d0ce239d07126497fa3f126be7265f1feb2005720ae8ab89e9f2ee609294162eadc7ca0a316efded96e753f
|
data/README.md
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
# Ruby Tables
|
2
|
+
[](https://travis-ci.org/Zarthus/rtables)
|
3
|
+
[](https://codeclimate.com/github/Zarthus/rtables)
|
4
|
+
[](https://codeclimate.com/github/Zarthus/rtables/coverage)
|
2
5
|
|
3
6
|
RTables (Ruby Tables) is a small library that helps you generate table output in various predefined formats.
|
4
7
|
|
data/docs/tables/MonoTable.md
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
#
|
1
|
+
# Monospace Table
|
2
2
|
|
3
3
|
Code:
|
4
4
|
|
5
5
|
```ruby
|
6
|
-
require 'rtables
|
6
|
+
require 'rtables'
|
7
7
|
table = RTables::Table::MonoTable.new
|
8
8
|
|
9
9
|
table.add_column('Example')
|
@@ -15,19 +15,21 @@ table.add_row('Very Large Field', 'With a large amount of text on it.')
|
|
15
15
|
table.render
|
16
16
|
```
|
17
17
|
|
18
|
-
Looks like:
|
19
|
-
|
18
|
+
Looks like (output from .ci/show_table_formats.rb):
|
20
19
|
```
|
21
|
-
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
25
|
-
|
26
|
-
|
|
27
|
-
|
28
|
-
|
|
29
|
-
|
30
|
-
|
20
|
+
+-------------+---------------------------------------------------------+
|
21
|
+
| Name | Maxine Caulfield |
|
22
|
+
| Occupation | Time Wizard |
|
23
|
+
| Voice Actor | Serena de Mouroux |
|
24
|
+
+-------------+---------------------------------------------------------+
|
25
|
+
| Name | David N. Madsen |
|
26
|
+
| Occupation | Head of Security at Blackwell Academy |
|
27
|
+
| Voice Actor | Don McManus |
|
28
|
+
+-------------+---------------------------------------------------------+
|
29
|
+
| Name | Mark Jefferson |
|
30
|
+
| Occupation | Professional Photographer, Teacher at Blackwell Academy |
|
31
|
+
| Voice Actor | Derek Phillips |
|
32
|
+
+-------------+---------------------------------------------------------+
|
31
33
|
```
|
32
34
|
|
33
35
|
## Positives
|
@@ -38,5 +40,3 @@ Looks like:
|
|
38
40
|
## Negatives
|
39
41
|
|
40
42
|
- Requires a Monospace font to render properly.
|
41
|
-
- If field names are too long the table will look strange.
|
42
|
-
- Table::MonoTable solves this by making use of [`BigMonoTable`](BigMonoTable.md) dynamically when the content is too big.
|
data/docs/tables/PlainTable.md
CHANGED
@@ -0,0 +1,36 @@
|
|
1
|
+
# Plain Table
|
2
|
+
|
3
|
+
Code:
|
4
|
+
|
5
|
+
```ruby
|
6
|
+
require 'rtables'
|
7
|
+
table = RTables::Table::PlainTable.new
|
8
|
+
|
9
|
+
table.add_column('Example')
|
10
|
+
table.add_column('Field')
|
11
|
+
table.add_row('First', 'This is an example text')
|
12
|
+
table.add_row('Small', 'Field')
|
13
|
+
table.add_row('Very Large Field', 'With a large amount of text on it.')
|
14
|
+
|
15
|
+
table.render
|
16
|
+
```
|
17
|
+
|
18
|
+
Looks like (output from .ci/show_table_formats.rb):
|
19
|
+
```
|
20
|
+
Name: Maxine Caulfield
|
21
|
+
Occupation: Time Wizard
|
22
|
+
Voice Actor: Serena de Mouroux
|
23
|
+
----
|
24
|
+
Name: David N. Madsen
|
25
|
+
Occupation: Head of Security at Blackwell Academy
|
26
|
+
Voice Actor: Don McManus
|
27
|
+
----
|
28
|
+
Name: Mark Jefferson
|
29
|
+
Occupation: Professional Photographer, Teacher at Blackwell Academy
|
30
|
+
Voice Actor: Derek Phillips
|
31
|
+
----
|
32
|
+
```
|
33
|
+
|
34
|
+
## Positives
|
35
|
+
|
36
|
+
- Displays the same everywhere
|
data/docs/tables/SimpleTable.md
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
# Simple Table
|
2
|
+
|
3
|
+
Code:
|
4
|
+
|
5
|
+
```ruby
|
6
|
+
require 'rtables'
|
7
|
+
table = RTables::Table::SimpleTable.new
|
8
|
+
|
9
|
+
table.add_column('Example')
|
10
|
+
table.add_column('Field')
|
11
|
+
table.add_row('First', 'This is an example text')
|
12
|
+
table.add_row('Small', 'Field')
|
13
|
+
table.add_row('Very Large Field', 'With a large amount of text on it.')
|
14
|
+
|
15
|
+
table.render
|
16
|
+
```
|
17
|
+
|
18
|
+
Looks like (output from .ci/show_table_formats.rb):
|
19
|
+
```
|
20
|
+
Name: Maxine Caulfield, Occupation: Time Wizard, Voice Actor: Serena de Mouroux
|
21
|
+
Name: David N. Madsen, Occupation: Head of Security at Blackwell Academy, Voice Actor: Don McManus
|
22
|
+
Name: Mark Jefferson, Occupation: Professional Photographer, Teacher at Blackwell Academy, Voice Actor: Derek Phillips
|
23
|
+
```
|
24
|
+
|
25
|
+
|
26
|
+
## Positives
|
27
|
+
|
28
|
+
- Displays the same everywhere
|
29
|
+
- Takes up very little space
|
30
|
+
|
31
|
+
## Negatives
|
32
|
+
|
33
|
+
- Difficult to read
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# Unicode Monospace Table
|
2
|
+
|
3
|
+
Code:
|
4
|
+
|
5
|
+
```ruby
|
6
|
+
require 'rtables'
|
7
|
+
table = RTables::Table::UnicodeMonoTable.new
|
8
|
+
|
9
|
+
table.add_column('Example')
|
10
|
+
table.add_column('Field')
|
11
|
+
table.add_row('First', 'This is an example text')
|
12
|
+
table.add_row('Small', 'Field')
|
13
|
+
table.add_row('Very Large Field', 'With a large amount of text on it.')
|
14
|
+
|
15
|
+
table.render
|
16
|
+
```
|
17
|
+
|
18
|
+
Looks like (output from .ci/show_table_formats.rb):
|
19
|
+
```
|
20
|
+
┌─────────────┬─────────────────────────────────────────────────────────┐
|
21
|
+
│ Name │ Maxine Caulfield │
|
22
|
+
│ Occupation │ Time Wizard │
|
23
|
+
│ Voice Actor │ Serena de Mouroux │
|
24
|
+
├─────────────┼─────────────────────────────────────────────────────────┤
|
25
|
+
│ Name │ David N. Madsen │
|
26
|
+
│ Occupation │ Head of Security at Blackwell Academy │
|
27
|
+
│ Voice Actor │ Don McManus │
|
28
|
+
├─────────────┼─────────────────────────────────────────────────────────┤
|
29
|
+
│ Name │ Mark Jefferson │
|
30
|
+
│ Occupation │ Professional Photographer, Teacher at Blackwell Academy │
|
31
|
+
│ Voice Actor │ Derek Phillips │
|
32
|
+
└─────────────┴─────────────────────────────────────────────────────────┘
|
33
|
+
```
|
34
|
+
|
35
|
+
## Positives
|
36
|
+
|
37
|
+
- Easy to read
|
38
|
+
- Perfect for key => value display
|
39
|
+
|
40
|
+
## Negatives
|
41
|
+
|
42
|
+
- Requires a Monospace font to render properly.
|
43
|
+
- Will not function when charset is misconfigured, does not use basic ASCII characters.
|
data/docs/tables_in_2_minutes.md
CHANGED
@@ -27,40 +27,7 @@ table.add_row('It\'s a beautiful day to be a table', 'Indeed.')
|
|
27
27
|
puts table.to_s
|
28
28
|
```
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
```
|
33
|
-
# PlainTable - the most boring table, but also the one that is the most consistent
|
34
|
-
|
35
|
-
Column: Row1 Value1, Column2: Row1 Value2, ...
|
36
|
-
Column: Row2 Value1, Column2: Row2 Value2, ...
|
37
|
-
Column: Row3 Value1, Column2: Row3 Value2, ...
|
38
|
-
```
|
39
|
-
|
40
|
-
```
|
41
|
-
# SimpleTable - slightly less boring table, keeping the same level of consistency
|
42
|
-
|
43
|
-
Column: Row1 Value1
|
44
|
-
Column2: Row1 Value2
|
45
|
-
----
|
46
|
-
Column: Row2 Value1
|
47
|
-
Column2: Row2 Value2
|
48
|
-
----
|
49
|
-
Column: Row3 Value1
|
50
|
-
Column2: Row3 Value2
|
51
|
-
|
52
|
-
```
|
53
|
-
|
54
|
-
```
|
55
|
-
# MonoTable - prettier, but requires a monospace font to function.
|
56
|
-
|
57
|
-
```
|
58
|
-
|
59
|
-
```
|
60
|
-
# UnicodeMonoTable - the prettiest, but requires a monospace font to function.
|
61
|
-
# Makes use of non-ascii characters, so may cause rendering issues on some clients.
|
62
|
-
|
63
|
-
```
|
30
|
+
You can run `ruby .ci/show_table_formats.rb` to generate a current list of table formats.
|
64
31
|
|
65
32
|
## Making your own table
|
66
33
|
Your table needs to meet the following two conditions:
|
data/lib/rtables/tablebuilder.rb
CHANGED
data/lib/rtables/version.rb
CHANGED