metapage 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1e864cae0626afd75c19e1887743f5909532b658
4
- data.tar.gz: 44cd6928669d3af624ac8362ff426d3021419df2
3
+ metadata.gz: c1224345899cff60c51e9fe1051caa6d2c65d55b
4
+ data.tar.gz: be3eb9eb0b8f637e1560f3bb2f5d5651f399fc75
5
5
  SHA512:
6
- metadata.gz: 73606a697e7c6adc7448d71f3b2daa9b92c960360401aadaa757aeb30610896c66d2f22c5bf19a9727b264da58d40a3b0d0e8ec0f684d3dd5786cc41089b4f3d
7
- data.tar.gz: 08deeda370fa63dbb25b0f1ce74273b41b9e616eafea6411c24a8d3dd04f6a87a50e569f4c32401f95c35e044aae8df343a0b72630c272c8bbf863f30ef9ae82
6
+ metadata.gz: d78e1d04e3bd6068b21f1efbd79d49d672d4e7bf371f73a3c267ac6475ee4e6a2c6d98a9fa456f94823a8a118a4b71650d4e8b350aab676cad3a473d51b8a250
7
+ data.tar.gz: acb13a35c999c9381d04c0619d005bc9354a427e8b1465d02278ce70d0d89491d93425537866a4b5e5bf25c6bec7191e47efdbf5f9901b968af8dc20f747675e
@@ -1,3 +1,3 @@
1
1
  module Metapage
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
data/lib/metapage.rb CHANGED
@@ -25,11 +25,18 @@ module Metapage
25
25
  end
26
26
 
27
27
  def extract(text)
28
- URI.extract(text, ['http', 'https']).map {|url| fetch(url.gsub(/[\.\,]+\Z/, '')) }.compact
28
+ extract_urls(text).map {|url| fetch(url.gsub(/[\.\,]+\Z/, '')) }.compact
29
29
  end
30
30
 
31
31
  def extract!(text)
32
- URI.extract(text, ['http', 'https']).map {|url| fetch!(url.gsub(/[\.\,]+\Z/, '')) }.compact
32
+ extract_urls(text).map {|url| fetch!(url.gsub(/[\.\,]+\Z/, '')) }.compact
33
+ end
34
+
35
+ def extract_urls(text)
36
+ processed_text = text.
37
+ gsub(/([^\/])www\./, '\1http://www.').
38
+ gsub(/\Awww\./, 'http://www.')
39
+ URI.extract processed_text, ['http', 'https']
33
40
  end
34
41
  end
35
42
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metapage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christoph Olszowka
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-11-05 00:00:00.000000000 Z
11
+ date: 2015-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient