class Flare::Util::PrettyTable::Column
Public Class Methods
new(text, options = {})
click to toggle source
# File lib/flare/util/pretty_table/column.rb, line 9 def initialize(text, options = {}) @text = text.to_s @align = options[:align] || :left end
Public Instance Methods
prettify(column_width)
click to toggle source
# File lib/flare/util/pretty_table/column.rb, line 18 def prettify(column_width) if self.width >= column_width return @text end padding = padding(column_width - self.width) case @align when :left then @text + padding else # @align == :right padding + @text end end
width()
click to toggle source
# File lib/flare/util/pretty_table/column.rb, line 14 def width @text.size end
Private Instance Methods
padding(length)
click to toggle source
# File lib/flare/util/pretty_table/column.rb, line 34 def padding(length) ' ' * length end