Given the following module,
module Foo
def bar
:baz
end
end
def send_to_foo(method)
# ...?
end
send_to_foo(:bar) # => :baz
What code should go in send_to_foo
to make the last line work as expected? (send_to_foo
is obviously not how I would implement this; it just makes clearer what I'm looking for.)
I expected Foo.send(:bar)
to work at first, but it makes sense that it doesn't. It would if the method were defined as def self.bar
, but that's no fun.