Class | Rack::Mount::Strexp |
In: |
lib/rack/mount/strexp.rb
|
Parent: | Object |
compile | -> | new |
Parses segmented string expression and converts it into a Regexp
Strexp.compile('foo') # => %r{\Afoo\Z} Strexp.compile('foo/:bar', {}, ['/']) # => %r{\Afoo/(?<bar>[^/]+)\Z} Strexp.compile(':foo.example.com') # => %r{\A(?<foo>.+)\.example\.com\Z} Strexp.compile('foo/:bar', {:bar => /[a-z]+/}, ['/']) # => %r{\Afoo/(?<bar>[a-z]+)\Z} Strexp.compile('foo(.:extension)') # => %r{\Afoo(\.(?<extension>.+))?\Z} Strexp.compile('src/*files') # => %r{\Asrc/(?<files>.+)\Z}