Class: Railbow::Table::Column
- Inherits:
-
Object
- Object
- Railbow::Table::Column
- Defined in:
- lib/railbow/table/column.rb
Instance Attribute Summary collapse
-
#accent ⇒ Object
readonly
Returns the value of attribute accent.
-
#aliased ⇒ Object
readonly
Returns the value of attribute aliased.
-
#align ⇒ Object
readonly
Returns the value of attribute align.
-
#droppable ⇒ Object
readonly
Returns the value of attribute droppable.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#max_width ⇒ Object
readonly
Returns the value of attribute max_width.
-
#min_width ⇒ Object
readonly
Returns the value of attribute min_width.
-
#shrink_floor ⇒ Object
readonly
Returns the value of attribute shrink_floor.
-
#shrinkable ⇒ Object
readonly
Returns the value of attribute shrinkable.
-
#sticky ⇒ Object
readonly
Returns the value of attribute sticky.
-
#truncate ⇒ Object
readonly
Returns the value of attribute truncate.
-
#truncate_fn ⇒ Object
readonly
Returns the value of attribute truncate_fn.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
- #fixed? ⇒ Boolean
-
#initialize(label:, width: :auto, min_width: nil, max_width: nil, align: :left, truncate: false, truncate_fn: nil, sticky: false, accent: false, aliased: true, shrinkable: false, shrink_floor: nil, droppable: nil) ⇒ Column
constructor
accent: the column carries its own meaning through color (a status glyph, say), so it keeps that color when the row is dimmed.
Constructor Details
#initialize(label:, width: :auto, min_width: nil, max_width: nil, align: :left, truncate: false, truncate_fn: nil, sticky: false, accent: false, aliased: true, shrinkable: false, shrink_floor: nil, droppable: nil) ⇒ Column
accent: the column carries its own meaning through color (a status glyph, say), so it keeps that color when the row is dimmed. aliased: value aliases from config may rewrite this column's cells. Off for cells the caller already resolved, such as a cluster of status glyphs, which no whole-cell alias could ever match. shrinkable: the width budget may narrow this column, down to shrink_floor, before it starts dropping columns. droppable: rank in the order the width budget drops columns entirely when shrinking is not enough - lower ranks go first. Nil: never dropped.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/railbow/table/column.rb', line 18 def initialize(label:, width: :auto, min_width: nil, max_width: nil, align: :left, truncate: false, truncate_fn: nil, sticky: false, accent: false, aliased: true, shrinkable: false, shrink_floor: nil, droppable: nil) @label = label @width = width @min_width = min_width @max_width = max_width @align = align @truncate = truncate @truncate_fn = truncate_fn @sticky = sticky @accent = accent @aliased = aliased @shrinkable = shrinkable @shrink_floor = shrink_floor @droppable = droppable end |
Instance Attribute Details
#accent ⇒ Object (readonly)
Returns the value of attribute accent.
6 7 8 |
# File 'lib/railbow/table/column.rb', line 6 def accent @accent end |
#aliased ⇒ Object (readonly)
Returns the value of attribute aliased.
6 7 8 |
# File 'lib/railbow/table/column.rb', line 6 def aliased @aliased end |
#align ⇒ Object (readonly)
Returns the value of attribute align.
6 7 8 |
# File 'lib/railbow/table/column.rb', line 6 def align @align end |
#droppable ⇒ Object (readonly)
Returns the value of attribute droppable.
6 7 8 |
# File 'lib/railbow/table/column.rb', line 6 def droppable @droppable end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
6 7 8 |
# File 'lib/railbow/table/column.rb', line 6 def label @label end |
#max_width ⇒ Object (readonly)
Returns the value of attribute max_width.
6 7 8 |
# File 'lib/railbow/table/column.rb', line 6 def max_width @max_width end |
#min_width ⇒ Object (readonly)
Returns the value of attribute min_width.
6 7 8 |
# File 'lib/railbow/table/column.rb', line 6 def min_width @min_width end |
#shrink_floor ⇒ Object (readonly)
Returns the value of attribute shrink_floor.
6 7 8 |
# File 'lib/railbow/table/column.rb', line 6 def shrink_floor @shrink_floor end |
#shrinkable ⇒ Object (readonly)
Returns the value of attribute shrinkable.
6 7 8 |
# File 'lib/railbow/table/column.rb', line 6 def shrinkable @shrinkable end |
#sticky ⇒ Object (readonly)
Returns the value of attribute sticky.
6 7 8 |
# File 'lib/railbow/table/column.rb', line 6 def sticky @sticky end |
#truncate ⇒ Object (readonly)
Returns the value of attribute truncate.
6 7 8 |
# File 'lib/railbow/table/column.rb', line 6 def truncate @truncate end |
#truncate_fn ⇒ Object (readonly)
Returns the value of attribute truncate_fn.
6 7 8 |
# File 'lib/railbow/table/column.rb', line 6 def truncate_fn @truncate_fn end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
6 7 8 |
# File 'lib/railbow/table/column.rb', line 6 def width @width end |
Instance Method Details
#fixed? ⇒ Boolean
34 35 36 |
# File 'lib/railbow/table/column.rb', line 34 def fixed? width.is_a?(Integer) end |