Class: Dependabot::Nuget::FileUpdater::PackagesConfigDeclarationFinder
- Inherits:
-
Object
- Object
- Dependabot::Nuget::FileUpdater::PackagesConfigDeclarationFinder
- Defined in:
- lib/dependabot/nuget/file_updater/packages_config_declaration_finder.rb
Constant Summary collapse
- DECLARATION_REGEX =
%r{<package [^>]*?/>| <package [^>]*?[^/]>.*?</package>}mx.freeze
Instance Attribute Summary collapse
-
#declaring_requirement ⇒ Object
readonly
Returns the value of attribute declaring_requirement.
-
#dependency_name ⇒ Object
readonly
Returns the value of attribute dependency_name.
-
#packages_config ⇒ Object
readonly
Returns the value of attribute packages_config.
Instance Method Summary collapse
- #declaration_nodes ⇒ Object
- #declaration_strings ⇒ Object
-
#initialize(dependency_name:, packages_config:, declaring_requirement:) ⇒ PackagesConfigDeclarationFinder
constructor
A new instance of PackagesConfigDeclarationFinder.
Constructor Details
#initialize(dependency_name:, packages_config:, declaring_requirement:) ⇒ PackagesConfigDeclarationFinder
Returns a new instance of PackagesConfigDeclarationFinder.
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/dependabot/nuget/file_updater/packages_config_declaration_finder.rb', line 17 def initialize(dependency_name:, packages_config:, declaring_requirement:) @dependency_name = dependency_name @packages_config = packages_config @declaring_requirement = declaring_requirement if declaring_requirement[:file].split("/").last. casecmp("packages.config").zero? return end raise "Requirement not from packages.config!" end |
Instance Attribute Details
#declaring_requirement ⇒ Object (readonly)
Returns the value of attribute declaring_requirement.
14 15 16 |
# File 'lib/dependabot/nuget/file_updater/packages_config_declaration_finder.rb', line 14 def declaring_requirement @declaring_requirement end |
#dependency_name ⇒ Object (readonly)
Returns the value of attribute dependency_name.
14 15 16 |
# File 'lib/dependabot/nuget/file_updater/packages_config_declaration_finder.rb', line 14 def dependency_name @dependency_name end |
#packages_config ⇒ Object (readonly)
Returns the value of attribute packages_config.
14 15 16 |
# File 'lib/dependabot/nuget/file_updater/packages_config_declaration_finder.rb', line 14 def packages_config @packages_config end |
Instance Method Details
#declaration_nodes ⇒ Object
35 36 37 38 39 |
# File 'lib/dependabot/nuget/file_updater/packages_config_declaration_finder.rb', line 35 def declaration_nodes declaration_strings.map do |declaration_string| Nokogiri::XML(declaration_string) end end |
#declaration_strings ⇒ Object
31 32 33 |
# File 'lib/dependabot/nuget/file_updater/packages_config_declaration_finder.rb', line 31 def declaration_strings @declaration_strings ||= fetch_declaration_strings end |