tabulo 2.6.1 → 2.6.2

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: 5bf2b89914117264e5f213553c792d1456d4f5d99ae8afac565ff1dbc069400b
4
- data.tar.gz: 6220df7007ae352c400291101f6308f99ad063fe98c5820820da599f674d4a43
3
+ metadata.gz: dde64a0fb26dfd5b5624fc18d4c442989cf81433371267d2ce52dbcac4137433
4
+ data.tar.gz: b0bc0295c6bb8fa5bbaf855ede1dc44fea722acfd23f2b74e1db68b36396e5df
5
5
  SHA512:
6
- metadata.gz: 13228bb55890713cb9483f18d55339dcf7393aff65a7f91383eb9a5d7dce03acd968e09e883ae3f72088e4d543d1bdc962cb38a0c9444cdd1a93482c55f9c354
7
- data.tar.gz: e865337603240b4b8456f5b2b7bbb64f660b18acfc4caf0318ef9869f58070801da24bbdd7de740133a6ef386d5c6c02ee198098605fb7a13acd60547bbdb04e
6
+ metadata.gz: 9dddd9de39377071967c86f75e65a175352f33966d52d39e5dd725012a7a5531415870b0e95a7ce546e9bec0af4c15a0fefd2a50eb3585a64a93ed99cae3bd37
7
+ data.tar.gz: b936c064abfab53617eb82f7977dd2f7b1957115990ea301d211de8f23661667ada82a92fd2dbdc9c34d0d741ce00b1a3dd03a655fe73b855f610cfb663fe298
@@ -7,4 +7,4 @@ rvm:
7
7
  - 2.4.10
8
8
  - 2.5.8
9
9
  - 2.6.6
10
- - 2.7.1
10
+ - 2.7.2
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ### v2.6.2
4
+
5
+ * Ensure line break character sequences are property formatted in output, regardless
6
+ of whether they are "\r\n", "\r" or "\n".
7
+
3
8
  ### v2.6.1
4
9
 
5
10
  * Update dependency versions
data/README.md CHANGED
@@ -16,19 +16,19 @@ or “ASCII tables”). It is both highly configurable and very easy to
16
16
  _Quick API:_
17
17
 
18
18
  ```
19
- > puts Tabulo::Table.new(User.all, :id, :first_name, :last_name, border: :modern).pack
20
- ┌────┬────────────┬───────────┐
21
- id first_name last_name
22
- ├────┼────────────┼───────────┤
23
- 1 John Citizen
24
- 2 Jane Doe
25
- └────┴────────────┴───────────┘
19
+ > puts Tabulo::Table.new(User.all, :id, :first_name, :last_name).pack
20
+ +----+------------+-----------+
21
+ | id | first_name | last_name |
22
+ +----+------------+-----------+
23
+ | 1 | John | Citizen |
24
+ | 2 | Jane | Doe |
25
+ +----+------------+-----------+
26
26
  ```
27
27
 
28
28
  _Full API:_
29
29
 
30
30
  ```
31
- table = Tabulo::Table.new(User.all, border: :modern) do |t|
31
+ table = Tabulo::Table.new(User.all) do |t|
32
32
  t.add_column("ID", &:id)
33
33
  t.add_column("First name", &:first_name)
34
34
  t.add_column("Last name") { |user| user.last_name.upcase }
@@ -37,12 +37,12 @@ end
37
37
 
38
38
  ```
39
39
  > puts table.pack
40
- ┌────┬────────────┬───────────┐
41
- ID First name Last name
42
- ├────┼────────────┼───────────┤
43
- 1 John CITIZEN
44
- 2 Jane DOE
45
- └────┴────────────┴───────────┘
40
+ +----+------------+-----------+
41
+ | ID | First name | Last name |
42
+ +----+------------+-----------+
43
+ | 1 | John | CITIZEN |
44
+ | 2 | Jane | DOE |
45
+ +----+------------+-----------+
46
46
  ```
47
47
 
48
48
  <a name="features"></a>
@@ -600,7 +600,7 @@ The character used to indicate truncation, which defaults to `~`, can be configu
600
600
  #### Manual cell wrapping [&#x2191;](#contents)
601
601
 
602
602
  You can &ldquo;manually&rdquo; wrap the content of a title, header or body cell at a particular
603
- point, simply by placing a newline character at that point:
603
+ point, simply by placing a newline character, at that point:
604
604
 
605
605
  ```ruby
