Module: Rethinker

Extended by:
Autoload
Defined in:
lib/rethinker.rb,
lib/rethinker/version.rb

Defined Under Namespace

Modules: Autoload, Document, Error, QueryRunner, Relation Classes: Connection, Criterion, Database, Railtie, Selection

Constant Summary collapse

VERSION =
'0.1'

Class Attribute Summary collapse

Class Method Summary collapse

Methods included from Autoload

autoload, autoload_and_include

Class Attribute Details

.connectionObject

Note: we always access the connection explicitly, so that in the future, we can refactor to return a connection depending on the context. Note that a connection is tied to a database in Rethinker.



21
22
23
# File 'lib/rethinker.rb', line 21

def connection
  @connection
end

Class Method Details

.connect(uri) ⇒ Object



23
24
25
# File 'lib/rethinker.rb', line 23

def connect(uri)
  self.connection = Connection.new(uri).tap { |c| c.connect }
end

.rails3?Boolean

Returns:

  • (Boolean)


32
33
34
35
36
# File 'lib/rethinker.rb', line 32

def rails3?
  return @rails3 unless @rails3.nil?
  @rails3 = Gem.loaded_specs['activemodel'].version >= Gem::Version.new('3') &&
            Gem.loaded_specs['activemodel'].version <  Gem::Version.new('4')
end