1
0
Fork 0
mirror of https://github.com/rubyjs/therubyracer synced 2023-03-27 23:21:42 -04:00

load a file as JavaScript source.

This commit is contained in:
Charles Lowell 2012-06-14 03:52:48 -05:00
parent a20ade811c
commit f808f9357e

View file

@ -79,6 +79,12 @@ module V8
Context.current = current
end
def load(filename)
File.open(filename) do |file|
self.eval file, filename
end
end
def eval(source, filename = '<eval>', line = 1)
if IO === source || StringIO === source
source = source.read