I cannot reproduce this issue with IronRuby 1.1.3.0 on .NET 4.0.30319.235
It works as expected: ir.exe result is same as irb result.

Regards

From: Lewis Lin 
Sent: Thursday, June 30, 2011 9:58 PM
To: ironruby-core@rubyforge.org 
Subject: [Ironruby-core] Access Top Level methods

Hi,

I am trying to access top level method from the class definition in IronRuby 
scripts. Example:

def global_hi
end

class A
   def hi
      global_hi
   end
end

A.new.hi

The script executed in ScriptEngine throws a NoSuchMethodError.
I tried to ran the same code in iirb.exe It seems to behave the way I expected. 
But when I tried it in ir.exe, it throws the exception as well.
I investigate a little more and found out

irb(main):021:0> self.method(:global_hi)
=> #<Method: Object#global_hi>
and
in ir.exe as well as script engine
>>> self.method(:xx)
=> #<Method: Object(#<Class:#<Object:0x0000058>>)#xx>

Is there anyway to make the script behave like the one in iirb.exe?

Thanks,
Lewis



--------------------------------------------------------------------------------
_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core
_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to