From 71fefe147475bb85c67de95fba8211385cfb0a79 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Thu, 30 Aug 2018 19:05:00 +0800 Subject: Properly implement prepending for Concern --- config/initializers/0_as_concern.rb | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) (limited to 'config') diff --git a/config/initializers/0_as_concern.rb b/config/initializers/0_as_concern.rb index 40232bd6252..ff132547225 100644 --- a/config/initializers/0_as_concern.rb +++ b/config/initializers/0_as_concern.rb @@ -1,25 +1,7 @@ -# This module is based on: https://gist.github.com/bcardarella/5735987 - -module Prependable - def prepend_features(base) - if base.instance_variable_defined?(:@_dependencies) - base.instance_variable_get(:@_dependencies) << self - false - else - return false if base < self - - super - base.singleton_class.send(:prepend, const_get('ClassMethods')) if const_defined?(:ClassMethods) - @_dependencies.each { |dep| base.send(:prepend, dep) } # rubocop:disable Gitlab/ModuleWithInstanceVariables - base.class_eval(&@_included_block) if instance_variable_defined?(:@_included_block) # rubocop:disable Gitlab/ModuleWithInstanceVariables - end - end -end +# frozen_string_literal: true module ActiveSupport module Concern - prepend Prependable - - alias_method :prepended, :included + prepend Gitlab::Patch::Prependable end end -- cgit v1.2.1