lib/devdnsd/rule.rb in devdnsd-1.0.3 vs lib/devdnsd/rule.rb in devdnsd-1.1.0

- old
+ new

@@ -44,11 +44,11 @@ @reply = block.blank? ? reply : nil @options = options @block = block raise(DevDNSd::Errors::InvalidRule.new("You must specify at least a rule and a host (also via a block). Optionally you can add a record type (default: A) and the options.")) if @reply.blank? && @block.nil? - raise(DevDNSd::Errors::InvalidRule.new("You can only use hashs for options.")) if !@options.is_a?(Hash) + raise(DevDNSd::Errors::InvalidRule.new("You can only use hashs for options.")) if !@options.is_a?(::Hash) end # Returns the resource class(es) for the current rule. # # @return [Array|Class] The class(es) for the current rule. @@ -59,11 +59,11 @@ # Checks if the rule is a regexp. # # @return [Boolean] `true` if the rule is a Regexp, `false` otherwise. def is_regexp? - self.match.is_a?(Regexp) + self.match.is_a?(::Regexp) end # Checks if the rule is a regexp. # # @return [Boolean] `true` if the rule has a block, `false` otherwise. @@ -86,11 +86,11 @@ # @param type [Symbol] The type of request to match. This is ignored if a block is provided. # @param options [Hash] A list of options for the request. # @param block [Proc] An optional block to compute the reply instead of using the `reply_or_type` parameter. In this case `reply_or_type` is used for the type of the request and `type` is ignored. def self.create(match, reply_or_type = nil, type = nil, options = {}, &block) raise(DevDNSd::Errors::InvalidRule.new("You must specify at least a rule and a host (also via a block). Optionally you can add a record type (default: A) and the options.")) if reply_or_type.blank? && block.nil? - raise(DevDNSd::Errors::InvalidRule.new("You can only use hashs for options.")) if !options.is_a?(Hash) + raise(DevDNSd::Errors::InvalidRule.new("You can only use hashs for options.")) if !options.is_a?(::Hash) rv = self.new(match) rv.options = options if block.present? then # reply_or_type acts like a type, type is ignored @@ -120,10 +120,10 @@ def self.symbol_to_resource_class(symbol) symbol = symbol.to_s.upcase begin "Resolv::DNS::Resource::IN::#{symbol}".constantize - rescue NameError + rescue ::NameError raise(DevDNSd::Errors::InvalidRule.new("Invalid resource class #{symbol}.")) end end end end