ÿØÿà JFIF ÿÛ „ ( %!1!%*+...983,7(-.-
each_pair-i.ri 0000644 00000001255 15236142455 0007253 0 ustar 00 U:RDoc::AnyMethod[iI"each_pair:EFI"OpenStruct#each_pair;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"MYields all attributes (as a symbol) along with the corresponding values ;TI"5or returns an enumerator if not block is given. ;TI"
Example:;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"require 'ostruct'
;TI"Pdata = OpenStruct.new("country" => "Australia", :population => 20_000_000)
;TI"Qdata.each_pair.to_a # => [[:country, "Australia"], [:population, 20000000]];T:@format0:
@fileI"lib/ostruct.rb;T:0@omit_headings_from_table_of_contents_below00I"p;T[ I"();T@FI"OpenStruct;TcRDoc::NormalClass00 dig-i.ri 0000644 00000001614 15236142455 0006102 0 ustar 00 U:RDoc::AnyMethod[iI"dig:ETI"OpenStruct#dig;TF:privateo:RDoc::Markup::Document:@parts[ o:RDoc::Markup::Paragraph; [ I"4Finds and returns the object in nested objects ;TI"4that is specified by +name+ and +identifiers+. ;TI"=The nested objects may be instances of various classes. ;TI"2See {Dig Methods}[rdoc-ref:dig_methods.rdoc].;To:RDoc::Markup::BlankLine o;
; [I"Examples:;To:RDoc::Markup::Verbatim; [
I"require "ostruct"
;TI"Faddress = OpenStruct.new("city" => "Anytown NC", "zip" => 12345)
;TI"Lperson = OpenStruct.new("name" => "John Smith", "address" => address)
;TI",person.dig(:address, "zip") # => 12345
;TI"2person.dig(:business_address, "zip") # => nil;T:@format0:
@fileI"lib/ostruct.rb;T:0@omit_headings_from_table_of_contents_below0I"/ostruct.dig(name, *identifiers) -> object
;T0[ I"(name, *names);T@FI"OpenStruct;TcRDoc::NormalClass00 inspect-i.ri 0000644 00000000565 15236142455 0007010 0 ustar 00 U:RDoc::AnyMethod[iI"inspect:EFI"OpenStruct#inspect;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"KReturns a string containing a detailed summary of the keys and values.;T:
@fileI"lib/ostruct.rb;T:0@omit_headings_from_table_of_contents_below000[[I" to_s;To;; [ ;@;0I"();T@FI"OpenStruct;TcRDoc::NormalClass00 json_create-c.ri 0000644 00000000654 15236142455 0007630 0 ustar 00 U:RDoc::AnyMethod[iI"json_create:EFI"OpenStruct::json_create;TT:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"LDeserializes JSON string by constructing new Struct object with values ;TI"/v serialized by to_json.;T:
@fileI"%ext/json/lib/json/add/ostruct.rb;T:0@omit_headings_from_table_of_contents_below000[ I"
(object);T@FI"OpenStruct;TcRDoc::NormalClass00 eql%3f-i.ri 0000644 00000000671 15236142455 0006420 0 ustar 00 U:RDoc::AnyMethod[iI" eql?:EFI"OpenStruct#eql?;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"NCompares this object and +other+ for equality. An OpenStruct is eql? to ;TI"P+other+ when +other+ is an OpenStruct and the two objects' Hash tables are ;TI"
eql?.;T:
@fileI"lib/ostruct.rb;T:0@omit_headings_from_table_of_contents_below000[ I"(other);T@FI"OpenStruct;TcRDoc::NormalClass00 new-c.ri 0000644 00000001466 15236142455 0006127 0 ustar 00 U:RDoc::AnyMethod[iI"new:ETI"OpenStruct::new;TT:publico:RDoc::Markup::Document:@parts[
o:RDoc::Markup::Paragraph; [I"LCreates a new OpenStruct object. By default, the resulting OpenStruct ;TI"$object will have no attributes.;To:RDoc::Markup::BlankLine o;
; [I"HThe optional +hash+, if given, will generate attributes and values ;TI"1(can be a Hash, an OpenStruct or a Struct). ;TI"For example:;T@o:RDoc::Markup::Verbatim; [
I"require 'ostruct'
;TI"Dhash = { "country" => "Australia", :population => 20_000_000 }
;TI"!data = OpenStruct.new(hash)
;TI"
;TI"Lp data # -> ;T:@format0:
@fileI"lib/ostruct.rb;T:0@omit_headings_from_table_of_contents_below000[ I"(hash=nil);T@FI"OpenStruct;TcRDoc::NormalClass00 freeze-i.ri 0000644 00000000354 15236142455 0006617 0 ustar 00 U:RDoc::AnyMethod[iI"freeze:ETI"OpenStruct#freeze;TF:privateo:RDoc::Markup::Document:@parts[ :
@fileI"lib/ostruct.rb;T:0@omit_headings_from_table_of_contents_below000[ I"();T@TI"OpenStruct;TcRDoc::NormalClass00 set_ostruct_member_value%21-i.ri 0000644 00000000453 15236142455 0012650 0 ustar 00 U:RDoc::AnyMethod[iI"set_ostruct_member_value!:ETI")OpenStruct#set_ostruct_member_value!;TF:privateo:RDoc::Markup::Document:@parts[ :
@fileI"lib/ostruct.rb;T:0@omit_headings_from_table_of_contents_below000[ I"(name, value);T@FI"OpenStruct;TcRDoc::NormalClass0[@FI"[]=;T %5b%5d-i.ri 0000644 00000000742 15236142455 0006211 0 ustar 00 U:RDoc::AnyMethod[iI"[]:EFI"OpenStruct#[];TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"#Returns the value of a member.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"Bperson = OpenStruct.new('name' => 'John Smith', 'age' => 70)
;TI".person[:age] # => 70, same as ostruct.age;T:@format0:
@fileI"lib/ostruct.rb;T:0@omit_headings_from_table_of_contents_below000[ I"(name);T@FI"OpenStruct;TcRDoc::NormalClass00 cdesc-OpenStruct.ri 0000644 00000006655 15236142455 0010310 0 ustar 00 U:RDoc::NormalClass[iI"OpenStruct:ET@I"Object;To:RDoc::Markup::Document:@parts[o;;[o:RDoc::Markup::Paragraph;[I"-OpenStruct serialization/deserialization;T:
@fileI"%ext/json/lib/json/add/ostruct.rb;T:0@omit_headings_from_table_of_contents_below0o;;[o; ;[ I"KAn OpenStruct is a data structure, similar to a Hash, that allows the ;TI"Pdefinition of arbitrary attributes with their accompanying values. This is ;TI"Qaccomplished by using Ruby's metaprogramming to define methods on the class ;TI"itself.;To:RDoc::Markup::BlankLine S:RDoc::Markup::Heading:
leveli: textI"Examples:;T@o:RDoc::Markup::Verbatim;[I"require 'ostruct'
;TI"
;TI"person = OpenStruct.new
;TI"#person.name = "John Smith"
;TI"person.age = 70
;TI"person.pension = 300
;TI"
;TI",puts person.name # -> "John Smith"
;TI""puts person.age # -> 70
;TI"#puts person.address # -> nil
;T:@format0o; ;[I"QAn OpenStruct employs a Hash internally to store the methods and values and ;TI"&can even be initialized with one:;T@o;;[I"Taustralia = OpenStruct.new(:country => "Australia", :population => 20_000_000)
;TI"Mp australia # ->
;T;0o; ;[ I"THash keys with spaces or characters that would normally not be able to use for ;TI"Hmethod calls (e.g. ()[]*) will not be immediately available on the ;TI"TOpenStruct object as a method for retrieval or assignment, but can be still be ;TI",reached through the Object#send method.;T@o;;[I"?measurements = OpenStruct.new("length (in inches)" => 24)
;TI"6measurements.send("length (in inches)") # -> 24
;TI"
;TI"3data_point = OpenStruct.new(:queued? => true)
;TI"8data_point.queued? # -> true
;TI"'data_point.send("queued?=",false)
;TI"9data_point.queued? # -> false
;T;0o; ;[I"ORemoving the presence of a method requires the execution the delete_field ;TI"Nmethod as setting the property value to +nil+ will not remove the method.;T@o;;[
I"Jfirst_pet = OpenStruct.new(:name => 'Rowdy', :owner => 'John Smith')
;TI"first_pet.owner = nil
;TI"3second_pet = OpenStruct.new(:name => 'Rowdy')
;TI"
;TI"*first_pet == second_pet # -> false
;TI"
;TI"$first_pet.delete_field(:owner)
;TI")first_pet == second_pet # -> true
;T;0S;
;i;I"Implementation:;T@o; ;[I"RAn OpenStruct utilizes Ruby's method lookup structure to find and define the ;TI"Onecessary methods for properties. This is accomplished through the method ;TI"&method_missing and define_method.;T@o; ;[I"SThis should be a consideration if there is a concern about the performance of ;TI"Qthe objects that are created, as there is much more overhead in the setting ;TI">of these properties compared to using a Hash or a Struct.;T;
I"lib/ostruct.rb;T;0;
0;0[ [ [ [[I"
class;T[[:public[[I"json_create;FI"%ext/json/lib/json/add/ostruct.rb;T[I"new;TI"lib/ostruct.rb;T[:protected[ [:private[ [I"
instance;T[[;[[I"==;T@h[I"[];F@h[I"[]=;F@h[I"as_json;F@e[I"delete_field;F@h[I"each_pair;F@h[I" eql?;F@h[I" hash;F@h[I"initialize_copy;F@h[I"inspect;F@h[I"marshal_dump;F@h[I"marshal_load;F@h[I" to_h;F@h[I"to_json;F@e[I" to_s;T@h[;[[I"modifiable;F@h[I"new_ostruct_member;F@h[;[ [ [U:RDoc::Context::Section[i 0o;;[ ;
0;0[@@Y@YcRDoc::TopLevel as_json-i.ri 0000644 00000000576 15236142455 0007001 0 ustar 00 U:RDoc::AnyMethod[iI"as_json:EFI"OpenStruct#as_json;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"OReturns a hash, that will be turned into a JSON object and represent this ;TI"object.;T:
@fileI"%ext/json/lib/json/add/ostruct.rb;T:0@omit_headings_from_table_of_contents_below000[ I"(*);T@FI"OpenStruct;TcRDoc::NormalClass00 to_json-i.ri 0000644 00000000606 15236142455 0007012 0 ustar 00 U:RDoc::AnyMethod[iI"to_json:EFI"OpenStruct#to_json;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"NStores class name (OpenStruct) with this struct's values v as a ;TI"JSON string.;T:
@fileI"%ext/json/lib/json/add/ostruct.rb;T:0@omit_headings_from_table_of_contents_below000[ I"(*args);T@FI"OpenStruct;TcRDoc::NormalClass00 to_s-i.ri 0000644 00000000371 15236142455 0006302 0 ustar 00 U:RDoc::AnyMethod[iI" to_s:ETI"OpenStruct#to_s;TF:publico:RDoc::Markup::Document:@parts[ :
@fileI"lib/ostruct.rb;T:0@omit_headings_from_table_of_contents_below000[ I"();T@FI"OpenStruct;TcRDoc::NormalClass0[@FI"inspect;F %5b%5d%3d-i.ri 0000644 00000001016 15236142455 0006500 0 ustar 00 U:RDoc::AnyMethod[iI"[]=:EFI"OpenStruct#[]=;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I" Sets the value of a member.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"Bperson = OpenStruct.new('name' => 'John Smith', 'age' => 70)
;TI";person[:age] = 42 # => equivalent to ostruct.age = 42
;TI"person.age # => 42;T:@format0:
@fileI"lib/ostruct.rb;T:0@omit_headings_from_table_of_contents_below000[ I"(name, value);T@FI"OpenStruct;TcRDoc::NormalClass00 delete_field-i.ri 0000644 00000001162 15236142455 0007742 0 ustar 00 U:RDoc::AnyMethod[iI"delete_field:EFI"OpenStruct#delete_field;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"NRemove the named field from the object. Returns the value that the field ;TI"!contained if it was defined.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [
I"require 'ostruct'
;TI"
;TI"Bperson = OpenStruct.new('name' => 'John Smith', 'age' => 70)
;TI"
;TI"3person.delete_field('name') # => 'John Smith';T:@format0:
@fileI"lib/ostruct.rb;T:0@omit_headings_from_table_of_contents_below000[ I"(name);T@FI"OpenStruct;TcRDoc::NormalClass00 to_h-i.ri 0000644 00000001220 15236142455 0006261 0 ustar 00 U:RDoc::AnyMethod[iI" to_h:EFI"OpenStruct#to_h;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I">Converts the OpenStruct to a hash with keys representing ;TI"@each attribute (as symbols) and their corresponding values ;TI"
Example:;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"require 'ostruct'
;TI"Pdata = OpenStruct.new("country" => "Australia", :population => 20_000_000)
;TI"Idata.to_h # => {:country => "Australia", :population => 20000000 };T:@format0:
@fileI"lib/ostruct.rb;T:0@omit_headings_from_table_of_contents_below000[ I"();T@FI"OpenStruct;TcRDoc::NormalClass00 %3d%3d-i.ri 0000644 00000000667 15236142455 0006215 0 ustar 00 U:RDoc::AnyMethod[iI"==:ETI"OpenStruct#==;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"OCompares this object and +other+ for equality. An OpenStruct is equal to ;TI"P+other+ when +other+ is an OpenStruct and the two objects' Hash tables are ;TI"equal.;T:
@fileI"lib/ostruct.rb;T:0@omit_headings_from_table_of_contents_below000[ I"(other);T@FI"OpenStruct;TcRDoc::NormalClass00 new_ostruct_member-i.ri 0000644 00000000763 15237405223 0011242 0 ustar 00 U:RDoc::AnyMethod[iI"new_ostruct_member:EFI""OpenStruct#new_ostruct_member;TF:protectedo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"2Used internally to defined properties on the ;TI"DOpenStruct. It does this by using the metaprogramming function ;TI"Ndefine_singleton_method for both the getter method and the setter method.;T:
@fileI"lib/ostruct.rb;T:0@omit_headings_from_table_of_contents_below000[ I"(name);T@FI"OpenStruct;TcRDoc::NormalClass00 modifiable-i.ri 0000644 00000000646 15237405223 0007432 0 ustar 00 U:RDoc::AnyMethod[iI"modifiable:EFI"OpenStruct#modifiable;TF:protectedo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I">Used internally to check if the OpenStruct is able to be ;TI"Omodified before granting access to the internal Hash table to be modified.;T:
@fileI"lib/ostruct.rb;T:0@omit_headings_from_table_of_contents_below000[ I"();T@FI"OpenStruct;TcRDoc::NormalClass00 marshal_dump-i.ri 0000644 00000000531 15237405223 0010004 0 ustar 00 U:RDoc::AnyMethod[iI"marshal_dump:EFI"OpenStruct#marshal_dump;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"AProvides marshalling support for use by the Marshal library.;T:
@fileI"lib/ostruct.rb;T:0@omit_headings_from_table_of_contents_below000[ I"();T@FI"OpenStruct;TcRDoc::NormalClass00 initialize_copy-i.ri 0000644 00000000516 15237405223 0010526 0 ustar 00 U:RDoc::AnyMethod[iI"initialize_copy:EFI"OpenStruct#initialize_copy;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I",Duplicate an OpenStruct object members.;T:
@fileI"lib/ostruct.rb;T:0@omit_headings_from_table_of_contents_below000[ I"(orig);T@TI"OpenStruct;TcRDoc::NormalClass00 marshal_load-i.ri 0000644 00000000532 15237405223 0007757 0 ustar 00 U:RDoc::AnyMethod[iI"marshal_load:EFI"OpenStruct#marshal_load;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"AProvides marshalling support for use by the Marshal library.;T:
@fileI"lib/ostruct.rb;T:0@omit_headings_from_table_of_contents_below000[ I"(x);T@FI"OpenStruct;TcRDoc::NormalClass00 hash-i.ri 0000644 00000000625 15237405223 0006257 0 ustar 00 U:RDoc::AnyMethod[iI" hash:EFI"OpenStruct#hash;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I".Compute a hash-code for this OpenStruct. ;TI"CTwo hashes with the same content will have the same hash code ;TI"(and will be eql?).;T:
@fileI"lib/ostruct.rb;T:0@omit_headings_from_table_of_contents_below000[ I"();T@FI"OpenStruct;TcRDoc::NormalClass00