class Opt::Command::Result

A hash-like result object.

Allow for method-access to all key-value pairs similar to `OpenStruct`.

@example

result = opt.parse %w(--help --level=5 add --exec bash sh)
result.help? #=> true
result.level #=> "5"
result.command #=> ["add"]
result.exec #=> ["bash", "sh"]

Attributes

command[R]

A list of command names.

@return [Array<String>] List of commands.

Public Class Methods

new() click to toggle source

@api private

Calls superclass method
# File lib/opt/command.rb, line 230
def initialize
  @command = []
  super
end

Public Instance Methods

method_missing(mth, *args, &block) click to toggle source

@api private

Calls superclass method
# File lib/opt/command.rb, line 247
def method_missing(mth, *args, &block)
  if mth =~ /^(\w+)\??$/ && key?($1) && args.empty? && block.nil?
    fetch $1
  else
    super
  end
end
respond_to_missing?(mth) click to toggle source

@api private

Calls superclass method
# File lib/opt/command.rb, line 237
def respond_to_missing?(mth)
  if mth =~ /^(\w)\??$/ && key?($1)
    true
  else
    super
  end
end