Class: Treat::Workers::Formatters::Readers::ABW::ABWXmlHandler

Inherits:
Object
  • Object
show all
Includes:
REXML::StreamListener
Defined in:
lib/treat/workers/formatters/readers/abw.rb

Overview

Helper class to parse the AbiWord file.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeABWXmlHandler

Returns a new instance of ABWXmlHandler.



37
38
39
# File 'lib/treat/workers/formatters/readers/abw.rb', line 37

def initialize
  @plain_text = ""
end

Instance Attribute Details

#plain_textObject (readonly)

Returns the value of attribute plain_text.



36
37
38
# File 'lib/treat/workers/formatters/readers/abw.rb', line 36

def plain_text
  @plain_text
end

Instance Method Details

#text(s) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/treat/workers/formatters/readers/abw.rb', line 40

def text(s)
  if s != 'AbiWord' && s !=
    'application/x-abiword'
    s.strip!
    if s.length > 0
      s += ' '
      s += "\n\n" if s.length < 45
    end
    @plain_text << s
  end
end