Class: Rasti::DB::DataSource
- Inherits:
-
Object
- Object
- Rasti::DB::DataSource
- Defined in:
- lib/rasti/db/data_source.rb
Instance Attribute Summary collapse
-
#db ⇒ Object
readonly
Returns the value of attribute db.
-
#schema ⇒ Object
readonly
Returns the value of attribute schema.
Instance Method Summary collapse
-
#initialize(db, schema = nil) ⇒ DataSource
constructor
A new instance of DataSource.
- #qualify(collection_name) ⇒ Object
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
#db ⇒ Object (readonly)
Returns the value of attribute db.
5 6 7 |
# File 'lib/rasti/db/data_source.rb', line 5 def db @db end |
#schema ⇒ Object (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 |