Class: Tarantool::Client::Watcher

Inherits:
Object
  • Object
show all
Defined in:
tarantool-client/lib/tarantool/client/watcher.rb

Overview

Subscription returned by Client#watch.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, watchers, callback) ⇒ Watcher

Returns a new instance of Watcher.



9
10
11
12
13
14
15
# File 'tarantool-client/lib/tarantool/client/watcher.rb', line 9

def initialize(key, watchers, callback)
  @key = key
  @watchers = watchers
  @callback = callback
  @active = true
  @notified = false
end

Instance Attribute Details

#key ⇒ Object (readonly)

Returns the value of attribute key.



7
8
9
# File 'tarantool-client/lib/tarantool/client/watcher.rb', line 7

def key
  @key
end

Instance Method Details

#unwatch ⇒ Object



17
18
19
20
21
22
# File 'tarantool-client/lib/tarantool/client/watcher.rb', line 17

def unwatch
  @active = false
  @watchers.remove(self)

  nil
end