Sha256: 2f5808d6c88ae981197822dd4ad5b25be5ea7dacd7d0256e6fc774f90ad85cfd
Contents?: true
Size: 676 Bytes
Versions: 28
Compression:
Stored size: 676 Bytes
Contents
require_relative './../../external_lib/singleton' class TypeCache include Singleton attr_accessor :type_cache def initialize @type_cache = [] end def cache_type(type_regex) @type_cache << type_regex end def is_type_cache_empty? @type_cache.empty? end def is_type_allowed(type_to_check) if type_to_check.is_a?(Module) name_to_check = type_to_check.name else name_to_check = "#{type_to_check.class.name}::#{type_to_check.name}" end @type_cache.any? do |pattern| /#{pattern}/.match?(name_to_check) end end def get_cached_types @type_cache end def clear_cache @type_cache.clear 0 end end
Version data entries
28 entries across 14 versions & 1 rubygems