Can this line of code be made more compact?
db_tables_scanned = {}
IO.readlines(resume_log_file).each { |db_table| db_tables_scanned[db_table.split(".")[0].strip] << db_table.split(".")[1].strip if db_table.include? '.' } if resume and File.exists?(resume_log_file)
You want a one-liner? Here’s a one-liner:
Of course this code is hideous. There is no need to get obsessed about getting less lines of code. Code has to:
In this case, let’s break it in lines, and use a
Hash[pairs_of_keys]to build the hash: