Ruby Array Swap Values
// a = [1,34,nil,14,5,2,nil,nil,9]
// a.swap!(nil, 0)
// a.swap(0, "No Data")
class Array def swap(from, to) collect { |value| value == from ? to : value } end def swap!(from, to) collect! { |value| value == from ? to : value } end end