get_text

get_text(path = nil)
Instance Public methods

Returns the first child Text node, if any, or nil otherwise. This method returns the actual Text node, rather than the String content.

1
2
3
doc = Document.new "<p>some text <b>this is bold!</b> more text</p>"
# The element 'p' has two text elements, "some text " and " more text".
doc.root.get_text.value            #-> "some text "
doc_ruby_on_rails
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.