Class: Dependabot::Config::IgnoreCondition

Inherits:
Object
  • Object
show all
Defined in:
lib/dependabot/config/ignore_condition.rb

Overview

Filters versions that should not be considered for dependency updates

Constant Summary collapse

UPDATE_TYPES =
i(
  ignore_major_versions
  ignore_minor_versions
  ignore_patch_versions
).freeze
ALL_VERSIONS =
">= 0"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dependency_name:, versions: nil, update_types: nil) ⇒ IgnoreCondition

Returns a new instance of IgnoreCondition.



16
17
18
19
20
# File 'lib/dependabot/config/ignore_condition.rb', line 16

def initialize(dependency_name:, versions: nil, update_types: nil)
  @dependency_name = dependency_name
  @versions = versions || []
  @update_types = update_types || []
end

Instance Attribute Details

#dependency_nameObject (readonly)

Returns the value of attribute dependency_name.



15
16
17
# File 'lib/dependabot/config/ignore_condition.rb', line 15

def dependency_name
  @dependency_name
end

#update_typesObject (readonly)

Returns the value of attribute update_types.



15
16
17
# File 'lib/dependabot/config/ignore_condition.rb', line 15

def update_types
  @update_types
end

#versionsObject (readonly)

Returns the value of attribute versions.



15
16
17
# File 'lib/dependabot/config/ignore_condition.rb', line 15

def versions
  @versions
end

Instance Method Details

#ignored_versions(dependency) ⇒ Object



22
23
24
25
26
# File 'lib/dependabot/config/ignore_condition.rb', line 22

def ignored_versions(dependency)
  return [ALL_VERSIONS] if @versions.empty? && @update_types.empty?

  versions_by_type(dependency) + @versions
end