Skip to content

Instantly share code, notes, and snippets.

@FsDevNinja
Created November 1, 2016 17:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FsDevNinja/c3cdb89e80f442d46f1785ce91f4f50d to your computer and use it in GitHub Desktop.
Save FsDevNinja/c3cdb89e80f442d46f1785ce91f4f50d to your computer and use it in GitHub Desktop.
remove duplicate entries in array
module Uniques
def self.cleanup(array)
arr = Hash.new(0)
array.reject{ |item| (arr[item] += 1) > 1 }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment