mutations-validate-outcome 0.8.1 → 0.8.2

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
  SHA1:
3
- metadata.gz: fda2812c430f8f35c99bc489158a760e1bc11324
4
- data.tar.gz: 08f927854a9ead2bd9328b530537bce91f387656
3
+ metadata.gz: 17fa9900ea6071170fb08b422168767a0742c7d7
4
+ data.tar.gz: c79145c76c2d5a919c1e76b2b6f1c69beca719ac
5
5
  SHA512:
6
- metadata.gz: 10cdf358d7c4f722d2eabc18bd16e5a10698d628b2407c41c5e1d81a81044991a19ceae99fb129d51ae4290fc5135bbedebd5a1210f154c42647145c121e4878
7
- data.tar.gz: ef45c93927c97effada6e85f1192bb7321dfb2adb8940f02233e4f432b6bea4ef789768fee348dff8432d301cb64418bcdbc46139015ba56a13ddbaa4fa08745
6
+ metadata.gz: afee3c02f19cf01fec6b346d834f1f83df57d65415d65b135f1afa410b54039386c4ef0933f34a3b3fe14589eadb9e0a48e8692371855959385d9c6756a7191a
7
+ data.tar.gz: 61ffc28639a24e450f70618aa78d9363c14dba21130552b54e922352d6956080c8b2eb7784f920daf204cd0eefe87011c6176e5e11a468a2e5ceee93046c23fa
@@ -49,7 +49,8 @@ module Mutations
49
49
  return validation_outcome if has_errors?
50
50
  validation_outcome(
51
51
  execute.tap do |result|
52
- if result.is_a?(Array)
52
+ case result
53
+ when Array
53
54
  result.each_with_index.with_object({}) do |(e, i), memo|
54
55
  _, outcome_error = self.class.outcome_filters.filter(e)
55
56
  outcome_error = validate_outcome(e) if outcome_error.nil?
@@ -57,8 +58,8 @@ module Mutations
57
58
  end.tap do |errs|
58
59
  @outcome_errors = errs unless errs.empty?
59
60
  end
60
- else
61
- add_outcome_error :self, :type, "This mutation must return Array instance (was #{result.class})"
61
+ when NilClass then nil
62
+ else add_outcome_error :self, :type, "This mutation must return Array instance (was #{result.class})"
62
63
  end
63
64
  end
64
65
  )
@@ -68,11 +68,12 @@ module Mutations
68
68
  return validation_outcome if has_errors?
69
69
  validation_outcome(
70
70
  execute.tap do |result|
71
- if result.is_a?(Hash)
71
+ case result
72
+ when Hash
72
73
  _, @outcome_errors = self.class.outcome_filters.filter(result)
73
74
  validate_outcome(result) unless has_outcome_errors?
74
- else
75
- add_outcome_error :self, :type, "This mutation must return Hash instance (was #{result.class})"
75
+ when NilClass then nil
76
+ else add_outcome_error :self, :type, "This mutation must return Hash instance (was #{result.class})"
76
77
  end
77
78
  end
78
79
  )
@@ -1,5 +1,5 @@
1
1
  module Mutations
2
2
  module ValidateOutcome
3
- VERSION = '0.8.1'.freeze
3
+ VERSION = '0.8.2'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mutations-validate-outcome
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aleksei Matiushkin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-19 00:00:00.000000000 Z
11
+ date: 2017-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler