class Array

Public Instance Methods

merge() click to toggle source
# File lib/bolo/core_ext/array.rb, line 2
def merge
  case first
  when Array
    to_h
  when Hash
    inject(:merge)
  else
    Hash[*self]
  end
end
uniq?() click to toggle source
# File lib/bolo/core_ext/array.rb, line 21
def uniq?
  (count - uniq.count).zero?
end
uniqs() click to toggle source
# File lib/bolo/core_ext/array.rb, line 13
def uniqs
  group_by{|i| i }.select{|_, v| v.one? }.keys
end
ununiqs() click to toggle source
# File lib/bolo/core_ext/array.rb, line 17
def ununiqs
  group_by{|i| i }.reject{|_, v| v.one? }.keys
end
ziph(*arr) click to toggle source
# File lib/bolo/core_ext/array.rb, line 25
def ziph(*arr)
  [self, arr].transpose.to_h
end