Class: DiscoverDogBreeds::Dog
- Inherits:
-
Object
- Object
- DiscoverDogBreeds::Dog
- Defined in:
- lib/discover_dog_breeds/dog.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#barking ⇒ Object
Returns the value of attribute barking.
-
#energy ⇒ Object
Returns the value of attribute energy.
-
#grooming ⇒ Object
Returns the value of attribute grooming.
-
#height_female ⇒ Object
Returns the value of attribute height_female.
-
#height_male ⇒ Object
Returns the value of attribute height_male.
-
#life ⇒ Object
Returns the value of attribute life.
-
#name ⇒ Object
Returns the value of attribute name.
-
#personality ⇒ Object
Returns the value of attribute personality.
-
#shedding ⇒ Object
Returns the value of attribute shedding.
-
#trainability ⇒ Object
Returns the value of attribute trainability.
-
#weight_female ⇒ Object
Returns the value of attribute weight_female.
-
#weight_male ⇒ Object
Returns the value of attribute weight_male.
-
#with_children ⇒ Object
Returns the value of attribute with_children.
-
#with_dogs ⇒ Object
Returns the value of attribute with_dogs.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, personality = nil, energy = nil, with_children = nil, with_dogs = nil, shedding = nil, grooming = nil, trainability = nil, height_male = nil, height_female = nil, weight_male = nil, weight_female = nil, life = nil, barking = nil) ⇒ Dog
constructor
A new instance of Dog.
Constructor Details
#initialize(name, personality = nil, energy = nil, with_children = nil, with_dogs = nil, shedding = nil, grooming = nil, trainability = nil, height_male = nil, height_female = nil, weight_male = nil, weight_female = nil, life = nil, barking = nil) ⇒ Dog
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/discover_dog_breeds/dog.rb', line 31 def initialize(name, personality = nil, energy = nil, with_children = nil, with_dogs = nil, shedding = nil, grooming = nil, trainability = nil, height_male = nil, height_female = nil, weight_male = nil, weight_female = nil, life = nil, = nil) @name = name @personality = personality @energy = energy @with_children = with_children @with_dogs = with_dogs @shedding = shedding @grooming = grooming @trainability = trainability @height_male = height_male @height_female = height_female @weight_male = weight_male @weight_female = weight_female @life = life @barking = @@all << self end |
Instance Attribute Details
#barking ⇒ Object
Returns the value of attribute barking.
4 5 6 |
# File 'lib/discover_dog_breeds/dog.rb', line 4 def @barking end |
#energy ⇒ Object
Returns the value of attribute energy.
4 5 6 |
# File 'lib/discover_dog_breeds/dog.rb', line 4 def energy @energy end |
#grooming ⇒ Object
Returns the value of attribute grooming.
4 5 6 |
# File 'lib/discover_dog_breeds/dog.rb', line 4 def grooming @grooming end |
#height_female ⇒ Object
Returns the value of attribute height_female.
4 5 6 |
# File 'lib/discover_dog_breeds/dog.rb', line 4 def height_female @height_female end |
#height_male ⇒ Object
Returns the value of attribute height_male.
4 5 6 |
# File 'lib/discover_dog_breeds/dog.rb', line 4 def height_male @height_male end |
#life ⇒ Object
Returns the value of attribute life.
4 5 6 |
# File 'lib/discover_dog_breeds/dog.rb', line 4 def life @life end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/discover_dog_breeds/dog.rb', line 4 def name @name end |
#personality ⇒ Object
Returns the value of attribute personality.
4 5 6 |
# File 'lib/discover_dog_breeds/dog.rb', line 4 def personality @personality end |
#shedding ⇒ Object
Returns the value of attribute shedding.
4 5 6 |
# File 'lib/discover_dog_breeds/dog.rb', line 4 def shedding @shedding end |
#trainability ⇒ Object
Returns the value of attribute trainability.
4 5 6 |
# File 'lib/discover_dog_breeds/dog.rb', line 4 def trainability @trainability end |
#weight_female ⇒ Object
Returns the value of attribute weight_female.
4 5 6 |
# File 'lib/discover_dog_breeds/dog.rb', line 4 def weight_female @weight_female end |
#weight_male ⇒ Object
Returns the value of attribute weight_male.
4 5 6 |
# File 'lib/discover_dog_breeds/dog.rb', line 4 def weight_male @weight_male end |
#with_children ⇒ Object
Returns the value of attribute with_children.
4 5 6 |
# File 'lib/discover_dog_breeds/dog.rb', line 4 def with_children @with_children end |
#with_dogs ⇒ Object
Returns the value of attribute with_dogs.
4 5 6 |
# File 'lib/discover_dog_breeds/dog.rb', line 4 def with_dogs @with_dogs end |
Class Method Details
.all ⇒ Object
8 9 10 |
# File 'lib/discover_dog_breeds/dog.rb', line 8 def self.all @@all end |
.create_new_from_details(name, details) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/discover_dog_breeds/dog.rb', line 12 def self.create_new_from_details(name, details) n = name.split("-").each { |w| w.capitalize! }.join(" ") p = details[0] e = details[1] wc = details[2] wd = details[3] s = details[4] g = details[5] t = details[6] hm = details[7].split(",").count == 2 ? details[7].split(",")[0].strip : details[7].strip hf = details[7].split(",").count == 2 ? details[7].split(",")[1].strip : details[7].strip wm = details[8].split(",").count == 2 ? details[8].split(",")[0].strip : details[8].strip wf = details[8].split(",").count == 2 ? details[8].split(",")[1].strip : details[8].strip l = details[9] b = details[10] # binding.pry self.new(n, p, e, wc, wd, s, g, t, hm, hf, wm, wf, l, b) end |