lib/best_friend/breed.rb in best_friend-0.1.0 vs lib/best_friend/breed.rb in best_friend-0.1.1

- old
+ new

@@ -1,37 +1,37 @@ -class Breed - - @@all = [] - attr_accessor :name, :bio, :characteristics, :stats - - def self.all - @@all - end - - def save - @@all << self - end - - 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 - - def add_stats(hash) - self.stats =Stats.new(hash) - end - def add_charac(array) - self.characteristics = [] - array.each do|charac| - self.characteristics << Characteristic.new(charac) - end - end - - +class Breed + + @@all = [] + attr_accessor :name, :bio, :characteristics, :stats + + def self.all + @@all + end + + def save + @@all << self + end + + 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 + + def add_stats(hash) + self.stats =Stats.new(hash) + end + def add_charac(array) + self.characteristics = [] + array.each do|charac| + self.characteristics << Characteristic.new(charac) + end + end + + end \ No newline at end of file