postrank-uri 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -72,9 +72,9 @@ module PostRank
72
72
  urls = []
73
73
  text.to_s.scan(URIREGEX[:valid_url]) do |all, before, url, protocol, domain, path, query|
74
74
  begin
75
- url = clean(url).to_s
75
+ url = clean(url)
76
76
  Domainatrix.parse(url)
77
- urls.push url
77
+ urls.push url.to_s
78
78
  rescue NoMethodError
79
79
  end
80
80
  end
@@ -86,7 +86,7 @@ module PostRank
86
86
  urls = []
87
87
  Nokogiri.HTML(text).search('a').each do |a|
88
88
  begin
89
- url = normalize(c18n(unescape(a.attr('href'))))
89
+ url = clean(a.attr('href'), false)
90
90
  if url.host.empty?
91
91
  next if host.nil?
92
92
  url.host = host
@@ -112,8 +112,9 @@ module PostRank
112
112
  end
113
113
  end
114
114
 
115
- def clean(uri)
116
- normalize(c18n(unescape(uri))).to_s
115
+ def clean(uri, string = true)
116
+ uri = normalize(c18n(unescape(uri)))
117
+ string ? uri.to_s : uri
117
118
  end
118
119
 
119
120
  def normalize(uri)
@@ -1,5 +1,5 @@
1
1
  module PostRank
2
2
  module URI
3
- VERSION = "1.0.3"
3
+ VERSION = "1.0.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 3
9
- version: 1.0.3
8
+ - 4
9
+ version: 1.0.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ilya Grigorik
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-01-25 00:00:00 -05:00
17
+ date: 2011-01-26 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency