Skip to content

Commit

Permalink
Merge pull request #1077 from BobbyMcWho/deprecate-changes
Browse files Browse the repository at this point in the history
Remove the intermediate variable
  • Loading branch information
technoweenie committed Nov 14, 2019
2 parents 8332622 + 5099ebc commit b499d4f
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions lib/faraday/deprecate.rb
Expand Up @@ -8,22 +8,18 @@ module Faraday
# @see Faraday::Deprecate
module DeprecatedClass
def self.proxy_class(origclass, ver = '1.0')
metaclass = nil
proxyclass = Class.new(origclass) do
metaclass = class << self
proxy = Class.new(origclass) do
class << self
extend Faraday::Deprecate

def ===(other)
other.is_a?(superclass) || super
end

self
end
end

metaclass.send(:deprecate, :new, "#{origclass}.new", ver)
metaclass.send(:deprecate, :inherited, origclass.name, ver)
proxyclass
proxy.singleton_class.send(:deprecate, :new, "#{origclass}.new", ver)
proxy.singleton_class.send(:deprecate, :inherited, origclass.name, ver)
proxy
end
end

Expand Down

0 comments on commit b499d4f

Please sign in to comment.