Skip to content

Instantly share code, notes, and snippets.

@brixen
Created August 27, 2009 00:48
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 brixen/175985 to your computer and use it in GitHub Desktop.
Save brixen/175985 to your computer and use it in GitHub Desktop.
sup = Class.new do
def a; "a"; end
def b; "b"; end
end
sub = Class.new(sup) do
[:a, :b].each do |name|
define_method name do
super()
end
end
end
sub.new.a.should == "a"
sub.new.b.should == "b"
sub.new.a.should == "a"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment