From 2b1c38b7922fe2c2086d346d03a880ccb774d9db Mon Sep 17 00:00:00 2001 From: Charles Lowell Date: Mon, 7 Jun 2010 10:59:41 +0300 Subject: [PATCH] finalize change of To.ruby() -> To.rb() --- lib/v8/array.rb | 2 +- lib/v8/context.rb | 12 ++++++------ lib/v8/function.rb | 2 +- lib/v8/object.rb | 2 +- lib/v8/to.rb | 6 ++---- 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/lib/v8/array.rb b/lib/v8/array.rb index 22c624e..95206b9 100644 --- a/lib/v8/array.rb +++ b/lib/v8/array.rb @@ -5,7 +5,7 @@ module V8 def each @context.enter do for i in 0..(@native.Length() - 1) - yield To.ruby(@native.Get(i)) + yield To.rb(@native.Get(i)) end end end diff --git a/lib/v8/context.rb b/lib/v8/context.rb index d47d8eb..11b4567 100644 --- a/lib/v8/context.rb +++ b/lib/v8/context.rb @@ -28,7 +28,7 @@ module V8 if try.HasCaught() err = JavascriptError.new(try) else - value = To.ruby(result) + value = To.rb(result) end end end @@ -69,11 +69,11 @@ module V8 def initialize(try) msg = try.Message() - @source_name = To.ruby(msg.GetScriptResourceName()) - @source_line = To.ruby(msg.GetSourceLine()) - @line_number = To.ruby(msg.GetLineNumber()) - @javascript_stacktrace = To.ruby(try.StackTrace()) - super("#{To.ruby(msg.Get())}: #{@source_name}:#{@line_number}") + @source_name = To.rb(msg.GetScriptResourceName()) + @source_line = To.rb(msg.GetSourceLine()) + @line_number = To.rb(msg.GetLineNumber()) + @javascript_stacktrace = To.rb(try.StackTrace()) + super("#{To.rb(msg.Get())}: #{@source_name}:#{@line_number}") end def self.check(try) diff --git a/lib/v8/function.rb b/lib/v8/function.rb index 8c5868a..f877e65 100644 --- a/lib/v8/function.rb +++ b/lib/v8/function.rb @@ -7,7 +7,7 @@ module V8 C::TryCatch.try do |try| @context.enter do 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() end end diff --git a/lib/v8/object.rb b/lib/v8/object.rb index 6cfa665..b119652 100644 --- a/lib/v8/object.rb +++ b/lib/v8/object.rb @@ -11,7 +11,7 @@ module V8 def [](key) @context.enter do - To.ruby(@native.Get(To.v8(key))) + To.rb(@native.Get(To.v8(key))) end end diff --git a/lib/v8/to.rb b/lib/v8/to.rb index ef68844..60b6aa2 100644 --- a/lib/v8/to.rb +++ b/lib/v8/to.rb @@ -2,7 +2,7 @@ module V8 module To class << self - def ruby(value) + def rb(value) case value when V8::C::Function then V8::Function.new(value) when V8::C::Array then V8::Array.new(value) @@ -14,8 +14,6 @@ module V8 end end - alias_method :rb, :ruby - def v8(value) case value when V8::Object @@ -26,7 +24,7 @@ module V8 template = C::FunctionTemplate::New() do |arguments| rbargs = [] for i in 0..arguments.Length() - 1 - rbargs << To.ruby(arguments[i]) + rbargs << To.rb(arguments[i]) end V8::Function.rubycall(value, *rbargs) end