Sha256: 9764ea0b5cd65ec535b8f17da2cd9161978c42df1b7d314d28ae2ca0a7ee12cb
Contents?: true
Size: 513 Bytes
Versions: 3
Compression:
Stored size: 513 Bytes
Contents
# frozen_string_literal: true require "csv" require_relative "elf_ham/version" class ElfHam def initialize(csv_data) @rows = CSV.parse(csv_data, headers: true).each.to_a end def transform(&block) @rows.each(&block) self end def select(&block) @rows.select!(&block) self end 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 end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
elf_ham-1.0.0 | lib/elf_ham.rb |
elf_ham-0.2.0 | lib/elf_ham.rb |
elf_ham-0.1.0 | lib/elf_ham.rb |