class SafeConstantize
Public Class Methods
constantize(class_name, allowed)
click to toggle source
# File lib/safe_constantize.rb, line 4 def self.constantize(class_name, allowed) raise IllegalClassToConstantize, "Not allowed to constantize: #{class_name}" unless allowed.include?(class_name.to_s) class_name.constantize end