模块 Gem::SafeMarshal
此模块用于安全地从 gem 加载 Marshal 规范。此模块上定义的 'safe_load' 方法专门用于加载 Gem
规范。
常量
- PERMITTED_CLASSES
- PERMITTED_IVARS
- PERMITTED_SYMBOLS
公共类方法
load(input, permitted_classes: [::Symbol], permitted_symbols: [], permitted_ivars: {}) 点击切换源代码
# File 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) 点击切换源代码
# File 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