Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-12-25 13:20:50 +0300
committerLin Jen-Shin <godfat@godfat.org>2017-12-26 12:18:10 +0300
commit8139895b4362817cf947431fab9c95ce223b87ae (patch)
tree3419ad5cdde44bad709024a886c523f57e7b4881 /doc/development/ee_features.md
parent29749f92b7f86d45af41509262601e47ee848d92 (diff)
Use `Gitlab::Utils::Override` over defined?(super)
Diffstat (limited to 'doc/development/ee_features.md')
-rw-r--r--doc/development/ee_features.md17
1 files changed, 10 insertions, 7 deletions
diff --git a/doc/development/ee_features.md b/doc/development/ee_features.md
index 1af839a27e1..b4b5b47c099 100644
--- a/doc/development/ee_features.md
+++ b/doc/development/ee_features.md
@@ -87,9 +87,9 @@ still having access the class's implementation with `super`.
There are a few gotchas with it:
-- you should always add a `raise NotImplementedError unless defined?(super)`
- guard clause in the "overrider" method to ensure that if the method gets
- renamed in CE, the EE override won't be silently forgotten.
+- you should always `extend ::Gitlab::Utils::Override` and use `override` to
+ guard the "overrider" method to ensure that if the method gets renamed in
+ CE, the EE override won't be silently forgotten.
- when the "overrider" would add a line in the middle of the CE
implementation, you should refactor the CE method and split it in
smaller methods. Or create a "hook" method that is empty in CE,
@@ -134,6 +134,9 @@ There are a few gotchas with it:
guards:
``` ruby
module EE::Base
+ extend ::Gitlab::Utils::Override
+
+ override :do_something
def do_something
# Follow the above pattern to call super and extend it
end
@@ -174,10 +177,11 @@ implementation:
```ruby
module EE
- class ApplicationController
- def after_sign_out_path_for(resource)
- raise NotImplementedError unless defined?(super)
+ module ApplicationController
+ extend ::Gitlab::Utils::Override
+ override :after_sign_out_path_for
+ def after_sign_out_path_for(resource)
if Gitlab::Geo.secondary?
Gitlab::Geo.primary_node.oauth_logout_url(@geo_logout_state)
else
@@ -209,7 +213,6 @@ In EE, the implementation `ee/app/models/ee/users.rb` would be:
```ruby
def full_private_access?
- raise NotImplementedError unless defined?(super)
super || auditor?
end
```