Sha256: d30e6dbe89760cfc470d81f5d08b6da0b22148749fa561ef708a34094a70d5ca

Contents?: true

Size: 750 Bytes

Versions: 1

Compression:

Stored size: 750 Bytes

Contents

#!/usr/bin/env ruby

require 'bundler/setup'
require 'pry'
require 'faker'
require 'simple_csv'

# CSV generation test
SimpleCsv.generate('spec/files/output.csv') do
  headers :first_name, :last_name, :birth_date, :employed_at

  100.times do
    first_name Faker::Name.first_name
    last_name Faker::Name.last_name
    birth_date Faker::Date.between(Date.today << 1000, Date.today << 200)
    employed_at [Faker::Company.name, nil].sample
  end
end

# CSV read test
SimpleCsv.read('spec/files/output.csv') do
  headers :first_name, :last_name, :birth_date, :employed_at

  in_groups_of(10) do
    each_row :with_index do
      puts [index, first_name, last_name,
            birth_date, employed_at].compact.join ', '
    end
    sleep 1
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simple_csv-0.1.0 bin/console