aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/journey/router/strexp.rb
blob: 4b7738f3357a3f2a3dacffccba22bf3cb24b5a4b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
module ActionDispatch
  module Journey # :nodoc:
    class Router # :nodoc:
      class Strexp # :nodoc:
        class << self
          alias :compile :new
        end

        attr_reader :path, :requirements, :separators, :anchor, :ast

        def self.build(path, requirements, separators, anchor = true)
          parser = Journey::Parser.new
          ast = parser.parse path
          new ast, path, requirements, separators, anchor
        end

        def initialize(ast, path, requirements, separators, anchor = true)
          @ast          = ast
          @path         = path
          @requirements = requirements
          @separators   = separators
          @anchor       = anchor
        end
      end
    end
  end
end