Class: IV::CLI::Formatter::CSV

Inherits:
Base
  • Object
show all
Defined in:
lib/iv-cli/formatters/csv.rb

Constant Summary collapse

SEPARATOR =
','

Instance Attribute Summary

Attributes inherited from Base

#options

Instance Method Summary collapse

Methods inherited from Base

find, #initialize

Methods included from Helpers::SubclassRegistration

included

Methods included from Helpers::Errors

included

Constructor Details

This class inherits a constructor from IV::CLI::Formatter::Base

Instance Method Details

#output_rows(list) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/iv-cli/formatters/csv.rb', line 9

def output_rows(list)
  line = []
  list.each do |row|
    options[:columns].each do |column|
      line << row[column]
    end

    STDOUT.puts line.join(SEPARATOR).gsub(IV::CLI::Formatter::COLOR_REGEX,'')
    line.slice!(0..-1)
  end
end