class BlueCrossPets::Dog
require_relative “./pet”
Public Class Methods
all()
click to toggle source
# File lib/blue_cross_pets/dog.rb, line 15 def self.all @@dogs end
create_dogs()
click to toggle source
# File lib/blue_cross_pets/dog.rb, line 23 def self.create_dogs if all.length == 0 dog_array = BlueCrossPets::Scraper.new.scrape_index("https://www.bluecross.org.uk/rehome/dog") create_from_index(dog_array) end end
new(pet_hash)
click to toggle source
# File lib/blue_cross_pets/dog.rb, line 7 def initialize(pet_hash) pet_hash.each do |attribute, value| self.send("#{attribute}=".to_sym, value) end @@dogs << self end
sorted_array()
click to toggle source
# File lib/blue_cross_pets/dog.rb, line 19 def self.sorted_array self.all.sort { |dog1, dog2| dog1.name <=> dog2.name } end