Class: CatBreeds::Cat
- Inherits:
-
Object
- Object
- CatBreeds::Cat
- Defined in:
- lib/cat_breeds/cats.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#blurb ⇒ Object
Returns the value of attribute blurb.
-
#characteristics ⇒ Object
Returns the value of attribute characteristics.
-
#description ⇒ Object
Returns the value of attribute description.
-
#fun_fact ⇒ Object
Returns the value of attribute fun_fact.
-
#grooming ⇒ Object
Returns the value of attribute grooming.
-
#health ⇒ Object
Returns the value of attribute health.
-
#history ⇒ Object
Returns the value of attribute history.
-
#name ⇒ Object
Returns the value of attribute name.
-
#page_url ⇒ Object
Returns the value of attribute page_url.
-
#personality ⇒ Object
Returns the value of attribute personality.
Class Method Summary collapse
Instance Method Summary collapse
-
#add_details(details) ⇒ Object
takes hash returned from CatBreeds::Scraper.scrape_profile(url) and adds breed data to the corresponding instance of cat breed.
-
#initialize(name, page_url) ⇒ Cat
constructor
A new instance of Cat.
Constructor Details
#initialize(name, page_url) ⇒ Cat
Returns a new instance of Cat.
6 7 8 9 10 |
# File 'lib/cat_breeds/cats.rb', line 6 def initialize(name, page_url) @name = name @page_url = page_url @@all << self end |
Instance Attribute Details
#blurb ⇒ Object
Returns the value of attribute blurb.
2 3 4 |
# File 'lib/cat_breeds/cats.rb', line 2 def blurb @blurb end |
#characteristics ⇒ Object
Returns the value of attribute characteristics.
2 3 4 |
# File 'lib/cat_breeds/cats.rb', line 2 def characteristics @characteristics end |
#description ⇒ Object
Returns the value of attribute description.
2 3 4 |
# File 'lib/cat_breeds/cats.rb', line 2 def description @description end |
#fun_fact ⇒ Object
Returns the value of attribute fun_fact.
2 3 4 |
# File 'lib/cat_breeds/cats.rb', line 2 def fun_fact @fun_fact end |
#grooming ⇒ Object
Returns the value of attribute grooming.
2 3 4 |
# File 'lib/cat_breeds/cats.rb', line 2 def grooming @grooming end |
#health ⇒ Object
Returns the value of attribute health.
2 3 4 |
# File 'lib/cat_breeds/cats.rb', line 2 def health @health end |
#history ⇒ Object
Returns the value of attribute history.
2 3 4 |
# File 'lib/cat_breeds/cats.rb', line 2 def history @history end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/cat_breeds/cats.rb', line 2 def name @name end |
#page_url ⇒ Object
Returns the value of attribute page_url.
2 3 4 |
# File 'lib/cat_breeds/cats.rb', line 2 def page_url @page_url end |
#personality ⇒ Object
Returns the value of attribute personality.
2 3 4 |
# File 'lib/cat_breeds/cats.rb', line 2 def personality @personality end |
Class Method Details
.all ⇒ Object
18 19 20 |
# File 'lib/cat_breeds/cats.rb', line 18 def self.all @@all end |
Instance Method Details
#add_details(details) ⇒ Object
takes hash returned from CatBreeds::Scraper.scrape_profile(url) and adds breed data to the corresponding instance of cat breed
12 13 14 15 16 |
# File 'lib/cat_breeds/cats.rb', line 12 def add_details(details) #takes hash returned from CatBreeds::Scraper.scrape_profile(url) and adds breed data to the corresponding instance of cat breed details.each do |k,v| self.send("#{k}=", v) end end |