Sha256: 3bb9d871adf55e7a4b7f9131595953a84c419fd640c7ccfd45eb8bc7dda9805a

Contents?: true

Size: 417 Bytes

Versions: 2

Compression:

Stored size: 417 Bytes

Contents

# encoding: utf-8
module PasswordChanger
  module Readers
    # Build data array from csv file
    class Csv
      def parse(file)
        data = File.readlines(file).delete_if { |l| /^#/ === l }

        csv = CSV.new(
          data.join,
          headers: true, 
          header_converters: :symbol, 
          converters: [:all ]
        )

        csv.to_a.map {|row| row.to_hash }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
password_changer-0.0.4 lib/password_changer/readers/csv.rb
password_changer-0.0.3 lib/password_changer/readers/csv.rb