Class: CatBreeds::Cat

Inherits:
Object
  • Object
show all
Defined in:
lib/cat_breeds/cats.rb

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#blurbObject

Returns the value of attribute blurb.



2
3
4
# File 'lib/cat_breeds/cats.rb', line 2

def blurb
  @blurb
end

#characteristicsObject

Returns the value of attribute characteristics.



2
3
4
# File 'lib/cat_breeds/cats.rb', line 2

def characteristics
  @characteristics
end

#descriptionObject

Returns the value of attribute description.



2
3
4
# File 'lib/cat_breeds/cats.rb', line 2

def description
  @description
end

#fun_factObject

Returns the value of attribute fun_fact.



2
3
4
# File 'lib/cat_breeds/cats.rb', line 2

def fun_fact
  @fun_fact
end

#groomingObject

Returns the value of attribute grooming.



2
3
4
# File 'lib/cat_breeds/cats.rb', line 2

def grooming
  @grooming
end

#healthObject

Returns the value of attribute health.



2
3
4
# File 'lib/cat_breeds/cats.rb', line 2

def health
  @health
end

#historyObject

Returns the value of attribute history.



2
3
4
# File 'lib/cat_breeds/cats.rb', line 2

def history
  @history
end

#nameObject

Returns the value of attribute name.



2
3
4
# File 'lib/cat_breeds/cats.rb', line 2

def name
  @name
end

#page_urlObject

Returns the value of attribute page_url.



2
3
4
# File 'lib/cat_breeds/cats.rb', line 2

def page_url
  @page_url
end

#personalityObject

Returns the value of attribute personality.



2
3
4
# File 'lib/cat_breeds/cats.rb', line 2

def personality
  @personality
end

Class Method Details

.allObject



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