lib/isomorfeus/policy/config.rb in isomorfeus-policy-1.0.0.zeta10 vs lib/isomorfeus/policy/config.rb in isomorfeus-policy-1.0.0.zeta11
- old
+ new
@@ -2,16 +2,23 @@
class << self
def cached_policy_classes
@cached_array_classes ||= {}
end
- def cached_policy_class(class_name)
- return "::#{class_name}".constantize if Isomorfeus.development?
- return cached_policy_classes[class_name] if cached_policy_classes.key?(class_name)
- cached_policy_classes[class_name] = "::#{class_name}".constantize
- end
+ if RUBY_ENGINE == 'opal'
+ def cached_policy_class(class_name)
+ return "::#{class_name}".constantize if Isomorfeus.development?
+ return cached_policy_classes[class_name] if cached_policy_classes.key?(class_name)
+ cached_policy_classes[class_name] = "::#{class_name}".constantize
+ end
+ else
+ def cached_policy_class(class_name)
+ return nil unless valid_policy_class_name?(class_name)
+ return "::#{class_name}".constantize if Isomorfeus.development?
+ return cached_policy_classes[class_name] if cached_policy_classes.key?(class_name)
+ cached_policy_classes[class_name] = "::#{class_name}".constantize
+ end
- if RUBY_ENGINE != 'opal'
def valid_policy_class_names
@valid_policy_class_names ||= Set.new
end
def valid_policy_class_name?(class_name)