mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Refactor parse_url_params
This commit is contained in:
parent
d0b62cc728
commit
4c423e967f
1 changed files with 6 additions and 9 deletions
|
@ -35,18 +35,15 @@ class Kemal::ParamParser
|
||||||
parse_part(@request.query)
|
parse_part(@request.query)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Ditto: This needs memoization without the huge AllParamTypes union :|
|
||||||
def parse_url_params
|
def parse_url_params
|
||||||
url_params = @request.url_params
|
if @request.url_params
|
||||||
begin
|
url_params = @request.url_params.not_nil!
|
||||||
url_params = url_params.not_nil!
|
|
||||||
name_table = url_params.regex.name_table
|
name_table = url_params.regex.name_table
|
||||||
size = url_params.size
|
url_params.size.times do |i|
|
||||||
size.times do |i|
|
name = (name_table.fetch(i + 1) { i + 1 }) as String
|
||||||
name = name_table.fetch(i + 1) { i + 1 }
|
@params[name] = url_params[i + 1]
|
||||||
value = url_params[i + 1]
|
|
||||||
@params[name as String] = value
|
|
||||||
end
|
end
|
||||||
rescue
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue