class Fuelcell::Help::BaseFormatter

Hold common functionality and information needed by all formatters

Constants

DEFAULT_PADDING
DEFAULT_WIDTH

Attributes

max_width[R]
padding[R]
width[R]

Public Class Methods

new(config = {}) click to toggle source
# File lib/fuelcell/help/base_formatter.rb, line 9
def initialize(config = {})
  @width     = config[:width] || DEFAULT_WIDTH
  @padding   = config[:padding] || DEFAULT_PADDING
  @max_width = width - padding
end

Public Instance Methods

long_opt(data, no_opt = '') click to toggle source
# File lib/fuelcell/help/base_formatter.rb, line 19
def long_opt(data, no_opt = '')
  data[:long].nil? ? no_opt : "--#{data[:long]}=#{data[:long].upcase}"
end
short_opt(data, no_opt = '') click to toggle source
# File lib/fuelcell/help/base_formatter.rb, line 15
def short_opt(data, no_opt = '')
  data[:short].nil? ? no_opt : "-#{data[:short]}"
end