G
Greg Weeks
The following code makes the meta-method "def_foo" available to any
class that inherits from Definer:
class Definer
def Definer.def_foo
def foo
17
end
end
end
# A TEST:
class User < Definer
def_foo
end
puts User.new.foo # prints 17
Is there a way to make meta-methods like "def_foo" available in class
definitions without using inheritance? Is there a standard way? Is it
pretty? (Or is it perhaps pointless?)
class that inherits from Definer:
class Definer
def Definer.def_foo
def foo
17
end
end
end
# A TEST:
class User < Definer
def_foo
end
puts User.new.foo # prints 17
Is there a way to make meta-methods like "def_foo" available in class
definitions without using inheritance? Is there a standard way? Is it
pretty? (Or is it perhaps pointless?)