smart_initializer 0.9.1 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,7 @@
2
2
 
3
3
  # @api private
4
4
  # @since 0.1.0
5
+ # @version 0.10.0
5
6
  # rubocop:disable Metrics/ClassLength
6
7
  class SmartCore::Initializer::Constructor::Definer
7
8
  # @param klass [Class]
@@ -9,9 +10,10 @@ class SmartCore::Initializer::Constructor::Definer
9
10
  #
10
11
  # @api private
11
12
  # @since 0.1.0
13
+ # @version 0.10.0
12
14
  def initialize(klass)
13
15
  @klass = klass
14
- @lock = SmartCore::Engine::Lock.new
16
+ @lock = SmartCore::Engine::ReadWriteLock.new
15
17
  end
16
18
 
17
19
  # @param block [Proc]
@@ -19,8 +21,9 @@ class SmartCore::Initializer::Constructor::Definer
19
21
  #
20
22
  # @api private
21
23
  # @since 0.1.0
24
+ # @version 0.10.0
22
25
  def define_init_extension(block)
23
- thread_safe do
26
+ @lock.write_sync do
24
27
  add_init_extension(build_init_extension(block))
25
28
  end
26
29
  end
@@ -37,7 +40,7 @@ class SmartCore::Initializer::Constructor::Definer
37
40
  #
38
41
  # @api private
39
42
  # @since 0.1.0
40
- # @version 0.8.0
43
+ # @version 0.10.0
41
44
  def define_parameter(
42
45
  name,
43
46
  type,
@@ -48,7 +51,7 @@ class SmartCore::Initializer::Constructor::Definer
48
51
  mutable,
49
52
  as
50
53
  )
