Workout log

Ruby code posted by Ahmed
created at 05 Oct 01:54

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
class WorkoutLog
  attr_accessor :name, :current_weight,:date, :gym, :duration, :muscle_group
  attr_reader :total_exersises
  def initialize(name, current_weight, date, gym, duration, muscle_group)
    @name = name
    @current_weight = current_weight
    @date = date
    @gym = gym
    @duration = duration
    @muscle_group = muscle_group
    @total_exersises = []
  end

   def add_exersise(*exersise)
    @total_exersises << exersise
    end
  def rate_workout
    case @duration
    when (0..15)
      puts "Woah what was that? no pain no gain remember? that was a short one"
    when (16..30)
      puts "Not bad but there's plenty of room for improvement"
    when (30..90)
      puts "That was a good duration."
    when (90..120)
      puts "There's a good chance you're over training."
    when (120..Float::INFINITY)
      puts "LEAVE THE GYM NOW!"
    else
      puts "that wasn't a valid number"
    end
  end
end
962 Bytes in 2 ms with coderay