Method: Autoproj::Configuration#declare

Defined in:
lib/autoproj/configuration.rb

#declare(name, type, **options, &validator) ⇒ Object

Declare an option

This declares a given option, thus allowing to ask the user about it

Parameters:

  • name (String)

    the option name

  • type (String)

    the option type (can be ‘boolean’ or ‘string’)

  • options (Hash)

    a customizable set of options

Options Hash (**options):

  • :short_doc (String)

    the one-line documentation string that is displayed when the user does not have to be queried. It defaults to the first line of :doc if not given

  • :doc (String)

    the full option documentation. It is displayed to the user when he is explicitly asked about the option’s value

  • :default (Object)

    the default value this option should take

  • :possible_values (Array)

    list of possible values (only if the option type is ‘string’)

  • :lowercase (Boolean) — default: false

    whether the user’s input should be converted to lowercase before it gets validated / saved.

  • :uppercase (Boolean) — default: false

    whether the user’s input should be converted to uppercase before it gets validated / saved.



165
166
167
# File 'lib/autoproj/configuration.rb', line 165

def declare(name, type, **options, &validator)
    declared_options[name] = BuildOption.new(name, type, options, validator)
end