From: "Rob N." Date: 2013-03-28T01:56:09+09:00 Subject: Re: Why don't TrueClass and FalseClass share a common Boolean ancestor Thank you for the responses. So FalseClass is the special object as it behaves differently to other objects in boolean operations, TrueClass is just a very simple object that in boolean operations behaves like other objects. Looking at it on that level it makes sense not to have a common ancestor. In response to Adam: For some background, I'm working on an gem I've created to simplify creating rules for arrays of objects. Up until now the logic has been simple, but I wanted to add some functions (sum, average, and count to start with). So if I added a rule 'sum(:some_method) > 4', it would pass when some_method was called on all the objects in the array, and the collected results added up to more than 4. The code is here: https://github.com/reggieb/array_logic/blob/master/lib/array_logic/rule.rb They we're not failing very gracefully if the method being called did not return a number, and I was working on a way of catching that. The count function also worked with true and false, so I wanted to let them through too. So I added the numbers_booleans_or_nils? method to handle the obvious problem input. In hindsight, it makes more sense to refactor my array_functions so that the commands being called can handle the problem input. It's probably just needs a 'collect(:to_f)' in front of the sum and average calls. However, it's the end of the day now, so the refactor will have to wait to the morning. Thank you again for you responses. The more I use and delve into Ruby, the more I love it. -- Posted via http://www.ruby-forum.com/.