Class: ChupaText::Decomposers::XML
- Inherits:
-
ChupaText::Decomposer
- Object
- ChupaText::Decomposer
- ChupaText::Decomposers::XML
- Defined in:
- lib/chupa-text/decomposers/xml.rb
Defined Under Namespace
Classes: Listener
Instance Method Summary collapse
Methods inherited from ChupaText::Decomposer
Constructor Details
This class inherits a constructor from ChupaText::Decomposer
Instance Method Details
#decompose(data) {|text_data| ... } ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/chupa-text/decomposers/xml.rb', line 30 def decompose(data) text = "" listener = Listener.new(text) data.open do |input| parser = REXML::Parsers::StreamParser.new(input, listener) parser.parse end text_data = TextData.new(text, :source_data => data) yield(text_data) end |
#target?(data) ⇒ Boolean
25 26 27 28 |
# File 'lib/chupa-text/decomposers/xml.rb', line 25 def target?(data) data.extension == "xml" or data.mime_type == "text/xml" end |