lib/spidr/sanitizers.rb in spidr-0.2.7 vs lib/spidr/sanitizers.rb in spidr-0.3.0

- old
+ new

@@ -1,11 +1,11 @@ require 'uri' module Spidr # # The {Sanitizers} module adds methods to {Agent} which control the - # sanitization of incoming links. + # sanitation of incoming links. # module Sanitizers def self.included(base) base.module_eval do # Specifies whether the Agent will strip URI fragments @@ -15,11 +15,11 @@ attr_accessor :strip_query end end # - # Initializes the sanitization rules. + # Initializes the Sanitizer rules. # # @param [Hash] options # Additional options. # # @option options [Boolean] :strip_fragments (true) @@ -50,10 +50,10 @@ # The new sanitized URL. # # @since 0.2.2 # def sanitize_url(url) - url = URI(url.to_s) + url = URI(url.to_s) unless url.kind_of?(URI) url.fragment = nil if @strip_fragments url.query = nil if @strip_query return url