ress 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -62,10 +62,16 @@ module Ress
62
62
  end
63
63
 
64
64
  def url(protocol, fullpath, subdomain)
65
- fullpath = fullpath[(subdomain.length + 1)..-1]
65
+
66
+ fullpath = fullpath[(subdomain.length + 1)..-1] unless subdomain.empty?
66
67
  begin
67
68
  if matches?(subdomain)
68
- return "#{protocol}#{subdomain}.#{fullpath}"
69
+ if subdomain.empty?
70
+ return "#{protocol}#{fullpath}"
71
+ else
72
+ return "#{protocol}#{subdomain}.#{fullpath}"
73
+ end
74
+
69
75
  end
70
76
  subdomain = subdomain.split('.')[1..-1].join('.')
71
77
  end while(!subdomain.empty?)
data/lib/ress/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ress
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -107,6 +107,13 @@ describe Ress::Subdomain do
107
107
  'http://foo.bar.com/some/stuff'
108
108
  end
109
109
 
110
+ it 'can handle empty subdomains' do
111
+ subdomain = Ress::Subdomain::RegexpSubdomain.new(/^(?!(m|tablet)\.).*$/)
112
+ subdomain.matches?('').should be_true
113
+ subdomain.url('http://', 'somewhere.com/some/stuff', '').should ==
114
+ 'http://somewhere.com/some/stuff'
115
+ end
116
+
110
117
  end
111
118
  end
112
119
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: ress
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.7
5
+ version: 0.0.8
6
6
  platform: ruby
7
7
  authors:
8
8
  - Matthew Robertson