Gestionnaire de fichiers - Editer - /opt/cpanel/ea-ruby24/root/usr/share/ri/system/UnboundMethod/cdesc-UnboundMethod.ri
Arrière
U:RDoc::NormalClass[iI"UnboundMethod:ET@I"Object;To:RDoc::Markup::Document:@parts[o;;[o:RDoc::Markup::Paragraph;[ I";Ruby supports two forms of objectified methods. Class ;TI"J<code>Method</code> is used to represent methods that are associated ;TI"Fwith a particular object: these method objects are bound to that ;TI"Eobject. Bound method objects for an object can be created using ;TI" <code>Object#method</code>.;To:RDoc::Markup::BlankLine o; ;[ I"FRuby also supports unbound methods; methods objects that are not ;TI"Iassociated with a particular object. These can be created either by ;TI"?calling <code>Module#instance_method</code> or by calling ;TI"I<code>unbind</code> on a bound method object. The result of both of ;TI"3these is an <code>UnboundMethod</code> object.;T@o; ;[I"CUnbound methods can only be called after they are bound to an ;TI"Bobject. That object must be a kind_of? the method's original ;TI"class.;T@o:RDoc::Markup::Verbatim;[I"class Square ;TI" def area ;TI" @side * @side ;TI" end ;TI" def initialize(side) ;TI" @side = side ;TI" end ;TI" end ;TI" ;TI"-area_un = Square.instance_method(:area) ;TI" ;TI"s = Square.new(12) ;TI"area = area_un.bind(s) ;TI"area.call #=> 144 ;T:@format0o; ;[I"FUnbound methods are a reference to the method at the time it was ;TI"Fobjectified: subsequent changes to the underlying class will not ;TI"affect the unbound method.;T@o;;[I"class Test ;TI" def test ;TI" :original ;TI" end ;TI" end ;TI"&um = Test.instance_method(:test) ;TI"class Test ;TI" def test ;TI" :modified ;TI" end ;TI" end ;TI"t = Test.new ;TI"%t.test #=> :modified ;TI"$um.bind(t).call #=> :original;T;0: @fileI"proc.c;T:0@omit_headings_from_table_of_contents_below0; 0;0[ [ [ [[I" class;T[[:public[ [:protected[ [:private[ [I" instance;T[[;[[I"==;TI"proc.c;T[I" arity;T@[[I" bind;T@[[I" clone;T@[[I" eql?;T@[[I" hash;T@[[I"inspect;T@[[I" name;T@[[I"original_name;T@[[I" owner;T@[[I"parameters;T@[[I"source_location;T@[[I"super_method;T@[[I" to_s;T@[[;[ [;[ [ [U:RDoc::Context::Section[i 0o;;[ ; 0;0[@F@FcRDoc::TopLevel
| ver. 1.4 |
Github
|
.
| PHP 8.0.30 | Génération de la page: 0 |
proxy
|
phpinfo
|
Réglages