Skip to content

Instantly share code, notes, and snippets.

@rthbound
Forked from seejohnrun/9_to_5.rb
Created December 27, 2016 21:36
Show Gist options
  • Save rthbound/d9f4e49279914f8fa568222be13acdbe to your computer and use it in GitHub Desktop.
Save rthbound/d9f4e49279914f8fa568222be13acdbe to your computer and use it in GitHub Desktop.
ice_cube 9-5
s = IceCube::Schedule.new(Time.now, :duration => 3600 * 7)
s.add_recurrence_rule IceCube::Rule.daily.day(:monday, :tuesday, :wednesday, :thursday, :friday).hour_of_day(9)
s.occurring_at?(Time.new(2011, 5, 30, 10, 0, 0)) # true, monday at 10am
s.occurring_at?(Time.new(2011, 5, 29, 10, 0, 0)) # false, sunday at 10am
s.occurring_at?(Time.new(2011, 5, 30, 8, 0, 0)) # false, monday at 8am
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment