hospital 0.7.4 → 0.7.5
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/hospital/formatter/base.rb +4 -2
- data/lib/hospital/formatter/hash.rb +44 -0
- data/lib/hospital/formatter/pre.rb +6 -2
- data/lib/hospital/formatter/shell.rb +5 -1
- data/lib/hospital/version.rb +1 -1
- data/lib/hospital.rb +6 -5
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 119a4bfc2acfd175c027a6734fd053db355e754872e0b1ea92a1f3e4fb687519
|
4
|
+
data.tar.gz: 597eff9eea46aec5f52a4f0ed9c85a21003645040184ce6649a2e7da120dd9b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb3001125845587feeec41413f9bdd95693f17568ed1ec4be31ab51b3db99f2038a7eb2bd82bc39f75424c34a4a1a17be52c501706ddd8c3e4a248d9b1b750dd
|
7
|
+
data.tar.gz: 73cf2b0cb3f08c18c8da77ee0f640c09a1439dd45d7505d67ab4ab00f22a7a0196c37dfc125f54464eb5d8ede77a63a79055597b18f3440753dfa234edc837ad
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require_relative "base"
|
2
|
+
|
3
|
+
using StringFormatter
|
4
|
+
|
5
|
+
module Hospital
|
6
|
+
module Formatter
|
7
|
+
class Hash < Base
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
@data = {}
|
11
|
+
@current_group = nil
|
12
|
+
@current_diagnosis = nil
|
13
|
+
end
|
14
|
+
|
15
|
+
def put_group_header text
|
16
|
+
@current_group = text
|
17
|
+
end
|
18
|
+
|
19
|
+
def put_diagnosis_header text
|
20
|
+
@current_diagnosis = text
|
21
|
+
end
|
22
|
+
|
23
|
+
def put_diagnosis_skipped text
|
24
|
+
end
|
25
|
+
|
26
|
+
def put_summary errors_count, warnings_count
|
27
|
+
@data['summary'] = {
|
28
|
+
'errors' => errors_count,
|
29
|
+
'warnings' => warnings_count
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
def put_diagnosis_result text
|
34
|
+
@data[@current_group] ||= {}
|
35
|
+
@data[@current_group][@current_diagnosis] ||= []
|
36
|
+
@data[@current_group][@current_diagnosis] << text
|
37
|
+
end
|
38
|
+
|
39
|
+
def result
|
40
|
+
@data
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -5,12 +5,16 @@ using StringFormatter
|
|
5
5
|
module Hospital
|
6
6
|
module Formatter
|
7
7
|
class Pre < Base
|
8
|
-
def
|
8
|
+
def put_group_headeresult
|
9
9
|
@buffer << "\n\n### #{text}"
|
10
10
|
end
|
11
11
|
|
12
12
|
def put_diagnosis_header text
|
13
|
-
@buffer << "\n\n## #{text}"
|
13
|
+
@buffer << "\n\n## Checking #{text}"
|
14
|
+
end
|
15
|
+
|
16
|
+
def put_diagnosis_skipped text
|
17
|
+
@buffer << "\n\n## Skipped #{text}"
|
14
18
|
end
|
15
19
|
|
16
20
|
def put_summary errors_count, warnings_count
|
@@ -10,7 +10,11 @@ module Hospital
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def put_diagnosis_header text
|
13
|
-
@buffer << "\
|
13
|
+
@buffer << "\nChecking #{text.h2.indented}"
|
14
|
+
end
|
15
|
+
|
16
|
+
def put_diagnosis_skipped text
|
17
|
+
@buffer << "\nSkipped #{text.h2.indented}"
|
14
18
|
end
|
15
19
|
|
16
20
|
def put_summary errors_count, warnings_count
|
data/lib/hospital/version.rb
CHANGED
data/lib/hospital.rb
CHANGED
@@ -63,8 +63,9 @@ module Hospital
|
|
63
63
|
def initialize verbose: false, formatter: :shell
|
64
64
|
@verbose = verbose
|
65
65
|
@formatter = case formatter
|
66
|
-
when :pre
|
67
|
-
|
66
|
+
when :pre then Formatter::Pre
|
67
|
+
when :hash then Formatter::Hash
|
68
|
+
else Formatter::Shell
|
68
69
|
end
|
69
70
|
|
70
71
|
@out = @formatter.new
|
@@ -85,10 +86,10 @@ module Hospital
|
|
85
86
|
warcount += diagnosis.warnings.count
|
86
87
|
|
87
88
|
if !checkup.skipped && (!checkup.group.skipped || checkup.precondition)
|
88
|
-
@out.put_diagnosis_header "
|
89
|
+
@out.put_diagnosis_header "#{diagnosis.name}:"
|
89
90
|
diagnosis.put_results @out
|
90
91
|
elsif verbose
|
91
|
-
@out.
|
92
|
+
@out.put_diagnosis_skipped "Skipped #{diagnosis.name}."
|
92
93
|
end
|
93
94
|
end
|
94
95
|
end
|
@@ -96,7 +97,7 @@ module Hospital
|
|
96
97
|
|
97
98
|
@out.put_summary errcount, warcount
|
98
99
|
|
99
|
-
@out.
|
100
|
+
@out.result
|
100
101
|
end
|
101
102
|
end
|
102
103
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hospital
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: require_all
|
@@ -39,6 +39,7 @@ files:
|
|
39
39
|
- lib/hospital/checkup_group.rb
|
40
40
|
- lib/hospital/diagnosis.rb
|
41
41
|
- lib/hospital/formatter/base.rb
|
42
|
+
- lib/hospital/formatter/hash.rb
|
42
43
|
- lib/hospital/formatter/pre.rb
|
43
44
|
- lib/hospital/formatter/shell.rb
|
44
45
|
- lib/hospital/string_formatter.rb
|