servactory 1.6.12 → 1.6.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6ccc9a97612c6e1ceabdc7af5cf7721db8e6cf69f6a4028b040937b70a666455
4
- data.tar.gz: d40c5f206135cd7b2c4f0e2d58cdb0cb5ac147c44c06fb270ed55dd0361c1f2a
3
+ metadata.gz: 8fb456eae63f08b03712474124ad24d2af28d8cf34501dcc442ff489d94152c0
4
+ data.tar.gz: 250cc4f9058345bfe888034c163aa49720cb5e469fe7956093defce979f85c9b
5
5
  SHA512:
6
- metadata.gz: 6b2e77ca62432273803111620519934121c5ece37f689b264814a5ea0f97382a3b046a969d4c6385080aa48a13627929c26f4d7a44c4afe6baf481a9bc372ed9
7
- data.tar.gz: 2dc3b575db383250a16a30c287a2f2349864889ec66469ad6ed544dc6db3c12a1fc56e434ed36fcab45572c8ab3341974e629c489e93fe6df647f07381246004
6
+ metadata.gz: d8a3b0c171df80b8eab5941f7c6fdfd01a032689aab2b45ca91f4f6a1ef199f12e0cd998cf8a92380f1bceb76577c5d5ebe746ed1afa5ecd4c96c7c3815e39b9
7
+ data.tar.gz: b2a0eefa30dfc7841a425bb9b7f3405bbbea0d93c1a2d9e0e6d6306eba376ab452becff2f7fe511f775593ea6679f0b24f442eb2353934ee3444868e5654fe37
@@ -28,8 +28,12 @@ module Servactory
28
28
  )
29
29
  end
30
30
 
31
- def fail!(message:, meta: nil)
32
- failure = Servactory.configuration.failure_class.new(message: message, meta: meta)
31
+ def fail!(
32
+ message:,
33
+ failure_class: Servactory.configuration.failure_class,
34
+ meta: nil
35
+ )
36
+ failure = failure_class.new(message: message, meta: meta)
33
37
 
34
38
  raise failure if @service_strict_mode
35
39
 
@@ -38,9 +38,9 @@ module Servactory
38
38
  end
39
39
 
40
40
  def check # rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
41
- if @input.array? && @value.present?
41
+ if @input.array? && Servactory::Utils.value_present?(@value)
42
42
  return if @value.respond_to?(:all?) && @value.all?(&:present?)
43
- elsif @value.present?
43
+ elsif Servactory::Utils.value_present?(@value)
44
44
  return
45
45
  end
46
46
 
@@ -9,5 +9,11 @@ module Servactory
9
9
  def true?(value)
10
10
  value.to_s.casecmp("true").to_i.zero?
11
11
  end
12
+
13
+ def value_present?(value)
14
+ !value.nil? && (
15
+ value.respond_to?(:empty?) ? !value.empty? : true
16
+ )
17
+ end
12
18
  end
13
19
  end
@@ -4,7 +4,7 @@ module Servactory
4
4
  module VERSION
5
5
  MAJOR = 1
6
6
  MINOR = 6
7
- PATCH = 12
7
+ PATCH = 13
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.12
4
+ version: 1.6.13
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-06-13 00:00:00.000000000 Z
11
+ date: 2023-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport