Class: TWFilter::Report

Inherits:
Data
  • Object
show all
Defined in:
lib/twfilter/finding.rb,
sig/twfilter.rbs

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#evidenceObject (readonly)

Returns the value of attribute evidence

Returns:

  • (Object)

    the current value of evidence



20
21
22
# File 'lib/twfilter/finding.rb', line 20

def evidence
  @evidence
end

#findingsObject (readonly)

Returns the value of attribute findings

Returns:

  • (Object)

    the current value of findings



20
21
22
# File 'lib/twfilter/finding.rb', line 20

def findings
  @findings
end

#hanObject (readonly)

Returns the value of attribute han

Returns:

  • (Object)

    the current value of han



20
21
22
# File 'lib/twfilter/finding.rb', line 20

def han
  @han
end

#textObject (readonly)

Returns the value of attribute text

Returns:

  • (Object)

    the current value of text



20
21
22
# File 'lib/twfilter/finding.rb', line 20

def text
  @text
end

#tierObject (readonly)

Returns the value of attribute tier

Returns:

  • (Object)

    the current value of tier



20
21
22
# File 'lib/twfilter/finding.rb', line 20

def tier
  @tier
end

Instance Method Details

#codes::Array[::Symbol]

Returns:

  • (::Array[::Symbol])


27
# File 'lib/twfilter/finding.rb', line 27

def codes = findings.map(&:code)

#marks::Array[Finding]

Returns:



25
# File 'lib/twfilter/finding.rb', line 25

def marks = findings.select(&:mark?)

#ok?Boolean

Returns:

  • (Boolean)


21
# File 'lib/twfilter/finding.rb', line 21

def ok? = findings.none?(&:reject?)

#reasons::Array[::String]

Returns:

  • (::Array[::String])


29
# File 'lib/twfilter/finding.rb', line 29

def reasons = rejects.map { |finding| [finding.code, finding.detail].compact.join(": ") }

#rejects::Array[Finding]

Returns:



23
# File 'lib/twfilter/finding.rb', line 23

def rejects = findings.select(&:reject?)

#to_h::Hash[::Symbol, untyped]

Returns:

  • (::Hash[::Symbol, untyped])


31
32
33
34
35
36
37
38
39
40
# File 'lib/twfilter/finding.rb', line 31

def to_h
  {
    text: text,
    ok: ok?,
    tier: tier,
    han: han,
    evidence: evidence,
    findings: findings.map(&:to_h)
  }
end