debian-mirror-gitlab/config/initializers/0_inject_enterprise_edition_module.rb

27 lines
577 B
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
require 'active_support/inflector'
module InjectEnterpriseEditionModule
2019-12-04 20:38:33 +05:30
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
2019-10-12 21:52:04 +05:30
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)