Fixed macros indentation (#409)

This commit is contained in:
Sijawusz Pur Rahnama 2017-10-06 13:55:37 +02:00 committed by Serdar Dogruyol
parent 210e2c0801
commit 1d8908e673
2 changed files with 16 additions and 16 deletions

View file

@ -9,18 +9,18 @@ module Kemal
@@exclude_routes_tree = Radix::Tree(String).new @@exclude_routes_tree = Radix::Tree(String).new
macro only(paths, method = "GET") macro only(paths, method = "GET")
class_name = {{@type.name}} class_name = {{@type.name}}
({{paths}}).each do |path| ({{paths}}).each do |path|
@@only_routes_tree.add "#{class_name}/#{{{method}}.downcase}#{path}", "/#{{{method}}.downcase}#{path}" @@only_routes_tree.add "#{class_name}/#{{{method}}.downcase}#{path}", "/#{{{method}}.downcase}#{path}"
end
end end
end
macro exclude(paths, method = "GET") macro exclude(paths, method = "GET")
class_name = {{@type.name}} class_name = {{@type.name}}
({{paths}}).each do |path| ({{paths}}).each do |path|
@@exclude_routes_tree.add "#{class_name}/#{{{method}}.downcase}#{path}", "/#{{{method}}.downcase}#{path}" @@exclude_routes_tree.add "#{class_name}/#{{{method}}.downcase}#{path}", "/#{{{method}}.downcase}#{path}"
end
end end
end
def call(env : HTTP::Server::Context) def call(env : HTTP::Server::Context)
call_next(env) call_next(env)

View file

@ -29,15 +29,15 @@ module Kemal
end end
{% for method in %w(url query body json) %} {% for method in %w(url query body json) %}
def {{method.id}} def {{method.id}}
# check memoization # check memoization
return @{{method.id}} if @{{method.id}}_parsed return @{{method.id}} if @{{method.id}}_parsed
parse_{{method.id}} parse_{{method.id}}
# memoize # memoize
@{{method.id}}_parsed = true @{{method.id}}_parsed = true
@{{method.id}} @{{method.id}}
end end
{% end %} {% end %}
private def parse_body private def parse_body