Skip to content

Releases: tilo/deprecate_soft

1.2.0

06 Apr 00:56
6d5beae

Choose a tag to compare

✨ Release Notes: v1.2.0

What's new in deprecate_soft v1.2.0

📝 DepracateSoft Change Log

[1.2.0] - 2025-04-05

✨ Added Support

  • improving handling of class methods
  • added deprecate_class_soft for class methods. Fixed Issue #1
  • support to define the method after the declaration

🛠️ Internals

  • stream-lined include DeprecateSoft

📐 Deliberate Limitations

  • Class methods need to be defined via def self.method, not in class << self blocks.
    Simply move the to-be-deprecated method out of the self << class and declare it via self.method_name.
    This also makes the

v1.1.0

30 Mar 00:07

Choose a tag to compare

✨ Release Notes: v1.1.0

What's new in deprecate_soft v1.1.0
✅ Features & Improvements

  • Double-wrap protection: Calling deprecate_soft multiple times on the same method no longer re-wraps it.

  • Hook failure isolation: If before_hook or after_hook raises, the original method still runs. Errors are logged to $stderr via Kernel.warn.

🧪 Test Suite Enhancements

  • Added coverage for corner cases:

    • Private methods (both instance and class-level).

    • before_hook and after_hook raising exceptions.

    • whendeprecate_soft is called (incorrectly) before method is defined

    • when deprecate_soft is called multiple times on the same method

  • Improved test robustness by capturing $stderr instead of mocking Kernel.warn.

🛠 Internal Cleanup

  • Simplified Initialization.
  • Used Kernel.warn directly to ensure compatibility with RSpec spies and Ruby internals.

v1.0.0

30 Mar 00:01

Choose a tag to compare

🎉 Initial Release: v1.0.0

Welcome to the first official release of deprecate_soft

A simple and non-intrusive way to ensure that methods you ear-marked for deletion are no longer used in production -- without impacting method execution.

This gem provides a lightweight mechanism to flag deprecated methods while continuing to execute them, enabling you to:

  • Notify developers or emit observability events when deprecated methods are called.

  • Configure custom hooks to log, alert, or track usage (e.g., in StatsD or DataDog).

  • Avoid breaking changes while gradually phasing out legacy code paths.

✨ Features

  • deprecate_soft method for both:

    • ✅ Instance methods (via include DeprecateSoft)

    • ✅ Class methods (via extend DeprecateSoft)

  • Customizable hooks:
    Safely wrap methods with an optional message.

    • DeprecateSoft.before_hook

    • DeprecateSoft.after_hook

  • Hook parameters:

    • method (fully qualified name)

    • message (deprecation reason)

    • args / result

  • Non-invasive: No exceptions raised, no dependencies added.

  • Naming isolation: Internally renames original methods to avoid collisions.

  • Support for soft-deprecating instance and class methods, as well as private methods.

  • Safe defaults: Skips wrapping if method isn’t yet defined.