D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
Data
/
Filename :
with-i.ri
back
Copy
U:RDoc::AnyMethod[iI" with:ETI"Data#with;TF:publico:RDoc::Markup::Document:@parts[ o:RDoc::Markup::Paragraph; [I"DReturns a shallow copy of +self+ --- the instance variables of ;TI";+self+ are copied, but not the objects they reference.;To:RDoc::Markup::BlankLine o; ; [ I"DIf the method is supplied any keyword arguments, the copy will ;TI"Dbe created with the respective field values updated to use the ;TI"Csupplied keyword argument values. Note that it is an error to ;TI"Dsupply a keyword that the Data class does not have as a member.;T@o:RDoc::Markup::Verbatim; [I"!Point = Data.define(:x, :y) ;TI" ;TI"$origin = Point.new(x: 0, y: 0) ;TI" ;TI"up = origin.with(x: 1) ;TI"right = origin.with(y: 1) ;TI""up_and_right = up.with(y: 1) ;TI" ;TI"-p origin # #<data Point x=0, y=0> ;TI"-p up # #<data Point x=1, y=0> ;TI"-p right # #<data Point x=0, y=1> ;TI"-p up_and_right # #<data Point x=1, y=1> ;TI" ;TI"Bout = origin.with(z: 1) # ArgumentError: unknown keyword: :z ;TI"isome_point = origin.with(1, 2) # ArgumentError: expected keyword arguments, got positional arguments;T:@format0: @fileI" struct.c;T:0@omit_headings_from_table_of_contents_below0I" with(**kwargs) -> instance ;T0[ I"(p1 = {});T@'FI" Data;TcRDoc::NormalClass00