Class: GetArgs::Argument
- Inherits:
-
Object
- Object
- GetArgs::Argument
- Defined in:
- lib/argument_list.rb
Instance Attribute Summary collapse
-
#default ⇒ Object
readonly
Returns the value of attribute default.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(arg_array) ⇒ Argument
constructor
A new instance of Argument.
- #multiple? ⇒ Boolean
- #optional? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(arg_array) ⇒ Argument
Returns a new instance of Argument.
15 16 17 18 |
# File 'lib/argument_list.rb', line 15 def initialize(arg_array) @optional = arg_array.length > 1 @name, @default = *arg_array end |
Instance Attribute Details
#default ⇒ Object (readonly)
Returns the value of attribute default.
13 14 15 |
# File 'lib/argument_list.rb', line 13 def default @default end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
13 14 15 |
# File 'lib/argument_list.rb', line 13 def name @name end |
Instance Method Details
#multiple? ⇒ Boolean
24 25 26 |
# File 'lib/argument_list.rb', line 24 def multiple? name.to_s.slice(0,1) == '*' end |
#optional? ⇒ Boolean
20 21 22 |
# File 'lib/argument_list.rb', line 20 def optional? @optional end |
#to_s ⇒ Object
28 29 30 |
# File 'lib/argument_list.rb', line 28 def to_s name end |