Class: Kiba::Plus::Destination::Csv
- Inherits:
-
Object
- Object
- Kiba::Plus::Destination::Csv
- Defined in:
- lib/kiba/plus/destination/csv.rb
Instance Attribute Summary collapse
-
#csv ⇒ Object
readonly
Returns the value of attribute csv.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(options = {}) ⇒ Csv
constructor
A new instance of Csv.
- #write(row) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Csv
Returns a new instance of Csv.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/kiba/plus/destination/csv.rb', line 7 def initialize( = {}) @options = @options.assert_valid_keys( :output_file, :mode, :row_sep, :col_sep, :force_quotes, :quote_char ) @csv = CSV.open(output_file, mode, { :col_sep => col_sep, :quote_char => quote_char, :force_quotes => force_quotes, :row_sep => row_sep }) end |
Instance Attribute Details
#csv ⇒ Object (readonly)
Returns the value of attribute csv.
5 6 7 |
# File 'lib/kiba/plus/destination/csv.rb', line 5 def csv @csv end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/kiba/plus/destination/csv.rb', line 5 def @options end |
Instance Method Details
#close ⇒ Object
29 30 31 |
# File 'lib/kiba/plus/destination/csv.rb', line 29 def close @csv.close end |
#write(row) ⇒ Object
25 26 27 |
# File 'lib/kiba/plus/destination/csv.rb', line 25 def write(row) @csv << row.values end |