Elixir/Unix style pipe operations in Ruby ↦
This is a proof of concept, but oh what a concept! I freakin’ 💚 Elixir’s pipe operator, hope they’ll add it to JavaScript, and would trade half my kingdom to have it in Ruby.
"https://api.github.com/repos/ruby/ruby".pipe do
URI.parse
Net::HTTP.get
JSON.parse.fetch("stargazers_count")
yield_self { |n| "Ruby has #{n} stars" }
Kernel.puts
end
#=> Ruby has 15120 stars
Discussion
Sign in or Join to comment or subscribe