Class: CartoDB::Client::Connection::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/cartodb-rb-client/cartodb/client/connection/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBase

Returns a new instance of Base.



8
9
10
11
12
13
14
15
16
# File 'lib/cartodb-rb-client/cartodb/client/connection/base.rb', line 8

def initialize
  raise Exception.new 'CartoDB settings not found' if CartoDB::Settings.nil?

  @active_connection = if cartodb_settings?
    CartoDB::Client::Connection::CartoDBConnection.new(settings)
  elsif postgresql_settings?
    CartoDB::Client::Connection::PostgreSQL.new(settings)
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/cartodb-rb-client/cartodb/client/connection/base.rb', line 18

def method_missing(method, *args, &block)
  if @active_connection.respond_to?(method)
    @active_connection.send(method, *args, &block)
  else
    super
  end
end

Instance Attribute Details

#active_connectionObject (readonly)

Returns the value of attribute active_connection.



6
7
8
# File 'lib/cartodb-rb-client/cartodb/client/connection/base.rb', line 6

def active_connection
  @active_connection
end