Module: NeoGruby::Sequel::Db

Defined in:
lib/neo_gruby/sequel/db.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.connObject (readonly)

Returns the value of attribute conn.



9
10
11
# File 'lib/neo_gruby/sequel/db.rb', line 9

def conn
  @conn
end

Class Method Details

.disconnect_allObject



20
21
22
23
24
# File 'lib/neo_gruby/sequel/db.rb', line 20

def disconnect_all
  @conn.keys.each do |name|
    @conn[name].disconnect
  end
end

.start_connectionsObject



11
12
13
14
15
16
17
18
# File 'lib/neo_gruby/sequel/db.rb', line 11

def start_connections
  @conn ||= {}
  template = ERB.new File.read NeoGruby.root.join('config', 'database.yml')
  config = YAML.load template.result binding
  config[NeoGruby.env].keys.each do |name|
    @conn[name.to_sym] = establish_connection(config[NeoGruby.env][name])
  end
end