Class: Rich::Column
- Inherits:
-
Object
- Object
- Rich::Column
- Defined in:
- lib/rich/table.rb
Overview
Column definition for a Table
Instance Attribute Summary collapse
-
#footer ⇒ String?
readonly
Column footer.
-
#footer_style ⇒ Style?
readonly
Footer style.
-
#header ⇒ String
readonly
Column header.
-
#header_style ⇒ Style?
readonly
Header style.
-
#justify ⇒ Symbol
readonly
Justification (:left, :center, :right).
-
#max_width ⇒ Integer?
readonly
Maximum width.
-
#min_width ⇒ Integer?
readonly
Minimum width.
-
#no_wrap ⇒ Boolean
readonly
No wrap.
-
#overflow ⇒ Symbol
readonly
Overflow handling (:fold, :crop, :ellipsis).
-
#ratio ⇒ Integer
readonly
Ratio for flexible sizing.
-
#style ⇒ Style?
readonly
Cell style.
Instance Method Summary collapse
-
#initialize(header = "", footer: nil, header_style: nil, style: nil, footer_style: nil, justify: :left, min_width: nil, max_width: nil, no_wrap: false, overflow: :ellipsis, ratio: 1) ⇒ Column
constructor
A new instance of Column.
Constructor Details
#initialize(header = "", footer: nil, header_style: nil, style: nil, footer_style: nil, justify: :left, min_width: nil, max_width: nil, no_wrap: false, overflow: :ellipsis, ratio: 1) ⇒ Column
Returns a new instance of Column.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/rich/table.rb', line 45 def initialize( header = "", footer: nil, header_style: nil, style: nil, footer_style: nil, justify: :left, min_width: nil, max_width: nil, no_wrap: false, overflow: :ellipsis, ratio: 1 ) @header = header.to_s @footer = @header_style = header_style.is_a?(String) ? Style.parse(header_style) : header_style @style = style.is_a?(String) ? Style.parse(style) : style @footer_style = .is_a?(String) ? Style.parse() : @justify = justify @min_width = min_width @max_width = max_width @no_wrap = no_wrap @overflow = overflow @ratio = ratio end |
Instance Attribute Details
#footer ⇒ String? (readonly)
Returns Column footer.
16 17 18 |
# File 'lib/rich/table.rb', line 16 def @footer end |
#footer_style ⇒ Style? (readonly)
Returns Footer style.
25 26 27 |
# File 'lib/rich/table.rb', line 25 def @footer_style end |
#header ⇒ String (readonly)
Returns Column header.
13 14 15 |
# File 'lib/rich/table.rb', line 13 def header @header end |
#header_style ⇒ Style? (readonly)
Returns Header style.
19 20 21 |
# File 'lib/rich/table.rb', line 19 def header_style @header_style end |
#justify ⇒ Symbol (readonly)
Returns Justification (:left, :center, :right).
28 29 30 |
# File 'lib/rich/table.rb', line 28 def justify @justify end |
#max_width ⇒ Integer? (readonly)
Returns Maximum width.
34 35 36 |
# File 'lib/rich/table.rb', line 34 def max_width @max_width end |
#min_width ⇒ Integer? (readonly)
Returns Minimum width.
31 32 33 |
# File 'lib/rich/table.rb', line 31 def min_width @min_width end |
#no_wrap ⇒ Boolean (readonly)
Returns No wrap.
37 38 39 |
# File 'lib/rich/table.rb', line 37 def no_wrap @no_wrap end |
#overflow ⇒ Symbol (readonly)
Returns Overflow handling (:fold, :crop, :ellipsis).
40 41 42 |
# File 'lib/rich/table.rb', line 40 def overflow @overflow end |
#ratio ⇒ Integer (readonly)
Returns Ratio for flexible sizing.
43 44 45 |
# File 'lib/rich/table.rb', line 43 def ratio @ratio end |
#style ⇒ Style? (readonly)
Returns Cell style.
22 23 24 |
# File 'lib/rich/table.rb', line 22 def style @style end |