Sha256: 382cc84f7f9062fbd0839f4e9512d5c2a05a58b0e871725054813b41956d4c09
Contents?: true
Size: 1.36 KB
Versions: 6
Compression:
Stored size: 1.36 KB
Contents
Deprecation ------------ [![Build Status](https://travis-ci.org/cbeer/deprecation.png?branch=master)](https://travis-ci.org/cbeer/deprecation) Provide deprecation warnings for code ## Add warnings ```ruby class DeprecatedModule extend Deprecation self.deprecation_horizon = 'my_gem version 3.0.0' def asdf end deprecation_deprecate :asdf def custom_deprecation *args Deprecation.warn(DeprecatedModule, "don't do that!") if args.length < 15 end end DeprecatedModule.new.asdf DEPRECATION WARNING: asdf is deprecated and will be removed from my_gem version 3.0.0. (called from irb_binding at (irb):18) => nil ``` ## Silence warnings ```ruby def silence_asdf_warning Deprecation.silence(DeprecationModule) do asdf end end ``` ## Reporting ```ruby Deprecation.default_deprecation_behavior = :stderr # the default Deprecation.default_deprecation_behavior = :log # put deprecation warnings into the Rails / ActiveSupport log DeprecationModule.debug = true # put the full callstack in the logged message Deprecation.default_deprecation_behavior = :notify # use ActiveSupport::Notifications to log the message Deprecation.default_deprecation_behavior = :raise # Raise an exception when using deprecated behavior Deprecation.default_deprecation_behavior = :silence # ignore all deprecations ```
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
deprecation-0.99.0 | README.md |
deprecation-1.0.0 | README.md |
deprecation-0.2.2 | README.md |
deprecation-0.2.1 | README.md |
deprecation-0.2.0 | README.md |
deprecation-0.1.0 | README.md |