-
Website
http://www.dcmanges.com/blog -
Original page
http://www.dcmanges.com/blog/the-power-of-implementing-ruby-in-ruby -
Subscribe
All Comments -
Community
-
Top Commenters
-
thelucid
3 comments · 1 points
-
jamiew
2 comments · 6 points
-
Daniel Ha
1 comment · 407 points
-
floehopper
1 comment · 1 points
-
leed25d
1 comment · 1 points
-
-
Popular Threads
<pre>
require 'java'
require 'jruby'
def examine(obj)
real = JRuby.reference(obj)
realclass = JRuby.reference(real.meta_class)
while realclass
p realclass
break unless realclass.super_class
realclass = JRuby.reference(realclass.super_class)
end
end
object = Class.new { def foo; 'foo from object'; end }.new
mixin = Module.new { def foo; 'foo from mixin'; end }
object.extend(mixin)
examine(object)
</pre>
In JRuby, as in Rubinius, all objects can be accessed as "just objects". So the same capabilities apply.