Class: Haml::More::CoffeeScript::JohnsonCompiler
- Defined in:
- lib/haml/more/coffee_script.rb
Instance Attribute Summary collapse
-
#runtime ⇒ Object
Returns the value of attribute runtime.
Attributes inherited from Compiler
#coffee_directory, #coffee_url
Instance Method Summary collapse
- #available? ⇒ Boolean
-
#initialize(runtime = nil) ⇒ JohnsonCompiler
constructor
A new instance of JohnsonCompiler.
- #prepare_runtime ⇒ Object
- #render(text) ⇒ Object
Methods inherited from Compiler
available_compilers, #compile_statement, #dependencies, #files, inherited, #javascript, new, #not_available!, #urls
Constructor Details
#initialize(runtime = nil) ⇒ JohnsonCompiler
Returns a new instance of JohnsonCompiler.
67 68 69 70 71 72 73 74 |
# File 'lib/haml/more/coffee_script.rb', line 67 def initialize(runtime = nil) super require "johnson" @runtime = runtime || Johnson::Runtime.new prepare_runtime rescue Exception # LoadError not_available! end |
Instance Attribute Details
#runtime ⇒ Object
Returns the value of attribute runtime.
66 67 68 |
# File 'lib/haml/more/coffee_script.rb', line 66 def runtime @runtime end |
Instance Method Details
#available? ⇒ Boolean
76 77 78 79 |
# File 'lib/haml/more/coffee_script.rb', line 76 def available? # CoffeeScript currently not working properly on Spidermonkey false end |
#prepare_runtime ⇒ Object
81 82 83 |
# File 'lib/haml/more/coffee_script.rb', line 81 def prepare_runtime runtime.load(*files) end |
#render(text) ⇒ Object
85 86 87 |
# File 'lib/haml/more/coffee_script.rb', line 85 def render(text) runtime.evaluate compile_statement(text) end |