Method: EaseEngine::Watcher#initialize

Defined in:
lib/ease_engine/watcher.rb

#initialize(options = {}) ⇒ Watcher

Returns a new instance of Watcher.



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/ease_engine/watcher.rb', line 29

def initialize( options = {} )
  # 環境に合わせて適切なものを選択
  if ! options.key?( :backend )
    backend = :select
    if EaseEngine::Platform.mac?
      backend = :kqueue
    elsif EaseEngine::Platform.linux?
      backend = :epoll
    end
    
    options[ :backend ] = backend
  end
  
  EaseEngine::Log.inf( "Watcher #{options}" )
  @loop = Cool.io::Loop.new( options )
  @watches = {}
end