Method: REXML::Element#texts

Defined in:
lib/rexml/element.rb

#textsObject

:call-seq:

texts -> array_of_text_children

Returns a frozen array of the REXML::Text children of the element:

xml_string = '<root><a/>text<b/>more<c/></root>'
d = REXML::Document.new(xml_string)
ts = d.root.texts
ts.frozen?            # => true
ts.map {|t| t.class } # => [REXML::Text, REXML::Text]
ts.map {|t| t.to_s }  # => ["text", "more"]


1469
1470
1471
# File 'lib/rexml/element.rb', line 1469

def texts
  find_all { |child| child.kind_of? Text }.freeze
end