class Middleman::Ngannotate::Processor

Public Class Methods

name() click to toggle source
# File lib/middleman-ngannotate/processor.rb, line 8
def self.name
  'Middleman::Ngannotate::Processor'
end

Public Instance Methods

evaluate(context, locals) click to toggle source
# File lib/middleman-ngannotate/processor.rb, line 18
def evaluate(context, locals)
  opt = { add: true }
  r = @context.call 'window.annotate', data, opt
  r['src']
end
prepare() click to toggle source
# File lib/middleman-ngannotate/processor.rb, line 12
def prepare
  ngannotate_source = File.open(File.join(File.dirname(__FILE__), '../../vendor/ngannotate.js')).read

  @context = ExecJS.compile "window = {};" + ngannotate_source
end