Class: Argy::Option
Overview
An option to be parsed from the command line
Instance Attribute Summary collapse
-
#aliases ⇒ Array<String>
readonly
A list of alternative flags.
Instance Method Summary collapse
-
#initialize(*args, aliases: [], **opts) ⇒ Option
constructor
Create a new Option.
-
#label ⇒ String
The display label for the argument.
Constructor Details
#initialize(*args, aliases: [], **opts) ⇒ Option
Create a new Option
17 18 19 20 |
# File 'lib/argy/option.rb', line 17 def initialize(*args, aliases: [], **opts) super(*args, **opts) @aliases = aliases end |
Instance Attribute Details
#aliases ⇒ Array<String> (readonly)
A list of alternative flags
8 9 10 |
# File 'lib/argy/option.rb', line 8 def aliases @aliases end |
Instance Method Details
#label ⇒ String
The display label for the argument
24 25 26 27 28 29 30 31 |
# File 'lib/argy/option.rb', line 24 def label case type when :boolean "--[no-]#{name.to_s.tr("_", "-")}" else "--#{name.to_s.tr("_", "-")}" end end |