class TinOpener::DataFileProcessors::XlsProcessor
Public Class Methods
new(args = {})
click to toggle source
Calls superclass method
TinOpener::DataFileProcessor::new
# File lib/tin_opener/data_file_processors/xls_processor.rb, line 4 def initialize(args = {}) super end
Private Instance Methods
csv_processor()
click to toggle source
# File lib/tin_opener/data_file_processors/xls_processor.rb, line 16 def csv_processor @csv_processor ||= CsvProcessor.new(file: tempfile.tap { write_csv_data }) end
filename()
click to toggle source
# File lib/tin_opener/data_file_processors/xls_processor.rb, line 24 def filename @file.path.split('/').last end
raw_data()
click to toggle source
# File lib/tin_opener/data_file_processors/xls_processor.rb, line 12 def raw_data @raw_data ||= Roo::Spreadsheet.open(@file.path) end
tempfile()
click to toggle source
# File lib/tin_opener/data_file_processors/xls_processor.rb, line 20 def tempfile @tempfile ||= Tempfile.new(filename) end
write_csv_data()
click to toggle source
TODO: Roo has a built-in .to_yaml transform. Consider using that over CSV
whenever a YAML processor is implemented
# File lib/tin_opener/data_file_processors/xls_processor.rb, line 30 def write_csv_data # arguments: filename = nil, separator = ',', sheet = default_sheet @csv_data ||= raw_data.to_csv(tempfile, ';') end