return host info if available in HostCommunicationError's addr_to_s

git-svn-id: file:///home/svn/framework3/trunk@6208 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
kris 2009-02-06 14:15:54 +00:00
parent 4e0bc60ce1
commit 2c039a87d2
1 changed files with 9 additions and 3 deletions

View File

@ -151,11 +151,17 @@ module HostCommunicationError
end
#
# This method returns a printable address and port associated with the host
# that triggered the exception.
# This method returns a printable address and optional port associated
# with the host that triggered the exception.
#
def addr_to_s
(host && port) ? "(#{host}:#{port})" : ""
if host and port
"(#{host}:#{port})"
elsif host
"(#{host})"
else
""
end
end
attr_accessor :host, :port