class Cl::Help::Format::Obj

Public Instance Methods

format() click to toggle source
# File lib/cl/help/format.rb, line 9
def format
  opts = []
  opts << "type: #{type(obj)}" unless obj.type == :flag
  opts << 'required' if obj.required?
  opts += Opt.new(obj).format if obj.is_a?(Cl::Opt)
  opts = opts.join(', ')
  opts = "(#{opts})" if obj.description && !opts.empty?
  opts = [obj.description, opts]
  opts.compact.map(&:strip).join(' ')
end
type(obj) click to toggle source
# File lib/cl/help/format.rb, line 20
def type(obj)
  return obj.type unless obj.is_a?(Cl::Opt) && obj.type == :array
  "array (string, can be given multiple times)"
end