Module: Arc::DataStores::ArelCompatibility
- Included in:
- AbstractDataStore
- Defined in:
- lib/arc/data_stores/abstract/arel_compatibility.rb
Instance Method Summary collapse
-
#columns_hash ⇒ Object
the interface for each of these methods is already implemented by the existing class just return self.
- #connection ⇒ Object
- #connection_pool ⇒ Object
-
#primary_key(table) ⇒ Object
provide a method for getting at the primary key of a given table.
-
#quote_hash(h) ⇒ Object
hashes, imo, have no business in a sql database add ability to quote a hash here to keep arel tests passing.
- #spec ⇒ Object
- #table_exists?(name) ⇒ Boolean
-
#visitor ⇒ Object
tell arel how we’ll be using it today.
- #with_connection {|_self| ... } ⇒ Object
Instance Method Details
#columns_hash ⇒ Object
the interface for each of these methods is already implemented by the existing class just return self
33 34 35 |
# File 'lib/arc/data_stores/abstract/arel_compatibility.rb', line 33 def columns_hash self end |
#connection ⇒ Object
36 37 38 |
# File 'lib/arc/data_stores/abstract/arel_compatibility.rb', line 36 def connection self end |
#connection_pool ⇒ Object
39 40 41 |
# File 'lib/arc/data_stores/abstract/arel_compatibility.rb', line 39 def connection_pool self end |
#primary_key(table) ⇒ Object
provide a method for getting at the primary key of a given table
26 27 28 29 30 |
# File 'lib/arc/data_stores/abstract/arel_compatibility.rb', line 26 def primary_key table return nil unless table table = self[table] pk = table.column_names.find{ |c| table[c].primary_key? } end |
#quote_hash(h) ⇒ Object
hashes, imo, have no business in a sql database add ability to quote a hash here to keep arel tests passing
22 23 24 |
# File 'lib/arc/data_stores/abstract/arel_compatibility.rb', line 22 def quote_hash h quote_string h.to_yaml end |
#spec ⇒ Object
42 43 44 |
# File 'lib/arc/data_stores/abstract/arel_compatibility.rb', line 42 def spec self end |
#table_exists?(name) ⇒ Boolean
17 18 19 |
# File 'lib/arc/data_stores/abstract/arel_compatibility.rb', line 17 def table_exists? name !self[name.to_sym].nil? end |
#visitor ⇒ Object
tell arel how we’ll be using it today
14 15 16 |
# File 'lib/arc/data_stores/abstract/arel_compatibility.rb', line 14 def visitor Arel::Visitors.for self end |
#with_connection {|_self| ... } ⇒ Object
45 46 47 |
# File 'lib/arc/data_stores/abstract/arel_compatibility.rb', line 45 def with_connection yield self end |