⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.133
Server IP:
185.119.109.197
Server:
Linux managedhosting.chostar.me 5.15.0-160-generic #170-Ubuntu SMP Wed Oct 1 10:06:56 UTC 2025 x86_64
Server Software:
Apache
PHP Version:
8.1.33
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
ri
/
3.0.0
/
system
/
Module
/
View File Name :
define_method-i.ri
U:RDoc::AnyMethod[iI"define_method:ETI"Module#define_method;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I">Defines an instance method in the receiver. The _method_ ;TI"Iparameter can be a +Proc+, a +Method+ or an +UnboundMethod+ object. ;TI"=If a block is specified, it is used as the method body. ;TI":If a block or the _method_ parameter has parameters, ;TI"(they're used as method parameters. ;TI"2This block is evaluated using #instance_eval.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I" class A ;TI" def fred ;TI" puts "In Fred" ;TI" end ;TI"' def create_method(name, &block) ;TI"0 self.class.define_method(name, &block) ;TI" end ;TI"3 define_method(:wilma) { puts "Charge it!" } ;TI": define_method(:flint) {|name| puts "I'm #{name}!"} ;TI" end ;TI"class B < A ;TI"6 define_method(:barney, instance_method(:fred)) ;TI" end ;TI"a = B.new ;TI"a.barney ;TI" a.wilma ;TI"a.flint('Dino') ;TI"(a.create_method(:betty) { p self } ;TI" a.betty ;T:@format0o; ; [I"
produces:
;T@o;; [ I" In Fred ;TI"Charge it! ;TI"I'm Dino! ;TI"#
;T; 0: @fileI"proc.c;T:0@omit_headings_from_table_of_contents_below0I"]define_method(symbol, method) -> symbol define_method(symbol) { block } -> symbol ;T0[ I"(*args);T@2FI"Module;TcRDoc::NormalClass00