class Option

Attributes

attribute[R]
default[R]
help[R]
long[R]
short[R]
type[R]

Public Class Methods

new(short, long, default, type, help, attribute) click to toggle source
# File lib/hiptest-publisher/options_parser.rb, line 59
def initialize(short, long, default, type, help, attribute)
  @short = short
  @long = long
  @default = default
  @type = type
  @help = help
  @attribute = attribute
end

Public Instance Methods

register(opts, options) click to toggle source
# File lib/hiptest-publisher/options_parser.rb, line 76
def register(opts, options)
  options[attribute] = @default unless default.nil?
  on_values = [
    @short ? "-#{@short}" : nil,
    "--#{@long}",
    @type,
    help
  ].compact

  opts.on(*on_values) do |value|
    options[attribute] = value
    options.__cli_args << attribute
  end
end