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.



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

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.



41
42
43
# File 'lib/drydock.rb', line 41

def arg
  @arg
end

#cmdObject (readonly)

Returns the value of attribute cmd.



41
42
43
# File 'lib/drydock.rb', line 41

def cmd
  @cmd
end

#msgObject (readonly)

Returns the value of attribute msg.



41
42
43
# File 'lib/drydock.rb', line 41

def msg
  @msg
end

Instance Method Details

#messageObject



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

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

#usageObject



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

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