module Fileconv::Convertor
Public Instance Methods
Conversion result @return [String, nil] the result @note output the string result to a file({#result_filename}) and don't create file if this method return nil(default) @note you can create result data using @meta or anather instance variable you create
# File lib/fileconv/base.rb, line 141 def conv_result end
Convert a File
@param [Object] file the file object @param [Hash] acc the accumulator for this file @return [String, nil] @note output the string to a file({#output_filename}) and don't create file if this method return nil
# File lib/fileconv/base.rb, line 119 def convert_file(file, acc) file end
Convert a Line
@param [Object] line the line object @param [Hash] acc the accumulator for this file @return [Object, Array, nil] the converted line @note add the line object add all lines if this method return Array and don't add it if this method return nil
# File lib/fileconv/base.rb, line 110 def convert_line(line, acc) line end
Init a accumlator @param [Hash] acc the accumulator for this file @return [void]
# File lib/fileconv/base.rb, line 95 def init_acc(acc) end
Initialize the convertor @return [void]
# File lib/fileconv/base.rb, line 89 def init_conv end
Input Directory @return [String]
# File lib/fileconv/base.rb, line 62 def input_dir @opts[:input_dir] || "." end
File
extention for input file @return [String,nil] @note target all files if this method return nil
# File lib/fileconv/base.rb, line 69 def input_ext @opts[:input_ext] end
Input files @param [Array<string>] files input files @return [Array<String>] @note you can overwrite default input files
# File lib/fileconv/base.rb, line 83 def input_files(files) files end
Output Directory @return [String]
# File lib/fileconv/base.rb, line 75 def output_dir @opts[:output_dir] || "output" end
File
name for the output @param [String] filename original base file name @param [Hash] acc the accumulator for this file @return [String] the output file name
# File lib/fileconv/base.rb, line 127 def output_filename(filename, acc) filename end
Read a file @param [Hash] acc the accumulator for this file @return [Object,nil] @note use default reader if this method return nil
# File lib/fileconv/base.rb, line 102 def read_file(filename, acc) end
File
name for the result @return [String] the result file name
# File lib/fileconv/base.rb, line 133 def result_filename @opts[:result_file] || "result.txt" end