123456789_123456789_123456789_123456789_123456789_

Class: Psych::ClassLoader::Restricted

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: Psych::ClassLoader
Defined in: ext/psych/lib/psych/class_loader.rb

Class Method Summary

Instance Method Summary

::Psych::ClassLoader - Inherited

#path2class

Convert path string to a class.

Constructor Details

.new(classes, symbols) ⇒ Restricted

[ GitHub ]

  
# File 'ext/psych/lib/psych/class_loader.rb', line 74

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

Instance Method Details

#find(klassname) (private)

[ GitHub ]

  
# File 'ext/psych/lib/psych/class_loader.rb', line 92

def find klassname
  if @classes.include? klassname
    super
  else
    raise DisallowedClass, klassname
  end
end

#symbolize(sym)

[ GitHub ]

  
# File 'ext/psych/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