servactory 2.0.4 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/locales/en.yml +3 -3
- data/config/locales/ru.yml +3 -3
- data/lib/servactory/context/workspace/internals.rb +2 -2
- data/lib/servactory/context/workspace/outputs.rb +2 -2
- data/lib/servactory/context/workspace.rb +4 -0
- data/lib/servactory/inputs/input.rb +20 -2
- data/lib/servactory/inputs/tools/validation.rb +5 -3
- data/lib/servactory/inputs/validations/required.rb +10 -9
- data/lib/servactory/inputs/workspace.rb +1 -2
- data/lib/servactory/internals/internal.rb +22 -1
- data/lib/servactory/maintenance/attributes/options/registrar.rb +11 -11
- data/lib/servactory/maintenance/attributes/tools/check_errors.rb +22 -0
- data/lib/servactory/maintenance/attributes/tools/validation.rb +81 -0
- data/lib/servactory/maintenance/attributes/validations/base.rb +23 -0
- data/lib/servactory/maintenance/attributes/validations/errors.rb +18 -0
- data/lib/servactory/maintenance/attributes/validations/inclusion.rb +75 -0
- data/lib/servactory/maintenance/attributes/validations/must.rb +102 -0
- data/lib/servactory/maintenance/attributes/validations/type.rb +62 -0
- data/lib/servactory/maintenance/validations/types.rb +10 -18
- data/lib/servactory/outputs/output.rb +22 -1
- data/lib/servactory/version.rb +2 -2
- metadata +8 -10
- data/lib/servactory/inputs/tools/check_errors.rb +0 -20
- data/lib/servactory/inputs/tools/distributor.rb +0 -24
- data/lib/servactory/inputs/validations/inclusion.rb +0 -66
- data/lib/servactory/inputs/validations/must.rb +0 -99
- data/lib/servactory/inputs/validations/type.rb +0 -52
- data/lib/servactory/internals/validations/base.rb +0 -17
- data/lib/servactory/internals/validations/type.rb +0 -31
- data/lib/servactory/outputs/validations/base.rb +0 -17
- data/lib/servactory/outputs/validations/type.rb +0 -31
@@ -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
|