Actions
Bug #17559
closedConflict with BasicSocket#send and Object#send
    Bug #17559:
    Conflict with BasicSocket#send and Object#send
  
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux]
Description
Object#send can be used in most objects like:
's'.send :class
=> String
But BasicSocket objects call BasicSocket#send instead of Object#send:
TCPSocket('example.com', 'echo').send :class
Traceback (most recent call last):
	22: from /home/sergioro/.rvm/gems/ruby-2.7.0/bin/ruby_executable_hooks:24:in `<main>'
	21: from /home/sergioro/.rvm/gems/ruby-2.7.0/bin/ruby_executable_hooks:24:in `eval'
	20: from /home/sergioro/.rvm/gems/ruby-2.7.0/bin/irb:23:in `<main>'
	19: from /home/sergioro/.rvm/gems/ruby-2.7.0/bin/irb:23:in `load'
	18: from /home/sergioro/.rvm/gems/ruby-2.7.0/gems/irb-1.3.1/exe/irb:11:in `<top (required)>'
	 1: from (irb):5:in `<main>'
(irb):5:in `send': wrong number of arguments (given 1, expected 2..3) (ArgumentError)
How to call Object#send from a BasicSocket object?
Expected result:
TCPSocket('example.com', 'echo').send :class
=> TCPSocket
Actions