Class: EaseEngine::Watcher::Info

Inherits:
Cool.io::IOWatcher
  • Object
show all
Defined in:
lib/ease_engine/watcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(io, flags, callbacks) ⇒ Info

Returns a new instance of Info.



9
10
11
12
13
14
# File 'lib/ease_engine/watcher.rb', line 9

def initialize( io, flags, callbacks )
  @io = io
  @callbacks = callbacks
  
  super( io.kind_of?( EaseEngine::Socket ) ? io.socket : io, flags )
end

Instance Attribute Details

#callbacksObject

Returns the value of attribute callbacks.



7
8
9
# File 'lib/ease_engine/watcher.rb', line 7

def callbacks
  @callbacks
end

#ioObject

Returns the value of attribute io.



7
8
9
# File 'lib/ease_engine/watcher.rb', line 7

def io
  @io
end

Instance Method Details

#on_readableObject



16
17
18
# File 'lib/ease_engine/watcher.rb', line 16

def on_readable
  @callbacks[ :on_read ].call( @io ) if @callbacks.key?( :on_read )
end

#on_removeObject



24
25
26
# File 'lib/ease_engine/watcher.rb', line 24

def on_remove
  @callbacks[ :on_remove ].call( @io ) if @callbacks.key?( :on_remove )
end

#on_writableObject



20
21
22
# File 'lib/ease_engine/watcher.rb', line 20

def on_writable
  @callbacks[ :on_write ].call( @io ) if @callbacks.key?( :on_write )
end