Update base.rb

robust collection determination