Class: BlueCrossPets::Cat
Overview
require_relative “./pet”
Constant Summary collapse
- @@cats =
[]
Instance Attribute Summary
Attributes inherited from Pet
#age, #availability, #bio, #breed, #breed_and_colour, #can_live_with, #gender, #name, #profile_url, #reference
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(pet_hash) ⇒ Cat
constructor
A new instance of Cat.
Methods inherited from Pet
#add_attributes, create_from_index, #get_more_info
Constructor Details
#initialize(pet_hash) ⇒ Cat
Returns a new instance of Cat.
7 8 9 10 11 12 13 |
# File 'lib/blue_cross_pets/cat.rb', line 7 def initialize(pet_hash) pet_hash.each do |attribute, value| self.send("#{attribute}=".to_sym, value) end @@cats << self end |
Class Method Details
.all ⇒ Object
15 16 17 |
# File 'lib/blue_cross_pets/cat.rb', line 15 def self.all @@cats end |
.create_cats ⇒ Object
19 20 21 22 23 24 |
# File 'lib/blue_cross_pets/cat.rb', line 19 def self.create_cats if all.length == 0 cat_array = BlueCrossPets::Scraper.new.scrape_index("https://www.bluecross.org.uk/rehome/cat") create_from_index(cat_array) end end |