hugeurl 0.0.1 → 0.0.2
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/Manifest.txt +1 -0
- data/README.rdoc +1 -1
- data/examples/example.rb +3 -3
- data/lib/hugeurl.rb +6 -1
- data/spec/hugeurl_spec.rb +1 -0
- data/spec/uri_spec.rb +17 -0
- metadata +5 -4
data/Manifest.txt
CHANGED
data/README.rdoc
CHANGED
data/examples/example.rb
CHANGED
@@ -3,8 +3,8 @@ require File.dirname(__FILE__)+'/../lib/hugeurl'
|
|
3
3
|
|
4
4
|
tinyurl = URI.parse("http://tinyurl.com/242tthb")
|
5
5
|
puts tinyurl
|
6
|
-
puts " => " +
|
6
|
+
puts " => " + tinyurl.to_huge.to_s
|
7
7
|
|
8
|
-
bitly = "http://bit.ly/d4VYD2"
|
8
|
+
bitly = URI.parse("http://bit.ly/d4VYD2")
|
9
9
|
puts bitly
|
10
|
-
puts " => " +
|
10
|
+
puts " => " + bitly.to_huge.to_s
|
data/lib/hugeurl.rb
CHANGED
@@ -6,10 +6,15 @@ require 'uri'
|
|
6
6
|
require 'open-uri'
|
7
7
|
|
8
8
|
module Hugeurl
|
9
|
-
VERSION = '0.0.
|
9
|
+
VERSION = '0.0.2'
|
10
10
|
def Hugeurl.get(url)
|
11
11
|
res = open("http://search.twitter.com/hugeurl?url=#{url.to_s}").read
|
12
12
|
URI.parse(res)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
+
class URI::HTTP
|
17
|
+
def to_huge
|
18
|
+
Hugeurl.get(self)
|
19
|
+
end
|
20
|
+
end
|
data/spec/hugeurl_spec.rb
CHANGED
data/spec/uri_spec.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
|
+
require 'uri'
|
3
|
+
|
4
|
+
describe URI, 'URI.to_huge' do
|
5
|
+
before(:all) do
|
6
|
+
@res = URI.parse("http://tinyurl.com/242tthb").to_huge
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'should return URI instance' do
|
10
|
+
@res.class.should == URI::HTTP
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should return expanded URI' do
|
14
|
+
@res.to_s.should == 'http://shokai.org'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
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: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sho Hashimoto
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-09-
|
18
|
+
date: 2010-09-18 00:00:00 +09:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -70,6 +70,7 @@ files:
|
|
70
70
|
- script/destroy
|
71
71
|
- script/generate
|
72
72
|
- spec/hugeurl_spec.rb
|
73
|
+
- spec/uri_spec.rb
|
73
74
|
- spec/spec.opts
|
74
75
|
- spec/spec_helper.rb
|
75
76
|
- tasks/rspec.rake
|