Class: TWFilter::Finding

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(check:, code:, severity: :reject, detail: nil) ⇒ Finding

Returns a new instance of Finding.

Parameters:

  • check: (::Symbol)
  • code: (::Symbol)
  • severity: (severity) (defaults to: :reject)
  • detail: (::String, nil) (defaults to: nil)


9
10
11
# File 'lib/twfilter/finding.rb', line 9

def initialize(check:, code:, severity: :reject, detail: nil)
  super
end

Instance Attribute Details

#checkObject (readonly)

Returns the value of attribute check

Returns:

  • (Object)

    the current value of check



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

def check
  @check
end

#codeObject (readonly)

Returns the value of attribute code

Returns:

  • (Object)

    the current value of code



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

def code
  @code
end

#detailObject (readonly)

Returns the value of attribute detail

Returns:

  • (Object)

    the current value of detail



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

def detail
  @detail
end

#severityObject (readonly)

Returns the value of attribute severity

Returns:

  • (Object)

    the current value of severity



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

def severity
  @severity
end

Instance Method Details

#mark?Boolean

Returns:

  • (Boolean)


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

def mark? = severity == :mark

#reject?Boolean

Returns:

  • (Boolean)


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

def reject? = severity == :reject

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

Returns:

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


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

def to_h = {check: check.to_s, code: code.to_s, severity: severity.to_s, detail: detail}.compact