Class: Dependabot::DependencyGroup
- Inherits:
-
Object
- Object
- Dependabot::DependencyGroup
- Extended by:
- T::Sig
- Defined in:
- lib/dependabot/dependency_group.rb
Instance Attribute Summary collapse
-
#applies_to ⇒ Object
readonly
Returns the value of attribute applies_to.
-
#dependencies ⇒ Object
readonly
Returns the value of attribute dependencies.
-
#group_by ⇒ Object
readonly
Returns the value of attribute group_by.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#rules ⇒ Object
readonly
Returns the value of attribute rules.
Instance Method Summary collapse
- #contains?(dependency) ⇒ Boolean
- #group_by_dependency_name? ⇒ Boolean
-
#initialize(name:, rules:, applies_to: "version-updates") ⇒ DependencyGroup
constructor
A new instance of DependencyGroup.
- #to_config_yaml ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(name:, rules:, applies_to: "version-updates") ⇒ DependencyGroup
Returns a new instance of DependencyGroup.
39 40 41 42 43 44 45 46 |
# File 'lib/dependabot/dependency_group.rb', line 39 def initialize(name:, rules:, applies_to: "version-updates") @name = name # For backwards compatibility, if no applies_to is provided, default to "version-updates" @applies_to = T.let(applies_to || "version-updates", String) @rules = rules @group_by = T.let(rules["group-by"], T.nilable(String)) @dependencies = T.let([], T::Array[Dependabot::Dependency]) end |
Instance Attribute Details
#applies_to ⇒ Object (readonly)
Returns the value of attribute applies_to.
26 27 28 |
# File 'lib/dependabot/dependency_group.rb', line 26 def applies_to @applies_to end |
#dependencies ⇒ Object (readonly)
Returns the value of attribute dependencies.
23 24 25 |
# File 'lib/dependabot/dependency_group.rb', line 23 def dependencies @dependencies end |
#group_by ⇒ Object (readonly)
Returns the value of attribute group_by.
29 30 31 |
# File 'lib/dependabot/dependency_group.rb', line 29 def group_by @group_by end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
17 18 19 |
# File 'lib/dependabot/dependency_group.rb', line 17 def name @name end |
#rules ⇒ Object (readonly)
Returns the value of attribute rules.
20 21 22 |
# File 'lib/dependabot/dependency_group.rb', line 20 def rules @rules end |
Instance Method Details
#contains?(dependency) ⇒ Boolean
49 50 51 52 53 54 |
# File 'lib/dependabot/dependency_group.rb', line 49 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 |
#group_by_dependency_name? ⇒ Boolean
57 58 59 |
# File 'lib/dependabot/dependency_group.rb', line 57 def group_by_dependency_name? @group_by == "dependency-name" end |
#to_config_yaml ⇒ Object
68 69 70 71 72 |
# File 'lib/dependabot/dependency_group.rb', line 68 def to_config_yaml { "groups" => { name => rules } }.to_yaml.delete_prefix("---\n") end |
#to_h ⇒ Object
62 63 64 |
# File 'lib/dependabot/dependency_group.rb', line 62 def to_h { "name" => name } end |