DEV Community

loading...

Discussion on: Ruby 2.7: The Pipeline Operator

Collapse
3limin4t0r profile image
3limin4t0r • Edited

Overall a pretty informative post. However I would like to add that:

5.then(&double).then(&double).then(&increment).then(&double)
Enter fullscreen mode Exit fullscreen mode

Could also be written as:

5.then(&double >> double >> increment >> double)
Enter fullscreen mode Exit fullscreen mode
Collapse
jleblanc profile image
Josh LeBlanc

I have never seen this kind of ruby before. That's very interesting.

Collapse
3limin4t0r profile image
3limin4t0r

The reason you might not have seen it. Is because the composition operators (>> and <<) are introduced in Ruby 2.6.0 and are still fairly new.