606
606
  table = Tabulo::Table.new(1..3) do |t|
@@ -622,6 +622,11 @@ end
622
622
  +--------------+--------------+--------------+
623
623
  ```
624
624
 
625
+ Tabulo will treat any of the character combinations `"\n"`, `"\r\n"` or `"\r"` equally, as a line break,
626
+ regardless of the platform it&#8217;s currently being run on. This ensures things are formatted as
627
+ expected if, for example, you are examining content that was produced on another platform from
628
+ the one you&#8217;re running Tabulo on.
629
+
625
630
  <a name="formatting-cell-values"></a>
626
631
  ### Formatting cell values [&#x2191;](#contents)
627
632
 
@@ -683,7 +688,7 @@ the table.
683
688
  The `formatter` callback also has an alternative, 2-parameter version. If `formatter` is passed
684
689
  a 2-parameter callable, the second parameter will be given a `CellData` instance,
685
690
  containing additional information about the cell that may be useful in determining how to format
686
- it&mdash;see the [documentation](https://www.rubydoc.info/gems/tabulo/2.6.1/Tabulo/CellData.html)
691
+ it&mdash;see the [documentation](https://www.rubydoc.info/gems/tabulo/2.6.2/Tabulo/CellData.html)
687
692
  for details.
688
693
 
689
694
  <a name="colours-and-styling"></a>
@@ -729,7 +734,7 @@ number is even). The second parameter represents the formatted string value of t
729
734
  content after any processing by the [formatter](#formatting-cell-values). The third and fourth
730
735
  parameters are optional, and contain further information about the cell and its contents that may be useful in
731
736
  determining how to style it. See the
732
- [documentation](https://www.rubydoc.info/gems/tabulo/2.6.1/Tabulo/Table#add_column-instance_method) for details.
737
+ [documentation](https://www.rubydoc.info/gems/tabulo/2.6.2/Tabulo/Table#add_column-instance_method) for details.
733
738
 
734
739
  If the content of a cell is wrapped over multiple lines, then the `styler` will be called once
735
740
  per line, so that each line of the cell will have the escape sequence applied to it separately
@@ -749,7 +754,7 @@ table.add_column(:even?, header_styler: -> (s) { "\033[32m#{s}\033[0m" })
749
754
  ```
750
755
 
751
756
  The `header_styler` option accepts a 1-, 2- or 3-parameter callable. See the
