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.
I think I wanted carnivore? to be an instance variable, but I may be
confusing myself due to having experience with strictly typed languages.
Let me ask you: if I want carnivore? to be an attribute of a dinosaur does
your solution essentially provide that or am I missing something?  One
thing I noted is that if I do a dump of instance variables, I am not sure
if carnivore? would show up otherwise?

*Jeremy Finzel*

*Senior Database Developer*
*M* 630-777-4520




On Tue, Dec 16, 2014 at 8:14 PM, Joseph Mastey <notifications@github.com>
wrote:
>
> In dino_catalog/dinosaur.rb
> <https://github.com/jmmastey/level_up_exercises/pull/350#discussion-diff-21948756>
> :
>
> > +
> > +class Dinosaur
> > +  attr_accessor :name, :period, :continent, :diet, :walking, :description
> > +  attr_reader :weight_in_lbs
> > +
> > +  def initialize(options)
> > +    options.each { |key, value| send("#{key}=", value) }
> > +  end
> > +
> > +  def weight_in_lbs=(weight_in_lbs)
> > +    @weight_in_lbs = weight_in_lbs.to_i
> > +  end
> > +
> > +  def carnivore?
> > +    @carnivore = carnivores.include?(@diet) ? true : false
> > +  end
>
> carnivores.include? @diet already returns true / false, no need for the
> ternary. Also, the assignment to @carnivore appears to be useless.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/jmmastey/level_up_exercises/pull/350/files#r21948756>.
>