end
query("SELECT * FROM db").each do |record|
- if database = @databases[record[:db]]
- user = "'#{record[:user]}'@'#{record[:host]}'"
+ database = @databases[record[:db]]
- database[:permissions][user] = DATABASE_PRIVILEGES.each_with_object([]) do |privilege, privileges|
- privileges << privilege if record["#{privilege}_priv".to_sym] == "Y"
- end
+ next unless database
+
+ user = "'#{record[:user]}'@'#{record[:host]}'"
+
+ database[:permissions][user] = DATABASE_PRIVILEGES.each_with_object([]) do |privilege, privileges|
+ privileges << privilege if record["#{privilege}_priv".to_sym] == "Y"
end
end