lib/roda.rb in roda-3.10.0 vs lib/roda.rb in roda-3.11.0
- old
+ new
@@ -237,19 +237,26 @@
private
# Build the rack app to use
def build_rack_app
if block = @route_block
+ block = rack_app_route_block(block)
app = lambda{|env| new(env).call(&block)}
@middleware.reverse_each do |args, bl|
mid, *args = args
app = mid.new(app, *args, &bl)
app.freeze if opts[:freeze_middleware]
end
@app = app
end
end
+
+ # The route block to use when building the rack app.
+ # Can be modified by plugins.
+ def rack_app_route_block(block)
+ block
+ end
end
# Instance methods for the Roda class.
#
# In addition to the listed methods, the following two methods are available:
@@ -274,9 +281,13 @@
r = @_request
r.block_result(instance_exec(r, &block))
@_response.finish
end
end
+
+ # Private alias for internal use
+ alias _call call
+ private :_call
# The environment hash for the current request. Example:
#
# env['REQUEST_METHOD'] # => 'GET'
def env