def date_of_next(wday, from = nil)
        from ||= Date.today

        from_wday = (from.wday + 1) % 6
        to_wday = (Date::DAYS_INTO_WEEK[wday.to_sym] + 1) % 7

        delta_in_days = from_wday - to_wday
        delta_in_days += 7 if delta_in_days <= 0

        from + delta_in_days
      end
def date_of_next(wday, from = nil)
        from ||= Date.today

        from_wday = (from.wday + 1) % 6
        to_wday = (Date::DAYS_INTO_WEEK[wday.to_sym] + 1) % 7

        delta_in_days = from_wday - to_wday
        delta_in_days += 7 if delta_in_days <= 0

        from + delta_in_days
      end
Get the next weekday from today or a specified date
 Example: date_of_next(:monday, Date.parse('2012-01-01')) => 2012-01-02