9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/rango/mini.rb', line 9
def app(&block)
raise ArgumentError, "Block is required" unless block_given?
lambda do |env|
Rango::Router.set_rack_env(env)
request = Rango::Request.new(env)
response = Rack::Response.new
body = block.call(request, response)
raise ArgumentError, "It has to return a valid rack body, #{body.inspect} returned" unless body.respond_to?(:each) || body.is_a?(String)
response.write(body)
array = response.finish
[array[0], array[1], body] end
end
|