class ChupaText::Decomposers::OpenDocumentSpreadsheet
Public Class Methods
Source
# File lib/chupa-text/decomposers/opendocument-spreadsheet.rb, line 24 def initialize(options={}) super @extension = "ods" @mime_type = "application/vnd.oasis.opendocument.spreadsheet" end
Calls superclass method
Private Instance Methods
Source
# File lib/chupa-text/decomposers/opendocument-spreadsheet.rb, line 37 def finish_decompose(context, &block) metadata = TextData.new("", source_data: context[:data]) context[:attributes].each do |name, value| metadata[name] = value end yield(metadata) (context[:sheets] || []).each_with_index do |sheet, i| text = sheet[:text] text_data = TextData.new(text, source_data: context[:data]) text_data["index"] = i name = sheet[:name] text_data["name"] = name if name yield(text_data) end end
Source
# File lib/chupa-text/decomposers/opendocument-spreadsheet.rb, line 54 def log_tag "#{super}[spreadsheet]" end
Source
# File lib/chupa-text/decomposers/opendocument-spreadsheet.rb, line 31 def process_content(entry, context, &block) context[:sheets] = [] listener = SheetsListener.new(context[:sheets]) parse(entry.file_data, listener) end