Class: Neopets::Pet
- Inherits:
-
Object
- Object
- Neopets::Pet
- Defined in:
- lib/neopets/pet.rb
Instance Attribute Summary collapse
-
#gender ⇒ Object
Returns the value of attribute gender.
-
#image_url ⇒ Object
Returns the value of attribute image_url.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #cp ⇒ Object
- #female? ⇒ Boolean
-
#initialize(name, options = {}) ⇒ Pet
constructor
A new instance of Pet.
- #male? ⇒ Boolean
- #mood ⇒ Object
Constructor Details
#initialize(name, options = {}) ⇒ Pet
Returns a new instance of Pet.
6 7 8 9 |
# File 'lib/neopets/pet.rb', line 6 def initialize(name, ={}) @name = name .each { |key, value| self.send("#{key}=", value) } end |
Instance Attribute Details
#gender ⇒ Object
Returns the value of attribute gender.
3 4 5 |
# File 'lib/neopets/pet.rb', line 3 def gender @gender end |
#image_url ⇒ Object
Returns the value of attribute image_url.
4 5 6 |
# File 'lib/neopets/pet.rb', line 4 def image_url @image_url end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/neopets/pet.rb', line 3 def name @name end |
Instance Method Details
#cp ⇒ Object
11 12 13 14 |
# File 'lib/neopets/pet.rb', line 11 def cp parse_image_url unless @cp @cp end |
#female? ⇒ Boolean
16 17 18 |
# File 'lib/neopets/pet.rb', line 16 def female? @gender == :female end |
#male? ⇒ Boolean
30 31 32 |
# File 'lib/neopets/pet.rb', line 30 def male? @gender == :male end |
#mood ⇒ Object
34 35 36 37 |
# File 'lib/neopets/pet.rb', line 34 def mood parse_image_url unless @mood @mood end |