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.
@@ -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
@@ -1,5 +0,0 @@
1
- require 'fat_core/formatters/formatter'
2
- require 'fat_core/formatters/aoa_formatter'
3
- require 'fat_core/formatters/aoh_formatter'
4
- require 'fat_core/formatters/org_formatter'
5
- require 'fat_core/formatters/text_formatter'