Created
April 23, 2014 17:53
-
-
Save aostrega/11225999 to your computer and use it in GitHub Desktop.
Alternative approach to super-overridable dynamic methods in http://thepugautomatic.com/2013/07/dsom/
This file contains 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
class SomeORM | |
module DynamicAttributes; end | |
include DynamicAttributes | |
def self.attributes(*names) | |
names.each do |name| | |
DynamicAttributes.module_eval do | |
define_method(name) do | |
# Stuff | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment