rack-app 5.10.1 → 5.10.2

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: 23e30b1cd43155376103906815a81992ab9fda1b
4
- data.tar.gz: 95ed0ee6c980d7b029b1845f6c97ee09a08d9aec
3
+ metadata.gz: 983dee78b91bcdb205f8897297ef37cd2ebf7e3a
4
+ data.tar.gz: b25e20aaaac647a04b6559ca59b9d4970f4a7670
5
5
  SHA512:
6
- metadata.gz: e8698f68df78a4bc3529f550ca4a8c1d206d93ebceeebddd6a11348a6bd96f29019017618dba991b3eb55e8b5df4d82a56eb2ff74283154de8bf4af7e635361f
7
- data.tar.gz: ab5b5fb6425a362d1de374199e502c24a122dfe8fabc30afc5fa1a8c288330b7e3f1b50131ee75ae97978dddee64207c5a9c0af8cab2d74044d60f24fc81c694
6
+ metadata.gz: 05075fc0dc6dad4d1f01f9c3a5b3683c4dd490733db795bffc4b34e192de70b694f0d7faa9c62f30ed097559a5a3e9089a1f4aec365a1a21a1edf3e8075dc644
7
+ data.tar.gz: 4f5d3a2ccff652a98c2a0369eee4ea7d823ddfc994c7984439620c9563857688ba616a31bedb1ccc658ab859d313cb56e505c114963532a9b8823a3eed63c089
data/VERSION CHANGED
@@ -1 +1 @@
1
- 5.10.1
1
+ 5.10.2
@@ -13,8 +13,8 @@ class Rack::App::ErrorHandler
13
13
  nil
14
14
  end
15
15
 
16
- def execute_with_error_handling_for(instance, &block)
17
- block.call
16
+ def execute_with_error_handling_for(instance)
17
+ yield
18
18
  rescue *[Exception, @handlers.keys].flatten => ex
19
19
  instance.instance_exec(ex, &get_handler(ex))
20
20
  end
@@ -4,10 +4,10 @@ module Rack::App::InstanceMethods::Payload
4
4
  request.env[Rack::App::Constants::ENV::PAYLOAD_GETTER].call
5
5
  end
6
6
 
7
- def payload_stream(&block)
7
+ def payload_stream
8
8
  return nil unless @request.body.respond_to?(:gets)
9
9
  while chunk = @request.body.gets
10
- block.call(chunk)
10
+ yield(chunk)
11
11
  end
12
12
  @request.body.rewind
13
13
  nil
@@ -10,7 +10,7 @@ module Rack::App::InstanceMethods::RedirectTo
10
10
  end
11
11
 
12
12
  response.status = 301
13
- response.headers.merge!({'Location' => url})
13
+ response.headers['Location']= url
14
14
 
15
15
  finish!
16
16
 
@@ -100,9 +100,10 @@ module Rack::App::Payload::Parser::Builder::Formats
100
100
  last_name = nil
101
101
  form_names.map(&:to_sym).each do |form_name|
102
102
  last_name = form_name
103
+ unless respond_to?(form_name)
104
+ raise(NotImplementedError, "unknown formatter: #{last_name}")
105
+ end
103
106
  __send__ form_name, builder
104
107
  end
105
- rescue NoMethodError
106
- raise(NotImplementedError, "unknown formatter: #{last_name}")
107
108
  end
108
109
  end
@@ -50,8 +50,8 @@ class Rack::App::Router::Base
50
50
  end
51
51
  end
52
52
 
53
- def find_by_path_infos(env, &block)
54
- block.call(raw_path_info(env)) || block.call(formatted_path_info(env))
53
+ def find_by_path_infos(env)
54
+ yield(raw_path_info(env)) || yield(formatted_path_info(env))
55
55
  end
56
56
 
57
57
  def get_request_method(env)
@@ -11,8 +11,8 @@ module Rack::App::SingletonMethods::Middleware
11
11
 
12
12
  alias middleware middlewares
13
13
 
14
- def use(*args)
15
- middlewares{ |b| b.use(*args) }
14
+ def use(*args, &block)
15
+ middlewares{ |b| b.use(*args, &block) }
16
16
  end
17
17
 
18
18
  protected
data/lib/rack/app/test.rb CHANGED
@@ -14,7 +14,7 @@ module Rack::App::Test
14
14
 
15
15
  def __send_rack_app_request__(request_method, *args)
16
16
  properties = args.select { |e| e.is_a?(Hash) }.reduce({}, &:merge!)
17
- url = args.select { |e| e.is_a?(String) }.first || properties.delete(:url)
17
+ url = args.detect { |e| e.is_a?(String) } || properties.delete(:url)
18
18
  mock_request = Rack::MockRequest.new(rack_app)
19
19
  request_env = Rack::App::Test::Utils.env_by(properties)
20
20
  return @last_response = mock_request.request(request_method.to_s.upcase, url, request_env)
@@ -12,9 +12,11 @@ module Rack::App::Test::SingletonMethods
12
12
  end
13
13
 
14
14
  def in_this_context(name, &block)
15
- let(name, &block)
16
- rescue NoMethodError
17
- define_method(name, &block)
15
+ if respond_to?(:let)
16
+ let(name, &block)
17
+ else
18
+ define_method(name, &block)
19
+ end
18
20
  end
19
21
 
20
22
  end
@@ -13,7 +13,7 @@ module Rack::App::Test::Utils
13
13
  def env_by(properties)
14
14
 
15
15
  properties = format_properties(properties)
16
- env = properties[:headers].reduce({}) { |m, (k, v)| m.merge("HTTP_#{k.to_s.gsub('-', '_').upcase}" => v.to_s) }
16
+ env = properties[:headers].reduce({}) { |m, (k, v)| m.merge("HTTP_#{k.to_s.tr('-', '_').upcase}" => v.to_s) }
17
17
  payload = properties.delete(:payload)
18
18
  env["rack.input"]= ::Rack::Lint::InputWrapper.new(string_io_for(payload))
19
19
  env[::Rack::QUERY_STRING]= Rack::App::Utils.encode_www_form(properties[:params].to_a)
@@ -56,7 +56,7 @@ module Rack::App::Utils
56
56
 
57
57
  def join(*url_path_parts)
58
58
  url_path_parts = [url_path_parts].flatten.compact.map(&:to_s)
59
- File.join(*url_path_parts).gsub(File::Separator, '/').sub(/^\/?(.*)$/, '/\1')
59
+ File.join(*url_path_parts).tr(File::Separator, '/').sub(/^\/?(.*)$/, '/\1')
60
60
  end
61
61
 
62
62
  def expand_path(file_path)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-app
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.10.1
4
+ version: 5.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Luzsi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-16 00:00:00.000000000 Z
11
+ date: 2017-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler