Module: DisposableDB

Defined in:
lib/disposable_db.rb,
lib/disposable_db/version.rb,
lib/disposable_db/database.rb,
lib/disposable_db/table_template.rb,
lib/disposable_db/databases/sqlite.rb,
lib/disposable_db/disposable_model.rb

Defined Under Namespace

Modules: Databases Classes: Database, DisposableDBError, DisposableModel, TableTemplate

Constant Summary collapse

VERSION =
'0.0.8'

Class Method Summary collapse

Class Method Details

.log(message) ⇒ Object



21
22
23
# File 'lib/disposable_db.rb', line 21

def log(message)
  logger.info("[disposable_db] #{message}") if logging?
end

.loggerObject



25
26
27
# File 'lib/disposable_db.rb', line 25

def logger
  @logger ||= options[:logger] || Logger.new(STDOUT)
end

.logger=(logger) ⇒ Object



29
30
31
# File 'lib/disposable_db.rb', line 29

def logger=(logger)
  @logger = logger
end

.logging?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/disposable_db.rb', line 33

def logging?
  options[:log]
end

.optionsObject



15
16
17
18
19
# File 'lib/disposable_db.rb', line 15

def options
  @options ||= {
    :log => true
  }
end