Class: Sharekit::Cli::Finding
- Inherits:
-
Data
- Object
- Data
- Sharekit::Cli::Finding
- Includes:
- Comparable
- Defined in:
- lib/sharekit/cli/finding.rb
Overview
Immutable value object for one scan hit. Data.define gives us structural
equality and Hash-pattern deconstruction (in {severity:, rule:}) for free —
a plain TS interface has neither.
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#preview ⇒ Object
readonly
Returns the value of attribute preview.
-
#rule ⇒ Object
readonly
Returns the value of attribute rule.
-
#severity ⇒ Object
readonly
Returns the value of attribute severity.
Instance Method Summary collapse
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file
10 11 12 |
# File 'lib/sharekit/cli/finding.rb', line 10 def file @file end |
#line ⇒ Object (readonly)
Returns the value of attribute line
10 11 12 |
# File 'lib/sharekit/cli/finding.rb', line 10 def line @line end |
#preview ⇒ Object (readonly)
Returns the value of attribute preview
10 11 12 |
# File 'lib/sharekit/cli/finding.rb', line 10 def preview @preview end |
#rule ⇒ Object (readonly)
Returns the value of attribute rule
10 11 12 |
# File 'lib/sharekit/cli/finding.rb', line 10 def rule @rule end |
#severity ⇒ Object (readonly)
Returns the value of attribute severity
10 11 12 |
# File 'lib/sharekit/cli/finding.rb', line 10 def severity @severity end |
Instance Method Details
#<=>(other) ⇒ Object
13 14 15 |
# File 'lib/sharekit/cli/finding.rb', line 13 def <=>(other) SEVERITY_RANK.fetch(severity) <=> SEVERITY_RANK.fetch(other.severity) end |
#high? ⇒ Boolean
17 |
# File 'lib/sharekit/cli/finding.rb', line 17 def high? = severity == :high |