Sha256: d63daa6d44d3bab91574e67b9059ab8c6a3e9b191b59fb1482a5b80627e456ab
Contents?: true
Size: 471 Bytes
Versions: 1
Compression:
Stored size: 471 Bytes
Contents
# we don't actually want this to be dependent on sequel, so only add # the extensions if its already been included in the app if defined? Sequel class Sequel::Dataset def on_count_change Thread.new do loop do await_count_change yield(self) end end end def await_count_change polling_interval = 1.5 current_count = self.count loop do break if self.count != current_count sleep polling_interval end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sinatra-liveviews-0.5.0 | lib/sequel/sequel-extensions.rb |