Skip to content

Instantly share code, notes, and snippets.

@aostrega
Created April 23, 2014 17:53
Show Gist options
  • Save aostrega/11225999 to your computer and use it in GitHub Desktop.
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/
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