class Breed

Attributes

bio[RW]
characteristics[RW]
name[RW]
stats[RW]

Public Class Methods

all() click to toggle source
# File lib/best_friend/breed.rb, line 6
def self.all
    @@all
end
create_by_hash(hash) click to toggle source
# File lib/best_friend/breed.rb, line 14
def self.create_by_hash(hash)
  Breed.new.tap do |breed| 
    hash.each do |key, value| 
      breed.send("#{key}=", value)
    end
    breed.add_stats(breed.stats)
    breed.add_charac(breed.characteristics)
    breed.save
  end
 
end

Public Instance Methods

add_charac(array) click to toggle source
# File lib/best_friend/breed.rb, line 29
def add_charac(array)
  self.characteristics = []
  array.each do|charac|
    self.characteristics << Characteristic.new(charac)
  end
end
add_stats(hash) click to toggle source
# File lib/best_friend/breed.rb, line 26
def add_stats(hash)
  self.stats =Stats.new(hash)
end
save() click to toggle source
# File lib/best_friend/breed.rb, line 10
def save
  @@all << self
end