From 2fe27f089007d6ae0a2bb6ee2e2d13c9f6e0696f Mon Sep 17 00:00:00 2001 From: Sdogruyol Date: Mon, 27 Feb 2017 19:10:49 +0300 Subject: [PATCH] Make FilterBlock inner class of Kemal::FilterHandler --- src/kemal/filter_handler.cr | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/kemal/filter_handler.cr b/src/kemal/filter_handler.cr index 71b06fb..98d2d4a 100644 --- a/src/kemal/filter_handler.cr +++ b/src/kemal/filter_handler.cr @@ -7,7 +7,7 @@ module Kemal # This middleware is lazily instantiated and added to the handlers as soon as a call to `after_X` or `before_X` is made. def initialize - @tree = Radix::Tree(Array(Kemal::FilterBlock)).new + @tree = Radix::Tree(Array(FilterBlock)).new Kemal.config.add_filter_handler(self) end @@ -69,18 +69,18 @@ module Kemal private def radix_path(verb, path, type : Symbol) "#{type}/#{verb}/#{path}" end - end - # :nodoc: - class FilterBlock - property block : HTTP::Server::Context -> String + # :nodoc: + class FilterBlock + property block : HTTP::Server::Context -> String - def initialize(&block : HTTP::Server::Context -> _) - @block = ->(context : HTTP::Server::Context) { block.call(context).to_s } - end + def initialize(&block : HTTP::Server::Context -> _) + @block = ->(context : HTTP::Server::Context) { block.call(context).to_s } + end - def call(context) - @block.call(context) + def call(context) + @block.call(context) + end end end end