class ElfHam
Constants
- VERSION
Public Class Methods
new(csv_data)
click to toggle source
# File lib/elf_ham.rb, line 8 def initialize(csv_data) @rows = CSV.parse(csv_data, headers: true).each.to_a end
Public Instance Methods
result()
click to toggle source
# File lib/elf_ham.rb, line 22 def result CSV.generate do |csv| @rows.each_with_index do |row, index| if index == 0 csv << row.headers end csv << row.fields end end end
select(&block)
click to toggle source
# File lib/elf_ham.rb, line 17 def select(&block) @rows.select!(&block) self end
transform(&block)
click to toggle source
# File lib/elf_ham.rb, line 12 def transform(&block) @rows.each(&block) self end