Class: Treat::Workers::Formatters::Readers::ODT::ODTXmlHandler
- Inherits:
-
Object
- Object
- Treat::Workers::Formatters::Readers::ODT::ODTXmlHandler
- Includes:
- REXML::StreamListener
- Defined in:
- lib/treat/workers/formatters/readers/odt.rb
Overview
Xml listener for the parsing of the ODT file.
Instance Attribute Summary collapse
-
#plain_text ⇒ Object
readonly
Returns the value of attribute plain_text.
Instance Method Summary collapse
-
#initialize ⇒ ODTXmlHandler
constructor
A new instance of ODTXmlHandler.
- #tag_start(name, attrs) ⇒ Object
- #text(s) ⇒ Object
Constructor Details
#initialize ⇒ ODTXmlHandler
Returns a new instance of ODTXmlHandler.
47 48 49 50 |
# File 'lib/treat/workers/formatters/readers/odt.rb', line 47 def initialize @plain_text = "" @last_name = "" end |
Instance Attribute Details
#plain_text ⇒ Object (readonly)
Returns the value of attribute plain_text.
46 47 48 |
# File 'lib/treat/workers/formatters/readers/odt.rb', line 46 def plain_text @plain_text end |
Instance Method Details
#tag_start(name, attrs) ⇒ Object
51 52 53 |
# File 'lib/treat/workers/formatters/readers/odt.rb', line 51 def tag_start(name, attrs) @last_name = name end |
#text(s) ⇒ Object
54 55 56 57 58 59 60 61 62 |
# File 'lib/treat/workers/formatters/readers/odt.rb', line 54 def text(s) if @last_name.index('text') s = s.strip if s.length > 0 @plain_text << s @plain_text << "\n\n" end end end |