Class: PetsSeekingPeople::Pets
- Inherits:
-
Object
- Object
- PetsSeekingPeople::Pets
- Defined in:
- lib/pets_seeking_people/pets.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#adoption_contact ⇒ Object
Returns the value of attribute adoption_contact.
-
#adoption_website ⇒ Object
Returns the value of attribute adoption_website.
-
#age ⇒ Object
Returns the value of attribute age.
-
#animal_url ⇒ Object
Returns the value of attribute animal_url.
-
#breed ⇒ Object
Returns the value of attribute breed.
-
#detailed_info ⇒ Object
Returns the value of attribute detailed_info.
-
#gender ⇒ Object
Returns the value of attribute gender.
-
#info ⇒ Object
Returns the value of attribute info.
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #add_animal_attributes(attributes_hash) ⇒ Object
-
#initialize(animal_hash) ⇒ Pets
constructor
A new instance of Pets.
Constructor Details
#initialize(animal_hash) ⇒ Pets
Returns a new instance of Pets.
7 8 9 10 |
# File 'lib/pets_seeking_people/pets.rb', line 7 def initialize(animal_hash) animal_hash.each {|key, value| self.send(("#{key}="), value)} @@all << self end |
Instance Attribute Details
#adoption_contact ⇒ Object
Returns the value of attribute adoption_contact.
3 4 5 |
# File 'lib/pets_seeking_people/pets.rb', line 3 def adoption_contact @adoption_contact end |
#adoption_website ⇒ Object
Returns the value of attribute adoption_website.
3 4 5 |
# File 'lib/pets_seeking_people/pets.rb', line 3 def adoption_website @adoption_website end |
#age ⇒ Object
Returns the value of attribute age.
3 4 5 |
# File 'lib/pets_seeking_people/pets.rb', line 3 def age @age end |
#animal_url ⇒ Object
Returns the value of attribute animal_url.
3 4 5 |
# File 'lib/pets_seeking_people/pets.rb', line 3 def animal_url @animal_url end |
#breed ⇒ Object
Returns the value of attribute breed.
3 4 5 |
# File 'lib/pets_seeking_people/pets.rb', line 3 def breed @breed end |
#detailed_info ⇒ Object
Returns the value of attribute detailed_info.
3 4 5 |
# File 'lib/pets_seeking_people/pets.rb', line 3 def detailed_info @detailed_info end |
#gender ⇒ Object
Returns the value of attribute gender.
3 4 5 |
# File 'lib/pets_seeking_people/pets.rb', line 3 def gender @gender end |
#info ⇒ Object
Returns the value of attribute info.
3 4 5 |
# File 'lib/pets_seeking_people/pets.rb', line 3 def info @info end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/pets_seeking_people/pets.rb', line 3 def name @name end |
Class Method Details
.all ⇒ Object
23 24 25 |
# File 'lib/pets_seeking_people/pets.rb', line 23 def self.all @@all end |
.create_from_collection(animals_array) ⇒ Object
12 13 14 15 16 |
# File 'lib/pets_seeking_people/pets.rb', line 12 def self.create_from_collection(animals_array) animals_array.each do |animal| PetsSeekingPeople::Pets.new(animal) end end |
.find(input) ⇒ Object
27 28 29 |
# File 'lib/pets_seeking_people/pets.rb', line 27 def self.find(input) self.all[input.to_i-1] end |
Instance Method Details
#add_animal_attributes(attributes_hash) ⇒ Object
18 19 20 21 |
# File 'lib/pets_seeking_people/pets.rb', line 18 def add_animal_attributes(attributes_hash) attributes_hash.each {|key, value| self.send(("#{key}="), value)} self end |