favicon_extractor 0.1.2 → 0.1.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6b210353c57dfa9e3b19e59b39ee1a6b88d77f13865549fc9d5b7c2c49ebde07
4
- data.tar.gz: 48256d53afb5288b90e53107e889adca043606ef097f00673d446e439d713446
3
+ metadata.gz: 187e199988b118245705c57d38190d320b5762f9a524d6c6b3c0a4981e91b142
4
+ data.tar.gz: be53d57f3048b09384f561ee11f811283623d65db04bf164bd87f2e393ac227a
5
5
  SHA512:
6
- metadata.gz: 8a8246dbfcdbe3e545b2fb68127c3463c43bbbd1f00b71284cc6a79f43a5129f813509741f1b63bf98fabf1a83531009b5f8d2c27be5008aef02d703a9ad0e55
7
- data.tar.gz: 50c7ae274fcdf35a7e10e207c9d627e3d4256d93216e99c8dde467bd0ced9db5a346aa2006e42934d5a93dcbd14215b94c489a7eafc24b5376f00f2dc35060bf
6
+ metadata.gz: 2948579cd27161d98505c7caea5c66797ae3fa0f62e67bf16f83f26f0f6976ecb022e325b74f43f6f60f14421137327e03c9233f814afa072e66499d9c34498e
7
+ data.tar.gz: cf3d613a3deb6ddbfd295db1d863751fe83b92fdd835559e0742224e54f27f74bffcad845421b367668bb7f5ab764841b6bbbb4a7bd1bf3d2ae0279ce2431748
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- favicon_extractor (0.1.0)
4
+ favicon_extractor (0.1.2)
5
5
  fastimage (~> 2.2)
6
6
 
7
7
  GEM
@@ -1,9 +1,10 @@
1
+ require 'pry'
1
2
  module FaviconExtractor
2
3
  class ExtractsFaviconsFromHtml
3
4
  class << self
4
5
  def extract(html, url)
5
6
  @url = url
6
- html.scan(/<link.*icon.*>/).flatten.map do |str|
7
+ html.scan(/<link.*?icon.*?>/).flatten.map do |str|
7
8
  str.match(/href="(.*?)"/).captures.first
8
9
  end
9
10
  .map { |str| handle_relative_paths(str) }
@@ -11,16 +11,16 @@ module FaviconExtractor
11
11
  end
12
12
 
13
13
  def request
14
- raise ArgumentError, 'too many redirects' if @redirects > redirect_limit
14
+ raise ArgumentError, "too many redirects" if @redirects > redirect_limit
15
15
 
16
16
  begin
17
17
  uri = URI(url)
18
18
  response = Net::HTTP.start(uri.host,
19
- uri.port,
20
- read_timeout: 10,
21
- open_timeout: 10,
22
- ssl_timeout: 10,
23
- use_ssl: uri.scheme == 'https') do |http|
19
+ uri.port,
20
+ read_timeout: 10,
21
+ open_timeout: 10,
22
+ ssl_timeout: 10,
23
+ use_ssl: uri.scheme == "https") do |http|
24
24
  http.request(Net::HTTP::Get.new(uri))
25
25
  end
26
26
 
@@ -29,7 +29,7 @@ module FaviconExtractor
29
29
  response.body
30
30
  when Net::HTTPRedirection
31
31
  @redirects += 1
32
- @url = response['location']
32
+ @url = response["location"]
33
33
  request
34
34
  else
35
35
  response.value
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FaviconExtractor
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: favicon_extractor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lee Ourand