Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create faraday deprecation class #1054

Merged

Conversation

BobbyMcWho
Copy link
Contributor

Description

This implementation warns in stderr similar to Gem::Deprecate, but gives a semver instead of a date like the default Gem::Deprecate does.

require 'faraday/deprecate'

class SomeFaradayClass
  # deprecate instance method
  extend Faraday::Deprecate

  def old_method; end
  deprecate :old_method, :new_method, '1.0.0'

  def new_method; end

  class << self
    # when deprecating a class method, you must extend from within the eigenclass
    extend Faraday::Deprecate

    def old_class_method; end
    deprecate :old_class_method, :new_class_method, '1.0.0'

    def new_class_method; end
  end
end

Relates to #1052 #1043

This implementation warns
in stderr similar to Gem::Deprecate, but gives a semver instead of
a date like the default Gem::Deprecate does.
@technoweenie technoweenie mentioned this pull request Oct 17, 2019
4 tasks
Copy link
Member

@technoweenie technoweenie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, and takes care of the Error class stuff that I wanted to backport in #1052.

# usage about deprecation.
# @see Faraday::Deprecate
module DeprecatedClass
def self.proxy_class(new_klass)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should accept a version argument so we can proxy deprecated classes beyond 1.0. Probably not necessary for this PR on the 0.1x branch, but definitely once this gets ported to master.

@technoweenie technoweenie merged commit a4e9bc2 into lostisland:0.1x Oct 17, 2019
This was referenced Oct 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants