Class: Oplogjam::Oplog
- Inherits:
-
Object
- Object
- Oplogjam::Oplog
- Defined in:
- lib/oplogjam/oplog.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
-
#initialize(client) ⇒ Oplog
constructor
A new instance of Oplog.
- #operations(query = {}) ⇒ Object
Constructor Details
#initialize(client) ⇒ Oplog
Returns a new instance of Oplog.
7 8 9 |
# File 'lib/oplogjam/oplog.rb', line 7 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
5 6 7 |
# File 'lib/oplogjam/oplog.rb', line 5 def client @client end |
Instance Method Details
#operations(query = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/oplogjam/oplog.rb', line 11 def operations(query = {}) Enumerator.new do |yielder| cursor = client.use(LOCAL)[OPLOG].find(query, cursor_type: :tailable_await).no_cursor_timeout cursor.each do |document| yielder << Operation.from(document) end end end |