diff options
author | Steve Kemp <steve@steve.org.uk> | 2012-11-24 16:32:35 +0000 |
---|---|---|
committer | Steve Kemp <steve@steve.org.uk> | 2012-11-24 16:32:35 +0000 |
commit | 31054d667bfec0227e0973b35b6a5137c56ffcd1 (patch) | |
tree | 70281ef425a2ed938e092317d75cc94d7dffcc64 /lib/custodian/alertfactory.rb | |
parent | 50a392b21a03476127ba1339ebf8c09146fa0c30 (diff) |
The argument to our class factories must be a non-nil string.
Diffstat (limited to 'lib/custodian/alertfactory.rb')
-rw-r--r-- | lib/custodian/alertfactory.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/custodian/alertfactory.rb b/lib/custodian/alertfactory.rb index e176f6d..3df6233 100644 --- a/lib/custodian/alertfactory.rb +++ b/lib/custodian/alertfactory.rb @@ -31,6 +31,9 @@ module Custodian # def self.create( alert_type, obj ) + raise ArgumentError, "The type of alerter to create cannot be nil" if ( alert_type.nil? ) + raise ArgumentError, "The type of alerter to create must be a string" unless ( alert_type.kind_of? String ) + c = @@subclasses[alert_type] if c c.new( obj ) |