class HammerCLI::Output::Adapter::CSValues

Public Instance Methods

print_collection(fields, collection) click to toggle source
print_message(msg, msg_params={}) click to toggle source
print_record(fields, record) click to toggle source
row_data(fields, collection) click to toggle source
# File lib/hammer_cli/output/adapter/csv.rb, line 142
def row_data(fields, collection)
  result = []
  collection.each do |data|
    result << Cell.create_cells(FieldWrapper.wrap(fields), data, @formatters)
  end
  result
end
tags() click to toggle source
# File lib/hammer_cli/output/adapter/csv.rb, line 138
def tags
  [:flat]
end

Private Instance Methods

default_headers(fields) click to toggle source
# File lib/hammer_cli/output/adapter/csv.rb, line 203
def default_headers(fields)
  fields.select{ |f| !(f.class <= Fields::Id) || @context[:show_ids] }.map { |f| f.label }
end
generate(&block) click to toggle source
# File lib/hammer_cli/output/adapter/csv.rb, line 195
def generate(&block)
  CSV.generate(
    :col_sep => @context[:csv_separator] || ',',
    :encoding => 'utf-8',
    &block
  )
end