Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
ruby / usr / share / ri / 2.2.0 / system / Struct / new-c.ri
Size: Mime:
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"<constant also gives the class the name of the constant.;T@o:RDoc::Markup::Verbatim;	[
I"3# Create a structure with a name under Struct
;TI"-Struct.new("Customer", :name, :address)
;TI"#=> Struct::Customer
;TI".Struct::Customer.new("Dave", "123 Main")
;TI"D#=> #<struct Struct::Customer name="Dave", address="123 Main">
;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"CCustomer.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"0# Create a structure named by its constant
;TI",Customer = Struct.new(:name, :address)
;TI"#=> Customer
;TI"&Customer.new("Dave", "123 Main")
;TI";#=> #<struct Customer name="Dave", address="123 Main">;T;
0:
@fileI"
struct.c;T:0@omit_headings_from_table_of_contents_below0I"4Struct.new([class_name] [, member_name]+>)                        -> StructClass
Struct.new([class_name] [, member_name]+>) {|StructClass| block } -> StructClass
StructClass.new(value, ...)                                       -> obj
StructClass[value, ...]                                           -> obj
;T0[I"(*args);T@=FI"Struct;TcRDoc::NormalClass00