Class: Dependabot::Package::ReleaseCooldownOptions

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/package/release_cooldown_options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(default_days: 0, semver_major_days: 0, semver_minor_days: 0, semver_patch_days: 0, include: [], exclude: []) ⇒ ReleaseCooldownOptions

Returns a new instance of ReleaseCooldownOptions.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/dependabot/package/release_cooldown_options.rb', line 21

def initialize(
  default_days: 0,
  semver_major_days: 0,
  semver_minor_days: 0,
  semver_patch_days: 0,
  include: [],
  exclude: []
)
  default_days ||= 0
  semver_major_days ||= 0
  semver_minor_days ||= 0
  semver_patch_days ||= 0
  include ||= []
  exclude ||= []

  @default_days = T.let(default_days, Integer)
  @semver_major_days = T.let(semver_major_days.positive? ? semver_major_days : default_days, Integer)
  @semver_minor_days = T.let(semver_minor_days.positive? ? semver_minor_days : default_days, Integer)
  @semver_patch_days = T.let(semver_patch_days.positive? ? semver_patch_days : default_days, Integer)
  @include = T.let(include.to_set, T::Set[String])
  @exclude = T.let(exclude.to_set, T::Set[String])
end

Instance Attribute Details

#default_daysObject (readonly)

Returns the value of attribute default_days.



45
46
47
# File 'lib/dependabot/package/release_cooldown_options.rb', line 45

def default_days
  @default_days
end

#excludeObject (readonly)

Returns the value of attribute exclude.



48
49
50
# File 'lib/dependabot/package/release_cooldown_options.rb', line 48

def exclude
  @exclude
end

#includeObject (readonly)

Returns the value of attribute include.



48
49
50
# File 'lib/dependabot/package/release_cooldown_options.rb', line 48

def include
  @include
end

#semver_major_daysObject (readonly)

Returns the value of attribute semver_major_days.



45
46
47
# File 'lib/dependabot/package/release_cooldown_options.rb', line 45

def semver_major_days
  @semver_major_days
end

#semver_minor_daysObject (readonly)

Returns the value of attribute semver_minor_days.



45
46
47
# File 'lib/dependabot/package/release_cooldown_options.rb', line 45

def semver_minor_days
  @semver_minor_days
end

#semver_patch_daysObject (readonly)

Returns the value of attribute semver_patch_days.



45
46
47
# File 'lib/dependabot/package/release_cooldown_options.rb', line 45

def semver_patch_days
  @semver_patch_days
end

Instance Method Details

#included?(dependency_name) ⇒ Boolean

Returns:

  • (Boolean)


51
52
53
54
55
# File 'lib/dependabot/package/release_cooldown_options.rb', line 51

def included?(dependency_name)
  return false if dependency_name.empty? || excluded?(dependency_name)

  @include.empty? || @include.any? { |pattern| File.fnmatch?(pattern, dependency_name) }
end