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

add rubysend() as replacement for rubycall where appropriate.

This commit is contained in:
Charles Lowell 2010-08-02 17:03:14 -05:00
parent bcb7da3965
commit c1909ad39c
2 changed files with 10 additions and 6 deletions

View file

@ -84,7 +84,7 @@ module V8
for i in 0..arguments.Length() - 1
rbargs << To.rb(arguments[i])
end
instance = V8::Function.rubycall(cls.method(:new), *rbargs)
instance = V8::Function.rubysend(cls, :new, *rbargs)
wrap = C::External::New(instance)
end
arguments.This().tap do |this|
@ -122,7 +122,7 @@ module V8
To.v8(method)
end
elsif obj.respond_to?(:[])
Function.rubycall(obj.method(:[]), name)
Function.rubysend(obj, :[], name)
else
C::Empty
end
@ -137,10 +137,10 @@ module V8
setter = name + "="
methods = accessible_methods(obj)
if methods.include?(setter)
Function.rubycall(obj.method(setter), To.rb(value))
Function.rubysend(obj, setter, To.rb(value))
value
elsif obj.respond_to?(:[]=)
Function.rubycall(obj.method(:[]=), name, To.rb(value))
Function.rubysend(obj, :[]=, name, To.rb(value))
value
else
C::Empty
@ -165,7 +165,7 @@ module V8
def self.call(index, info)
obj = To.rb(info.This())
if obj.respond_to?(:[])
Function.rubycall(obj.method(:[]), index)
Function.rubysend(obj, :[], index)
else
C::Empty
end
@ -176,7 +176,7 @@ module V8
def self.call(index, value, info)
obj = To.rb(info.This())
if obj.respond_to?(:[]=)
Function.rubycall(obj.method(:[]=), index, To.rb(value))
Function.rubysend(obj, :[]=, index, To.rb(value))
value
else
C::Empty

View file

@ -39,5 +39,9 @@ module V8
end
end
end
def self.rubysend(obj, message, *args)
rubycall(obj.method(message), *args)
end
end
end