Method: CommandKit::Options::OptionValue#initialize

Defined in:
lib/command_kit/options/option_value.rb

#initialize(type: String, default: nil, usage: self.class.default_usage(type), **kwargs) ⇒ OptionValue

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initializes the option value.

Parameters:

  • type (Class, Hash, Array, Regexp) (defaults to: String)

    The type of the option value.

  • default (Object, Proc, nil) (defaults to: nil)

    The default parsed value for the option value.

  • usage (String, nil) (defaults to: self.class.default_usage(type))

    The optional usage string for the option value.

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments.

Options Hash (**kwargs):

  • required (Boolean)

    Specifies whether the option value is required or optional.



70
71
72
73
74
75
76
77
78
# File 'lib/command_kit/options/option_value.rb', line 70

def initialize(type:    String,
               default: nil,
               usage:   self.class.default_usage(type),
               **kwargs)
  super(usage: usage, **kwargs)

  @type    = type
  @default = default
end