Class: RubyRest::DatabaseConfig

Inherits:
SimpleConfig show all
Defined in:
lib/rubyrest/config.rb

Overview

Specialization of SimpleConfig that provides hooks for database initialization during startup

Constant Summary

Constants included from Tools

Tools::ATOM_DATE_FORMAT, Tools::ERRORS

Instance Method Summary collapse

Methods inherited from SimpleConfig

#[], #[]=, #has, #initialize, #to_s

Methods included from Tools

#error, #format_atom_date, #nvl, #parse_atom_date, #to_class, #to_gem_name, #to_module_name

Constructor Details

This class inherits a constructor from RubyRest::SimpleConfig

Instance Method Details

#connect_to_databaseObject

Connects and returns a database instance.

This method will delegate to a more specialized method, according to the :adapter config option



64
65
66
67
68
69
# File 'lib/rubyrest/config.rb', line 64

def connect_to_database
  adapter_method = "#{self[:adapter]}_connect"
  error( 004, self, adapter_method ) if !self.respond_to?( adapter_method )
  @db = self.method( adapter_method ).call
  error( 005, self, adapter_method ) if @db == nil
end

#init_databaseObject

This method must be implemented in subclasses Intentionnaly left empty



73
74
75
# File 'lib/rubyrest/config.rb', line 73

def init_database
  
end