The sqlite3 module allows Ruby programs to interface with the installed SQLite3 database engine.
As it interfaces with the installed library, we just need to use the modified SQLite engine containing litereplica.
First follow the instructions to compile and install litereplica or use the pre-compiled binaries for your platform.
Then follow the instructions in the sqlite3-ruby repository.
If the Ruby sqlite3 module is already installed then just installing litereplica may be sufficient if the original SQLite files are overwritten at the installation.
To open the database we use a URI like this:
db = SQLite3::Database.new "file:test.db?replica=master&slave=tcp://server:port"