ÿØÿà JFIF    ÿÛ „ ( %!1!%*+...983,7(-.- U:RDoc::NormalClass[iI" Struct:ET@I" Object;To:RDoc::Markup::Document: @parts[o;;[: @fileI"$ext/json/lib/json/add/struct.rb;T:0@omit_headings_from_table_of_contents_below0o;;[5o:RDoc::Markup::Paragraph;[I"G\Class \Struct provides a convenient way to create a simple class ;TI"%that can store and fetch values.;To:RDoc::Markup::BlankLineo; ;[I"MThis example creates a subclass of +Struct+, Struct::Customer; ;TI"@the first argument, a string, is the name of the subclass; ;TI"Othe other arguments, symbols, determine the _members_ of the new subclass.;T@o:RDoc::Markup::Verbatim;[ I">Customer = Struct.new('Customer', :name, :address, :zip) ;TI"1Customer.name # => "Struct::Customer" ;TI"$Customer.class # => Class ;TI"%Customer.superclass # => Struct ;T: @format0o; ;[I"JCorresponding to each member are two methods, a writer and a reader, ;TI"!that store and fetch values:;T@o; ;[I"/methods = Customer.instance_methods false ;TI"Dmethods # => [:zip, :address=, :zip=, :address, :name, :name=] ;T;0o; ;[I"1An instance of the subclass may be created, ;TI"@and its members assigned values, via method ::new:;T@o; ;[I"Ejoe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345) ;TI"fjoe # => # ;T;0o; ;[I"+The member values may be managed thus:;T@o; ;[I""joe.name # => "Joe Smith" ;TI"joe.name = 'Joseph Smith' ;TI"%joe.name # => "Joseph Smith" ;T;0o; ;[I"UAnd thus; note that member name may be expressed as either a string or a symbol:;T@o; ;[I"%joe[:name] # => "Joseph Smith" ;TI"&joe[:name] = 'Joseph Smith, Jr.' ;TI"*joe['name'] # => "Joseph Smith, Jr." ;T;0o; ;[I"See Struct::new.;T@S:RDoc::Markup::Heading: leveli: textI"What's Here;T@o; ;[I"-First, what's elsewhere. \Class \Struct:;T@o:RDoc::Markup::List: @type: BULLET: @items[o:RDoc::Markup::ListItem: @label0;[o; ;[I"PInherits from {class Object}[Object.html#class-Object-label-What-27s+Here].;To;;0;[o; ;[I"ZIncludes {module Enumerable}[Enumerable.html#module-Enumerable-label-What-27s+Here], ;TI"1which provides dozens of additional methods.;T@o; ;[I">Here, class \Struct provides methods that are useful for:;T@o;;;;[ o;;0;[o; ;[I"]{Creating a Struct Subclass}[#class-Struct-label-Methods+for+Creating+a+Struct+Subclass];To;;0;[o; ;[I"9{Querying}[#class-Struct-label-Methods+for+Querying];To;;0;[o; ;[I";{Comparing}[#class-Struct-label-Methods+for+Comparing];To;;0;[o; ;[I"9{Fetching}[#class-Struct-label-Methods+for+Fetching];To;;0;[o; ;[I";{Assigning}[#class-Struct-label-Methods+for+Assigning];To;;0;[o; ;[I";{Iterating}[#class-Struct-label-Methods+for+Iterating];To;;0;[o; ;[I"={Converting}[#class-Struct-label-Methods+for+Converting];T@S;;i;I"+Methods for Creating a Struct Subclass;T@o;;: NOTE;[o;;[I" ::new;T;[o; ;[I"'Returns a new subclass of \Struct.;T@S;;i;I"Methods for Querying;T@o;;;;[o;;[I" #hash;T;[o; ;[I"#Returns the integer hash code.;To;;[I"#length, #size;T;[o; ;[I"#Returns the number of members.;T@S;;i;I"Methods for Comparing;T@o;;;;[o;;[I"{#==}[#method-i-3D-3D];T;[o; ;[I"8Returns whether a given object is equal to +self+, ;TI"0using == to compare member values.;To;;[I" #eql?;T;[o; ;[I"8Returns whether a given object is equal to +self+, ;TI"2using eql? to compare member values.;T@S;;i;I"Methods for Fetching;T@o;;;;[ o;;[I"#[];T;[o; ;[I";Returns the value associated with a given member name.;To;;[I"!#to_a, #values, #deconstruct;T;[o; ;[I"5Returns the member values in +self+ as an array.;To;;[I"#deconstruct_keys;T;[o; ;[I",Returns a hash of the name/value pairs ;TI"for given member names.;To;;[I" #dig;T;[o; ;[I"contains the encrypted password of the user as a String. ;TI"Kan 'x' is returned if shadow passwords are in use. An '*' is returned ;TI"0if the user cannot log in using a password.;To;;[I"uid;T;[o; ;[I"4contains the integer user ID (uid) of the user.;To;;[I"gid;T;[o; ;[I"Econtains the integer group ID (gid) of the user's primary group.;To;;[I"dir;T;[o; ;[I"Econtains the path to the home directory of the user as a String.;To;;[I" shell;T;[o; ;[I"Bcontains the path to the login shell of the user as a String.;T@S;;i;I"WThe following members below are optional, and must be compiled with special flags:;T@o;;;;[ o;;[I" gecos;T;[o; ;[ I"?contains a longer String description of the user, such as ;TI"Ja full name. Some Unix systems provide structured information in the ;TI"0gecos field, but this is system-dependent. ;TI"8must be compiled with +HAVE_STRUCT_PASSWD_PW_GECOS+;To;;[I" change;T;[o; ;[I"Wpassword change time(integer) must be compiled with +HAVE_STRUCT_PASSWD_PW_CHANGE+;To;;[I" quota;T;[o; ;[I"Mquota value(integer) must be compiled with +HAVE_STRUCT_PASSWD_PW_QUOTA+;To;;[I"age;T;[o; ;[I"Lpassword age(integer) must be compiled with +HAVE_STRUCT_PASSWD_PW_AGE+;To;;[I" class;T;[o; ;[I"Ruser access class(string) must be compiled with +HAVE_STRUCT_PASSWD_PW_CLASS+;To;;[I" comment;T;[o; ;[I"Jcomment(string) must be compiled with +HAVE_STRUCT_PASSWD_PW_COMMENT+;To;;[I" expire;T;[o; ;[I"Zaccount expiration time(integer) must be compiled with +HAVE_STRUCT_PASSWD_PW_EXPIRE+;T; I"ext/etc/etc.c;T; 0@…@cRDoc::NormalClass0U;[iI" Group;TI"Struct::Group;T;0o;;[ o; ;[I" Group;T@o; ;[I"QGroup is a Struct that is only available when compiled with +HAVE_GETGRENT+.;T@o; ;[I"/The struct contains the following members:;T@o;;;;[ o;;[I" name;T;[o; ;[I"0contains the name of the group as a String.;To;;[I" passwd;T;[o; ;[ I"