Method: CommandKit::Options::Option#initialize
- Defined in:
- lib/command_kit/options/option.rb
#initialize(name, short: nil, long: self.class.default_long_opt(name), equals: false, value: nil, desc:) {|(value)| ... } ⇒ Option
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.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/command_kit/options/option.rb', line 86 def initialize(name, short: nil, long: self.class.default_long_opt(name), equals: false, value: nil, desc: , &block) @name = name @short = short @long = long @equals = equals @value = case value when Hash then OptionValue.new(**value) when true then OptionValue.new() when false, nil then nil else raise(TypeError,"value: keyword must be Hash, true, false, or nil") end @desc = desc @block = block end |