Skip to content

Instantly share code, notes, and snippets.

@covard
Created February 3, 2023 15:59
Show Gist options
  • Save covard/59b25f1ee73cdebe4f934ced15e5e25f to your computer and use it in GitHub Desktop.
Save covard/59b25f1ee73cdebe4f934ced15e5e25f to your computer and use it in GitHub Desktop.
Get count of array items. i.e. looking for duplicates in array
 ```
h = Hash.new(0)
['a','b','b','c'].each{ |e| h[e] += 1 }
=>
{ a: 1, b: 2, c: 1 }
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment