Last active
December 31, 2015 20:49
-
-
Save davidbalbert/8042981 to your computer and use it in GitHub Desktop.
A bad idea
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
module CreatedAt | |
module ClassMixin | |
def new(*) | |
obj = super | |
obj.instance_variable_set(:@_created_at, Time.now) | |
obj | |
end | |
end | |
module ObjectMixin | |
def created_at | |
@_created_at | |
end | |
end | |
end | |
class Class | |
prepend CreatedAt::ClassMixin | |
end | |
class Object | |
include CreatedAt::ObjectMixin | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment