Skip to content

Instantly share code, notes, and snippets.

@richmolj
Last active December 18, 2015 19:19
Show Gist options
  • Save richmolj/5832031 to your computer and use it in GitHub Desktop.
Save richmolj/5832031 to your computer and use it in GitHub Desktop.
# This example is pretty overkill, just illustrating the concept
module Delayable
def delay(attribute, opts)
# maybe we do additional timing stuff here, like UTC
send("#{attribute}=", opts[:by].from_now)
end
end
class Post
include Delayable
def publish
delay :published_at, :by => 24.hours
save
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment