Class: Rails::Sequel::Database::Sqlite
- Inherits:
-
Object
- Object
- Rails::Sequel::Database::Sqlite
- Defined in:
- lib/rails3_sequel/adapters/sqlite.rb
Instance Method Summary collapse
- #connect(options = {}) ⇒ Object
- #create_database(*args) ⇒ Object
- #drop_database(*args) ⇒ Object
-
#initialize(env) ⇒ Sqlite
constructor
A new instance of Sqlite.
Constructor Details
#initialize(env) ⇒ Sqlite
Returns a new instance of Sqlite.
6 7 8 9 |
# File 'lib/rails3_sequel/adapters/sqlite.rb', line 6 def initialize (env) @env = env @config = Database.configurations[@env] end |
Instance Method Details
#connect(options = {}) ⇒ Object
11 12 13 |
# File 'lib/rails3_sequel/adapters/sqlite.rb', line 11 def connect ( = {}) ::Sequel.connect(@config.merge()) end |
#create_database(*args) ⇒ Object
15 16 17 18 |
# File 'lib/rails3_sequel/adapters/sqlite.rb', line 15 def create_database (*args) connect puts 'Warning: sqlite file may not have been created until there are some operations on it' end |
#drop_database(*args) ⇒ Object
20 21 22 23 |
# File 'lib/rails3_sequel/adapters/sqlite.rb', line 20 def drop_database (*args) dbfile = @config['database'] File.delete(dbfile) if File.exists?(dbfile) end |