class HamlCoffeeTemplate::Compiler
Attributes
runtime[R]
Public Class Methods
new()
click to toggle source
# File lib/haml_coffee_template/compiler.rb, line 7 def initialize @runtime = ExecJS.compile(runtime_source) end
Public Instance Methods
coffeescript_source()
click to toggle source
# File lib/haml_coffee_template/compiler.rb, line 36 def coffeescript_source File.read(CoffeeScript::Source.path) end
compile(source)
click to toggle source
# File lib/haml_coffee_template/compiler.rb, line 23 def compile(source) runtime.call( "HamlCoffeeTemplate.compile", source, HamlCoffeeTemplate.configuration.haml_coffee_compiler_options, HamlCoffeeTemplate.configuration.coffee_script_compiler_options ) end
haml_coffee_source()
click to toggle source
# File lib/haml_coffee_template/compiler.rb, line 40 def haml_coffee_source File.read(HamlCoffeeTemplate.configuration.haml_coffee_path) end
runtime_source()
click to toggle source
# File lib/haml_coffee_template/compiler.rb, line 32 def runtime_source [coffeescript_source, haml_coffee_source, wrapper_source].join(";") end
template(name, source)
click to toggle source
# File lib/haml_coffee_template/compiler.rb, line 11 def template(name, source) haml_coffee_compiler_options = HamlCoffeeTemplate.configuration.haml_coffee_compiler_options.dup haml_coffee_compiler_options[:name] = name haml_coffee_compiler_options[:namespace] = HamlCoffeeTemplate.configuration.namespace runtime.call( "HamlCoffeeTemplate.template", source, haml_coffee_compiler_options, HamlCoffeeTemplate.configuration.coffee_script_compiler_options, ) end
wrapper_script_path()
click to toggle source
# File lib/haml_coffee_template/compiler.rb, line 48 def wrapper_script_path File.expand_path("wrapper.js", __dir__) end
wrapper_source()
click to toggle source
# File lib/haml_coffee_template/compiler.rb, line 44 def wrapper_source File.read(wrapper_script_path) end