Class: Kweerie::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/kweerie/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/kweerie/configuration.rb', line 7

def initialize
  # Default to using ActiveRecord's connection if available
  @connection_provider = lambda {
    unless defined?(ActiveRecord::Base)
      raise ConfigurationError, "No connection provider configured and ActiveRecord is not available"
    end

    ActiveRecord::Base.connection.raw_connection
  }

  # Default SQL paths
  @sql_paths = lambda {
    paths = ["app/queries"]
    paths.unshift("lib/queries") unless defined?(Rails)
    paths
  }
end

Instance Attribute Details

#connection_providerObject

Returns the value of attribute connection_provider.



5
6
7
# File 'lib/kweerie/configuration.rb', line 5

def connection_provider
  @connection_provider
end

#sql_pathsObject

Returns the value of attribute sql_paths.



5
6
7
# File 'lib/kweerie/configuration.rb', line 5

def sql_paths
  @sql_paths
end