From: ts Date: 2004-06-06T19:31:56+09:00 Subject: Re: How to use "method_missing"? >>>>> "X" == Xiangrong Fang writes: X> irb(main):001:0> def NilClass.method_missing(m, *a) you have defined a singleton method for the object NilClass X> NoMethodError: undefined method `length' for nil:NilClass ruby search the method #length for the object nil, it then search the method #method_missing for the object nil and don't find it X> irb(main):007:0> def a.method_missing(m, *a) you have defined a singleton method for the object a X> irb(main):010:0> a.hello ruby search the method #length for the object a, it then search the method #method_missing for the object a and it find it conclusion : define the method #method_missing for nil class NilClass def method_missing(*a) nil end end Guy Decoux