You need to sign in or sign up before continuing.
Guideline for overriding CE methods doesn't make sense
The docs (development/ee_features.md) read:
- 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.
What seems to be proposed is code that looks like:
module EE::SomeClass
def some_method
raise NotImplementedError unless defined?(super)
super
...
end
end
This doesn't help the situation described in the docs, since without the guard, super
would still raise a NoMethodError
- and presumably if CE renames a method they'll rename the call sites as well, so this check will go completely ignored.
I'd propose a solution with a custom module, say EE::Extension
:
module EE::SomeClass
include EE::Extension
override :some_method
def some_method
super ...
end
# or if we want to be really ~clever~
override def some_method
super
...
end
end
And have the module check statically for the presense of the methods it's marked to override. (say, base.instance_methods - Object.instance_methods
).