diff options
author | Azul <azul@riseup.net> | 2012-09-20 13:15:33 +0200 |
---|---|---|
committer | Azul <azul@riseup.net> | 2012-09-20 13:17:17 +0200 |
commit | 1bac88549fc3bfda81e04b2811443a301aa9e781 (patch) | |
tree | 1d646219965216479e5c770d82eec543a80044aa /lib/leap_ca/couch_changes.rb | |
parent | 15354c284879c734ca9bd87450d715dcdbe8aec2 (diff) |
moved files into own dir and added main leap_ca.rb
Also updated the couchdb.yml.example with more meaningful content
Diffstat (limited to 'lib/leap_ca/couch_changes.rb')
-rw-r--r-- | lib/leap_ca/couch_changes.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/leap_ca/couch_changes.rb b/lib/leap_ca/couch_changes.rb new file mode 100644 index 0000000..59209a4 --- /dev/null +++ b/lib/leap_ca/couch_changes.rb @@ -0,0 +1,17 @@ +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 |