PackageDescription: BooleanExpressions


Boolean Expressions

Last published: May 11, 2006 by 'michael'

Defines 0 Classes
Extends 5 Classes


This is an extension to the way we test boolean expressions in Smalltalk.
Originally we'd test for false or true, but Ruby showed me that nil can be thought of as false too.
Taking that further than Ruby even, this implementation treats different kinds of objects as either 'something' or 'not something'.
anObject ? aBlock - executes aBlock if anObject isSomething.
anObject !? aBlock - executes aBlock if anObject isSomething not.

Strings are something if they aren't empty (ie: '')
Collections are something if they aren't empty
Objects are something if they aren't nil
Numbers are something if they aren't 0
Booleans are something if they aren't false