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

finalize change of To.ruby() -> To.rb()

This commit is contained in:
Charles Lowell 2010-06-07 10:59:41 +03:00
parent ff0e11fee8
commit 2b1c38b792
5 changed files with 11 additions and 13 deletions

View file

@ -5,7 +5,7 @@ module V8
def each def each
@context.enter do @context.enter do
for i in 0..(@native.Length() - 1) for i in 0..(@native.Length() - 1)
yield To.ruby(@native.Get(i)) yield To.rb(@native.Get(i))
end end
end end
end end

View file

@ -28,7 +28,7 @@ module V8
if try.HasCaught() if try.HasCaught()
err = JavascriptError.new(try) err = JavascriptError.new(try)
else else
value = To.ruby(result) value = To.rb(result)
end end
end end
end end
@ -69,11 +69,11 @@ module V8
def initialize(try) def initialize(try)
msg = try.Message() msg = try.Message()
@source_name = To.ruby(msg.GetScriptResourceName()) @source_name = To.rb(msg.GetScriptResourceName())
@source_line = To.ruby(msg.GetSourceLine()) @source_line = To.rb(msg.GetSourceLine())
@line_number = To.ruby(msg.GetLineNumber()) @line_number = To.rb(msg.GetLineNumber())
@javascript_stacktrace = To.ruby(try.StackTrace()) @javascript_stacktrace = To.rb(try.StackTrace())
super("#{To.ruby(msg.Get())}: #{@source_name}:#{@line_number}") super("#{To.rb(msg.Get())}: #{@source_name}:#{@line_number}")
end end
def self.check(try) def self.check(try)

View file

@ -7,7 +7,7 @@ module V8
C::TryCatch.try do |try| C::TryCatch.try do |try|
@context.enter do @context.enter do
this = To.v8(thisObject) this = To.v8(thisObject)
return_value = To.ruby(@native.Call(this, To.v8(args))) return_value = To.rb(@native.Call(this, To.v8(args)))
err = JavascriptError.new(try) if try.HasCaught() err = JavascriptError.new(try) if try.HasCaught()
end end
end end

View file

@ -11,7 +11,7 @@ module V8
def [](key) def [](key)
@context.enter do @context.enter do
To.ruby(@native.Get(To.v8(key))) To.rb(@native.Get(To.v8(key)))
end end
end end

View file

@ -2,7 +2,7 @@
module V8 module V8
module To module To
class << self class << self
def ruby(value) def rb(value)
case value case value
when V8::C::Function then V8::Function.new(value) when V8::C::Function then V8::Function.new(value)
when V8::C::Array then V8::Array.new(value) when V8::C::Array then V8::Array.new(value)
@ -14,8 +14,6 @@ module V8
end end
end end
alias_method :rb, :ruby
def v8(value) def v8(value)
case value case value
when V8::Object when V8::Object
@ -26,7 +24,7 @@ module V8
template = C::FunctionTemplate::New() do |arguments| template = C::FunctionTemplate::New() do |arguments|
rbargs = [] rbargs = []
for i in 0..arguments.Length() - 1 for i in 0..arguments.Length() - 1
rbargs << To.ruby(arguments[i]) rbargs << To.rb(arguments[i])
end end
V8::Function.rubycall(value, *rbargs) V8::Function.rubycall(value, *rbargs)
end end