Skip to content

Instantly share code, notes, and snippets.

@dLobatog
Created June 24, 2013 21:27

Revisions

  1. dLobatog created this gist Jun 24, 2013.
    18 changes: 18 additions & 0 deletions gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    is_weekday = lambda {|day_of_week, time| time.wday == day_of_week}.curry

    sunday = is_weekday[0]
    monday = is_weekday[1]
    tuesday = is_weekday[2]
    wednesday = is_weekday[3]
    thursday = is_weekday[4]
    friday = is_weekday[5]
    saturday = is_weekday[6]

    case Time.now
    when sunday
    puts "Day of rest"
    when monday, tuesday, wednesday, thursday, friday
    puts "Work"
    when saturday
    puts "chores"
    end