Skip to content

Instantly share code, notes, and snippets.

@sandro
Created January 14, 2009 05:31
Show Gist options
  • Save sandro/46799 to your computer and use it in GitHub Desktop.
Save sandro/46799 to your computer and use it in GitHub Desktop.
class C
def self.hi
puts 'hi'
end
end
class A
def self.inherited(sub)
eval("::#{sub} = Class.new(C)")
end
end
class B < A
end
B.hi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment