Class: Flist::Csvx
- Inherits:
-
Object
- Object
- Flist::Csvx
- Defined in:
- lib/flist/csvx.rb
Overview
CSV操作用クラス
Instance Attribute Summary collapse
-
#csv ⇒ Object
Returns the value of attribute csv.
-
#headers_s ⇒ Object
readonly
Returns the value of attribute headers_s.
Instance Method Summary collapse
-
#finish ⇒ Object
終了処理.
-
#initialize(fname) ⇒ Csvx
constructor
初期化.
Constructor Details
#initialize(fname) ⇒ Csvx
初期化
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/flist/csvx.rb', line 10 def initialize(fname) @headers_sym = %i[level kind repo path project comment atime ctime mtime] @headers_s = @headers_sym.map(&:to_s) @fname = fname @csv = if @fname CSV.open(@fname, 'w', { encoding: 'UTF-8', headers: @headers_s, force_quotes: true, write_headers: true }) end end |
Instance Attribute Details
#csv ⇒ Object
Returns the value of attribute csv.
7 8 9 |
# File 'lib/flist/csvx.rb', line 7 def csv @csv end |
#headers_s ⇒ Object (readonly)
Returns the value of attribute headers_s.
6 7 8 |
# File 'lib/flist/csvx.rb', line 6 def headers_s @headers_s end |
Instance Method Details
#finish ⇒ Object
終了処理
25 26 27 |
# File 'lib/flist/csvx.rb', line 25 def finish @csv&.close end |