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.



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

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

Instance Method Details

#symbolize(sym) ⇒ Object



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

def symbolize sym
  return super if @symbols.empty?

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