lib/execjs/external_runtime.rb in execjs-1.1.0 vs lib/execjs/external_runtime.rb in execjs-1.1.1
- old
+ new
@@ -2,23 +2,25 @@
module ExecJS
class ExternalRuntime
class Context
def initialize(runtime, source = "")
+ source = source.encode('UTF-8') if source.respond_to?(:encode)
+
@runtime = runtime
@source = source
end
def eval(source, options = {})
- souce = source.encode('UTF-8') if source.respond_to?(:encode)
+ source = source.encode('UTF-8') if source.respond_to?(:encode)
if /\S/ =~ source
exec("return eval(#{MultiJson.encode("(#{source})")})")
end
end
def exec(source, options = {})
- souce = source.encode('UTF-8') if source.respond_to?(:encode)
+ source = source.encode('UTF-8') if source.respond_to?(:encode)
compile_to_tempfile([@source, source].join("\n")) do |file|
extract_result(@runtime.send(:exec_runtime, file.path))
end
end