From: "drbrain (Eric Hodel)" Date: 2012-03-21T11:40:54+09:00 Subject: [ruby-core:43514] [ruby-trunk - Feature #6180] to_b for converting objects to a boolean value Issue #6180 has been updated by drbrain (Eric Hodel). =begin If you're testing that a method returns exactly true and not a true value you're probably being over-specific in your tests. An assertion that a method returns a true value and not exactly true will allow the tests to be used unmodified after refactoring. Being overly specific by forcing exactly true or exactly false limits the flexibility of the tests. In other words: assert word.has_vowel? is a better test than assert_equal true, word.has_vowel? as it allows the implementation to be more flexible. =end ---------------------------------------- Feature #6180: to_b for converting objects to a boolean value https://bugs.ruby-lang.org/issues/6180#change-24995 Author: AaronLasseigne (Aaron Lasseigne) Status: Open Priority: Normal Assignee: Category: Target version: When a boolean return value is required it has become common practice is to use "!!" to convert the object. It would be more consistent to provide a "to_b" method on Object. -- http://bugs.ruby-lang.org/