⚝
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 :
~
/
proc
/
self
/
root
/
usr
/
share
/
ri
/
3.0.0
/
system
/
Object
/
View File Name :
dup-i.ri
U:RDoc::AnyMethod[iI"dup:ETI"Object#dup;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"GProduces a shallow copy of
obj
---the instance variables of ;TI"?
obj
are copied, but not the objects they reference.;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"AIn general, #clone and #dup may have different semantics in ;TI"Fdescendant classes. While #clone is used to duplicate an object, ;TI"Hincluding its internal state, #dup typically uses the class of the ;TI"2descendant object to create the new 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 #=> #
;TI",s1.extend(Foo) #=> #
;TI"s1.foo #=> "foo" ;TI" ;TI"+s2 = s1.clone #=> #
;TI"s2.foo #=> "foo" ;TI" ;TI")s3 = s1.dup #=> #
;TI"Ms3.foo #=> NoMethodError: undefined method `foo' for #
;T:@format0: @fileI" object.c;T:0@omit_headings_from_table_of_contents_below0I"obj.dup -> an_object ;T0[ I"();T@4FI"Object;TcRDoc::NormalClass00