Creates a new MatchData object. MatchData objects should never be instantiated directly.
@param [Addressable::URI] uri
The URI that the template was matched against.
# File lib/addressable/template.rb, line 101 def initialize(uri, template, mapping) @uri = uri.dup.freeze @template = template @mapping = mapping.dup.freeze end
Returns a String representation of the MatchData's state.
@return [String] The MatchData's state, as a String.
# File lib/addressable/template.rb, line 152 def inspect sprintf("#<%s:%#0x RESULT:%s>", self.class.to_s, self.object_id, self.mapping.inspect) end
@return [Array]
The list of values that were captured by the Template. Note that this list will include nils for any variables which were in the Template, but did not appear in the URI.
# File lib/addressable/template.rb, line 140 def values @values ||= self.variables.inject([]) do |accu, key| accu << self.mapping[key] accu end end
@return [Array]
The list of variables that were present in the Template. Note that this list will include variables which do not appear in the mapping because they were not present in URI.
# File lib/addressable/template.rb, line 130 def variables self.template.variables end
Generated with the Darkfish Rdoc Generator 2.