Class: Menuconform::Finding

Inherits:
Object
  • Object
show all
Defined in:
lib/menuconform/finding.rb

Overview

One conformance finding. Severity is filled in by the engine from the rule catalog so rule implementations can never disagree with the published catalog.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rule, entity_type, entity_id, message) ⇒ Finding

Returns a new instance of Finding.



10
11
12
13
14
15
# File 'lib/menuconform/finding.rb', line 10

def initialize(rule, entity_type, entity_id, message)
  @rule = rule
  @entity_type = entity_type
  @entity_id = entity_id
  @message = message
end

Instance Attribute Details

#entity_idObject (readonly)

Returns the value of attribute entity_id.



7
8
9
# File 'lib/menuconform/finding.rb', line 7

def entity_id
  @entity_id
end

#entity_typeObject (readonly)

Returns the value of attribute entity_type.



7
8
9
# File 'lib/menuconform/finding.rb', line 7

def entity_type
  @entity_type
end

#messageObject (readonly)

Returns the value of attribute message.



7
8
9
# File 'lib/menuconform/finding.rb', line 7

def message
  @message
end

#ruleObject (readonly)

Returns the value of attribute rule.



7
8
9
# File 'lib/menuconform/finding.rb', line 7

def rule
  @rule
end

#severityObject

Returns the value of attribute severity.



8
9
10
# File 'lib/menuconform/finding.rb', line 8

def severity
  @severity
end

Instance Method Details

#to_hObject



17
18
19
20
21
22
23
24
# File 'lib/menuconform/finding.rb', line 17

def to_h
  {
    "rule" => rule,
    "severity" => severity,
    "entity" => { "type" => entity_type, "id" => entity_id },
    "message" => message
  }
end