Parent

Files

Guard::LiveReload::Reactor

Attributes

options[R]
thread[R]
web_sockets[R]

Public Class Methods

new(options) click to toggle source
# File lib/guard/livereload/reactor.rb, line 8
def initialize(options)
  @web_sockets = []
  @options     = options
  @thread      = start_threaded_reactor(options)
end

Public Instance Methods

reload_browser(paths = []) click to toggle source
# File lib/guard/livereload/reactor.rb, line 18
def reload_browser(paths = [])
  UI.info "Reloading browser: #{paths.join(' ')}"
  paths.each do |path|
    data = {
      :command  => 'reload',
      :path     => "#{Dir.pwd}/#{path}",
      :liveCSS  => @options[:apply_css_live]
    }
    if options[:override_url] && File.exist?(path)
      data[:overrideURL] = '/' + path
    end
    UI.debug data
    web_sockets.each { |ws| ws.send(MultiJson.encode(data)) }
  end
end
stop() click to toggle source
# File lib/guard/livereload/reactor.rb, line 14
def stop
  thread.kill
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.