Class: MongoDelta::Outlet::Base
- Inherits:
-
Object
- Object
- MongoDelta::Outlet::Base
- Defined in:
- lib/mongo_delta/outlet/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#db ⇒ Object
readonly
Returns the value of attribute db.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
-
#target_collection ⇒ Object
readonly
Returns the value of attribute target_collection.
Instance Method Summary collapse
- #handles?(db, collection, method) ⇒ Boolean
-
#initialize(target, db, collection, options = {}) ⇒ Base
constructor
A new instance of Base.
- #ns ⇒ Object
Constructor Details
#initialize(target, db, collection, options = {}) ⇒ Base
Returns a new instance of Base.
7 8 9 10 11 12 13 14 |
# File 'lib/mongo_delta/outlet/base.rb', line 7 def initialize(target, db, collection, ={}) @target = target @db = db @collection = collection @options = @target_collection = target.db(['target_db'] || db).collection(['target_collection'] || collection) end |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
5 6 7 |
# File 'lib/mongo_delta/outlet/base.rb', line 5 def collection @collection end |
#db ⇒ Object (readonly)
Returns the value of attribute db.
5 6 7 |
# File 'lib/mongo_delta/outlet/base.rb', line 5 def db @db end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/mongo_delta/outlet/base.rb', line 5 def @options end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
5 6 7 |
# File 'lib/mongo_delta/outlet/base.rb', line 5 def target @target end |
#target_collection ⇒ Object (readonly)
Returns the value of attribute target_collection.
5 6 7 |
# File 'lib/mongo_delta/outlet/base.rb', line 5 def target_collection @target_collection end |
Instance Method Details
#handles?(db, collection, method) ⇒ Boolean
20 21 22 |
# File 'lib/mongo_delta/outlet/base.rb', line 20 def handles?(db, collection, method) @db == db and @collection == collection and respond_to?(method) end |
#ns ⇒ Object
16 17 18 |
# File 'lib/mongo_delta/outlet/base.rb', line 16 def ns "#{db}.#{collection}" end |