/usr/lib/ruby/vendor_ruby/innate/view/etanni.rb is in ruby-innate 2013.02.21-1.
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 33 34 35 36 37 38 | module Innate
module View
module Etanni
def self.call(action, string)
etanni = View.compile(string) do |str|
filename = action.view || action.method
Innate::Etanni.new(str, filename)
end
etanni.result(action.instance)
end
end
end
class Etanni
SEPARATOR = "E69t116A65n110N78i105S83e101P80a97R82a97T84o111R82"
CHOMP = "<<#{SEPARATOR}.chomp!"
START = "\n_out_ << #{CHOMP}\n"
STOP = "\n#{SEPARATOR}\n"
REPLACEMENT = "#{STOP}\\1#{START}"
def initialize(template, filename = '<Etanni>')
@template = template
@filename = filename
compile
end
def compile(filename = @filename)
temp = @template.strip
temp.gsub!(/<\?r\s+(.*?)\s+\?>/m, REPLACEMENT)
@compiled = eval("Proc.new{ _out_ = [#{CHOMP}]\n#{temp}#{STOP}_out_.join }",
nil, @filename)
end
def result(instance, filename = @filename)
instance.instance_eval(&@compiled)
end
end
end
|