lib/lita/handlers/web_title.rb in lita-web-title-1.0.5 vs lib/lita/handlers/web_title.rb in lita-web-title-1.0.6

- old
+ new

@@ -10,14 +10,17 @@ "URL" => "Responds with the title of the web page at URL" }) def parse_uri_request(request) requestUri = URI::extract(request.message.body, URI_PROTOCOLS).first - if config.ignore_patterns.kind_of?(String) then - Array(config.ignore_patterns) + if config.ignore_patterns then + if config.ignore_patterns.kind_of?(String) then + Array(config.ignore_patterns) + end + config.ignore_patterns.each do |pattern| + return if requestUri.match(%r{#{pattern}}) + end end - re = Regexp.union(%r(#{config.ignore_patterns})) - return if requestUri.match(re) result = parse_uri(requestUri) request.reply(result.delete("\n").strip) unless result.nil? end def parse_uri(uriString)