Exception: UsageError

Inherits:
RuntimeError
  • Object
show all
Extended by:
T::Sig
Defined in:
exceptions.rb

Overview

Raised when a command is used wrong.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reason = nil) ⇒ UsageError

Returns a new instance of UsageError.



13
14
15
16
17
# File 'exceptions.rb', line 13

def initialize(reason = nil)
  super

  @reason = reason
end

Instance Attribute Details

#reasonObject (readonly)

Returns the value of attribute reason.



11
12
13
# File 'exceptions.rb', line 11

def reason
  @reason
end

Instance Method Details

#to_sString

Returns:



20
21
22
23
24
# File 'exceptions.rb', line 20

def to_s
  s = "Invalid usage"
  s += ": #{reason}" if reason
  s
end