Module: Martlet::DayConversions
- Included in:
- CalendarHelpers, ScheduleParser
- Defined in:
- lib/martlet/day_conversions.rb
Instance Method Summary collapse
Instance Method Details
#day_from_letter(letter) ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/martlet/day_conversions.rb', line 3 def day_from_letter(letter) case letter.upcase when 'M' then 'Monday' when 'T' then 'Tuesday' when 'W' then 'Wednesday' when 'R' then 'Thursday' when 'F' then 'Friday' else letter end end |
#number_from_day(day) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/martlet/day_conversions.rb', line 25 def number_from_day(day) case day.capitalize when 'M', 'Monday' then 1 when 'T', 'Tuesday' then 2 when 'W', 'Wednesday' then 3 when 'R', 'Thursday' then 4 when 'F', 'Friday' then 5 end end |
#short_day_name(day) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/martlet/day_conversions.rb', line 14 def short_day_name(day) case day.capitalize when 'M', 'Monday' then 'Mon' when 'T', 'Tuesday' then 'Tue' when 'W', 'Wednesday' then 'Wed' when 'R', 'Thursday' then 'Thu' when 'F', 'Friday' then 'Fri' else day end end |