Parent

Methods

TablePrint::FixedWidthFormatter

Attributes

width[RW]

Public Class Methods

new(width) click to toggle source
# File lib/table_print/formatter.rb, line 23
def initialize(width)
  self.width = width
end

Public Instance Methods

format(value) click to toggle source
# File lib/table_print/formatter.rb, line 27
def format(value)
  padding = width - length(value.to_s)
  truncate(value) + (padding < 0 ? '' : " " * padding)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.