Class: Sequel::Dataset
- Inherits:
-
Object
- Object
- Sequel::Dataset
- Defined in:
- lib/sequel/sequel-extensions.rb
Instance Method Summary collapse
Instance Method Details
#await_count_change ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/sequel/sequel-extensions.rb', line 15 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 |
#on_count_change ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/sequel/sequel-extensions.rb', line 6 def on_count_change Thread.new do loop do await_count_change yield(self) end end end |