Class: HeapScope::Finding
- Inherits:
-
Object
- Object
- HeapScope::Finding
- Defined in:
- lib/heapscope/findings.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#derived ⇒ Object
readonly
Returns the value of attribute derived.
-
#evidence ⇒ Object
readonly
Returns the value of attribute evidence.
-
#facts ⇒ Object
readonly
Returns the value of attribute facts.
-
#hypothesis ⇒ Object
readonly
Returns the value of attribute hypothesis.
-
#severity ⇒ Object
readonly
Returns the value of attribute severity.
-
#subject ⇒ Object
readonly
Returns the value of attribute subject.
-
#suggestions ⇒ Object
readonly
Returns the value of attribute suggestions.
-
#suspected_cause ⇒ Object
readonly
Returns the value of attribute suspected_cause.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(code:, severity:, title: nil, facts: [], derived: [], hypothesis: nil, suspected_cause: nil, evidence: [], suggestions: [], subject: nil) ⇒ Finding
constructor
A new instance of Finding.
- #name ⇒ Object
- #priority ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(code:, severity:, title: nil, facts: [], derived: [], hypothesis: nil, suspected_cause: nil, evidence: [], suggestions: [], subject: nil) ⇒ Finding
Returns a new instance of Finding.
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/heapscope/findings.rb', line 108 def initialize(code:, severity:, title: nil, facts: [], derived: [], hypothesis: nil, suspected_cause: nil, evidence: [], suggestions: [], subject: nil) = Diagnostics::CODES[code] || {} @code = code @severity = severity || [:default_severity] || :low @title = title || [:title] || code @facts = Array(facts) @derived = Array(derived) @hypothesis = hypothesis @suspected_cause = suspected_cause @evidence = Array(evidence) @suggestions = Array(suggestions) @subject = subject end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
105 106 107 |
# File 'lib/heapscope/findings.rb', line 105 def code @code end |
#derived ⇒ Object (readonly)
Returns the value of attribute derived.
105 106 107 |
# File 'lib/heapscope/findings.rb', line 105 def derived @derived end |
#evidence ⇒ Object (readonly)
Returns the value of attribute evidence.
105 106 107 |
# File 'lib/heapscope/findings.rb', line 105 def evidence @evidence end |
#facts ⇒ Object (readonly)
Returns the value of attribute facts.
105 106 107 |
# File 'lib/heapscope/findings.rb', line 105 def facts @facts end |
#hypothesis ⇒ Object (readonly)
Returns the value of attribute hypothesis.
105 106 107 |
# File 'lib/heapscope/findings.rb', line 105 def hypothesis @hypothesis end |
#severity ⇒ Object (readonly)
Returns the value of attribute severity.
105 106 107 |
# File 'lib/heapscope/findings.rb', line 105 def severity @severity end |
#subject ⇒ Object (readonly)
Returns the value of attribute subject.
105 106 107 |
# File 'lib/heapscope/findings.rb', line 105 def subject @subject end |
#suggestions ⇒ Object (readonly)
Returns the value of attribute suggestions.
105 106 107 |
# File 'lib/heapscope/findings.rb', line 105 def suggestions @suggestions end |
#suspected_cause ⇒ Object (readonly)
Returns the value of attribute suspected_cause.
105 106 107 |
# File 'lib/heapscope/findings.rb', line 105 def suspected_cause @suspected_cause end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
105 106 107 |
# File 'lib/heapscope/findings.rb', line 105 def title @title end |
Instance Method Details
#name ⇒ Object
124 125 126 |
# File 'lib/heapscope/findings.rb', line 124 def name Diagnostics::CODES.dig(code, :name) end |
#priority ⇒ Object
128 129 130 |
# File 'lib/heapscope/findings.rb', line 128 def priority Findings.priority_score(self) end |
#to_h ⇒ Object
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/heapscope/findings.rb', line 132 def to_h { code: code, name: name, severity: severity.to_s, title: title, subject: subject, priority: priority, facts: facts, derived: derived, hypothesis: hypothesis, suspected_cause: suspected_cause, evidence: evidence, suggestions: suggestions }.compact end |