Permalink
Browse files

using regexps instead of splitting on .

  • Loading branch information...
1 parent e3b8d93 commit 91f8ef95a848422b3f0ba11e66b1905eeeb6a341 @matthewrobertson committed Feb 5, 2013
Showing with 1 addition and 3 deletions.
  1. +1 −3 lib/ress/subdomain.rb
View
@@ -63,11 +63,9 @@ def matches?(subdomain)
def url(protocol, fullpath, subdomain)
fullpath = fullpath[(subdomain.length + 1)..-1] unless subdomain.empty?
- subdomains = subdomain.split('.')
begin
- subdomain = subdomains.join('.')
return build_url(protocol, subdomain, fullpath) if matches?(subdomain)
- end while(subdomains = subdomains[1..-1])
+ end while( subdomain.slice!(/^[^\.]+\.?/) )
end
private

0 comments on commit 91f8ef9

Please sign in to comment.