Class: OptParseBuilder::Argument

Inherits:
Object
  • Object
show all
Defined in:
lib/opt_parse_builder/argument.rb

Overview

The base class for all arguments. You don’t create arguments explicitly; they are created by for you when you use the builder API.

Instance Method Summary collapse

Instance Method Details

#apply_option(_op) ⇒ Object

:nodoc:



38
39
# File 'lib/opt_parse_builder/argument.rb', line 38

def apply_option(_op) # :nodoc:
end

:nodoc:



23
24
25
# File 'lib/opt_parse_builder/argument.rb', line 23

def banner_lines # :nodoc:
  []
end

:nodoc:



34
35
36
# File 'lib/opt_parse_builder/argument.rb', line 34

def footer_lines # :nodoc:
  []
end

#keyObject

:nodoc:



8
9
# File 'lib/opt_parse_builder/argument.rb', line 8

def key # :nodoc:
end

#operand_notationObject

:nodoc:



27
28
# File 'lib/opt_parse_builder/argument.rb', line 27

def operand_notation # :nodoc:
end

#optionalObject

Convert from a required operand to an optional one, returning a new argument. Raises an error if that isn’t possible.

Raises:



53
54
55
56
# File 'lib/opt_parse_builder/argument.rb', line 53

def optional
  raise BuildError,
        "cannot convert #{self.class.name} to an optional operand"
end

#requiredObject

Convert from a required operand to an optional one, returning a new argument. Raises an error if that isn’t possible.

Raises:



60
61
62
63
# File 'lib/opt_parse_builder/argument.rb', line 60

def required
  raise BuildError,
        "cannot convert #{self.class.name} to a required operand"
end

#resetObject

:nodoc:



44
45
# File 'lib/opt_parse_builder/argument.rb', line 44

def reset # :nodoc:
end

#separator_linesObject

:nodoc:



30
31
32
# File 'lib/opt_parse_builder/argument.rb', line 30

def separator_lines # :nodoc:
  []
end

#shift_operand(_argv) ⇒ Object

:nodoc:



41
42
# File 'lib/opt_parse_builder/argument.rb', line 41

def shift_operand(_argv) # :nodoc:
end

#to_aObject

:nodoc:



47
48
49
# File 'lib/opt_parse_builder/argument.rb', line 47

def to_a # :nodoc:
  [self]
end

#valueObject

Get an argument’s value. Returns nil if the argument has no value. This is made public for the use of a handler proc (See ArgumentBuilder#handler).



14
15
# File 'lib/opt_parse_builder/argument.rb', line 14

def value
end

#value=(_v) ⇒ Object

Set the argument’s value. Does nothing if the argument has no value. This is made public for the use of a handler proc (See ArgumentBuilder#handler).



20
21
# File 'lib/opt_parse_builder/argument.rb', line 20

def value=(_v)
end