752
- [documentation](https://www.rubydoc.info/gems/tabulo/2.6.1/Tabulo/Table#add_column-instance_method)
757
+ [documentation](https://www.rubydoc.info/gems/tabulo/2.6.2/Tabulo/Table#add_column-instance_method)
753
758
  for details.
754
759
 
755
760
  <a name="styling-title"></a>
@@ -763,7 +768,7 @@ table = Tabulo::Table.new(1..5, :itself, :even?, :odd?, title: "Numbers", title_
763
768
  ```
764
769
 
765
770
  The `title_styler` option accepts a 1- or 2-parameter callable. See the
766
- [documentation](https://www.rubydoc.info/gems/tabulo/2.6.1/Tabulo/Table#initialize-instance_method)
771
+ [documentation](https://www.rubydoc.info/gems/tabulo/2.6.2/Tabulo/Table#initialize-instance_method)
767
772
  for details.
768
773
 
769
774
  <a name="styling-borders"></a>
@@ -958,7 +963,7 @@ a new table in which the rows and columns are swapped:
958
963
  By default, a header row is added to the new table, showing the string value of the element
959
964
  represented in that column. This can be configured, however, along with other aspects of
960
965
  `transpose`&#8217;s behaviour. For details, see the
961
- [documentation](https://www.rubydoc.info/gems/tabulo/2.6.1/Tabulo/Table#transpose-instance_method).
966
+ [documentation](https://www.rubydoc.info/gems/tabulo/2.6.2/Tabulo/Table#transpose-instance_method).
962
967
 
963
968
  <a name="borders"></a>
964
969
  ### Configuring borders [&#x2191;](#contents)
@@ -1014,6 +1019,10 @@ This is done using the `border` option passed to `Table.new`. The options are as
1014
1019
  └──────────────┴──────────────┴──────────────┘
1015
1020
  ```
1016
1021
 
1022
+ _Note: The unicode characters used for the `:modern` border may not render properly
1023
+ when viewing this documentation on some browsers or devices. This doesn&#8217;t reflect any brokenness
1024
+ in `tabulo` itself._
1025
+
1017
1026
  `:markdown`&mdash;renders a GitHub flavoured Markdown table:
1018
1027
 
1019
1028
  ```
@@ -1103,6 +1112,10 @@ generally support adding a caption (i.e. title) element to tables.
1103
1112
  ────────────── ────────────── ──────────────
1104
1113
  ```
1105
1114
 
1115
+ _Note: The unicode characters used for the `:reduced_modern` border may not render properly
1116
+ when viewing this documentation on some browsers or devices. This doesn&#8217;t reflect any brokenness
1117
+ in `tabulo` itself._
1118
+
1106
1119
  `:classic`&mdash;reproduces the default behaviour in Tabulo v1; this is like the `:ascii` option,
1107
1120
  but without a bottom border:
1108
1121
 
@@ -1156,16 +1169,16 @@ every Nth row. For example:
1156
1169
  If you want a line before every row, pass `1` to `row_divider_frequency`. For example:
1157
1170
 
1158
1171
  ```
1159
- > puts Tabulo::Table.new(1..3, :itself, :even?, :odd?, border: :modern, row_divider_frequency: 1)
1160
- ┌──────────────┬──────────────┬──────────────┐
1161
- itself even? odd?
1162
- ├──────────────┼──────────────┼──────────────┤
1163
- 1 false true
1164
- ├──────────────┼──────────────┼──────────────┤
1165
- 2 true false
1166
- ├──────────────┼──────────────┼──────────────┤
1167
- 3 false true
1168
- └──────────────┴──────────────┴──────────────┘
1172
+ > puts Tabulo::Table.new(1..3, :itself, :even?, :odd?, row_divider_frequency: 1)
1173
+ +--------------+--------------+--------------+
1174
+ | itself | even? | odd? |
1175
+ +--------------+--------------+--------------+
1176
+ | 1 | false | true |
1177
+ +--------------+--------------+--------------+
1178
+ | 2 | true | false |
1179
+ +--------------+--------------+--------------+
1180
+ | 3 | false | true |
1181
+ +--------------+--------------+--------------+
1169
1182
  ```
1170
1183
 
1171
1184
  <a name="freezing-a-table"></a>
@@ -1341,14 +1354,14 @@ The gem is available as open source under the terms of the [MIT
1341
1354
  License](http://opensource.org/licenses/MIT).
1342
1355
 
1343
1356
  [Gem Version]: https://rubygems.org/gems/tabulo
1344
- [Documentation]: http://www.rubydoc.info/gems/tabulo/2.6.1
1357
+ [Documentation]: http://www.rubydoc.info/gems/tabulo/2.6.2
1345
1358
  [Build Status]: https://travis-ci.org/matt-harvey/tabulo
1346
1359
  [Coverage Status]: https://coveralls.io/r/matt-harvey/tabulo
1347
1360
  [Code Climate]: https://codeclimate.com/github/matt-harvey/tabulo
1348
1361
  [Awesome Ruby]: https://github.com/markets/awesome-ruby#cli-utilities
1349
1362
 
1350
1363
  [GV img]: https://img.shields.io/gem/v/tabulo.svg
1351
- [DC img]: https://img.shields.io/badge/documentation-v2.6.1-blue.svg
1364
+ [DC img]: https://img.shields.io/badge/documentation-v2.6.2-blue.svg
1352
1365
  [BS img]: https://img.shields.io/travis/matt-harvey/tabulo.svg
1353
1366
  [CS img]: https://img.shields.io/coveralls/matt-harvey/tabulo.svg
1354
1367
  [CC img]: https://codeclimate.com/github/matt-harvey/tabulo/badges/gpa.svg
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.6.1
1
+ 2.6.2
@@ -101,7 +101,7 @@ module Tabulo
101
101
 
102
102
  def calculate_subcells
103
103
  line_index = 0
104
- formatted_content.split($/, -1).flat_map do |substr|
104
+ formatted_content.split(Util::NEWLINE, -1).flat_map do |substr|
105
105
  subsubcells, subsubcell, subsubcell_width = [], String.new(""), 0
106
106
 
107
107
  substr.scan(/\X/).each do |grapheme_cluster|
@@ -35,17 +35,17 @@ module Tabulo
35
35
  # be unique. Each element of the Array will be used to create a column whose content is
36
36
  # created by calling the corresponding method on each element of sources. Note
37
37
  # the {#add_column} method is a much more flexible way to set up columns on the table.
38
- # @param [:left, :right, :center, :auto] align_body (:auto) Determines the alignment of body cell
38
+ # @param [:left, :right, :center, :auto] align_body Determines the alignment of body cell
39
39
  # (i.e. non-header) content within columns in this Table. Can be overridden for individual columns
40
40
  # using the <tt>align_body</tt> option passed to {#add_column}. If passed <tt>:auto</tt>,
41
41
  # alignment is determined by cell content, with numbers aligned right, booleans
42
42
  # center-aligned, and other values left-aligned.
43
- # @param [:left, :right, :center] align_header (:center) Determines the alignment of header text
43
+ # @param [:left, :right, :center] align_header Determines the alignment of header text
44
44
  # for columns in this Table. Can be overridden for individual columns using the
45
45
  # <tt>align_header</tt> option passed to {#add_column}
46
- # @param [:left, :right, :center] align_header (:center) Determines the alignment of the table
46
+ # @param [:left, :right, :center] align_header Determines the alignment of the table
47
47
  # title, if present.
48
- # @param [:ascii, :markdown, :modern, :blank, nil] border (nil) Determines the characters used
48
+ # @param [:ascii, :markdown, :modern, :blank, nil] border Determines the characters used
49
49
  # for the Table border, including both the characters around the outside of table, and the lines drawn
50
50
  # within the table to separate columns from each other and the header row from the Table body.
51
51
  # If <tt>nil</tt>, then the value of {DEFAULT_BORDER} will be used.
@@ -63,7 +63,7 @@ module Tabulo
63
63
  # borders and intersection characters consisting of whitespace only
64
64
  # - `:classic` Like `:ascii`, but does not have a horizontal line at the bottom of the
65
65
  # table. This reproduces the default behaviour in `tabulo` v1.
66
- # @param [nil, #to_proc] border_styler (nil) A lambda or other callable object taking
66
+ # @param [nil, #to_proc] border_styler A lambda or other callable object taking
67
67
  # a single parameter, representing a section of the table's borders (which for this purpose
68
68
  # include any horizontal and vertical lines inside the table), and returning a string.
69
69
  # If passed <tt>nil</tt>, then no additional styling will be applied to borders. If passed a
@@ -72,7 +72,7 @@ module Tabulo
72
72
  # <tt>border_styler</tt> is not taken into consideration by the internal table rendering calculations
73
73
  # Thus it can be used to apply ANSI escape codes to border characters, to colour the borders
74
74
  # for example, without breaking the table formatting.
75
- # @param [nil, Integer, Array] column_padding (1) Determines the amount of blank space with which to pad
75
+ # @param [nil, Integer, Array] column_padding Determines the amount of blank space with which to pad
76
76
  # either side of each column. If passed an Integer, then the given amount of padding is
77
77
  # applied to each side of each column. If passed a two-element Array, then the first element of the
78
78
  # Array indicates the amount of padding to apply to the left of each column, and the second
@@ -80,26 +80,26 @@ module Tabulo
80
80
  # individual columns using the `padding` option of {#add_column}.
81
81
  # @param [Integer, nil] column_width The default column width for columns in this
82
82
  # table, not excluding padding. If <tt>nil</tt>, then {DEFAULT_COLUMN_WIDTH} will be used.
83
- # @param [nil, #to_proc] formatter (:to_s.to_proc) The default formatter for columns in this
83
+ # @param [nil, #to_proc] formatter The default formatter for columns in this
84
84
  # table. See `formatter` option of {#add_column} for details.
85
85
  # @param [:start, nil, Integer] header_frequency (:start) Controls the display of column headers.
86
86
  # If passed <tt>:start</tt>, headers will be shown at the top of the table only. If passed <tt>nil</tt>,
87
87
  # headers will not be shown. If passed an Integer N (> 0), headers will be shown at the top of the table,
88
88
  # then repeated every N rows.
89
- # @param [nil, #to_proc] header_styler (nil) The default header styler for columns in this
89
+ # @param [nil, #to_proc] header_styler The default header styler for columns in this
90
90
  # table. See `header_styler` option of {#add_column} for details.
91
- # @param [nil, Integer] row_divider_frequency (nil) Controls the display of horizontal row dividers within
91
+ # @param [nil, Integer] row_divider_frequency Controls the display of horizontal row dividers within
92
92
  # the table body. If passed <tt>nil</tt>, dividers will not be shown. If passed an Integer N (> 0),
93
93
  # dividers will be shown after every N rows. The characters used to form the dividers are
94
94
  # determined by the `border` option, and are the same as those used to form the bottom edge of the
95
95
  # header row.
96
- # @param [nil, #to_proc] styler (nil) The default styler for columns in this table. See `styler`
96
+ # @param [nil, #to_proc] styler The default styler for columns in this table. See `styler`
97
97
  # option of {#add_column} for details.
98
- # @param [nil, String] title (nil) If passed a String, will arrange for a title to be shown at the top
98
+ # @param [nil, String] title If passed a String, will arrange for a title to be shown at the top
99
99
  # of the table. Note: If the `border` option is set to `:markdown`, adding a title to the table
100
100
  # will cause it to cease being valid Markdown when rendered, since Markdown engines do not generally
101
101
  # support adding a caption element (i.e. title) to tables.
102
- # @param [nil, #to_proc] title_styler (nil) A lambda or other callable object that will
102
+ # @param [nil, #to_proc] title_styler A lambda or other callable object that will
103
103
  # determine the colors or other styling applied to the table title. Can be passed
104
104
  # <tt>nil</tt>, or can be passed a callable that takes either 1 or 2 parametes:
105
105
  # * If passed <tt>nil</tt>, then no additional styling will be applied to the title.
@@ -184,24 +184,24 @@ module Tabulo
184
184
  # a method to be called on each item in the table sources to provide the content
185
185
  # for this column. If a String is passed as the label, then it will be converted to
186
186
  # a Symbol for the purpose of serving as this label.
187
- # @param [:left, :center, :right, :auto, nil] align_body (nil) Specifies how the cell body contents
187
+ # @param [:left, :center, :right, :auto, nil] align_body Specifies how the cell body contents
188
188
  # should be aligned. If <tt>nil</tt> is passed, then the alignment is determined
189
189
  # by the Table-level setting passed to the <tt>align_body</tt> option on Table initialization
190
190
  # (which itself defaults to <tt>:auto</tt>). Otherwise this option determines the alignment of
191
191
  # this column. If <tt>:auto</tt> is passed, the alignment is determined by the type of the cell
192
192
  # value, with numbers aligned right, booleans center-aligned, and other values left-aligned.
193
193
  # Note header text alignment is configured separately using the :align_header param.
194
- # @param [:left, :center, :right, nil] align_header (nil) Specifies how the header text
194
+ # @param [:left, :center, :right, nil] align_header Specifies how the header text
195
195
  # should be aligned. If <tt>nil</tt> is passed, then the alignment is determined
196
196
  # by the Table-level setting passed to the <tt>align_header</tt> (which itself defaults
197
197
  # to <tt>:center</tt>). Otherwise, this option determines the alignment of the header
198
198
  # content for this column.
199
- # @param [Symbol, String, Integer, nil] before (nil) The label of the column before (i.e. to
199
+ # @param [Symbol, String, Integer, nil] before The label of the column before (i.e. to
200
200
  # the left of) which the new column should inserted. If <tt>nil</tt> is passed, it will be
201
201
  # inserted after all other columns. If there is no column with the given label, then an
202
202
  # {InvalidColumnLabelError} will be raised. A non-Integer labelled column can be identified
203
203
  # in either String or Symbol form for this purpose.
204
- # @param [#to_proc] formatter (nil) A lambda or other callable object that
204
+ # @param [#to_proc] formatter A lambda or other callable object that
205
205
  # will be passed the calculated value of each cell to determine how it should be displayed. This
206
206
  # is distinct from the extractor and the styler (see below).
207
207
  # For example, if the extractor for this column generates a Date, then the formatter might format
@@ -219,7 +219,7 @@ module Tabulo
219
219
  # whether the {Cell} is an odd- or even-numbered {Row}, to arrange for different formatting
220
220
  # to be applied to alternating rows.
221
221
  # See the documentation for {CellData} for more.
222
- # @param [nil, #to_s] header (nil) Text to be displayed in the column header. If passed nil,
222
+ # @param [nil, #to_s] header Text to be displayed in the column header. If passed nil,
223
223
  # the column's label will also be used as its header text.
224
224
  # @param [nil, #to_proc] header_styler (nil) A lambda or other callable object that will
225
225
  # determine the colors or other styling applied to the header content. Can be passed
@@ -249,14 +249,14 @@ module Tabulo
249
249
  #
250
250
  # Note that if the header content is truncated, then any <tt>header_styler</tt> will be applied to the
251
251
  # truncation indicator character as well as to the truncated content.
252
- # @param [nil, Integer, Array] padding (nil) Determines the amount of blank space with which to
252
+ # @param [nil, Integer, Array] padding Determines the amount of blank space with which to
253
253
  # pad either side of the column. If passed nil, then the `column_padding` setting of the
254
254
  # {Table} will determine the column's padding. (See {#initialize}.) Otherwise, this option
255
255
  # overrides, for this column, the `column_padding` that was set at the table level: if passed an Integer,
256
256
  # then the given amount of padding is applied to either side of the column; or if passed a two-element Array,
257
257
  # then the first element of the Array indicates the amount of padding to apply to the left of the column,
258
258
  # and the second element indicates the amount to apply to the right.
259
- # @param [nil, #to_proc] styler (nil) A lambda or other callable object that will determine
259
+ # @param [nil, #to_proc] styler A lambda or other callable object that will determine
260
260
  # the colors or other styling applied to the formatted value of the cell. Can be passed
261
261
  # <tt>nil</tt>, or can be passed a callable that takes either 2 or 3 parameters:
262
262
  # * If passed <tt>nil</tt>, then no additional styling will be applied to the cell content
@@ -288,7 +288,7 @@ module Tabulo
288
288
  #
289
289
  # Note that if the content of a cell is truncated, then the whatever styling is applied by the
290
290
  # <tt>styler</tt> to the cell content will also be applied to the truncation indicator character.
291
- # @param [Integer] width (nil) Specifies the width of the column, excluding padding. If
291
+ # @param [Integer] width Specifies the width of the column, excluding padding. If
292
292
  # nil, then the column will take the width provided by the `column_width` param
293
293
  # with which the Table was initialized.
294
294
  # @param [#to_proc] extractor A block or other callable that will be passed each of the {Table}
@@ -412,7 +412,7 @@ module Tabulo
412
412
  # Produce a horizontal dividing line suitable for printing at the top, bottom or middle
413
413
  # of the table.
414
414
  #
415
- # @param [:top, :middle, :bottom, :title_top, :title_bottom] position (:bottom)
415
+ # @param [:top, :middle, :bottom, :title_top, :title_bottom] position
416
416
  # Specifies the position for which the resulting horizontal dividing line is intended to
417
417
  # be printed. This determines the border characters that are used to construct the line.
418
418
  # The `:title_top` and `:title_bottom` options are used internally for adding borders
@@ -451,7 +451,7 @@ module Tabulo
451
451
  # is called. If the source Enumerable changes between that point, and the point when
452
452
  # the Table is printed, then columns will *not* be resized yet again on printing.
453
453
  #
454
- # @param [nil, Numeric] max_table_width (:auto) With no args, or if passed <tt>:auto</tt>,
454
+ # @param [nil, Numeric] max_table_width With no args, or if passed <tt>:auto</tt>,
455
455
  # stops the total table width (including padding and borders) from expanding beyond the
456
456
  # bounds of the terminal screen.
457
457
  # If passed <tt>nil</tt>, the table width will not be capped.
@@ -523,13 +523,13 @@ module Tabulo
523
523
  # new Table, which contains the names of "fields" (corresponding to the original Table's
524
524
  # column headings). If this is not provided, then by default this column will be made just
525
525
  # wide enough to accommodate its contents.
526
- # @option opts [String] :field_names_header ("") By default the left-most column will have a
526
+ # @option opts [String] :field_names_header By default the left-most column will have a
527
527
  # blank header; but this can be overridden by passing a String to this option.
528
- # @option opts [:left, :center, :right] :field_names_header_alignment (:right) Specifies how the
528
+ # @option opts [:left, :center, :right] :field_names_header_alignment Specifies how the
529
529
  # header text of the left-most column (if it has header text) should be aligned.
530
- # @option opts [:left, :center, :right] :field_names_body_alignment (:right) Specifies how the
530
+ # @option opts [:left, :center, :right] :field_names_body_alignment Specifies how the
531
531
  # body text of the left-most column should be aligned.
532
- # @option opts [#to_proc] :headers (:to_s.to_proc) A lambda or other callable object that
532
+ # @option opts [#to_proc] :headers A lambda or other callable object that
533
533
  # will be passed in turn each of the elements of the current Table's <tt>sources</tt>
534
534
  # Enumerable, to determine the text to be displayed in the header of each column of the
535
535
  # new Table (other than the left-most column's header, which is determined as described
@@ -3,6 +3,8 @@ module Tabulo
3
3
  # @!visibility private
4
4
  module Util
5
5
 
6
+ NEWLINE = /\r\n|\n|\r/
7
+
6
8
  # @!visibility private
7
9
  def self.condense_lines(lines)
8
10
  join_lines(lines.reject(&:empty?))
@@ -34,7 +36,7 @@ module Tabulo
34
36
  # @return [Integer] the length of the longest segment of str when split by newlines
35
37
  def self.wrapped_width(str)
36
38
  return 0 if str.empty?
37
- segments = str.split($/)
39
+ segments = str.split(NEWLINE)
38
40
  segments.inject(1) do |longest_length_so_far, segment|
39
41
  Util.max(longest_length_so_far, Unicode::DisplayWidth.of(segment))
40
42
  end
@@ -1,3 +1,3 @@
1
1
  module Tabulo
2
- VERSION = "2.6.1"
2
+ VERSION = "2.6.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tabulo
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.1
4
+ version: 2.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Harvey
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-24 00:00:00.000000000 Z
11
+ date: 2020-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tty-screen