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.



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

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.



8
9
10
# File 'lib/table_builder/column.rb', line 8

def text
  @text
end