Class: Barely::ConnectionPool

Inherits:
Object
  • Object
show all
Defined in:
lib/barely.rb

Defined Under Namespace

Classes: Spec

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConnectionPool

Returns a new instance of ConnectionPool.



102
103
104
105
106
# File 'lib/barely.rb', line 102

def initialize
  @spec = Spec.new(:adapter => 'america')
  @connection = Connection.new
  @connection.visitor = Arel::Visitors::ToSql.new(connection)
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



100
101
102
# File 'lib/barely.rb', line 100

def connection
  @connection
end

#specObject (readonly)

Returns the value of attribute spec.



100
101
102
# File 'lib/barely.rb', line 100

def spec
  @spec
end

Instance Method Details

#columns_hashObject



116
117
118
# File 'lib/barely.rb', line 116

def columns_hash
  connection.columns_hash
end

#quote(thing, column = nil) ⇒ Object



124
125
126
# File 'lib/barely.rb', line 124

def quote thing, column = nil
  connection.quote thing, column
end

#schema_cacheObject



120
121
122
# File 'lib/barely.rb', line 120

def schema_cache
  connection
end

#table_exists?(name) ⇒ Boolean

Returns:

  • (Boolean)


112
113
114
# File 'lib/barely.rb', line 112

def table_exists? name
  connection.tables.include? name.to_s
end

#with_connection {|connection| ... } ⇒ Object

Yields:



108
109
110
# File 'lib/barely.rb', line 108

def with_connection
  yield connection
end