MMCT TEAM
Server IP : 111.118.215.189  /  Your IP : 216.73.216.162
Web Server : Apache
System : Linux md-in-83.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : a1673wkz ( 2475)
PHP Version : 8.2.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /proc/thread-self/root/opt/cpanel/ea-ruby24/root/usr/share/ri/system/Marshal/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : //proc/thread-self/root/opt/cpanel/ea-ruby24/root/usr/share/ri/system/Marshal/cdesc-Marshal.ri
U:RDoc::NormalModule[iI"Marshal:ET@0o:RDoc::Markup::Document:@parts[o;;[-o:RDoc::Markup::Paragraph;[	I"HThe marshaling library converts collections of Ruby objects into a ;TI"Cbyte stream, allowing them to be stored outside the currently ;TI"Hactive script. This data may subsequently be read and the original ;TI"objects reconstituted.;To:RDoc::Markup::BlankLineo;	;[
I"EMarshaled data has major and minor version numbers stored along ;TI"Ewith the object information. In normal use, marshaling can only ;TI"Gload data written with the same major version number and an equal ;TI"For lower minor version number. If Ruby's ``verbose'' flag is set ;TI"C(normally using -d, -v, -w, or --verbose) the major and minor ;TI"Fnumbers must match exactly. Marshal versioning is independent of ;TI"HRuby's version numbers. You can extract the version by reading the ;TI"'first two bytes of marshaled data.;T@o:RDoc::Markup::Verbatim;[	I"!str = Marshal.dump("thing")
;TI" RUBY_VERSION   #=> "1.9.0"
;TI"str[0].ord     #=> 4
;TI"str[1].ord     #=> 8
;T:@format0o;	;[I"HSome objects cannot be dumped: if the objects to be dumped include ;TI"Fbindings, procedure or method objects, instances of class IO, or ;TI"3singleton objects, a TypeError will be raised.;T@o;	;[	I"HIf your class has special serialization needs (for example, if you ;TI"Cwant to serialize in some specific format), or if it contains ;TI"Iobjects that would otherwise not be serializable, you can implement ;TI"%your own serialization strategy.;T@o;	;[	I"HThere are two methods of doing this, your object can define either ;TI"Omarshal_dump and marshal_load or _dump and _load.  marshal_dump will take ;TI"Lprecedence over _dump if both are defined.  marshal_dump may result in ;TI"smaller Marshal strings.;T@S:RDoc::Markup::Heading:
leveli:	textI"Security considerations;T@o;	;[I"NBy design, Marshal.load can deserialize almost any class loaded into the ;TI"ORuby process. In many cases this can lead to remote code execution if the ;TI"5Marshal data is loaded from an untrusted source.;T@o;	;[I"RAs a result, Marshal.load is not suitable as a general purpose serialization ;TI"Rformat and you should never unmarshal user supplied input or other untrusted ;TI"
data.;T@o;	;[	I"RIf you need to deserialize untrusted data, use JSON or another serialization ;TI"Pformat that is only able to load simple, 'primitive' types such as String, ;TI"LArray, Hash, etc. Never allow user input to specify arbitrary types to ;TI"deserialize into.;T@S;
;i;I""marshal_dump and marshal_load;T@o;	;[I"DWhen dumping an object the method marshal_dump will be called. ;TI"Pmarshal_dump must return a result containing the information necessary for ;TI"Lmarshal_load to reconstitute the object.  The result can be any object.;T@o;	;[I"JWhen loading an object dumped using marshal_dump the object is first ;TI"Nallocated then marshal_load is called with the result from marshal_dump. ;TI"Nmarshal_load must recreate the object from the information in the result.;T@o;	;[I"
Example:;T@o;;[I"class MyObj
;TI"*  def initialize name, version, data
;TI"    @name    = name
;TI"    @version = version
;TI"    @data    = data
;TI"  end
;TI"
;TI"  def marshal_dump
;TI"    [@name, @version]
;TI"  end
;TI"
;TI"  def marshal_load array
;TI"!    @name, @version = array
;TI"  end
;TI"	end
;T;0S;
;i;I"_dump and _load;T@o;	;[I"OUse _dump and _load when you need to allocate the object you're restoring ;TI"yourself.;T@o;	;[	I"PWhen dumping an object the instance method _dump is called with an Integer ;TI"Qwhich indicates the maximum depth of objects to dump (a value of -1 implies ;TI"Jthat you should disable depth checking).  _dump must return a String ;TI"Econtaining the information necessary to reconstitute the object.;T@o;	;[I"PThe class method _load should take a String and use it to return an object ;TI"of the same class.;T@o;	;[I"
Example:;T@o;;[I"class MyObj
;TI"*  def initialize name, version, data
;TI"    @name    = name
;TI"    @version = version
;TI"    @data    = data
;TI"  end
;TI"
;TI"  def _dump level
;TI"$    [@name, @version].join ':'
;TI"  end
;TI"
;TI"  def self._load args
;TI"    new(*args.split(':'))
;TI"  end
;TI"	end
;T;0o;	;[I"MSince Marshal.dump outputs a string you can have _dump return a Marshal ;TI"Astring which is Marshal.loaded in _load for complex objects.;T:
@fileI"marshal.c;T:0@omit_headings_from_table_of_contents_below0;0;0[[U:RDoc::Constant[iI"MAJOR_VERSION;TI"Marshal::MAJOR_VERSION;T00o;;[o;	;[I"major version;T@;@�;0@�@cRDoc::NormalModule0U;[iI"MINOR_VERSION;TI"Marshal::MINOR_VERSION;T00o;;[o;	;[I"minor version;T@;@�;0@�@@�0[[[I"
class;T[[:public[[I"	dump;TI"marshal.c;T[I"	load;T@�[I"restore;T@�[:protected[[:private[[I"
instance;T[[;[[;[[;[[[U:RDoc::Context::Section[i0o;;[;0;0[@�@�cRDoc::TopLevel

MMCT - 2023