Sha256: bcda2f2c5049ef033f70373dc9e4e3670fcac4c42ad7ae926327195cf2ef3dca
Contents?: true
Size: 835 Bytes
Versions: 3
Compression:
Stored size: 835 Bytes
Contents
# frozen_string_literal: true require "rack/builder" module Hanami class API module Middleware # Hanami::API middleware stack # # @since 0.1.1 # @api private class App # @since 0.1.1 # @api private def initialize(app, mapping) @trie = Hanami::API::Middleware::Trie.new(app) mapping.each do |path, stack| builder = Rack::Builder.new stack.each do |middleware, args, blk| builder.use(middleware, *args, &blk) end builder.run(app) @trie.add(path, builder.to_app.freeze) end @trie.freeze end # @since 0.1.1 # @api private def call(env) @trie.find(env["PATH_INFO"]).call(env) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
hanami-api-0.2.0 | lib/hanami/api/middleware/app.rb |
hanami-api-0.1.2 | lib/hanami/api/middleware/app.rb |
hanami-api-0.1.1 | lib/hanami/api/middleware/app.rb |