diff options
Diffstat (limited to 'actionpack/lib/action_dispatch/journey/router/strexp.rb')
-rw-r--r-- | actionpack/lib/action_dispatch/journey/router/strexp.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/journey/router/strexp.rb b/actionpack/lib/action_dispatch/journey/router/strexp.rb new file mode 100644 index 0000000000..f97f1a223e --- /dev/null +++ b/actionpack/lib/action_dispatch/journey/router/strexp.rb @@ -0,0 +1,24 @@ +module ActionDispatch + module Journey # :nodoc: + class Router # :nodoc: + class Strexp # :nodoc: + class << self + alias :compile :new + end + + attr_reader :path, :requirements, :separators, :anchor + + def initialize(path, requirements, separators, anchor = true) + @path = path + @requirements = requirements + @separators = separators + @anchor = anchor + end + + def names + @path.scan(/:\w+/).map { |s| s.tr(':', '') } + end + end + end + end +end |