summaryrefslogtreecommitdiff
path: root/lib/erb.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/erb.rb')
-rw-r--r--lib/erb.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/erb.rb b/lib/erb.rb
index 5c41c37..25654d6 100644
--- a/lib/erb.rb
+++ b/lib/erb.rb
@@ -797,7 +797,7 @@ class ERB
@safe_level = safe_level
compiler = make_compiler(trim_mode)
set_eoutvar(compiler, eoutvar)
- @src, @enc = *compiler.compile(str)
+ @src, @encoding = *compiler.compile(str)
@filename = nil
@lineno = 0
end
@@ -812,6 +812,9 @@ class ERB
# The Ruby code generated by ERB
attr_reader :src
+ # The encoding to eval
+ attr_reader :encoding
+
# The optional _filename_ argument passed to Kernel#eval when the ERB code
# is run
attr_accessor :filename
@@ -879,7 +882,7 @@ class ERB
# print MyClass.new.render('foo', 123)
def def_method(mod, methodname, fname='(ERB)')
src = self.src
- magic_comment = "#coding:#{@enc}\n"
+ magic_comment = "#coding:#{@encoding}\n"
mod.module_eval do
eval(magic_comment + "def #{methodname}\n" + src + "\nend\n", binding, fname, -2)
end