buffer = 0 files.each do |f| buffer += File.size(File.expand_path(f)) end puts buffer.show_pretty_size
I did some searching and saw http://www.ruby-forum.com/topic/92075 where they point out that Action View harbors some code that does that. Until I got about halfway through writing this I couldn't figure out how to use the code (needed include ActionView::Helpers::NumberHelper, doh!). But for a stand along gem (and one not related to rails) is including this gem a fairly reasonable way to go or does that seem too bulky? Is there some code buried away somewhere in the standard ruby library that does it as well perhaps? I'm tempted to just copy and paste the code and move on but I can't decide exactly how I feel about adding complexity (another stray method) vs adding dependencies (adding the action_view gem).