>>>>> "N" == Neil Mc Laughlin <nml / fjserv.net> writes:

N> Is this a bug in ruby or have I missed something?

 #warn is a private method of Kernel

 When you call it, like a public method (i.e. B.warn), ruby don't find it
 and call #method_missing

 With #send ruby is able to find any methods (even private) and call it.

 For example

svg% cat b.rb
#!/usr/bin/ruby
class A
   class << self
      def method_missing(*args)
         puts "method_missing : #{args}"
      end

      private
      def tt(*args)
         puts "tt : #{args}"
      end
   end
end

A.tt(1, 2)
A.send(:tt, 3, 4)
svg%
 
svg% b.rb
method_missing : tt12
tt : 34
svg% 


Guy Decoux