Class: LeapCA::CouchChanges

Inherits:
Object
  • Object
show all
Defined in:
lib/leap_ca/couch_changes.rb

Instance Method Summary collapse

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

#followObject



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_seqObject



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