Fixed macros indentation (#409)
This commit is contained in:
parent
210e2c0801
commit
1d8908e673
2 changed files with 16 additions and 16 deletions
|
@ -9,18 +9,18 @@ module Kemal
|
|||
@@exclude_routes_tree = Radix::Tree(String).new
|
||||
|
||||
macro only(paths, method = "GET")
|
||||
class_name = {{@type.name}}
|
||||
({{paths}}).each do |path|
|
||||
@@only_routes_tree.add "#{class_name}/#{{{method}}.downcase}#{path}", "/#{{{method}}.downcase}#{path}"
|
||||
class_name = {{@type.name}}
|
||||
({{paths}}).each do |path|
|
||||
@@only_routes_tree.add "#{class_name}/#{{{method}}.downcase}#{path}", "/#{{{method}}.downcase}#{path}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
macro exclude(paths, method = "GET")
|
||||
class_name = {{@type.name}}
|
||||
({{paths}}).each do |path|
|
||||
@@exclude_routes_tree.add "#{class_name}/#{{{method}}.downcase}#{path}", "/#{{{method}}.downcase}#{path}"
|
||||
class_name = {{@type.name}}
|
||||
({{paths}}).each do |path|
|
||||
@@exclude_routes_tree.add "#{class_name}/#{{{method}}.downcase}#{path}", "/#{{{method}}.downcase}#{path}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def call(env : HTTP::Server::Context)
|
||||
call_next(env)
|
||||
|
|
|
@ -29,15 +29,15 @@ module Kemal
|
|||
end
|
||||
|
||||
{% for method in %w(url query body json) %}
|
||||
def {{method.id}}
|
||||
# check memoization
|
||||
return @{{method.id}} if @{{method.id}}_parsed
|
||||
def {{method.id}}
|
||||
# check memoization
|
||||
return @{{method.id}} if @{{method.id}}_parsed
|
||||
|
||||
parse_{{method.id}}
|
||||
# memoize
|
||||
@{{method.id}}_parsed = true
|
||||
@{{method.id}}
|
||||
end
|
||||
parse_{{method.id}}
|
||||
# memoize
|
||||
@{{method.id}}_parsed = true
|
||||
@{{method.id}}
|
||||
end
|
||||
{% end %}
|
||||
|
||||
private def parse_body
|
||||
|
|
Loading…
Reference in a new issue