{"id":15591171,"url":"https://github.com/hopsoft/pipe_envy","last_synced_at":"2025-06-18T06:35:33.537Z","repository":{"id":56888112,"uuid":"98687111","full_name":"hopsoft/pipe_envy","owner":"hopsoft","description":"Elixir style pipe operator for Ruby","archived":false,"fork":false,"pushed_at":"2017-08-02T03:33:44.000Z","size":17,"stargazers_count":47,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-28T10:25:26.629Z","etag":null,"topics":["data-transformation","elixir","ruby"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hopsoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-28T20:46:32.000Z","updated_at":"2024-11-09T16:35:03.000Z","dependencies_parsed_at":"2022-08-21T00:50:44.134Z","dependency_job_id":null,"html_url":"https://github.com/hopsoft/pipe_envy","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hopsoft%2Fpipe_envy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hopsoft%2Fpipe_envy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hopsoft%2Fpipe_envy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hopsoft%2Fpipe_envy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hopsoft","download_url":"https://codeload.github.com/hopsoft/pipe_envy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251293430,"owners_count":21566097,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-transformation","elixir","ruby"],"created_at":"2024-10-02T23:40:28.976Z","updated_at":"2025-04-28T10:25:34.347Z","avatar_url":"https://github.com/hopsoft.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Lines of Code](http://img.shields.io/badge/lines_of_code-30-brightgreen.svg?style=flat)](http://blog.codinghorror.com/the-best-code-is-no-code-at-all/)\n[![Code Status](http://img.shields.io/codeclimate/github/hopsoft/pipe_envy.svg?style=flat)](https://codeclimate.com/github/hopsoft/pipe_envy)\n[![Dependency Status](http://img.shields.io/gemnasium/hopsoft/pipe_envy.svg?style=flat)](https://gemnasium.com/hopsoft/pipe_envy)\n[![Build Status](http://img.shields.io/travis/hopsoft/pipe_envy.svg?style=flat)](https://travis-ci.org/hopsoft/pipe_envy)\n[![Coverage Status](https://img.shields.io/coveralls/hopsoft/pipe_envy.svg?style=flat)](https://coveralls.io/r/hopsoft/pipe_envy?branch=master)\n[![Downloads](http://img.shields.io/gem/dt/pipe_envy.svg?style=flat)](http://rubygems.org/gems/pipe_envy)\n\n[![Sponsor](https://app.codesponsor.io/embed/QMSjMHrtPhvfmCnk5Hbikhhr/hopsoft/pipe_envy.svg)](https://app.codesponsor.io/link/QMSjMHrtPhvfmCnk5Hbikhhr/hopsoft/pipe_envy)\n\n# PipeEnvy\n\n## WARNING\n\nThis lib is experimental \u0026 is probably not a good idea.\n\n\u003e PipeEnvy overrides the pipe operator `|` on Array \u0026 Integer.\n\u003e It also adds it to Object.\n\n## Fun Stuff\n\n[Elixir's pipe operator](https://elixir-lang.org/getting-started/enumerables-and-streams.html#the-pipe-operator)\nis very cool \u0026 supports intuitive reasoning about data transformations similar to [Unix pipelines](https://en.wikipedia.org/wiki/Pipeline_(Unix)).\n\n```elixir\n\"Elixir Rocks\" |\u003e String.upcase |\u003e String.split # =\u003e [\"ELIXIR\", \"ROCKS\"]\n```\n\nRubyists can now enjoy this same mental model of data transformation.\n\n```sh\ngem install pipe_envy\n```\n\n```ruby\nrequire \"pipe_envy\"\n\n# refinements that apply extensions to Object, Array, \u0026 Integer in the current scope\nusing PipeEnvy\n\n\"Ruby Rocks\" | :upcase | :split # =\u003e [\"RUBY\", \"ROCKS\"]\n```\n\nHere's a more sophisticated albeit contrived example.\n*Notice that methods which require arguments are piped as Arrays.*\n\n```ruby\nmagic = (1..100) \\\n  | :to_a \\\n  | [:select!, -\u003e (i) { i.even? }] \\\n  | [:map, -\u003e (i) { i ** 10 }] \\\n  | :sum \\\n  | Math.method(:sqrt) \\\n  | :to_s \\\n  | :chars \\\n  | :reverse \\\n  | [:[], 3] \\\n  | :to_i\n\n# =\u003e 7\n```\n\nBe sure to check out [Chainable Methods](https://github.com/akitaonrails/chainable_methods) which offers similar behavior.\n\nHere's another example similar to the one on the `chainable_methods` repo.\n\n```ruby\nmagic = \"foo bar http://github.com/hopsoft/pipe_envy foo bar\" \\\n  | URI.method(:extract) \\\n  | :first \\\n  | URI.method(:parse) \\\n  | :open \\\n  | :readlines \\\n  | :join \\\n  | Nokogiri::HTML.method(:parse) \\\n  | [:css, \"h1\"] \\\n  | :first \\\n  | :text \\\n  | :strip\n\n# =\u003e \"hopsoft/pipe_envy\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhopsoft%2Fpipe_envy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhopsoft%2Fpipe_envy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhopsoft%2Fpipe_envy/lists"}