Ruby - Metaprogramming Fundamentals
Given this Ruby class, what will obj.respond_to?(:handle_event) return?
class EventHandler
def respond_to_missing?(method_name, include_private = false)
method_name.to_s.end_with?("_event")
end
def method_missing(method_name, *args)
"Handled #{method_name}" if respond_to_missing?(method_name)
end
end
obj = EventHandler.new