Request for comments: Ruby script that counts the length of a MySQL table name
- by bakerjr
Hi, I'm new at ruby and I would like to ask you guys if there's something that could improve my Ruby code. Here's my script:
#!/usr/bin/ruby -w
require 'mysql'
dbh = Mysql.real_connect('localhost', 'db_user', 'password', 'db_table')
tables = dbh.query('show tables')
tables.each do |table|
puts "#{table}" + " (" + "#{table}".length.to_s + ")"
end
I'd love to hear your comments. Thanks in advance