Class: Switchman::SchemaCache
- Inherits:
-
ActiveRecord::ConnectionAdapters::SchemaCache
- Object
- ActiveRecord::ConnectionAdapters::SchemaCache
- Switchman::SchemaCache
- Defined in:
- lib/switchman/schema_cache.rb
Constant Summary collapse
- SHARED_IVS =
%i{@columns @columns_hash @primary_keys @data_sources @indexes}.freeze
Instance Attribute Summary collapse
-
#pool ⇒ Object
readonly
Returns the value of attribute pool.
Instance Method Summary collapse
- #copy_references(other_cache) ⇒ Object
- #copy_values(other_cache) ⇒ Object
-
#initialize(pool) ⇒ SchemaCache
constructor
A new instance of SchemaCache.
Constructor Details
#initialize(pool) ⇒ SchemaCache
Returns a new instance of SchemaCache.
10 11 12 13 |
# File 'lib/switchman/schema_cache.rb', line 10 def initialize(pool) @pool = pool super(nil) end |
Instance Attribute Details
#pool ⇒ Object (readonly)
Returns the value of attribute pool.
6 7 8 |
# File 'lib/switchman/schema_cache.rb', line 6 def pool @pool end |
Instance Method Details
#copy_references(other_cache) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/switchman/schema_cache.rb', line 21 def copy_references(other_cache) # use the same cached values but still fall back to the correct pool SHARED_IVS.each do |iv| instance_variable_set(iv, other_cache.instance_variable_get(iv)) end end |
#copy_values(other_cache) ⇒ Object
15 16 17 18 19 |
# File 'lib/switchman/schema_cache.rb', line 15 def copy_values(other_cache) SHARED_IVS.each do |iv| instance_variable_get(iv).replace(other_cache.instance_variable_get(iv)) end end |