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.
@@ -7,6 +7,7 @@ script/console
7
7
  script/destroy
8
8
  script/generate
9
9
  spec/hugeurl_spec.rb
10
+ spec/uri_spec.rb
10
11
  spec/spec.opts
11
12
  spec/spec_helper.rb
12
13
  tasks/rspec.rake
@@ -11,7 +11,7 @@ expand tinyurl and bit.ly
11
11
 
12
12
  require 'rubygems'
13
13
  require 'hugeurl'
14
- puts Hugeurl.get("http://bit.ly/d4VYD2") # get expanded URI instance
14
+ puts URI.parse("http://bit.ly/d4VYD2").to_huge # get expanded URI instance
15
15
 
16
16
  == REQUIREMENTS:
17
17
 
@@ -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 " => " + Hugeurl.get(tinyurl).to_s
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 " => " + Hugeurl.get(bitly).to_s
10
+ puts " => " + bitly.to_huge.to_s
@@ -6,10 +6,15 @@ require 'uri'
6
6
  require 'open-uri'
7
7
 
8
8
  module Hugeurl
9
- VERSION = '0.0.1'
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
@@ -28,3 +28,4 @@ describe Hugeurl, 'expand URI instance "http://bit.ly/d4VYD2"' do
28
28
  @res.to_s.should == 'http://shokai.org'
29
29
  end
30
30
  end
31
+
@@ -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: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
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-17 00:00:00 +09:00
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