Permalink
Browse files

Make runner_source and exec_runtime protected

  • Loading branch information...
josh committed Mar 10, 2011
1 parent c595c07 commit 0dc15c319c7d159476c0aaf3b9850e3a5ea704e4
Showing with 13 additions and 13 deletions.
  1. +13 −13 lib/execjs/external_runtime.rb
@@ -17,7 +17,7 @@ def eval(source, options = {})
def exec(source, options = {})
compile_to_tempfile([@source, source].join("\n")) do |file|
- extract_result(@runtime.exec_runtime(file.path))
+ extract_result(@runtime.send(:exec_runtime, file.path))
end
end
@@ -36,7 +36,7 @@ def compile_to_tempfile(source)
end
def compile(source)
- @runtime.runner_source.dup.tap do |output|
+ @runtime.send(:runner_source).dup.tap do |output|
output.sub!('#{source}', source)
output.sub!('#{json2_source}') do
IO.read(ExecJS.root + "/support/json2.js")
@@ -84,20 +84,20 @@ def available?
@binary ? true : false
end
- def runner_source
- @runner_source ||= IO.read(@runner_path)
- end
+ protected
+ def runner_source
+ @runner_source ||= IO.read(@runner_path)
+ end
- def exec_runtime(filename)
- output = sh("#{@binary} #{filename} 2>&1")
- if $?.success?
- output
- else
- raise RuntimeError, output
+ def exec_runtime(filename)
+ output = sh("#{@binary} #{filename} 2>&1")
+ if $?.success?
+ output
+ else
+ raise RuntimeError, output
+ end
end
- end
- protected
def locate_binary
if binary = which(@command)
if @test_args

0 comments on commit 0dc15c3

Please sign in to comment.