Class: TableGen::Column
- Inherits:
-
Object
- Object
- TableGen::Column
- Defined in:
- lib/tablegen/column.rb
Overview
Instances of this class are created automatically by TableGen#column.
Instance Attribute Summary collapse
-
#alignment ⇒ Symbol
The alignment of the row fields.
-
#collapse ⇒ Boolean
Whether the column can be hidden to respect the table’s width constraint.
-
#format ⇒ Proc
The row formatter.
-
#header_alignment ⇒ Symbol
The alignment of the header fields.
-
#index ⇒ Fixnum
readonly
The column’s index.
-
#min_width ⇒ Fixnum
The column’s minimum width (in characters).
-
#padding ⇒ String
The field padding character.
-
#stretch ⇒ Boolean
Whether to stretch the column to fill the table’s width constraint.
Instance Method Summary collapse
-
#initialize(index) ⇒ Column
constructor
private
A new instance of Column.
Constructor Details
#initialize(index) ⇒ Column
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Column.
76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/tablegen/column.rb', line 76 def initialize(index) @index = index @alignment = :left @collapse = false @format = proc {|data| data.to_s } @header_alignment = :auto @min_width = 0 @padding = "\x20" @stretch = false end |
Instance Attribute Details
#alignment ⇒ Symbol
The alignment of the row fields. Possible values:
-
:left
-
:center
-
:right
(Defaults to :left)
18 19 20 |
# File 'lib/tablegen/column.rb', line 18 def alignment @alignment end |
#collapse ⇒ Boolean
Whether the column can be hidden to respect the table’s width constraint. (Defaults to false)
24 25 26 |
# File 'lib/tablegen/column.rb', line 24 def collapse @collapse end |
#format ⇒ Proc
The row formatter. The default block converts the original data to a String.
42 43 44 |
# File 'lib/tablegen/column.rb', line 42 def format @format end |
#header_alignment ⇒ Symbol
The alignment of the header fields. Possible values:
-
:auto (row alignment)
-
:left
-
:center
-
:right
(Defaults to :auto)
55 56 57 |
# File 'lib/tablegen/column.rb', line 55 def header_alignment @header_alignment end |
#index ⇒ Fixnum (readonly)
The column’s index.
6 7 8 |
# File 'lib/tablegen/column.rb', line 6 def index @index end |
#min_width ⇒ Fixnum
The column’s minimum width (in characters). (Defaults to 0)
61 62 63 |
# File 'lib/tablegen/column.rb', line 61 def min_width @min_width end |
#padding ⇒ String
The field padding character. (Defaults to a space)
67 68 69 |
# File 'lib/tablegen/column.rb', line 67 def padding @padding end |
#stretch ⇒ Boolean
Whether to stretch the column to fill the table’s width constraint. (Defaults to false)
73 74 75 |
# File 'lib/tablegen/column.rb', line 73 def stretch @stretch end |