Class: OptParseGen::Option
- Inherits:
-
Struct
- Object
- Struct
- OptParseGen::Option
- Defined in:
- lib/optparsegen.rb
Overview
Represents a single option.
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#name ⇒ Object
Returns the value of attribute name.
-
#short ⇒ Object
Returns the value of attribute short.
Instance Method Summary collapse
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description
6 7 8 |
# File 'lib/optparsegen.rb', line 6 def description @description end |
#name ⇒ Object
Returns the value of attribute name
6 7 8 |
# File 'lib/optparsegen.rb', line 6 def name @name end |
#short ⇒ Object
Returns the value of attribute short
6 7 8 |
# File 'lib/optparsegen.rb', line 6 def short @short end |
Instance Method Details
#opt_args ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/optparsegen.rb', line 15 def opt_args args = [] args.push "--#{name}" if name args.push "-#{short}" if short args.push description if description args end |
#symbol_name ⇒ Object
11 12 13 |
# File 'lib/optparsegen.rb', line 11 def symbol_name ":#{underscored_name}" end |
#underscored_name ⇒ Object
7 8 9 |
# File 'lib/optparsegen.rb', line 7 def underscored_name name.sub('-', '_') end |