Skip to content

Instantly share code, notes, and snippets.

@siefca
Created April 9, 2009 18:27
Show Gist options
  • Save siefca/92650 to your computer and use it in GitHub Desktop.
Save siefca/92650 to your computer and use it in GitHub Desktop.
def self.attr_inheritable(*variables)
variables.each do |v|
module_eval %{
def self.#{v}
@#{v} = superclass.#{v} if !instance_variable_defined?(:@#{v}) && superclass.respond_to?(:#{v})
return @#{v}
end
}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment