Skip to content

Commit

Permalink
Bug fix of String."+"
Browse files Browse the repository at this point in the history
git-svn-id: http://hotruby.googlecode.com/svn/trunk@33 4fb8041d-b042-0410-9571-f50be27af959
  • Loading branch information
yukoba@accelart.jp committed Jan 27, 2008
1 parent 6c3d3a3 commit 6db571e
Show file tree
Hide file tree
Showing 8 changed files with 476 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/RubyNative.js
Expand Up @@ -229,7 +229,10 @@ HotRuby.prototype.classes = {

"String" : {
"+" : function(recver, args) {
return this.createRubyString(recver.__native + args[0].__native);
if(typeof(args[0]) == "object")
return this.createRubyString(recver.__native + args[0].__native);
else
return this.createRubyString(recver.__native + args[0]);
},

"*" : function(recver, args) {
Expand Down
1 change: 1 addition & 0 deletions test/compile.bat
Expand Up @@ -7,5 +7,6 @@ goto end

:main
ruby compile.rb %1\%1.rb -o %1\%1.js -p %1\%1_pretty.json
copy %1\%1.js ..\web\js\test

:end
1 change: 1 addition & 0 deletions test/super2/super2.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions test/super2/super2.rb
@@ -0,0 +1,21 @@
class Pi
def initialize hoge, hoge2
@a = 352.0 + hoge + hoge2
@@c = 3
end
def getA
@a
end
end

class Pi2 < Pi
def initialize hoge, hoge2
super
@b = 110.0 + @@c
end
def calc
getA / @b
end
end

puts '335/113 = ' + Pi2.new(1, 2).calc

0 comments on commit 6db571e

Please sign in to comment.