Class: Psych::ClassLoader::Restricted

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

Constant Summary

Constants inherited from Psych::ClassLoader

BIG_DECIMAL, COMPLEX, DATE, DATE_TIME, EXCEPTION, OBJECT, PSYCH_OMAP, PSYCH_SET, RANGE, RATIONAL, REGEXP, STRUCT, SYMBOL

Instance Method Summary collapse

Methods inherited from Psych::ClassLoader

#load

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