Issue #15921 has been updated by duerst (Martin D=FCrst).


For me, the main use case is at the end of method chains. Instead of e.g.
```
Word =3D Struct.new(:text, :count)
words =3D $stdin.read
        .scan(/[-\w']+/)
        .group_by(&:downcase)
        .collect { |key, value| Word.new(key, value.count) }
        .sort_by { |w| [-w.text.length, w.text] }
```
we can now write
```
$stdin.read
      .scan(/[-\w']+/)
      .group_by(&:downcase)
      .collect { |key, value| Word.new(key, value.count) }
      .sort_by { |w| [-w.text.length, w.text] } =3D> words
```
where the order of the code pieces aligns with the order of what's happenin=
g, and there's no need to go back with your eyes.

(This is an example of a problem given to students, they have to count word=
s in a text and output them in a specific order. It's from a C programming =
class where I show them after the submission deadline that it's much easier=
 and shorter in Ruby.)

I'm not sure if having the assignment on the following line is possible (se=
e below), but I think it should be. I'll submit a feature request if it is =
not yet possible.
```
$stdin.read
      .scan(/[-\w']+/)
      .group_by(&:downcase)
      .collect { |key, value| Word.new(key, value.count) }
      .sort_by { |w| [-w.text.length, w.text] }
=3D> words
```


----------------------------------------
Feature #15921: R-assign (rightward-assignment) operator
https://bugs.ruby-lang.org/issues/15921#change-85365

* Author: nobu (Nobuyoshi Nakada)
* Status: Closed
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
----------------------------------------
From https://bugs.ruby-lang.org/issues/15799#change-78465, proposal of the =
rightward-assignment operator by `=3D>`.

```
$ ./ruby -v -e '(1..).lazy.map {|x| x*2} =3D> x' -e 'p x.first(10)'
ruby 2.7.0dev (2019-06-12T06:32:32Z feature/rassgn-assoc c928f06b79) [x86_6=
4-darwin18]
last_commit=3DRightward-assign by ASSOC
[2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
```

https://github.com/nobu/ruby/tree/feature/rassgn-assoc



-- =

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

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