Class: RProgram::NonOption
- Defined in:
- lib/rprogram/non_option.rb
Instance Attribute Summary collapse
-
#multiple ⇒ Object
readonly
Can the argument be specified multiple times.
-
#name ⇒ Object
readonly
Name of the argument(s).
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ NonOption
constructor
Creates a new NonOption object.
-
#leading? ⇒ true, false
Determines whether the non-option's arguments are leading.
-
#tailing? ⇒ true, false
Determines whether the non-option's arguments are tailing.
Methods inherited from Argument
Constructor Details
#initialize(options = {}) ⇒ NonOption
Creates a new NonOption object.
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/rprogram/non_option.rb', line 30 def initialize(={}) @name = [:name] @tailing = if [:leading] then ![:leading] elsif [:tailing] then [:tailing] else true end @multiple = ([:multiple] || false) end |
Instance Attribute Details
#multiple ⇒ Object (readonly)
Can the argument be specified multiple times
10 11 12 |
# File 'lib/rprogram/non_option.rb', line 10 def multiple @multiple end |
#name ⇒ Object (readonly)
Name of the argument(s)
7 8 9 |
# File 'lib/rprogram/non_option.rb', line 7 def name @name end |
Instance Method Details
#leading? ⇒ true, false
Determines whether the non-option's arguments are leading.
57 58 59 |
# File 'lib/rprogram/non_option.rb', line 57 def leading? !(@tailing) end |
#tailing? ⇒ true, false
Determines whether the non-option's arguments are tailing.
47 48 49 |
# File 'lib/rprogram/non_option.rb', line 47 def tailing? @tailing == true end |