uri-subdomain 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/Rakefile +1 -0
- data/lib/uri/subdomain.rb +21 -0
- data/uri-subdomain.gemspec +22 -0
- metadata +85 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'uri'
|
2
|
+
|
3
|
+
module URI::Subdomain
|
4
|
+
|
5
|
+
VERSION = "0.0.1"
|
6
|
+
|
7
|
+
def domain
|
8
|
+
host.split('.').last(2).join('.')
|
9
|
+
end
|
10
|
+
|
11
|
+
def subdomain
|
12
|
+
host.split('.').tap(&:pop).tap(&:pop).join('.')
|
13
|
+
end
|
14
|
+
|
15
|
+
def subdomain= subdomain
|
16
|
+
self.host = "#{subdomain}.#{domain}"
|
17
|
+
end
|
18
|
+
|
19
|
+
URI::HTTP.send :include, self
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "uri/subdomain"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "uri-subdomain"
|
7
|
+
s.version = URI::Subdomain::VERSION
|
8
|
+
s.authors = ["Jared"]
|
9
|
+
s.email = ["jared@change.org"]
|
10
|
+
s.homepage = ""
|
11
|
+
s.summary = %q{add subdomain methods to URI::HTTP}
|
12
|
+
s.description = %q{add subdomain methods to URI::HTTP}
|
13
|
+
|
14
|
+
s.rubyforge_project = "uri-subdomain"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
s.add_development_dependency "rake"
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: uri-subdomain
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Jared
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-10-18 00:00:00 -07:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: rake
|
23
|
+
type: :development
|
24
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
prerelease: false
|
34
|
+
requirement: *id001
|
35
|
+
description: add subdomain methods to URI::HTTP
|
36
|
+
email:
|
37
|
+
- jared@change.org
|
38
|
+
executables: []
|
39
|
+
|
40
|
+
extensions: []
|
41
|
+
|
42
|
+
extra_rdoc_files: []
|
43
|
+
|
44
|
+
files:
|
45
|
+
- .gitignore
|
46
|
+
- Gemfile
|
47
|
+
- Rakefile
|
48
|
+
- lib/uri/subdomain.rb
|
49
|
+
- uri-subdomain.gemspec
|
50
|
+
has_rdoc: true
|
51
|
+
homepage: ""
|
52
|
+
licenses: []
|
53
|
+
|
54
|
+
post_install_message:
|
55
|
+
rdoc_options: []
|
56
|
+
|
57
|
+
require_paths:
|
58
|
+
- lib
|
59
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
hash: 3
|
65
|
+
segments:
|
66
|
+
- 0
|
67
|
+
version: "0"
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
hash: 3
|
74
|
+
segments:
|
75
|
+
- 0
|
76
|
+
version: "0"
|
77
|
+
requirements: []
|
78
|
+
|
79
|
+
rubyforge_project: uri-subdomain
|
80
|
+
rubygems_version: 1.5.3
|
81
|
+
signing_key:
|
82
|
+
specification_version: 3
|
83
|
+
summary: add subdomain methods to URI::HTTP
|
84
|
+
test_files: []
|
85
|
+
|