Class: RR::NoisyCursor
- Inherits:
-
Object
- Object
- RR::NoisyCursor
- Defined in:
- lib/rubyrep/noisy_connection.rb
Overview
Wraps an existing cursor. Purpose: send regular updates to the installed TaskSweeper
Instance Attribute Summary collapse
-
#org_cursor ⇒ Object
The original cusor.
-
#sweeper ⇒ Object
The installed task sweeper.
Instance Method Summary collapse
- #clear ⇒ Object
-
#initialize(cursor, sweeper) ⇒ NoisyCursor
constructor
Create a new NoisyCursor.
-
#next? ⇒ Boolean
Delegate the uninteresting methods to the original cursor.
-
#next_row ⇒ Object
Returns the row as a column => value hash and moves the cursor to the next row.
Constructor Details
#initialize(cursor, sweeper) ⇒ NoisyCursor
Create a new NoisyCursor.
-
cursor: the original cursor
-
sweeper: the target TaskSweeper
15 16 17 18 |
# File 'lib/rubyrep/noisy_connection.rb', line 15 def initialize(cursor, sweeper) self.org_cursor = cursor self.sweeper = sweeper end |
Instance Attribute Details
#org_cursor ⇒ Object
The original cusor
7 8 9 |
# File 'lib/rubyrep/noisy_connection.rb', line 7 def org_cursor @org_cursor end |
#sweeper ⇒ Object
The installed task sweeper
10 11 12 |
# File 'lib/rubyrep/noisy_connection.rb', line 10 def sweeper @sweeper end |
Instance Method Details
#clear ⇒ Object
22 |
# File 'lib/rubyrep/noisy_connection.rb', line 22 def clear; org_cursor.clear end |
#next? ⇒ Boolean
Delegate the uninteresting methods to the original cursor
21 |
# File 'lib/rubyrep/noisy_connection.rb', line 21 def next?; org_cursor.next? end |
#next_row ⇒ Object
Returns the row as a column => value hash and moves the cursor to the next row.
25 26 27 28 29 30 |
# File 'lib/rubyrep/noisy_connection.rb', line 25 def next_row sweeper.ping row = org_cursor.next_row sweeper.ping row end |