Class: Catpedia::Cat

Inherits:
Object
  • Object
show all
Defined in:
lib/catpedia/cat.rb

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#groomingObject

Returns the value of attribute grooming.



3
4
5
# File 'lib/catpedia/cat.rb', line 3

def grooming
  @grooming
end

#healthObject

Returns the value of attribute health.



3
4
5
# File 'lib/catpedia/cat.rb', line 3

def health
  @health
end

#historyObject

Returns the value of attribute history.



3
4
5
# File 'lib/catpedia/cat.rb', line 3

def history
  @history
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/catpedia/cat.rb', line 3

def name
  @name
end

#personalityObject

Returns the value of attribute personality.



3
4
5
# File 'lib/catpedia/cat.rb', line 3

def personality
  @personality
end

#summaryObject

Returns the value of attribute summary.



3
4
5
# File 'lib/catpedia/cat.rb', line 3

def summary
  @summary
end

Class Method Details

.allObject



14
15
16
# File 'lib/catpedia/cat.rb', line 14

def self.all
    @@all
end