Class: ActiveRecordSaferLookupQuery::Checker::Finding

Inherits:
Struct
  • Object
show all
Defined in:
lib/active_record_safer_lookup_query/checker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#lineObject

Returns the value of attribute line

Returns:

  • (Object)

    the current value of line



57
58
59
# File 'lib/active_record_safer_lookup_query/checker.rb', line 57

def line
  @line
end

#messageObject

Returns the value of attribute message

Returns:

  • (Object)

    the current value of message



57
58
59
# File 'lib/active_record_safer_lookup_query/checker.rb', line 57

def message
  @message
end

#pathObject

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



57
58
59
# File 'lib/active_record_safer_lookup_query/checker.rb', line 57

def path
  @path
end

#ruleObject

Returns the value of attribute rule

Returns:

  • (Object)

    the current value of rule



57
58
59
# File 'lib/active_record_safer_lookup_query/checker.rb', line 57

def rule
  @rule
end

#severityObject

Returns the value of attribute severity

Returns:

  • (Object)

    the current value of severity



57
58
59
# File 'lib/active_record_safer_lookup_query/checker.rb', line 57

def severity
  @severity
end

#sourceObject

Returns the value of attribute source

Returns:

  • (Object)

    the current value of source



57
58
59
# File 'lib/active_record_safer_lookup_query/checker.rb', line 57

def source
  @source
end

Instance Method Details

#fail_at?(threshold) ⇒ Boolean

Returns:

  • (Boolean)


69
70
71
# File 'lib/active_record_safer_lookup_query/checker.rb', line 69

def fail_at?(threshold)
  Checker::SEVERITY_RANK.fetch(severity) >= Checker::SEVERITY_RANK.fetch(threshold)
end

#to_hObject



58
59
60
61
62
63
64
65
66
67
# File 'lib/active_record_safer_lookup_query/checker.rb', line 58

def to_h
  {
    path: path,
    line: line,
    severity: severity,
    rule: rule,
    message: message,
    source: source
  }
end