We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d10881e commit 647cc21Copy full SHA for 647cc21
test/net/imap/fake_server/command_router.rb
@@ -10,7 +10,9 @@ module Routable
10
def on(*command_names, &handler)
11
scope = self.is_a?(Module) ? self : singleton_class
12
command_names.each do |command_name|
13
- scope.define_method("handle_#{command_name.downcase}", &handler)
+ method_name = :"handle_#{command_name.downcase}"
14
+ scope.undef_method(method_name) if scope.method_defined?(method_name)
15
+ scope.define_method(method_name, &handler)
16
end
17
18
0 commit comments