paulnicholson/coffee-filter — Issue #4: String Interpolation error when there is a variable in expression.
Author: ppt
Created: 2011-10-31 15:01:09+00:00
State: open

When I use only numbers in the expression there is no error.
`console.log "#{1+3}"`
But when I use a variable in the expression, there is an error
`a=3; console.log "#{a}"`
The error message

ERROR: compiling /Users/praphan/Development/lab/rails3.1/hello/app/assets/haml/hello.html.haml RAISED undefined local variable or method `a' for #
Backtrace: (haml):3:in `block in render'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/bundler/gems/haml-46d64d1123a9/lib/haml/engine.rb:191:in `eval'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/bundler/gems/haml-46d64d1123a9/lib/haml/engine.rb:191:in `render'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/haml_assets-0.0.3/lib/haml_assets/haml_sprockets_engine.rb:40:in `render_haml'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/haml_assets-0.0.3/lib/haml_assets/haml_sprockets_engine.rb:28:in `evaluate'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/tilt-1.3.3/lib/tilt/template.rb:76:in `render'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/sprockets-2.0.3/lib/sprockets/context.rb:175:in `block in evaluate'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/sprockets-2.0.3/lib/sprockets/context.rb:172:in `each'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/sprockets-2.0.3/lib/sprockets/context.rb:172:in `evaluate'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/sprockets-2.0.3/lib/sprockets/bundled_asset.rb:171:in `build_dependency_context_and_body'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/sprockets-2.0.3/lib/sprockets/bundled_asset.rb:135:in `dependency_context'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/sprockets-2.0.3/lib/sprockets/bundled_asset.rb:194:in `build_dependencies_paths_and_assets'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/sprockets-2.0.3/lib/sprockets/bundled_asset.rb:141:in `dependency_paths'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/sprockets-2.0.3/lib/sprockets/bundled_asset.rb:61:in `mtime'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/sprockets-2.0.3/lib/sprockets/asset.rb:58:in `block in encode_with'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/sprockets-2.0.3/lib/sprockets/asset.rb:57:in `each'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/sprockets-2.0.3/lib/sprockets/asset.rb:57:in `encode_with'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/sprockets-2.0.3/lib/sprockets/bundled_asset.rb:43:in `encode_with'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/sprockets-2.0.3/lib/sprockets/caching.rb:52:in `cache_asset'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/sprockets-2.0.3/lib/sprockets/environment.rb:82:in `build_asset'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/sprockets-2.0.3/lib/sprockets/trail.rb:102:in `find_asset_in_path'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/sprockets-2.0.3/lib/sprockets/base.rb:101:in `find_asset'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/sprockets-2.0.3/lib/sprockets/environment.rb:72:in `find_asset'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/sprockets-2.0.3/lib/sprockets/server.rb:42:in `call'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/rack-mount-0.8.3/lib/rack/mount/prefix.rb:26:in `call'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/rack-mount-0.8.3/lib/rack/mount/route_set.rb:152:in `block in call'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/rack-mount-0.8.3/lib/rack/mount/code_generation.rb:96:in `block in recognize'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/rack-mount-0.8.3/lib/rack/mount/code_generation.rb:68:in `optimized_each'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/rack-mount-0.8.3/lib/rack/mount/code_generation.rb:95:in `recognize'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/rack-mount-0.8.3/lib/rack/mount/route_set.rb:141:in `call'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/actionpack-3.1.1/lib/action_dispatch/routing/route_set.rb:532:in `call'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/actionpack-3.1.1/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/rack-1.3.5/lib/rack/etag.rb:23:in `call'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/rack-1.3.5/lib/rack/conditionalget.rb:25:in `call'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/actionpack-3.1.1/lib/action_dispatch/middleware/head.rb:14:in `call'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/actionpack-3.1.1/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/actionpack-3.1.1/lib/action_dispatch/middleware/flash.rb:243:in `call'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/rack-1.3.5/lib/rack/session/abstract/id.rb:195:in `context'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/rack-1.3.5/lib/rack/session/abstract/id.rb:190:in `call'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/actionpack-3.1.1/lib/action_dispatch/middleware/cookies.rb:331:in `call'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/activerecord-3.1.1/lib/active_record/query_cache.rb:62:in `call'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/activerecord-3.1.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:477:in `call'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/actionpack-3.1.1/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/activesupport-3.1.1/lib/active_support/callbacks.rb:392:in `_run_call_callbacks'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/activesupport-3.1.1/lib/active_support/callbacks.rb:81:in `run_callbacks'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/actionpack-3.1.1/lib/action_dispatch/middleware/callbacks.rb:28:in `call'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/actionpack-3.1.1/lib/action_dispatch/middleware/reloader.rb:68:in `call'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/rack-1.3.5/lib/rack/sendfile.rb:101:in `call'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/actionpack-3.1.1/lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/actionpack-3.1.1/lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/railties-3.1.1/lib/rails/rack/logger.rb:13:in `call'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/rack-1.3.5/lib/rack/methodoverride.rb:24:in `call'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/rack-1.3.5/lib/rack/runtime.rb:17:in `call'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/activesupport-3.1.1/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/rack-1.3.5/lib/rack/lock.rb:15:in `call'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/actionpack-3.1.1/lib/action_dispatch/middleware/static.rb:53:in `call'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/railties-3.1.1/lib/rails/engine.rb:456:in `call'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/railties-3.1.1/lib/rails/rack/content_length.rb:16:in `call'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/railties-3.1.1/lib/rails/rack/log_tailer.rb:14:in `call'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/rack-1.3.5/lib/rack/handler/mongrel.rb:77:in `process'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/mongrel-1.2.0.pre2/lib/mongrel.rb:165:in `block in process_client'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/mongrel-1.2.0.pre2/lib/mongrel.rb:164:in `each'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/mongrel-1.2.0.pre2/lib/mongrel.rb:164:in `process_client'
/Users/praphan/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/mongrel-1.2.0.pre2/lib/mongrel.rb:291:in `block (2 levels) in run'
Compiled hello.html (6ms) (pid 8920)
Served asset /hello.html - 200 OK (10ms)

I use Rails 3.1.1

My GemFile

gem 'mongrel'
gem 'haml_assets'
gem 'ejs'
gem "haml"
gem "coffee-filter"

gem 'guard-livereload'