doctor_doug 0.1.2 → 0.1.3
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/README.md +1 -1
- data/lib/doctor_doug/checkup.rb +7 -4
- data/lib/doctor_doug/notify/base.rb +1 -1
- data/lib/doctor_doug/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c765e1141a17da3c333f0af539d63648ca1461f
|
4
|
+
data.tar.gz: 071dd80dbc373a8f5e7e31720e574e1817cde3e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b8210360c18e4cf62bf0d4227744baf469d2c5821927f82722f91d53ab58ca677298823d3e576f9fcf760b301e8f936db644bb2083b2651a325bf2895288008
|
7
|
+
data.tar.gz: f2fb96c05cf0500fe69ee32b502c649c8ef2aa8994bc3f33624a258b2a05853ab2be40289968047e932ee3ad3ced5f49fa9531e5d57742b32b0234f72149bfc8
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -42,7 +42,7 @@ end
|
|
42
42
|
DoctorDoug.checkup "user name should not be blank" do
|
43
43
|
users = User.where(updated_at: 1.hour.ago..Time.now)
|
44
44
|
notify :if, any: users do |user|
|
45
|
-
user.name.blank?
|
45
|
+
violate? user.name.blank?
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
data/lib/doctor_doug/checkup.rb
CHANGED
@@ -13,16 +13,19 @@ class CheckupProxy # :nodoc:
|
|
13
13
|
@checkup_name = checkup_name
|
14
14
|
end
|
15
15
|
|
16
|
+
def violate?(condition)
|
17
|
+
return false unless [true, false].include?(condition)
|
18
|
+
condition
|
19
|
+
end
|
20
|
+
|
16
21
|
def notify(condition, any:)
|
17
22
|
raise NoneBlockGivenError unless block_given?
|
18
23
|
collections = any
|
19
24
|
violations = collections.map do |c|
|
20
25
|
need_notify = false
|
21
26
|
block_result = yield c
|
22
|
-
|
23
|
-
|
24
|
-
need_notify = !block_result if condition == :unless
|
25
|
-
end
|
27
|
+
need_notify = block_result if condition == :if
|
28
|
+
need_notify = !block_result if condition == :unless
|
26
29
|
c if need_notify
|
27
30
|
end
|
28
31
|
|
data/lib/doctor_doug/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: doctor_doug
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tongfei Gao
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mail
|