Class: DataFabric::PoolProxy

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

Instance Method Summary collapse

Constructor Details

#initialize(proxy) ⇒ PoolProxy

Returns a new instance of PoolProxy.



22
23
24
# File 'lib/data_fabric/connection_proxy.rb', line 22

def initialize(proxy)
  @proxy = proxy
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



56
57
58
59
# File 'lib/data_fabric/connection_proxy.rb', line 56

def method_missing(name, *args)
  DataFabric.logger.warn "Add '#{name}' to DataFabric::PoolProxy for performance"
  @proxy.current_pool.send(name, *args)
end

Instance Method Details

#connected?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/data_fabric/connection_proxy.rb', line 38

def connected?
  @proxy.connected?
end

#connectionObject



26
27
28
# File 'lib/data_fabric/connection_proxy.rb', line 26

def connection
  @proxy
end

#specObject



30
31
32
# File 'lib/data_fabric/connection_proxy.rb', line 30

def spec
  @proxy.current_pool.spec
end

#with_connection {|@proxy| ... } ⇒ Object

Yields:

  • (@proxy)


34
35
36
# File 'lib/data_fabric/connection_proxy.rb', line 34

def with_connection
  yield @proxy
end