Class: Sanford::NoHostError

Inherits:
BaseError
  • Object
show all
Defined in:
lib/sanford/exceptions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host_name) ⇒ NoHostError

Returns a new instance of NoHostError.



10
11
12
13
14
15
16
17
# File 'lib/sanford/exceptions.rb', line 10

def initialize(host_name)
  message = if Sanford.hosts.empty?
    "No hosts have been defined. Please define a host before trying to run Sanford."
  else
    "A host couldn't be found with the name #{host_name.inspect}. "
  end
  super message
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



8
9
10
# File 'lib/sanford/exceptions.rb', line 8

def message
  @message
end