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

invoke javascript methods from ruby. invoke javascript constructors from ruby.

This commit is contained in:
Charles Lowell 2010-06-03 13:41:52 +03:00
parent 7a656e8e46
commit d46ff17315
2 changed files with 22 additions and 6 deletions

View file

@ -36,6 +36,22 @@ module V8
end
end
end
def respond_to?(method)
self[method] != nil
end
def method_missing(name, *args, &block)
return super(name, *args, &block) unless self.respond_to?(name)
property = self[name]
if property.kind_of?(V8::Function)
property.methodcall(self, *args)
elsif args.empty?
property
else
raise ArgumentError, "wrong number of arguments (#{args.length} for 0)" unless args.empty?
end
end
end
end

@ -1 +1 @@
Subproject commit 08ba26e9295d69c09ecc0ed76c1346b98e52a066
Subproject commit 69c7cf355d38fda586f4eb1093b0043ecd9430c6