Sha256: fcb0aaa8ba47249d32ab1fabe3700a33e4351bd90b034b2b9105e77fef7181bd
Contents?: true
Size: 1.42 KB
Versions: 2
Compression:
Stored size: 1.42 KB
Contents
require 'active_support/core_ext/module/aliasing' require 'active_support/core_ext/array/extract_options' module Deprecation # Declare that a method has been deprecated. def self.deprecate_methods(target_module, *method_names) options = method_names.extract_options! method_names += options.keys generated_deprecation_methods = Module.new method_names.each do |method_name| if RUBY_VERSION < '3' generated_deprecation_methods.module_eval(<<-end_eval, __FILE__, __LINE__ + 1) def #{method_name}(*args, &block) Deprecation.warn(#{target_module.to_s}, Deprecation.deprecated_method_warning(#{target_module.to_s}, :#{method_name}, #{options[method_name].inspect}), caller ) super end pass_keywords(:#{method_name}) if respond_to?(:pass_keywords, true) end_eval else generated_deprecation_methods.module_eval(<<-end_eval, __FILE__, __LINE__ + 1) def #{method_name}(*args, **kwargs, &block) Deprecation.warn(#{target_module.to_s}, Deprecation.deprecated_method_warning(#{target_module.to_s}, :#{method_name}, #{options[method_name].inspect}), caller ) super end end_eval end end target_module.prepend generated_deprecation_methods end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
blacklight-spotlight-3.6.0.beta8 | vendor/bundle/ruby/3.2.0/gems/deprecation-1.1.0/lib/deprecation/method_wrappers.rb |
deprecation-1.1.0 | lib/deprecation/method_wrappers.rb |