atacama 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/atacama.rb +8 -2
- data/lib/atacama/contract/parameter.rb +0 -8
- data/lib/atacama/contract/validator.rb +1 -3
- data/lib/atacama/version.rb +1 -1
- metadata +1 -2
- data/lib/atacama/transaction/halt_execution.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c60dffa1549a8ad42d49c0d5a54aeeb5985c553
|
4
|
+
data.tar.gz: 9bc7644e038ce25f28436b0402712171093933b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f869b06dfe02bca18b86611aa5613a96e3393d2b9c4013400b91b38a52ca5a7a9436bbf1ad79bdd9fca75e1450d096835949eb6375de109576300705710faa3b
|
7
|
+
data.tar.gz: 3f0bd303fb8a123eb0733a91352e58523e660d9c9dad2013cb29425a79e813bcafa5f4380d36cfa9d0023995d5141ad1499731f9525f131702bacb0d07a32d57
|
data/Gemfile.lock
CHANGED
data/lib/atacama.rb
CHANGED
@@ -9,10 +9,16 @@ module Atacama
|
|
9
9
|
ReturnTypeMismatchError = Class.new(StandardError)
|
10
10
|
ResultTypeMismatchError = Class.new(StandardError)
|
11
11
|
|
12
|
+
# Execute a type check, catch and yield if theres an error.
|
13
|
+
#
|
14
|
+
# @yields [Exception] the caught type error
|
15
|
+
#
|
16
|
+
# @param type [Dry::Types?] type to check
|
17
|
+
# @param value [Object] object to execute with
|
12
18
|
def self.check(type, value)
|
13
19
|
type && type[value]
|
14
20
|
nil
|
15
|
-
rescue Dry::Types::ConstraintError =>
|
16
|
-
yield
|
21
|
+
rescue Dry::Types::ConstraintError => exception
|
22
|
+
yield exception
|
17
23
|
end
|
18
24
|
end
|
@@ -9,13 +9,5 @@ module Atacama
|
|
9
9
|
@name = name
|
10
10
|
@type = type
|
11
11
|
end
|
12
|
-
|
13
|
-
# Determine the validity of a value for an optionally given type. Raises a
|
14
|
-
# type error on failure.
|
15
|
-
#
|
16
|
-
# @raise [Dry::Types::ConstraintError]
|
17
|
-
def validate!(value)
|
18
|
-
type[value] && nil unless type.nil?
|
19
|
-
end
|
20
12
|
end
|
21
13
|
end
|
@@ -25,9 +25,7 @@ module Atacama
|
|
25
25
|
|
26
26
|
def detect_invalid_types!
|
27
27
|
options.each do |key, parameter|
|
28
|
-
|
29
|
-
parameter.validate! context[key]
|
30
|
-
rescue Dry::Types::ConstraintError => e
|
28
|
+
Atacama.check(parameter.type, context[key]) do |e|
|
31
29
|
raise OptionTypeMismatchError, %(#{klass} option :#{key} invalid: #{e.message})
|
32
30
|
end
|
33
31
|
end
|
data/lib/atacama/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: atacama
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyler Johnston
|
@@ -91,7 +91,6 @@ files:
|
|
91
91
|
- lib/atacama/step.rb
|
92
92
|
- lib/atacama/transaction.rb
|
93
93
|
- lib/atacama/transaction/definition.rb
|
94
|
-
- lib/atacama/transaction/halt_execution.rb
|
95
94
|
- lib/atacama/types.rb
|
96
95
|
- lib/atacama/values.rb
|
97
96
|
- lib/atacama/version.rb
|