Dino Dex First Refactor

Let me know when you have a few minutes.  I want to go over a few of the questions you had which I haven't yet done anything with.
Thanks for the idea.

*Jeremy Finzel*

*Senior Database Developer*
*M* 630-777-4520




On Thu, Dec 18, 2014 at 2:07 PM, zsyed1 <notifications@github.com> wrote:
>
> In dino_catalog/objects_filter.rb
> <https://github.com/jmmastey/level_up_exercises/pull/353#discussion-diff-22067580>
> :
>
> > +      filter_exception
> > +    else
> > +      attributes_values.each do |attribute, value|
> > +        objects = add_filter(objects, operator, { attribute => value })
> > +      end
> > +      objects
> > +    end
> > +  end
> > +
> > +  def self.add_filter(objects, operator, attribute_value)
> > +    begin
> > +      objects.select do |object|
> > +        object.send("#{attribute_value.keys[0]}")
> > +            .send(operator, attribute_value.values[0])
> > +      end
> > +    rescue
>
> You should refactor lines 24, 25 by having a method on Dinosaur called def
> passes_filter?(key, operator, value) that does this for you. Here you
> would just pass the three values to it e.g. object.passes_filter?(key,
> operator, value).
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/jmmastey/level_up_exercises/pull/353/files#r22067580>.
>