{"id":20204567,"url":"https://github.com/wilsonsilva/safeword","last_synced_at":"2025-07-02T01:33:39.482Z","repository":{"id":56894166,"uuid":"78060860","full_name":"wilsonsilva/safeword","owner":"wilsonsilva","description":"A safeword, as used in sports, is a code word used by a player to avoid impending injury.","archived":false,"fork":false,"pushed_at":"2017-01-05T00:37:50.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-28T14:14:31.346Z","etag":null,"topics":["console","prevent","prevent-data-loss","ruby","ruby-gem","rubygem"],"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/wilsonsilva.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":"2017-01-04T23:18:21.000Z","updated_at":"2017-02-13T16:44:12.000Z","dependencies_parsed_at":"2022-08-21T01:20:18.741Z","dependency_job_id":null,"html_url":"https://github.com/wilsonsilva/safeword","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/wilsonsilva/safeword","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilsonsilva%2Fsafeword","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilsonsilva%2Fsafeword/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilsonsilva%2Fsafeword/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilsonsilva%2Fsafeword/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wilsonsilva","download_url":"https://codeload.github.com/wilsonsilva/safeword/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilsonsilva%2Fsafeword/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263060543,"owners_count":23407531,"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":["console","prevent","prevent-data-loss","ruby","ruby-gem","rubygem"],"created_at":"2024-11-14T05:13:55.611Z","updated_at":"2025-07-02T01:33:39.460Z","avatar_url":"https://github.com/wilsonsilva.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Safeword\n\n[![Build Status](https://travis-ci.org/wilsonsilva/safeword.svg?branch=master)](https://travis-ci.org/wilsonsilva/safeword)\n\nPrevents blocks of code from being executed until you consider them safe. Useful if you need to run untested code\nin the production console.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'safeword'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install safeword\n\n## Usage\n\nEvery new instance of Safeword is `enabled` by default. Enabled safewords prevent code from being executed.\nDisabled safewords allow it to be executed.\n\nTo enable, disable and verifying if a safeword is enabled, you can use `enable`, `disable`\nand `enabled?` respectively:\n\n```ruby\nrequire 'safeword'\n\nsafeword = Safeword.new\nsafeword.enabled? # =\u003e true\n\nsafeword.disable\nsafeword.enabled? # =\u003e false\n\nsafeword.enable\nsafeword.enabled? # =\u003e true\n```\n\n### Preventing code execution\n\nInstantiate a `Safeword` and pass your wrapped code in a block to its `use` method.\n\n```ruby\nrequire 'safeword'\n\nsafeword = Safeword.new\nsafeword.use { puts 'start war' } #=\u003e nothing happens\n```\n\n### Allowing code execution\nCall `#disable` on the safeword to allow subsequent calls to `use` to execute the provided code blocks:\n\n```ruby\nrequire 'safeword'\n\nsafeword = Safeword.new\nsafeword.disable\nsafeword.use { puts 'drop bomb' } #=\u003e drop bomb\n```\n\n### Instantiating a disabled safeword\nSafewords are enabled by default, but can be disabled during initialization:\n\n```ruby\nrequire 'safeword'\n\nsafe = Safeword.new\nsafe.enabled? #=\u003e true\n\nunsafe = Safeword.new(enabled: false)\nunsafe.enabled? #=\u003e false\n```\n\n### Chaining methods\n\nThe methods `enable`, `disable` and `use` return the word itself, so you can chain multiple calls together:\n\n```ruby\nrequire 'safeword'\n\nSafeword.new\n  .disable\n  .use { puts 'start war' } #=\u003e start war\n  .use { puts 'drop bomb' } #=\u003e drop bomb\n  .enable\n  .use { puts 'cut fruit' } #=\u003e nothing happens\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests.\nYou can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the\nversion number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version,\npush git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/wilsonsilva/safeword.\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%2Fwilsonsilva%2Fsafeword","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwilsonsilva%2Fsafeword","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilsonsilva%2Fsafeword/lists"}