(someobject).methods-1.methods pre>This is great for viewing only the content provided by the Java object instead of APIDoc.
So, if you are willing to patch HotSpot, I believe you can set off a Java-like thing :-)
As for you Basic introspection, it just works™:
require'java'
java.lang.String.public_instance_methods.sort.reject {|m| m =~ /[_?!=~<>]/ }
# => [:bytes, :charAt, :class, :clone, :codePointAt, :codePointBefore,
# => :codePointCount, :com , :compareTo, :compareToIgnoreCase, :concat,
# => :contains, :contentEquals, :display, :dup, :empty, :endsWith, :equals,
# => :equalsIgnoreCase, :extend , :finalize, :freeze, :getBytes, :getChars,
# => :getClass, :hash, :hashCode, :id, :indexOf, :initialize, :inspect, :intern,
# = > :isE mpty, :java, :javax, :lastIndexOf, :length, :matches, :method,
# => :methods, :notify, :notifyAll, :offsetByCodePoints, :org, :regionMatches,
# => :replace, :replaceAll, :replaceFirst, :send, :split, :startsWith,
# => :subSequence, :substring, :synchronized, :taint, :tap, :toCharArray,
# => :toLowerCase, :toString, :toUpperCase, :trim, :trust, :type, :untaint,
# => :untrust, :wait]
Of course, one point of JRuby is Integrate Java and Ruby object models as much as possible, so we actually get Java and Ruby methods here, but reject all methods with unusual or very illegal characters. Java, we get a fairly clean list, and the rest Ruby methods are not difficult to find.
Is there a way to introspect a Java object from J Ruby and find its Java-land method? Like provided by http://github.com/oggy/looksee, but for Java. Or like
(someobject).methods-1.methods pre>This is great for just viewing the content provided by the Java object instead of APIDoc.
Looksee patched the interpreter, this is Why it only applies to MRI and YARV, but not to JRuby, XRuby, IronRuby, Ruby.NET, Rubinius, tinyrb, RubyGoLightly, MacRuby, HotRuby, BlueRuby, Cardinal, MagLev, SmallRuby, Red Sun and all other implementations.
So, if you are willing to patch HotSpot, I believe you can whip up something similar to Java:-)
As for your basic introspection, it just works™:
p>require'java'
java.lang.String.public_instance_methods.sort.reject {|m| m =~ /[_?!=~<>]/}
# => [:bytes, :charAt, :class, :clone, :codePointAt, :codePointBefore,
# => :codePointCount, :com, :compareTo, :compareToIgnoreCase, :concat,
# => :contains, :contentEquals, :display, :dup, :empty, :endsWith, :equals,
# => :equalsIgnoreCase, :extend, :finalize, :freeze, :getBytes, :getChars ,
# => :getClass, :hash, :hashCode, :id, :indexOf, :initialize, :inspect, :intern,
# => :isEmpty, :java, :javax, :lastIndexOf , :length, :matches, :metho d,
# => :methods, :notify, :notifyAll, :offsetByCodePoints, :org, :regionMatches,
# => :replace, :replaceAll, :replaceFirst, :send, :split,: startsWith,
# => :subSequence, :substring, :synchronized, :taint, :tap, :toCharArray,
# => :toLowerCase, :toString, :toUpperCase, :trim, :trust,: type, :untaint,
# => :untrust, :wait]Of course, one of JRuby's main points is to integrate Java and Ruby object models as much as possible, so we actually get it here Java and Ruby methods, but reject all methods with unusual or very illegal characters. Java, we get a fairly clean list, and the remaining Ruby methods are not difficult to find.