{"id":15647251,"url":"https://github.com/rossta/loves-enumerable","last_synced_at":"2025-04-30T12:41:02.226Z","repository":{"id":66515666,"uuid":"45793989","full_name":"rossta/loves-enumerable","owner":"rossta","description":"Code samples for a presentation on the joy of Ruby Enumerable","archived":false,"fork":false,"pushed_at":"2016-04-14T15:43:56.000Z","size":5718,"stargazers_count":45,"open_issues_count":0,"forks_count":14,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-26T06:18:18.625Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rossta.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-11-08T18:52:26.000Z","updated_at":"2023-04-01T17:25:51.000Z","dependencies_parsed_at":"2023-02-20T19:46:10.935Z","dependency_job_id":null,"html_url":"https://github.com/rossta/loves-enumerable","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rossta%2Floves-enumerable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rossta%2Floves-enumerable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rossta%2Floves-enumerable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rossta%2Floves-enumerable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rossta","download_url":"https://codeload.github.com/rossta/loves-enumerable/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251701963,"owners_count":21629925,"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":[],"created_at":"2024-10-03T12:17:49.134Z","updated_at":"2025-04-30T12:41:02.197Z","avatar_url":"https://github.com/rossta.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Enumerable: How I fell in love with Ruby\n\nThis repository contains code snippets used in my presentation on Ruby's enumerable module. Ruby code was written to run on Ruby 2.2.\n\n[Enumerable presentation on Slidedeck](https://speakerdeck.com/rossta/enumerable-how-i-fell-in-love-with-ruby)\n\n\n## Usage\n\nTo run a sample, clone the repo and install the gems:\n\n```bash\n$ git clone https://github.com/rossta/loves-enumerable.git\n$ cd loves-enumerable\n$ bundle install\n```\n\nThen simply run the code with the ruby executable.\n\n```bash\n$ ruby code/pascals_triangle.rb\n```\n\nYou'll get the most out of this repo by inspecting the source along with following the presentation.\n\n## Main Points\n\nUse more of the Enumerable API\n- look for more direct solutions\n- read the docs\n\nLearn how Enumerable methods are implemented\n- it’s not magic\n- implement Enumerable on your own\n- create your own extensions\n\nEncapsulate complexity of enumerating\n- e.g. stream data to client,\n- deferred data fetching\n\nProvide Enumerators\n- for any method that returns an enumerable with a block:\n  return an enumerator when the block is missing\n\nWhen to be Lazy\n- for avoiding eager evaluation\n- for filtering results over large collection\n\nEmbrace the functional flavor\n- given the same inputs, you can expect the same results\n- use Enumerables like Legos: as building blocks\n\n## Resources\n\nMany of the ideas and examples are adapted from other great sources. Please\ncheck out the following to learn more.\n\n#### General\n\n* https://practicingruby.com/articles/building-enumerable-and-enumerator\n* http://www.sitepoint.com/guide-ruby-collections-iii-enumerable-enumerator/\n* http://jwb.io/20130114-building-sequences-with-enumerator.html\n* https://speakerdeck.com/jeg2/10-things-you-didnt-know-ruby-could-do\n* http://dgiim.github.io/blog/2015/08/24/ruby-enumerators/\n\n#### Lazy Enumerators\n\n* http://patshaughnessy.net/2013/4/3/ruby-2-0-works-hard-so-you-can-be-lazy\n* http://railsware.com/blog/2012/03/13/ruby-2-0-enumerablelazy/\n* http://blog.honeybadger.io/using-lazy-enumerators-to-work-with-large-files-in-ruby/\n* https://gist.github.com/barmstrong/1323865 # processing large csv\n* http://www.sitepoint.com/implementing-lazy-enumerables-in-ruby/\n\n#### Streaming\n\n* http://old.blog.phusion.nl/2014/08/03/why-rails-4-live-streaming-is-a-big-deal\n* http://www.sitepoint.com/streaming-with-rails-4/\n* http://smsohan.com/blog/2013/05/09/genereating-and-streaming-potentially-large-csv-files-using-ruby-on-rails\n\n#### Code\n\n* https://github.com/rubinius/rubinius/blob/master/kernel/common/enumerable.rb\n* https://github.com/rubinius/rubinius/blob/master/kernel/common/enumerator.rb\n* https://github.com/sferik/twitter/blob/master/lib/twitter/enumerable.rb\n* https://github.com/bbatsov/powerpack/tree/master/lib/powerpack/enumerable\n* https://github.com/rubyworks/facets\n\n#### Data sources\n\n* http://catalog.data.gov/dataset/college-scorecard\n* http://www.gutenberg.org\n\n#### Books\n\n* The Well-Grounded Rubyist by David Black\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frossta%2Floves-enumerable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frossta%2Floves-enumerable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frossta%2Floves-enumerable/lists"}