Last active
December 18, 2015 19:19
-
-
Save richmolj/5832031 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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