tty-table 0.10.0 → 0.11.0

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.
Files changed (150) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +13 -0
  3. data/README.md +67 -3
  4. data/Rakefile +2 -0
  5. data/lib/tty-table.rb +0 -3
  6. data/lib/tty/table.rb +35 -12
  7. data/lib/tty/table/alignment_set.rb +2 -2
  8. data/lib/tty/table/border.rb +6 -3
  9. data/lib/tty/table/border/ascii.rb +1 -1
  10. data/lib/tty/table/border/null.rb +3 -2
  11. data/lib/tty/table/border/row_line.rb +1 -1
  12. data/lib/tty/table/border/unicode.rb +1 -2
  13. data/lib/tty/table/border_dsl.rb +3 -3
  14. data/lib/tty/table/border_options.rb +21 -1
  15. data/lib/tty/table/column_constraint.rb +1 -1
  16. data/lib/tty/table/columns.rb +0 -1
  17. data/lib/tty/table/empty.rb +2 -0
  18. data/lib/tty/table/error.rb +1 -1
  19. data/lib/tty/table/field.rb +1 -1
  20. data/lib/tty/table/header.rb +1 -1
  21. data/lib/tty/table/indentation.rb +2 -3
  22. data/lib/tty/table/operation/alignment.rb +8 -6
  23. data/lib/tty/table/operation/escape.rb +1 -1
  24. data/lib/tty/table/operation/filter.rb +1 -1
  25. data/lib/tty/table/operation/padding.rb +1 -9
  26. data/lib/tty/table/operation/truncation.rb +1 -1
  27. data/lib/tty/table/operation/wrapped.rb +1 -1
  28. data/lib/tty/table/operations.rb +1 -1
  29. data/lib/tty/table/options.rb +1 -1
  30. data/lib/tty/table/orientation.rb +1 -1
  31. data/lib/tty/table/orientation/horizontal.rb +1 -1
  32. data/lib/tty/table/orientation/vertical.rb +1 -1
  33. data/lib/tty/table/renderer.rb +4 -4
  34. data/lib/tty/table/renderer/ascii.rb +1 -1
  35. data/lib/tty/table/renderer/basic.rb +19 -20
  36. data/lib/tty/table/renderer/unicode.rb +1 -1
  37. data/lib/tty/table/row.rb +2 -2
  38. data/lib/tty/table/transformation.rb +2 -2
  39. data/lib/tty/table/validatable.rb +1 -1
  40. data/lib/tty/table/version.rb +3 -1
  41. data/spec/spec_helper.rb +1 -1
  42. data/spec/unit/access_spec.rb +1 -3
  43. data/spec/unit/add_row_spec.rb +1 -3
  44. data/spec/unit/alignment_set/each_spec.rb +1 -3
  45. data/spec/unit/alignment_set/new_spec.rb +1 -3
  46. data/spec/unit/alignment_set/to_ary_spec.rb +1 -3
  47. data/spec/unit/alignment_spec.rb +1 -3
  48. data/spec/unit/border/ascii/rendering_spec.rb +1 -3
  49. data/spec/unit/border/new_spec.rb +1 -3
  50. data/spec/unit/border/null/rendering_spec.rb +1 -3
  51. data/spec/unit/border/options/from_spec.rb +1 -3
  52. data/spec/unit/border/options/new_spec.rb +1 -3
  53. data/spec/unit/border/unicode/rendering_spec.rb +1 -3
  54. data/spec/unit/border_options/new_spec.rb +1 -3
  55. data/spec/unit/border_options/update_spec.rb +1 -3
  56. data/spec/unit/column_constraint/enforce_spec.rb +1 -3
  57. data/spec/unit/column_constraint/widths_spec.rb +1 -3
  58. data/spec/unit/columns/extract_widths_spec.rb +1 -1
  59. data/spec/unit/columns/total_width_spec.rb +0 -1
  60. data/spec/unit/columns/widths_from_spec.rb +1 -1
  61. data/spec/unit/data_spec.rb +1 -3
  62. data/spec/unit/each_spec.rb +1 -3
  63. data/spec/unit/each_with_index_spec.rb +1 -3
  64. data/spec/unit/empty_spec.rb +1 -3
  65. data/spec/unit/eql_spec.rb +1 -3
  66. data/spec/unit/field/equality_spec.rb +1 -3
  67. data/spec/unit/field/length_spec.rb +1 -3
  68. data/spec/unit/field/lines_spec.rb +1 -3
  69. data/spec/unit/field/new_spec.rb +1 -3
  70. data/spec/unit/field/width_spec.rb +1 -3
  71. data/spec/unit/filter_spec.rb +1 -3
  72. data/spec/unit/header/call_spec.rb +1 -3
  73. data/spec/unit/header/color_spec.rb +1 -3
  74. data/spec/unit/header/equality_spec.rb +1 -3
  75. data/spec/unit/header/height_spec.rb +1 -3
  76. data/spec/unit/header/new_spec.rb +1 -4
  77. data/spec/unit/header/set_spec.rb +1 -3
  78. data/spec/unit/header/to_ary_spec.rb +1 -3
  79. data/spec/unit/header_spec.rb +1 -3
  80. data/spec/unit/indentation/indent_spec.rb +1 -3
  81. data/spec/unit/new_spec.rb +1 -3
  82. data/spec/unit/operation/alignment/call_spec.rb +1 -3
  83. data/spec/unit/operation/escape/call_spec.rb +1 -3
  84. data/spec/unit/operation/filter/call_spec.rb +1 -3
  85. data/spec/unit/operation/truncation/call_spec.rb +1 -3
  86. data/spec/unit/operation/wrapped/call_spec.rb +1 -3
  87. data/spec/unit/operations/new_spec.rb +1 -1
  88. data/spec/unit/options/access_spec.rb +1 -3
  89. data/spec/unit/options_spec.rb +1 -3
  90. data/spec/unit/orientation_spec.rb +1 -3
  91. data/spec/unit/padding_spec.rb +1 -3
  92. data/spec/unit/properties_spec.rb +1 -3
  93. data/spec/unit/render_repeat_spec.rb +1 -4
  94. data/spec/unit/render_spec.rb +1 -3
  95. data/spec/unit/render_with_spec.rb +1 -3
  96. data/spec/unit/renderer/ascii/coloring_spec.rb +16 -3
  97. data/spec/unit/renderer/ascii/indentation_spec.rb +1 -3
  98. data/spec/unit/renderer/ascii/multiline_spec.rb +1 -3
  99. data/spec/unit/renderer/ascii/padding_spec.rb +1 -3
  100. data/spec/unit/renderer/ascii/render_spec.rb +1 -3
  101. data/spec/unit/renderer/ascii/resizing_spec.rb +1 -3
  102. data/spec/unit/renderer/ascii/separator_spec.rb +14 -4
  103. data/spec/unit/renderer/basic/alignment_spec.rb +1 -3
  104. data/spec/unit/renderer/basic/coloring_spec.rb +1 -3
  105. data/spec/unit/renderer/basic/extract_column_widths_spec.rb +1 -3
  106. data/spec/unit/renderer/basic/filter_spec.rb +1 -3
  107. data/spec/unit/renderer/basic/indentation_spec.rb +1 -3
  108. data/spec/unit/renderer/basic/multiline_spec.rb +1 -3
  109. data/spec/unit/renderer/basic/new_spec.rb +1 -3
  110. data/spec/unit/renderer/basic/options_spec.rb +1 -3
  111. data/spec/unit/renderer/basic/padding_spec.rb +1 -3
  112. data/spec/unit/renderer/basic/render_spec.rb +1 -3
  113. data/spec/unit/renderer/basic/resizing_spec.rb +1 -3
  114. data/spec/unit/renderer/basic/separator_spec.rb +1 -3
  115. data/spec/unit/renderer/basic/single_row_separator_spec.rb +80 -0
  116. data/spec/unit/renderer/basic/truncation_spec.rb +1 -3
  117. data/spec/unit/renderer/basic/wrapping_spec.rb +1 -3
  118. data/spec/unit/renderer/border_spec.rb +1 -3
  119. data/spec/unit/renderer/render_spec.rb +1 -3
  120. data/spec/unit/renderer/select_spec.rb +1 -3
  121. data/spec/unit/renderer/unicode/coloring_spec.rb +1 -3
  122. data/spec/unit/renderer/unicode/indentation_spec.rb +1 -3
  123. data/spec/unit/renderer/unicode/padding_spec.rb +1 -3
  124. data/spec/unit/renderer/unicode/render_spec.rb +1 -3
  125. data/spec/unit/renderer/unicode/separator_spec.rb +13 -3
  126. data/spec/unit/renderer_spec.rb +1 -3
  127. data/spec/unit/rotate_spec.rb +1 -3
  128. data/spec/unit/row/access_spec.rb +1 -3
  129. data/spec/unit/row/call_spec.rb +1 -3
  130. data/spec/unit/row/data_spec.rb +1 -3
  131. data/spec/unit/row/each_spec.rb +1 -3
  132. data/spec/unit/row/equality_spec.rb +1 -3
  133. data/spec/unit/row/height_spec.rb +1 -3
  134. data/spec/unit/row/new_spec.rb +1 -3
  135. data/spec/unit/row/to_ary_spec.rb +1 -3
  136. data/spec/unit/to_s_spec.rb +1 -1
  137. data/spec/unit/transformation/extract_tuples_spec.rb +1 -3
  138. data/spec/unit/utf_spec.rb +1 -3
  139. data/spec/unit/validatable/validate_options_spec.rb +1 -3
  140. data/spec/unit/validatable_spec.rb +1 -3
  141. data/tasks/console.rake +1 -0
  142. data/tty-table.gemspec +19 -10
  143. metadata +21 -27
  144. data/.gitignore +0 -14
  145. data/.rspec +0 -3
  146. data/.travis.yml +0 -26
  147. data/CODE_OF_CONDUCT.md +0 -49
  148. data/Gemfile +0 -17
  149. data/appveyor.yml +0 -21
  150. data/benchmarks/speed.rb +0 -39
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: c5a7d889fe3c0a30613340ff98741bdf6fe60e59
4
- data.tar.gz: 41477fe8e7edddf80275eb253c5505efcde49b1b
2
+ SHA256:
3
+ metadata.gz: 7e62b5af0c89b3acf1aa73598053bc5b5f364d9f346fc40e20129d2a639c3919
4
+ data.tar.gz: 812b92b6eccf2743f121bfd85c069f833e0e3d80507526a8c1cabfacb776df15
5
5
  SHA512:
6
- metadata.gz: 28d1f65541cd25ba4dab63f85cdc66294a67e485ca88424ddf0386824b2a28744d2b5143c0880a7eb6d7ba51597a85d4df3c5bf824285f782961c6964d39c6fc
7
- data.tar.gz: 30e29bacb151c98f5cb41f0b09a53ac3cb53e1cbb030493362713522d7ffc7f2fce6a8cca00edde189e940626cf6848614394365f55af3dd34c5b5b1ff88f651
6
+ metadata.gz: bdc6608e3633b35eaed9481e545732c6d55f9ec43823ca111b08b177edb03046e1710221d36e7e4b6df8980d8555ebfecfdfc07535786199ae04f37e18423228
7
+ data.tar.gz: 1a77ffd2f0ef11427c5bb4769edb6ec41f691f0226f6f216c3988abd19519ce5ab84685de4b90d7a2f590023b3fedde2a075a4b80f7992b74a6160be909280a6
@@ -1,5 +1,17 @@
1
1
  # Change log
2
2
 
3
+ ## [v0.11.0] - 2019-08-01
4
+
5
+ ### Add
6
+ * Add ability to specify border separator as an Array, Proc value by Mitch VanDuyn(@catmando)
7
+
8
+ ### Changed
9
+ * Change Indentation#indent to stop mutating input
10
+ * Change gemspec to load files directly
11
+ * Change to freeze strings
12
+ * Change to relax constraints on tty-screen & equatable
13
+ * Change to remove upper boundary on bundler dev dependency
14
+
3
15
  ## [v0.10.0] - 2018-02-18
4
16
 
5
17
  ### Changed
@@ -91,6 +103,7 @@
91
103
 
92
104
  * Initial implementation and release
93
105
 
106
+ [v0.11.0]: https://github.com/piotrmurach/tty-table/compare/v0.10.0...v0.11.0
94
107
  [v0.10.0]: https://github.com/piotrmurach/tty-table/compare/v0.9.0...v0.10.0
95
108
  [v0.9.0]: https://github.com/piotrmurach/tty-table/compare/v0.8.0...v0.9.0
96
109
  [v0.8.0]: https://github.com/piotrmurach/tty-table/compare/v0.7.0...v0.8.0
data/README.md CHANGED
@@ -1,4 +1,9 @@
1
+ <div align="center">
2
+ <a href="https://piotrmurach.github.io/tty" target="_blank"><img width="130" src="https://github.com/piotrmurach/tty/blob/master/images/tty.png" alt="tty logo" /></a>
3
+ </div>
4
+
1
5
  # TTY::Table [![Gitter](https://badges.gitter.im/Join%20Chat.svg)][gitter]
6
+
2
7
  [![Gem Version](https://badge.fury.io/rb/tty-table.svg)][gem]
3
8
  [![Build Status](https://secure.travis-ci.org/piotrmurach/tty-table.svg?branch=master)][travis]
4
9
  [![Build status](https://ci.appveyor.com/api/projects/status/8fxrbawbyomqd979?svg=true)][appveyor]
@@ -152,7 +157,7 @@ table.each_with_index { |row, index| ... } # iterate over rows with an index
152
157
 
153
158
  ### 2.3 Access
154
159
 
155
- In order to referene the row at `index` do:
160
+ In order to reference the row at `index` do:
156
161
 
157
162
  ```ruby
158
163
  table = TTY::Table.new [['a1','a2'], ['b1','b2']]
@@ -520,7 +525,7 @@ table.render_with MyBorder
520
525
 
521
526
  #### 3.5.3 Separator
522
527
 
523
- In addition to specifying border characters you can force table to render separator line on each row like:
528
+ In addition to specifying border characters you can force the table to render a separator line on each row like:
524
529
 
525
530
  ```ruby
526
531
  table = TTY::Table.new ['header1', 'header2'], [['a1', 'a2'], ['b1', 'b2']]
@@ -537,6 +542,65 @@ end
537
542
  # +-------+-------+
538
543
  ```
539
544
 
545
+ If you want more control you can provide an array of rows *after* which a separator will be added:
546
+
547
+ ```ruby
548
+ table = TTY::Table.new ['header1', 'header2'], [['a1', 'a2'], ['b1', 'b2'], ['c1', 'c2']]
549
+ table.render do |renderer|
550
+ renderer.border.separator = [0, 2]
551
+ end
552
+ # =>
553
+ # +-------+-------+
554
+ # |header1|header2|
555
+ # +-------+-------+
556
+ # |a1 |a2 |
557
+ # |b1 |b2 |
558
+ # +-------+-------+
559
+ # |c1 |c2 |
560
+ # +-------+-------+
561
+ ```
562
+
563
+ **Note:** if you supply a detailed list of rows to separate, then the separator between the header and the rows
564
+ will not be automatically added.
565
+
566
+ You can also give the separator option a proc to control where the separators are:
567
+
568
+ ```ruby
569
+ table = TTY::Table.new ['header1', 'header2'],
570
+ [['a1', 'a2'], ['b1', 'b2'], ['c1', 'c2'], ['d1', 'd2']]
571
+ table.render do |renderer|
572
+ renderer.border.separator = ->(row) { row == 0 || (row+1) % 2 == 0} # separate every two rows
573
+ end
574
+ # =>
575
+ # +-------+-------+
576
+ # |header1|header2|
577
+ # +-------+-------+
578
+ # |a1 |a2 |
579
+ # |b1 |b2 |
580
+ # +-------+-------+
581
+ # |c1 |c2 |
582
+ # |d1 |d2 |
583
+ # +-------+-------+
584
+ ```
585
+
586
+ Finally you can also position a separator using the `:separator` key word in place of a row:
587
+
588
+ ```ruby
589
+ table = TTY::Table.new ['header1', 'header2'],
590
+ [:separator, ['a1', 'a2'], ['b1', 'b2']]
591
+ table << :separator << ['c1', 'c2'] # you can push separators on too!
592
+ table.render
593
+ # =>
594
+ # +-------+-------+
595
+ # |header1|header2|
596
+ # +-------+-------+
597
+ # |a1 |a2 |
598
+ # |b1 |b2 |
599
+ # +-------+-------+
600
+ # |c1 |c2 |
601
+ # +-------+-------+
602
+ ```
603
+
540
604
  #### 3.5.4 Style
541
605
 
542
606
  If you want to change the display color of your border do:
@@ -710,4 +774,4 @@ This project is intended to be a safe, welcoming space for collaboration, and co
710
774
 
711
775
  ## Copyright
712
776
 
713
- Copyright (c) 2015-2018 Piotr Murach. See LICENSE for further details.
777
+ Copyright (c) 2015 Piotr Murach. See LICENSE for further details.
data/Rakefile CHANGED
@@ -6,3 +6,5 @@ FileList['tasks/**/*.rake'].each(&method(:import))
6
6
 
7
7
  desc 'Run all specs'
8
8
  task ci: %w[ spec ]
9
+
10
+ task default: :spec
@@ -1,4 +1 @@
1
- # encoding: utf-8
2
-
3
- require_relative 'tty/table/version'
4
1
  require_relative 'tty/table'
@@ -1,4 +1,4 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'equatable'
4
4
  require 'forwardable'
@@ -11,6 +11,7 @@ require_relative 'table/row'
11
11
  require_relative 'table/renderer'
12
12
  require_relative 'table/transformation'
13
13
  require_relative 'table/validatable'
14
+ require_relative 'table/version'
14
15
 
15
16
  module TTY
16
17
  # A core class intended for storing data in a structured, tabular form.
@@ -37,21 +38,21 @@ module TTY
37
38
 
38
39
  # The table orientation out of :horizontal and :vertical
39
40
  #
40
- # @reutrn [TTY::Table::Orientation]
41
+ # @return [TTY::Table::Orientation]
41
42
  #
42
43
  # @api public
43
44
  attr_reader :orientation
44
45
 
45
46
  # The table original row count
46
47
  #
47
- # @reutrn [Integer]
48
+ # @return [Integer]
48
49
  #
49
50
  # @api public
50
51
  attr_reader :original_rows
51
52
 
52
53
  # The table original column count
53
54
  #
54
- # @reutrn [Integer]
55
+ # @return [Integer]
55
56
  #
56
57
  # @api public
57
58
  attr_reader :original_columns
@@ -86,7 +87,7 @@ module TTY
86
87
  # @example of parameters passed as hash
87
88
  # Table.new [{'Header1' => ['a1','a2'], 'Header2' => ['b1', 'b2'] }]}
88
89
  #
89
- # @param [Array[Symbol], Hash] *args
90
+ # @param [Array[Symbol], Hash] args
90
91
  #
91
92
  # @api public
92
93
  def self.new(*args, &block)
@@ -126,6 +127,15 @@ module TTY
126
127
  yield_or_eval(&block) if block_given?
127
128
  end
128
129
 
130
+ # Provides a list of rows to have separations applied
131
+ #
132
+ # @return [Array]
133
+ #
134
+ # @api public
135
+ def separators
136
+ @separators ||= []
137
+ end
138
+
129
139
  # Provides access to all table data
130
140
  #
131
141
  # @return [Array]
@@ -285,9 +295,13 @@ module TTY
285
295
  #
286
296
  # @api public
287
297
  def <<(row)
288
- rows_copy = rows.dup
289
- assert_row_sizes rows_copy << row
290
- rows << to_row(row)
298
+ if row == Border::SEPARATOR
299
+ separators << columns_size - (header ? 0 : 2)
300
+ else
301
+ rows_copy = rows.dup
302
+ assert_row_sizes rows_copy << row
303
+ rows << to_row(row)
304
+ end
291
305
  self
292
306
  end
293
307
 
@@ -428,10 +442,12 @@ module TTY
428
442
 
429
443
  # Render a given table using custom border class.
430
444
  #
431
- # @param [TTY::Table::Border]
445
+ # @param [TTY::Table::Border] border_class
432
446
  #
433
447
  # @param [Symbol] renderer_type
434
448
  #
449
+ # @param [Hash] options
450
+ #
435
451
  # @yield [renderer]
436
452
  #
437
453
  # @yieldparam [TTY::Table::Renderer] renderer
@@ -456,15 +472,22 @@ module TTY
456
472
  # This coercion mechanism is used by Table to handle Enumerable types
457
473
  # and force them into array type.
458
474
  #
459
- # @param [Enumerable] object
475
+ # @param [Enumerable] rows
460
476
  # the object to coerce
461
477
  #
462
478
  # @return [Array]
463
479
  #
464
480
  # @api public
465
481
  def coerce(rows)
466
- rows = @converter.convert(rows).to(:array)
467
- rows.map { |row| to_row(row, header) }
482
+ coerced_rows = []
483
+ @converter.convert(rows).to(:array).each do |row|
484
+ if row == Border::SEPARATOR
485
+ separators << coerced_rows.length - (header ? 0 : 1)
486
+ else
487
+ coerced_rows << to_row(row, header)
488
+ end
489
+ end
490
+ coerced_rows
468
491
  end
469
492
 
470
493
  private
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'necromancer'
4
4
 
@@ -39,7 +39,7 @@ module TTY
39
39
 
40
40
  # Lookup an alignment by index
41
41
  #
42
- # @param [Integer]
42
+ # @param [Integer] index
43
43
  #
44
44
  # @return [Symbol] alignment
45
45
  #
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'equatable'
4
4
  require 'pastel'
@@ -22,6 +22,9 @@ module TTY
22
22
  # Represent a separtor on each row
23
23
  EACH_ROW = :each_row
24
24
 
25
+ # specify a separator as a row
26
+ SEPARATOR = :separator
27
+
25
28
  class << self
26
29
  # Store characters for border
27
30
  #
@@ -138,7 +141,7 @@ module TTY
138
141
  #
139
142
  # @param [Symbol] color
140
143
  #
141
- # @param [Array[String]] array of strings
144
+ # @param [Array[String]] strings array of strings
142
145
  #
143
146
  # @return [Array[String]]
144
147
  #
@@ -188,7 +191,7 @@ module TTY
188
191
  # @param [TTY::Table::Row] row
189
192
  # the table row
190
193
  #
191
- # @param [Integer] line
194
+ # @param [Integer] line_index
192
195
  # the index for current line inside multiline
193
196
  #
194
197
  # @param [TTY::Table::Border::RowLine] line
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require_relative '../border'
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require_relative '../border'
4
4
 
@@ -23,7 +23,8 @@ module TTY
23
23
  #
24
24
  # @api private
25
25
  def separator
26
- return [] if border_options.separator == EACH_ROW
26
+ return [] if border_options.separator # == EACH_ROW #TODO ask about this looks broken.
27
+ # how could border_options ever be nil, if we just did border_options.separator
27
28
  border_options ? super : nil
28
29
  end
29
30
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  module TTY
4
4
  class Table
@@ -1,6 +1,5 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
- #require 'tty/table/border'
4
3
  require_relative '../border'
5
4
 
6
5
  module TTY
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'forwardable'
4
4
 
@@ -37,7 +37,7 @@ module TTY
37
37
 
38
38
  # Apply style color to the border
39
39
  #
40
- # @param [Symbol] style
40
+ # @param [Symbol] value
41
41
  # the style color for the border
42
42
  #
43
43
  # @return [undefined]
@@ -50,7 +50,7 @@ module TTY
50
50
 
51
51
  # Apply table tuple separator
52
52
  #
53
- # @param [Symbol] separator
53
+ # @param [Symbol] value
54
54
  # the table tuple separator
55
55
  #
56
56
  # @return [undefined]
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  module TTY
4
4
  class Table
@@ -48,6 +48,26 @@ module TTY
48
48
  end
49
49
  hash
50
50
  end
51
+
52
+ # return true if there should be a separator AFTER this line
53
+ #
54
+ # @param [Integer] line
55
+ #
56
+ # @return [Boolean]
57
+ #
58
+ # @api public
59
+ def separator?(line)
60
+ case separator
61
+ when TTY::Table::Border::EACH_ROW
62
+ true
63
+ when Array
64
+ separator.include?(line)
65
+ when Proc
66
+ separator.call(line)
67
+ else
68
+ false
69
+ end
70
+ end
51
71
  end # BorderOptions
52
72
  end # Table
53
73
  end # TTY
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require_relative 'border/null'
4
4
  require_relative 'columns'
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  require_relative 'error'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module TTY
2
4
  class Table
3
5
  class Empty < TTY::Table
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  module TTY
4
4
  class Table
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'equatable'
4
4
  require 'pastel'
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'forwardable'
4
4