Using `yield_self` for composable ActiveRecord relations ↦
Derek Prior on Ruby 2.5’s yield_self
method and how it can be compared to Elixir’s (and soon JavaScript’s?) pipe operator.
I write Ruby daily, but I had no idea yield_self
was a thing. In this post, Derek takes us through a real-world use case for it. I agree that the final code is more readable than where it started. Good stuff 👌
Discussion
Sign in or Join to comment or subscribe