Method: Oga::XML::NodeSet#text

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

#textString

Returns the text of all nodes in the set, ignoring comment nodes.

Returns:

  • (String)


273
274
275
276
277
278
279
280
281
282
283
# File 'lib/oga/xml/node_set.rb', line 273

def text
  text = ''

  @nodes.each do |node|
    if node.respond_to?(:text) and !node.is_a?(Comment)
      text << node.text
    end
  end

  text
end