class KManager::Resources::CsvFileResource

Represents a CSV file resource.

Public Class Methods

new(**opts) click to toggle source
Calls superclass method KManager::Resources::FileResource::new
# File lib/k_manager/resources/csv_file_resource.rb, line 9
def initialize(**opts)
  super(**opts)
  @type = :csv
end

Public Instance Methods

load_document() click to toggle source
# File lib/k_manager/resources/csv_file_resource.rb, line 14
def load_document
  data = []
  CSV.parse(content, headers: true, header_converters: :symbol).each do |row|
    data << row.to_h
  end
  document.data = data
end