uri-subdomain 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/uri/subdomain.rb +12 -2
- metadata +4 -4
data/lib/uri/subdomain.rb
CHANGED
@@ -2,14 +2,24 @@ require 'uri'
|
|
2
2
|
|
3
3
|
module URI::Subdomain
|
4
4
|
|
5
|
-
VERSION = "0.0.
|
5
|
+
VERSION = "0.0.4"
|
6
6
|
|
7
7
|
def domain
|
8
8
|
host.split('.').last(2).join('.') if host
|
9
9
|
end
|
10
10
|
|
11
|
+
def domain= domain
|
12
|
+
if subdomain.nil?
|
13
|
+
self.host = domain
|
14
|
+
else
|
15
|
+
self.host = "#{subdomain}.#{domain}"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
11
19
|
def subdomain
|
12
|
-
|
20
|
+
return nil if host.nil?
|
21
|
+
subdomain = host.split('.').tap(&:pop).tap(&:pop).join('.')
|
22
|
+
subdomain == "" ? nil : subdomain
|
13
23
|
end
|
14
24
|
|
15
25
|
def subdomain= subdomain
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uri-subdomain
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jared
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-10-
|
18
|
+
date: 2011-10-21 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|