Class: RenderExecJS::Renderer
- Inherits:
-
Object
- Object
- RenderExecJS::Renderer
- Defined in:
- lib/render_execjs/renderer.rb
Class Method Summary collapse
- .call(func, *args) ⇒ Object
- .coffeescript_environment=(new_environment) ⇒ Object
- .environment ⇒ Object
- .environment=(new_environment) ⇒ Object
- .exec(js, options = {}) ⇒ Object
Class Method Details
.call(func, *args) ⇒ Object
30 31 32 |
# File 'lib/render_execjs/renderer.rb', line 30 def call func, *args context.call func, *args end |
.coffeescript_environment=(new_environment) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/render_execjs/renderer.rb', line 13 def coffeescript_environment= new_environment if defined? CoffeeScript @context = nil @environment = CoffeeScript.compile new_environment, :bare => true elsif !new_environment.blank? puts "Can't find CoffeeScript. Did you forget to add it to your Gemfile?" end end |
.environment ⇒ Object
4 5 6 |
# File 'lib/render_execjs/renderer.rb', line 4 def environment @environment end |
.environment=(new_environment) ⇒ Object
8 9 10 11 |
# File 'lib/render_execjs/renderer.rb', line 8 def environment= new_environment @context = nil @environment = new_environment end |
.exec(js, options = {}) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/render_execjs/renderer.rb', line 22 def exec js, = {} if [:coffee_script] js = CoffeeScript.compile js, :bare => true end context.exec js end |