Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
7 changed files
with
184 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ dir.rb | |
gc.rb | ||
io.rb | ||
kernel.rb | ||
marshal.rb | ||
numeric.rb | ||
nilclass.rb | ||
pack.rb | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters