module QB::Options::Option::OptionParserConcern

Public Instance Methods

option_parser_format_multiline(string) { |case line| ... } click to toggle source
# File lib/qb/options/option/option_parser_concern.rb, line 82
def option_parser_format_multiline string, &block
  lines = string.lines.to_a
  
  lines.map do |line|
    yield case line
    when "\n"
      # Need a space for {OptionParser} to respect it
      option_parser_spacer + line
    when /\A\s*\-\ /
      line.sub '-', '*'
    else
      line
    end
  end
option_parser_spacer() click to toggle source
# File lib/qb/options/option/option_parser_concern.rb, line 64
def option_parser_spacer
  ' '
end
option_parser_type_acceptable() click to toggle source
# File lib/qb/options/option/option_parser_concern.rb, line 69
def option_parser_type_acceptable
  acceptable = Class.new TypeAcceptable
  acceptable.instance_variable_set :@type, self.type
  acceptable
end
option_parser_value_name() click to toggle source
# File lib/qb/options/option/option_parser_concern.rb, line 76
def option_parser_value_name
  meta_name.upcase
end