Exception: UsageError

Inherits:
RuntimeError
  • Object
show all
Defined in:
Library/Homebrew/exceptions.rb

Direct Known Subclasses

FormulaUnspecifiedError, KegUnspecifiedError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reason = nil) ⇒ UsageError

Returns a new instance of UsageError



4
5
6
# File 'Library/Homebrew/exceptions.rb', line 4

def initialize(reason = nil)
  @reason = reason
end

Instance Attribute Details

#reasonObject (readonly)

Returns the value of attribute reason



2
3
4
# File 'Library/Homebrew/exceptions.rb', line 2

def reason
  @reason
end

Instance Method Details

#to_sObject



8
9
10
11
12
# File 'Library/Homebrew/exceptions.rb', line 8

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