Module: EM::Sequel::Postgres::Watcher

Defined in:
lib/em-postgresql-sequel/watcher.rb

Instance Method Summary collapse

Instance Method Details

#initialize(client, deferrable) ⇒ Object



5
6
7
8
# File 'lib/em-postgresql-sequel/watcher.rb', line 5

def initialize(client, deferrable)
  @client = client
  @deferrable = deferrable
end

#notify_readableObject



10
11
12
13
14
15
16
17
18
# File 'lib/em-postgresql-sequel/watcher.rb', line 10

def notify_readable
  detach
  begin
    @client.block
    @deferrable.succeed(@client.get_last_result)
  rescue Exception => e
    @deferrable.fail(e)
  end
end