(A) If I do this:

  class Module
    def foo
      p self
      Foo.__send__(:eval, "def bar; puts 'bar'; end")
    end
  end

  class Foo
    foo
  end

  f = Foo.new
  Module.bar
  f.bar

Then I get:

  Foo
  bar
  test.rb:13: undefined method `bar' for #<Foo:0x4027a784> (NameError)

(B) However if I do this:

  class Foo
  end

  Foo.__send__(:eval, "def bar; puts 'bar'; end")
  f = Foo.new
  Module.bar
  f.bar

Then from irb I get:
  NameError: private method `bar' called for Module:Class
  NameError: private method `bar' called for #<Foo:0x402affa0>

(C) However if I do this:

  class Foo
  end

  f = Foo.new
  Module.bar
  f.bar

Then from irb I get exactly what I would expect:
  NameError: undefined method `bar' for Module:Class
  NameError: undefined method `bar' for #<Foo:0x40334f9c>

(D) Lastly, if I do this:

  class Foo
  end
  Foo.freeze

  Foo.__send__(:eval, "def bar; puts 'bar'; end")

  f = Foo.new
  f.bar

Then I get this:
  NameError: private method `bar' called for #<Foo:0x402a733c>

So the questions are:

1) Why in (A) does bar get defined for Module but not for Foo?
2) Why in (B) does bar get defined for both Module and Foo, and why is it
private?
3) Why in (D) does Ruby allow me to modify a frozen class, and why is the
resulting method private?

Paul