/usr/lib/ruby/1.8/ramaze/view/tenjin.rb is in libramaze-ruby1.8 2010.06.18-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | require 'tenjin'
module Ramaze
module View
module Tenjin
def self.call(action, string)
tenjin = View.compile(string){|s|
template = ::Tenjin::Template.new
template.convert(s)
template
}
html = tenjin.ramaze_render(action.binding)
return html, 'text/html'
end
end
end
end
module Tenjin
class Template
# This method allows us to use tenjin with a binding, so helper methods are
# available instead of only instance variables.
# The big issue with this approach is that the original
# Tenjin::ContextHelper is not available here. Patches welcome.
def ramaze_render(binding)
code = "_buf = #{init_buf_expr}; #{@script}; _buf.to_s"
_buf = eval(code, binding, @filename || '(tenjin)')
end
end
end
|