Class: ActiveRecordSaferQuery::Checker::Finding

Inherits:
Struct
  • Object
show all
Defined in:
lib/active_record_safer_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



51
52
53
# File 'lib/active_record_safer_query/checker.rb', line 51

def line
  @line
end

#messageObject

Returns the value of attribute message

Returns:

  • (Object)

    the current value of message



51
52
53
# File 'lib/active_record_safer_query/checker.rb', line 51

def message
  @message
end

#pathObject

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



51
52
53
# File 'lib/active_record_safer_query/checker.rb', line 51

def path
  @path
end

#ruleObject

Returns the value of attribute rule

Returns:

  • (Object)

    the current value of rule



51
52
53
# File 'lib/active_record_safer_query/checker.rb', line 51

def rule
  @rule
end

#severityObject

Returns the value of attribute severity

Returns:

  • (Object)

    the current value of severity



51
52
53
# File 'lib/active_record_safer_query/checker.rb', line 51

def severity
  @severity
end

#sourceObject

Returns the value of attribute source

Returns:

  • (Object)

    the current value of source



51
52
53
# File 'lib/active_record_safer_query/checker.rb', line 51

def source
  @source
end

Instance Method Details

#fail_at?(threshold) ⇒ Boolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/active_record_safer_query/checker.rb', line 63

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

#to_hObject



52
53
54
55
56
57
58
59
60
61
# File 'lib/active_record_safer_query/checker.rb', line 52

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