de-conflict autoextend const_added method
refs AE-855 Change-Id: Ib2f622aaf0fbbc703e33888890cdd2a1b2cb90f3 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/343689 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Isaac Moore <isaac.moore@instructure.com> Reviewed-by: Jacob Burroughs <jburroughs@instructure.com> QA-Review: Aaron Ogata <aogata@instructure.com> Product-Review: Aaron Ogata <aogata@instructure.com>
This commit is contained in:
parent
91751a3b7a
commit
e39a1f7ba3
|
@ -2,4 +2,4 @@
|
|||
|
||||
# to deal with any lingering references (e.g. jobs, plugins)
|
||||
UserObserver = UserObservationLink
|
||||
Autoextend.const_added("UserObserver", source: :inherited)
|
||||
Autoextend.ae_const_added("UserObserver", source: :inherited)
|
||||
|
|
|
@ -22,7 +22,7 @@ require_relative "autoextend/railtie" if defined?(Rails::Railtie)
|
|||
|
||||
module Autoextend
|
||||
class << self
|
||||
def const_added(const, source:, recursive: false)
|
||||
def ae_const_added(const, source:, recursive: false)
|
||||
const_name = const.is_a?(String) ? const : const.name
|
||||
return [] unless const_name
|
||||
|
||||
|
@ -44,7 +44,7 @@ module Autoextend
|
|||
child_const = const.const_get(child, false)
|
||||
next unless child_const.is_a?(Module)
|
||||
|
||||
const_added(child_const, source:, recursive: true)
|
||||
ae_const_added(child_const, source:, recursive: true)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -144,7 +144,7 @@ module Autoextend
|
|||
loader.on_load do |_cpath, value, _abspath|
|
||||
next unless value.is_a?(Module)
|
||||
|
||||
Autoextend.const_added(value, source: :Zeitwerk, recursive: true)
|
||||
Autoextend.ae_const_added(value, source: :Zeitwerk, recursive: true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -184,7 +184,7 @@ end
|
|||
|
||||
module Autoextend::ClassMethods
|
||||
def inherited(klass)
|
||||
Autoextend.const_added(klass, source: :inherited)
|
||||
Autoextend.ae_const_added(klass, source: :inherited)
|
||||
super
|
||||
end
|
||||
end
|
||||
|
@ -193,14 +193,14 @@ end
|
|||
# only when it gets included into a class.
|
||||
module Autoextend::ModuleMethods
|
||||
def prepended(klass)
|
||||
Autoextend.const_added(self, source: :prepended).each do |extension|
|
||||
Autoextend.ae_const_added(self, source: :prepended).each do |extension|
|
||||
extension.extend(klass, source: :prepended)
|
||||
end
|
||||
super
|
||||
end
|
||||
|
||||
def included(klass)
|
||||
Autoextend.const_added(self, source: :included).each do |extension|
|
||||
Autoextend.ae_const_added(self, source: :included).each do |extension|
|
||||
extension.extend(klass, source: :included)
|
||||
end
|
||||
super
|
||||
|
|
Loading…
Reference in New Issue