Class: Arcade::Init

Inherits:
Object
  • Object
show all
Extended by:
Dry::Core::ClassAttributes
Defined in:
lib/init.rb

Overview

Arcade::Init.connect environment

--------------------------------

initializes the database connection and returns the active database handle

The database cannot switched later

Arcade::Init.db

--------------

returns an instance of the database handle

Class Method Summary collapse

Class Method Details

.connect(e = :development) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/init.rb', line 19

def self.connect e= :development

  env =  if e.to_s =~ /^p/
           :production
         elsif e.to_s =~ /^t/
           :test
         else
           :development
         end
  #      set the class attribute

  db Database.new(env)
end