Class: TypeCache
- Inherits:
-
Object
show all
- Includes:
- Singleton
- Defined in:
- lib/javonet-ruby-sdk/core/type_cache/type_cache.rb,
lib/javonet-ruby-sdk/Binaries/Ruby/Linux/X64/core/type_cache/type_cache.rb,
lib/javonet-ruby-sdk/Binaries/Ruby/MacOs/X64/core/type_cache/type_cache.rb,
lib/javonet-ruby-sdk/Binaries/Ruby/Windows/X64/core/type_cache/type_cache.rb
Constant Summary
Constants included
from Singleton
Singleton::VERSION
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Singleton
__init__, #_dump, #clone, #dup
Constructor Details
Returns a new instance of TypeCache.
8
9
10
|
# File 'lib/javonet-ruby-sdk/core/type_cache/type_cache.rb', line 8
def initialize
@type_cache = []
end
|
Instance Attribute Details
#type_cache ⇒ Object
Returns the value of attribute type_cache.
6
7
8
|
# File 'lib/javonet-ruby-sdk/core/type_cache/type_cache.rb', line 6
def type_cache
@type_cache
end
|
Instance Method Details
#cache_type(type_regex) ⇒ Object
12
13
14
|
# File 'lib/javonet-ruby-sdk/core/type_cache/type_cache.rb', line 12
def cache_type(type_regex)
@type_cache << type_regex
end
|
#clear_cache ⇒ Object
36
37
38
39
|
# File 'lib/javonet-ruby-sdk/core/type_cache/type_cache.rb', line 36
def clear_cache
@type_cache.clear
0
end
|
#get_cached_types ⇒ Object
32
33
34
|
# File 'lib/javonet-ruby-sdk/core/type_cache/type_cache.rb', line 32
def get_cached_types
@type_cache
end
|
#is_type_allowed(type_to_check) ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/javonet-ruby-sdk/core/type_cache/type_cache.rb', line 20
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
|
#is_type_cache_empty? ⇒ Boolean
16
17
18
|
# File 'lib/javonet-ruby-sdk/core/type_cache/type_cache.rb', line 16
def is_type_cache_empty?
@type_cache.empty?
end
|