fat_table 0.2.9 → 0.2.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: af65227dda201238ba06b2296e548bcfbab9cc209ad66fc7e5efafe6bbcde8d5
4
- data.tar.gz: f59e53d1ec7aa54a36e96d475f32d50e0d7b668a838476fe3e73f9cd091396f4
3
+ metadata.gz: 1e55116f769d702af90918ed1bff4e9d8589d02d746da47d599d3bc155bbd033
4
+ data.tar.gz: f415408bfb6af7a2752b4f0f9d8d9b80407dd6062a1ba3ff85088886bd23c743
5
5
  SHA512:
6
- metadata.gz: 3e5d1f93e4c0fb505afd5f8f5e1c2cb918d31653a4c64ce2db63cd20733fdccd75649f756cb90597c761a61a26d4a76ddaf8a34f7f9f4db8029cd93db62dc70d
7
- data.tar.gz: a6f8b68c21b13382cb6cff7b65f05ed8de120d6e1296ccf2376152da92ba30efbee5196d9b792642e8f3097ed57f11147cc5eac65a330acb4efe4719bae51a79
6
+ metadata.gz: e3344a48f676d18c6e68ff460af5b697b19b8ebba6343d2a604ba62fc65d228b2e6f5563bcbfe7cf852d31db1fe20e9cc7f7952f75c4e6c09a2eb29a8211c9cd
7
+ data.tar.gz: 615a248fc73a49ca5caad56c12569aa3686aa3450393c4a1305de657fc5a6809a34b1a135a84298373fb49f5fb8461af375abe2d6880319b0a49e9e5ccbd1c2e
@@ -0,0 +1,3 @@
1
+ inherit_from: ~/.rubocop.yml
2
+ require: rubocop-rspec
3
+ require: rubocop-performance
@@ -2,8 +2,8 @@ language: ruby
2
2
  before_install:
3
3
  - sudo apt-get -qq update
4
4
  - sudo apt-get install -y texlive-latex-base texlive-latex-recommended
5
- before_script:
6
- - createdb -U travis travis
5
+ # before_script:
6
+ # - createdb -U travis travis
7
7
  after_failure:
8
8
  - "pwd"
9
9
  - "cat ./spec/tmp/latex.err"
@@ -13,9 +13,9 @@ bundler_args: --without debug
13
13
  services:
14
14
  - postgresql
15
15
  rvm:
16
- - 2.2.2
17
16
  - 2.3
18
17
  - 2.4
19
18
  - 2.5
20
19
  - 2.6
20
+ - 2.7
21
21
  - ruby-head
data/README.org CHANGED
@@ -963,28 +963,21 @@ You can sort a table on any number of columns with ~order_by~. The ~order_by~
963
963
  method takes any number of symbol arguments for the columns to sort on. If you
964
964
  specify more than one column, the sort is performed on the first column, then
965
965
  all columns that are equal with respect to the first column are sorted by the
966
- second column, and so on. All columns of the input table are included in the
967
- output.
966
+ second column, and so on. Ordering is done is ascending order for each of the
967
+ columns, but can be reversed by adding a '!' to the end a symbol argument.
968
+ All columns of the input table are included in the output.
968
969
 
969
- Let's sort our table first by ~:code~, then by ~:date~.
970
+ Let's sort our table first by ~:code~, then in reverse order of ~:date~.
970
971
 
971
972
  #+HEADER: :colnames no :session readme :hlines yes :wrap EXAMPLE :exports both
972
973
  #+BEGIN_SRC ruby
973
- tab1.order_by(:code, :date) \
974
+ tab1.order_by(:code, :date!) \
974
975
  .to_aoa
975
976
  #+END_SRC
976
977
 
977
- #+BEGIN_EXAMPLE
978
+ #+begin_EXAMPLE
978
979
  | Ref | Date | Code | Price | G10 | QP10 | Shares | Lp | Qp | Iplp | Ipqp |
979
980
  |------+------------+------+-------+-----+------+--------+------+-------+--------+--------|
980
- | T001 | 2016-11-01 | P | 7.7 | T | F | 100 | 14 | 86 | 0.2453 | 0.1924 |
981
- | T002 | 2016-11-01 | P | 7.75 | T | F | 200 | 28 | 172 | 0.2453 | 0.1924 |
982
- | T003 | 2016-11-01 | P | 7.5 | F | T | 800 | 112 | 688 | 0.2453 | 0.1924 |
983
- | T003 | 2016-11-01 | P | 7.5 | F | T | 800 | 112 | 688 | 0.2453 | 0.1924 |
984
- | T008 | 2016-11-01 | P | 7.65 | F | F | 2771 | 393 | 2378 | 0.2453 | 0.1924 |
985
- | T009 | 2016-11-01 | P | 7.6 | F | F | 9550 | 1363 | 8187 | 0.2453 | 0.1924 |
986
- | T010 | 2016-11-01 | P | 7.55 | F | T | 3175 | 451 | 2724 | 0.2453 | 0.1924 |
987
- |------+------------+------+-------+-----+------+--------+------+-------+--------+--------|
988
981
  | T011 | 2016-11-02 | P | 7.425 | T | F | 100 | 14 | 86 | 0.2453 | 0.1924 |
