lib/xmpp4r/rexmladdons.rb in xmpp4r-0.4 vs lib/xmpp4r/rexmladdons.rb in xmpp4r-0.5
- old
+ new
@@ -15,9 +15,15 @@
module REXML
# this class adds a few helper methods to REXML::Element
class Element
+ def each_elements(*els, &block)
+ els.inject([ ]) do |res, e|
+ res + each_element(e, &block)
+ end
+ end
+
##
# Replaces or adds a child element of name <tt>e</tt> with text <tt>t</tt>.
def replace_element_text(e, t)
el = first_element(e)
if el.nil?