lib/newrelic-management/util.rb
def common_array(ary) # rubocop: disable AbcSize
      return ary unless ary.is_a? Array
      count = ary.count
      return ary if count.zero?
      return ary.flatten.uniq if count == 1
      common = ary[0] & ary[1]
      return common if count == 2
      (count - 2).times { |x| common &= ary[x + 2] } if count > 2
      common
    end
def common_array(ary) # rubocop: disable AbcSize
      return ary unless ary.is_a? Array
      count = ary.count
      return ary if count.zero?
      return ary.flatten.uniq if count == 1
      common = ary[0] & ary[1]
      return common if count == 2
      (count - 2).times { |x| common &= ary[x + 2] } if count > 2
      common
    end
def common_array ( ary ) # rubocop: disable AbcSize return ary unless ary . is_a? Array count = ary . count return ary if count . zero? return ary . flatten . uniq if count == 1 common = ary [ 0 ] & ary [ 1 ] return common if count == 2 ( count - 2 ) . times { | x | common &= ary [ x + 2 ] } if count > 2 common end
=> Return Common Elements of an Array
= > Return Common Elements of an Array