Class: Option
- Inherits:
-
Object
- Object
- Option
- Defined in:
- lib/hiptest-publisher/options_parser.rb
Instance Attribute Summary collapse
-
#attribute ⇒ Object
readonly
Returns the value of attribute attribute.
-
#default ⇒ Object
readonly
Returns the value of attribute default.
-
#help ⇒ Object
readonly
Returns the value of attribute help.
-
#long ⇒ Object
readonly
Returns the value of attribute long.
-
#short ⇒ Object
readonly
Returns the value of attribute short.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(short, long, default, type, help, attribute) ⇒ Option
constructor
A new instance of Option.
- #register(opts, options) ⇒ Object
Constructor Details
#initialize(short, long, default, type, help, attribute) ⇒ Option
Returns a new instance of Option.
24 25 26 27 28 29 30 31 |
# File 'lib/hiptest-publisher/options_parser.rb', line 24 def initialize(short, long, default, type, help, attribute) @short = short @long = long @default = default @type = type @help = help @attribute = attribute end |
Instance Attribute Details
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
22 23 24 |
# File 'lib/hiptest-publisher/options_parser.rb', line 22 def attribute @attribute end |
#default ⇒ Object (readonly)
Returns the value of attribute default.
22 23 24 |
# File 'lib/hiptest-publisher/options_parser.rb', line 22 def default @default end |
#help ⇒ Object (readonly)
Returns the value of attribute help.
22 23 24 |
# File 'lib/hiptest-publisher/options_parser.rb', line 22 def help @help end |
#long ⇒ Object (readonly)
Returns the value of attribute long.
22 23 24 |
# File 'lib/hiptest-publisher/options_parser.rb', line 22 def long @long end |
#short ⇒ Object (readonly)
Returns the value of attribute short.
22 23 24 |
# File 'lib/hiptest-publisher/options_parser.rb', line 22 def short @short end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
22 23 24 |
# File 'lib/hiptest-publisher/options_parser.rb', line 22 def type @type end |
Instance Method Details
#register(opts, options) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/hiptest-publisher/options_parser.rb', line 41 def register(opts, ) [attribute] = @default unless default.nil? on_values = [ @short ? "-#{@short}" : nil, "--#{@long}", @type, help ].compact opts.on(*on_values) do |value| [attribute] = value .__cli_args << attribute end end |