Skip to content

Instantly share code, notes, and snippets.

@TalkativeTree
Last active December 16, 2015 22:20
Show Gist options
  • Save TalkativeTree/5506529 to your computer and use it in GitHub Desktop.
Save TalkativeTree/5506529 to your computer and use it in GitHub Desktop.
Parsers
module CSVparser
def self.create_class_objects(filename, klass) #will create a new class instance and store them into a variable.
receiver = []
CSV.foreach(filename, :headers => true) do |row|
object << klass.new(row)
end
receiver
end
end
receiver = CSVparser.create_class_objects('filename', Recipe)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment