Thank you Melvin, I forgot to mention I've already found your script before I asked here, but I didn’t think it was robust enough (please don't offend :-). Particularly, it didn't work well on PostgreSQL 10.
I think the solution for the long term is to add a flag to pg_dump, but in the short/mid term we’ll have to replicate some form of your script into the gem.
Cheers,
Aldrin.
PS: I’ve added initial support for PostgreSQL 10 to clone_schema here, but I have no time to test it well: