Class: FileXmlContentRule

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

Direct Known Subclasses

MavenPluginRule

Instance Attribute Summary collapse

Attributes inherited from Rule

#framework

Instance Method Summary collapse

Methods inherited from Rule

#initialize

Constructor Details

This class inherits a constructor from Rule

Instance Attribute Details

#css_selectorObject

Returns the value of attribute css_selector.



5
6
7
# File 'lib/technologist/rules/file_xml_content_rule.rb', line 5

def css_selector
  @css_selector
end

#file_nameObject

Returns the value of attribute file_name.



5
6
7
# File 'lib/technologist/rules/file_xml_content_rule.rb', line 5

def file_name
  @file_name
end

Instance Method Details

#matches?(repository) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
10
11
12
# File 'lib/technologist/rules/file_xml_content_rule.rb', line 7

def matches?(repository)
  !!repository.file_with_content_exists?(file_name) do |content|
    xml = Nokogiri::XML(content)
    xml.css(css_selector).any?
  end
end