File: extract_text.rb

package info (click to toggle)
ruby-htree 0.8%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 520 kB
  • sloc: ruby: 5,928; makefile: 23
file content (37 lines) | stat: -rw-r--r-- 510 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
require 'htree/text'
require 'htree/doc'
require 'htree/elem'

module HTree
  module Node
    def extract_text
      raise NotImplementedError
    end
  end

  class Location
    def extract_text
      to_node.extract_text
    end
  end

  # :stopdoc:
  module Container
    def extract_text
      Text.concat(*@children.map {|n| n.extract_text })
    end
  end

  module Leaf
    def extract_text
      Text.new('')
    end
  end

  class Text
    def extract_text
      self
    end
  end
  # :startdoc:
end