-
-
Save elektronaut/b94de7076d591315d54b to your computer and use it in GitHub Desktop.
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
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