Class: Gem::SafeMarshal::Visitors::ToRuby
- Defined in:
- lib/rubygems/safe_marshal/visitors/to_ruby.rb
Defined Under Namespace
Classes: Error, FormatError, MethodCallError, UnpermittedClassError, UnpermittedIvarError, UnpermittedSymbolError, UnsupportedError
Instance Method Summary collapse
-
#initialize(permitted_classes:, permitted_symbols:, permitted_ivars:) ⇒ ToRuby
constructor
A new instance of ToRuby.
-
#inspect ⇒ Object
:nodoc:.
- #visit(target) ⇒ Object
Constructor Details
#initialize(permitted_classes:, permitted_symbols:, permitted_ivars:) ⇒ ToRuby
Returns a new instance of ToRuby.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/rubygems/safe_marshal/visitors/to_ruby.rb', line 8 def initialize(permitted_classes:, permitted_symbols:, permitted_ivars:) @permitted_classes = permitted_classes @permitted_symbols = ["E"].concat(permitted_symbols).concat(permitted_classes) @permitted_ivars = permitted_ivars @objects = [] @symbols = [] @class_cache = {} @stack = ["root"] @stack_idx = 1 end |
Instance Method Details
#inspect ⇒ Object
:nodoc:
21 22 23 24 |
# File 'lib/rubygems/safe_marshal/visitors/to_ruby.rb', line 21 def inspect # :nodoc: format("#<%s permitted_classes: %p permitted_symbols: %p permitted_ivars: %p>", self.class, @permitted_classes, @permitted_symbols, @permitted_ivars) end |
#visit(target) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/rubygems/safe_marshal/visitors/to_ruby.rb', line 26 def visit(target) stack_idx = @stack_idx super ensure @stack_idx = stack_idx - 1 end |