Class: Pluginscan::Check
- Inherits:
-
Object
- Object
- Pluginscan::Check
- Defined in:
- lib/pluginscan/reports/issues_report/issue_checks/check.rb
Overview
Responsible for checking a string against set of rexgexps and returning all matches
Direct Known Subclasses
Defined Under Namespace
Classes: IgnoreThing
Instance Attribute Summary collapse
-
#ignores ⇒ Object
readonly
Returns the value of attribute ignores.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#patterns ⇒ Object
readonly
Returns the value of attribute patterns.
Instance Method Summary collapse
- #ignore?(_match, content) ⇒ Boolean
-
#initialize(check_hash) ⇒ Check
constructor
A new instance of Check.
- #run(content) ⇒ Object
Constructor Details
#initialize(check_hash) ⇒ Check
Returns a new instance of Check.
6 7 8 9 10 11 12 13 |
# File 'lib/pluginscan/reports/issues_report/issue_checks/check.rb', line 6 def initialize(check_hash) @name = check_hash[:name] = check_hash[:message] @patterns = Array(check_hash[:patterns]) @ignores = Array(check_hash[:ignores]).map do |ignore_thing| IgnoreThing.new(ignore_thing) end end |
Instance Attribute Details
#ignores ⇒ Object (readonly)
Returns the value of attribute ignores.
4 5 6 |
# File 'lib/pluginscan/reports/issues_report/issue_checks/check.rb', line 4 def ignores @ignores end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
4 5 6 |
# File 'lib/pluginscan/reports/issues_report/issue_checks/check.rb', line 4 def end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/pluginscan/reports/issues_report/issue_checks/check.rb', line 4 def name @name end |
#patterns ⇒ Object (readonly)
Returns the value of attribute patterns.
4 5 6 |
# File 'lib/pluginscan/reports/issues_report/issue_checks/check.rb', line 4 def patterns @patterns end |
Instance Method Details
#ignore?(_match, content) ⇒ Boolean
19 20 21 22 23 24 |
# File 'lib/pluginscan/reports/issues_report/issue_checks/check.rb', line 19 def ignore?(_match, content) # `match` is not used in the default case, but is included # so that classes inheriting from this one can use it when deciding # whether or not to ignore content by overriding this function ignores.any? { |ignore_thing| ignore_thing.ignore?(content) } end |
#run(content) ⇒ Object
15 16 17 |
# File 'lib/pluginscan/reports/issues_report/issue_checks/check.rb', line 15 def run(content) pattern_matches(content).map{ |matchdata| match(matchdata) } end |