-
Notifications
You must be signed in to change notification settings - Fork 2
/
README
33 lines (30 loc) · 975 Bytes
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Contributors:
Sarah Allen, http://github.com/ultrasaurus
Wolfram Arnold, http://github.com/wolframarnold
Nikolay, http://github.com/jastix
Build and install the gem:
gem build xml_subset_matcher.gemspec
sudo gem install xml_subset_matcher
run the specs (all pass)
spec spec/lib/xml_subset_matcher_spec.rb
using the library
$ irb
>> require 'xml_subset_matcher'
=> true
>> subset = "<root><thing>text</thing></root>"
=> "<root><thing>text</thing></root>"
>> superset = "<root extra='stuff'><ignorethis/><thing>text</thing></root>"
=> "<root extra='stuff'><ignorethis/><thing>text</thing></root>"
>> x = XmlSubsetMatcher::XmlSubsetMatcher.new(superset)
=> #<XmlSubsetMatcher::XmlSubsetMatcher:0x55a514 @error="", @superset=<?xml version="1.0" encoding="UTF-8"?>
<root extra="stuff">
<ignorethis/>
<thing>text</thing>
</root>
>
>> x.matches?(subset)
=> true
>> subset = "<something>else</something>"
=> "<something>else</something>"
>> x.matches?(subset)
=> false