Module: ExtendedMatcherRegistry::InstanceMethods

Defined in:
lib/vcr-xml.rb

Instance Method Summary collapse

Instance Method Details

#[](matcher) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/vcr-xml.rb', line 30

def [](matcher)
  @registry.fetch(matcher) do
    marker, xpath = matcher.to_s.split(/^xpath:/)
    return VCR::XpathMatcher.new(xpath) if xpath

    marker, notxpath = matcher.to_s.split(/^notxpath:/)
    return VCR::NotXpathMatcher.new(notxpath) if notxpath

    marker, keys = matcher.to_s.split(/^headers:\/\//)
    return VCR::HeaderMatcher.new(keys.split(',')) if keys.split(',').present?

    super
  end
end