Sha256: 17a2a108cbc5ac453eba68b88873ace2aafe649b418cba35d55f86886afb9e3f

Contents?: true

Size: 779 Bytes

Versions: 10

Compression:

Stored size: 779 Bytes

Contents

module Isomorfeus
  class << self
    def cached_policy_classes
      @cached_array_classes ||= {}
    end

    def cached_policy_class(class_name)
      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)
        valid_policy_class_names.include?(class_name)
      end

      def add_valid_policy_class(klass)
        class_name = klass.name
        class_name = class_name.split('>::').last if class_name.start_with?('#<')
        valid_policy_class_names << class_name
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
isomorfeus-policy-1.0.0.zeta5 lib/isomorfeus/policy/config.rb
isomorfeus-policy-1.0.0.zeta4 lib/isomorfeus/policy/config.rb
isomorfeus-policy-1.0.0.zeta3 lib/isomorfeus/policy/config.rb
isomorfeus-policy-1.0.0.zeta2 lib/isomorfeus/policy/config.rb
isomorfeus-policy-1.0.0.zeta1 lib/isomorfeus/policy/config.rb
isomorfeus-policy-1.0.0.epsilon4 lib/isomorfeus/policy/config.rb
isomorfeus-policy-1.0.0.epsilon3 lib/isomorfeus/policy/config.rb
isomorfeus-policy-1.0.0.epsilon2 lib/isomorfeus/policy/config.rb
isomorfeus-policy-1.0.0.epsilon1 lib/isomorfeus/policy/config.rb
isomorfeus-policy-1.0.0.delta12 lib/isomorfeus/policy/config.rb