Permalink
Browse files

actually pass options to erubis

  • Loading branch information...
1 parent 7dd0b01 commit 1fdc1bfe7d3944494bdc6182f58690c1e690d411 @wbzyl wbzyl committed with Oct 29, 2009
Showing with 8 additions and 1 deletion.
  1. +1 −1 lib/tilt.rb
  2. +7 −0 test/spec_tilt_erubistemplate.rb
View
2 lib/tilt.rb
@@ -232,7 +232,7 @@ class ErubisTemplate < ERBTemplate
def compile!
require_template_library 'erubis' unless defined?(::Erubis)
Erubis::Eruby.class_eval(%Q{def add_preamble(src) src << "@_out_buf = _buf = '';" end})
- @engine = ::Erubis::Eruby.new(data)
+ @engine = ::Erubis::Eruby.new(data, options)
end
end
register 'erubis', ErubisTemplate
View
7 test/spec_tilt_erubistemplate.rb
@@ -62,6 +62,13 @@
line.should.equal '6'
end
end
+
+ it "passes options to erubis" do
+ template = Tilt::ErubisTemplate.new(nil, :pattern => '\{% %\}') { 'Hey {%= @name %}!' }
+ scope = Object.new
+ scope.instance_variable_set :@name, 'Joe'
+ template.render(scope).should.equal "Hey Joe!"
+ end
end
rescue LoadError => boom
warn "Tilt::ErubisTemplate (disabled)\n"

0 comments on commit 1fdc1bf

Please sign in to comment.