Sha256: 2ef77eddca40d13ac430fe8fd18f45a30b7bb7e08382227abe2df1db1724a881
Contents?: true
Size: 715 Bytes
Versions: 28
Compression:
Stored size: 715 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