Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
1e7dc472
Commit
1e7dc472
authored
Dec 13, 2016
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Document a new gotcha when using `prepend`
[ci skip] Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
2a17a63b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
doc/development/ee_features.md
doc/development/ee_features.md
+8
-2
No files found.
doc/development/ee_features.md
View file @
1e7dc472
...
...
@@ -158,10 +158,16 @@ There are two ways for overriding a method that's defined in CE:
The
`prepend`
method should always be preferred but 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.
-
when the override would add a line in the middle of the CE implementation,
guard clause in 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,
it usually means that you'd better refactor the method to split it in
smaller methods that can be more easily and automatically overriden.
-
when the original implementation contains a guard clause (e.g.
`return unless condition`
), it doesn't return from the overriden method (it's
actually the same behavior as with method overridding via inheritance). In
this case, it's usually better to create a "hook" method that is empty in CE,
and with the EE-specific implementation in EE
-
sometimes for one-liner methods that don't change often it can be more
pragmatic to just change the method in place since conflicts resolution
should be trivial in this case. Use your best judgement!
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment