Project

General

Profile

Bug #17559

Updated by nobu (Nobuyoshi Nakada) almost 4 years ago

`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 
 ```

Back