lib/inat/data/db.rb in inat-get-0.8.0.12 vs lib/inat/data/db.rb in inat-get-0.8.0.13

- old
+ new

@@ -4,14 +4,17 @@ require 'sqlite3' require_relative '../app/globals' require_relative 'ddl' -class DB +class INat::DB - include LogDSL + include INat + include INat::App + include INat::App::Logger::DSL + # @private def self.get_finalizer *dbs proc do dbs.each { |db| db.close } end end @@ -25,11 +28,11 @@ @mutex.synchronize do @data.encoding = 'UTF-8' @data.auto_vacuum = 1 @data.results_as_hash = true @data.foreign_keys = true - @data.execute_batch DDL.DDL + @data.execute_batch Data::DDL.DDL end ObjectSpace.define_finalizer self, self.class.get_finalizer(@data) end def execute query, *args @@ -63,11 +66,13 @@ # @data.transaction(&block) # end class << self + private :new + def instance - @instance ||= DB::new + @instance ||= new @instance end def execute query, *args instance.execute query, *args