servactory 1.6.1 → 1.6.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/lib/servactory/context/callable.rb +2 -2
  3. data/lib/servactory/context/workspace.rb +10 -8
  4. data/lib/servactory/inputs/input.rb +15 -15
  5. data/lib/servactory/inputs/option.rb +3 -3
  6. data/lib/servactory/inputs/options_collection.rb +2 -2
  7. data/lib/servactory/inputs/tools/find_unnecessary.rb +3 -3
  8. data/lib/servactory/inputs/tools/prepare.rb +5 -5
  9. data/lib/servactory/inputs/tools/rules.rb +3 -3
  10. data/lib/servactory/inputs/tools/{check.rb → validation.rb} +11 -11
  11. data/lib/servactory/inputs/{checks → validations}/base.rb +2 -4
  12. data/lib/servactory/inputs/{checks → validations}/errors.rb +1 -1
  13. data/lib/servactory/inputs/{checks → validations}/inclusion.rb +1 -1
  14. data/lib/servactory/inputs/{checks → validations}/must.rb +1 -1
  15. data/lib/servactory/inputs/{checks → validations}/required.rb +1 -1
  16. data/lib/servactory/inputs/{checks → validations}/type.rb +1 -1
  17. data/lib/servactory/inputs/workbench.rb +4 -4
  18. data/lib/servactory/internals/tools/prepare.rb +2 -2
  19. data/lib/servactory/internals/{checks → validations}/base.rb +1 -1
  20. data/lib/servactory/internals/{checks → validations}/type.rb +4 -4
  21. data/lib/servactory/methods/collection.rb +1 -1
  22. data/lib/servactory/methods/method.rb +9 -1
  23. data/lib/servactory/methods/workbench.rb +15 -2
  24. data/lib/servactory/outputs/output.rb +1 -1
  25. data/lib/servactory/outputs/tools/conflicts.rb +3 -3
  26. data/lib/servactory/outputs/tools/prepare.rb +2 -2
  27. data/lib/servactory/outputs/{checks → validations}/base.rb +1 -1
  28. data/lib/servactory/outputs/{checks → validations}/type.rb +4 -4
  29. data/lib/servactory/outputs/workbench.rb +1 -1
  30. data/lib/servactory/utils.rb +1 -1
  31. data/lib/servactory/version.rb +1 -1
  32. metadata +13 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 77500bca8d6ee7ee302e77b8b64eb840a2e004bece8743a2b246e49a49a42b24
4
- data.tar.gz: dfff784e9b2787ac349d5e33f84f75a318814ecf64ac0df7915a500b2073f6ef
3
+ metadata.gz: 321c1d5afff2d05fca47c222254ed759bcab36acce61f346d4a141f936e25fa7
4
+ data.tar.gz: 9820d66f4f2985665b3552583c2f84eddeb6860cb588c5444da7f32d32bf6c89
5
5
  SHA512:
6
- metadata.gz: 16091e0330a74cda1246f0a3a4ccdbc9ed572cba9c29d485e306c95c2405792e12bd9d03cbf13e1e17cf0c40bd4839ea997d75eac7f5f26a199eb8bc757af01a
7
- data.tar.gz: 2d67bd5beff3c5a4d73a28a70662b3df52e61757fadc37f15751e745e28f9a3b18cd3af43d84684339debd58b6231ca70bdcbcc8b2af8c20ef76f9eb9e68c883
6
+ metadata.gz: 3db3d15d89132bcb65afe6d25f278cb59e3c40f1cae70a02bb9f8af681356dc2aa14e05017c03088a10baf6b1de22833aaa3b70fb6f3138027cb283a279b77cb
7
+ data.tar.gz: 1d01c55aba13762649115010a8cb3ca99489773abc8d48236529139318f9f12e636de08b8b66c417157918ff44b7223d0d9bd9a0f9faa9663aef1e908a869d79
@@ -16,7 +16,7 @@ module Servactory
16
16
 
17
17
  prepare_data
18
18
 
19
- inputs_workbench.check!
19
+ inputs_workbench.validate!
20
20
 
21
21
  methods_workbench.run!
22
22
 
@@ -41,7 +41,7 @@ module Servactory
41
41
 
42
42
  prepare_data
43
43
 
44
- inputs_workbench.check!
44
+ inputs_workbench.validate!
45
45
 
46
46
  methods_workbench.run!
47
47
 
@@ -3,8 +3,6 @@
3
3
  module Servactory
4
4
  module Context
5
5
  module Workspace
6
- attr_reader :inputs
7
-
8
6
  def errors
9
7
  @errors ||= Servactory::Errors::Collection.new
10
8
  end
@@ -13,6 +11,16 @@ module Servactory
13
11
  @inputs = inputs
14
12
  end
15
13
 
14
+ def raise_first_fail
15
+ return if (tmp_errors = errors.for_fails.not_blank).empty?
16
+
17
+ raise tmp_errors.first
18
+ end
19
+
20
+ protected
21
+
22
+ attr_reader :inputs
23
+
16
24
  def fail_input!(input_name, message:)
17
25
  raise Servactory.configuration.input_error_class.new(
18
26
  input_name: input_name,
@@ -23,12 +31,6 @@ module Servactory
23
31
  def fail!(message:, meta: nil)
24
32
  errors << Servactory.configuration.failure_class.new(message: message, meta: meta)
25
33
  end
26
-
27
- def raise_first_fail
28
- return if (tmp_errors = errors.for_fails.not_blank).empty?
29
-
30
- raise tmp_errors.first
31
- end
32
34
  end
33
35
  end
34
36
  end
@@ -29,18 +29,18 @@ module Servactory
29
29
  # rubocop:enable Style/KeywordParametersOrder
30
30
 
31
31
  def add_basic_options_with(type:, options:)
32
- # Check Class: Servactory::Inputs::Checks::Required
32
+ # Check Class: Servactory::Inputs::Validations::Required
33
33
  add_required_option_with(options)
34
34
 
35
- # Check Class: Servactory::Inputs::Checks::Type
35
+ # Check Class: Servactory::Inputs::Validations::Type
36
36
  add_types_option_with(type)
37
37
  add_default_option_with(options)
38
38
  add_array_option_with(options)
39
39
 
40
- # Check Class: Servactory::Inputs::Checks::Inclusion
40
+ # Check Class: Servactory::Inputs::Validations::Inclusion
41
41
  add_inclusion_option_with(options)
42
42
 
43
- # Check Class: Servactory::Inputs::Checks::Must
43
+ # Check Class: Servactory::Inputs::Validations::Must
44
44
  add_must_option_with(options)
45
45
 
46
46
  # Check Class: nil
@@ -51,15 +51,15 @@ module Servactory
51
51
  collection_of_options << Option.new(
52
52
  name: :required,
53
53
  input: self,
54
- check_class: Servactory::Inputs::Checks::Required,
54
+ validation_class: Servactory::Inputs::Validations::Required,
55
55
  define_input_methods: [
56
56
  DefineInputMethod.new(
57
57
  name: :required?,
58
- content: ->(value:) { Servactory::Utils.boolean?(value[:is]) }
58
+ content: ->(value:) { Servactory::Utils.true?(value[:is]) }
59
59
  ),
60
60
  DefineInputMethod.new(
61
61
  name: :optional?,
62
- content: ->(value:) { !Servactory::Utils.boolean?(value[:is]) }
62
+ content: ->(value:) { !Servactory::Utils.true?(value[:is]) }
63
63
  )
64
64
  ],
65
65
  define_input_conflicts: [
@@ -76,7 +76,7 @@ module Servactory
76
76
  collection_of_options << Option.new(
77
77
  name: :types,
78
78
  input: self,
79
- check_class: Servactory::Inputs::Checks::Type,
79
+ validation_class: Servactory::Inputs::Validations::Type,
80
80
  original_value: Array(type),
81
81
  need_for_checks: true,
82
82
  value_fallback: nil,
@@ -88,7 +88,7 @@ module Servactory
88
88
  collection_of_options << Option.new(
89
89
  name: :default,
90
90
  input: self,
91
- check_class: Servactory::Inputs::Checks::Type,
91
+ validation_class: Servactory::Inputs::Validations::Type,
92
92
  define_input_methods: [
93
93
  DefineInputMethod.new(
94
94
  name: :default_value_present?,
@@ -106,11 +106,11 @@ module Servactory
106
106
  collection_of_options << Option.new(
107
107
  name: :array,
108
108
  input: self,
109
- check_class: Servactory::Inputs::Checks::Type,
109
+ validation_class: Servactory::Inputs::Validations::Type,
110
110
  define_input_methods: [
111
111
  DefineInputMethod.new(
112
112
  name: :array?,
113
- content: ->(value:) { Servactory::Utils.boolean?(value[:is]) }
113
+ content: ->(value:) { Servactory::Utils.true?(value[:is]) }
114
114
  )
115
115
  ],
116
116
  define_input_conflicts: [
@@ -128,7 +128,7 @@ module Servactory
128
128
  collection_of_options << Option.new(
129
129
  name: :inclusion,
130
130
  input: self,
131
- check_class: Servactory::Inputs::Checks::Inclusion,
131
+ validation_class: Servactory::Inputs::Validations::Inclusion,
132
132
  define_input_methods: [
133
133
  DefineInputMethod.new(
134
134
  name: :inclusion_present?,
@@ -146,7 +146,7 @@ module Servactory
146
146
  collection_of_options << Option.new(
147
147
  name: :must,
148
148
  input: self,
149
- check_class: Servactory::Inputs::Checks::Must,
149
+ validation_class: Servactory::Inputs::Validations::Must,
150
150
  define_input_methods: [
151
151
  DefineInputMethod.new(
152
152
  name: :must_present?,
@@ -165,11 +165,11 @@ module Servactory
165
165
  collection_of_options << Option.new(
166
166
  name: :internal,
167
167
  input: self,
168
- check_class: nil,
168
+ validation_class: nil,
169
169
  define_input_methods: [
170
170
  DefineInputMethod.new(
171
171
  name: :internal?,
172
- content: ->(value:) { Servactory::Utils.boolean?(value[:is]) }
172
+ content: ->(value:) { Servactory::Utils.true?(value[:is]) }
173
173
  )
174
174
  ],
175
175
  need_for_checks: false,
@@ -8,7 +8,7 @@ module Servactory
8
8
  private_constant :DEFAULT_VALUE
9
9
 
10
10
  attr_reader :name,
11
- :check_class,
11
+ :validation_class,
12
12
  :define_input_methods,
13
13
  :define_input_conflicts,
14
14
  :need_for_checks,
@@ -19,7 +19,7 @@ module Servactory
19
19
  def initialize(
20
20
  name:,
21
21
  input:,
22
- check_class:,
22
+ validation_class:,
23
23
  need_for_checks:,
24
24
  value_fallback:,
25
25
  original_value: nil,
@@ -30,7 +30,7 @@ module Servactory
30
30
  **options
31
31
  ) # do
32
32
  @name = name.to_sym
33
- @check_class = check_class
33
+ @validation_class = validation_class
34
34
  @define_input_methods = define_input_methods
35
35
  @define_input_conflicts = define_input_conflicts
36
36
  @need_for_checks = need_for_checks
@@ -11,8 +11,8 @@ module Servactory
11
11
  @collection = Set.new
12
12
  end
13
13
 
14
- def check_classes
15
- filter { |option| option.check_class.present? }.map(&:check_class).uniq
14
+ def validation_classes
15
+ filter { |option| option.validation_class.present? }.map(&:validation_class).uniq
16
16
  end
17
17
 
18
18
  def options_for_checks
@@ -4,8 +4,8 @@ module Servactory
4
4
  module Inputs
5
5
  module Tools
6
6
  class FindUnnecessary
7
- def self.check!(...)
8
- new(...).check!
7
+ def self.validate!(...)
8
+ new(...).validate!
9
9
  end
10
10
 
11
11
  def initialize(context, incoming_arguments, collection_of_inputs)
@@ -14,7 +14,7 @@ module Servactory
14
14
  @collection_of_inputs = collection_of_inputs
15
15
  end
16
16
 
17
- def check!
17
+ def validate!
18
18
  return if unnecessary_attributes.empty?
19
19
 
20
20
  message_text = I18n.t(
@@ -31,11 +31,11 @@ module Servactory
31
31
  input_value = @incoming_arguments.fetch(input.name, nil)
32
32
  input_value = input.default if input.optional? && input_value.blank?
33
33
 
34
- @inputs_variables[input.internal_name] = input_value
35
-
36
- return unless input.internal?
37
-
38
- @internal_variables[input.name] = input_value
34
+ if input.internal?
35
+ @internal_variables[input.name] = input_value
36
+ else
37
+ @inputs_variables[input.internal_name] = input_value
38
+ end
39
39
  end
40
40
 
41
41
  def create_instance_variables
@@ -4,8 +4,8 @@ module Servactory
4
4
  module Inputs
5
5
  module Tools
6
6
  class Rules
7
- def self.check!(...)
8
- new(...).check!
7
+ def self.validate!(...)
8
+ new(...).validate!
9
9
  end
10
10
 
11
11
  def initialize(context, collection_of_inputs)
@@ -13,7 +13,7 @@ module Servactory
13
13
  @collection_of_inputs = collection_of_inputs
14
14
  end
15
15
 
16
- def check!
16
+ def validate!
17
17
  @collection_of_inputs.each do |input|
18
18
  check_for!(input)
19
19
  end
@@ -3,9 +3,9 @@
3
3
  module Servactory
4
4
  module Inputs
5
5
  module Tools
6
- class Check
7
- def self.check!(...)
8
- new(...).check!
6
+ class Validation
7
+ def self.validate!(...)
8
+ new(...).validate!
9
9
  end
10
10
 
11
11
  def initialize(context, incoming_arguments, collection_of_inputs)
@@ -14,7 +14,7 @@ module Servactory
14
14
  @collection_of_inputs = collection_of_inputs
15
15
  end
16
16
 
17
- def check!
17
+ def validate!
18
18
  @collection_of_inputs.each do |input|
19
19
  process_input(input)
20
20
  end
@@ -31,9 +31,9 @@ module Servactory
31
31
  end
32
32
 
33
33
  def process_option(check_key, check_options, input:)
34
- check_classes_from(input).each do |check_class|
35
- errors_from_checks = process_check_class(
36
- check_class,
34
+ validation_classes_from(input).each do |validation_class|
35
+ errors_from_checks = process_validation_classes(
36
+ validation_class,
37
37
  input: input,
38
38
  check_key: check_key,
39
39
  check_options: check_options
@@ -43,8 +43,8 @@ module Servactory
43
43
  end
44
44
  end
45
45
 
46
- def process_check_class(check_class, input:, check_key:, check_options:)
47
- check_class.check(
46
+ def process_validation_classes(validation_class, input:, check_key:, check_options:)
47
+ validation_class.check(
48
48
  context: @context,
49
49
  input: input,
50
50
  value: @incoming_arguments.fetch(input.name, nil),
@@ -55,8 +55,8 @@ module Servactory
55
55
 
56
56
  ########################################################################
57
57
 
58
- def check_classes_from(input)
59
- input.collection_of_options.check_classes
58
+ def validation_classes_from(input)
59
+ input.collection_of_options.validation_classes
60
60
  end
61
61
 
62
62
  ########################################################################
@@ -2,9 +2,9 @@
2
2
 
3
3
  module Servactory
4
4
  module Inputs
5
- module Checks
5
+ module Validations
6
6
  class Base
7
- protected
7
+ private
8
8
 
9
9
  def add_error(message, **attributes)
10
10
  message = message.call(**attributes) if message.is_a?(Proc)
@@ -12,8 +12,6 @@ module Servactory
12
12
  errors << message
13
13
  end
14
14
 
15
- private
16
-
17
15
  def errors
18
16
  @errors ||= Errors.new
19
17
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Servactory
4
4
  module Inputs
5
- module Checks
5
+ module Validations
6
6
  class Errors
7
7
  # NOTE: http://words.steveklabnik.com/beware-subclassing-ruby-core-classes
8
8
  extend Forwardable
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Servactory
4
4
  module Inputs
5
- module Checks
5
+ module Validations
6
6
  class Inclusion < Base
7
7
  DEFAULT_MESSAGE = lambda do |service_class_name:, input:, value:|
8
8
  I18n.t(
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Servactory
4
4
  module Inputs
5
- module Checks
5
+ module Validations
6
6
  class Must < Base
7
7
  DEFAULT_MESSAGE = lambda do |service_class_name:, input:, value:, code:|
8
8
  I18n.t(
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Servactory
4
4
  module Inputs
5
- module Checks
5
+ module Validations
6
6
  class Required < Base
7
7
  DEFAULT_MESSAGE = lambda do |service_class_name:, input:, value:|
8
8
  i18n_key = "servactory.inputs.checks.required.default_error."
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Servactory
4
4
  module Inputs
5
- module Checks
5
+ module Validations
6
6
  class Type < Base
7
7
  DEFAULT_MESSAGE = lambda do |service_class_name:, input:, expected_type:, given_type:|
8
8
  if input.array?
@@ -17,19 +17,19 @@ module Servactory
17
17
  end
18
18
 
19
19
  def find_unnecessary!
20
- Tools::FindUnnecessary.check!(context, @incoming_arguments, collection_of_inputs)
20
+ Tools::FindUnnecessary.validate!(context, @incoming_arguments, collection_of_inputs)
21
21
  end
22
22
 
23
23
  def check_rules!
24
- Tools::Rules.check!(context, collection_of_inputs)
24
+ Tools::Rules.validate!(context, collection_of_inputs)
25
25
  end
26
26
 
27
27
  def prepare
28
28
  Tools::Prepare.prepare(context, @incoming_arguments, collection_of_inputs)
29
29
  end
30
30
 
31
- def check!
32
- Tools::Check.check!(context, @incoming_arguments, collection_of_inputs)
31
+ def validate!
32
+ Tools::Validation.validate!(context, @incoming_arguments, collection_of_inputs)
33
33
  end
34
34
 
35
35
  private
@@ -30,7 +30,7 @@ module Servactory
30
30
  # EXAMPLE:
31
31
  #
32
32
  # define_method(:user=) do |value|
33
- # Servactory::Internals::Checks::Type.check!( context: self, internal:, value: )
33
+ # Servactory::Internals::Validations::Type.validate!( context: self, internal:, value: )
34
34
  #
35
35
  # instance_variable_set(:@user, value)
36
36
  # end
@@ -40,7 +40,7 @@ module Servactory
40
40
  def context_internal_template_for(internal)
41
41
  <<-RUBY
42
42
  define_method(:#{internal.name}=) do |value|
43
- Servactory::Internals::Checks::Type.check!(
43
+ Servactory::Internals::Validations::Type.validate!(
44
44
  context: self,
45
45
  internal: internal,
46
46
  value: value
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Servactory
4
4
  module Internals
5
- module Checks
5
+ module Validations
6
6
  class Base
7
7
  protected
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Servactory
4
4
  module Internals
5
- module Checks
5
+ module Validations
6
6
  class Type < Base
7
7
  DEFAULT_MESSAGE = lambda do |service_class_name:, internal:, expected_type:, given_type:|
8
8
  I18n.t(
@@ -16,8 +16,8 @@ module Servactory
16
16
 
17
17
  private_constant :DEFAULT_MESSAGE
18
18
 
19
- def self.check!(...)
20
- new(...).check!
19
+ def self.validate!(...)
20
+ new(...).validate!
21
21
  end
22
22
 
23
23
  ##########################################################################
@@ -30,7 +30,7 @@ module Servactory
30
30
  @value = value
31
31
  end
32
32
 
33
- def check!
33
+ def validate!
34
34
  return if prepared_types.any? { |type| @value.is_a?(type) }
35
35
 
36
36
  raise_error_with(
@@ -5,7 +5,7 @@ module Servactory
5
5
  class Collection
6
6
  # NOTE: http://words.steveklabnik.com/beware-subclassing-ruby-core-classes
7
7
  extend Forwardable
8
- def_delegators :@collection, :<<, :each, :merge
8
+ def_delegators :@collection, :<<, :each, :merge, :empty?
9
9
 
10
10
  def initialize(*)
11
11
  @collection = Set.new
@@ -4,12 +4,20 @@ module Servactory
4
4
  module Methods
5
5
  class Method
6
6
  attr_reader :name,
7
- :condition
7
+ :condition,
8
+ :is_condition_opposite
8
9
 
9
10
  def initialize(name, **options)
10
11
  @name = name
11
12
 
13
+ @is_condition_opposite = false
12
14
  @condition = options.fetch(:if, nil)
15
+
16
+ return unless @condition.nil?
17
+
18
+ @condition = options.fetch(:unless, nil)
19
+
20
+ @is_condition_opposite = true unless @condition.nil?
13
21
  end
14
22
  end
15
23
  end
@@ -16,6 +16,8 @@ module Servactory
16
16
  end
17
17
 
18
18
  def run!
19
+ return try_to_use_call if collection_of_methods.empty?
20
+
19
21
  collection_of_methods.each do |make_method|
20
22
  next if unnecessary_for?(make_method)
21
23
 
@@ -28,11 +30,22 @@ module Servactory
28
30
  attr_reader :context,
29
31
  :collection_of_methods
30
32
 
33
+ def try_to_use_call
34
+ context.try(:send, :call)
35
+ end
36
+
31
37
  def unnecessary_for?(make_method)
32
38
  condition = make_method.condition
39
+ is_condition_opposite = make_method.is_condition_opposite
40
+
41
+ result = prepare_condition_for(condition)
42
+
43
+ is_condition_opposite ? !result : result
44
+ end
33
45
 
34
- return false if condition.blank?
35
- return !Servactory::Utils.boolean?(condition) unless condition.is_a?(Proc)
46
+ def prepare_condition_for(condition)
47
+ return false if condition.nil?
48
+ return !Servactory::Utils.true?(condition) unless condition.is_a?(Proc)
36
49
 
37
50
  !condition.call(context: context)
38
51
  end
@@ -25,7 +25,7 @@ module Servactory
25
25
  end
26
26
 
27
27
  def required?
28
- Servactory::Utils.boolean?(required)
28
+ Servactory::Utils.true?(required)
29
29
  end
30
30
 
31
31
  def optional?
@@ -4,8 +4,8 @@ module Servactory
4
4
  module Outputs
5
5
  module Tools
6
6
  class Conflicts
7
- def self.check!(...)
8
- new(...).check!
7
+ def self.validate!(...)
8
+ new(...).validate!
9
9
  end
10
10
 
11
11
  def initialize(context, collection_of_outputs, collection_of_internals)
@@ -14,7 +14,7 @@ module Servactory
14
14
  @collection_of_internals = collection_of_internals
15
15
  end
16
16
 
17
- def check!
17
+ def validate!
18
18
  return if overlapping_attributes.empty?
19
19
 
20
20
  message_text = I18n.t(
@@ -30,7 +30,7 @@ module Servactory
30
30
  # EXAMPLE:
31
31
  #
32
32
  # define_method(:user=) do |value|
33
- # Servactory::Internals::Checks::Type.check!( context: self, output:, value: )
33
+ # Servactory::Internals::Validations::Type.validate!( context: self, output:, value: )
34
34
  #
35
35
  # instance_variable_set(:@user, value)
36
36
  # end
@@ -42,7 +42,7 @@ module Servactory
42
42
  def context_output_template_for(output)
43
43
  <<-RUBY
44
44
  define_method(:#{output.name}=) do |value|
45
- Servactory::Outputs::Checks::Type.check!(
45
+ Servactory::Outputs::Validations::Type.validate!(
46
46
  context: self,
47
47
  output: output,
48
48
  value: value
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Servactory
4
4
  module Outputs
5
- module Checks
5
+ module Validations
6
6
  class Base
7
7
  protected
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Servactory
4
4
  module Outputs
5
- module Checks
5
+ module Validations
6
6
  class Type < Base
7
7
  DEFAULT_MESSAGE = lambda do |service_class_name:, output:, expected_type:, given_type:|
8
8
  I18n.t(
@@ -16,8 +16,8 @@ module Servactory
16
16
 
17
17
  private_constant :DEFAULT_MESSAGE
18
18
 
19
- def self.check!(...)
20
- new(...).check!
19
+ def self.validate!(...)
20
+ new(...).validate!
21
21
  end
22
22
 
23
23
  ##########################################################################
@@ -30,7 +30,7 @@ module Servactory
30
30
  @value = value
31
31
  end
32
32
 
33
- def check!
33
+ def validate!
34
34
  return if prepared_types.any? { |type| @value.is_a?(type) }
35
35
 
36
36
  raise_error_with(
@@ -16,7 +16,7 @@ module Servactory
16
16
  end
17
17
 
18
18
  def find_conflicts_in!(collection_of_internals:)
19
- Tools::Conflicts.check!(context, collection_of_outputs, collection_of_internals)
19
+ Tools::Conflicts.validate!(context, collection_of_outputs, collection_of_internals)
20
20
  end
21
21
 
22
22
  def prepare
@@ -6,7 +6,7 @@ module Servactory
6
6
 
7
7
  # @param value [#to_s]
8
8
  # @return [Boolean]
9
- def boolean?(value)
9
+ def true?(value)
10
10
  value.to_s.casecmp("true").to_i.zero?
11
11
  end
12
12
  end
@@ -4,7 +4,7 @@ module Servactory
4
4
  module VERSION
5
5
  MAJOR = 1
6
6
  MINOR = 6
7
- PATCH = 1
7
+ PATCH = 3
8
8
 
9
9
  STRING = [MAJOR, MINOR, PATCH].join(".")
10
10
  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: 1.6.1
4
+ version: 1.6.3
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-05-27 00:00:00.000000000 Z
11
+ date: 2023-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -205,12 +205,6 @@ files:
205
205
  - lib/servactory/errors/input_error.rb
206
206
  - lib/servactory/errors/internal_error.rb
207
207
  - lib/servactory/errors/output_error.rb
208
- - lib/servactory/inputs/checks/base.rb
209
- - lib/servactory/inputs/checks/errors.rb
210
- - lib/servactory/inputs/checks/inclusion.rb
211
- - lib/servactory/inputs/checks/must.rb
212
- - lib/servactory/inputs/checks/required.rb
213
- - lib/servactory/inputs/checks/type.rb
214
208
  - lib/servactory/inputs/collection.rb
215
209
  - lib/servactory/inputs/define_input_conflict.rb
216
210
  - lib/servactory/inputs/define_input_method.rb
@@ -218,31 +212,37 @@ files:
218
212
  - lib/servactory/inputs/input.rb
219
213
  - lib/servactory/inputs/option.rb
220
214
  - lib/servactory/inputs/options_collection.rb
221
- - lib/servactory/inputs/tools/check.rb
222
215
  - lib/servactory/inputs/tools/check_errors.rb
223
216
  - lib/servactory/inputs/tools/find_unnecessary.rb
224
217
  - lib/servactory/inputs/tools/prepare.rb
225
218
  - lib/servactory/inputs/tools/rules.rb
219
+ - lib/servactory/inputs/tools/validation.rb
220
+ - lib/servactory/inputs/validations/base.rb
221
+ - lib/servactory/inputs/validations/errors.rb
222
+ - lib/servactory/inputs/validations/inclusion.rb
223
+ - lib/servactory/inputs/validations/must.rb
224
+ - lib/servactory/inputs/validations/required.rb
225
+ - lib/servactory/inputs/validations/type.rb
226
226
  - lib/servactory/inputs/workbench.rb
227
- - lib/servactory/internals/checks/base.rb
228
- - lib/servactory/internals/checks/type.rb
229
227
  - lib/servactory/internals/collection.rb
230
228
  - lib/servactory/internals/dsl.rb
231
229
  - lib/servactory/internals/internal.rb
232
230
  - lib/servactory/internals/tools/prepare.rb
231
+ - lib/servactory/internals/validations/base.rb
232
+ - lib/servactory/internals/validations/type.rb
233
233
  - lib/servactory/internals/workbench.rb
234
234
  - lib/servactory/methods/collection.rb
235
235
  - lib/servactory/methods/dsl.rb
236
236
  - lib/servactory/methods/method.rb
237
237
  - lib/servactory/methods/shortcuts/collection.rb
238
238
  - lib/servactory/methods/workbench.rb
239
- - lib/servactory/outputs/checks/base.rb
240
- - lib/servactory/outputs/checks/type.rb
241
239
  - lib/servactory/outputs/collection.rb
242
240
  - lib/servactory/outputs/dsl.rb
243
241
  - lib/servactory/outputs/output.rb
244
242
  - lib/servactory/outputs/tools/conflicts.rb
245
243
  - lib/servactory/outputs/tools/prepare.rb
244
+ - lib/servactory/outputs/validations/base.rb
245
+ - lib/servactory/outputs/validations/type.rb
246
246
  - lib/servactory/outputs/workbench.rb
247
247
  - lib/servactory/result.rb
248
248
  - lib/servactory/utils.rb