#!/usr/bin/env ruby
class Array
def to_html_table(border = 0, cellpad = 2, cellspace = 2)
"
\n" <<
(self.map { |ary|
" \n" << (ary.map { |elem|
" | #{elem.to_s} | \n"
}).join << "
\n"
}).join <<
"
\n"
end
end
# test suite
if $0 == __FILE__
ary = `df -h`.map { |line| line.split /\s+/ }
puts ary.to_html_table
end