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.



75
76
77
78
79
# File 'lib/psych/class_loader.rb', line 75

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

Instance Method Details

#symbolize(sym) ⇒ Object



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

def symbolize sym
  return super if @symbols.empty?

  if @symbols.include? sym
    super
  else
    raise DisallowedClass, 'Symbol'
  end
end