989
982
  | T012 | 2016-11-02 | P | 7.55 | F | F | 4700 | 677 | 4023 | 0.2453 | 0.1924 |
990
983
  | T012 | 2016-11-02 | P | 7.55 | F | F | 4700 | 677 | 4023 | 0.2453 | 0.1924 |
@@ -993,12 +986,20 @@ Let's sort our table first by ~:code~, then by ~:date~.
993
986
  | T015 | 2016-11-02 | P | 7.75 | F | F | 500 | 72 | 428 | 0.2453 | 0.1924 |
994
987
  | T016 | 2016-11-02 | P | 8.25 | T | T | 100 | 14 | 86 | 0.2453 | 0.1924 |
995
988
  |------+------------+------+-------+-----+------+--------+------+-------+--------+--------|
989
+ | T001 | 2016-11-01 | P | 7.7 | T | F | 100 | 14 | 86 | 0.2453 | 0.1924 |
990
+ | T002 | 2016-11-01 | P | 7.75 | T | F | 200 | 28 | 172 | 0.2453 | 0.1924 |
991
+ | T003 | 2016-11-01 | P | 7.5 | F | T | 800 | 112 | 688 | 0.2453 | 0.1924 |
992
+ | T003 | 2016-11-01 | P | 7.5 | F | T | 800 | 112 | 688 | 0.2453 | 0.1924 |
993
+ | T008 | 2016-11-01 | P | 7.65 | F | F | 2771 | 393 | 2378 | 0.2453 | 0.1924 |
994
+ | T009 | 2016-11-01 | P | 7.6 | F | F | 9550 | 1363 | 8187 | 0.2453 | 0.1924 |
995
+ | T010 | 2016-11-01 | P | 7.55 | F | T | 3175 | 451 | 2724 | 0.2453 | 0.1924 |
996
+ |------+------------+------+-------+-----+------+--------+------+-------+--------+--------|
996
997
  | T004 | 2016-11-01 | S | 7.55 | T | F | 6811 | 966 | 5845 | 0.2453 | 0.1924 |
997
998
  | T005 | 2016-11-01 | S | 7.5 | F | F | 4000 | 572 | 3428 | 0.2453 | 0.1924 |
998
999
  | T006 | 2016-11-01 | S | 7.6 | F | T | 1000 | 143 | 857 | 0.2453 | 0.1924 |
999
1000
  | T006 | 2016-11-01 | S | 7.6 | F | T | 1000 | 143 | 857 | 0.2453 | 0.1924 |
1000
1001
  | T007 | 2016-11-01 | S | 7.65 | T | F | 200 | 28 | 172 | 0.2453 | 0.1924 |
1001
- #+END_EXAMPLE
1002
+ #+end_EXAMPLE
1002
1003
 
1003
1004
  The interesting thing about ~order_by~ is that, while it ignores groups in its
1004
1005
  input, it adds group boundaries in the output table at those rows where the sort
