Skip to content

Instantly share code, notes, and snippets.

@wrgoldstein
Created February 25, 2015 15:18
Show Gist options
  • Save wrgoldstein/d3642e847d401cd3efa9 to your computer and use it in GitHub Desktop.
Save wrgoldstein/d3642e847d401cd3efa9 to your computer and use it in GitHub Desktop.
require 'active_support/concern'
module A
extend ActiveSupport::Concern
module ClassMethods
@@a = 2
def a
@@a
end
end
end
class C
include A
end
C.a
#=> 2
Hash[C.ancestors.map { |c| [c, c.class_variables] }]
#=>{C=>[], A=>[], Object=>[], Kernel=>[], BasicObject=>[]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment