class ChupaText::Decomposers::OpenDocumentSpreadsheet
Public Class Methods
new(options={})
click to toggle source
Calls superclass method
# File lib/chupa-text/decomposers/opendocument-spreadsheet.rb, line 24 def initialize(options={}) super @extension = "ods" @mime_type = "application/vnd.oasis.opendocument.spreadsheet" end
Private Instance Methods
finish_decompose(context) { |metadata| ... }
click to toggle 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
log_tag()
click to toggle source
# File lib/chupa-text/decomposers/opendocument-spreadsheet.rb, line 54 def log_tag "#{super}[spreadsheet]" end
process_content(entry, context, &block)
click to toggle 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