checkability 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/checkability/acts_as_checkable.rb +3 -2
- data/lib/checkability/checkable.rb +10 -9
- data/lib/checkability/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f98c412b0f3a40893889268f064da207c09c7aafa187ff18d66f919b306e7d4c
|
4
|
+
data.tar.gz: 20e29cb2657551e246377c0e9c1f8fbb84ecdffa5a6f89e3d0ff9e64f2a8f3d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32e68e282b77e79572b1ef9767fef2d124ceef20ef0f2b41fe614d0394716c6a389c6be4580c34a6e2c418a13551ccfd4b7c343f06081c48652a67c4e760f32b
|
7
|
+
data.tar.gz: e22cb3d2f239db8de010ee5909dd2425544b4733badef2e0d93f4b76ecc21ae73c420be6b3e1bc008f597b77956d4662358caf088dcdf07377fb65a3781a11b6
|
@@ -23,7 +23,7 @@ module Checkability
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
attr_accessor :ch_allowed, :ch_messages
|
26
|
+
attr_accessor :ch_allowed, :ch_messages, :ch_conf
|
27
27
|
|
28
28
|
def initialize(params)
|
29
29
|
@ch_messages = []
|
@@ -32,7 +32,8 @@ module Checkability
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def perform_check
|
35
|
-
|
35
|
+
@ch_conf = ch_conf
|
36
|
+
Checkability::Checkable.new(self).check
|
36
37
|
ch_messages << "#{ch_allowed}:::'#{_value}' is #{_allowness}. "
|
37
38
|
end
|
38
39
|
|
@@ -7,10 +7,10 @@ module Checkability
|
|
7
7
|
# Possible to implemet as Iterator in future
|
8
8
|
#
|
9
9
|
class Checkable
|
10
|
-
attr_accessor :check_obj
|
10
|
+
attr_accessor :check_obj, :handler_confs
|
11
11
|
|
12
12
|
extend Forwardable
|
13
|
-
def_delegators :@check_obj, :ch_messages, :ch_allowed
|
13
|
+
def_delegators :@check_obj, :ch_messages, :ch_allowed, :ch_conf
|
14
14
|
|
15
15
|
def initialize(check_obj)
|
16
16
|
@check_obj = check_obj
|
@@ -26,11 +26,8 @@ module Checkability
|
|
26
26
|
#
|
27
27
|
# ChainOfResponsibilty
|
28
28
|
#
|
29
|
-
def check
|
30
|
-
|
31
|
-
first_handler = _handlers(handler_confs)[first_handler_name]
|
32
|
-
|
33
|
-
first_handler.handle(check_obj)
|
29
|
+
def check
|
30
|
+
_first_handler.handle(check_obj)
|
34
31
|
rescue StandardError => e
|
35
32
|
check_obj.ch_messages << "false:::#{e}: #{handler_confs}."
|
36
33
|
false
|
@@ -38,8 +35,12 @@ module Checkability
|
|
38
35
|
|
39
36
|
private
|
40
37
|
|
41
|
-
def
|
42
|
-
|
38
|
+
def _first_handler
|
39
|
+
_handlers[ch_conf.keys.first]
|
40
|
+
end
|
41
|
+
|
42
|
+
def _handlers
|
43
|
+
handlers = _make_handlers(ch_conf)
|
43
44
|
handlers.each_value.with_index do |handler, i|
|
44
45
|
next_handler_name = handlers.keys[i + 1]
|
45
46
|
handler.next_handler(handlers[next_handler_name]) if handlers[next_handler_name]
|
data/lib/checkability/version.rb
CHANGED