Module: Haml::Filters::Coffee
- Includes:
- Base
- Defined in:
- lib/haml/filters/coffee.rb
Instance Attribute Summary collapse
-
#coffee_path ⇒ Object
Returns the value of attribute coffee_path.
Instance Method Summary collapse
Instance Attribute Details
#coffee_path ⇒ Object
Returns the value of attribute coffee_path.
2 3 4 |
# File 'lib/haml/filters/coffee.rb', line 2 def coffee_path @coffee_path end |
Instance Method Details
#popen_args ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/haml/filters/coffee.rb', line 11 def popen_args bin, args = coffee_path.split(' ') if args args << " -sc" else args = "-sc" end [bin, args] end |
#render_with_options(text, options) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/haml/filters/coffee.rb', line 21 def (text, ) bin, path = popen_args js, error = Open3.popen3(bin, path) do |i,o,e| i << text i.close [o.read, e.read] end raise SyntaxError, error unless error.blank? <<END <script type=#{[:attr_wrapper]}text/javascript#{[:attr_wrapper]}> //<![CDATA[ #{js} //]]> </script> END end |