{"id":30855619,"url":"https://github.com/twilightcoders/deprecate","last_synced_at":"2025-09-07T11:09:23.634Z","repository":{"id":311388383,"uuid":"1043541962","full_name":"TwilightCoders/deprecate","owner":"TwilightCoders","description":"Easily maintain your codebase by exposing an easy and concise way to mark methods as deprecated.","archived":false,"fork":false,"pushed_at":"2025-08-24T06:52:30.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-24T13:14:43.474Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/TwilightCoders.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}},"created_at":"2025-08-24T04:46:50.000Z","updated_at":"2025-08-24T06:52:33.000Z","dependencies_parsed_at":"2025-08-24T13:16:52.186Z","dependency_job_id":"44cbef23-60c5-4b8d-a4ef-6143ebbeb08e","html_url":"https://github.com/TwilightCoders/deprecate","commit_stats":null,"previous_names":["twilightcoders/deprecate"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/TwilightCoders/deprecate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TwilightCoders%2Fdeprecate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TwilightCoders%2Fdeprecate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TwilightCoders%2Fdeprecate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TwilightCoders%2Fdeprecate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TwilightCoders","download_url":"https://codeload.github.com/TwilightCoders/deprecate/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TwilightCoders%2Fdeprecate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274026718,"owners_count":25209740,"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","status":"online","status_checked_at":"2025-09-07T02:00:09.463Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2025-09-07T11:09:12.996Z","updated_at":"2025-09-07T11:09:23.622Z","avatar_url":"https://github.com/TwilightCoders.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deprecate\n\n[![CI](https://github.com/twilightcoders/deprecate/actions/workflows/ci.yml/badge.svg)](https://github.com/twilightcoders/deprecate/actions/workflows/ci.yml)\n[![Gem Version](https://badge.fury.io/rb/deprecate.svg)](https://badge.fury.io/rb/deprecate)\n[![Code Coverage](https://qlty.sh/gh/TwilightCoders/projects/deprecate/coverage.svg)](https://qlty.sh/gh/TwilightCoders/projects/deprecate)\n[![Maintainability](https://qlty.sh/gh/TwilightCoders/projects/deprecate/maintainability.svg)](https://qlty.sh/gh/TwilightCoders/projects/deprecate)\n\nEasily maintain your codebase by exposing an easy and concise way to mark methods as deprecated.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'deprecate'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install deprecate\n\n## Usage\n\n### Basic Usage\n\nSimply call `deprecate` with the method name you want to deprecate:\n\n```ruby\nclass MyClass\n  def old_method\n    \"This method still works but is deprecated\"\n  end\n  \n  def new_method\n    \"This is the new way\"\n  end\n  \n  # Mark old_method as deprecated and suggest new_method\n  deprecate :old_method, :new_method\nend\n\nobj = MyClass.new\nobj.old_method  # Works but prints deprecation warning\n# =\u003e DEPRECATION WARNING: old_method is deprecated (use new_method instead). Called from example.rb:15\n```\n\n### Without Replacement Suggestion\n\n```ruby\nclass MyClass\n  def legacy_method\n    \"Going away soon\"\n  end\n  \n  # Mark as deprecated without suggesting replacement\n  deprecate :legacy_method\nend\n\nobj = MyClass.new\nobj.legacy_method  # Prints: DEPRECATION WARNING: legacy_method is deprecated. Called from example.rb:10\n```\n\n### Configuration\n\nConfigure deprecation behavior globally:\n\n```ruby\nDeprecate.configure do |config|\n  config[:output_stream] = File.open('deprecations.log', 'a')  # Log to file instead of stderr\n  config[:message_format] = \"WARNING: %{method} is deprecated%{replacement}\"  # Custom message format\n  config[:show_caller] = false  # Don't show caller location\n  config[:warn_once] = false    # Warn every time, not just once per method\nend\n```\n\n### Configuration Options\n\n- **`:output_stream`** - Where to send warnings (default: `$stderr`)\n- **`:message_format`** - Message template with `%{method}`, `%{replacement}`, `%{caller}` placeholders\n- **`:show_caller`** - Include caller location in warnings (default: `true`)\n- **`:warn_once`** - Only warn once per deprecated method (default: `true`)\n\n### Resetting Warnings\n\nClear the \"warned once\" tracking to see warnings again:\n\n```ruby\nDeprecate.reset_warnings!\n```\n\n### Method Visibility\n\nThe gem preserves the original method's visibility (public, protected, private):\n\n```ruby\nclass MyClass\n  private\n  \n  def secret_method\n    \"private stuff\"\n  end\n  \n  deprecate :secret_method\n  \n  public\n  \n  def call_secret\n    secret_method  # This works and shows deprecation warning\n  end\nend\n\nobj = MyClass.new\nobj.call_secret      # Works\nobj.secret_method    # Still raises NoMethodError (method remains private)\n```\n\n## Contributing\n\n1. Fork it ( https://github.com/twilightcoders/deprecate/fork )\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 a new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwilightcoders%2Fdeprecate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftwilightcoders%2Fdeprecate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwilightcoders%2Fdeprecate/lists"}