class Guard::LiveReload::Snippet

Attributes

options[R]
path[R]

Public Class Methods

new(template, options) click to toggle source
# File lib/guard/livereload/snippet.rb, line 12
def initialize(template, options)
  @options = options # for ERB context

  # NOTE: use instance variable for Tempfile, so it's not GC'ed before sending
  @tmpfile = Tempfile.new('livereload.js')
  source = IO.read(template)
  data = ERB.new(source).result(binding)
  @tmpfile.write(data)
  @tmpfile.close
  @path = @tmpfile.path
end