class YnabConvert::File
Operations on the CSV file to convert
Public Class Methods
new(opts)
click to toggle source
@option opts [String] :file The filename or path to the file @option opts [Processor] :processor The class to use for converting the CSV file
# File lib/ynab_convert.rb, line 30 def initialize(opts) logger.debug opts.to_h @file = opts[:file] begin @processor = opts[:processor].new( file: @file ) rescue Errno::ENOENT handle_file_not_found end end
Public Instance Methods
to_ynab!()
click to toggle source
Converts @file to YNAB4 format and writes it to disk @return [String] The path to the YNAB4 formatted CSV file created
# File lib/ynab_convert.rb, line 45 def to_ynab! logger.debug "Processing `#{@file}' through `#{@processor.class.name}'" @processor.to_ynab! end
Private Instance Methods
file_not_found_message()
click to toggle source
# File lib/ynab_convert.rb, line 52 def file_not_found_message raise Errno::ENOENT, "File `#{@file}' not found or not accessible." end