Class: FileContentRule
- Defined in:
- lib/technologist/rules/file_content_rule.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#file_content_pattern ⇒ Object
Returns the value of attribute file_content_pattern.
-
#file_name ⇒ Object
Returns the value of attribute file_name.
Attributes inherited from Rule
Instance Method Summary collapse
Methods inherited from Rule
Constructor Details
This class inherits a constructor from Rule
Instance Attribute Details
#file_content_pattern ⇒ Object
Returns the value of attribute file_content_pattern.
4 5 6 |
# File 'lib/technologist/rules/file_content_rule.rb', line 4 def file_content_pattern @file_content_pattern end |
#file_name ⇒ Object
Returns the value of attribute file_name.
4 5 6 |
# File 'lib/technologist/rules/file_content_rule.rb', line 4 def file_name @file_name end |
Instance Method Details
#matches?(repository) ⇒ Boolean
6 7 8 9 10 |
# File 'lib/technologist/rules/file_content_rule.rb', line 6 def matches?(repository) !!repository.file_with_content_exists?(file_name) do |content| content =~ /#{file_content_pattern}/ end end |