Ich habe einen Anwendungsfall, wo ich class A
haben, die module B
umfasst.Anrufverfahren enthalten Modul aus der Klasse
class A
include B
def do_one_thing
# override module's method. do something different instead
end
def do_another_thing
# Call `do_one_thing` from here,
# but call the module's method, not the one I overrode above.
end
end
module B
included do
def do_one_thing
# ...
end
end
# some other methods
end
Wie oben gezeigt, ich rufe do_one_thing
von do_another_thing
. Mein Problem ist, dass ich das Modul des Verfahrens (das heißt die super
-Methode) nennen. Ist das in Rails möglich?
Mögliche Duplikat [Rubin Schlüsselwort super] 'speichern' können (http://stackoverflow.com/questions/2597643/ruby-super-keyword) – Hamms