module Listen::Adapter
Constants
- OPTIMIZED_ADAPTERS
- POLLING_FALLBACK_MESSAGE
Public Class Methods
select(options = {})
click to toggle source
# File lib/listen/adapter.rb, line 14 def self.select(options = {}) _log :debug, 'Adapter: considering TCP ...' return TCP if options[:force_tcp] _log :debug, 'Adapter: considering polling ...' return Polling if options[:force_polling] _log :debug, 'Adapter: considering optimized backend...' return _usable_adapter_class if _usable_adapter_class _log :debug, 'Adapter: falling back to polling...' _warn_polling_fallback(options) Polling rescue _log :warn, "Adapter: failed: #{$!.inspect}:#{$@.join("\n")}" raise end
Private Class Methods
_log(type, message)
click to toggle source
# File lib/listen/adapter.rb, line 40 def self._log(type, message) Celluloid::Logger.send(type, message) end
_usable_adapter_class()
click to toggle source
# File lib/listen/adapter.rb, line 31 def self._usable_adapter_class OPTIMIZED_ADAPTERS.detect(&:usable?) end
_warn_polling_fallback(options)
click to toggle source
# File lib/listen/adapter.rb, line 35 def self._warn_polling_fallback(options) msg = options.fetch(:polling_fallback_message, POLLING_FALLBACK_MESSAGE) Kernel.warn "[Listen warning]:\n #{msg}" if msg end