F
Farrel Lifson
Is it possible to mix in a module method to become a class method? I'd
like to define the method_added method in a module and then mix it
into a class like so
module Foo
def self.method_added(method)
puts "Added #{method}"
end
end
class Bar
include Foo
def bar
end
def baz
end
end
So that I get
Added bar
Added baz
printed out. Is there any way to do this besides making Foo a class
and subclassing Foo from it?
Farrel
like to define the method_added method in a module and then mix it
into a class like so
module Foo
def self.method_added(method)
puts "Added #{method}"
end
end
class Bar
include Foo
def bar
end
def baz
end
end
So that I get
Added bar
Added baz
printed out. Is there any way to do this besides making Foo a class
and subclassing Foo from it?
Farrel