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

Version Path
javonet-ruby-sdk-2.5.7 lib/javonet-ruby-sdk/core/type_cache/type_cache.rb
javonet-ruby-sdk-2.5.7 lib/javonet-ruby-sdk/Binaries/Ruby/Windows/X64/core/type_cache/type_cache.rb
javonet-ruby-sdk-2.5.6 lib/javonet-ruby-sdk/core/type_cache/type_cache.rb
javonet-ruby-sdk-2.5.6 lib/javonet-ruby-sdk/Binaries/Ruby/Windows/X64/core/type_cache/type_cache.rb
javonet-ruby-sdk-2.5.5 lib/javonet-ruby-sdk/Binaries/Ruby/Windows/X64/core/type_cache/type_cache.rb
javonet-ruby-sdk-2.5.5 lib/javonet-ruby-sdk/core/type_cache/type_cache.rb
javonet-ruby-sdk-2.5.4 lib/javonet-ruby-sdk/Binaries/Ruby/Windows/X64/core/type_cache/type_cache.rb
javonet-ruby-sdk-2.5.4 lib/javonet-ruby-sdk/core/type_cache/type_cache.rb
javonet-ruby-sdk-2.5.3 lib/javonet-ruby-sdk/core/type_cache/type_cache.rb
javonet-ruby-sdk-2.5.3 lib/javonet-ruby-sdk/Binaries/Ruby/Windows/X64/core/type_cache/type_cache.rb
javonet-ruby-sdk-2.5.2 lib/javonet-ruby-sdk/Binaries/Ruby/Windows/X64/core/type_cache/type_cache.rb
javonet-ruby-sdk-2.5.2 lib/javonet-ruby-sdk/core/type_cache/type_cache.rb
javonet-ruby-sdk-2.5.1 lib/javonet-ruby-sdk/Binaries/Ruby/Windows/X64/core/type_cache/type_cache.rb
javonet-ruby-sdk-2.5.1 lib/javonet-ruby-sdk/core/type_cache/type_cache.rb
javonet-ruby-sdk-2.5.0 lib/javonet-ruby-sdk/Binaries/Ruby/Windows/X64/core/type_cache/type_cache.rb
javonet-ruby-sdk-2.5.0 lib/javonet-ruby-sdk/core/type_cache/type_cache.rb
javonet-ruby-sdk-2.4.11 lib/javonet-ruby-sdk/core/type_cache/type_cache.rb
javonet-ruby-sdk-2.4.11 lib/javonet-ruby-sdk/Binaries/Ruby/Windows/X64/core/type_cache/type_cache.rb
javonet-ruby-sdk-2.4.10 lib/javonet-ruby-sdk/Binaries/Ruby/Windows/X64/core/type_cache/type_cache.rb
javonet-ruby-sdk-2.4.10 lib/javonet-ruby-sdk/core/type_cache/type_cache.rb