Class: TableBuilder::Column

Inherits:
Object
  • Object
show all
Includes:
ColumnValidator
Defined in:
lib/table_builder/column.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text, size) ⇒ Column

Returns a new instance of Column.



8
9
10
11
12
13
14
# File 'lib/table_builder/column.rb', line 8

def initialize(text, size)
  # Ignore ANSI escape sequences
  pure_text = text.to_pure

  text += ' ' * (size - pure_text.size) if !size.nil? && size > pure_text.size
  @text = text
end

Instance Attribute Details

#textObject

Returns the value of attribute text.



6
7
8
# File 'lib/table_builder/column.rb', line 6

def text
  @text
end