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.
-
#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
-
#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.
36 37 38 39 40 41 42 |
# File 'lib/dependabot/dependency_group.rb', line 36 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 @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 |
#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
45 46 47 48 49 50 |
# File 'lib/dependabot/dependency_group.rb', line 45 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
59 60 61 62 63 |
# File 'lib/dependabot/dependency_group.rb', line 59 def to_config_yaml { "groups" => { name => rules } }.to_yaml.delete_prefix("---\n") end |
#to_h ⇒ Object
53 54 55 |
# File 'lib/dependabot/dependency_group.rb', line 53 def to_h { "name" => name } end |