ÿØÿà JFIF ÿÛ „ ( %!1!%)+//.383,7(-.+
-%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ ¥2" ÿÄ ÿÄ J ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ ÿÄ * !1AQa‘"2q3±ð#b¡ÿÚ ? ¼QxJQaÍuò¸Zö Úü8,ÐÚú
"SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁTÃÛ5
ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßwpŽF|È¥ù®häðÍѶ¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e
ríV
?>
.........................................
.............................................................................
ÿØÿà JFIF ÿÛ „
(
%!1!%)+//.383,7(-.+
-%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ ¥2" ÿÄ
ÿÄ J ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ
ÿÄ * !1AQa‘"2q3±ð#b¡ÿÚ
? ¼QxJQaÍuò¸Zö
Úü8,ÐÚú
"SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁTÃÛ5
ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßwpŽF|È¥ù®häðÍѶ¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e
ríV
?>
.........................................
.............................................................................
????????????????????????????????????
????????????????????????????????????
ÿØÿà JFIF ÿÛ „ ( %!1!%)+//.383,7(-.+
-%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ ¥2" ÿÄ ÿÄ J ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ ÿÄ * !1AQa‘"2q3±ð#b¡ÿÚ ? ¼QxJQaÍuò¸Zö Úü8,ÐÚú
"SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁTÃÛ5
ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßwpŽF|È¥ù®häðÍѶ¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e
ríV
?>
.........................................
.............................................................................
ÿØÿà JFIF ÿÛ „
(
%!1!%)+//.383,7(-.+
-%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ ¥2" ÿÄ
ÿÄ J ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ
ÿÄ * !1AQa‘"2q3±ð#b¡ÿÚ
? ¼QxJQaÍuò¸Zö
Úü8,ÐÚú
"SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁTÃÛ5
ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßwpŽF|È¥ù®häðÍѶ¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e
ríV
?>
.........................................
.............................................................................
????????????????????????????????????
????????????????????????????????????
U:RDoc::AnyMethod[iI"new:ETI"Struct::new;TT:publico:RDoc::Markup::Document:@parts[/o:RDoc::Markup::Paragraph; [I"OStruct.new returns a new subclass of +Struct+. The new subclass:;To:RDoc::Markup::BlankLine o:RDoc::Markup::List:
@type:BULLET:@items[o:RDoc::Markup::ListItem:@label0; [o;
; [I"BMay be anonymous, or may have the name given by +class_name+.;To;;0; [o;
; [I"1May have members as given by +member_names+.;To;;0; [o;
; [I"MMay have initialization via ordinary arguments, or via keyword arguments;T@o;
; [I">The new subclass has its own method ::new; thus:;T@o:RDoc::Markup::Verbatim; [I":Foo = Struct.new('Foo', :foo, :bar) # => Struct::Foo
;TI"Qf = Foo.new(0, 1) # => #
;T:@format0o;
; [I"\Class Name;T@o;
; [I"(With string argument +class_name+, ;TI"Sreturns a new subclass of +Struct+ named Struct::class_name:;T@o;; [I":Foo = Struct.new('Foo', :foo, :bar) # => Struct::Foo
;TI" "Struct::Foo"
;TI"5Foo.superclass # => Struct
;T;0o;
; [I"+Without string argument +class_name+, ;TI"2returns a new anonymous subclass of +Struct+:;T@o;; [I"*Struct.new(:foo, :bar).name # => nil
;T;0o;
; [I"Block;T@o;
; [I"FWith a block given, the created subclass is yielded to the block:;T@o;; [I"GCustomer = Struct.new('Customer', :name, :address) do |new_class|
;TI", p "The new subclass is #{new_class}"
;TI" def greeting
;TI"' "Hello #{name} at #{address}"
;TI" end
;TI")end # => Struct::Customer
;TI"-dave = Customer.new('Dave', '123 Main')
;TI"Ndave # => #
;TI"1dave.greeting # => "Hello Dave at 123 Main"
;T;0o;
; [I"&Output, from Struct.new:;T@o;; [I","The new subclass is Struct::Customer"
;T;0o;
; [I"Member Names;T@o;
; [I"%Symbol arguments +member_names+ ;TI"0determines the members of the new subclass:;T@o;; [I"=Struct.new(:foo, :bar).members # => [:foo, :bar]
;TI"=Struct.new('Foo', :foo, :bar).members # => [:foo, :bar]
;T;0o;
; [I"KThe new subclass has instance methods corresponding to +member_names+:;T@o;; [
I")Foo = Struct.new('Foo', :foo, :bar)
;TI"AFoo.instance_methods(false) # => [:foo, :bar, :foo=, :bar=]
;TI"Mf = Foo.new # => #
;TI"*f.foo # => nil
;TI"(f.foo = 0 # => 0
;TI"*f.bar # => nil
;TI"(f.bar = 1 # => 1
;TI"If # => #
;T;0o;
; [I"Singleton Methods;T@o;
; [I"CA subclass returned by Struct.new has these singleton methods:;T@o;;
;;[o;;0; [o;
; [I"A\Method ::new creates an instance of the subclass:;T@o;; [I"BFoo.new # => #
;TI"@Foo.new(0) # => #
;TI">Foo.new(0, 1) # => #
;TI"BFoo.new(0, 1, 2) # Raises ArgumentError: struct size differs
;TI"
;TI".# Initialization with keyword arguments:
;TI"GFoo.new(foo: 0) # => #
;TI"EFoo.new(foo: 0, bar: 1) # => #
;TI"%Foo.new(foo: 0, bar: 1, baz: 2)
;TI"3# Raises ArgumentError: unknown keywords: baz
;T;0o;;0; [o;
; [I"O\Method :inspect returns a string representation of the subclass:;T@o;; [I"Foo.inspect
;TI"# => "Struct::Foo"
;T;0o;;0; [o;
; [I"E\Method ::members returns an array of the member names:;T@o;; [I"#Foo.members # => [:foo, :bar]
;T;0o;
; [I"Keyword Argument;T@o;
; [I"PBy default, the arguments for initializing an instance of the new subclass ;TI"2can be both positional and keyword arguments.;T@o;
; [I"OOptional keyword argument keyword_init: allows to force only one ;TI"&type of arguments to be accepted:;T@o;; [I"?KeywordsOnly = Struct.new(:foo, :bar, keyword_init: true)
;TI"&KeywordsOnly.new(bar: 1, foo: 0)
;TI".# => #
;TI"KeywordsOnly.new(0, 1)
;TI"7# Raises ArgumentError: wrong number of arguments
;TI"
;TI"BPositionalOnly = Struct.new(:foo, :bar, keyword_init: false)
;TI"PositionalOnly.new(0, 1)
;TI"0# => #
;TI"(PositionalOnly.new(bar: 1, foo: 0)
;TI"C# => #1, :bar=>2}, bar=nil>
;TI"M# Note that no error is raised, but arguments treated as one hash value
;TI"
;TI"+# Same as not providing keyword_init:
;TI"5Any = Struct.new(:foo, :bar, keyword_init: nil)
;TI"Any.new(foo: 1, bar: 2)
;TI"%# => #
;TI"Any.new(1, 2)
;TI"$# => #;T;0:
@fileI"
struct.c;T:0@omit_headings_from_table_of_contents_below0I";Struct.new(*member_names, keyword_init: nil){|Struct_subclass| ... } -> Struct_subclass
Struct.new(class_name, *member_names, keyword_init: nil){|Struct_subclass| ... } -> Struct_subclass
Struct_subclass.new(*member_names) -> Struct_subclass_instance
Struct_subclass.new(**member_names) -> Struct_subclass_instance
;T0[ I"(*args, p2 = {});T@FI"Struct;TcRDoc::NormalClass00