Last active
August 29, 2015 13:59
-
-
Save rjmcdonald83/51684261bf141df2e6db to your computer and use it in GitHub Desktop.
Make a pretty sorted list of a counted hash
This file contains 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
-if hash_with_count.present? | |
-# Take a hash formated like so { :a => 2, :b => 4, :c => 6...}, sort it highest to lowest and slice up and iterate over each row. | |
- hash_with_count.sort_by{|k,v| v}.reverse.each_slice(5).to_a.each do |row| | |
%ul#tags.list-inline | |
-row.each do |name, count| | |
%li | |
.label.label-success | |
= name | |
= count | |
-else | |
%p No Hash Present |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment