Gestionnaire de fichiers - Editer - /opt/cpanel/ea-ruby24/root/usr/share/ri/system/Object/dup-i.ri
Arrière
U:RDoc::AnyMethod[iI"dup:ETI"Object#dup;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"GProduces a shallow copy of <i>obj</i>---the instance variables of ;TI"@<i>obj</i> are copied, but not the objects they reference. ;TI"=<code>dup</code> copies the tainted state of <i>obj</i>.;To:RDoc::Markup::BlankLine o; ; [I"@This method may have class-specific behavior. If so, that ;TI"Hbehavior will be documented under the #+initialize_copy+ method of ;TI"the class.;T@S:RDoc::Markup::Heading: leveli: textI"on dup vs clone;T@o; ; [ I"LIn general, <code>clone</code> and <code>dup</code> may have different ;TI"Jsemantics in descendant classes. While <code>clone</code> is used to ;TI"Iduplicate an object, including its internal state, <code>dup</code> ;TI"Itypically uses the class of the descendant object to create the new ;TI"instance.;T@o; ; [I"RWhen using #dup, any modules that the object has been extended with will not ;TI"be copied.;T@o:RDoc::Markup::Verbatim; [I"class Klass ;TI" attr_accessor :str ;TI" end ;TI" ;TI"module Foo ;TI" def foo; 'foo'; end ;TI" end ;TI" ;TI",s1 = Klass.new #=> #<Klass:0x401b3a38> ;TI",s1.extend(Foo) #=> #<Klass:0x401b3a38> ;TI"s1.foo #=> "foo" ;TI" ;TI"+s2 = s1.clone #=> #<Klass:0x401b3a38> ;TI"s2.foo #=> "foo" ;TI" ;TI")s3 = s1.dup #=> #<Klass:0x401b3a38> ;TI"Ms3.foo #=> NoMethodError: undefined method `foo' for #<Klass:0x401b3a38>;T:@format0: @fileI" object.c;T:0@omit_headings_from_table_of_contents_below0I"obj.dup -> an_object ;T0[ I"();T@6FI"Object;TcRDoc::NormalClass00
| ver. 1.4 |
Github
|
.
| PHP 8.0.30 | Génération de la page: 0.57 |
proxy
|
phpinfo
|
Réglages