Class: Switchman::SchemaCache

Inherits:
ActiveRecord::ConnectionAdapters::SchemaCache
  • Object
show all
Defined in:
lib/switchman/schema_cache.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pool) ⇒ SchemaCache

Returns a new instance of SchemaCache.



8
9
10
11
# File 'lib/switchman/schema_cache.rb', line 8

def initialize(pool)
  @pool = pool
  super(nil)
end

Instance Attribute Details

#poolObject (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_values(other_cache) ⇒ Object



13
14
15
16
17
18
# File 'lib/switchman/schema_cache.rb', line 13

def copy_values(other_cache)
  # use the same cached values but still fall back to the correct pool
  %i[@columns @columns_hash @primary_keys @data_sources].each do |iv|
    instance_variable_set(iv, other_cache.instance_variable_get(iv))
  end
end