Class: ActiveRecordSaferQuery::Checker::Whitelist::Entry
- Inherits:
-
Object
- Object
- ActiveRecordSaferQuery::Checker::Whitelist::Entry
- Defined in:
- lib/active_record_safer_query/checker.rb
Instance Method Summary collapse
-
#initialize(config, path) ⇒ Entry
constructor
A new instance of Entry.
- #match?(finding) ⇒ Boolean
Constructor Details
#initialize(config, path) ⇒ Entry
Returns a new instance of Entry.
124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/active_record_safer_query/checker.rb', line 124 def initialize(config, path) unless config.is_a?(Hash) raise ArgumentError, "whitelist entry must be a hash: #{path}" end @path = value(config, 'path') @rule = value(config, 'rule') @severity = value(config, 'severity') @line = value(config, 'line') @source = value(config, 'source') @reason = value(config, 'reason') end |
Instance Method Details
#match?(finding) ⇒ Boolean
137 138 139 140 141 142 143 |
# File 'lib/active_record_safer_query/checker.rb', line 137 def match?(finding) match_pattern?(@path, finding.path) && match_pattern?(@rule, finding.rule) && match_pattern?(@severity, finding.severity) && match_line?(finding.line) && match_source?(finding.source) end |