{"id":15066822,"url":"https://github.com/yegor256/elapsed","last_synced_at":"2026-02-03T08:14:40.999Z","repository":{"id":253103712,"uuid":"842465605","full_name":"yegor256/elapsed","owner":"yegor256","description":"Ruby function to track the time elapsed by the execution of a block and print it to the log","archived":false,"fork":false,"pushed_at":"2026-01-28T03:06:28.000Z","size":207,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-01-31T16:04:51.021Z","etag":null,"topics":["logging","ruby","ruby-gem","time-lapse"],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/elapsed","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/yegor256.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-08-14T12:08:40.000Z","updated_at":"2026-01-28T03:06:02.000Z","dependencies_parsed_at":"2026-01-01T00:07:08.731Z","dependency_job_id":null,"html_url":"https://github.com/yegor256/elapsed","commit_stats":null,"previous_names":["yegor256/elapsed"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/yegor256/elapsed","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yegor256%2Felapsed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yegor256%2Felapsed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yegor256%2Felapsed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yegor256%2Felapsed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yegor256","download_url":"https://codeload.github.com/yegor256/elapsed/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yegor256%2Felapsed/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29038088,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-03T06:39:36.383Z","status":"ssl_error","status_checked_at":"2026-02-03T06:39:32.787Z","response_time":96,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["logging","ruby","ruby-gem","time-lapse"],"created_at":"2024-09-25T01:12:47.321Z","updated_at":"2026-02-03T08:14:40.976Z","avatar_url":"https://github.com/yegor256.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Measures the Time Elapsed by a Block\n\n[![DevOps By Rultor.com](https://www.rultor.com/b/yegor256/elapsed)](https://www.rultor.com/p/yegor256/elapsed)\n[![We recommend RubyMine](https://www.elegantobjects.org/rubymine.svg)](https://www.jetbrains.com/ruby/)\n\n[![rake](https://github.com/yegor256/elapsed/actions/workflows/rake.yml/badge.svg)](https://github.com/yegor256/elapsed/actions/workflows/rake.yml)\n[![PDD status](https://www.0pdd.com/svg?name=yegor256/elapsed)](https://www.0pdd.com/p?name=yegor256/elapsed)\n[![Gem Version](https://badge.fury.io/rb/elapsed.svg)](https://badge.fury.io/rb/elapsed)\n[![Test Coverage](https://img.shields.io/codecov/c/github/yegor256/elapsed.svg)](https://codecov.io/github/yegor256/elapsed?branch=master)\n[![Yard Docs](https://img.shields.io/badge/yard-docs-blue.svg)](https://rubydoc.info/github/yegor256/elapsed/master/frames)\n[![Hits-of-Code](https://hitsofcode.com/github/yegor256/elapsed)](https://hitsofcode.com/view/github/yegor256/elapsed)\n[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/yegor256/elapsed/blob/master/LICENSE.txt)\n\nHere is how you can measure and log the time of a block:\n\n```ruby\nrequire 'elapsed'\nelapsed do\n  run_something_slow\nend\n```\n\nYou can also send the log message to a log, for example to the\n[Loog](https://github.com/yegor256/loog):\n\n```ruby\nrequire 'elapsed'\nrequire 'loog'\nelapsed(Loog::VERBOSE) do\n  # any code\nend\n```\n\nYou can also make the message custom:\n\n```ruby\nelapsed(good: 'File saved') do\n  File.save(f, 'Hello, world!')\nend\n```\n\nOr, you can make the message even more custom:\n\n```ruby\nelapsed do\n  File.save(f, 'Hello, world!')\n  throw :\"Successfully saved #{File.size(f)} bytes\"\nend\n```\n\nYou can also filter out small durations using the `over:` parameter:\n\n```ruby\nelapsed(Loog::VERBOSE, over: 0.5) do\n  # This message will only be logged if the block takes more than 0.5 seconds\n  run_something_that_might_be_fast\nend\n```\n\nYou can change the level of logging\n(use `Logger::INFO`, `Logger::DEBUG`, or `Logger::ERROR`), while\nthe default one is `DEBUG`:\n\n```ruby\nelapsed(Loog::VERBOSE, level: Logger::DEBUG) do\n  # The procedure\nend\n```\n\nThat's it.\n\n## How to contribute\n\nRead\n[these guidelines](https://www.yegor256.com/2014/04/15/github-guidelines.html).\nMake sure your build is green before you contribute\nyour pull request. You will need to have\n[Ruby](https://www.ruby-lang.org/en/) 3.0+ and\n[Bundler](https://bundler.io/) installed. Then:\n\n```bash\nbundle update\nbundle exec rake\n```\n\nIf it's clean and you don't see any error messages, submit your pull request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyegor256%2Felapsed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyegor256%2Felapsed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyegor256%2Felapsed/lists"}