{"id":21429983,"url":"https://github.com/mblumtritt/deprecations","last_synced_at":"2025-07-14T11:31:03.491Z","repository":{"id":18059192,"uuid":"21117218","full_name":"mblumtritt/deprecations","owner":"mblumtritt","description":"Deprecation support for your project.","archived":false,"fork":false,"pushed_at":"2023-12-22T14:30:57.000Z","size":55,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-23T13:46:46.515Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mblumtritt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-06-23T07:14:47.000Z","updated_at":"2021-11-26T19:46:16.000Z","dependencies_parsed_at":"2022-09-02T11:01:48.645Z","dependency_job_id":null,"html_url":"https://github.com/mblumtritt/deprecations","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mblumtritt%2Fdeprecations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mblumtritt%2Fdeprecations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mblumtritt%2Fdeprecations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mblumtritt%2Fdeprecations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mblumtritt","download_url":"https://codeload.github.com/mblumtritt/deprecations/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225971933,"owners_count":17553564,"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":"2024-11-22T22:19:59.669Z","updated_at":"2025-07-14T11:31:03.483Z","avatar_url":"https://github.com/mblumtritt.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deprecations\n\nThis gem provides transparent declaration of deprecated methods and classes. It's easy, small, has no dependencies and no overhead.\n\n## Installation\n\nThe simplest way to install Deprecations gem is to use [Bundler](http://gembundler.com/).\n\nAdd Deprecations to your `Gemfile`:\n\n```ruby\ngem 'deprecations'\n```\n\nand install it by running Bundler:\n\n```shell\n$ bundle add deprecations\n```\n\nTo install the gem globally use:\n\n```shell\n$ gem install deprecations\n```\n\n## Usage\n\nAfter adding the gem to your project\n\n```ruby\nrequire 'deprecations'\n```\n\nyou can specify which methods and classes are deprecated. To mark a method as deprecated is quite easy:\n\n```ruby\nclass MySample\n  def clear\n    # something here\n  end\n\n  def clean\n    clear\n  end\n\n  deprecated :clean, :clear, 'next version'\nend\n```\n\nWhenever the method `MySample#clean` is called this warning appears:\n\n\u003e warning: `MySample#clean` is deprecated and will be outdated next version. Please use `MySample#clear` instead.\n\nMarking a complete class as deprecated will present the deprecation warning whenever this class is instantiated:\n\n```ruby\nclass MySample\n  deprecated!\n\n  # some more code here...\nend\n```\n\nYou can change the behavior of notifying:\n\n```ruby\nDeprecations.behavior = :raise\n```\n\nThere are 3 pre-defined behaviors:\n\n- `:raise` will raise an `Deprecations::Exception` when a deprecated method is called\n- `:silence` will do nothing (ignore the deprecation)\n- `:warn` will print a warning (default behavior)\n- `:deprecated` will print a warning when Ruby's warning category 'deprecated' is enabled\n\nBesides this you can implement your own:\n\n```ruby\nDeprecations.behavior =\n  proc do |subject, _alternative, _outdated|\n    SuperLogger.warning \"deprecated: #{subject}\"\n  end\n```\n\nAny object responding to `#call` will be accepted as a valid handler.\n\nWhenever you need to temporary change the standard behavior (like e.g. in your specs) you can do this like\n\n```ruby\nDeprecations.with_behavior(:silent) { MyDeprecatedClass.new.do_some_magic }\n```\n\nPlease have a look at the [specs](https://github.com/mblumtritt/deprecations/blob/master/spec/deprecations_spec.rb) for detailed information and more samples.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmblumtritt%2Fdeprecations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmblumtritt%2Fdeprecations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmblumtritt%2Fdeprecations/lists"}