Dinodex

Refactored dinodex to simplify usage and make it more readable/usable
Changed filter on dinodex to array instead of hash to allow filtering on same data
Removed method_missing for define_method
cleaned up dino to be less copy/pasty
Ehhhhh, okay. I won't fight you on it :) I would still leave the raise in
the other spot.

Joseph Mastey
jmmastey@gmail.com | 815.228.6924 | http://josephmastey.com |
http://leveluprails.herokuapp.com

On Thu, Sep 25, 2014 at 11:48 AM, Przemek Wojtowicz <
notifications@github.com> wrote:

> In dino_catalog/dinodex.rb:
>
> > +###############
> > +Dino Dex Entries (Count: #{@dinos.length})
> > +---------------
> > +Filter:
> > +#{@filter.map { |f| "#{f.first}: #{f.last}" }.join("\n")}
> > +---------------
> > +#{@dinos.join("\n")}
> > +###############
> > +    STRING
> > +  end
> > +
> > +  private
> > +
> > +  def parse_file(file_path)
> > +    csv = CSV.open(file_path, headers: true)
> > +    dino_mapper = get_mapper(csv) || raise("Could not map file #{file_path}")
>
> That's where I originally had it, but the mapper for doesn't care if the
> mapper exists, the actual things parsing it cares, so I had that raise the
> exception because it cannot continue without a parser.
>
> The get_mapper can continue and I think it's a better patter to return
> nothing if not found and let the calling code decide what to do in the case
> it's not found.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/jmmastey/level_up_exercises/pull/84/files#r18043930>.
>