Class: Koji::Detector
- Inherits:
-
Object
- Object
- Koji::Detector
- Defined in:
- lib/koji/detector.rb
Instance Attribute Summary collapse
-
#website ⇒ Object
readonly
Returns the value of attribute website.
Instance Method Summary collapse
- #detailed_report ⇒ Object
-
#initialize(website) ⇒ Detector
constructor
A new instance of Detector.
- #report ⇒ Object
- #score ⇒ Object
- #verdict ⇒ Object
Constructor Details
#initialize(website) ⇒ Detector
Returns a new instance of Detector.
7 8 9 |
# File 'lib/koji/detector.rb', line 7 def initialize(website) @website = website end |
Instance Attribute Details
#website ⇒ Object (readonly)
Returns the value of attribute website.
5 6 7 |
# File 'lib/koji/detector.rb', line 5 def website @website end |
Instance Method Details
#detailed_report ⇒ Object
33 34 35 36 |
# File 'lib/koji/detector.rb', line 33 def detailed_report plugin_reports = plugins.map(&:report).select { |report| report.dig(:score).to_i.positive? } report.merge(plugin_reports: plugin_reports) end |
#report ⇒ Object
26 27 28 29 30 31 |
# File 'lib/koji/detector.rb', line 26 def report { verdict: verdict, score: score } end |
#score ⇒ Object
11 12 13 |
# File 'lib/koji/detector.rb', line 11 def score plugins.map(&:score).sum end |
#verdict ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/koji/detector.rb', line 15 def verdict case score.to_i when -Float::INFINITY..49 "Not underconstruction" when 50..99 "Possibly underconstruction" when 100..Float::INFINITY "Underconstruction" end end |