fat_core 1.7.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/TODO.org +0 -19
- data/lib/fat_core/string.rb +23 -11
- data/lib/fat_core/version.rb +3 -3
- data/lib/fat_core.rb +0 -4
- data/spec/lib/string_spec.rb +41 -37
- metadata +2 -33
- data/lib/fat_core/column.rb +0 -345
- data/lib/fat_core/evaluator.rb +0 -43
- data/lib/fat_core/formatters/aoa_formatter.rb +0 -84
- data/lib/fat_core/formatters/aoh_formatter.rb +0 -82
- data/lib/fat_core/formatters/formatter.rb +0 -973
- data/lib/fat_core/formatters/org_formatter.rb +0 -72
- data/lib/fat_core/formatters/text_formatter.rb +0 -91
- data/lib/fat_core/formatters.rb +0 -5
- data/lib/fat_core/table.rb +0 -988
- data/spec/example_files/datawatch.org +0 -471
- data/spec/example_files/goldberg.org +0 -199
- data/spec/example_files/wpcs.csv +0 -92
- data/spec/lib/column_spec.rb +0 -224
- data/spec/lib/evaluator_spec.rb +0 -34
- data/spec/lib/formatters/aoa_formatter_spec.rb +0 -62
- data/spec/lib/formatters/aoh_formatter_spec.rb +0 -61
- data/spec/lib/formatters/formatter_spec.rb +0 -371
- data/spec/lib/formatters/org_formatter_spec.rb +0 -60
- data/spec/lib/formatters/text_formatter_spec.rb +0 -60
- data/spec/lib/table_spec.rb +0 -990
@@ -1,72 +0,0 @@
|
|
1
|
-
module FatCore
|
2
|
-
# Output the table in the same way as org-mode for emacs does. This is almost
|
3
|
-
# identical to TextFormatter except that dates do get formatted as inactive
|
4
|
-
# timestamps and the connector at the beginning of hlines is a '|' rather than
|
5
|
-
# a '+' as for text tables.
|
6
|
-
class OrgFormatter < Formatter
|
7
|
-
|
8
|
-
self.default_format = default_format.dup
|
9
|
-
self.default_format[:date_fmt] = '[%F]'
|
10
|
-
self.default_format[:datetime_fmt] = '[%F %a %H:%M:%S]'
|
11
|
-
|
12
|
-
# Does this Formatter require a second pass over the cells to align the
|
13
|
-
# columns according to the alignment formatting instruction to the width of
|
14
|
-
# the widest cell in each column?
|
15
|
-
def aligned?
|
16
|
-
true
|
17
|
-
end
|
18
|
-
|
19
|
-
def pre_header(widths)
|
20
|
-
result = '|'
|
21
|
-
widths.values.each do |w|
|
22
|
-
result += '-' * (w + 2) + '+'
|
23
|
-
end
|
24
|
-
result[-1] = '|'
|
25
|
-
result + "\n"
|
26
|
-
end
|
27
|
-
|
28
|
-
def pre_row
|
29
|
-
'|'
|
30
|
-
end
|
31
|
-
|
32
|
-
# Add one space of padding.
|
33
|
-
def pre_cell(_h)
|
34
|
-
' '
|
35
|
-
end
|
36
|
-
|
37
|
-
def quote_cell(v)
|
38
|
-
v
|
39
|
-
end
|
40
|
-
|
41
|
-
# Add one space of padding.
|
42
|
-
def post_cell
|
43
|
-
' '
|
44
|
-
end
|
45
|
-
|
46
|
-
def inter_cell
|
47
|
-
'|'
|
48
|
-
end
|
49
|
-
|
50
|
-
def post_row
|
51
|
-
"|\n"
|
52
|
-
end
|
53
|
-
|
54
|
-
def hline(widths)
|
55
|
-
result = '|'
|
56
|
-
widths.values.each do |w|
|
57
|
-
result += '-' * (w + 2) + '+'
|
58
|
-
end
|
59
|
-
result[-1] = '|'
|
60
|
-
result + "\n"
|
61
|
-
end
|
62
|
-
|
63
|
-
def post_footers(widths)
|
64
|
-
result = '|'
|
65
|
-
widths.values.each do |w|
|
66
|
-
result += '-' * (w + 2) + '+'
|
67
|
-
end
|
68
|
-
result[-1] = '|'
|
69
|
-
result + "\n"
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
@@ -1,91 +0,0 @@
|
|
1
|
-
module FatCore
|
2
|
-
# Output the table as plain text. This is almost identical to OrgFormatter
|
3
|
-
# except that dates do not get formatted as inactive timestamps and the
|
4
|
-
# connector at the beginning of hlines is a '+' rather than a '|' as for org
|
5
|
-
# tables.
|
6
|
-
class TextFormatter < Formatter
|
7
|
-
# Does this Formatter require a second pass over the cells to align the
|
8
|
-
# columns according to the alignment formatting instruction to the width of
|
9
|
-
# the widest cell in each column?
|
10
|
-
def aligned?
|
11
|
-
true
|
12
|
-
end
|
13
|
-
|
14
|
-
def pre_header(widths)
|
15
|
-
result = '|'
|
16
|
-
widths.values.each do |w|
|
17
|
-
result += '-' * (w + 2) + '+'
|
18
|
-
end
|
19
|
-
result[-1] = '|'
|
20
|
-
result + "\n"
|
21
|
-
end
|
22
|
-
|
23
|
-
def pre_row
|
24
|
-
'|'
|
25
|
-
end
|
26
|
-
|
27
|
-
# Add one space of padding.
|
28
|
-
def pre_cell(_h)
|
29
|
-
' '
|
30
|
-
end
|
31
|
-
|
32
|
-
def quote_cell(v)
|
33
|
-
v
|
34
|
-
end
|
35
|
-
|
36
|
-
# Add one space of padding.
|
37
|
-
def post_cell
|
38
|
-
' '
|
39
|
-
end
|
40
|
-
|
41
|
-
def inter_cell
|
42
|
-
'|'
|
43
|
-
end
|
44
|
-
|
45
|
-
def post_row
|
46
|
-
"|\n"
|
47
|
-
end
|
48
|
-
|
49
|
-
def hline(widths)
|
50
|
-
result = '+'
|
51
|
-
widths.values.each do |w|
|
52
|
-
result += '-' * (w + 2) + '+'
|
53
|
-
end
|
54
|
-
result[-1] = '+'
|
55
|
-
result + "\n"
|
56
|
-
end
|
57
|
-
|
58
|
-
def pre_group
|
59
|
-
''
|
60
|
-
end
|
61
|
-
|
62
|
-
def post_group
|
63
|
-
''
|
64
|
-
end
|
65
|
-
|
66
|
-
def pre_gfoot
|
67
|
-
''
|
68
|
-
end
|
69
|
-
|
70
|
-
def post_gfoot
|
71
|
-
''
|
72
|
-
end
|
73
|
-
|
74
|
-
def pre_foot
|
75
|
-
''
|
76
|
-
end
|
77
|
-
|
78
|
-
def post_foot
|
79
|
-
''
|
80
|
-
end
|
81
|
-
|
82
|
-
def post_footers(widths)
|
83
|
-
result = '+'
|
84
|
-
widths.values.each do |w|
|
85
|
-
result += '-' * (w + 2) + '+'
|
86
|
-
end
|
87
|
-
result[-1] = '+'
|
88
|
-
result + "\n"
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|