Sha256: ef2159d12e926704b57be4cf8aee0bd95e2f76d602070c6840acb008dff06b24

Contents?: true

Size: 518 Bytes

Versions: 2

Compression:

Stored size: 518 Bytes

Contents

require "spring/watcher/abstract"
require "spring/watcher/listen"
require "spring/watcher/polling"

module Spring
  class << self
    attr_accessor :watch_interval
    attr_writer :watcher
  end

  self.watch_interval = 0.2

  def self.watcher
    @watcher ||= watcher_class.new(Spring.application_root_path, watch_interval)
  end

  def self.watcher_class
    if Watcher::Listen.available?
      Watcher::Listen
    else
      Watcher::Polling
    end
  end

  def self.watch(*items)
    watcher.add *items
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spring-0.0.9 lib/spring/watcher.rb
spring-0.0.8 lib/spring/watcher.rb