Ruby on Rails Discussions
How to get first 10 items from hash in ruby?
rubyonrails-talk
Christian_van_der_Le
(Christian van der Leeden)
February 13, 2009, 11:48am
1
How about hashTable.sort.keys[0,10].each { |key| puts "#{key} #{hashTable[key]} }
Christian
Related topics
Topic
Replies
Views
Activity
How to get first 10 items from hash in ruby?
rubyonrails-talk
1
193
February 13, 2009
just want my first ten parts of the hash? how to chop it?
rubyonrails-talk
0
159
December 11, 2006
just want my first ten parts of the hash? how to chop it?
rubyonrails-talk
0
137
December 11, 2006
Using hash.keys - why doesn't it display in order created
rubyonrails-talk
6
365
January 31, 2007
create an array from a hash that includes key and value
rubyonrails-talk
4
365
July 19, 2008