Class: QuietQuality::MessageFilter
- Inherits:
-
Object
- Object
- QuietQuality::MessageFilter
- Defined in:
- lib/quiet_quality/message_filter.rb
Instance Method Summary collapse
- #filter(messages) ⇒ Object
-
#initialize(changed_files:) ⇒ MessageFilter
constructor
A new instance of MessageFilter.
- #relevant?(message) ⇒ Boolean
Constructor Details
#initialize(changed_files:) ⇒ MessageFilter
Returns a new instance of MessageFilter.
3 4 5 |
# File 'lib/quiet_quality/message_filter.rb', line 3 def initialize(changed_files:) @changed_files = changed_files end |
Instance Method Details
#filter(messages) ⇒ Object
16 17 18 |
# File 'lib/quiet_quality/message_filter.rb', line 16 def filter() Messages.new(.select { |m| relevant?(m) }) end |
#relevant?(message) ⇒ Boolean
7 8 9 10 11 12 13 14 |
# File 'lib/quiet_quality/message_filter.rb', line 7 def relevant?() return false unless changed_files.include?(.path) file = changed_files.file(.path) return true if file.entire? relevant_lines?(, file) end |