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.
That makes perfect sense.  Can you tell me if there is a standard, like
new_weight_in_lbs, for setter values?

*Jeremy Finzel*

*Senior Database Developer*
*M* 630-777-4520




On Thu, Dec 18, 2014 at 11:59 AM, zsyed1 <notifications@github.com> wrote:
>
> In dino_catalog/dinosaur.rb
> <https://github.com/jmmastey/level_up_exercises/pull/353#discussion-diff-22058614>
> :
>
> > +  attr_accessor :name, :period, :continent, :diet, :walking, :description, :weight_in_lbs
> > +  CARNIVORES = %w(Carnivore Insectivore Piscivore)
> > +  PERIOD_PERIOD_TYPES =
> > +  { "Early Cretaceous" => "Cretaceous",
> > +    "Late Cretaceous" => "Cretaceous",
> > +    "Cretaceous" => "Cretaceous",
> > +    "Jurassic" => "Jurassic",
> > +    "Oxfordian" => "Oxfordian" }
> > +
> > +  def initialize(attributes = {})
> > +    attributes.each { |key, value| send("#{key}=", value) }
> > +  end
> > +
> > +  def weight_in_lbs=(weight_in_lbs)
> > +    @weight_in_lbs = weight_in_lbs.to_i
> > +  end
>
> You don't need an @ symbol for variables defined with attr_accessor. Just weight_in_lbs
> = .... Also, change the name of the argument variable so it doesn't get
> shadowed by the instance variable. In general, different variables should
> have different names.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/jmmastey/level_up_exercises/pull/353/files#r22058614>.
>