dimscan 0.2.2 → 0.2.3

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: c14696cd1b70ca070fb3dec80ac87acc1a36583e
4
- data.tar.gz: 138eb770c4edf299b5f840638cbccd3e4eb9cc06
3
+ metadata.gz: 191ef573d63a6519e5830a9f23b9b2615117d1a5
4
+ data.tar.gz: 43fe8b8c62170bee0df76e0eb732e339df10f529
5
5
  SHA512:
6
- metadata.gz: 80bad6a316b4bfe4b66bc15bc4ac286784fe309dcc1992e965408cd8503272a77e0bbd0bb14c4439edde04f504ca2b7a557937d5bf5d48669b9fdd9e81a98589
7
- data.tar.gz: 9367e5cbd9069caba92696117ff227a88a7888b94024cad8c77881d3e2ee2fd010dd6ebb1f85fb39654faa22bdaca72949b69481e5e8401b6e3048bc29696e0e
6
+ metadata.gz: e2ebc9201d8d1455771b73fa78b830ec5791ec3f7cab9fe0bcd1c601ff59eb3d1403bb707de909873c5c96929395bb7b7d53fc1fa29449916bda6d74158180cc
7
+ data.tar.gz: d610c586114e3865277eafd3f6ebd0fc0d7b37e71fe9cd162dad927e03489dc51d2656af15d69fe822096a8fbc41edc026e244edf29ba42e6f4c13c643a9658d
@@ -33,4 +33,5 @@ Gem::Specification.new do |spec|
33
33
 
34
34
  spec.add_dependency 'mini_magick', '~> 4.1'
35
35
  spec.add_dependency 'abstractize', '~> 0.1'
36
+ spec.add_dependency 'net-http-persistent', '~> 2.9'
36
37
  end
@@ -1,9 +1,16 @@
1
1
  require 'uri'
2
- require 'net/http'
2
+ require 'net/http/persistent'
3
3
 
4
4
  module Dimscan
5
5
  # A utility class for enumerating over the bytes of a http response body
6
6
  class HTTPByteEnumerator
7
+
8
+ class << self
9
+ def http
10
+ @http ||= Net::HTTP::Persistent.new('dimscan')
11
+ end
12
+ end
13
+
7
14
  def initialize(url)
8
15
  @uri = URI(url)
9
16
  fail ArgumentError, 'invalid scheme' unless @uri.scheme =~ /^https?$/
@@ -11,14 +18,9 @@ module Dimscan
11
18
 
12
19
  def each(&block)
13
20
  return to_enum(__callee__) unless block_given?
14
- request = Net::HTTP::Get.new(@uri)
15
- Net::HTTP.start(
16
- @uri.host, @uri.port, use_ssl: @uri.scheme == 'https'
17
- ) do |http|
18
- http.request(request) do |response|
19
- fail response.body if error?(response)
20
- enumerate_response(response, &block)
21
- end
21
+ self.class.http.request(@uri) do |response|
22
+ fail response.body if error?(response)
23
+ enumerate_response(response, &block)
22
24
  end
23
25
  end
24
26
 
@@ -1,4 +1,4 @@
1
1
  # Version string
2
2
  module Dimscan
3
- VERSION = '0.2.2'.freeze
3
+ VERSION = '0.2.3'.freeze
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dimscan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joakim Reinert
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-22 00:00:00.000000000 Z
11
+ date: 2015-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0.1'
111
+ - !ruby/object:Gem::Dependency
112
+ name: net-http-persistent
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '2.9'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '2.9'
111
125
  description: Bandwith efficient scanner for dimensions of web hosted images
112
126
  email:
113
127
  - mail@jreinert.net