{"id":19186853,"url":"https://github.com/dougeverly/hopper","last_synced_at":"2025-05-08T01:25:31.892Z","repository":{"id":14163429,"uuid":"16869384","full_name":"DougEverly/hopper","owner":"DougEverly","description":"Hopper accumulates items and executes a block of code when its capacity is reached, or the timeout is reached, whichever event occurs first.","archived":false,"fork":false,"pushed_at":"2014-12-11T22:02:05.000Z","size":104,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-15T05:48:49.441Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DougEverly.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":"2014-02-15T19:00:01.000Z","updated_at":"2015-03-27T16:18:00.000Z","dependencies_parsed_at":"2022-07-08T06:41:08.214Z","dependency_job_id":null,"html_url":"https://github.com/DougEverly/hopper","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/DougEverly%2Fhopper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DougEverly%2Fhopper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DougEverly%2Fhopper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DougEverly%2Fhopper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DougEverly","download_url":"https://codeload.github.com/DougEverly/hopper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252980170,"owners_count":21835179,"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-09T11:16:56.688Z","updated_at":"2025-05-08T01:25:31.858Z","avatar_url":"https://github.com/DougEverly.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hopper\n\n*Hopper* (noun): A storage container used to collect granular materials designed to easily dispense these materials through the use of gravity. (http://en.wikipedia.org/wiki/Hopper)\n\n**Hopper** accumulates items and executes a block of code when its capacity is reached, or the timeout is reached, whichever event occurs first.\n\n**Hopper** is useful for collecting a certain number of items before processing them, whilst not blocking too long if the capacity is not reached.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem 'hopper'\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install hopper\n\n## Usage\n\n\nCreate a hopper:\n\n    h = Hopper.new capacity: 28, timeout: 1 do |items, timed_out|\n      puts \"I have #{items.size} items\"\n      puts \"I timed out\" if timed_out\n    end\n\nAdd items to the hopper:\n\n    h \u003c\u003c 'an item'\n\nTo run the block even when there are no items present:\n\n    h = Hopper.new capacity: 28, timeout: 1 do |items, timed_out|\n      puts \"I have #{items.size} items\"\n      puts \"I timed out\" if timed_out\n    end\n    \nTo stop the hopper:\n\n    h.stop\n    \nHopper raises an exception if an item is added to the hopper while its not running.\n    \n    \n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdougeverly%2Fhopper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdougeverly%2Fhopper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdougeverly%2Fhopper/lists"}