Class: Homebrew::Vulns::Match::Interval Private
- Defined in:
- vulns/match.rb
Overview
This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.
An affected Homebrew interval. A missing fix leaves the interval open.
Instance Attribute Summary collapse
-
#fixed ⇒ String?
readonly
private
Returns the value of prop
fixed. -
#introduced ⇒ String
readonly
private
Returns the value of prop
introduced.
Class Method Summary collapse
-
.union(intervals) ⇒ Array<Interval>
private
Union copies and platforms before choosing Homebrew label boundaries.
Instance Method Summary collapse
- #events ⇒ Array<Hash{Symbol => String}> private
- #initialize(introduced:, fixed: nil) ⇒ void constructor
- #valid? ⇒ Boolean private
Constructor Details
Instance Attribute Details
#fixed ⇒ String? (readonly)
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Returns the value of prop fixed.
|
|
# File '' const :fixed, T.nilable(String) |
#introduced ⇒ String (readonly)
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Returns the value of prop introduced.
|
|
# File '' const :introduced, String |
Class Method Details
.union(intervals) ⇒ Array<Interval>
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Union copies and platforms before choosing Homebrew label boundaries.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'vulns/match.rb', line 75 def self.union(intervals) merged = T.let([], T::Array[Interval]) intervals.sort_by { |interval| PkgVersion.parse(interval.introduced) } .each_with_object(merged) do |interval, merged| previous = merged.last if previous.nil? merged << interval elsif (fixed = previous.fixed) if PkgVersion.parse(interval.introduced) > PkgVersion.parse(fixed) merged << interval else last_fixed = interval.fixed last_fixed = fixed if last_fixed && PkgVersion.parse(last_fixed) < PkgVersion.parse(fixed) merged[-1] = previous.with(fixed: last_fixed) end end end end |
Instance Method Details
#events ⇒ Array<Hash{Symbol => String}>
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
66 67 68 69 70 71 |
# File 'vulns/match.rb', line 66 def events events = T.let([{ introduced: }], T::Array[T::Hash[Symbol, String]]) fixed = self.fixed events << { fixed: } if fixed events end |
#valid? ⇒ Boolean
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
53 54 55 56 57 58 59 60 61 62 63 |
# File 'vulns/match.rb', line 53 def valid? return false if introduced.blank? introduced_version = PkgVersion.parse(introduced) fixed = self.fixed return true if fixed.nil? fixed.present? && introduced_version < PkgVersion.parse(fixed) rescue ArgumentError false end |