diff options
author | Yusuke Endoh <mame@ruby-lang.org> | 2020-01-09 08:21:42 +0900 |
---|---|---|
committer | Yusuke Endoh <mame@ruby-lang.org> | 2020-01-09 08:21:42 +0900 |
commit | 65c2c75e162ebc8c4b35b0823967eeb132c00749 (patch) | |
tree | 8a03da42b1d58cffb3bf599234f46abb96bd8ced /lib | |
parent | 1d09acd82bc90c0794c0409e330ecc71a912d1b3 (diff) | |
download | ruby-65c2c75e162ebc8c4b35b0823967eeb132c00749.tar.gz |
lib/net/imap.rb: use `&blk` instead of Kernel#proc with no block
[Bug #16488]
Diffstat (limited to 'lib')
-rw-r--r-- | lib/net/imap.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/net/imap.rb b/lib/net/imap.rb index aa46e47ef1..720acbc86d 100644 --- a/lib/net/imap.rb +++ b/lib/net/imap.rb @@ -903,8 +903,9 @@ module Net # end # } # - def add_response_handler(handler = Proc.new) - @response_handlers.push(handler) + def add_response_handler(handler = nil, &block) + raise ArgumentError, "two Procs are passed" if handler && block + @response_handlers.push(block || handler) end # Removes the response handler. @@ -959,7 +960,7 @@ module Net put_string("#{tag} IDLE#{CRLF}") begin - add_response_handler(response_handler) + add_response_handler(&response_handler) @idle_done_cond = new_cond @idle_done_cond.wait(timeout) @idle_done_cond = nil @@ -1267,7 +1268,7 @@ module Net @logout_command_tag = tag end if block - add_response_handler(block) + add_response_handler(&block) end begin return get_tagged_response(tag, cmd) |