class ChupaText::Decomposers::OfficeOpenXML::TextListener
Public Class Methods
Source
# File lib/chupa-text/decomposers/office-open-xml.rb, line 83 def initialize(output, target_uri) @output = output @target_uri = target_uri @in_target = false end
Public Instance Methods
Source
# File lib/chupa-text/decomposers/office-open-xml.rb, line 112 def cdata(content) add_text(content) end
Source
# File lib/chupa-text/decomposers/office-open-xml.rb, line 108 def characters(text) add_text(text) end
Source
# File lib/chupa-text/decomposers/office-open-xml.rb, line 97 def end_element(uri, local_name, qname) if uri == @target_uri case local_name when "p", "br" @output << "\n" when "t" @in_target = false end end end
Source
# File lib/chupa-text/decomposers/office-open-xml.rb, line 89 def start_element(uri, local_name, qname, attributes) return unless uri == @target_uri case local_name when "t" @in_target = true end end
Private Instance Methods
Source
# File lib/chupa-text/decomposers/office-open-xml.rb, line 117 def add_text(text) return unless @in_target @output << text end