Class: Catpedia::Cat
- Inherits:
-
Object
- Object
- Catpedia::Cat
- Defined in:
- lib/catpedia/cat.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#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.
-
#personality ⇒ Object
Returns the value of attribute personality.
-
#summary ⇒ Object
Returns the value of attribute summary.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(details) ⇒ Cat
constructor
A new instance of Cat.
Constructor Details
#initialize(details) ⇒ Cat
Returns a new instance of Cat.
7 8 9 10 11 12 |
# File 'lib/catpedia/cat.rb', line 7 def initialize(details) @@all << self details.each do |key, value| #for each details hash, create keys and values in the instance of Cat self.send("#{key}=", value) end end |
Instance Attribute Details
#grooming ⇒ Object
Returns the value of attribute grooming.
3 4 5 |
# File 'lib/catpedia/cat.rb', line 3 def grooming @grooming end |
#health ⇒ Object
Returns the value of attribute health.
3 4 5 |
# File 'lib/catpedia/cat.rb', line 3 def health @health end |
#history ⇒ Object
Returns the value of attribute history.
3 4 5 |
# File 'lib/catpedia/cat.rb', line 3 def history @history end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/catpedia/cat.rb', line 3 def name @name end |
#personality ⇒ Object
Returns the value of attribute personality.
3 4 5 |
# File 'lib/catpedia/cat.rb', line 3 def personality @personality end |
#summary ⇒ Object
Returns the value of attribute summary.
3 4 5 |
# File 'lib/catpedia/cat.rb', line 3 def summary @summary end |
Class Method Details
.all ⇒ Object
14 15 16 |
# File 'lib/catpedia/cat.rb', line 14 def self.all @@all end |