class MatchData
The result of matching against a class Utopia::Path.
Definitions
def initialize(named_parts, post_match)
Initialize the named captures and unmatched path suffix.
Signature
-
parameter
named_partsHash The named match captures.
-
parameter
post_matchString The unmatched path suffix.
Implementation
def initialize(named_parts, post_match)
@named_parts = named_parts
@post_match = Path[post_match]
end
attr :named_parts
Matched components by name.
attr :post_match
Any remaining part past the end of the explicitly matched components.
def [](key)
Fetch a named capture.
Signature
-
parameter
keyString | Symbol The lookup key.
-
returns
Object | Nil The named captured value.
Implementation
def [] key
@named_parts[key]
end
def names
Return the named captures.
Signature
-
returns
Array(String) The capture names.
Implementation
def names
@named_parts.keys
end