Method: Nokogiri::XML::NodeSet#inner_text

Defined in:
lib/nokogiri/xml/node_set.rb

#inner_textObject Also known as: text

Get the inner text of all contained Node objects

Note: This joins the text of all Node objects in the NodeSet:

doc = Nokogiri::XML('<xml><a><d>foo</d><d>bar</d></a></xml>')
doc.css('d').text # => "foobar"

Instead, if you want to return the text of all nodes in the NodeSet:

doc.css('d').map(&:text) # => ["foo", "bar"]

See Nokogiri::XML::Node#content for more information.



255
256
257
# File 'lib/nokogiri/xml/node_set.rb', line 255

def inner_text
  collect(&:inner_text).join("")
end