module Gem::SafeMarshal

This module is used for safely loading Marshal specs from a gem. The ‘safe_load` method defined on this module is specifically designed for loading Gem specifications.

Constants

PERMITTED_CLASSES
PERMITTED_IVARS
PERMITTED_SYMBOLS

Public Class Methods

load(input, permitted_classes: [::Symbol], permitted_symbols: [], permitted_ivars: {}) click to toggle source
# File lib/rubygems/safe_marshal.rb, line 64
def self.load(input, permitted_classes: [::Symbol], permitted_symbols: [], permitted_ivars: {})
  root = Reader.new(StringIO.new(input, "r").binmode).read!

  Visitors::ToRuby.new(
    permitted_classes: permitted_classes,
    permitted_symbols: permitted_symbols,
    permitted_ivars: permitted_ivars,
  ).visit(root)
end
safe_load(input) click to toggle source
# File lib/rubygems/safe_marshal.rb, line 60
def self.safe_load(input)
  load(input, permitted_classes: PERMITTED_CLASSES, permitted_symbols: PERMITTED_SYMBOLS, permitted_ivars: PERMITTED_IVARS)
end