servactory 2.0.0.rc5 → 2.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ecb994c1e8be578cb83edfa20eb4b60efc3b80a36d24439e83e6b0c6208ac3be
4
- data.tar.gz: d75f094fd6d07465761b542e7997ac222fcaf1c2e397216c10c768485a5b4250
3
+ metadata.gz: 7f2faba7bb024470613b92cccd026889f07744afa108b02308995332850bcf87
4
+ data.tar.gz: c6cd5f199e95e2c104b65778125017a62347e216e97d0cf2f2337fb081fc85ba
5
5
  SHA512:
6
- metadata.gz: a0213bf096871d202defff4eab2055bd91c9414c1ebd8bba279b2fda73df0345b1321bcb802a68176cc3b16abdc81c77dd2fd55294f06123a674ed74c2ae2c0f
7
- data.tar.gz: 403bc708be4a3cfc9ce73c78f2f14336a8d49b9e9a488b0781b80ee2808cc2217599f3b5cc6f54396239e404e52f8d5719676b491f0adc0019bdb4f31c5b69b4
6
+ metadata.gz: a46461312794bbee6b5a38b164377a5fb10fd258315936b89f6118f489b4fa66b3b8e75c518a7cc1e32d2827c10844f085d7fa38123eb8c2781177fcdced77fd
7
+ data.tar.gz: cf285f17d88fa7034b349b0e22c3bf6649fce0d525a75d49ac22a692a75cd2048e2894065a3e4d83a2241abfafc7fc65390fc690b7d716d54e96d97dd825734e
@@ -48,8 +48,8 @@ module Servactory
48
48
 
49
49
  input.value = input.default if input.optional? && input.value.blank?
50
50
 
51
- if input.hash_mode?
52
- input.value = prepare_hash_values_inside(object: input.value, schema: input.schema.fetch(:is))
51
+ if input.hash_mode? && (tmp_schema = input.schema.fetch(:is)).present?
52
+ input.value = prepare_hash_values_inside(object: input.value, schema: tmp_schema)
53
53
  end
54
54
 
55
55
  input_prepare = input.prepare.fetch(:in, nil)
@@ -9,7 +9,6 @@ module Servactory
9
9
  collection_of_inputs: collection_of_inputs
10
10
  )
11
11
  end
12
- alias inp inputs
13
12
 
14
13
  def internals
15
14
  @internals ||= Internals.new(
@@ -17,7 +16,6 @@ module Servactory
17
16
  collection_of_internals: collection_of_internals
18
17
  )
19
18
  end
20
- alias int internals
21
19
 
22
20
  def outputs
23
21
  @outputs ||= Outputs.new(
@@ -25,7 +23,6 @@ module Servactory
25
23
  collection_of_outputs: collection_of_outputs
26
24
  )
27
25
  end
28
- alias out outputs
29
26
 
30
27
  def fail_input!(input_name, message:)
31
28
  raise self.class.config.input_error_class.new(
@@ -16,7 +16,6 @@ module Servactory
16
16
  name,
17
17
  *helpers,
18
18
  as: nil,
19
- type:,
20
19
  collection_mode_class_names:,
21
20
  hash_mode_class_names:,
22
21
  option_helpers:,
@@ -30,7 +29,7 @@ module Servactory
30
29
 
31
30
  options = apply_helpers_for_options(helpers: helpers, options: options) if helpers.present?
32
31
 
33
- add_basic_options_with(type: type, options: options)
32
+ add_basic_options_with(options)
34
33
  end
35
34
  # rubocop:enable Style/KeywordParametersOrder
36
35
 
@@ -60,15 +59,15 @@ module Servactory
60
59
  options.merge(prepared_options)
61
60
  end
62
61
 
63
- def add_basic_options_with(type:, options:)
62
+ def add_basic_options_with(options)
64
63
  # Check Class: Servactory::Inputs::Validations::Required
65
64
  add_required_option_with(options)
66
65
 
67
66
  # Check Class: Servactory::Inputs::Validations::Type
68
- add_types_option_with(type)
67
+ add_types_option_with(options)
69
68
  add_default_option_with(options)
70
- add_collection_option_with(type, options)
71
- add_hash_option_with(type, options)
69
+ add_collection_option_with(options)
70
+ add_hash_option_with(options)
72
71
 
73
72
  # Check Class: Servactory::Inputs::Validations::Inclusion
74
73
  add_inclusion_option_with(options)
@@ -107,12 +106,12 @@ module Servactory
107
106
  )
108
107
  end
109
108
 
