Class: Sidewalk::UriMatch
- Inherits:
-
Object
- Object
- Sidewalk::UriMatch
- Defined in:
- lib/sidewalk/uri_match.rb
Overview
Information on a URI
=> Controller match.
These are generated by UriMapper.
Instance Attribute Summary collapse
-
#controller ⇒ Object
readonly
What the URL maps to.
-
#parameters ⇒ Object
readonly
Any named captures from the match.
-
#parts ⇒ Object
readonly
The URL path, divided into regexp-matches.
Instance Method Summary collapse
-
#initialize(parts = [], parameters = {}, controller = nil) ⇒ UriMatch
constructor
A new instance of UriMatch.
Constructor Details
#initialize(parts = [], parameters = {}, controller = nil) ⇒ UriMatch
Returns a new instance of UriMatch.
20 21 22 23 24 25 26 27 |
# File 'lib/sidewalk/uri_match.rb', line 20 def initialize parts = [], parameters = {}, controller = nil unless parts.is_a?(Array) && parameters.is_a?(Hash) raise ArgumentError.new( 'Sidewalk::UriMatch([parts], {parameters}, controller)' ) end @parts, @parameters, @controller = parts, parameters, controller end |
Instance Attribute Details
#controller ⇒ Object (readonly)
What the URL maps to.
This should be an instance of Controller, or a Proc
.
18 19 20 |
# File 'lib/sidewalk/uri_match.rb', line 18 def controller @controller end |
#parameters ⇒ Object (readonly)
Any named captures from the match.
13 14 15 |
# File 'lib/sidewalk/uri_match.rb', line 13 def parameters @parameters end |
#parts ⇒ Object (readonly)
The URL path, divided into regexp-matches.
The URI map is a tree; this tells you what was matched at each level of the tree.
10 11 12 |
# File 'lib/sidewalk/uri_match.rb', line 10 def parts @parts end |