| Server IP : 167.99.254.82 / Your IP : 216.73.216.76 Web Server : Apache System : Linux host.techisquad.com 5.15.0-187-generic #197-Ubuntu SMP Fri Jul 17 19:17:01 UTC 2026 x86_64 User : pawluxera ( 1011) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/share/ri/3.0.0/system/BasicObject/ |
Upload File : |
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 <i>obj</i> is sent a message it cannot handle. ;TI"H<i>symbol</i> is the symbol for the method called, and <i>args</i> ;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"F<i>super</i> should be called, so that ancestors can pick up the ;TI"missing method. ;TI"The example below creates ;TI"Fa class <code>Roman</code>, 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" ;TI") def method_missing(symbol, *args) ;TI" str = symbol.id2name ;TI" begin ;TI" roman_to_int(str) ;TI" rescue ;TI" super(symbol, *args) ;TI" end ;TI" end ;TI" end ;TI" ;TI"r = Roman.new ;TI"r.iv #=> 4 ;TI"r.xxiii #=> 23 ;TI"r.mm #=> 2000 ;TI" r.foo #=> NoMethodError;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@0FI"BasicObject;TcRDoc::NormalClass00