Class: Rasti::DB::DataSource

Inherits:
Object
  • Object
show all
Defined in:
lib/rasti/db/data_source.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(db, schema = nil) ⇒ DataSource

Returns a new instance of DataSource.



7
8
9
10
# File 'lib/rasti/db/data_source.rb', line 7

def initialize(db, schema=nil)
  @db = db
  @schema = schema ? schema.to_sym : nil
end

Instance Attribute Details

#dbObject (readonly)

Returns the value of attribute db.



5
6
7
# File 'lib/rasti/db/data_source.rb', line 5

def db
  @db
end

#schemaObject (readonly)

Returns the value of attribute schema.



5
6
7
# File 'lib/rasti/db/data_source.rb', line 5

def schema
  @schema
end

Instance Method Details

#qualify(collection_name) ⇒ Object



12
13
14
# File 'lib/rasti/db/data_source.rb', line 12

def qualify(collection_name)
  schema ? Sequel[schema][collection_name] : Sequel[collection_name]
end