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

JRuby 1.9 returns public_methods as an array of symbols, while 1.8 returns an array of strings. Normalize to an array of symbols.

This commit is contained in:
Alex Wolfe 2011-09-27 09:57:40 -05:00
parent 11d294da4c
commit 7073412013

View file

@ -38,8 +38,8 @@ module Rhino
if name == "toString"
return RubyFunction.new(lambda { "[Ruby #{robject.class.name}]"})
end
rb_name = name.gsub(/([a-z])([A-Z])/) {"#{$1}_#{$2.downcase}"}
if (robject.public_methods(false).include?(rb_name))
rb_name = name.gsub(/([a-z])([A-Z])/) {"#{$1}_#{$2.downcase}"}.to_sym
if (robject.public_methods(false).collect(&:to_sym).include?(rb_name))
method = robject.method(rb_name)
if method.arity == 0
To.javascript(method.call)
@ -52,12 +52,11 @@ module Rhino
end
def has(name, start)
rb_name = name.gsub(/([a-z])([A-Z])/) {"#{$1}_#{$2.downcase}"}
To.ruby(start).public_methods(false).respond_to?(rb_name) ? true : super(name,start)
rb_name = name.gsub(/([a-z])([A-Z])/) {"#{$1}_#{$2.downcase}"}.to_sym
To.ruby(start).public_methods(false).collect(&:to_sym).key?(rb_name) ? true : super(name,start)
end
Generic = new
end
end
end