web 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.
data/lib/web.rb CHANGED
@@ -13,7 +13,8 @@ module Web
13
13
  attr_writer :cache
14
14
 
15
15
  # register a url to cache
16
- def register(regex, options = {})
16
+ def register(method, regex, options = {})
17
+ options[:method] = method
17
18
  options[:regex] = regex
18
19
  registered << options
19
20
  end
data/lib/web/faker.rb CHANGED
@@ -12,12 +12,13 @@ module Web
12
12
  @cache = Web.cache
13
13
  # keep these around
14
14
  @url = url
15
+ @method = method
15
16
  end
16
17
 
17
18
  # whether or not this is a key we want
18
19
  def desired?
19
20
  @match = Web.registered.detect do |opt|
20
- opt[:regex] =~ @url
21
+ opt[:regex] =~ @url && opt[:method] === @method
21
22
  end
22
23
  end
23
24
 
@@ -2,11 +2,6 @@ module Web
2
2
 
3
3
  module HTTPResponse
4
4
 
5
- def read_body(dist = nil, &block)
6
- yield @body if block_given?
7
- @body
8
- end
9
-
10
5
  def cached?
11
6
  !!@cached
12
7
  end
data/lib/web/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Web
2
2
 
3
- VERSION = '0.0.1'
3
+ VERSION = '0.0.2'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
17
- requirement: &2154079540 !ruby/object:Gem::Requirement
17
+ requirement: &2162217700 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,7 +22,7 @@ dependencies:
22
22
  version: '0'
23
23
  type: :development
24
24
  prerelease: false
25
- version_requirements: *2154079540
25
+ version_requirements: *2162217700
26
26
  description: web is a library for caching HTTP responses
27
27
  email: john.crepezzi@gmail.com
28
28
  executables: []
@@ -41,7 +41,7 @@ files:
41
41
  - lib/web.rb
42
42
  - spec/spec_helper.rb
43
43
  has_rdoc: true
44
- homepage: http://seejohnrun.github.com/web/
44
+ homepage: http://github.com/seejohnrun/web
45
45
  licenses: []
46
46
  post_install_message:
47
47
  rdoc_options: []