What is the simplest way to split arrays into multiple arrays based on some conditions? In my scenario, I need to move the integer and the string values to different arrays.
Here is my solution:
hash = x.group_by { |t| t.kind_of? Fixnum } # hash => {true=>[1, 2, 3, 4], false=>["a", "b"]} array1 = hash[true] # The array of integers array2 = hash[false] # The array of strings