servactory 2.0.3 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/config/locales/en.yml +3 -3
  3. data/config/locales/ru.yml +3 -3
  4. data/lib/servactory/context/workspace/inputs.rb +8 -6
  5. data/lib/servactory/context/workspace/internals.rb +2 -2
  6. data/lib/servactory/context/workspace/outputs.rb +2 -2
  7. data/lib/servactory/context/workspace.rb +5 -0
  8. data/lib/servactory/inputs/input.rb +20 -2
  9. data/lib/servactory/inputs/tools/validation.rb +5 -3
  10. data/lib/servactory/inputs/validations/required.rb +10 -9
  11. data/lib/servactory/inputs/workspace.rb +1 -2
  12. data/lib/servactory/internals/internal.rb +22 -1
  13. data/lib/servactory/maintenance/attributes/options/registrar.rb +11 -11
  14. data/lib/servactory/maintenance/attributes/tools/check_errors.rb +22 -0
  15. data/lib/servactory/maintenance/attributes/tools/validation.rb +81 -0
  16. data/lib/servactory/maintenance/attributes/validations/base.rb +23 -0
  17. data/lib/servactory/maintenance/attributes/validations/errors.rb +18 -0
  18. data/lib/servactory/maintenance/attributes/validations/inclusion.rb +75 -0
  19. data/lib/servactory/maintenance/attributes/validations/must.rb +102 -0
  20. data/lib/servactory/maintenance/attributes/validations/type.rb +62 -0
  21. data/lib/servactory/maintenance/validations/types.rb +10 -18
  22. data/lib/servactory/outputs/output.rb +22 -1
  23. data/lib/servactory/version.rb +2 -2
  24. metadata +10 -12
  25. data/lib/servactory/inputs/tools/check_errors.rb +0 -20
  26. data/lib/servactory/inputs/tools/distributor.rb +0 -24
  27. data/lib/servactory/inputs/validations/inclusion.rb +0 -66
  28. data/lib/servactory/inputs/validations/must.rb +0 -99
  29. data/lib/servactory/inputs/validations/type.rb +0 -52
  30. data/lib/servactory/internals/validations/base.rb +0 -17
  31. data/lib/servactory/internals/validations/type.rb +0 -31
  32. data/lib/servactory/outputs/validations/base.rb +0 -17
  33. data/lib/servactory/outputs/validations/type.rb +0 -31
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Servactory
4
- module Internals
5
- module Validations
6
- class Type < Base
7
- def self.validate!(...)
8
- new(...).validate!
9
- end
10
-
11
- def initialize(context:, internal:, value:)
12
- super()
13
-
14
- @context = context
15
- @internal = internal
16
- @value = value
17
- end
18
-
19
- def validate!
20
- Servactory::Maintenance::Validations::Types.validate!(
21
- context: @context,
22
- attribute: @internal,
23
- types: @internal.types,
24
- value: @value,
25
- error_callback: ->(**args) { raise_error_with(**args) }
26
- )
27
- end
28
- end
29
- end
30
- end
31
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Servactory
4
- module Outputs
5
- module Validations
6
- class Base
7
- protected
8
-
9
- def raise_error_with(message:, **attributes)
10
- message = message.call(**attributes) if message.is_a?(Proc)
11
-
12
- raise @context.class.config.output_error_class.new(message: message)
13
- end
14
- end
15
- end
16
- end
17
- end
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Servactory
4
- module Outputs
5
- module Validations
6
- class Type < Base
7
- def self.validate!(...)
8
- new(...).validate!
9
- end
10
-
11
- def initialize(context:, output:, value:)
12
- super()
13
-
14
- @context = context
15
- @output = output
16
- @value = value
17
- end
18
-
19
- def validate!
20
- Servactory::Maintenance::Validations::Types.validate!(
21
- context: @context,
22
- attribute: @output,
23
- types: @output.types,
24
- value: @value,
25
- error_callback: ->(**args) { raise_error_with(**args) }
26
- )
27
- end
28
- end
29
- end
30
- end
31
- end