class TrainingSchedulerParser

Constants

COMMAND_MAP
DAYS_OF_THE_WEEK
PARSED

Week,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday,

Attributes

current_day[R]
input[R]

Public Class Methods

new(input) click to toggle source
# File lib/training_schedule_parser.rb, line 39
def initialize(input)
  @input = input
  current_time = Time.now.utc - 6 * 3600
  @current_day = current_time.to_date
end

Public Instance Methods

current_week() click to toggle source
# File lib/training_schedule_parser.rb, line 49
def current_week
  DAYS_OF_THE_WEEK.zip(get_week_data[1..7]).flatten.join(', ')
end
get_day_data() click to toggle source
# File lib/training_schedule_parser.rb, line 57
def get_day_data
  get_week_data[current_day.cwday]
end
get_week_data() click to toggle source
# File lib/training_schedule_parser.rb, line 53
def get_week_data
  PARSED.select{|r| r.first.strip.to_i == current_day.cweek}.flatten
end
perform() click to toggle source
# File lib/training_schedule_parser.rb, line 45
def perform
  self.send COMMAND_MAP[input].to_sym
end