class RProgram::NonOption

Attributes

multiple[R]

Can the argument be specified multiple times

name[R]

Name of the argument(s)

Public Class Methods

new(options={}) click to toggle source

Creates a new NonOption object.

@param [Hash] options

Additional options.

@option options [Symbol] :name

The name of the non-option.

@option options [true, false] :leading (true)

Implies the non-option is a leading non-option.

@option options [false, true] :tailing (false)

Implies the non-option is a tailing non-option.

@option options [false, true] :multiple (false)

Implies the non-option maybe given an Array of values.
# File lib/rprogram/non_option.rb, line 30
def initialize(options={})
  @name = options[:name]

  @tailing = if    options[:leading] then !options[:leading]
             elsif options[:tailing] then options[:tailing]
             else                         true
             end

  @multiple = (options[:multiple] || false)
end

Public Instance Methods

leading?() click to toggle source

Determines whether the non-option's arguments are leading.

@return [true, false]

Specifies whether the non-option's arguments are leading.
# File lib/rprogram/non_option.rb, line 57
def leading?
  !(@tailing)
end
tailing?() click to toggle source

Determines whether the non-option's arguments are tailing.

@return [true, false]

Specifies whether the non-option's arguments are tailing.
# File lib/rprogram/non_option.rb, line 47
def tailing?
  @tailing == true
end