est-il un moyen standard pour éviter truthiness en Ruby, ou aurais-je besoin de rouler ma propre solution, comme class FalseClass
def to_bool
self
end
end
class TrueClass
def to
Doublons possibles: Check if Ruby object is a Boolean How can I avoid truthiness in Ruby? Étant donné un tableau comme celui-ci (par exemple): [3, false, "String", 14, "20-31", true, true, "Other Stri