class SeaLife::Animal

Attributes

category[R]
distribution[RW]
habitat[RW]
habits[RW]
longer_desc[RW]
name[RW]
scientific_name[RW]
short_desc[RW]
status[RW]
taxonomy[RW]
url[RW]

Public Class Methods

all() click to toggle source
# File lib/sea_life/animal.rb, line 20
def self.all
  @@all
end
find_by_name(name) click to toggle source
# File lib/sea_life/animal.rb, line 24
def self.find_by_name(name)
  self.all.detect { |animal| animal.name == name }
end
new(info) click to toggle source
# File lib/sea_life/animal.rb, line 6
def initialize(info)
  add_info(info)
  @@all << self
end

Public Instance Methods

add_info(info) click to toggle source
# File lib/sea_life/animal.rb, line 16
def add_info(info)
  info.each { |k, v| self.send("#{k}=", v) }
end
category=(category) click to toggle source
# File lib/sea_life/animal.rb, line 11
def category=(category)
  @category = category
  category.animals << self
end