Class: Dependabot::DependencyGroup
- Inherits:
-
Object
- Object
- Dependabot::DependencyGroup
- Defined in:
- lib/dependabot/dependency_group.rb
Instance Attribute Summary collapse
-
#dependencies ⇒ Object
readonly
Returns the value of attribute dependencies.
-
#handled_dependencies ⇒ Object
readonly
Returns the value of attribute handled_dependencies.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#rules ⇒ Object
readonly
Returns the value of attribute rules.
Instance Method Summary collapse
- #add_all_to_handled ⇒ Object
- #add_to_handled(*dependencies) ⇒ Object
- #contains?(dependency) ⇒ Boolean
-
#initialize(name:, rules:) ⇒ DependencyGroup
constructor
A new instance of DependencyGroup.
-
#to_config_yaml ⇒ Object
Provides a debug utility to view the group as it appears in the config file.
- #to_h ⇒ Object
Constructor Details
#initialize(name:, rules:) ⇒ DependencyGroup
Returns a new instance of DependencyGroup.
15 16 17 18 19 20 |
# File 'lib/dependabot/dependency_group.rb', line 15 def initialize(name:, rules:) @name = name @rules = rules @dependencies = [] @handled_dependencies = Set.new end |
Instance Attribute Details
#dependencies ⇒ Object (readonly)
Returns the value of attribute dependencies.
13 14 15 |
# File 'lib/dependabot/dependency_group.rb', line 13 def dependencies @dependencies end |
#handled_dependencies ⇒ Object (readonly)
Returns the value of attribute handled_dependencies.
13 14 15 |
# File 'lib/dependabot/dependency_group.rb', line 13 def handled_dependencies @handled_dependencies end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
13 14 15 |
# File 'lib/dependabot/dependency_group.rb', line 13 def name @name end |
#rules ⇒ Object (readonly)
Returns the value of attribute rules.
13 14 15 |
# File 'lib/dependabot/dependency_group.rb', line 13 def rules @rules end |
Instance Method Details
#add_all_to_handled ⇒ Object
26 27 28 |
# File 'lib/dependabot/dependency_group.rb', line 26 def add_all_to_handled @handled_dependencies += dependencies.map(&:name) end |
#add_to_handled(*dependencies) ⇒ Object
22 23 24 |
# File 'lib/dependabot/dependency_group.rb', line 22 def add_to_handled(*dependencies) @handled_dependencies += dependencies.map(&:name) end |
#contains?(dependency) ⇒ Boolean
30 31 32 33 34 35 |
# File 'lib/dependabot/dependency_group.rb', line 30 def contains?(dependency) return true if @dependencies.include?(dependency) return false if matches_excluded_pattern?(dependency.name) matches_pattern?(dependency.name) && matches_dependency_type?(dependency) end |
#to_config_yaml ⇒ Object
Provides a debug utility to view the group as it appears in the config file.
42 43 44 45 46 |
# File 'lib/dependabot/dependency_group.rb', line 42 def to_config_yaml { "groups" => { name => rules } }.to_yaml.delete_prefix("---\n") end |
#to_h ⇒ Object
37 38 39 |
# File 'lib/dependabot/dependency_group.rb', line 37 def to_h { "name" => name } end |