Class: Barely::ConnectionPool
- Inherits:
-
Object
- Object
- Barely::ConnectionPool
- Defined in:
- lib/barely.rb
Defined Under Namespace
Classes: Spec
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#spec ⇒ Object
readonly
Returns the value of attribute spec.
Instance Method Summary collapse
- #columns_hash ⇒ Object
-
#initialize ⇒ ConnectionPool
constructor
A new instance of ConnectionPool.
- #quote(thing, column = nil) ⇒ Object
- #schema_cache ⇒ Object
- #table_exists?(name) ⇒ Boolean
- #with_connection {|connection| ... } ⇒ Object
Constructor Details
#initialize ⇒ ConnectionPool
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
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
100 101 102 |
# File 'lib/barely.rb', line 100 def connection @connection end |
#spec ⇒ Object (readonly)
Returns the value of attribute spec.
100 101 102 |
# File 'lib/barely.rb', line 100 def spec @spec end |
Instance Method Details
#columns_hash ⇒ Object
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_cache ⇒ Object
120 121 122 |
# File 'lib/barely.rb', line 120 def schema_cache connection end |
#table_exists?(name) ⇒ 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
108 109 110 |
# File 'lib/barely.rb', line 108 def with_connection yield connection end |