File: rexml-all-text.rb

package info (click to toggle)
ruby-kramdown-rfc2629 1.7.29-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 524 kB
  • sloc: ruby: 3,907; makefile: 4
file content (20 lines) | stat: -rw-r--r-- 354 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
require 'rexml/document'

module REXML
  # all_text: Get all text from descendants that are Text or CData
  class Element
    def all_text
      @children.map {|c| c.all_text}.join
    end
  end
  class Text                    # also: ancestor of CData
    def all_text
      value
    end
  end
  class Child
    def all_text
      ''
    end
  end
end