class Md2site::ListFile

ダウンロード一覧ファイルクラス

Public Class Methods

new(dir, mes) click to toggle source

初期化

@param dir [String] 書込先ディレクトリ @param mes [Messagex] Messagexクラスのインスタンス

# File lib/md2site/listfile.rb, line 12
def initialize(dir, mes)
  @fname = File.join(dir, LIST_FILE)
  @mes = mes

  @mes.exc_file_open(@fname) { @csv = CSV.open(@fname, "w", { col_sep: "\t", headers: true }) }

  @csv.add_row([FIELD_FILENMAE, FIELD_DATETIMESTR, FIELD_UNIXTIME, FIELD_MD5])
end

Public Instance Methods

add(row) click to toggle source

行追加

@param row [Array<String>] 1行分のフィールドの配列 @return [void]

# File lib/md2site/listfile.rb, line 26
def add(row)
  @csv.add_row(row)
end
close() click to toggle source

ダウンロード一覧ファイルクローズ

@return [void]

# File lib/md2site/listfile.rb, line 34
def close
  @mes.exc_file_close(@fname) { @csv.close }
end