@@ -1,7 +1,6 @@
1
1
  lib = File.expand_path('../lib', __FILE__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
  require 'fat_table/version'
4
- require 'fat_table/patches'
5
4
 
6
5
  Gem::Specification.new do |spec|
7
6
  spec.name = 'fat_table'
@@ -10,7 +9,7 @@ Gem::Specification.new do |spec|
10
9
  spec.email = ['ded-law@ddoherty.net']
11
10
 
12
11
  spec.summary = 'Provides tools for working with tables as a data type.'
13
- spec.description = <<-DESC.strip_heredoc
12
+ spec.description = <<-DESC
14
13
  FatTable is a gem that treats tables as a data type. It provides methods for
15
14
  constructing tables from a variety of sources, building them row-by-row,
16
15
  extracting rows, columns, and cells, and performing aggregate operations on
@@ -64,19 +63,20 @@ Gem::Specification.new do |spec|
64
63
  spec.require_paths = ['lib']
65
64
  spec.metadata['yard.run'] = 'yri' # use "yard" to build full HTML docs.
66
65
 
67
- spec.add_development_dependency 'bundler', '~> 1.14'
66
+ spec.add_development_dependency 'bundler'
68
67
  spec.add_development_dependency 'byebug'
69
68
  spec.add_development_dependency 'pry'
70
69
  spec.add_development_dependency 'pry-byebug'
71
70
  spec.add_development_dependency 'pry-doc'
72
- spec.add_development_dependency 'rake', '~> 10.0'
71
+ spec.add_development_dependency 'rake', '~> 13.0'
73
72
  spec.add_development_dependency 'redcarpet'
74
73
  spec.add_development_dependency 'rspec', '~> 3.0'
75
74
  spec.add_development_dependency 'rubocop-rspec'
75
+ spec.add_development_dependency 'rubocop-performance'
76
76
  spec.add_development_dependency 'simplecov'
77
77
 
78
78
  spec.add_runtime_dependency 'activesupport', '>3.0'
79
- spec.add_runtime_dependency 'fat_core', '~> 4.0', '>= 4.1'
79
+ spec.add_runtime_dependency 'fat_core', '>= 4.1'
80
80
  spec.add_runtime_dependency 'mysql2'
81
81
  spec.add_runtime_dependency 'pg'
82
82
  spec.add_runtime_dependency 'rainbow'
@@ -247,7 +247,7 @@ module FatTable
247
247
  cols.each do |c|
248
248
  hsh[c] = :avg
249
249
  end
250
- footer('Average', hsh)
250
+ footer('Average', **hsh)
251
251
  end
252
252
 
253
253
  # :category: Footers
@@ -258,7 +258,7 @@ module FatTable
258
258
  cols.each do |c|
259
259
  hsh[c] = :avg
260
260
  end
261
- gfooter('Group Average', hsh)
261
+ gfooter('Group Average', **hsh)
262
262
  end
263
263
 
264
264
  # :category: Footers
@@ -270,7 +270,7 @@ module FatTable
270
270
  cols.each do |c|
271
271
  hsh[c] = :min
272
272
  end
273
- footer('Minimum', hsh)
273
+ footer('Minimum', **hsh)
274
274
  end
275
275
 
276
276
  # :category: Footers
@@ -282,7 +282,7 @@ module FatTable
282
282
  cols.each do |c|
283
283
  hsh[c] = :min
284
284
  end
285
- gfooter('Group Minimum', hsh)
285
+ gfooter('Group Minimum', **hsh)
286
286
  end
287
287
 
288
288
  # :category: Footers
@@ -294,7 +294,7 @@ module FatTable
294
294
  cols.each do |c|
295
295
  hsh[c] = :max
296
296
  end
297
- footer('Maximum', hsh)
297
+ footer('Maximum', **hsh)
298
298
  end
299
299
 
300
300
  # :category: Footers
@@ -306,7 +306,7 @@ module FatTable
306
306
  cols.each do |c|
307
307
  hsh[c] = :max
308
308
  end
309
- gfooter('Group Maximum', hsh)
309
+ gfooter('Group Maximum', **hsh)
310
310
  end
311
311
 
312
312
  # :category: Formatting
@@ -418,7 +418,7 @@ module FatTable
418
418
  # \n\[niltext\]:: render a nil item with the given text.
419
419
  def format(**fmts)
420
420
  %i[header bfirst gfirst body footer gfooter].each do |loc|
421
- format_for(loc, fmts)
421
+ format_for(loc, **fmts)
422
422
  end
423
423
  self
424
424
  end
@@ -1369,7 +1369,7 @@ module FatTable
1369
1369
  # default format for Formatter, there is no class PsvFormatter as you might
1370
1370
  # expect.
1371
1371
  def to_psv(options = {})
1372
- fmt = Formatter.new(self, options)
1372
+ fmt = Formatter.new(self, **options)
1373
1373
  yield fmt if block_given?
1374
1374
  fmt.output
1375
1375
  end
@@ -1382,7 +1382,7 @@ module FatTable
1382
1382
  # the block to which formatting instructions and footers can be added by
1383
1383
  # calling methods on it.
1384
1384
  def to_aoa(options = {})
1385
- fmt = FatTable::AoaFormatter.new(self, options)
1385
+ fmt = FatTable::AoaFormatter.new(self, **options)
1386
1386
  yield fmt if block_given?
1387
1387
  fmt.output
1388
1388
  end
@@ -1396,7 +1396,7 @@ module FatTable
1396
1396
  # given, it yields an AohFormatter to the block to which formatting
1397
1397
  # instructions and footers can be added by calling methods on it.
1398
1398
  def to_aoh(options = {})
1399
- fmt = AohFormatter.new(self, options)
1399
+ fmt = AohFormatter.new(self, **options)
1400
1400
  yield fmt if block_given?
1401
1401
  fmt.output
1402
1402
  end
@@ -1409,7 +1409,7 @@ module FatTable
1409
1409
  # LaTeXFormatter to the block to which formatting instructions and footers
1410
1410
  # can be added by calling methods on it.
1411
1411
  def to_latex(options = {})
1412
- fmt = LaTeXFormatter.new(self, options)
1412
+ fmt = LaTeXFormatter.new(self, **options)
1413
1413
  yield fmt if block_given?
1414
1414
  fmt.output
1415
1415
  end
@@ -1422,7 +1422,7 @@ module FatTable
1422
1422
  # OrgFormatter to the block to which formatting instructions and footers can
1423
1423
  # be added by calling methods on it.
1424
1424
  def to_org(options = {})
1425
- fmt = OrgFormatter.new(self, options)
1425
+ fmt = OrgFormatter.new(self, **options)
1426
1426
  yield fmt if block_given?
1427
1427
  fmt.output
1428
1428
  end
@@ -1435,7 +1435,7 @@ module FatTable
1435
1435
  # given, it yields a TermFormatter to the block to which formatting
1436
1436
  # instructions and footers can be added by calling methods on it.
1437
1437
  def to_term(options = {})
1438
- fmt = TermFormatter.new(self, options)
1438
+ fmt = TermFormatter.new(self, **options)
1439
1439
  yield fmt if block_given?
1440
1440
  fmt.output
1441
1441
  end
@@ -1449,7 +1449,7 @@ module FatTable
1449
1449
  # footers can be added by calling methods on it.
1450
1450
  # @return [String]
1451
1451
  def to_text(options = {})
1452
- fmt = TextFormatter.new(self, options)
1452
+ fmt = TextFormatter.new(self, **options)
1453
1453
  yield fmt if block_given?
1454
1454
  fmt.output
1455
1455
  end
@@ -1,4 +1,4 @@
1
1
  module FatTable
2
2
  # The current version of FatTable
3
- VERSION = '0.2.9'.freeze
3
+ VERSION = '0.2.11'.freeze
4
4
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fat_table
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel E. Doherty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-04 00:00:00.000000000 Z
11
+ date: 2019-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.14'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.14'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: byebug
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '10.0'
89
+ version: '13.0'
90
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: '10.0'
96
+ version: '13.0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: redcarpet
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -136,6 +136,20 @@ dependencies:
136
136
  - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rubocop-performance
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: simplecov
141
155
  requirement: !ruby/object:Gem::Requirement
@@ -168,9 +182,6 @@ dependencies:
168
182
  name: fat_core
169
183
  requirement: !ruby/object:Gem::Requirement
170
184
  requirements:
171
- - - "~>"
172
- - !ruby/object:Gem::Version
173
- version: '4.0'
174
185
  - - ">="
175
186
  - !ruby/object:Gem::Version
176
187
  version: '4.1'
@@ -178,9 +189,6 @@ dependencies:
178
189
  prerelease: false
179
190
  version_requirements: !ruby/object:Gem::Requirement
180
191
  requirements:
181
- - - "~>"
182
- - !ruby/object:Gem::Version
183
- version: '4.0'
184
192
  - - ">="
185
193
  - !ruby/object:Gem::Version
186
194
  version: '4.1'
@@ -264,7 +272,8 @@ description: |2
264
272
  duplicate rows, group_by for aggregating multiple rows into single rows and
265
273
  applying column aggregate methods to ungrouped columns, a collection of join
266
274
  methods for combining tables, and more.
267
- Furthermore, FatTable provides methods for formatting tables and producing
275
+
276
+ Furthermore, FatTable provides methods for formatting tables and producing
268
277
  output that targets various output media: text, ANSI terminals, ruby data
269
278
  structures, LaTeX tables, Emacs org-mode tables, and more. The formatting
270
279
  methods can specify cell formatting in a way that is uniform across all the
@@ -272,7 +281,8 @@ description: |2
272
281
  including group footers. FatTable applies formatting directives to the extent
273
282
  they makes sense for the output medium and treats other formatting directives as
274
283
  no-ops.
275
- FatTable can be used to perform operations on data that are naturally best
284
+
285
+ FatTable can be used to perform operations on data that are naturally best
276
286
  conceived of as tables, which in my experience is quite often. It can also serve
277
287
  as a foundation for providing reporting functions where flexibility about the
278
288
  output medium can be quite useful. Finally FatTable can be used within Emacs
@@ -290,6 +300,7 @@ extra_rdoc_files: []
290
300
  files:
291
301
  - ".gitignore"
292
302
  - ".rspec"
303
+ - ".rubocop.yml"
293
304
  - ".travis.yml"
294
305
  - ".yardopts"
295
306
  - Gemfile
@@ -338,7 +349,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
338
349
  - !ruby/object:Gem::Version
339
350
  version: '0'
340
351
  requirements: []
341
- rubygems_version: 3.0.3
352
+ rubygems_version: 3.1.2
342
353
  signing_key:
343
354
  specification_version: 4
344
355
  summary: Provides tools for working with tables as a data type.