Permalink
Browse files

Extract ip host regexp to a constant

  • Loading branch information...
1 parent e927f06 commit 6e23c235184ecc72f4e68508fda91bba0652b6e2 @carlosantoniodasilva carlosantoniodasilva committed Jan 12, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 actionpack/lib/action_dispatch/http/url.rb
@@ -1,6 +1,8 @@
module ActionDispatch
module Http
module URL
+ IP_HOST_REGEXP = /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/
+
mattr_accessor :tld_length
self.tld_length = 1
@@ -52,7 +54,7 @@ def url_for(options = {})
private
def named_host?(host)
- !(host.nil? || /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.match(host))
+ !(host.nil? || IP_HOST_REGEXP.match(host))
end
def rewrite_authentication(options)

0 comments on commit 6e23c23

Please sign in to comment.