Class: TomParse::Option
- Inherits:
-
Object
- Object
- TomParse::Option
- Defined in:
- lib/tomparse/option.rb
Overview
Encapsulate a named parameter.
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, description = '') ⇒ Option
constructor
Create new Argument object.
-
#required? ⇒ Boolean
Is this a required option?.
Constructor Details
#initialize(name, description = '') ⇒ Option
Create new Argument object.
16 17 18 19 |
# File 'lib/tomparse/option.rb', line 16 def initialize(name, description = '') @name = name.to_s.intern @description = description end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
9 10 11 |
# File 'lib/tomparse/option.rb', line 9 def description @description end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/tomparse/option.rb', line 7 def name @name end |
Instance Method Details
#required? ⇒ Boolean
Is this a required option?
24 25 26 |
# File 'lib/tomparse/option.rb', line 24 def required? @description.downcase.include? 'required' end |