Class: Keymap::ConnectionAdapters::ConnectionManagement::Proxy

Inherits:
Object
  • Object
show all
Defined in:
lib/keymap/connection_adapters/abstract/connection_pool.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(body, testing = false) ⇒ Proxy

Returns a new instance of Proxy.



392
393
394
395
# File 'lib/keymap/connection_adapters/abstract/connection_pool.rb', line 392

def initialize(body, testing = false)
  @body = body
  @testing = testing
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_sym, *arguments, &block) ⇒ Object



397
398
399
# File 'lib/keymap/connection_adapters/abstract/connection_pool.rb', line 397

def method_missing(method_sym, *arguments, &block)
  @body.send(method_sym, *arguments, &block)
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



390
391
392
# File 'lib/keymap/connection_adapters/abstract/connection_pool.rb', line 390

def body
  @body
end

#testingObject (readonly)

Returns the value of attribute testing.



390
391
392
# File 'lib/keymap/connection_adapters/abstract/connection_pool.rb', line 390

def testing
  @testing
end

Instance Method Details

#closeObject



409
410
411
412
413
414
415
# File 'lib/keymap/connection_adapters/abstract/connection_pool.rb', line 409

def close
  body.close if body.respond_to?(:close)

  # Don't return connection (and perform implicit rollback) if
  # this request is a part of integration test
  Keymap::Base.clear_active_connections! unless testing
end

#each(&block) ⇒ Object



405
406
407
# File 'lib/keymap/connection_adapters/abstract/connection_pool.rb', line 405

def each(&block)
  body.each(&block)
end

#respond_to?(method_sym, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


401
402
403
# File 'lib/keymap/connection_adapters/abstract/connection_pool.rb', line 401

def respond_to?(method_sym, include_private = false)
  @body.respond_to?(method_sym)
end