Class: Exercise

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

Overview

exercise belongs to a category

Constant Summary collapse

@@all_exercises =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeExercise

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

#categoryObject

Returns the value of attribute category.



2
3
4
# File 'lib/exercise.rb', line 2

def category
  @category
end

#descriptionObject

Returns the value of attribute description.



2
3
4
# File 'lib/exercise.rb', line 2

def description
  @description
end

#muscleObject

Returns the value of attribute muscle.



2
3
4
# File 'lib/exercise.rb', line 2

def muscle
  @muscle
end

#nameObject

Returns the value of attribute name.



2
3
4
# File 'lib/exercise.rb', line 2

def name
  @name
end

#workoutObject

Returns the value of attribute workout.



2
3
4
# File 'lib/exercise.rb', line 2

def workout
  @workout
end

Class Method Details

.allObject



13
14
15
# File 'lib/exercise.rb', line 13

def self.all
    @@all_exercises
end