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

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