Class: Squealer::Database::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/squealer/database.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dbc) ⇒ Connection

Returns a new instance of Connection.



43
44
45
46
# File 'lib/squealer/database.rb', line 43

def initialize(dbc)
  @dbc = dbc
  @collections = {}
end

Instance Attribute Details

#collectionsObject (readonly)

Returns the value of attribute collections.



41
42
43
# File 'lib/squealer/database.rb', line 41

def collections
  @collections
end

Instance Method Details

#eval(string) ⇒ Object



54
55
56
# File 'lib/squealer/database.rb', line 54

def eval(string)
  @dbc.eval(string)
end

#source(collection, conditions = {}, &block) ⇒ Object



48
49
50
51
52
# File 'lib/squealer/database.rb', line 48

def source(collection, conditions = {}, &block)
  source = Source.new(@dbc, collection)
  @collections[collection] = source
  source.source(conditions, &block)
end