Skip to content

Instantly share code, notes, and snippets.

@elektronaut
Created June 22, 2012 20:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elektronaut/b94de7076d591315d54b to your computer and use it in GitHub Desktop.
Save elektronaut/b94de7076d591315d54b to your computer and use it in GitHub Desktop.
module IncludeAttr
def self.included(klass)
klass.instance_eval do
class << self
attr_accessor :random_attribute
end
end
end
end
# and then i have this somewhere:
class RandomClass
include IncludeAttr
end
# if i do something like:
RandomClass.random_attribute = 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment