rubysqlitesqlite3-ruby

How to create a new SQLite3 database using Ruby?


I know how to connect to a database in the current file directory:

db = SQLite3::Database.new 'Data.db'

My question is how do I create a new database in the current file directory?

bonus question: what do the two colons means?


Solution

  • The file gets created if it doesn't exist.

    Bonus: SQLite3::Database points to SQLite3 module's Database submodule or subclass.