Skip to content

Instantly share code, notes, and snippets.

@nossidge
Last active July 3, 2020 15:30
Show Gist options
  • Save nossidge/3b4fe19528ec053ef532e3c9ecd418c2 to your computer and use it in GitHub Desktop.
Save nossidge/3b4fe19528ec053ef532e3c9ecd418c2 to your computer and use it in GitHub Desktop.
require 'active_support/all'
require 'ice_cube'
start_time = Time.parse('09:00')
end_time = Time.parse('17:00')
puts start_time
puts end_time
icecube = IceCube::Schedule.new(start_time, end_time: end_time)
icecube.add_recurrence_rule IceCube::Rule.weekly.day(:sunday, :tuesday)
puts icecube
mongo_field = icecube.to_yaml
puts mongo_field
icecube_from_field = IceCube::Schedule.from_yaml(mongo_field)
puts icecube_from_field
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment