Created
November 1, 2016 17:18
-
-
Save FsDevNinja/c3cdb89e80f442d46f1785ce91f4f50d to your computer and use it in GitHub Desktop.
remove duplicate entries in array
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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