class Formatting::CellFormatter

CellFormatter class format data in cell

Public Class Methods

format_value(value,opts) click to toggle source

@param [String] String value for formatting @param opts [Hash] options: format, max width, alignment @return [String] Formatted string value

# File lib/formatting.rb, line 31
def self.format_value(value,opts)
  if opts.has_key?(:format)
    cell = sprintf(opts[:format],value)
  else
    cell = sprintf("%#{opts[:max_width]}s",value)
  end
  Formatting.format_value_by_width_and_just(cell,opts[:max_width],opts[:just])
end