dup

obj.dup â an_object
Instance Public methods

Produces a shallow copy of objâthe instance variables of obj are copied, but not the objects they reference. dup copies the tainted state of obj. See also the discussion under Object#clone. In general, clone and dup may have different semantics in descendant classes. While clone is used to duplicate an object, including its internal state, dup typically uses the class of the descendant object to create the new instance.

This method may have class-specific behavior. If so, that behavior will be documented under the #initialize_copy method of the class.

doc_ruby_on_rails
2015-04-23 10:01:45
Comments
Leave a Comment

Please login to continue.