Class: TestXml::Matchers::XmlMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/test_xml/matchers.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(subject, pattern, compare_value) ⇒ XmlMatcher

Returns a new instance of XmlMatcher.



5
6
7
8
9
# File 'lib/test_xml/matchers.rb', line 5

def initialize(subject, pattern, compare_value)
  @subject = Nokogiri::XML::Document.parse(subject)
  @pattern = Nokogiri::XML::Document.parse(pattern)
  @compare_value = compare_value
end

Instance Attribute Details

#compare_valueObject (readonly)

Returns the value of attribute compare_value.



4
5
6
# File 'lib/test_xml/matchers.rb', line 4

def compare_value
  @compare_value
end

#patternObject (readonly)

Returns the value of attribute pattern.



4
5
6
# File 'lib/test_xml/matchers.rb', line 4

def pattern
  @pattern
end

#subjectObject (readonly)

Returns the value of attribute subject.



4
5
6
# File 'lib/test_xml/matchers.rb', line 4

def subject
  @subject
end

Instance Method Details

#match?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/test_xml/matchers.rb', line 11

def match?
  subject.match?(pattern, compare_value)
end