diff options
author | Azul <azul@riseup.net> | 2013-09-10 09:44:38 +0200 |
---|---|---|
committer | Azul <azul@riseup.net> | 2013-09-10 09:44:38 +0200 |
commit | 57140b80f00aab43918a3ec3276062823971dec7 (patch) | |
tree | 759de1356d0cee24e44a4229629ddaf2fc662ad0 /lib/tapicero/couch_changes.rb | |
parent | c221405796270f46d8d4881183fd55fd4d977da9 (diff) |
bringing over couch_changes from leap_ca including tests
Diffstat (limited to 'lib/tapicero/couch_changes.rb')
-rw-r--r-- | lib/tapicero/couch_changes.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/tapicero/couch_changes.rb b/lib/tapicero/couch_changes.rb new file mode 100644 index 0000000..2e668dc --- /dev/null +++ b/lib/tapicero/couch_changes.rb @@ -0,0 +1,19 @@ +module Tapicero + class CouchChanges + def initialize(stream) + @stream = stream + end + + def last_seq + @stream.get "_changes", :limit => 1, :descending => true do |hash| + return hash[:last_seq] + end + end + + def follow + @stream.get "_changes", :feed => :continuous, :since => last_seq do |hash| + yield(hash) + end + end + end +end |