Class: Psych::ClassLoader::Restricted

Inherits:
ClassLoader
  • Object
show all
Defined in:
lib/psych/class_loader.rb

Instance Method Summary collapse

Constructor Details

#initialize(classes, symbols) ⇒ Restricted

Returns a new instance of Restricted.



77
78
79
80
81
# File 'lib/psych/class_loader.rb', line 77

def initialize classes, symbols
  @classes = classes
  @symbols = symbols
  super()
end

Instance Method Details

#symbolize(sym) ⇒ Object



83
84
85
86
87
88
89
90
91
# File 'lib/psych/class_loader.rb', line 83

def symbolize sym
  return super if @symbols.empty?

  if @symbols.include? sym
    super
  else
    raise DisallowedClass.new('load', 'Symbol')
  end
end