Class: RubyRich::Columns::Column
- Inherits:
-
Object
- Object
- RubyRich::Columns::Column
- Defined in:
- lib/ruby_rich/columns.rb
Instance Attribute Summary collapse
-
#align ⇒ Object
Returns the value of attribute align.
-
#content ⇒ Object
Returns the value of attribute content.
-
#padding ⇒ Object
Returns the value of attribute padding.
-
#title ⇒ Object
Returns the value of attribute title.
-
#width ⇒ Object
Returns the value of attribute width.
Instance Method Summary collapse
- #<<(text) ⇒ Object
- #add(text) ⇒ Object
- #clear ⇒ Object
- #height ⇒ Object
-
#initialize(width: nil, align: :left, padding: 1, title: nil) ⇒ Column
constructor
A new instance of Column.
- #lines ⇒ Object
Constructor Details
#initialize(width: nil, align: :left, padding: 1, title: nil) ⇒ Column
Returns a new instance of Column.
6 7 8 9 10 11 12 |
# File 'lib/ruby_rich/columns.rb', line 6 def initialize(width: nil, align: :left, padding: 1, title: nil) @content = [] @width = width @align = align @padding = padding @title = title end |
Instance Attribute Details
#align ⇒ Object
Returns the value of attribute align.
4 5 6 |
# File 'lib/ruby_rich/columns.rb', line 4 def align @align end |
#content ⇒ Object
Returns the value of attribute content.
4 5 6 |
# File 'lib/ruby_rich/columns.rb', line 4 def content @content end |
#padding ⇒ Object
Returns the value of attribute padding.
4 5 6 |
# File 'lib/ruby_rich/columns.rb', line 4 def padding @padding end |
#title ⇒ Object
Returns the value of attribute title.
4 5 6 |
# File 'lib/ruby_rich/columns.rb', line 4 def title @title end |
#width ⇒ Object
Returns the value of attribute width.
4 5 6 |
# File 'lib/ruby_rich/columns.rb', line 4 def width @width end |
Instance Method Details
#<<(text) ⇒ Object
19 20 21 |
# File 'lib/ruby_rich/columns.rb', line 19 def <<(text) add(text) end |
#add(text) ⇒ Object
14 15 16 17 |
# File 'lib/ruby_rich/columns.rb', line 14 def add(text) @content << text.to_s self end |
#clear ⇒ Object
23 24 25 26 |
# File 'lib/ruby_rich/columns.rb', line 23 def clear @content.clear self end |
#height ⇒ Object
32 33 34 |
# File 'lib/ruby_rich/columns.rb', line 32 def height @content.length end |
#lines ⇒ Object
28 29 30 |
# File 'lib/ruby_rich/columns.rb', line 28 def lines @content end |