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:
parent
11d294da4c
commit
7073412013
1 changed files with 4 additions and 5 deletions
|
@ -38,8 +38,8 @@ module Rhino
|
||||||
if name == "toString"
|
if name == "toString"
|
||||||
return RubyFunction.new(lambda { "[Ruby #{robject.class.name}]"})
|
return RubyFunction.new(lambda { "[Ruby #{robject.class.name}]"})
|
||||||
end
|
end
|
||||||
rb_name = name.gsub(/([a-z])([A-Z])/) {"#{$1}_#{$2.downcase}"}
|
rb_name = name.gsub(/([a-z])([A-Z])/) {"#{$1}_#{$2.downcase}"}.to_sym
|
||||||
if (robject.public_methods(false).include?(rb_name))
|
if (robject.public_methods(false).collect(&:to_sym).include?(rb_name))
|
||||||
method = robject.method(rb_name)
|
method = robject.method(rb_name)
|
||||||
if method.arity == 0
|
if method.arity == 0
|
||||||
To.javascript(method.call)
|
To.javascript(method.call)
|
||||||
|
@ -52,12 +52,11 @@ module Rhino
|
||||||
end
|
end
|
||||||
|
|
||||||
def has(name, start)
|
def has(name, start)
|
||||||
rb_name = name.gsub(/([a-z])([A-Z])/) {"#{$1}_#{$2.downcase}"}
|
rb_name = name.gsub(/([a-z])([A-Z])/) {"#{$1}_#{$2.downcase}"}.to_sym
|
||||||
To.ruby(start).public_methods(false).respond_to?(rb_name) ? true : super(name,start)
|
To.ruby(start).public_methods(false).collect(&:to_sym).key?(rb_name) ? true : super(name,start)
|
||||||
end
|
end
|
||||||
|
|
||||||
Generic = new
|
Generic = new
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue