You can use the Aray pr Enumerable monkey patch and provide a conditional add method.
module Array def add_if(object, condition=true) self << object if condition return self end end
Thus, it would be chained, retaining most of the space. array = [].add(:class, is_given?).add(object, false) #etc
Tails source share