Ruby 2.7.0-preview1 has introduced the method reference operator .: as an experimental feature. (more here and here).
There are some abstract examples available for how to use this new operator:
method = 42.:to_s => #<Method: Integer#to_s> method.receiver => 42 method.name => :to_s method.call => "42" and:
method = File.:read => #<Method: File.read> method.call('/Users/foo/.zshrc') => "export ZSH=$HOME/.zsh" These abstract examples are not representative of real-world implementations. What is the plain-English explanation of the purpose and use of the method reference operator, defined in terms of practical and real-world examples?
Update
This question is not very useful because the method reference operator was removed from Ruby 2.7.0 before release. This question is left up for historical reasons.
#methodclearly saving keystrokes in stuff like[1,42].reject(&42.:==)self-explaining, I doubt we could be of any help here.#itself, safe navigation&., now this. It’s all about saving keystrokes; that simple. Just new alias [with a same not overridable semantics as__call__] for#method.