110
- def add_types_option_with(type)
109
+ def add_types_option_with(options)
111
110
  collection_of_options << Servactory::Maintenance::Attributes::Option.new(
112
111
  name: :types,
113
112
  attribute: self,
114
113
  validation_class: Servactory::Inputs::Validations::Type,
115
- original_value: Array(type),
114
+ original_value: Array(options.fetch(:type)),
116
115
  need_for_checks: true,
117
116
  body_fallback: nil,
118
117
  with_advanced_mode: false
@@ -137,7 +136,7 @@ module Servactory
137
136
  )
138
137
  end
139
138
 
140
- def add_collection_option_with(type, options) # rubocop:disable Metrics/MethodLength
139
+ def add_collection_option_with(options) # rubocop:disable Metrics/MethodLength
141
140
  collection_of_options << Servactory::Maintenance::Attributes::Option.new(
142
141
  name: :consists_of,
143
142
  attribute: self,
@@ -145,7 +144,7 @@ module Servactory
145
144
  define_methods: [
146
145
  Servactory::Maintenance::Attributes::DefineMethod.new(
147
146
  name: :collection_mode?,
148
- content: ->(**) { collection_mode_class_names.include?(type) }
147
+ content: ->(**) { collection_mode_class_names.include?(options.fetch(:type)) }
149
148
  )
150
149
  ],
151
150
  define_conflicts: [
@@ -161,7 +160,7 @@ module Servactory
161
160
  )
162
161
  end
163
162
 
164
- def add_hash_option_with(type, options) # rubocop:disable Metrics/MethodLength
163
+ def add_hash_option_with(options) # rubocop:disable Metrics/MethodLength
165
164
  collection_of_options << Servactory::Maintenance::Attributes::Option.new(
166
165
  name: :schema,
167
166
  attribute: self,
@@ -169,7 +168,7 @@ module Servactory
169
168
  define_methods: [
170
169
  Servactory::Maintenance::Attributes::DefineMethod.new(
171
170
  name: :hash_mode?,
172
- content: ->(**) { hash_mode_class_names.include?(type) }
171
+ content: ->(**) { hash_mode_class_names.include?(options.fetch(:type)) }
173
172
  )
174
173
  ],
175
174
  define_conflicts: [
@@ -9,7 +9,6 @@ module Servactory
9
9
 
10
10
  def initialize(
11
11
  name,
12
- type:,
13
12
  collection_mode_class_names:,
14
13
  hash_mode_class_names:,
15
14
  **options
@@ -18,7 +17,7 @@ module Servactory
18
17
  @collection_mode_class_names = collection_mode_class_names
19
18
  @hash_mode_class_names = hash_mode_class_names
20
19
 
21
- add_basic_options_with(type: type, options: options)
20
+ add_basic_options_with(options)
22
21
  end
23
22
 
24
23
  def method_missing(name, *args, &block)
@@ -33,26 +32,26 @@ module Servactory
33
32
  collection_of_options.names.include?(name) || super
34
33
  end
35
34
 
36
- def add_basic_options_with(type:, options:)
35
+ def add_basic_options_with(options)
37
36
  # Check Class: Servactory::Internals::Validations::Type
38
- add_types_option_with(type)
39
- add_collection_option_with(type, options)
40
- add_hash_option_with(type, options)
37
+ add_types_option_with(options)
38
+ add_collection_option_with(options)
39
+ add_hash_option_with(options)
41
40
  end
42
41
 
43
- def add_types_option_with(type)
42
+ def add_types_option_with(options)
44
43
  collection_of_options << Servactory::Maintenance::Attributes::Option.new(
45
44
  name: :types,
46
45
  attribute: self,
47
46
  validation_class: Servactory::Internals::Validations::Type,
48
- original_value: Array(type),
47
+ original_value: Array(options.fetch(:type)),
49
48
  need_for_checks: true,
50
49
  body_fallback: nil,
51
50
  with_advanced_mode: false
52
51
  )
53
52
  end
54
53
 
55
- def add_collection_option_with(type, options) # rubocop:disable Metrics/MethodLength
54
+ def add_collection_option_with(options) # rubocop:disable Metrics/MethodLength
56
55
  collection_of_options << Servactory::Maintenance::Attributes::Option.new(
57
56
  name: :consists_of,
58
57
  attribute: self,
@@ -60,7 +59,7 @@ module Servactory
60
59
  define_methods: [
61
60
  Servactory::Maintenance::Attributes::DefineMethod.new(
62
61
  name: :collection_mode?,
63
- content: ->(**) { collection_mode_class_names.include?(type) }
62
+ content: ->(**) { collection_mode_class_names.include?(options.fetch(:type)) }
64
63
  )
65
64
  ],
66
65
  need_for_checks: false,
@@ -71,7 +70,7 @@ module Servactory
71
70
  )
72
71
  end
73
72
 
74
- def add_hash_option_with(type, options) # rubocop:disable Metrics/MethodLength
73
+ def add_hash_option_with(options) # rubocop:disable Metrics/MethodLength
75
74
  collection_of_options << Servactory::Maintenance::Attributes::Option.new(
76
75
  name: :schema,
77
76
  attribute: self,
@@ -79,7 +78,7 @@ module Servactory
79
78
  define_methods: [
80
79
  Servactory::Maintenance::Attributes::DefineMethod.new(
81
80
  name: :hash_mode?,
82
- content: ->(**) { hash_mode_class_names.include?(type) }
81
+ content: ->(**) { hash_mode_class_names.include?(options.fetch(:type)) }
83
82
  )
84
83
  ],
85
84
  need_for_checks: false,
@@ -9,7 +9,6 @@ module Servactory
9
9
 
10
10
  def initialize(
11
11
  name,
12
- type:,
13
12
  collection_mode_class_names:,
14
13
  hash_mode_class_names:,
15
14
  **options
@@ -18,7 +17,7 @@ module Servactory
18
17
  @collection_mode_class_names = collection_mode_class_names
19
18
  @hash_mode_class_names = hash_mode_class_names
20
19
 
21
- add_basic_options_with(type: type, options: options)
20
+ add_basic_options_with(options)
22
21
  end
23
22
 
24
23
  def method_missing(name, *args, &block)
@@ -33,26 +32,26 @@ module Servactory
33
32
  collection_of_options.names.include?(name) || super
34
33
  end
35
34
 
36
- def add_basic_options_with(type:, options:)
35
+ def add_basic_options_with(options)
37
36
  # Check Class: Servactory::Outputs::Validations::Type
38
- add_types_option_with(type)
39
- add_collection_option_with(type, options)
40
- add_hash_option_with(type, options)
37
+ add_types_option_with(options)
38
+ add_collection_option_with(options)
39
+ add_hash_option_with(options)
41
40
  end
42
41
 
43
- def add_types_option_with(type)
42
+ def add_types_option_with(options)
44
43
  collection_of_options << Servactory::Maintenance::Attributes::Option.new(
45
44
  name: :types,
46
45
  attribute: self,
47
46
  validation_class: Servactory::Internals::Validations::Type,
48
- original_value: Array(type),
47
+ original_value: Array(options.fetch(:type)),
49
48
  need_for_checks: true,
50
49
  body_fallback: nil,
51
50
  with_advanced_mode: false
52
51
  )
53
52
  end
54
53
 
55
- def add_collection_option_with(type, options) # rubocop:disable Metrics/MethodLength
54
+ def add_collection_option_with(options) # rubocop:disable Metrics/MethodLength
56
55
  collection_of_options << Servactory::Maintenance::Attributes::Option.new(
57
56
  name: :consists_of,
58
57
  attribute: self,
@@ -60,7 +59,7 @@ module Servactory
60
59
  define_methods: [
61
60
  Servactory::Maintenance::Attributes::DefineMethod.new(
62
61
  name: :collection_mode?,
63
- content: ->(**) { collection_mode_class_names.include?(type) }
62
+ content: ->(**) { collection_mode_class_names.include?(options.fetch(:type)) }
64
63
  )
65
64
  ],
66
65
  need_for_checks: false,
@@ -71,7 +70,7 @@ module Servactory
71
70
  )
72
71
  end
73
72
 
74
- def add_hash_option_with(type, options) # rubocop:disable Metrics/MethodLength
73
+ def add_hash_option_with(options) # rubocop:disable Metrics/MethodLength
75
74
  collection_of_options << Servactory::Maintenance::Attributes::Option.new(
76
75
  name: :schema,
77
76
  attribute: self,
@@ -79,7 +78,7 @@ module Servactory
79
78
  define_methods: [
80
79
  Servactory::Maintenance::Attributes::DefineMethod.new(
81
80
  name: :hash_mode?,
82
- content: ->(**) { hash_mode_class_names.include?(type) }
81
+ content: ->(**) { hash_mode_class_names.include?(options.fetch(:type)) }
83
82
  )
84
83
  ],
85
84
  need_for_checks: false,
@@ -5,7 +5,7 @@ module Servactory
5
5
  MAJOR = 2
6
6
  MINOR = 0
7
7
  PATCH = 0
8
- PRE = "rc5"
8
+ PRE = nil
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH, PRE].compact.join(".")
11
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: servactory
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.rc5
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Sokolov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-28 00:00:00.000000000 Z
11
+ date: 2023-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -294,9 +294,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
294
294
  version: 2.7.0
295
295
  required_rubygems_version: !ruby/object:Gem::Requirement
296
296
  requirements:
297
- - - ">"
297
+ - - ">="
298
298
  - !ruby/object:Gem::Version
299
- version: 1.3.1
299
+ version: '0'
300
300
  requirements: []
301
301
  rubygems_version: 3.4.17
302
302
  signing_key: