allow %w in Handler macros (#385)

This commit is contained in:
Will Leinweber 2017-08-18 00:19:21 -07:00 committed by Serdar Dogruyol
parent fc4c97aafd
commit 5a83522866
2 changed files with 29 additions and 2 deletions

View file

@ -9,14 +9,14 @@ module Kemal
macro only(paths, method = "GET")
class_name = {{@type.name}}
{{paths}}.each do |path|
({{paths}}).each do |path|
@@only_routes_tree.add "#{class_name}/#{{{method}}.downcase}#{path}", "/#{{{method}}.downcase}#{path}"
end
end
macro exclude(paths, method = "GET")
class_name = {{@type.name}}
{{paths}}.each do |path|
({{paths}}).each do |path|
@@exclude_routes_tree.add "#{class_name}/#{{{method}}.downcase}#{path}", "/#{{{method}}.downcase}#{path}"
end
end