Class: Cmdlib::Option
- Inherits:
-
Object
- Object
- Cmdlib::Option
- Defined in:
- lib/cmdlib/option.rb
Overview
Class for create option object.
Instance Attribute Summary collapse
-
#brief ⇒ Object
Contain text with describe option (String).
-
#longname ⇒ Object
Contain text with option long name (String).
-
#param ⇒ Object
Contain parameter tag, the option can be have a parameter.
-
#shortname ⇒ Object
Contain text with option short name (String).
-
#value ⇒ Object
Contain option value.
Instance Method Summary collapse
-
#initialize(sname, lname, brief = '', param = false) ⇒ Option
constructor
Set option shortname (sname) and longname (lname).
Constructor Details
#initialize(sname, lname, brief = '', param = false) ⇒ Option
Set option shortname (sname) and longname (lname).
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/cmdlib/option.rb', line 21 def initialize ( sname, lname, brief = '', param = false ) raise TypeError, 'Incorrectly types for option constructor.' unless sname.instance_of? String and lname.instance_of? String and brief.instance_of? String @shortname = sname @longname = lname @brief = brief @value = nil @param = param end |
Instance Attribute Details
#brief ⇒ Object
Contain text with describe option (String).
12 13 14 |
# File 'lib/cmdlib/option.rb', line 12 def brief @brief end |
#longname ⇒ Object
Contain text with option long name (String).
9 10 11 |
# File 'lib/cmdlib/option.rb', line 9 def longname @longname end |
#param ⇒ Object
Contain parameter tag, the option can be have a parameter.
18 19 20 |
# File 'lib/cmdlib/option.rb', line 18 def param @param end |
#shortname ⇒ Object
Contain text with option short name (String).
6 7 8 |
# File 'lib/cmdlib/option.rb', line 6 def shortname @shortname end |
#value ⇒ Object
Contain option value.
15 16 17 |
# File 'lib/cmdlib/option.rb', line 15 def value @value end |