开发者

What does the < operator in ActionController::Base < mod mean in Ruby?

I came across this piece of code in Rails action pack gem (2.3.9)

[ControllerCapture, ActionController::ProcessWithTest].each do |mod|
  u开发者_如何学Gonless ActionController::Base < mod # what does this comparison mean?
    ActionController::Base.class_eval { include mod }
  end
end

I am trying to understand the second line in the code shown above. What does the < operator do in this context? Is it the standard comparison operator?(if so how do you explain the code?)


More information on these operators can be found here.

For < it reads:

mod < other → true, false, or nil

Returns true if mod is a subclass of other. Returns nil if there‘s no relationship between the two. (Think of the relationship in terms of the class definition: "class A < B" implies "A < B").

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