Created
June 26, 2016 17:19
-
-
Save mscoutermarsh/39b8f930f50d281aa3d806b38758e5c2 to your computer and use it in GitHub Desktop.
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
some_data = [{ type: 'dog', name: 'Fido' }, | |
{ type: 'dog', name: 'Ruby' }, | |
{ type: 'cat', name: 'Fuzzy' }] | |
some_data.partition { |pet| pet[:type] == 'cat' } | |
=> [[{:type=>"cat", :name=>"Fuzzy"}], | |
[{:type=>"dog", :name=>"Fido"}, {:type=>"dog", :name=>"Ruby"}]] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment