Class: Exercise
- Inherits:
-
Object
- Object
- Exercise
- Defined in:
- lib/exercise.rb
Overview
exercise belongs to a category
Constant Summary collapse
- @@all_exercises =
[]
Instance Attribute Summary collapse
-
#category ⇒ Object
Returns the value of attribute category.
-
#description ⇒ Object
Returns the value of attribute description.
-
#muscle ⇒ Object
Returns the value of attribute muscle.
-
#name ⇒ Object
Returns the value of attribute name.
-
#workout ⇒ Object
Returns the value of attribute workout.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Exercise
constructor
A new instance of Exercise.
Constructor Details
#initialize ⇒ Exercise
Returns a new instance of Exercise.
6 7 8 9 10 11 |
# File 'lib/exercise.rb', line 6 def initialize @name = name @muscle = muscle # each instance of exercise will set its muscle equal to instance of muscle category @description = description @@all_exercises << self end |
Instance Attribute Details
#category ⇒ Object
Returns the value of attribute category.
2 3 4 |
# File 'lib/exercise.rb', line 2 def category @category end |
#description ⇒ Object
Returns the value of attribute description.
2 3 4 |
# File 'lib/exercise.rb', line 2 def description @description end |
#muscle ⇒ Object
Returns the value of attribute muscle.
2 3 4 |
# File 'lib/exercise.rb', line 2 def muscle @muscle end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/exercise.rb', line 2 def name @name end |
#workout ⇒ Object
Returns the value of attribute workout.
2 3 4 |
# File 'lib/exercise.rb', line 2 def workout @workout end |
Class Method Details
.all ⇒ Object
13 14 15 |
# File 'lib/exercise.rb', line 13 def self.all @@all_exercises end |