Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 超级在这里是什么意思?_Ruby - Fatal编程技术网

Ruby 超级在这里是什么意思?

Ruby 超级在这里是什么意思?,ruby,Ruby,我知道如果在Ruby中使用super,就意味着调用父级的相同方法 但在一些代码中,我看到: def self.post(*args); handle_response super end 我想知道super在这里是什么意思?super调用超类方法;因此super返回超类方法返回的内容 这里,调用在超类上定义的post方法,并将其返回值传递给handle\u response方法 super调用超类方法;因此super返回超类方法返回的内容 这里,调用在超类上定义的post方法,并将其返回值传递

我知道如果在Ruby中使用super,就意味着调用父级的相同方法

但在一些代码中,我看到:

def self.post(*args); handle_response super end

我想知道super在这里是什么意思?

super
调用超类方法;因此
super
返回超类方法返回的内容


这里,调用在超类上定义的
post
方法,并将其返回值传递给
handle\u response
方法

super
调用超类方法;因此
super
返回超类方法返回的内容

这里,调用在超类上定义的
post
方法,并将其返回值传递给
handle\u response
方法