From d8aa37614354b1638bd8c73a3d8104dfdf39c08e Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Fri, 23 Nov 2012 13:49:07 +0000 Subject: Ensure we have a sane argument to our constructor. --- lib/custodian/util/ping.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/custodian/util/ping.rb') diff --git a/lib/custodian/util/ping.rb b/lib/custodian/util/ping.rb index 86fa2ab..9abc746 100644 --- a/lib/custodian/util/ping.rb +++ b/lib/custodian/util/ping.rb @@ -25,6 +25,10 @@ module Custodian # Save the hostname away, resolve it if possible. # def initialize( hostname ) + + raise ArgumentError, "Hostname must not be nil" if ( hostname.nil? ) + raise ArgumentError, "Hostname must be a String" unless hostname.kind_of?( String ) + @hostname = hostname @resolved = Custodian::Util::DNS.hostname_to_ip( hostname ) end -- cgit v1.2.1