Class: FileContentRule

Inherits:
Rule
  • Object
show all
Defined in:
lib/technologist/rules/file_content_rule.rb

Direct Known Subclasses

GemRule

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Rule

#initialize

Constructor Details

This class inherits a constructor from Rule

Instance Attribute Details

#file_content_patternObject

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_nameObject

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?(framework_name, repository) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/technologist/rules/file_content_rule.rb', line 6

def matches?(framework_name, repository)
  !!(repository.file_content(file_name) =~ /#{file_content_pattern}/)
end