h1. Object h2. Object#blank? By default all objects are blank if they are @nil@. Individual subclasses define their own @blank?@ methods. This primarily affects String, Array and Hash objects. All three return true if the object is either nil or empty. h3. Inspiration This was originally inspired by Rails, but I've wished for it outside of Rails so I've added it. h2. Object#in? Returns a boolean value indicating whether or not @object@ is part of an enumerable object of some sort. The argument to Object#in? must respond to the @include?@ method.
a = ['alpha', 1, 2, 3] 2.in?(a) # => true 'foo'.in?(a) # => false 3.in?(4) # => ArgumentErrorh2. Object#to_bool Returns a boolean indicating whether or not the object is nil or false. To be true, an object must not be nil and not be false. h3. Inspiration An idiom I see in practice that I don't like is the double negation syntax that some programmers use in order to determine if the object is false or nil:
!!var # => ick var.to_bool # => more readableC extension writers will recognize that this is just an @RTEST()@ call.