mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
23 lines
500 B
Ruby
23 lines
500 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
module ActionDispatch
|
||
|
module Journey
|
||
|
module PathHelper
|
||
|
def path_from_string(string)
|
||
|
build_path(string, {}, "/.?", true)
|
||
|
end
|
||
|
|
||
|
def build_path(path, requirements, separators, anchored)
|
||
|
parser = ActionDispatch::Journey::Parser.new
|
||
|
ast = parser.parse path
|
||
|
ActionDispatch::Journey::Path::Pattern.new(
|
||
|
ast,
|
||
|
requirements,
|
||
|
separators,
|
||
|
anchored
|
||
|
)
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|