75353242e2
(cherry picked from commit 897a9d308db46b620b738b98f2b0e5630ac7d2dd)
26 lines
577 B
Ruby
26 lines
577 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'active_support/inflector'
|
|
|
|
module InjectEnterpriseEditionModule
|
|
def prepend_if_ee(constant, with_descendants: false)
|
|
return unless Gitlab.ee?
|
|
|
|
ee_module = constant.constantize
|
|
prepend(ee_module)
|
|
|
|
if with_descendants
|
|
descendants.each { |descendant| descendant.prepend(ee_module) }
|
|
end
|
|
end
|
|
|
|
def extend_if_ee(constant)
|
|
extend(constant.constantize) if Gitlab.ee?
|
|
end
|
|
|
|
def include_if_ee(constant)
|
|
include(constant.constantize) if Gitlab.ee?
|
|
end
|
|
end
|
|
|
|
Module.prepend(InjectEnterpriseEditionModule)
|