{"id":21186773,"url":"https://github.com/emmanuelaaron/enumerables","last_synced_at":"2025-03-14T20:18:38.750Z","repository":{"id":97963660,"uuid":"260512887","full_name":"Emmanuelaaron/Enumerables","owner":"Emmanuelaaron","description":"My own version of Ruby Enumerable methods","archived":false,"fork":false,"pushed_at":"2020-05-11T07:25:28.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-01-21T13:06:53.309Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/Emmanuelaaron.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":"2020-05-01T17:01:51.000Z","updated_at":"2020-05-11T07:25:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"52800970-47d4-4981-b899-8ae9223cd7e7","html_url":"https://github.com/Emmanuelaaron/Enumerables","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/Emmanuelaaron%2FEnumerables","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Emmanuelaaron%2FEnumerables/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Emmanuelaaron%2FEnumerables/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Emmanuelaaron%2FEnumerables/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Emmanuelaaron","download_url":"https://codeload.github.com/Emmanuelaaron/Enumerables/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243639558,"owners_count":20323511,"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-11-20T18:26:09.495Z","updated_at":"2025-03-14T20:18:38.728Z","avatar_url":"https://github.com/Emmanuelaaron.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Advanced Building Blocks - Enumerable Methods\n\u003e In this project, I implemented my own version of Ruby's enumerable methods. I created them in a way that they  return the same results as the original when they are called.\nBelow are the methods implemented\n- each\n- each_with_index\n- select\n- all?\n- any?\n- none?\n- count\n- map\n- inject\n## Built With\n\n- Ruby\n\n## Getting Started\n- Clone this repo on your local machine\n- Run the command `bundle install` in your terminal\n- Insert the lines below any where in your main.rb file to text the methods\n```\nhash = Hash.new\n%w(cat dog wombat).my_each_with_index { |item, index|\n  hash[item] = index\n}\np hash \n\np [1,2,3,4,5].my_select { |num|  num.even?  }  \n\np %w[ant bear cat].my_all? { |word| word.length \u003e= 3 } #=\u003e true\np %w[ant bear cat].my_all? { |word| word.length \u003e= 4 } #=\u003e false\np %w[ant bear cat].my_all?(/t/)                        #=\u003e false\np [1, 2i, 3.14].my_all?(Numeric)                       #=\u003e true\np [nil, true, 99].my_all?                              #=\u003e false\np [].my_all?                                           #=\u003e true\n\np %w[ant bear cat].my_any? { |word| word.length \u003e= 3 } #=\u003e true\np %w[ant bear cat].my_any? { |word| word.length \u003e= 4 } #=\u003e true\np %w[ant bear cat].my_any?(/d/)                        #=\u003e false\np [nil, true, 99].my_any?(Integer)                     #=\u003e true\np [nil, true, 99].my_any?                              #=\u003e true\np [].my_any?                                           #=\u003e false\n\np %w{ant bear cat}.my_none? { |word| word.length == 5 } #=\u003e true\np %w{ant bear cat}.my_none? { |word| word.length \u003e= 4 } #=\u003e false\np %w{ant bear cat}.my_none?(/d/)                        #=\u003e true\np [1, 3.14, 42].my_none?(Float)                         #=\u003e false\np [].my_none?                                           #=\u003e true\np [nil].my_none?                                        #=\u003e true\np [nil, false].my_none?                                 #=\u003e true\np [nil, false, true].my_none?                           #=\u003e false\n\nary = [1, 2, 4, 2]\np ary.my_count               #=\u003e 4\np ary.my_count(2)            #=\u003e 2\np ary.my_count{ |x| x%2==0 } #=\u003e 3\n\np (1..4).my_map { |i| i*i }      #=\u003e [1, 4, 9, 16]\np (1..4).my_map { \"cat\"  }   #=\u003e [\"cat\", \"cat\", \"cat\", \"cat\"]\n\np (5..10).my_inject(:+)                             #=\u003e 45\np (5..10).my_inject { |sum, n| sum + n }            #=\u003e 45\np (5..10).my_inject(1, :*)                          #=\u003e 151200\np (5..10).my_inject(1) { |product, n| product * n } #=\u003e 151200\nlongest = %w{ cat sheeps bear }.my_inject do |memo, word|\n   memo.length \u003e word.length ? memo : word\nend\np longest                                        #=\u003e \"sheeps\"\n\np multiply_els([2,4,5]) #=\u003e 40\n\n```\n\n### Prerequisites\nTo make this repository working in your local machine you need [ruby](https://rubyinstaller.org/) installed.\n\n## Authors\n\n👤 **Emmanuel Isabirye**\n\n- Github: [@EmmanuelAaron](https://github.com/Emmanuelaaron)\n- Twitter: [@EmmanuelAaron](https://twitter.com/EmmanuelIsabir1)\n- Linkedin: [@EmmanuelAaron](https://www.linkedin.com/in/fullstackwebdev-emma/)\n\n## 🤝 Contributing\n\nContributions, issues and feature requests are welcome!\n\nFeel free to check the [issues page](https://github.com/Emmanuelaaron/Enumerables/issues).\n\n## Show your support\n\nGive a ⭐️ if you like this project!\n\n## Acknowledgments\n\n- Great Thanks to [Guilherme Recordon](https://github.com/guirecordon)  for the support given during the execution of this project\n\n## 📝 License\n\nThis project is [MIT](lic.url) licensed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femmanuelaaron%2Fenumerables","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femmanuelaaron%2Fenumerables","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femmanuelaaron%2Fenumerables/lists"}