{"id":26437483,"url":"https://github.com/justincampbell/progress_printer","last_synced_at":"2025-03-18T08:29:55.722Z","repository":{"id":56888881,"uuid":"106864481","full_name":"justincampbell/progress_printer","owner":"justincampbell","description":"Ruby gem which logs the progress of an operation, with estimated completion time","archived":false,"fork":false,"pushed_at":"2023-02-07T19:45:09.000Z","size":22,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-18T16:18:24.359Z","etag":null,"topics":["gem","ruby"],"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/justincampbell.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-13T19:18:32.000Z","updated_at":"2023-02-07T19:46:47.000Z","dependencies_parsed_at":"2022-08-20T16:00:22.959Z","dependency_job_id":null,"html_url":"https://github.com/justincampbell/progress_printer","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justincampbell%2Fprogress_printer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justincampbell%2Fprogress_printer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justincampbell%2Fprogress_printer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justincampbell%2Fprogress_printer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/justincampbell","download_url":"https://codeload.github.com/justincampbell/progress_printer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244183834,"owners_count":20412109,"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":["gem","ruby"],"created_at":"2025-03-18T08:29:54.508Z","updated_at":"2025-03-18T08:29:55.713Z","avatar_url":"https://github.com/justincampbell.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ProgressPrinter [![Gem Version](https://badge.fury.io/rb/progress_printer.svg)](https://badge.fury.io/rb/progress_printer)\n\n\u003e Logs the progress of an operation, with estimated completion time.\n\n## Installation\n\nWhen using [Bundler](https://bundler.io), add this to your project's `Gemfile`:\n\n```ruby\ngem 'progress_printer'\n```\n\nOtherwise, install it with the `gem` command:\n\n\n```shell\n$ gem install progress_printer\n```\n\n### Already in a console?\n\nProgressPrinter is in a single file with no dependencies, so you're able to copy/paste the entire file into an `irb` session, and then immediately use `ProgressPrinter.new` (see below). The raw source to copy is available here:\n\n[https://raw.githubusercontent.com/justincampbell/progress_printer/master/lib/progress_printer.rb](https://raw.githubusercontent.com/justincampbell/progress_printer/master/lib/progress_printer.rb)\n\n## Usage\n\n### Basic Usage\n\nA `ProgressPrinter` must be created, started, and finished. Use `#increment` within your operation to increment the progress.\n\n```rb\nrequire 'progress_printer'\n\nprinter = ProgressPrinter.new(name: \"Counting\", total: 250)\nprinter.start\n250.times { sleep 0.05; printer.increment }\nprinter.finish\n```\n\nOutput:\n\n```\nCounting:   0/250   0% calculating...\nCounting: 100/250  40% ~8s\nCounting: 200/250  80% ~2s\nCounting: 250/250 100% 14s total\n```\n\nYou can also achieve the same results by using `.wrap` or `#wrap`:\n\n```rb\nProgressPrinter.wrap(name: \"Counting\", total: 250) do |progress|\n  250.times { sleep 0.05; progress.increment }\nend\n```\n\n```rb\nprinter = ProgressPrinter.new(name: \"Counting\", total: 250)\nprinter.wrap do |progress|\n  250.times { sleep 0.05; progress.increment }\nend\n```\n\n### Arguments\n\n* `total` - The total number of iterations expected. If this is omitted, estimated completion time will not be shown.\n* `name` - A string to display next to each printed line. This helps identify the current operation, or the specific progress printer if using multiple.\n* `every` (Default: `100`) - How many iterations should pass in between printing a line.\n* `out` (Default: `$stdout`) - An object responding to `#puts` for printing the progress to.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/justincampbell/progress_printer. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustincampbell%2Fprogress_printer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjustincampbell%2Fprogress_printer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustincampbell%2Fprogress_printer/lists"}