Class: Plumbing::Provider::Router::WildcardRoute
- Defined in:
- lib/plumbing/provider/router.rb
Overview
A wildcard route matches any query path that begins with its static
prefix segments; the tail (the "remainder") is handed to whatever the
provider resolves at the prefix — see Provider's wildcard delegation.
path here is the prefix, i.e. the registration path with its trailing
"/" removed ("other/" -> "other").
Instance Method Summary collapse
- #dynamic? ⇒ Boolean
- #matches?(path) ⇒ Boolean
- #params ⇒ Object
- #prefix_size ⇒ Object
- #remainder_for(path) ⇒ Object
- #static? ⇒ Boolean
- #wildcard? ⇒ Boolean
Instance Method Details
#dynamic? ⇒ Boolean
61 |
# File 'lib/plumbing/provider/router.rb', line 61 def dynamic? = false |
#matches?(path) ⇒ Boolean
66 67 68 69 70 |
# File 'lib/plumbing/provider/router.rb', line 66 def matches?(path) query_segments = path.split("/") return false if query_segments.size < @segments.size @segments.each_with_index.all? { |segment, index| query_segments[index] == segment } end |
#params ⇒ Object
63 |
# File 'lib/plumbing/provider/router.rb', line 63 def params = {}.freeze |
#prefix_size ⇒ Object
64 |
# File 'lib/plumbing/provider/router.rb', line 64 def prefix_size = @segments.size |
#remainder_for(path) ⇒ Object
72 |
# File 'lib/plumbing/provider/router.rb', line 72 def remainder_for(path) = path.split("/").drop(@segments.size).join("/") |
#static? ⇒ Boolean
60 |
# File 'lib/plumbing/provider/router.rb', line 60 def static? = false |
#wildcard? ⇒ Boolean
62 |
# File 'lib/plumbing/provider/router.rb', line 62 def wildcard? = true |