rspec 示例中的接收器是什么?
What's the receiver in an rspec example?
在 https://github.com/cloudfoundry/cloud_controller_ng/blob/aacfd8/spec/unit/controllers/runtime/apps_controller_spec.rb#L17 中,例如,我想确定如何解析 "get" 方法。我知道的最快方法是转储 receiver.method(:get).source_location,但我不知道这里的接收器是什么。
您无需明确指定您发送的任何不合格消息的接收者,因为它是隐含的 self
。因此,在您的情况下,method(:get)
会告诉您 who/what 实现了发送到 self
的 get
方法。
在 https://github.com/cloudfoundry/cloud_controller_ng/blob/aacfd8/spec/unit/controllers/runtime/apps_controller_spec.rb#L17 中,例如,我想确定如何解析 "get" 方法。我知道的最快方法是转储 receiver.method(:get).source_location,但我不知道这里的接收器是什么。
您无需明确指定您发送的任何不合格消息的接收者,因为它是隐含的 self
。因此,在您的情况下,method(:get)
会告诉您 who/what 实现了发送到 self
的 get
方法。