class Sway::CSV
Public Class Methods
new(csv, *options)
click to toggle source
Calls superclass method
Sway::Base::new
# File lib/sway/csv.rb, line 7 def initialize(csv, *options) extracted_options = options.extract_options! without_header = !(extracted_options[:header] == :first_line) raise "CSV can't be moshed without a header." if without_header lines = ::CSV.new(csv) key = lines.first values = lines.map {|line| line} array = values.inject([]) {|key_value, value| key_value << Hash[key.zip(value)]} super(array) end