Class: Utopia::Path::Matcher::MatchData
- Inherits:
-
Object
- Object
- Utopia::Path::Matcher::MatchData
- Defined in:
- lib/utopia/path/matcher.rb
Overview
The result of matching against a Utopia::Path.
Instance Attribute Summary collapse
-
#named_parts ⇒ Object
readonly
Matched components by name.
-
#post_match ⇒ Object
readonly
Any remaining part past the end of the explicitly matched components.
Instance Method Summary collapse
-
#[](key) ⇒ Object
Fetch a named capture.
-
#initialize(named_parts, post_match) ⇒ MatchData
constructor
Initialize the named captures and unmatched path suffix.
-
#names ⇒ Object
Return the named captures.
Constructor Details
Instance Attribute Details
#named_parts ⇒ Object (readonly)
Matched components by name.
27 28 29 |
# File 'lib/utopia/path/matcher.rb', line 27 def named_parts @named_parts end |
#post_match ⇒ Object (readonly)
Any remaining part past the end of the explicitly matched components.
30 31 32 |
# File 'lib/utopia/path/matcher.rb', line 30 def post_match @post_match end |
Instance Method Details
#[](key) ⇒ Object
Fetch a named capture.
35 36 37 |
# File 'lib/utopia/path/matcher.rb', line 35 def [] key @named_parts[key] end |
#names ⇒ Object
Return the named captures.
41 42 43 |
# File 'lib/utopia/path/matcher.rb', line 41 def names @named_parts.keys end |