Sha256: 5415a87cc194337df206397479b28078c647e5efd3fb0c4882b4443a9d955f94

Contents?: true

Size: 498 Bytes

Versions: 1

Compression:

Stored size: 498 Bytes

Contents

require 'erb'
require 'tempfile'

require 'guard/compat/plugin'

module Guard
  class LiveReload < Plugin
    class Snippet
      attr_reader :path
      attr_reader :options

      def initialize(template, options)
        @options = options # for ERB context
        tmpfile = Tempfile.new('livereload.js')
        source = IO.read(template)
        data = ERB.new(source).result(binding)
        tmpfile.write(data)
        tmpfile.close
        @path = tmpfile.path
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
guard-livereload-2.5.0 lib/guard/livereload/snippet.rb