rack-middleware 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8d254a000706d677872a46358fc59d570207c23729871dd8f8901324d15ac546
4
+ data.tar.gz: a39f91dbeddbcb674c3942a9fcd858e916b13d8fcab25a9f20d7a0559902fde1
5
+ SHA512:
6
+ metadata.gz: 77b199bf6c6b42769ed82f7bfc629cf0f1aec03d5810eab9b03ea362cdfaf94a87c38445333112839b9fea58b4c13f9c9ac56d4bf8c4efa40be071d63c792269
7
+ data.tar.gz: 7c177655556927e8d789295abf983dffff2dbce846c94e9bc20dd3630a875b4442d18ca18c75dae250a6576b5faa3dff545768ac3e4815d451527c04dc49e92d
@@ -0,0 +1,30 @@
1
+ module Rack
2
+ module Middleware
3
+ def initialize app, *a, &b
4
+ @app = app
5
+ args *a, &b if respond_to? :args
6
+ end
7
+
8
+ def call env
9
+ @env = env
10
+ before if respond_to? :before
11
+ @status, @header, @body = @app.call @env
12
+ after if respond_to? :after
13
+ @status, @header, @body = @response.finish if @response
14
+ [@status, @header, @body]
15
+ end
16
+
17
+
18
+ def header_hash
19
+ @header_hash ||= (@header = Utils::HeaderHash.new @header)
20
+ end
21
+
22
+ def request
23
+ @request ||= Request.new @env
24
+ end
25
+
26
+ def response
27
+ @response ||= Response.new @body, @status, @header
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,7 @@
1
+ Gem::Specification.new do |g|
2
+ g.name = 'rack-middleware'
3
+ g.files = [__FILE__, 'lib/rack/middleware.rb']
4
+ g.version = '0.0.0'
5
+ g.summary = 'A convenient way to create Rack middlewares.'
6
+ g.authors = ['Anatoly Chernow']
7
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rack-middleware
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Anatoly Chernow
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-03-03 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email:
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/rack/middleware.rb
20
+ - rack-middleware.gemspec
21
+ homepage:
22
+ licenses: []
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubyforge_project:
40
+ rubygems_version: 2.7.6
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: A convenient way to create Rack middlewares.
44
+ test_files: []