Class: Utopia::Path::Matcher::MatchData

Inherits:
Object
  • Object
show all
Defined in:
lib/utopia/path/matcher.rb

Overview

The result of matching against a Utopia::Path.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(named_parts, post_match) ⇒ MatchData

Returns a new instance of MatchData.



35
36
37
38
# File 'lib/utopia/path/matcher.rb', line 35

def initialize(named_parts, post_match)
	@named_parts = named_parts
	@post_match = Path[post_match]
end

Instance Attribute Details

#named_partsObject (readonly)

Matched components by name.



41
42
43
# File 'lib/utopia/path/matcher.rb', line 41

def named_parts
  @named_parts
end

#post_matchObject (readonly)

Any remaining part past the end of the explicitly matched components.



44
45
46
# File 'lib/utopia/path/matcher.rb', line 44

def post_match
  @post_match
end

Instance Method Details

#[](key) ⇒ Object



46
47
48
# File 'lib/utopia/path/matcher.rb', line 46

def [] key
	@named_parts[key]
end

#namesObject



50
51
52
# File 'lib/utopia/path/matcher.rb', line 50

def names
	@named_parts.keys
end