Class: Haml::More::CoffeeScript::ClientCompiler
- Defined in:
- lib/haml/more/coffee_script.rb
Instance Attribute Summary collapse
-
#script_tag ⇒ Object
Returns the value of attribute script_tag.
-
#skip_scripts ⇒ Object
Returns the value of attribute skip_scripts.
Attributes inherited from Compiler
#coffee_directory, #coffee_url
Instance Method Summary collapse
-
#initialize ⇒ ClientCompiler
constructor
A new instance of ClientCompiler.
- #render(text) ⇒ Object
- #skip_scripts? ⇒ Boolean
Methods inherited from Compiler
#available?, available_compilers, #compile_statement, #dependencies, #files, inherited, #javascript, new, #not_available!, #urls
Constructor Details
#initialize ⇒ ClientCompiler
Returns a new instance of ClientCompiler.
105 106 107 108 |
# File 'lib/haml/more/coffee_script.rb', line 105 def initialize @script_tag = "<script type=\"text/javascript\" src=%s></script>\n" super end |
Instance Attribute Details
#script_tag ⇒ Object
Returns the value of attribute script_tag.
110 111 112 |
# File 'lib/haml/more/coffee_script.rb', line 110 def script_tag @script_tag end |
#skip_scripts ⇒ Object
Returns the value of attribute skip_scripts.
110 111 112 |
# File 'lib/haml/more/coffee_script.rb', line 110 def skip_scripts @skip_scripts end |
Instance Method Details
#render(text) ⇒ Object
115 116 117 118 119 |
# File 'lib/haml/more/coffee_script.rb', line 115 def render(text) result = "" urls.each { |u| result << (script_tag % u.inspect) } unless skip_scripts? result << javascript("eval(#{compile_statement(text)})") end |
#skip_scripts? ⇒ Boolean
111 112 113 |
# File 'lib/haml/more/coffee_script.rb', line 111 def skip_scripts? !!@skip_scripts end |