Skip to content

Commit

Permalink
actually pass options to erubis
Browse files Browse the repository at this point in the history
  • Loading branch information
Wlodek Bzyl authored and rtomayko committed Oct 29, 2009
1 parent 7dd0b01 commit 1fdc1bf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/tilt.rb
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions test/spec_tilt_erubistemplate.rb
Expand Up @@ -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"
Expand Down

0 comments on commit 1fdc1bf

Please sign in to comment.