ruby super keyword
Posted
by ash34
on Stack Overflow
See other posts from Stack Overflow
or by ash34
Published on 2010-04-08T04:49:46Z
Indexed on
2010/04/08
4:53 UTC
Read the original article
Hit count: 796
Hi,
From what I understand, 'super' keyword invokes a method with the same name as the current method in the superclass of the current class. Below in the autoload method, there is a call to 'super'. I would like to know in which superclass I would find a method with the same name or what does the call to 'super' do
module ActiveSupport
module Autoload
...
def autoload(const_name, path = @@at_path)
full = [self.name, @@under_path, const_name.to_s, path].compact.join("::")
location = path || Inflector.underscore(full)
if @@eager_autoload
@@autoloads[const_name] = location
end
super const_name, location
end
....
end
end
module ActiveRecord
extend ActiveSupport::Autoload
...
autoload :TestCase
autoload :TestFixtures, 'active_record/fixtures'
end
This code is from the rails master branch. Thanks much.
© Stack Overflow or respective owner