51
- thread_safe do
54
+ @lock.write_sync do
52
55
  attribute = build_param_attribute(
53
56
  name,
54
57
  type,
@@ -71,9 +74,9 @@ class SmartCore::Initializer::Constructor::Definer
71
74
  #
72
75
  # @api private
73
76
  # @since 0.1.0
74
- # @version 0.8.0
77
+ # @version 0.10.0
75
78
  def define_parameters(*names, mutable:, privacy:)
76
- thread_safe do
79
+ @lock.write_sync do
77
80
  names.map do |name|
78
81
  build_param_attribute(
79
82
  name,
@@ -107,7 +110,7 @@ class SmartCore::Initializer::Constructor::Definer
107
110
  #
108
111
  # @api private
109
112
  # @since 0.1.0
110
- # @version 0.8.0
113
+ # @version 0.10.0
111
114
  def define_option(
112
115
  name,
113
116
  type,
@@ -120,7 +123,7 @@ class SmartCore::Initializer::Constructor::Definer
120
123
  default,
121
124
  optional
122
125
  )
123
- thread_safe do
126
+ @lock.write_sync do
124
127
  attribute = build_option_attribute(
125
128
  name,
126
129
  type,
@@ -145,9 +148,9 @@ class SmartCore::Initializer::Constructor::Definer
145
148
  #
146
149
  # @api private
147
150
  # @since 0.1.0
148
- # @version 0.8.0
151
+ # @version 0.10.0
149
152
  def define_options(*names, mutable:, privacy:)
150
- thread_safe do
153
+ @lock.write_sync do
151
154
  names.map do |name|
152
155
  build_option_attribute(
153
156
  name,
@@ -352,14 +355,5 @@ class SmartCore::Initializer::Constructor::Definer
352
355
  ERROR_MESSAGE
353
356
  end
354
357
  end
355
-
356
- # @param block [Block]
357
- # @return [Any]
358
- #
359
- # @api private
360
- # @since 0.1.0
361
- def thread_safe(&block)
362
- @lock.synchronize(&block)
363
- end
364
358
  end
365
359
  # rubocop:enable Metrics/ClassLength
@@ -2,6 +2,7 @@
2
2
 
3
3
  # @api private
4
4
  # @since 0.1.0
5
+ # @version 0.10.0
5
6
  module SmartCore::Initializer::DSL
6
7
  require_relative 'dsl/inheritance'
7
8
 
@@ -11,13 +12,13 @@ module SmartCore::Initializer::DSL
11
12
  #
12
13
  # @api private
13
14
  # @since 0.1.0
15
+ # @version 0.10.0
14
16
  def extended(base_klass)
15
17
  base_klass.instance_eval do
16
18
  instance_variable_set(:@__params__, SmartCore::Initializer::Attribute::List.new)
17
19
  instance_variable_set(:@__options__, SmartCore::Initializer::Attribute::List.new)
18
20
  instance_variable_set(:@__init_extensions__, SmartCore::Initializer::Extensions::List.new)
19
21
  instance_variable_set(:@__definer__, SmartCore::Initializer::Constructor::Definer.new(self))
20
- instance_variable_set(:@__deflock__, SmartCore::Engine::Lock.new)
21
22
  instance_variable_set(:@__initializer_settings__, SmartCore::Initializer::Settings.new)
22
23
  end
23
24
  base_klass.extend(ClassMethods)
@@ -27,20 +28,20 @@ module SmartCore::Initializer::DSL
27
28
 
28
29
  # @api private
29
30
  # @since 0.1.0
31
+ # @version 0.10.0
30
32
  module ClassInheritance
31
33
  # @param child_klass [Class]
32
34
  # @return [void]
33
35
  #
34
36
  # @api private
35
37
  # @since 0.1.0
36
- # @version 0.3.2
38
+ # @version 0.10.0
37
39
  def inherited(child_klass)
38
40
  child_klass.instance_exec(__initializer_settings__) do |init_settings|
39
41
  instance_variable_set(:@__params__, SmartCore::Initializer::Attribute::List.new)
40
42
  instance_variable_set(:@__options__, SmartCore::Initializer::Attribute::List.new)
41
43
  instance_variable_set(:@__init_extensions__, SmartCore::Initializer::Extensions::List.new)
42
44
  instance_variable_set(:@__definer__, SmartCore::Initializer::Constructor::Definer.new(self))
43
- instance_variable_set(:@__deflock__, SmartCore::Engine::Lock.new)
44
45
  instance_variable_set(:@__initializer_settings__, init_settings.dup)
45
46
  end
46
47
  child_klass.extend(ClassMethods)
@@ -2,6 +2,7 @@
2
2
 
3
3
  # @api private
4
4
  # @since 0.1.0
5
+ # @version 0.10.0
5
6
  class SmartCore::Initializer::Extensions::List
6
7
  # @since 0.1.0
7
8
  include Enumerable
@@ -10,9 +11,10 @@ class SmartCore::Initializer::Extensions::List
10
11
  #
11
12
  # @api private
12
13
  # @since 0.1.0
14
+ # @version 0.10.0
13
15
  def initialize
14
16
  @extensions = []
15
- @lock = SmartCore::Engine::Lock.new
17
+ @lock = SmartCore::Engine::ReadWriteLock.new
16
18
  end
17
19
 
18
20
  # @param extension [SmartCore::Initializer::Extensions::Abstract]
@@ -20,8 +22,9 @@ class SmartCore::Initializer::Extensions::List
20
22
  #
21
23
  # @api private
22
24
  # @since 0.1.0
25
+ # @version 0.10.0
23
26
  def add(extension)
24
- thread_safe { extensions << extension }
27
+ @lock.write_sync { extensions << extension }
25
28
  end
26
29
  alias_method :<<, :add
27
30
 
@@ -30,8 +33,9 @@ class SmartCore::Initializer::Extensions::List
30
33
  #
31
34
  # @api private
32
35
  # @since 0.1.0
36
+ # @version 0.10.0
33
37
  def concat(list)
34
- thread_safe do
38
+ @lock.write_sync do
35
39
  list.each { |extension| add(extension.dup) }
36
40
  end
37
41
  end
@@ -41,8 +45,9 @@ class SmartCore::Initializer::Extensions::List
41
45
  #
42
46
  # @api private
43
47
  # @since 0.1.0
48
+ # @version 0.10.0
44
49
  def each(&block)
45
- thread_safe do
50
+ @lock.read_sync do
46
51
  block_given? ? extensions.each(&block) : extensions.each
47
52
  end
48
53
  end
@@ -51,8 +56,9 @@ class SmartCore::Initializer::Extensions::List
51
56
  #
52
57
  # @api private
53
58
  # @since 0.1.0
59
+ # @version 0.10.0
54
60
  def size
55
- thread_safe { extensions.size }
61
+ @lock.read_sync { extensions.size }
56
62
  end
57
63
 
58
64
  private
@@ -62,13 +68,4 @@ class SmartCore::Initializer::Extensions::List
62
68
  # @api private
63
69
  # @since 0.1.0
64
70
  attr_reader :extensions
65
-
66
- # @param block [Block]
67
- # @return [Any]
68
- #
69
- # @api private
70
- # @since 0.1.0
71
- def thread_safe(&block)
72
- @lock.synchronize(&block)
73
- end
74
71
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  # @api private
4
4
  # @since 0.1.0
5
+ # @version 0.10.0
5
6
  class SmartCore::Initializer::Plugins::Abstract
6
7
  class << self
7
8
  # @param child_klass [Class]
@@ -9,9 +10,10 @@ class SmartCore::Initializer::Plugins::Abstract
9
10
  #
10
11
  # @api private
11
12
  # @since 0.1.0
13
+ # @version 0.10.0
12
14
  def inherited(child_klass)
13
15
  child_klass.instance_variable_set(:@__loaded__, false)
14
- child_klass.instance_variable_set(:@__lock__, Mutex.new)
16
+ child_klass.instance_variable_set(:@__lock__, SmartCore::Engine::Lock.new)
15
17
  super
16
18
  end
17
19
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  # @api private
4
4
  # @since 0.1.0
5
+ # @version 0.10.0
5
6
  class SmartCore::Initializer::Plugins::Registry
6
7
  # @since 0.1.0
7
8
  include Enumerable
@@ -10,9 +11,10 @@ class SmartCore::Initializer::Plugins::Registry
10
11
  #
11
12
  # @api private
12
13
  # @since 0.1.0
14
+ # @version 0.10.0
13
15
  def initialize
14
16
  @plugin_set = {}
15
- @access_lock = Mutex.new
17
+ @access_lock = SmartCore::Engine::ReadWriteLock.new
16
18
  end
17
19
 
18
20
  # @param plugin_name [Symbol, String]
@@ -20,8 +22,9 @@ class SmartCore::Initializer::Plugins::Registry
20
22
  #
21
23
  # @api private
22
24
  # @since 0.1.0
25
+ # @version 0.10.0
23
26
  def [](plugin_name)
24
- thread_safe { fetch(plugin_name) }
27
+ @access_lock.read_sync { fetch(plugin_name) }
25
28
  end
26
29
 
27
30
  # @param plugin_name [Symbol, String]
@@ -30,8 +33,9 @@ class SmartCore::Initializer::Plugins::Registry
30
33
  #
31
34
  # @api private
32
35
  # @since 0.1.0
36
+ # @version 0.10.0
33
37
  def register(plugin_name, plugin_module)
34
- thread_safe { apply(plugin_name, plugin_module) }
38
+ @access_lock.write_sync { apply(plugin_name, plugin_module) }
35
39
  end
36
40
  alias_method :[]=, :register
37
41
 
@@ -39,16 +43,18 @@ class SmartCore::Initializer::Plugins::Registry
39
43
  #
40
44
  # @api private
41
45
  # @since 0.1.0
46
+ # @version 0.10.0
42
47
  def names
43
- thread_safe { plugin_names }
48
+ @access_lock.read_sync { plugin_names }
44
49
  end
45
50
 
46
51
  # @return [Hash<String,Class<SmartCore::Initializer::Plugins::Abstract>>]
47
52
  #
48
53
  # @api private
49
54
  # @since 0.1.0
55
+ # @version 0.10.0
50
56
  def loaded
51
- thread_safe { loaded_plugins }
57
+ @access_lock.read_sync { loaded_plugins }
52
58
  end
53
59
 
54
60
  # @param block [Block]
@@ -56,8 +62,9 @@ class SmartCore::Initializer::Plugins::Registry
56
62
  #
57
63
  # @api private
58
64
  # @since 0.1.0
65
+ # @version 0.10.0
59
66
  def each(&block)
60
- thread_safe { iterate(&block) }
67
+ @access_lock.read_sync { iterate(&block) }
61
68
  end
62
69
 
63
70
  private
@@ -74,14 +81,6 @@ class SmartCore::Initializer::Plugins::Registry
74
81
  # @since 0.1.0
75
82
  attr_reader :access_lock
76
83
 
77
- # @return [void]
78
- #
79
- # @api private
80
- # @since 0.1.0
81
- def thread_safe
82
- access_lock.synchronize { yield if block_given? }
83
- end
84
-
85
84
  # @return [Array<String>]
86
85
  #
87
86
  # @api private
@@ -2,6 +2,7 @@
2
2
 
3
3
  # @api private
4
4
  # @since 0.1.0
5
+ # @version 0.10.0
5
6
  module SmartCore::Initializer::Plugins::RegistryInterface
6
7
  class << self
7
8
  # @param base_module [Class, Module]
@@ -9,12 +10,13 @@ module SmartCore::Initializer::Plugins::RegistryInterface
9
10
  #
10
11
  # @api private
11
12
  # @since 0.1.0
13
+ # @version 0.10.0
12
14
  def extended(base_module)
13
15
  base_module.instance_variable_set(
14
16
  :@plugin_registry, SmartCore::Initializer::Plugins::Registry.new
15
17
  )
16
18
  base_module.instance_variable_set(
17
- :@access_lock, SmartCore::Engine::Lock.new
19
+ :@access_lock, SmartCore::Engine::ReadWriteLock.new
18
20
  )
19
21
  end
20
22
  end
@@ -24,24 +26,27 @@ module SmartCore::Initializer::Plugins::RegistryInterface
24
26
  #
25
27
  # @api public
26
28
  # @since 0.1.0
29
+ # @version 0.10.0
27
30
  def load(plugin_name)
28
- thread_safe { plugin_registry[plugin_name].load! }
31
+ @access_lock.read_sync { plugin_registry[plugin_name].load! }
29
32
  end
30
33
 
31
34
  # @return [Array<String>]
32
35
  #
33
36
  # @api public
34
37
  # @since 0.1.0
38
+ # @version 0.10.0
35
39
  def loaded_plugins
36
- thread_safe { plugin_registry.loaded.keys }
40
+ @access_lock.read_sync { plugin_registry.loaded.keys }
37
41
  end
38
42
 
39
43
  # @return [Array<String>]
40
44
  #
41
45
  # @api public
42
46
  # @since 0.1.0
47
+ # @version 0.10.0
43
48
  def names
44
- thread_safe { plugin_registry.names }
49
+ @access_lock.read_sync { plugin_registry.names }
45
50
  end
46
51
 
47
52
  # @param plugin_name [Symbol, String]
@@ -49,8 +54,9 @@ module SmartCore::Initializer::Plugins::RegistryInterface
49
54
  #
50
55
  # @api private
51
56
  # @since 0.1.0
57
+ # @version 0.10.0
52
58
  def register_plugin(plugin_name, plugin_module)
53
- thread_safe { plugin_registry[plugin_name] = plugin_module }
59
+ @access_lock.write_sync { plugin_registry[plugin_name] = plugin_module }
54
60
  end
55
61
 
56
62
  private
@@ -60,18 +66,4 @@ module SmartCore::Initializer::Plugins::RegistryInterface
60
66
  # @api private
61
67
  # @since 0.1.0
62
68
  attr_reader :plugin_registry
63
-
64
- # @return [SmartCore::Engine::Lock]
65
- #
66
- # @api private
67
- # @since 0.1.0
68
- attr_reader :access_lock
69
-
70
- # @return [void]
71
- #
72
- # @api private
73
- # @since 0.1.0
74
- def thread_safe
75
- access_lock.synchronize { yield if block_given? }
76
- end
77
69
  end
@@ -2,23 +2,16 @@
2
2
 
3
3
  # @api private
4
4
  # @since 0.8.0
5
+ # @version 0.10.0
5
6
  class SmartCore::Initializer::Settings::AutoCast < SmartCore::Initializer::Settings::Base
6
- # @return [void]
7
- #
8
- # @api private
9
- # @since 0.8.0
10
- def initialize
11
- @value = nil
12
- @lock = SmartCore::Engine::Lock.new
13
- end
14
-
15
7
  # @return [Boolean]
16
8
  #
17
9
  # @api private
18
10
  # @since 0.8.0
11
+ # @version 0.10.0
19
12
  def resolve
20
- thread_safe do
21
- @value == nil ? SmartCore::Initializer::Configuration[:auto_cast] : @value
13
+ @lock.read_sync do
14
+ (@value == nil) ? SmartCore::Initializer::Configuration[:auto_cast] : @value
22
15
  end
23
16
  end
24
17
 
@@ -27,8 +20,9 @@ class SmartCore::Initializer::Settings::AutoCast < SmartCore::Initializer::Setti
27
20
  #
28
21
  # @api private
29
22
  # @since 0.8.0
23
+ # @version 0.10.0
30
24
  def assign(value)
31
- thread_safe do
25
+ @lock.write_sync do
32
26
  raise(
33
27
  SmartCore::Initializer::SettingArgumentError,
34
28
  ":auto_cast setting should be a type of boolean (got: `#{value.class}`)"
@@ -2,14 +2,16 @@
2
2
 
3
3
  # @api private
4
4
  # @since 0.8.0
5
+ # @version 0.10.0
5
6
  class SmartCore::Initializer::Settings::Base
6
7
  # @return [void]
7
8
  #
8
9
  # @api private
9
10
  # @since 0.8.0
11
+ # @version 0.10.0
10
12
  def initialize
11
13
  @value = nil
12
- @lock = SmartCore::Engine::Lock.new
14
+ @lock = SmartCore::Engine::ReadWriteLock.new
13
15
  end
14
16
 
15
17
  # @!method resolve
@@ -28,22 +30,12 @@ class SmartCore::Initializer::Settings::Base
28
30
  #
29
31
  # @api private
30
32
  # @since 0.8.0
33
+ # @version 0.10.0
31
34
  def dup
32
- thread_safe do
35
+ @lock.write_sync do
33
36
  self.class.new.tap do |duplicate|
34
37
  duplicate.instance_variable_set(:@value, @value)
35
38
  end
36
39
  end
37
40
  end
38
-
39
- private
40
-
41
- # @param block [Block]
42
- # @return [Any]
43
- #
44
- # @api private
45
- # @since 0.8.0
46
- def thread_safe(&block)
47
- @lock.synchronize(&block)
48
- end
49
41
  end
@@ -2,23 +2,16 @@
2
2
 
3
3
  # @api private
4
4
  # @since 0.8.0
5
+ # @version 0.10.0
5
6
  class SmartCore::Initializer::Settings::StrictOptions < SmartCore::Initializer::Settings::Base
6
- # @return [void]
7
- #
8
- # @api private
9
- # @since 0.8.0
10
- def initialize
11
- @value = nil
12
- @lock = SmartCore::Engine::Lock.new
13
- end
14
-
15
7
  # @return [Boolean]
16
8
  #
17
9
  # @api private
18
10
  # @since 0.8.0
11
+ # @version 0.10.0
19
12
  def resolve
20
- thread_safe do
21
- @value == nil ? SmartCore::Initializer::Configuration[:strict_options] : @value
13
+ @lock.read_sync do
14
+ (@value == nil) ? SmartCore::Initializer::Configuration[:strict_options] : @value
22
15
  end
23
16
  end
24
17
 
@@ -27,8 +20,9 @@ class SmartCore::Initializer::Settings::StrictOptions < SmartCore::Initializer::
27
20
  #
28
21
  # @api private
29
22
  # @since 0.8.0
23
+ # @version 0.10.0
30
24
  def assign(value)
31
- thread_safe do
25
+ @lock.write_sync do
32
26
  raise(
33
27
  SmartCore::Initializer::SettingArgumentError,
34
28
  ":strict_options setting should be a type of boolean (got: `#{value.class}`)"
@@ -2,24 +2,15 @@
2
2
 
3
3
  # @api private
4
4
  # @since 0.1.0
5
- # @version 0.8.0
5
+ # @version 0.10.0
6
6
  class SmartCore::Initializer::Settings::TypeSystem < SmartCore::Initializer::Settings::Base
7
- # @return [void]
8
- #
9
- # @api private
10
- # @since 0.1.0
11
- # @version 0.8.0
12
- def initialize
13
- @value = nil
14
- @lock = SmartCore::Engine::Lock.new
15
- end
16
-
17
7
  # @return [Any]
18
8
  #
19
9
  # @api private
20
10
  # @since 0.1.0
11
+ # @version 0.10.0
21
12
  def generic_type_object
22
- thread_safe do
13
+ @lock.read_sync do
23
14
  SmartCore::Initializer::TypeSystem.resolve(resolve).generic_type_object
24
15
  end
25
16
  end
@@ -28,10 +19,10 @@ class SmartCore::Initializer::Settings::TypeSystem < SmartCore::Initializer::Set
28
19
  #
29
20
  # @api private
30
21
  # @since 0.1.0
31
- # @version 0.8.0
22
+ # @version 0.10.0
32
23
  def resolve
33
- thread_safe do
34
- @value == nil ? SmartCore::Initializer::Configuration[:default_type_system] : @value
24
+ @lock.read_sync do
25
+ (@value == nil) ? SmartCore::Initializer::Configuration[:default_type_system] : @value
35
26
  end
36
27
  end
37
28
 
@@ -40,9 +31,9 @@ class SmartCore::Initializer::Settings::TypeSystem < SmartCore::Initializer::Set
40
31
  #
41
32
  # @api private
42
33
  # @since 0.1.0
43
- # @version 0.8.0
34
+ # @version 0.10.0
44
35
  def assign(value)
45
- thread_safe do
36
+ @lock.write_sync do
46
37
  # NOTE: type system existence validation
47
38
  SmartCore::Initializer::TypeSystem.resolve(value)
48
39
  @value = value
@@ -2,32 +2,36 @@
2
2
 
3
3
  # @api private
4
4
  # @since 0.1.0
5
+ # @version 0.10.0
5
6
  class SmartCore::Initializer::TypeSystem::Interop::Aliasing::AliasList
6
7
  # @param interop_klass [Class<SmartCore::Initializer::TypeSystem::Interop>]
7
8
  # @return [void]
8
9
  #
9
10
  # @api private
10
11
  # @since 0.1.0
12
+ # @version 0.10.0
11
13
  def initialize(interop_klass)
12
14
  @interop_klass = interop_klass
13
15
  @list = {}
14
- @lock = SmartCore::Engine::Lock.new
16
+ @lock = SmartCore::Engine::ReadWriteLock.new
15
17
  end
16
18
 
17
19
  # @return [Array<String>]
18
20
  #
19
21
  # @api private
20
22
  # @since 0.1.0
23
+ # @version 0.10.0
21
24
  def keys
22
- thread_safe { registered_aliases }
25
+ @lock.read_sync { registered_aliases }
23
26
  end
24
27
 
25
28
  # @return [Hash<String,Any>]
26
29
  #
27
30
  # @api private
28
31
  # @since 0.1.0
32
+ # @version 0.10.0
29
33
  def to_h
30
- thread_safe { transform_to_hash }
34
+ @lock.read_sync { transform_to_hash }
31
35
  end
32
36
  alias_method :to_hash, :to_h
33
37
 
@@ -37,9 +41,10 @@ class SmartCore::Initializer::TypeSystem::Interop::Aliasing::AliasList
37
41
  #
38
42
  # @api private
39
43
  # @since 0.1.0
44
+ # @version 0.10.0
40
45
  def associate(alias_name, type)
41
46
  interop_klass.prevent_incompatible_type!(type)
42
- thread_safe { set_alias(alias_name, type) }
47
+ @lock.write_sync { set_alias(alias_name, type) }
43
48
  end
44
49
 
45
50
  # @param alias_name [String, Symbol]
@@ -47,8 +52,9 @@ class SmartCore::Initializer::TypeSystem::Interop::Aliasing::AliasList
47
52
  #
48
53
  # @api private
49
54
  # @since 0.1.0
55
+ # @version 0.10.0
50
56
  def resolve(alias_name)
51
- thread_safe { get_alias(alias_name) }
57
+ @lock.read_sync { get_alias(alias_name) }
52
58
  end
53
59
 
54
60
  private
@@ -65,15 +71,6 @@ class SmartCore::Initializer::TypeSystem::Interop::Aliasing::AliasList
65
71
  # @since 0.1.0
66
72
  attr_reader :interop_klass
67
73
 
68
- # @param block [Block]
69
- # @return [Any]
70
- #
71
- # @api private
72
- # @since 0.1.0
73
- def thread_safe(&block)
74
- @lock.synchronize(&block)
75
- end
76
-
77
74
  # @param alias_name [String, Symbol]
78
75
  # @param type [Any]
79
76
  # @return [void]
@@ -97,16 +94,16 @@ class SmartCore::Initializer::TypeSystem::Interop::Aliasing::AliasList
97
94
  #
98
95
  # @api private
99
96
  # @since 0.1.0
97
+ # @version 0.10.0
100
98
  def get_alias(alias_name)
101
99
  alias_name = normalized_alias(alias_name)
102
100
 
103
- begin
104
- list.fetch(alias_name)
105
- rescue ::KeyError
106
- raise(SmartCore::Initializer::TypeAliasNotFoundError, <<~ERROR_MESSAGE)
107
- Alias with name "#{alias_name}" not found.
108
- ERROR_MESSAGE
109
- end
101
+ raise(
102
+ SmartCore::Initializer::TypeAliasNotFoundError,
103
+ "Alias with name `#{alias_name}` not found."
104
+ ) unless list.key?(alias_name)
105
+
106
+ list.fetch(alias_name)
110
107
  end
111
108
 
112
109
  # @param alias_name [String, Symbol]