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.



48
49
50
51
52
53
54
# File 'lib/drydock.rb', line 48

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

Instance Attribute Details

#argObject (readonly)

Returns the value of attribute arg.



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

def arg
  @arg
end

#cmdObject (readonly)

Returns the value of attribute cmd.



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

def cmd
  @cmd
end

#msgObject (readonly)

Returns the value of attribute msg.



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

def msg
  @msg
end

Instance Method Details

#messageObject



56
57
58
# File 'lib/drydock.rb', line 56

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

#usageObject



60
61
62
# File 'lib/drydock.rb', line 60

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