require 'active_support/deprecation'
module DeprecatedAttributes - DeprecatedAttributes has no descriptive comment
extend ActiveSupport::Concern
class_methods do
def deprecate_attribute(*names) - DeprecatedAttributes#deprecate_attribute has a flog score of 72
- DeprecatedAttributes#deprecate_attribute has approx 16 statements
names.each do |name|
define_method(:"#{name}") do
callstack = caller_locations(0).map(&:to_s).reject{ |path| path =~ /deprecated_attributes\.rb/ } -
-
-
-
-
-
-
ActiveSupport::Deprecation.warn("#{self.class.name}##{name} is deprecated and will be removed", callstack) -
-
super()
end
define_method(:"#{name}=") do |value|
callstack = caller_locations(0).map(&:to_s).reject{ |path| path =~ /deprecated_attributes\.rb/ } -
-
-
-
-
- DeprecatedAttributes#deprecate_attribute contains iterators nested 3 deep
ActiveSupport::Deprecation.warn("#{self.class.name}##{name}= is deprecated and will be removed", callstack) -
-
super(value)
end
define_method(:"#{name}?") do
callstack = caller_locations(0).map(&:to_s).reject{ |path| path =~ /deprecated_attributes\.rb/ } -
-
-
-
-
-
-
ActiveSupport::Deprecation.warn("#{self.class.name}##{name}? is deprecated and will be removed", callstack)
super()
end
end
end
end
end