From: Louis-Philippe Date: 2010-11-04T20:21:48+09:00 Subject: Re: true! or false! --0016e659fd1460b6cd0494385cc6 Content-Type: text/plain; charset=ISO-8859-1 I believe the more idiomatic way of doing it would be with question marks, isn't it? .true? instead of .true! exclamation marks are usually for destructive methods, question marks for booleans. 2010/11/4 Intransition > Making good use of polymorphism I had this idea for assertion methods: > > class TrueClass > # Assert true. > # > # (x == y).true! > # > def true! > true > end > # Assert false. > # > # (x == y).false! > # > def false! > raise "not false!" > end > end > > class FalseClass > # Assert true. > # > # (x == y).true! > # > def true! > raise "not true!" > end > # Assert false. > # > # (x == y).false! > # > def false! > true > end > end > > If only the error message could say something about WHAT was not true > or false, this could be pretty nifty. > > --0016e659fd1460b6cd0494385cc6--