{"id":15775382,"url":"https://github.com/styd/sleep2","last_synced_at":"2025-06-14T16:32:55.316Z","repository":{"id":59155910,"uuid":"83867087","full_name":"styd/sleep2","owner":"styd","description":"Ruby sleep 😴 with extra magical stuff.","archived":false,"fork":false,"pushed_at":"2017-10-25T07:33:35.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-11T17:04:23.548Z","etag":null,"topics":["gem","ruby","sleep"],"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/styd.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-03-04T05:17:48.000Z","updated_at":"2017-09-28T06:50:03.000Z","dependencies_parsed_at":"2022-09-13T17:52:10.928Z","dependency_job_id":null,"html_url":"https://github.com/styd/sleep2","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/styd/sleep2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styd%2Fsleep2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styd%2Fsleep2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styd%2Fsleep2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styd%2Fsleep2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/styd","download_url":"https://codeload.github.com/styd/sleep2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styd%2Fsleep2/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259845506,"owners_count":22920759,"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","sleep"],"created_at":"2024-10-04T17:00:45.395Z","updated_at":"2025-06-14T16:32:55.275Z","avatar_url":"https://github.com/styd.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sleep2 [![Build Status](https://travis-ci.org/styd/sleep2.svg?branch=master)](https://travis-ci.org/styd/sleep2)\n\nRuby sleep with extra magical stuff. These extra stuff will be useful when you\nare developing an algorithm with some kind of delay patterns such as in\nanimation.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'sleep2'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install sleep2\n\n## Usage\n\nDon't forget to `require 'sleep2'` first.\n\n### Do math with sleep.\n\n```ruby\n\u003e\u003e sleep = Sleep2[2] # no sleep when instantiating\n#=\u003e #\u003cSleep2:0x2afc2eaef970\u003e\n\u003e\u003e sleep # sleeps for 2 seconds\n#=\u003e #\u003cSleep2:0x2afc2eaef970\u003e\n\u003e\u003e delay = sleep * 2 # instantiate new sleep object (therefore no sleeping yet)\n#=\u003e #\u003cSleep2:0x2afc217b09d0\u003e\n\u003e\u003e delay # sleeps twice longer than sleep\n#=\u003e #\u003cSleep2:0x2afc217b09d0\u003e\n```\n\n### Compare sleep with integer (in seconds) or another of its type\n\n```ruby\n\u003e\u003e sleep if sleep \u003e 3 # not sleeping at all since sleep duration is 2 seconds\n#=\u003e nil\n\u003e\u003e delay = Sleep2[3] # no sleep when instantiating\n#=\u003e #\u003cSleep2:0x2afc2eb138c0\u003e\n\u003e\u003e delay \u003e sleep ? delay : sleep # sleeps for 3 seconds\n#=\u003e #\u003cSleep2:0x2afc2eb138c0\u003e\n```\n\n### Change current instance duration\n\n```ruby\n\u003e\u003e freeze = Sleep2[3] # no sleep when instantiating\n#=\u003e #\u003cSleep2:0x2afc2262c2c0\u003e\n\u003e\u003e freeze[4] # no sleep when changing duration\n#=\u003e 4.0\n\u003e\u003e freeze # sleeps for 4 seconds\n#=\u003e #\u003cSleep2:0x2afc2262c2c0\u003e\n```\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/styd/sleep2. 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\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstyd%2Fsleep2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstyd%2Fsleep2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstyd%2Fsleep2/lists"}