Class: Bowline::Watcher::Callback
Instance Attribute Summary collapse
-
#event ⇒ Object
readonly
Returns the value of attribute event.
-
#oneshot ⇒ Object
readonly
Returns the value of attribute oneshot.
-
#prok ⇒ Object
readonly
Returns the value of attribute prok.
Instance Method Summary collapse
-
#call(*args) ⇒ Object
Execute callback.
-
#initialize(watcher, event, prok, oneshot = false) ⇒ Callback
constructor
A new instance of Callback.
-
#remove ⇒ Object
Remove callback from watcher.
Constructor Details
#initialize(watcher, event, prok, oneshot = false) ⇒ Callback
Returns a new instance of Callback.
71 72 73 74 75 76 |
# File 'lib/bowline/watcher.rb', line 71 def initialize(watcher, event, prok, oneshot = false) @watcher = watcher @event = event @prok = prok @oneshot = oneshot end |
Instance Attribute Details
#event ⇒ Object (readonly)
Returns the value of attribute event.
69 70 71 |
# File 'lib/bowline/watcher.rb', line 69 def event @event end |
#oneshot ⇒ Object (readonly)
Returns the value of attribute oneshot.
69 70 71 |
# File 'lib/bowline/watcher.rb', line 69 def oneshot @oneshot end |
#prok ⇒ Object (readonly)
Returns the value of attribute prok.
69 70 71 |
# File 'lib/bowline/watcher.rb', line 69 def prok @prok end |
Instance Method Details
#call(*args) ⇒ Object
Execute callback
79 80 81 82 |
# File 'lib/bowline/watcher.rb', line 79 def call(*args) prok.call(*args) remove if oneshot end |
#remove ⇒ Object
Remove callback from watcher
85 86 87 |
# File 'lib/bowline/watcher.rb', line 85 def remove @watcher.remove(@event, @prok) end |