|
1require 'active_support/deprecation'
|
|
|
|
3module DeprecatedAttributes
|
|
4 extend ActiveSupport::Concern
|
|
|
|
|
- DuplicateMethodCall - calls 'caller_locations(0)' 3 times » reek
- DuplicateMethodCall - calls 'caller_locations(0).map(&:to_s)' 3 times » reek
- DuplicateMethodCall - calls 'caller_locations(0).map(&:to_s).reject' 3 times » reek
- DuplicateMethodCall - calls 'caller_locations(0).map(&:to_s).reject{ |path| path =~ /deprecated_attributes\.rb/ }' 3 times » reek
- DuplicateMethodCall - calls 'path =~ /deprecated_attributes\.rb/' 3 times » reek
- DuplicateMethodCall - calls 'self.class' 3 times » reek
- DuplicateMethodCall - calls 'self.class.name' 3 times » reek
- NestedIterators - contains iterators nested 2 deep » reek
- NestedIterators - contains iterators nested 3 deep » reek
- TooManyStatements - has approx 16 statements » reek
- Complexity 8 » saikuro
|
7 def deprecate_attribute(*names)
|
|
|
|
9 define_method(:"#{name}") do
|
|
10 callstack = caller_locations(0).map(&:to_s).reject{ |path| path =~ /deprecated_attributes\.rb/ }
|
|
11 ActiveSupport::Deprecation.warn("#{self.class.name}##{name} is deprecated and will be removed", callstack)
|
|
|
|
|
|
|
|
15 define_method(:"#{name}=") do |value|
|
|
16 callstack = caller_locations(0).map(&:to_s).reject{ |path| path =~ /deprecated_attributes\.rb/ }
|
|
17 ActiveSupport::Deprecation.warn("#{self.class.name}##{name}= is deprecated and will be removed", callstack)
|
|
|
|
|
|
|
|
21 define_method(:"#{name}?") do
|
|
22 callstack = caller_locations(0).map(&:to_s).reject{ |path| path =~ /deprecated_attributes\.rb/ }
|
|
23 ActiveSupport::Deprecation.warn("#{self.class.name}##{name}? is deprecated and will be removed", callstack)
|
|
|
|
|
|
|
|
|
|
|
|
|