U:RDoc::AnyMethod[iI"method_missing:ETI"BasicObject#method_missing;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"IInvoked by Ruby when obj is sent a message it cannot handle. ;TI"Hsymbol is the symbol for the method called, and args ;TI"Kare any arguments that were passed to it. By default, the interpreter ;TI"Iraises an error when this method is called. However, it is possible ;TI">to override the method to provide more dynamic behavior. ;TI"KIf it is decided that a particular method should not be handled, then ;TI"Fsuper should be called, so that ancestors can pick up the ;TI"missing method. ;TI"The example below creates ;TI"Fa class Roman
, which responds to methods with names ;TI"Gconsisting of roman numerals, returning the corresponding integer ;TI"values.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"class Roman
;TI" def roman_to_int(str)
;TI" # ...
;TI" end
;TI"" def method_missing(methId)
;TI" str = methId.id2name
;TI" roman_to_int(str)
;TI" end
;TI" end
;TI"
;TI"r = Roman.new
;TI"r.iv #=> 4
;TI"r.xxiii #=> 23
;TI"r.mm #=> 2000;T:@format0:
@fileI"vm_eval.c;T:0@omit_headings_from_table_of_contents_below0I"7obj.method_missing(symbol [, *args] ) -> result
;T0[ I"(*args);T@*FI"BasicObject;TcRDoc::NormalClass00