Issue #18246 has been updated by jeremyevans0 (Jeremy Evans).

Status changed from Open to Closed

The method you are looking for is `!` and not `!@`.  The reason `false.send(:!@)` works is that `:!@` is parsed as `:!`, that's why the unquoted version works but the quoted version does not.  This was determined to be a feature and not a bug in #10463.

----------------------------------------
Bug #18246: send does not work for unary ! operator when operator isn't a literal symbol
https://bugs.ruby-lang.org/issues/18246#change-94066

* Author: chucke (Tiago Cardoso)
* Status: Closed
* Priority: Normal
* ruby -v: 3.0.2
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
```ruby
1.send(:+, 1) #=> 2
1.send(:"+", 1) #=> 2
1.send(:-@) #=> -1
1.send(:"-@") #=> -1
false.send(:!@) #=> true
false.send(:"!@") #> 
# undefined method `!@' for false:FalseClass (NoMethodError)
# Did you mean?  !=
               !~
```



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>