First Dino Dex Program

I have it set up right now to just run the code in the Main class, and it prints the results to the console.
Honestly, I previously didn't have it as an instance variable and instead I
was passing these variables along.  But then I had a ton of class methods
and I was second-guessing that approach.

After I got some too long method warnings, I kept refactoring each piece of
logic into a different method but not sure if I 'went too far'.  I think
it's not bad to have the csv file load in a separate method because it
really is a single piece of logic - but maybe that's overkill.

*Jeremy Finzel*

*Senior Database Developer*
*M* 630-777-4520




On Tue, Dec 16, 2014 at 8:19 PM, Joseph Mastey <notifications@github.com>
wrote:
>
> In dino_catalog/dinosaur_import.rb
> <https://github.com/jmmastey/level_up_exercises/pull/350#discussion-diff-21948898>
> :
>
> > @@ -0,0 +1,78 @@
> > +$LOAD_PATH << '.'
> > +
> > +require 'csv'
> > +require 'dinosaur'
> > +
> > +class DinosaurImport
> > +  attr_accessor :dinosaurs, :csv_files, :data
> > +
> > +  DEFAULT_OPTIONS = {
> > +    headers: true,
> > +    col_sep: ',',
> > +  }
> > +
> > +  def initialize(csv_files)
> > +    @csv_files = csv_files
>
> Keeping @csv_files as an instance variable is probably not that useful.
> You never retrieve it. Better to pass it as an argument to
> csv_files_to_dinosaurs. Honestly, you could even move the outer loop into
> initialize:
>
> def initialize(csv_files)
>   @dinosaurs = []
>   csv_files.each do |file|
>     load_csv_file(file)
>   end
> end
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/jmmastey/level_up_exercises/pull/350/files#r21948898>.
>