class GLI::Commands::HelpModules::OptionsFormatter

Public Instance Methods

format() click to toggle source
# File lib/gli/commands/help_modules/options_formatter.rb, line 10
def format
  list_formatter = ListFormatter.new(@flags_and_switches.map { |option|
    if option.respond_to? :argument_name
      [option_names_for_help_string(option,option.argument_name),description_with_default(option)]
    else
      [option_names_for_help_string(option),description_with_default(option)]
    end
  },@wrapper_class)
  stringio = StringIO.new
  list_formatter.output(stringio)
  stringio.string
end

Public Class Methods

new(flags_and_switches,sorter,wrapper_class) click to toggle source
# File lib/gli/commands/help_modules/options_formatter.rb, line 5
def initialize(flags_and_switches,sorter,wrapper_class)
  @flags_and_switches = sorter.call(flags_and_switches)
  @wrapper_class = wrapper_class
end