rasantiago-tiny_xpath_helper 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +5 -0
- data/lib/tiny_xpath_helper.rb +3 -0
- data/tiny_xpath_helper.gemspec +1 -1
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -56,6 +56,11 @@ and defaults to true.
|
|
56
56
|
>> xpath.all( 'node/@style', :auto_text => false )
|
57
57
|
=> [style='first']
|
58
58
|
|
59
|
+
If you find yourself writing iterative xpaths, you may want to use :format => :tiny_xpath_helper
|
60
|
+
>> node_xpath = xpath.first( 'node', :format => :tiny_xpath_helper)
|
61
|
+
>> node_xpath.first('@style')
|
62
|
+
=> style='first'
|
63
|
+
|
59
64
|
Option defaults can be passed to TinyXPathHelper#new
|
60
65
|
>> xpath_with_options = TinyXPathHelper.new( File.open( 'test/xml/sample.xml' ), :format => :to_i, :find => :all )
|
61
66
|
>> xpath_with_options.find_xpath( 'node' )
|
data/lib/tiny_xpath_helper.rb
CHANGED
@@ -100,6 +100,9 @@ class TinyXPathHelper
|
|
100
100
|
elsif format == :xml or format == :rexml
|
101
101
|
auto_text = false
|
102
102
|
format = nil
|
103
|
+
elsif format == :xpath_helper or format == :tiny_xpath_helper
|
104
|
+
auto_text = false
|
105
|
+
format = self.method(:new)
|
103
106
|
end
|
104
107
|
|
105
108
|
filter1 = auto_text ? self.method(:xml_node_to_text) : nil
|
data/tiny_xpath_helper.gemspec
CHANGED