Sha256: 6235ae00bbe3d3877c59d53faa653b3f1b20ea002025484b7892517cd4e99cc8
Contents?: true
Size: 777 Bytes
Versions: 3
Compression:
Stored size: 777 Bytes
Contents
require 'sequel' module Itiel module DB module SQLConnectable attr_accessor :connection, :connection_file_path module ClassMethods def connection_file_path @@connection_file_path ||= 'config/database.yml' end def connection_file_path=(value) @@connection_file_path = value end def sequel_connection(connection_name) Sequel.connect read_connection_string(connection_name) end protected def read_connection_string(connection_name) @connections ||= YAML.load_file(connection_file_path) @connections[connection_name.to_s] end end def self.included(receiver) receiver.extend ClassMethods end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
itiel-0.1.2 | lib/itiel/db/sql_connectable.rb |
itiel-0.1.1 | lib/itiel/db/sql_connectable.rb |
itiel-0.1.0 | lib/itiel/db/sql_connectable.rb |