module Fileconv::Convertor

Public Instance Methods

conv_result() click to toggle source

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_file(file, acc) click to toggle source

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_line(line, acc) click to toggle source

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_acc(acc) click to toggle source

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
init_conv() click to toggle source

Initialize the convertor @return [void]

# File lib/fileconv/base.rb, line 89
def init_conv
end
input_dir() click to toggle source

Input Directory @return [String]

# File lib/fileconv/base.rb, line 62
def input_dir
  @opts[:input_dir] || "."
end
input_ext() click to toggle source

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(files) click to toggle source

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_dir() click to toggle source

Output Directory @return [String]

# File lib/fileconv/base.rb, line 75
def output_dir
  @opts[:output_dir] || "output"
end
output_filename(filename, acc) click to toggle source

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_file(filename, acc) click to toggle source

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
result_filename() click to toggle source

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