Use compile-time StringLiteral#downcase instead of runtime String#downcase (#508)
This commit is contained in:
parent
482b4a6e7d
commit
50f48509fd
1 changed files with 2 additions and 2 deletions
|
@ -11,7 +11,7 @@ module Kemal
|
||||||
|
|
||||||
macro only(paths, method = "GET")
|
macro only(paths, method = "GET")
|
||||||
class_name = {{@type.name}}
|
class_name = {{@type.name}}
|
||||||
method_downcase = {{method}}.downcase
|
method_downcase = {{method.downcase}}
|
||||||
class_name_method = "#{class_name}/#{method_downcase}"
|
class_name_method = "#{class_name}/#{method_downcase}"
|
||||||
({{paths}}).each do |path|
|
({{paths}}).each do |path|
|
||||||
@@only_routes_tree.add class_name_method + path, '/' + method_downcase + path
|
@@only_routes_tree.add class_name_method + path, '/' + method_downcase + path
|
||||||
|
@ -20,7 +20,7 @@ module Kemal
|
||||||
|
|
||||||
macro exclude(paths, method = "GET")
|
macro exclude(paths, method = "GET")
|
||||||
class_name = {{@type.name}}
|
class_name = {{@type.name}}
|
||||||
method_downcase = {{method}}.downcase
|
method_downcase = {{method.downcase}}
|
||||||
class_name_method = "#{class_name}/#{method_downcase}"
|
class_name_method = "#{class_name}/#{method_downcase}"
|
||||||
({{paths}}).each do |path|
|
({{paths}}).each do |path|
|
||||||
@@exclude_routes_tree.add class_name_method + path, '/' + method_downcase + path
|
@@exclude_routes_tree.add class_name_method + path, '/' + method_downcase + path
|
||||||
|
|
Loading…
Reference in a new issue