Sha256: 055647988e9f8e188fbac0e3d05e7518104a880488714233cb56c1ba21c89a17

Contents?: true

Size: 1.41 KB

Versions: 1

Compression:

Stored size: 1.41 KB

Contents

module OptParseBuilder

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

    def key # :nodoc:
    end

    # 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).
    def value
    end

    # 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).
    def value=(_v)
    end

    def banner_lines # :nodoc:
      []
    end

    def operand_notation # :nodoc:
    end

    def separator_lines # :nodoc:
      []
    end

    def apply_option(_op) # :nodoc:
    end

    def shift_operand(_argv) # :nodoc:
    end

    def reset # :nodoc:
    end

    def to_a # :nodoc:
      [self]
    end

    # Convert from a required operand to an optional one, returning a
    # new argument.  Raises an error if that isn't possible.
    def optional
      raise BuildError,
            "cannot convert #{self.class.name} to an optional operand"
    end

    # Convert from a required operand to an optional one, returning a
    # new argument.  Raises an error if that isn't possible.
    def required
      raise BuildError,
            "cannot convert #{self.class.name} to a required operand"
    end
       
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opt_parse_builder-0.1.0 lib/opt_parse_builder/argument.rb