Skip to content

Commit

Permalink
using regexps instead of splitting on .
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Robertson committed Feb 5, 2013
1 parent e3b8d93 commit 91f8ef9
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/ress/subdomain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 91f8ef9

Please sign in to comment.