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.
59 60 61 62 63 64 65 66 |
# File 'lib/hiptest-publisher/options_parser.rb', line 59 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.
57 58 59 |
# File 'lib/hiptest-publisher/options_parser.rb', line 57 def attribute @attribute end |
#default ⇒ Object (readonly)
Returns the value of attribute default.
57 58 59 |
# File 'lib/hiptest-publisher/options_parser.rb', line 57 def default @default end |
#help ⇒ Object (readonly)
Returns the value of attribute help.
57 58 59 |
# File 'lib/hiptest-publisher/options_parser.rb', line 57 def help @help end |
#long ⇒ Object (readonly)
Returns the value of attribute long.
57 58 59 |
# File 'lib/hiptest-publisher/options_parser.rb', line 57 def long @long end |
#short ⇒ Object (readonly)
Returns the value of attribute short.
57 58 59 |
# File 'lib/hiptest-publisher/options_parser.rb', line 57 def short @short end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
57 58 59 |
# File 'lib/hiptest-publisher/options_parser.rb', line 57 def type @type end |
Instance Method Details
#register(opts, options) ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/hiptest-publisher/options_parser.rb', line 76 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 |