hugeurl 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +4 -0
- data/README.rdoc +1 -1
- data/bin/hugeurl +1 -0
- data/lib/hugeurl.rb +9 -3
- metadata +5 -5
data/History.txt
CHANGED
data/README.rdoc
CHANGED
data/bin/hugeurl
CHANGED
data/lib/hugeurl.rb
CHANGED
@@ -4,13 +4,19 @@ $:.unshift(File.dirname(__FILE__)) unless
|
|
4
4
|
require 'rubygems'
|
5
5
|
require 'uri'
|
6
6
|
require 'net/http'
|
7
|
+
require 'net/https'
|
7
8
|
|
8
9
|
module Hugeurl
|
9
|
-
VERSION = '0.0.
|
10
|
+
VERSION = '0.0.5'
|
10
11
|
def self.get(url)
|
11
12
|
url = URI.parse url unless url.class.to_s =~ /^URI::/
|
12
|
-
|
13
|
-
|
13
|
+
if url.class == URI::HTTPS
|
14
|
+
http = Net::HTTP.new(url.host, 443)
|
15
|
+
http.use_ssl = true
|
16
|
+
else
|
17
|
+
http = Net::HTTP.new(url.host, url.port)
|
18
|
+
end
|
19
|
+
res = http.head(url.path.size < 1 ? '/' : url.path)
|
14
20
|
URI.parse res['location'] rescue return url
|
15
21
|
end
|
16
22
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hugeurl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sho Hashimoto
|
@@ -63,7 +63,7 @@ dependencies:
|
|
63
63
|
version: "2.15"
|
64
64
|
type: :development
|
65
65
|
version_requirements: *id003
|
66
|
-
description: expand tinyurl and
|
66
|
+
description: expand tinyurl, bit.ly, t.co and more.
|
67
67
|
email:
|
68
68
|
- hashimoto@shokai.org
|
69
69
|
executables:
|
@@ -121,7 +121,7 @@ rubyforge_project: hugeurl
|
|
121
121
|
rubygems_version: 1.8.17
|
122
122
|
signing_key:
|
123
123
|
specification_version: 3
|
124
|
-
summary: expand tinyurl and
|
124
|
+
summary: expand tinyurl, bit.ly, t.co and more.
|
125
125
|
test_files:
|
126
126
|
- test/test_helper.rb
|
127
127
|
- test/test_hugeurl.rb
|