News for hackers. Stuff that matters.
Re:Elixir-style pipelines in Ruby by bonquesha99 on Saturday December 10, 2022 @03:56PM (#33936704)
Check out this proof of concept gem to perform pipe operations in Ruby using block expressions:

https://github.com/lendinghome/pipe_operator#-pipe_operator

  "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

There are no comments on this comment yet.