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:
parent
a20ade811c
commit
f808f9357e
1 changed files with 6 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue