1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/marshal.rb
Jean Boussier afcbb501ac marshal.c Marshal.load accepts a freeze: true option.
Fixes [Feature #18148]

When set, all the loaded objects are returned as frozen.

If a proc is provided, it is called with the objects already frozen.
2021-10-05 18:34:56 +02:00

21 lines
727 B
Ruby

module Marshal
# call-seq:
# load( source [, proc] ) -> obj
# restore( source [, proc] ) -> obj
#
# Returns the result of converting the serialized data in source into a
# Ruby object (possibly with associated subordinate objects). source
# may be either an instance of IO or an object that responds to
# to_str. If proc is specified, each object will be passed to the proc, as the object
# is being deserialized.
#
# Never pass untrusted data (including user supplied input) to this method.
# Please see the overview for further details.
def self.load(source, proc = nil, freeze: false)
Primitive.marshal_load(source, proc, freeze)
end
class << self
alias restore load
end
end