Sha256: f8f4b677b941f2c261de7f5793705cea0aad29c37cb668ef8e0a5b93fb4acbf7

Contents?: true

Size: 711 Bytes

Versions: 13

Compression:

Stored size: 711 Bytes

Contents

require "spring/watcher/abstract"
require "spring/configuration"

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

  def self.watch_method=(method)
    case method
    when :polling
      require_relative "watcher/polling"
      @watch_method = Watcher::Polling
    when :listen
      require_relative "watcher/listen"
      @watch_method = Watcher::Listen
    else
      @watch_method = method
    end
  end

  self.watch_interval = 0.2
  self.watch_method = :polling

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

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

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
spring-1.1.3 lib/spring/watcher.rb
spring-1.1.2 lib/spring/watcher.rb
spring-1.1.1 lib/spring/watcher.rb
spring-1.1.0 lib/spring/watcher.rb
spring-1.1.0.beta4 lib/spring/watcher.rb
spring-1.1.0.beta3 lib/spring/watcher.rb
spring-1.1.0.beta2 lib/spring/watcher.rb
spring-1.1.0.beta1 lib/spring/watcher.rb
spring-1.0.0 lib/spring/watcher.rb
spring-0.9.2 lib/spring/watcher.rb
spring-0.9.1 lib/spring/watcher.rb
spring-0.9.0 lib/spring/watcher.rb
spring-0.0.11 lib/spring/watcher.rb