class AppEarnings::GooglePlay::Parser

Converts a csv file to a hash.

Attributes

file_name[RW]

Public Class Methods

new(file_name) click to toggle source
# File lib/app_earnings/google_play/parser.rb, line 8
def initialize(file_name)
  @file_name = file_name
end

Public Instance Methods

extract() click to toggle source
# File lib/app_earnings/google_play/parser.rb, line 12
def extract
  @extracted_data = []
  options = { headers: true, header_converters: :symbol }

  CSV.foreach(@file_name, options) do |row|
    @extracted_data << row.to_hash
  end
  @extracted_data
end