yodatra 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/yodatra/api_formatter.rb +22 -0
- data/lib/yodatra/version.rb +1 -1
- metadata +2 -1
@@ -0,0 +1,22 @@
|
|
1
|
+
module Yodatra
|
2
|
+
class ApiFormatter
|
3
|
+
|
4
|
+
def initialize(app, &block)
|
5
|
+
@app = app
|
6
|
+
@block = block if block_given?
|
7
|
+
end
|
8
|
+
|
9
|
+
def call(env)
|
10
|
+
dup._call(env)
|
11
|
+
end
|
12
|
+
|
13
|
+
def _call(env)
|
14
|
+
status, headers, response = @app.call(env)
|
15
|
+
|
16
|
+
@block.yield status, headers, response unless @block.nil?
|
17
|
+
|
18
|
+
[status, headers, response]
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
data/lib/yodatra/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yodatra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -131,6 +131,7 @@ files:
|
|
131
131
|
- LICENSE
|
132
132
|
- README
|
133
133
|
- lib/yodatra.rb
|
134
|
+
- lib/yodatra/api_formatter.rb
|
134
135
|
- lib/yodatra/base.rb
|
135
136
|
- lib/yodatra/boot.rb
|
136
137
|
- lib/yodatra/initializers.rb
|