Class: Gestopft::Option
- Inherits:
-
Object
- Object
- Gestopft::Option
- Defined in:
- lib/gestopft/option.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
(also: #desc)
readonly
Returns the value of attribute description.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
- #arity ⇒ Object
-
#initialize(name, args = {}) ⇒ Option
constructor
A new instance of Option.
- #option_name ⇒ Object
- #require_args? ⇒ Boolean
Constructor Details
#initialize(name, args = {}) ⇒ Option
Returns a new instance of Option.
7 8 9 10 11 |
# File 'lib/gestopft/option.rb', line 7 def initialize(name, args={}) @name = name @params = args[:params] || [] @description = args[:desc] || args[:description] || "" end |
Instance Attribute Details
#description ⇒ Object (readonly) Also known as: desc
Returns the value of attribute description.
4 5 6 |
# File 'lib/gestopft/option.rb', line 4 def description @description end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/gestopft/option.rb', line 4 def name @name end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
4 5 6 |
# File 'lib/gestopft/option.rb', line 4 def params @params end |
Instance Method Details
#arity ⇒ Object
21 22 23 |
# File 'lib/gestopft/option.rb', line 21 def arity @params.size end |
#option_name ⇒ Object
13 14 15 |
# File 'lib/gestopft/option.rb', line 13 def option_name @name.to_option end |
#require_args? ⇒ Boolean
17 18 19 |
# File 'lib/gestopft/option.rb', line 17 def require_args? !@params.empty? end |