IronRuby.Tests.Tests.DefineMethod2 C# (CSharp) Method

DefineMethod2() public method

define_method and class_eval change owner of the method definition.
public DefineMethod2 ( ) : void
return void
        public void DefineMethod2() {
            // TODO:
            TestOutput(@"
module M
  $p = lambda {    
    def goo
      def bar
        puts 'bar'
      end
    end  
  }      
end

class C
  define_method :foo,&$p
end

class D
 class_eval(&$p)
end

c = C.new
d = D.new

d.goo
c.foo
c.goo

p M.instance_methods(false).sort
p C.instance_methods(false).sort
p D.instance_methods(false).sort
", @"
#<NoMethodError: undefined method `goo' for #<C:0x24c5a00>>
[:goo]
[:foo]
[:bar, :goo]
");

        }
Tests