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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fa1ae6fc8c72cd3073a9301eb633a23bed7a3912a3e338e54c83aba5fc8f4b08
4
- data.tar.gz: 8d1935bd53420a47316e76ce952b18c0b8ca4d96e8ee0193fcce5aea16a159e4
3
+ metadata.gz: f98c412b0f3a40893889268f064da207c09c7aafa187ff18d66f919b306e7d4c
4
+ data.tar.gz: 20e29cb2657551e246377c0e9c1f8fbb84ecdffa5a6f89e3d0ff9e64f2a8f3d8
5
5
  SHA512:
6
- metadata.gz: 971c297f7e4d8da9eb73a02bdad49329c0e84024553d3f864e0a91e02aee71fc5f71e0ab3d4ef9b66b6696047237c3c36f7c22d72004bc70fc6dfceb4d4ec125
7
- data.tar.gz: 1a22cb5f5f8b25612116f5b302e82b5d914a05aaedfc624c6c635db56fd23d3998b29dc8582f633d78f64f7ef8120d5a87d66052b0c5adba0ec41558174166a6
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
- Checkability::Checkable.new(self).check(ch_conf)
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(handler_confs)
30
- first_handler_name = handler_confs.keys.first
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 _handlers(handler_confs)
42
- handlers = _make_handlers(handler_confs)
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]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Checkability
4
- VERSION = '2.0.1'
4
+ VERSION = '2.0.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: checkability
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey Eremeev