fat_table 0.4.0 → 0.5.3
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/.rspec +2 -1
- data/README.org +1426 -447
- data/README.rdoc +1 -2
- data/TODO.org +17 -10
- data/examples/create_trans.sql +14 -0
- data/examples/quick.pdf +0 -0
- data/examples/quick.png +0 -0
- data/examples/quick.ppm +0 -0
- data/examples/quick.tex +8 -0
- data/examples/quick_small.png +0 -0
- data/examples/quicktable.tex +123 -0
- data/examples/trades.db +0 -0
- data/examples/trans.csv +13 -0
- data/fat_table.gemspec +1 -0
- data/lib/ext/array.rb +15 -0
- data/lib/fat_table/column.rb +89 -208
- data/lib/fat_table/convert.rb +174 -0
- data/lib/fat_table/errors.rb +4 -0
- data/lib/fat_table/evaluator.rb +7 -0
- data/lib/fat_table/footer.rb +228 -0
- data/lib/fat_table/formatters/formatter.rb +200 -166
- data/lib/fat_table/formatters/latex_formatter.rb +9 -7
- data/lib/fat_table/table.rb +366 -117
- data/lib/fat_table/version.rb +1 -1
- data/lib/fat_table.rb +19 -16
- data/md/README.md +1 -2
- metadata +31 -5
data/lib/fat_table/version.rb
CHANGED
data/lib/fat_table.rb
CHANGED
@@ -19,9 +19,12 @@ module FatTable
|
|
19
19
|
|
20
20
|
require 'fat_table/version'
|
21
21
|
require 'fat_table/patches'
|
22
|
+
require 'ext/array'
|
22
23
|
require 'fat_table/evaluator'
|
24
|
+
require 'fat_table/convert'
|
23
25
|
require 'fat_table/column'
|
24
26
|
require 'fat_table/table'
|
27
|
+
require 'fat_table/footer'
|
25
28
|
require 'fat_table/formatters'
|
26
29
|
require 'fat_table/db_handle'
|
27
30
|
require 'fat_table/errors'
|
@@ -58,22 +61,22 @@ module FatTable
|
|
58
61
|
|
59
62
|
# Return an empty FatTable::Table object. You can use FatTable::Table#add_row
|
60
63
|
# or FatTable::Table#add_column to populate the table with data.
|
61
|
-
def self.new
|
62
|
-
Table.new
|
64
|
+
def self.new(*args, tolerant_columns: [])
|
65
|
+
Table.new(*args, tolerant_columns: tolerant_columns)
|
63
66
|
end
|
64
67
|
|
65
68
|
# Construct a FatTable::Table from the contents of a CSV file given by the
|
66
69
|
# file name +fname+. Headers will be taken from the first row and converted to
|
67
70
|
# symbols.
|
68
|
-
def self.from_csv_file(fname)
|
69
|
-
Table.from_csv_file(fname)
|
71
|
+
def self.from_csv_file(fname, tolerant_columns: [])
|
72
|
+
Table.from_csv_file(fname, tolerant_columns: tolerant_columns)
|
70
73
|
end
|
71
74
|
|
72
75
|
# Construct a FatTable::Table from the string +str+, treated in the same
|
73
76
|
# manner as if read the input from a CSV file. Headers will be taken from the
|
74
77
|
# first row and converted to symbols.
|
75
|
-
def self.from_csv_string(str)
|
76
|
-
Table.from_csv_string(str)
|
78
|
+
def self.from_csv_string(str, tolerant_columns: [])
|
79
|
+
Table.from_csv_string(str, tolerant_columns: tolerant_columns)
|
77
80
|
end
|
78
81
|
|
79
82
|
# Construct a FatTable::Table from the first table found in the Emacs org-mode
|
@@ -81,8 +84,8 @@ module FatTable
|
|
81
84
|
# is an hline. Otherwise, synthetic headers of the form +:col_1+, +:col_2+,
|
82
85
|
# etc. are created. Any other hlines will be treated as marking a boundary in
|
83
86
|
# the table.
|
84
|
-
def self.from_org_file(fname)
|
85
|
-
Table.from_org_file(fname)
|
87
|
+
def self.from_org_file(fname, tolerant_columns: [])
|
88
|
+
Table.from_org_file(fname, tolerant_columns: tolerant_columns)
|
86
89
|
end
|
87
90
|
|
88
91
|
# Construct a FatTable::Table from the first table found in the string +str+,
|
@@ -90,8 +93,8 @@ module FatTable
|
|
90
93
|
# are taken from the first row if the second row is an hrule. Otherwise,
|
91
94
|
# synthetic headers of the form :col_1, :col_2, etc. are created. Any other
|
92
95
|
# hlines will be treated as marking a boundary in the table.
|
93
|
-
def self.from_org_string(str)
|
94
|
-
Table.from_org_string(str)
|
96
|
+
def self.from_org_string(str, tolerant_columns: [])
|
97
|
+
Table.from_org_string(str, tolerant_columns: tolerant_columns)
|
95
98
|
end
|
96
99
|
|
97
100
|
# Construct a FatTable::Table from the array of arrays +aoa+. By default, with
|
@@ -105,8 +108,8 @@ module FatTable
|
|
105
108
|
# org-mode code blocks, by default (+:hlines no+) all hlines are stripped from
|
106
109
|
# the table, otherwise (+:hlines yes+) they are indicated with nil elements in
|
107
110
|
# the outer array.
|
108
|
-
def self.from_aoa(aoa, hlines: false)
|
109
|
-
Table.from_aoa(aoa, hlines: hlines)
|
111
|
+
def self.from_aoa(aoa, hlines: false, tolerant_columns: [])
|
112
|
+
Table.from_aoa(aoa, hlines: hlines, tolerant_columns: tolerant_columns)
|
110
113
|
end
|
111
114
|
|
112
115
|
# Construct a FatTable::Table from the array of hashes +aoh+, which can be an
|
@@ -114,8 +117,8 @@ module FatTable
|
|
114
117
|
# interpret nil separators as marking boundaries in the new Table. All hashes
|
115
118
|
# must have the same keys, which, converted to symbols, become the headers for
|
116
119
|
# the new Table.
|
117
|
-
def self.from_aoh(aoh, hlines: false)
|
118
|
-
Table.from_aoh(aoh, hlines: hlines)
|
120
|
+
def self.from_aoh(aoh, hlines: false, tolerant_columns: [])
|
121
|
+
Table.from_aoh(aoh, hlines: hlines, tolerant_columns: tolerant_columns)
|
119
122
|
end
|
120
123
|
|
121
124
|
# Construct a FatTable::Table from another FatTable::Table. Inherit any group
|
@@ -127,8 +130,8 @@ module FatTable
|
|
127
130
|
# Construct a Table by running a SQL query against the database set up with
|
128
131
|
# FatTable.connect. Return the Table with the query results as rows and the
|
129
132
|
# headers from the query, converted to symbols, as headers.
|
130
|
-
def self.from_sql(query)
|
131
|
-
Table.from_sql(query)
|
133
|
+
def self.from_sql(query, tolerant_columns: [])
|
134
|
+
Table.from_sql(query, tolerant_columns: tolerant_columns)
|
132
135
|
end
|
133
136
|
|
134
137
|
########################################################################
|
data/md/README.md
CHANGED
@@ -1109,8 +1109,7 @@ will raise an exception.
|
|
1109
1109
|
|
1110
1110
|
- **`first`:** the first non-nil item in the column,
|
1111
1111
|
- **`last`:** the last non-nil item in the column,
|
1112
|
-
- **`
|
1113
|
-
values in the column,
|
1112
|
+
- **`range`:** form a Range ~~{min}..{max}~ to show the range of values in the column,
|
1114
1113
|
- **`sum`:** for `Numeric` and `String` columns, apply ’+’ to all the non-nil
|
1115
1114
|
values,
|
1116
1115
|
- **`count`:** the number of non-nil values in the column,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fat_table
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel E. Doherty
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-01-
|
11
|
+
date: 2022-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: sqlite3
|
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'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: rspec
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -283,12 +297,24 @@ files:
|
|
283
297
|
- TODO.org
|
284
298
|
- bin/ft_console
|
285
299
|
- bin/setup
|
300
|
+
- examples/create_trans.sql
|
301
|
+
- examples/quick.pdf
|
302
|
+
- examples/quick.png
|
303
|
+
- examples/quick.ppm
|
304
|
+
- examples/quick.tex
|
305
|
+
- examples/quick_small.png
|
306
|
+
- examples/quicktable.tex
|
307
|
+
- examples/trades.db
|
308
|
+
- examples/trans.csv
|
286
309
|
- fat_table.gemspec
|
310
|
+
- lib/ext/array.rb
|
287
311
|
- lib/fat_table.rb
|
288
312
|
- lib/fat_table/column.rb
|
313
|
+
- lib/fat_table/convert.rb
|
289
314
|
- lib/fat_table/db_handle.rb
|
290
315
|
- lib/fat_table/errors.rb
|
291
316
|
- lib/fat_table/evaluator.rb
|
317
|
+
- lib/fat_table/footer.rb
|
292
318
|
- lib/fat_table/formatters.rb
|
293
319
|
- lib/fat_table/formatters/aoa_formatter.rb
|
294
320
|
- lib/fat_table/formatters/aoh_formatter.rb
|
@@ -306,7 +332,7 @@ licenses: []
|
|
306
332
|
metadata:
|
307
333
|
allowed_push_host: https://rubygems.org
|
308
334
|
yard.run: yri
|
309
|
-
post_install_message:
|
335
|
+
post_install_message:
|
310
336
|
rdoc_options: []
|
311
337
|
require_paths:
|
312
338
|
- lib
|
@@ -322,7 +348,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
322
348
|
version: '0'
|
323
349
|
requirements: []
|
324
350
|
rubygems_version: 3.3.3
|
325
|
-
signing_key:
|
351
|
+
signing_key:
|
326
352
|
specification_version: 4
|
327
353
|
summary: Provides tools for working with tables as a data type.
|
328
354
|
test_files: []
|