<分区>
Possible Duplicates:
Check if Ruby object is a Boolean
How can I avoid truthiness in Ruby?
给定如下数组(例如):
[3, false, "String", 14, "20-31", true, true, "Other String"]
例如,是否有更简单的方法来确定哪些元素是实际 bool 值而不求助于此?
value === TrueClass || value === FalseClass
依赖于数组中的位置不是一种选择,因为它会因情况而异。