Class: LeapCA::CouchChanges
- Inherits:
-
Object
- Object
- LeapCA::CouchChanges
- Defined in:
- lib/leap_ca/couch_changes.rb
Instance Method Summary collapse
- #follow ⇒ Object
-
#initialize(stream) ⇒ CouchChanges
constructor
A new instance of CouchChanges.
- #last_seq ⇒ Object
Constructor Details
#initialize(stream) ⇒ CouchChanges
Returns a new instance of CouchChanges.
3 4 5 |
# File 'lib/leap_ca/couch_changes.rb', line 3 def initialize(stream) @stream = stream end |
Instance Method Details
#follow ⇒ Object
13 14 15 16 17 |
# File 'lib/leap_ca/couch_changes.rb', line 13 def follow @stream.get "_changes", :feed => :continuous, :since => last_seq do |hash| yield(hash) end end |
#last_seq ⇒ Object
7 8 9 10 11 |
# File 'lib/leap_ca/couch_changes.rb', line 7 def last_seq @stream.get "_changes", :limit => 1, :descending => true do |hash| return hash[:last_seq] end end |