four_o_four 0.0.3 → 0.0.4

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: 127480fd317f94373fe8df9ec1d20da701e29a71
4
- data.tar.gz: 2e0e157306c4d79c2dfe131b0a8205b0d45f2b64
3
+ metadata.gz: 1dd1e55a2f069ab329fd348d7a47b4f64f90fdf5
4
+ data.tar.gz: bc3ca6d87528d1656a3b524a7cea88fd98a28576
5
5
  SHA512:
6
- metadata.gz: 67be6d324ede87539fc559bfeccc83db4871f7dddaf36b16d747cf050dfae2123a0a1080c306b6caf0778459d34f66c5161c28d6b0e046e9daab18714c715f96
7
- data.tar.gz: bf844b9e0e42e9dc63b633e43a23b602a8b2227ea3acabb0597df6e8193c9632645ae97b60145bce23ecaec5ed57f0dbc099711af77718f4752a589c11d544e7
6
+ metadata.gz: d8d89eedbc78a921ce76a6aff9b74a1f676e542b663d5bec715f38bfab812e4a6107f8246c9e2693f3989f7bb2cf7fcad2d28b5965612263ff2f1ce9517131f5
7
+ data.tar.gz: 1ada552b2c4bdd704343e61ff70f818d3bd104d3b82cda136c42afe1cdd60e43739da031235cbe4c9c20a990034de7f3aba4e277996ff1f35a5bf3d87c1af4ca
@@ -2,9 +2,11 @@
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
+ require 'four_o_four/version'
6
+
5
7
  Gem::Specification.new do |spec|
6
8
  spec.name = 'four_o_four'
7
- spec.version = '0.0.3'
9
+ spec.version = FourOFour::VERSION
8
10
  spec.authors = ['Espartaco Palma']
9
11
  spec.email = ['esparta@gmail.com']
10
12
 
@@ -3,7 +3,6 @@ require 'utils/asset'
3
3
 
4
4
  # A small Rack middleware to handle 404 responses with a delegation
5
5
  class FourOFour
6
- VERSION = '0.0.3'
7
6
 
8
7
  def initialize(app, delegation = nil, skip_formats = [])
9
8
  @app = app
@@ -14,7 +13,8 @@ class FourOFour
14
13
  def call(env)
15
14
  status, headers, response = @app.call(env)
16
15
 
17
- if !Utils::Asset.match(env['REQUEST_URI']) && can_process_request?(status, headers)
16
+ if processable_request_method?(env) && !Utils::Asset.match(env['REQUEST_URI']) &&
17
+ can_process_request?(status, headers)
18
18
  Object.const_get(@delegation).new.call(env)
19
19
  else
20
20
  [status, headers, response]
@@ -61,4 +61,14 @@ class FourOFour
61
61
  def processable_type?(content_type)
62
62
  content_type.nil? || (content_type && content_type !~ @skip_formats)
63
63
  end
64
+
65
+ # Return true if the request method is a GET
66
+ #
67
+ # @param [Hash] env Rack environment
68
+ # @return [Boolean]
69
+ #
70
+ # @api private
71
+ def processable_request_method?(env)
72
+ env['REQUEST_METHOD'] == 'GET'
73
+ end
64
74
  end
@@ -0,0 +1,3 @@
1
+ class FourOFour
2
+ VERSION = '0.0.4'
3
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: four_o_four
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Espartaco Palma
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-13 00:00:00.000000000 Z
11
+ date: 2016-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -203,6 +203,7 @@ files:
203
203
  - bin/setup
204
204
  - four_o_four.gemspec
205
205
  - lib/four_o_four.rb
206
+ - lib/four_o_four/version.rb
206
207
  - lib/utils/asset.rb
207
208
  homepage: https://github.com/SparkHub/four_o_four
208
209
  licenses: