smart_initializer 0.1.0.alpha4 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/.travis.yml +36 -5
  4. data/CHANGELOG.md +3 -0
  5. data/Gemfile.lock +48 -31
  6. data/README.md +151 -22
  7. data/Rakefile +1 -1
  8. data/bin/rspec +54 -0
  9. data/gemfiles/with_external_deps.gemfile +7 -0
  10. data/gemfiles/with_external_deps.gemfile.lock +99 -0
  11. data/gemfiles/without_external_deps.gemfile +5 -0
  12. data/gemfiles/without_external_deps.gemfile.lock +97 -0
  13. data/lib/smart_core/initializer.rb +38 -35
  14. data/lib/smart_core/initializer/attribute.rb +12 -4
  15. data/lib/smart_core/initializer/attribute/factory.rb +47 -27
  16. data/lib/smart_core/initializer/attribute/parameters.rb +12 -4
  17. data/lib/smart_core/initializer/configurable_module.rb +27 -0
  18. data/lib/smart_core/initializer/configuration.rb +33 -0
  19. data/lib/smart_core/initializer/constructor.rb +9 -6
  20. data/lib/smart_core/initializer/constructor/definer.rb +34 -11
  21. data/lib/smart_core/initializer/dsl.rb +23 -6
  22. data/lib/smart_core/initializer/errors.rb +44 -0
  23. data/lib/smart_core/initializer/plugins.rb +17 -0
  24. data/lib/smart_core/initializer/plugins/abstract.rb +55 -0
  25. data/lib/smart_core/initializer/plugins/access_mixin.rb +47 -0
  26. data/lib/smart_core/initializer/plugins/registry.rb +166 -0
  27. data/lib/smart_core/initializer/plugins/registry_interface.rb +77 -0
  28. data/lib/smart_core/initializer/plugins/thy_types.rb +30 -0
  29. data/lib/smart_core/initializer/plugins/thy_types/errors.rb +11 -0
  30. data/lib/smart_core/initializer/plugins/thy_types/thy_types.rb +23 -0
  31. data/lib/smart_core/initializer/plugins/thy_types/thy_types/abstract_factory.rb +78 -0
  32. data/lib/smart_core/initializer/plugins/thy_types/thy_types/operation.rb +12 -0
  33. data/lib/smart_core/initializer/plugins/thy_types/thy_types/operation/base.rb +9 -0
  34. data/lib/smart_core/initializer/plugins/thy_types/thy_types/operation/cast.rb +21 -0
  35. data/lib/smart_core/initializer/plugins/thy_types/thy_types/operation/valid.rb +16 -0
  36. data/lib/smart_core/initializer/plugins/thy_types/thy_types/operation/validate.rb +19 -0
  37. data/lib/smart_core/initializer/settings.rb +49 -0
  38. data/lib/smart_core/initializer/settings/duplicator.rb +20 -0
  39. data/lib/smart_core/initializer/settings/type_system.rb +69 -0
  40. data/lib/smart_core/initializer/type_system.rb +16 -0
  41. data/lib/smart_core/initializer/type_system/interop.rb +103 -0
  42. data/lib/smart_core/initializer/type_system/interop/abstract_factory.rb +70 -0
  43. data/lib/smart_core/initializer/type_system/interop/aliasing.rb +72 -0
  44. data/lib/smart_core/initializer/type_system/interop/aliasing/alias_list.rb +141 -0
  45. data/lib/smart_core/initializer/type_system/interop/operation.rb +30 -0
  46. data/lib/smart_core/initializer/type_system/registry.rb +174 -0
  47. data/lib/smart_core/initializer/type_system/registry_interface.rb +102 -0
  48. data/lib/smart_core/initializer/type_system/smart_types.rb +48 -0
  49. data/lib/smart_core/initializer/type_system/smart_types/abstract_factory.rb +72 -0
  50. data/lib/smart_core/initializer/type_system/smart_types/operation.rb +13 -0
  51. data/lib/smart_core/initializer/type_system/smart_types/operation/base.rb +8 -0
  52. data/lib/smart_core/initializer/type_system/smart_types/operation/cast.rb +16 -0
  53. data/lib/smart_core/initializer/type_system/smart_types/operation/valid.rb +16 -0
  54. data/lib/smart_core/initializer/type_system/smart_types/operation/validate.rb +16 -0
  55. data/lib/smart_core/initializer/version.rb +1 -1
  56. data/smart_initializer.gemspec +13 -9
  57. metadata +67 -17
  58. data/lib/smart_core/initializer/attribute/init_extension.rb +0 -4
  59. data/lib/smart_core/initializer/type_aliasing.rb +0 -50
  60. data/lib/smart_core/initializer/type_aliasing/alias_list.rb +0 -101
data/Rakefile CHANGED
@@ -11,8 +11,8 @@ require 'rubocop-rake'
11
11
  RuboCop::RakeTask.new(:rubocop) do |t|
12
12
  config_path = File.expand_path(File.join('.rubocop.yml'), __dir__)
13
13
  t.options = ['--config', config_path]
14
- t.requires << 'rubocop-performance'
15
14
  t.requires << 'rubocop-rspec'
15
+ t.requires << 'rubocop-performance'
16
16
  t.requires << 'rubocop-rake'
17
17
  end
18
18
 
data/bin/rspec ADDED
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'pathname'
5
+ require 'optparse'
6
+
7
+ module SmartCoreInitializerRSpecRunner
8
+ expand_gemfile_path = lambda do |gemfile|
9
+ File.expand_path(File.join('..', 'gemfiles', gemfile), __dir__)
10
+ end
11
+
12
+ GEMFILES = {
13
+ with_external_deps: expand_gemfile_path.call('with_external_deps.gemfile'),
14
+ without_external_deps: expand_gemfile_path.call('without_external_deps.gemfile')
15
+ }.freeze
16
+
17
+ class << self
18
+ def run!
19
+ OptionParser.new do |opts|
20
+ opts.banner = 'Usage: bin/rspec [options]'
21
+
22
+ opts.on('-w', '--with-plugins', 'Run general tests and plugin tests') do
23
+ run_with_plugin_tests!
24
+ end
25
+
26
+ opts.on('-g', '--without-plugins', 'Run general tests (without plugin tests') do
27
+ run_without_plugin_tests!
28
+ end
29
+ end.parse!
30
+ end
31
+
32
+ private
33
+
34
+ def run_with_plugin_tests!
35
+ ENV['TEST_PLUGINS'] = 'true'
36
+ ENV['FULL_TEST_COVERAGE_CHECK'] = 'true'
37
+ ENV['BUNDLE_GEMFILE'] = GEMFILES[:with_external_deps]
38
+ run_tests!
39
+ end
40
+
41
+ def run_without_plugin_tests!
42
+ ENV['BUNDLE_GEMFILE'] = GEMFILES[:without_external_deps]
43
+ run_tests!
44
+ end
45
+
46
+ def run_tests!
47
+ require 'rubygems'
48
+ require 'bundler/setup'
49
+ load Gem.bin_path('rspec-core', 'rspec')
50
+ end
51
+ end
52
+ end
53
+
54
+ SmartCoreInitializerRSpecRunner.run!
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gem 'thy', '~> 0.1.4'
6
+
7
+ gemspec path: '..'
@@ -0,0 +1,99 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ smart_initializer (0.1.0.alpha4)
5
+ qonfig (~> 0.24)
6
+ smart_engine (~> 0.6)
7
+ smart_types (~> 0.1.0)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ activesupport (6.0.3)
13
+ concurrent-ruby (~> 1.0, >= 1.0.2)
14
+ i18n (>= 0.7, < 2)
15
+ minitest (~> 5.1)
16
+ tzinfo (~> 1.1)
17
+ zeitwerk (~> 2.2, >= 2.2.2)
18
+ armitage-rubocop (0.82.0.2)
19
+ rubocop (= 0.82.0)
20
+ rubocop-performance (= 1.5.2)
21
+ rubocop-rails (= 2.5.2)
22
+ rubocop-rake (= 0.5.1)
23
+ rubocop-rspec (= 1.39.0)
24
+ ast (2.4.0)
25
+ concurrent-ruby (1.1.6)
26
+ diff-lcs (1.3)
27
+ docile (1.3.2)
28
+ i18n (1.8.2)
29
+ concurrent-ruby (~> 1.0)
30
+ jaro_winkler (1.5.4)
31
+ minitest (5.14.0)
32
+ parallel (1.19.1)
33
+ parser (2.7.1.2)
34
+ ast (~> 2.4.0)
35
+ qonfig (0.24.1)
36
+ rack (2.2.2)
37
+ rainbow (3.0.0)
38
+ rake (13.0.1)
39
+ rexml (3.2.4)
40
+ rspec (3.9.0)
41
+ rspec-core (~> 3.9.0)
42
+ rspec-expectations (~> 3.9.0)
43
+ rspec-mocks (~> 3.9.0)
44
+ rspec-core (3.9.2)
45
+ rspec-support (~> 3.9.3)
46
+ rspec-expectations (3.9.2)
47
+ diff-lcs (>= 1.2.0, < 2.0)
48
+ rspec-support (~> 3.9.0)
49
+ rspec-mocks (3.9.1)
50
+ diff-lcs (>= 1.2.0, < 2.0)
51
+ rspec-support (~> 3.9.0)
52
+ rspec-support (3.9.3)
53
+ rubocop (0.82.0)
54
+ jaro_winkler (~> 1.5.1)
55
+ parallel (~> 1.10)
56
+ parser (>= 2.7.0.1)
57
+ rainbow (>= 2.2.2, < 4.0)
58
+ rexml
59
+ ruby-progressbar (~> 1.7)
60
+ unicode-display_width (>= 1.4.0, < 2.0)
61
+ rubocop-performance (1.5.2)
62
+ rubocop (>= 0.71.0)
63
+ rubocop-rails (2.5.2)
64
+ activesupport
65
+ rack (>= 1.1)
66
+ rubocop (>= 0.72.0)
67
+ rubocop-rake (0.5.1)
68
+ rubocop
69
+ rubocop-rspec (1.39.0)
70
+ rubocop (>= 0.68.1)
71
+ ruby-progressbar (1.10.1)
72
+ simplecov (0.18.5)
73
+ docile (~> 1.1)
74
+ simplecov-html (~> 0.11)
75
+ simplecov-html (0.12.2)
76
+ smart_engine (0.6.0)
77
+ smart_types (0.1.0)
78
+ smart_engine (~> 0.6)
79
+ thread_safe (0.3.6)
80
+ thy (0.1.4)
81
+ tzinfo (1.2.7)
82
+ thread_safe (~> 0.1)
83
+ unicode-display_width (1.7.0)
84
+ zeitwerk (2.3.0)
85
+
86
+ PLATFORMS
87
+ ruby
88
+
89
+ DEPENDENCIES
90
+ armitage-rubocop (~> 0.81)
91
+ bundler (~> 2.1)
92
+ rake (~> 13.0)
93
+ rspec (~> 3.9)
94
+ simplecov (~> 0.18)
95
+ smart_initializer!
96
+ thy (~> 0.1.4)
97
+
98
+ BUNDLED WITH
99
+ 2.1.4
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec path: '..'
@@ -0,0 +1,97 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ smart_initializer (0.1.0.alpha4)
5
+ qonfig (~> 0.24)
6
+ smart_engine (~> 0.6)
7
+ smart_types (~> 0.1.0)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ activesupport (6.0.3)
13
+ concurrent-ruby (~> 1.0, >= 1.0.2)
14
+ i18n (>= 0.7, < 2)
15
+ minitest (~> 5.1)
16
+ tzinfo (~> 1.1)
17
+ zeitwerk (~> 2.2, >= 2.2.2)
18
+ armitage-rubocop (0.82.0.2)
19
+ rubocop (= 0.82.0)
20
+ rubocop-performance (= 1.5.2)
21
+ rubocop-rails (= 2.5.2)
22
+ rubocop-rake (= 0.5.1)
23
+ rubocop-rspec (= 1.39.0)
24
+ ast (2.4.0)
25
+ concurrent-ruby (1.1.6)
26
+ diff-lcs (1.3)
27
+ docile (1.3.2)
28
+ i18n (1.8.2)
29
+ concurrent-ruby (~> 1.0)
30
+ jaro_winkler (1.5.4)
31
+ minitest (5.14.0)
32
+ parallel (1.19.1)
33
+ parser (2.7.1.2)
34
+ ast (~> 2.4.0)
35
+ qonfig (0.24.1)
36
+ rack (2.2.2)
37
+ rainbow (3.0.0)
38
+ rake (13.0.1)
39
+ rexml (3.2.4)
40
+ rspec (3.9.0)
41
+ rspec-core (~> 3.9.0)
42
+ rspec-expectations (~> 3.9.0)
43
+ rspec-mocks (~> 3.9.0)
44
+ rspec-core (3.9.2)
45
+ rspec-support (~> 3.9.3)
46
+ rspec-expectations (3.9.2)
47
+ diff-lcs (>= 1.2.0, < 2.0)
48
+ rspec-support (~> 3.9.0)
49
+ rspec-mocks (3.9.1)
50
+ diff-lcs (>= 1.2.0, < 2.0)
51
+ rspec-support (~> 3.9.0)
52
+ rspec-support (3.9.3)
53
+ rubocop (0.82.0)
54
+ jaro_winkler (~> 1.5.1)
55
+ parallel (~> 1.10)
56
+ parser (>= 2.7.0.1)
57
+ rainbow (>= 2.2.2, < 4.0)
58
+ rexml
59
+ ruby-progressbar (~> 1.7)
60
+ unicode-display_width (>= 1.4.0, < 2.0)
61
+ rubocop-performance (1.5.2)
62
+ rubocop (>= 0.71.0)
63
+ rubocop-rails (2.5.2)
64
+ activesupport
65
+ rack (>= 1.1)
66
+ rubocop (>= 0.72.0)
67
+ rubocop-rake (0.5.1)
68
+ rubocop
69
+ rubocop-rspec (1.39.0)
70
+ rubocop (>= 0.68.1)
71
+ ruby-progressbar (1.10.1)
72
+ simplecov (0.18.5)
73
+ docile (~> 1.1)
74
+ simplecov-html (~> 0.11)
75
+ simplecov-html (0.12.2)
76
+ smart_engine (0.6.0)
77
+ smart_types (0.1.0)
78
+ smart_engine (~> 0.6)
79
+ thread_safe (0.3.6)
80
+ tzinfo (1.2.7)
81
+ thread_safe (~> 0.1)
82
+ unicode-display_width (1.7.0)
83
+ zeitwerk (2.3.0)
84
+
85
+ PLATFORMS
86
+ ruby
87
+
88
+ DEPENDENCIES
89
+ armitage-rubocop (~> 0.81)
90
+ bundler (~> 2.1)
91
+ rake (~> 13.0)
92
+ rspec (~> 3.9)
93
+ simplecov (~> 0.18)
94
+ smart_initializer!
95
+
96
+ BUNDLED WITH
97
+ 2.1.4
@@ -6,47 +6,50 @@ require 'forwardable'
6
6
 
7
7
  # @api public
8
8
  # @since 0.1.0
9
- module SmartCore::Initializer
10
- require_relative 'initializer/version'
11
- require_relative 'initializer/errors'
12
- require_relative 'initializer/attribute'
13
- require_relative 'initializer/extensions'
14
- require_relative 'initializer/constructor'
15
- require_relative 'initializer/dsl'
16
- require_relative 'initializer/type_aliasing'
17
-
9
+ module SmartCore
10
+ # @api public
18
11
  # @since 0.1.0
19
- extend SmartCore::Initializer::TypeAliasing
12
+ module Initializer
13
+ require_relative 'initializer/version'
14
+ require_relative 'initializer/errors'
15
+ require_relative 'initializer/plugins'
16
+ require_relative 'initializer/settings'
17
+ require_relative 'initializer/configuration'
18
+ require_relative 'initializer/configurable_module'
19
+ require_relative 'initializer/type_system'
20
+ require_relative 'initializer/attribute'
21
+ require_relative 'initializer/extensions'
22
+ require_relative 'initializer/constructor'
23
+ require_relative 'initializer/dsl'
24
+
25
+ class << self
26
+ # @param base_klass [Class]
27
+ # @return [void]
28
+ #
29
+ # @api private
30
+ # @since 0.1.0
31
+ def included(base_klass)
32
+ base_klass.extend(SmartCore::Initializer::DSL)
33
+ end
34
+ end
20
35
 
21
- class << self
22
- # @param base_klass [Class]
23
36
  # @return [void]
24
37
  #
25
38
  # @api private
26
39
  # @since 0.1.0
27
- def included(base_klass)
28
- base_klass.extend(SmartCore::Initializer::DSL)
29
- end
40
+ def initialize(*); end
30
41
  end
31
42
 
32
- # @return [void]
33
- #
34
- # @api private
35
- # @since 0.1.0
36
- def initialize(*); end
37
-
38
- type_alias(:nil, SmartCore::Types::Value::Nil)
39
- type_alias(:string, SmartCore::Types::Value::String)
40
- type_alias(:symbol, SmartCore::Types::Value::Symbol)
41
- type_alias(:text, SmartCore::Types::Value::Text)
42
- type_alias(:integer, SmartCore::Types::Value::Integer)
43
- type_alias(:float, SmartCore::Types::Value::Float)
44
- type_alias(:numeric, SmartCore::Types::Value::Numeric)
45
- type_alias(:boolean, SmartCore::Types::Value::Boolean)
46
- type_alias(:array, SmartCore::Types::Value::Array)
47
- type_alias(:hash, SmartCore::Types::Value::Hash)
48
- type_alias(:proc, SmartCore::Types::Value::Proc)
49
- type_alias(:class, SmartCore::Types::Value::Class)
50
- type_alias(:module, SmartCore::Types::Value::Module)
51
- type_alias(:any, SmartCore::Types::Value::Any)
43
+ class << self
44
+ # @option type_system [String, Symbol, NilSymbol]
45
+ # @return [Module]
46
+ #
47
+ # @api public
48
+ # @since 0.1.0
49
+ # rubocop:disable Naming/MethodName
50
+ def Initializer(type_system: SmartCore::Initializer::ConfigurableModule::INITIAL_TYPE_SYSTEM)
51
+ SmartCore::Initializer::ConfigurableModule.build(type_system: type_system)
52
+ end
53
+ # rubocop:enable Naming/MethodName
54
+ end
52
55
  end
@@ -17,12 +17,18 @@ class SmartCore::Initializer::Attribute
17
17
  # @since 0.1.0
18
18
  def_delegator :parameters, :name
19
19
 
20
- # @return [SmartCore::Types::Primitive]
20
+ # @return [SmartCore::Initializer::TypeSystem::Interop]
21
21
  #
22
22
  # @pai private
23
23
  # @since 0.1.0
24
24
  def_delegator :parameters, :type
25
25
 
26
+ # @return [Class<SmartCore::Initializer::TypeSystem::Interop>]
27
+ #
28
+ # @api private
29
+ # @since 0.1.0
30
+ def_delegator :parameters, :type_system
31
+
26
32
  # @return [Symbol]
27
33
  #
28
34
  # @pai private
@@ -54,7 +60,8 @@ class SmartCore::Initializer::Attribute
54
60
  def_delegator :parameters, :has_default?
55
61
 
56
62
  # @param name [Symbol]
57
- # @param type [SmartCore::Types::Primitive]
63
+ # @param type [SmartCore::Initializer::TypeSystem::Interop]
64
+ # @param type_system [Class<SmartCore::Initializer::TypeSystem::Interop>]
58
65
  # @param privacy [Symbol]
59
66
  # @param finalizer [SmartCore::Initializer::Attribute::Finalizer::AnonymousBlock/InstanceMethod]
60
67
  # @param cast [Boolean]
@@ -63,9 +70,9 @@ class SmartCore::Initializer::Attribute
63
70
  #
64
71
  # @api private
65
72
  # @since 0.1.0
66
- def initialize(name, type, privacy, finalizer, cast, dynamic_options)
73
+ def initialize(name, type, type_system, privacy, finalizer, cast, dynamic_options)
67
74
  @parameters = SmartCore::Initializer::Attribute::Parameters.new(
68
- name, type, privacy, finalizer, cast, dynamic_options
75
+ name, type, type_system, privacy, finalizer, cast, dynamic_options
69
76
  )
70
77
  end
71
78
 
@@ -77,6 +84,7 @@ class SmartCore::Initializer::Attribute
77
84
  self.class.new(
78
85
  parameters.name.dup,
79
86
  parameters.type,
87
+ parameters.type_system,
80
88
  parameters.privacy,
81
89
  parameters.finalizer.dup,
82
90
  parameters.cast,
@@ -5,7 +5,8 @@
5
5
  class SmartCore::Initializer::Attribute::Factory
6
6
  class << self
7
7
  # @param name [String, Symbol]
8
- # @param type [String, Symbol, SmartCore::Types::Primitive]
8
+ # @param type [String, Symbol, Any]
9
+ # @param type_system [String, Symbol]
9
10
  # @param privacy [String, Symbol]
10
11
  # @param finalize [String, Symbol, Proc]
11
12
  # @param cast [Boolean]
@@ -14,15 +15,24 @@ class SmartCore::Initializer::Attribute::Factory
14
15
  #
15
16
  # @api private
16
17
  # @since 0.1.0
17
- def create(name, type, privacy, finalize, cast, dynamic_options)
18
- name = prepare_name_param(name)
19
- type = prepare_type_param(type)
20
- privacy = prepare_privacy_param(privacy)
21
- finalize = prepare_finalize_param(finalize)
22
- cast = prepare_cast_param(cast)
23
- dynamic_options = prepare_dynamic_options_param(dynamic_options)
24
-
25
- create_attribute(name, type, privacy, finalize, cast, dynamic_options)
18
+ def create(name, type, type_system, privacy, finalize, cast, dynamic_options)
19
+ prepared_name = prepare_name_param(name)
20
+ prepared_privacy = prepare_privacy_param(privacy)
21
+ prepared_finalize = prepare_finalize_param(finalize)
22
+ prepared_cast = prepare_cast_param(cast)
23
+ prepared_type_system = prepare_type_system_param(type_system)
24
+ prepared_type = prepare_type_param(type, prepared_type_system)
25
+ prepared_dynamic_options = prepare_dynamic_options_param(dynamic_options)
26
+
27
+ create_attribute(
28
+ prepared_name,
29
+ prepared_type,
30
+ prepared_type_system,
31
+ prepared_privacy,
32
+ prepared_finalize,
33
+ prepared_cast,
34
+ prepared_dynamic_options
35
+ )
26
36
  end
27
37
 
28
38
  private
@@ -42,23 +52,21 @@ class SmartCore::Initializer::Attribute::Factory
42
52
  name.to_sym
43
53
  end
44
54
 
45
- # @param type [String, Symbol, SmartCore::Types::Primitive]
46
- # @return [SmartCore::Types::Primitive]
55
+ # @param type [String, Symbol, Any]
56
+ # @param type_system [Class<SmartCore::Initializer::TypeSystem::Interop>]
57
+ # @return [SmartCore::Initializer::TypeSystem::Interop]
47
58
  #
48
59
  # @api private
49
60
  # @since 0.1.0
50
- def prepare_type_param(type)
51
- unless type.is_a?(String) || type.is_a?(Symbol) || type.is_a?(SmartCore::Types::Primitive)
52
- raise(SmartCore::Initializer::ArgumentError, <<~ERROR_MESSAGE)
53
- Attribute type should be a type of String, Symbol or SmartCore::Types::Primitive
54
- ERROR_MESSAGE
55
- end
56
-
57
- if type.is_a?(String) || type.is_a?(Symbol)
58
- SmartCore::Initializer.type_from_alias(type)
59
- else
60
- type
61
- end
61
+ def prepare_type_param(type, type_system)
62
+ type_primitive =
63
+ if type.is_a?(String) || type.is_a?(Symbol)
64
+ type_system.type_from_alias(type)
65
+ else
66
+ type
67
+ end
68
+
69
+ type_system.create(type_primitive)
62
70
  end
63
71
 
64
72
  # @param cast [Boolean]
@@ -127,8 +135,18 @@ class SmartCore::Initializer::Attribute::Factory
127
135
  dynamic_options
128
136
  end
129
137
 
138
+ # @param type_system [String, Symbol]
139
+ # @return [Class<SmartCore::Initializer::TypeSystem::Interop>]
140
+ #
141
+ # @api private
142
+ # @since 0.1.0
143
+ def prepare_type_system_param(type_system)
144
+ SmartCore::Initializer::TypeSystem.resolve(type_system)
145
+ end
146
+
130
147
  # @param name [String]
131
- # @param type [SmartCore::Types::Primitive]
148
+ # @param type [SmartCore::Initializer::TypeSystem::Interop]
149
+ # @param type_system [Class<SmartCore::Initializer::TypeSystem::Interop>]
132
150
  # @param privacy [Symbol]
133
151
  # @param finalize [SmartCore::Initializer::Attribute::Finalizer::AnonymousBlock/InstanceMethod]
134
152
  # @param cast [Boolean]
@@ -137,8 +155,10 @@ class SmartCore::Initializer::Attribute::Factory
137
155
  #
138
156
  # @api private
139
157
  # @since 0.1.0
140
- def create_attribute(name, type, privacy, finalize, cast, dynamic_options)
141
- SmartCore::Initializer::Attribute.new(name, type, privacy, finalize, cast, dynamic_options)
158
+ def create_attribute(name, type, type_system, privacy, finalize, cast, dynamic_options)
159
+ SmartCore::Initializer::Attribute.new(
160
+ name, type, type_system, privacy, finalize, cast, dynamic_options
161
+ )
142
162
  end
143
163
  end
144
164
  end