class Array

def _keep(arr, cls, bool)

def _keep(arr, cls, bool)
  case cls
  when Class, Module
    arr.keep_if { |i| i.is_a?(cls) == bool }
  when Proc
    arr.keep_if { |i| !!cls.call(i) == bool }
  else
    arr.keep_if { |i| (i == cls) == bool }
  end
end