Exception: Drydock::ArgError

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/drydock.rb

Direct Known Subclasses

OptError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ ArgError

Returns a new instance of ArgError.



45
46
47
48
49
50
# File 'lib/drydock.rb', line 45

def initialize(*args)
  @msg = args.shift if args.size == 1
  @arg, @cmd, @msg = *args
  @cmd ||= 'COMMAND'
  @msg = nil if @msg && @msg.empty?
end

Instance Attribute Details

#argObject (readonly)

Returns the value of attribute arg.



44
45
46
# File 'lib/drydock.rb', line 44

def arg
  @arg
end

#cmdObject (readonly)

Returns the value of attribute cmd.



44
45
46
# File 'lib/drydock.rb', line 44

def cmd
  @cmd
end

#msgObject (readonly)

Returns the value of attribute msg.



44
45
46
# File 'lib/drydock.rb', line 44

def msg
  @msg
end

Instance Method Details

#messageObject



51
# File 'lib/drydock.rb', line 51

def message; @msg || "Error: No #{@arg} provided"; end

#usageObject



52
# File 'lib/drydock.rb', line 52

def usage; "See: #{$0} #{@cmd} -h"; end