I get it's easy to confuse, but this post is about the "then" method in the Kernel module, not the keyword "then", which is entirely different.
An article about it really ought to get this right but it manages to call it a keyword in the headline, but then method in the very next line.
That it then calls it currying makes things worse. If you want to curry something in Ruby, you'd use Proc#curry.
At the end the article says "then" (the method) "seems identical" to the "yield_self" method. This is because it is - it's an alias. "yield_self" was introduced in 2.5, "then" was introduced as an alias in 2.6.
aeonflux · 13h ago
Hey man, you should really put some effort into formatting the code samples, as they are awful to read.
graypegg · 13h ago
I'm not the author, but if you wanted them to see that you could post it on the article's comments section
I get it's easy to confuse, but this post is about the "then" method in the Kernel module, not the keyword "then", which is entirely different.
An article about it really ought to get this right but it manages to call it a keyword in the headline, but then method in the very next line.
That it then calls it currying makes things worse. If you want to curry something in Ruby, you'd use Proc#curry.
At the end the article says "then" (the method) "seems identical" to the "yield_self" method. This is because it is - it's an alias. "yield_self" was introduced in 2.5, "then" was introduced as an alias in 2.6.