U:RDoc::AnyMethod[iI"new:ETI"Struct::new;TT: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"OThe first two forms are used to create a new Struct subclass +class_name+ ;TI"Lthat can contain a value for each +member_name+. This subclass can be ;TI"Dused to create instances of the structure like any other Class.;To:RDoc::Markup::BlankLineo; ; [ I"IIf the +class_name+ is omitted an anonymous structure class will be ;TI"Ocreated. Otherwise, the name of this struct will appear as a constant in ;TI"Jclass Struct, so it must be unique for all Structs in the system and ;TI"Imust start with a capital letter. Assigning a structure class to a ;TI" Struct::Customer ;TI".Struct::Customer.new("Dave", "123 Main") ;TI"D#=> # ;TI" ;TI"0# Create a structure named by its constant ;TI",Customer = Struct.new(:name, :address) ;TI"#=> Customer ;TI"&Customer.new("Dave", "123 Main") ;TI"<#=> # ;T: @format0o; ; [I"@If a block is given it will be evaluated in the context of ;TI"=+StructClass+, passing the created class as a parameter:;T@o; ; [ I"/Customer = Struct.new(:name, :address) do ;TI" def greeting ;TI" "Hello #{name}!" ;TI" end ;TI" end ;TI"BCustomer.new("Dave", "123 Main").greeting #=> "Hello Dave!" ;T; 0o; ; [I"HThis is the recommended way to customize a struct. Subclassing an ;TI"Oanonymous struct creates an extra anonymous class that will never be used.;T@o; ; [ I"PThe last two forms create a new instance of a struct subclass. The number ;TI"Gof +value+ parameters must be less than or equal to the number of ;TI"Oattributes defined for the structure. Unset parameters default to +nil+. ;TI"BPassing more parameters than number of attributes will raise ;TI"an ArgumentError.;T@o; ; [ I",Customer = Struct.new(:name, :address) ;TI"&Customer.new("Dave", "123 Main") ;TI"<#=> # ;TI"Customer["Dave"] ;TI"4#=> #;T; 0: @fileI" struct.c;T:0@omit_headings_from_table_of_contents_below0I"6Struct.new([class_name] [, member_name]+) -> StructClass Struct.new([class_name] [, member_name]+) {|StructClass| block } -> StructClass StructClass.new(value, ...) -> object StructClass[value, ...] -> object ;T0[I" (*args);T@CFI" Struct;TcRDoc::NormalClass00