Class: Nokogiri::XML::Element
- Inherits:
-
Object
- Object
- Nokogiri::XML::Element
- Defined in:
- lib/eagleclaw/xml.rb
Instance Method Summary collapse
-
#next_until(method = :next_element) {|Nokogiri::XML::Element| ... } ⇒ Object
Keep consuming elements until the block returns ‘true`.
-
#next_while(method = :next_element) ⇒ Object
Keep consuming elements until the block returns ‘false`.
Instance Method Details
#next_until(method = :next_element) {|Nokogiri::XML::Element| ... } ⇒ Object
Keep consuming elements until the block returns ‘true`.
16 17 18 19 20 21 22 |
# File 'lib/eagleclaw/xml.rb', line 16 def next_until(method = :next_element) current = self until yield(current) current = current.send(method) end current end |
#next_while(method = :next_element) ⇒ Object
Keep consuming elements until the block returns ‘false`.
The behaviour of this method is identical to #next_until, only it will keep iterating until the block yields a false value instead of a true one.
31 32 33 34 35 36 37 |
# File 'lib/eagleclaw/xml.rb', line 31 def next_while(method = :next_element) current = self while yield(current) current = current.send(method) end current end |