In ruby, is truthiness idiomatic for a method name ending with a question mark?

后端 未结 4 1986
情深已故
情深已故 2021-02-13 21:33

Is it normal for methods with a question mark to return something that\'s truthy (for example, a number) to indicate that something is true, or should true itself b

4条回答
  •  悲哀的现实
    2021-02-13 22:15

    I renamed the method in question to remove the ?, which was really not important to the question being answered. Scanning through the core functions that end in ?s, the only ones I spotted that returned data or nil were the add? and delete? methods on Set.

提交回复
热议问题